forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
....@@ -34,15 +34,15 @@
3434 {
3535 struct mlxsw_sp_acl_atcam_region *aregion;
3636 struct mlxsw_sp_acl_atcam_entry *aentry;
37
- struct mlxsw_sp_acl_erp *erp;
37
+ struct mlxsw_sp_acl_erp_mask *erp_mask;
3838
3939 aregion = mlxsw_sp_acl_tcam_cregion_aregion(cregion);
4040 aentry = mlxsw_sp_acl_tcam_centry_aentry(centry);
4141
42
- erp = mlxsw_sp_acl_erp_get(aregion, mask, true);
43
- if (IS_ERR(erp))
44
- return PTR_ERR(erp);
45
- aentry->erp = erp;
42
+ erp_mask = mlxsw_sp_acl_erp_mask_get(aregion, mask, true);
43
+ if (IS_ERR(erp_mask))
44
+ return PTR_ERR(erp_mask);
45
+ aentry->erp_mask = erp_mask;
4646
4747 return 0;
4848 }
....@@ -57,7 +57,7 @@
5757 aregion = mlxsw_sp_acl_tcam_cregion_aregion(cregion);
5858 aentry = mlxsw_sp_acl_tcam_centry_aentry(centry);
5959
60
- mlxsw_sp_acl_erp_put(aregion, aentry->erp);
60
+ mlxsw_sp_acl_erp_mask_put(aregion, aentry->erp_mask);
6161 }
6262
6363 static const struct mlxsw_sp_acl_ctcam_region_ops
....@@ -139,7 +139,8 @@
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;
....@@ -147,7 +148,8 @@
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
....@@ -164,6 +166,18 @@
164166 struct mlxsw_sp_acl_tcam_region *region)
165167 {
166168 return mlxsw_sp_acl_atcam_region_associate(mlxsw_sp, region->id);
169
+}
170
+
171
+static void *mlxsw_sp2_acl_tcam_region_rehash_hints_get(void *region_priv)
172
+{
173
+ struct mlxsw_sp2_acl_tcam_region *region = region_priv;
174
+
175
+ return mlxsw_sp_acl_atcam_rehash_hints_get(&region->aregion);
176
+}
177
+
178
+static void mlxsw_sp2_acl_tcam_region_rehash_hints_put(void *hints_priv)
179
+{
180
+ mlxsw_sp_acl_atcam_rehash_hints_put(hints_priv);
167181 }
168182
169183 static void mlxsw_sp2_acl_tcam_chunk_init(void *region_priv, void *chunk_priv,
....@@ -211,6 +225,20 @@
211225 }
212226
213227 static int
228
+mlxsw_sp2_acl_tcam_entry_action_replace(struct mlxsw_sp *mlxsw_sp,
229
+ void *region_priv, void *entry_priv,
230
+ struct mlxsw_sp_acl_rule_info *rulei)
231
+{
232
+ struct mlxsw_sp2_acl_tcam_region *region = region_priv;
233
+ struct mlxsw_sp2_acl_tcam_entry *entry = entry_priv;
234
+
235
+ entry->act_block = rulei->act_block;
236
+ return mlxsw_sp_acl_atcam_entry_action_replace(mlxsw_sp,
237
+ &region->aregion,
238
+ &entry->aentry, rulei);
239
+}
240
+
241
+static int
214242 mlxsw_sp2_acl_tcam_entry_activity_get(struct mlxsw_sp *mlxsw_sp,
215243 void *region_priv, void *entry_priv,
216244 bool *activity)
....@@ -229,11 +257,14 @@
229257 .region_init = mlxsw_sp2_acl_tcam_region_init,
230258 .region_fini = mlxsw_sp2_acl_tcam_region_fini,
231259 .region_associate = mlxsw_sp2_acl_tcam_region_associate,
260
+ .region_rehash_hints_get = mlxsw_sp2_acl_tcam_region_rehash_hints_get,
261
+ .region_rehash_hints_put = mlxsw_sp2_acl_tcam_region_rehash_hints_put,
232262 .chunk_priv_size = sizeof(struct mlxsw_sp2_acl_tcam_chunk),
233263 .chunk_init = mlxsw_sp2_acl_tcam_chunk_init,
234264 .chunk_fini = mlxsw_sp2_acl_tcam_chunk_fini,
235265 .entry_priv_size = sizeof(struct mlxsw_sp2_acl_tcam_entry),
236266 .entry_add = mlxsw_sp2_acl_tcam_entry_add,
237267 .entry_del = mlxsw_sp2_acl_tcam_entry_del,
268
+ .entry_action_replace = mlxsw_sp2_acl_tcam_entry_action_replace,
238269 .entry_activity_get = mlxsw_sp2_acl_tcam_entry_activity_get,
239270 };