Skip to content

Commit a339bf8

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum_acl: Pass hints priv all the way to ERP code
The hints priv comes from ERP code and it is possible to obtain it from TCAM code. Add arg to appropriate functions so the hints priv could be passed back down to ERP code. Pass NULL now as the follow-up patches would pass an actual hints priv pointer. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 29a2102 commit a339bf8

File tree

7 files changed

+22
-11
lines changed

7 files changed

+22
-11
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ struct mlxsw_sp_acl_tcam_ops {
704704
size_t region_priv_size;
705705
int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv,
706706
void *tcam_priv,
707-
struct mlxsw_sp_acl_tcam_region *region);
707+
struct mlxsw_sp_acl_tcam_region *region,
708+
void *hints_priv);
708709
void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv);
709710
int (*region_associate)(struct mlxsw_sp *mlxsw_sp,
710711
struct mlxsw_sp_acl_tcam_region *region);

drivers/net/ethernet/mellanox/mlxsw/spectrum1_acl_tcam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ mlxsw_sp1_acl_ctcam_region_catchall_del(struct mlxsw_sp *mlxsw_sp,
112112
static int
113113
mlxsw_sp1_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
114114
void *tcam_priv,
115-
struct mlxsw_sp_acl_tcam_region *_region)
115+
struct mlxsw_sp_acl_tcam_region *_region,
116+
void *hints_priv)
116117
{
117118
struct mlxsw_sp1_acl_tcam_region *region = region_priv;
118119
int err;

drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,17 @@ static void mlxsw_sp2_acl_tcam_fini(struct mlxsw_sp *mlxsw_sp, void *priv)
139139
static int
140140
mlxsw_sp2_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
141141
void *tcam_priv,
142-
struct mlxsw_sp_acl_tcam_region *_region)
142+
struct mlxsw_sp_acl_tcam_region *_region,
143+
void *hints_priv)
143144
{
144145
struct mlxsw_sp2_acl_tcam_region *region = region_priv;
145146
struct mlxsw_sp2_acl_tcam *tcam = tcam_priv;
146147

147148
region->region = _region;
148149

149150
return mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &tcam->atcam,
150-
&region->aregion, _region,
151+
&region->aregion,
152+
_region, hints_priv,
151153
&mlxsw_sp2_acl_ctcam_region_ops);
152154
}
153155

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
318318
struct mlxsw_sp_acl_atcam *atcam,
319319
struct mlxsw_sp_acl_atcam_region *aregion,
320320
struct mlxsw_sp_acl_tcam_region *region,
321+
void *hints_priv,
321322
const struct mlxsw_sp_acl_ctcam_region_ops *ops)
322323
{
323324
int err;
@@ -334,7 +335,7 @@ mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
334335
err = aregion->ops->init(aregion);
335336
if (err)
336337
goto err_ops_init;
337-
err = mlxsw_sp_acl_erp_region_init(aregion);
338+
err = mlxsw_sp_acl_erp_region_init(aregion, hints_priv);
338339
if (err)
339340
goto err_erp_region_init;
340341
err = mlxsw_sp_acl_ctcam_region_init(mlxsw_sp, &aregion->cregion,

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,8 @@ static const struct objagg_ops mlxsw_sp_acl_erp_objagg_ops = {
13131313
};
13141314

13151315
static struct mlxsw_sp_acl_erp_table *
1316-
mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion)
1316+
mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion,
1317+
struct objagg_hints *hints)
13171318
{
13181319
struct mlxsw_sp_acl_erp_table *erp_table;
13191320
int err;
@@ -1323,7 +1324,7 @@ mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion)
13231324
return ERR_PTR(-ENOMEM);
13241325

13251326
erp_table->objagg = objagg_create(&mlxsw_sp_acl_erp_objagg_ops,
1326-
NULL, aregion);
1327+
hints, aregion);
13271328
if (IS_ERR(erp_table->objagg)) {
13281329
err = PTR_ERR(erp_table->objagg);
13291330
goto err_objagg_create;
@@ -1444,12 +1445,14 @@ void mlxsw_sp_acl_erp_rehash_hints_put(void *hints_priv)
14441445
objagg_hints_put(hints);
14451446
}
14461447

1447-
int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion)
1448+
int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion,
1449+
void *hints_priv)
14481450
{
14491451
struct mlxsw_sp_acl_erp_table *erp_table;
1452+
struct objagg_hints *hints = hints_priv;
14501453
int err;
14511454

1452-
erp_table = mlxsw_sp_acl_erp_table_create(aregion);
1455+
erp_table = mlxsw_sp_acl_erp_table_create(aregion, hints);
14531456
if (IS_ERR(erp_table))
14541457
return PTR_ERR(erp_table);
14551458
aregion->erp_table = erp_table;

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp,
572572
if (err)
573573
goto err_tcam_region_enable;
574574

575-
err = ops->region_init(mlxsw_sp, region->priv, tcam->priv, region);
575+
err = ops->region_init(mlxsw_sp, region->priv, tcam->priv,
576+
region, NULL);
576577
if (err)
577578
goto err_tcam_region_init;
578579

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
206206
struct mlxsw_sp_acl_atcam *atcam,
207207
struct mlxsw_sp_acl_atcam_region *aregion,
208208
struct mlxsw_sp_acl_tcam_region *region,
209+
void *hints_priv,
209210
const struct mlxsw_sp_acl_ctcam_region_ops *ops);
210211
void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion);
211212
void mlxsw_sp_acl_atcam_chunk_init(struct mlxsw_sp_acl_atcam_region *aregion,
@@ -265,7 +266,8 @@ void mlxsw_sp_acl_erp_bf_remove(struct mlxsw_sp *mlxsw_sp,
265266
void *
266267
mlxsw_sp_acl_erp_rehash_hints_get(struct mlxsw_sp_acl_atcam_region *aregion);
267268
void mlxsw_sp_acl_erp_rehash_hints_put(void *hints_priv);
268-
int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion);
269+
int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion,
270+
void *hints_priv);
269271
void mlxsw_sp_acl_erp_region_fini(struct mlxsw_sp_acl_atcam_region *aregion);
270272
int mlxsw_sp_acl_erps_init(struct mlxsw_sp *mlxsw_sp,
271273
struct mlxsw_sp_acl_atcam *atcam);

0 commit comments

Comments
 (0)