.. | .. |
---|
17 | 17 | unsigned long *used_groups; /* bit array */ |
---|
18 | 18 | unsigned int max_groups; |
---|
19 | 19 | unsigned int max_group_size; |
---|
20 | | - unsigned long priv[0]; |
---|
| 20 | + struct mutex lock; /* guards vregion list */ |
---|
| 21 | + struct list_head vregion_list; |
---|
| 22 | + u32 vregion_rehash_intrvl; /* ms */ |
---|
| 23 | + unsigned long priv[]; |
---|
21 | 24 | /* priv has to be always the last item */ |
---|
22 | 25 | }; |
---|
23 | 26 | |
---|
.. | .. |
---|
26 | 29 | struct mlxsw_sp_acl_tcam *tcam); |
---|
27 | 30 | void mlxsw_sp_acl_tcam_fini(struct mlxsw_sp *mlxsw_sp, |
---|
28 | 31 | struct mlxsw_sp_acl_tcam *tcam); |
---|
| 32 | +u32 mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get(struct mlxsw_sp *mlxsw_sp, |
---|
| 33 | + struct mlxsw_sp_acl_tcam *tcam); |
---|
| 34 | +int mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set(struct mlxsw_sp *mlxsw_sp, |
---|
| 35 | + struct mlxsw_sp_acl_tcam *tcam, |
---|
| 36 | + u32 val); |
---|
29 | 37 | int mlxsw_sp_acl_tcam_priority_get(struct mlxsw_sp *mlxsw_sp, |
---|
30 | 38 | struct mlxsw_sp_acl_rule_info *rulei, |
---|
31 | 39 | u32 *priority, bool fillup_priority); |
---|
.. | .. |
---|
34 | 42 | size_t ruleset_priv_size; |
---|
35 | 43 | int (*ruleset_add)(struct mlxsw_sp *mlxsw_sp, |
---|
36 | 44 | struct mlxsw_sp_acl_tcam *tcam, void *ruleset_priv, |
---|
37 | | - struct mlxsw_afk_element_usage *tmplt_elusage); |
---|
| 45 | + struct mlxsw_afk_element_usage *tmplt_elusage, |
---|
| 46 | + unsigned int *p_min_prio, unsigned int *p_max_prio); |
---|
38 | 47 | void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); |
---|
39 | 48 | int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, |
---|
40 | 49 | struct mlxsw_sp_port *mlxsw_sp_port, |
---|
.. | .. |
---|
43 | 52 | struct mlxsw_sp_port *mlxsw_sp_port, |
---|
44 | 53 | bool ingress); |
---|
45 | 54 | u16 (*ruleset_group_id)(void *ruleset_priv); |
---|
46 | | - size_t (*rule_priv_size)(struct mlxsw_sp *mlxsw_sp); |
---|
| 55 | + size_t rule_priv_size; |
---|
47 | 56 | int (*rule_add)(struct mlxsw_sp *mlxsw_sp, |
---|
48 | 57 | void *ruleset_priv, void *rule_priv, |
---|
49 | 58 | struct mlxsw_sp_acl_rule_info *rulei); |
---|
50 | 59 | void (*rule_del)(struct mlxsw_sp *mlxsw_sp, void *rule_priv); |
---|
| 60 | + int (*rule_action_replace)(struct mlxsw_sp *mlxsw_sp, void *rule_priv, |
---|
| 61 | + struct mlxsw_sp_acl_rule_info *rulei); |
---|
51 | 62 | int (*rule_activity_get)(struct mlxsw_sp *mlxsw_sp, void *rule_priv, |
---|
52 | 63 | bool *activity); |
---|
53 | 64 | }; |
---|
.. | .. |
---|
65 | 76 | (MLXSW_REG_PTCEX_FLEX_KEY_BLOCKS_LEN * BITS_PER_BYTE) |
---|
66 | 77 | |
---|
67 | 78 | struct mlxsw_sp_acl_tcam_group; |
---|
| 79 | +struct mlxsw_sp_acl_tcam_vregion; |
---|
68 | 80 | |
---|
69 | 81 | struct mlxsw_sp_acl_tcam_region { |
---|
70 | | - struct list_head list; /* Member of a TCAM group */ |
---|
71 | | - struct list_head chunk_list; /* List of chunks under this region */ |
---|
| 82 | + struct mlxsw_sp_acl_tcam_vregion *vregion; |
---|
72 | 83 | struct mlxsw_sp_acl_tcam_group *group; |
---|
| 84 | + struct list_head list; /* Member of a TCAM group */ |
---|
73 | 85 | enum mlxsw_reg_ptar_key_type key_type; |
---|
74 | 86 | u16 id; /* ACL ID and region ID - they are same */ |
---|
75 | 87 | char tcam_region_info[MLXSW_REG_PXXX_TCAM_REGION_INFO_LEN]; |
---|
76 | 88 | struct mlxsw_afk_key_info *key_info; |
---|
77 | 89 | struct mlxsw_sp *mlxsw_sp; |
---|
78 | | - unsigned long priv[0]; |
---|
| 90 | + unsigned long priv[]; |
---|
79 | 91 | /* priv has to be always the last item */ |
---|
80 | 92 | }; |
---|
81 | 93 | |
---|
.. | .. |
---|
121 | 133 | struct mlxsw_sp_acl_ctcam_region *cregion, |
---|
122 | 134 | struct mlxsw_sp_acl_ctcam_chunk *cchunk, |
---|
123 | 135 | struct mlxsw_sp_acl_ctcam_entry *centry); |
---|
| 136 | +int mlxsw_sp_acl_ctcam_entry_action_replace(struct mlxsw_sp *mlxsw_sp, |
---|
| 137 | + struct mlxsw_sp_acl_ctcam_region *cregion, |
---|
| 138 | + struct mlxsw_sp_acl_ctcam_entry *centry, |
---|
| 139 | + struct mlxsw_sp_acl_rule_info *rulei); |
---|
124 | 140 | static inline unsigned int |
---|
125 | 141 | mlxsw_sp_acl_ctcam_entry_offset(struct mlxsw_sp_acl_ctcam_entry *centry) |
---|
126 | 142 | { |
---|
.. | .. |
---|
144 | 160 | |
---|
145 | 161 | struct mlxsw_sp_acl_atcam_region { |
---|
146 | 162 | struct rhashtable entries_ht; /* A-TCAM only */ |
---|
| 163 | + struct list_head entries_list; /* A-TCAM only */ |
---|
147 | 164 | struct mlxsw_sp_acl_ctcam_region cregion; |
---|
148 | 165 | const struct mlxsw_sp_acl_atcam_region_ops *ops; |
---|
149 | 166 | struct mlxsw_sp_acl_tcam_region *region; |
---|
.. | .. |
---|
154 | 171 | }; |
---|
155 | 172 | |
---|
156 | 173 | struct mlxsw_sp_acl_atcam_entry_ht_key { |
---|
157 | | - char enc_key[MLXSW_REG_PTCEX_FLEX_KEY_BLOCKS_LEN]; /* Encoded key */ |
---|
| 174 | + char full_enc_key[MLXSW_REG_PTCEX_FLEX_KEY_BLOCKS_LEN]; /* Encoded |
---|
| 175 | + * key. |
---|
| 176 | + */ |
---|
158 | 177 | u8 erp_id; |
---|
159 | 178 | }; |
---|
160 | 179 | |
---|
.. | .. |
---|
164 | 183 | |
---|
165 | 184 | struct mlxsw_sp_acl_atcam_entry { |
---|
166 | 185 | struct rhash_head ht_node; |
---|
| 186 | + struct list_head list; /* Member in entries_list */ |
---|
167 | 187 | struct mlxsw_sp_acl_atcam_entry_ht_key ht_key; |
---|
| 188 | + char enc_key[MLXSW_REG_PTCEX_FLEX_KEY_BLOCKS_LEN]; /* Encoded key, |
---|
| 189 | + * minus delta bits. |
---|
| 190 | + */ |
---|
| 191 | + struct { |
---|
| 192 | + u16 start; |
---|
| 193 | + u8 mask; |
---|
| 194 | + u8 value; |
---|
| 195 | + } delta_info; |
---|
168 | 196 | struct mlxsw_sp_acl_ctcam_entry centry; |
---|
169 | 197 | struct mlxsw_sp_acl_atcam_lkey_id *lkey_id; |
---|
170 | | - struct mlxsw_sp_acl_erp *erp; |
---|
| 198 | + struct mlxsw_sp_acl_erp_mask *erp_mask; |
---|
171 | 199 | }; |
---|
172 | 200 | |
---|
173 | 201 | static inline struct mlxsw_sp_acl_atcam_region * |
---|
.. | .. |
---|
189 | 217 | struct mlxsw_sp_acl_atcam *atcam, |
---|
190 | 218 | struct mlxsw_sp_acl_atcam_region *aregion, |
---|
191 | 219 | struct mlxsw_sp_acl_tcam_region *region, |
---|
| 220 | + void *hints_priv, |
---|
192 | 221 | const struct mlxsw_sp_acl_ctcam_region_ops *ops); |
---|
193 | 222 | void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion); |
---|
194 | 223 | void mlxsw_sp_acl_atcam_chunk_init(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
.. | .. |
---|
204 | 233 | struct mlxsw_sp_acl_atcam_region *aregion, |
---|
205 | 234 | struct mlxsw_sp_acl_atcam_chunk *achunk, |
---|
206 | 235 | struct mlxsw_sp_acl_atcam_entry *aentry); |
---|
| 236 | +int mlxsw_sp_acl_atcam_entry_action_replace(struct mlxsw_sp *mlxsw_sp, |
---|
| 237 | + struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 238 | + struct mlxsw_sp_acl_atcam_entry *aentry, |
---|
| 239 | + struct mlxsw_sp_acl_rule_info *rulei); |
---|
207 | 240 | int mlxsw_sp_acl_atcam_init(struct mlxsw_sp *mlxsw_sp, |
---|
208 | 241 | struct mlxsw_sp_acl_atcam *atcam); |
---|
209 | 242 | void mlxsw_sp_acl_atcam_fini(struct mlxsw_sp *mlxsw_sp, |
---|
210 | 243 | struct mlxsw_sp_acl_atcam *atcam); |
---|
| 244 | +void * |
---|
| 245 | +mlxsw_sp_acl_atcam_rehash_hints_get(struct mlxsw_sp_acl_atcam_region *aregion); |
---|
| 246 | +void mlxsw_sp_acl_atcam_rehash_hints_put(void *hints_priv); |
---|
211 | 247 | |
---|
212 | | -struct mlxsw_sp_acl_erp; |
---|
| 248 | +struct mlxsw_sp_acl_erp_delta; |
---|
213 | 249 | |
---|
214 | | -bool mlxsw_sp_acl_erp_is_ctcam_erp(const struct mlxsw_sp_acl_erp *erp); |
---|
215 | | -u8 mlxsw_sp_acl_erp_id(const struct mlxsw_sp_acl_erp *erp); |
---|
216 | | -struct mlxsw_sp_acl_erp * |
---|
217 | | -mlxsw_sp_acl_erp_get(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
218 | | - const char *mask, bool ctcam); |
---|
219 | | -void mlxsw_sp_acl_erp_put(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
220 | | - struct mlxsw_sp_acl_erp *erp); |
---|
221 | | -int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion); |
---|
| 250 | +u16 mlxsw_sp_acl_erp_delta_start(const struct mlxsw_sp_acl_erp_delta *delta); |
---|
| 251 | +u8 mlxsw_sp_acl_erp_delta_mask(const struct mlxsw_sp_acl_erp_delta *delta); |
---|
| 252 | +u8 mlxsw_sp_acl_erp_delta_value(const struct mlxsw_sp_acl_erp_delta *delta, |
---|
| 253 | + const char *enc_key); |
---|
| 254 | +void mlxsw_sp_acl_erp_delta_clear(const struct mlxsw_sp_acl_erp_delta *delta, |
---|
| 255 | + const char *enc_key); |
---|
| 256 | + |
---|
| 257 | +struct mlxsw_sp_acl_erp_mask; |
---|
| 258 | + |
---|
| 259 | +bool |
---|
| 260 | +mlxsw_sp_acl_erp_mask_is_ctcam(const struct mlxsw_sp_acl_erp_mask *erp_mask); |
---|
| 261 | +u8 mlxsw_sp_acl_erp_mask_erp_id(const struct mlxsw_sp_acl_erp_mask *erp_mask); |
---|
| 262 | +const struct mlxsw_sp_acl_erp_delta * |
---|
| 263 | +mlxsw_sp_acl_erp_delta(const struct mlxsw_sp_acl_erp_mask *erp_mask); |
---|
| 264 | +struct mlxsw_sp_acl_erp_mask * |
---|
| 265 | +mlxsw_sp_acl_erp_mask_get(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 266 | + const char *mask, bool ctcam); |
---|
| 267 | +void mlxsw_sp_acl_erp_mask_put(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 268 | + struct mlxsw_sp_acl_erp_mask *erp_mask); |
---|
| 269 | +int mlxsw_sp_acl_erp_bf_insert(struct mlxsw_sp *mlxsw_sp, |
---|
| 270 | + struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 271 | + struct mlxsw_sp_acl_erp_mask *erp_mask, |
---|
| 272 | + struct mlxsw_sp_acl_atcam_entry *aentry); |
---|
| 273 | +void mlxsw_sp_acl_erp_bf_remove(struct mlxsw_sp *mlxsw_sp, |
---|
| 274 | + struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 275 | + struct mlxsw_sp_acl_erp_mask *erp_mask, |
---|
| 276 | + struct mlxsw_sp_acl_atcam_entry *aentry); |
---|
| 277 | +void * |
---|
| 278 | +mlxsw_sp_acl_erp_rehash_hints_get(struct mlxsw_sp_acl_atcam_region *aregion); |
---|
| 279 | +void mlxsw_sp_acl_erp_rehash_hints_put(void *hints_priv); |
---|
| 280 | +int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 281 | + void *hints_priv); |
---|
222 | 282 | void mlxsw_sp_acl_erp_region_fini(struct mlxsw_sp_acl_atcam_region *aregion); |
---|
223 | 283 | int mlxsw_sp_acl_erps_init(struct mlxsw_sp *mlxsw_sp, |
---|
224 | 284 | struct mlxsw_sp_acl_atcam *atcam); |
---|
225 | 285 | void mlxsw_sp_acl_erps_fini(struct mlxsw_sp *mlxsw_sp, |
---|
226 | 286 | struct mlxsw_sp_acl_atcam *atcam); |
---|
227 | 287 | |
---|
| 288 | +struct mlxsw_sp_acl_bf; |
---|
| 289 | + |
---|
| 290 | +int |
---|
| 291 | +mlxsw_sp_acl_bf_entry_add(struct mlxsw_sp *mlxsw_sp, |
---|
| 292 | + struct mlxsw_sp_acl_bf *bf, |
---|
| 293 | + struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 294 | + unsigned int erp_bank, |
---|
| 295 | + struct mlxsw_sp_acl_atcam_entry *aentry); |
---|
| 296 | +void |
---|
| 297 | +mlxsw_sp_acl_bf_entry_del(struct mlxsw_sp *mlxsw_sp, |
---|
| 298 | + struct mlxsw_sp_acl_bf *bf, |
---|
| 299 | + struct mlxsw_sp_acl_atcam_region *aregion, |
---|
| 300 | + unsigned int erp_bank, |
---|
| 301 | + struct mlxsw_sp_acl_atcam_entry *aentry); |
---|
| 302 | +struct mlxsw_sp_acl_bf * |
---|
| 303 | +mlxsw_sp_acl_bf_init(struct mlxsw_sp *mlxsw_sp, unsigned int num_erp_banks); |
---|
| 304 | +void mlxsw_sp_acl_bf_fini(struct mlxsw_sp_acl_bf *bf); |
---|
| 305 | + |
---|
228 | 306 | #endif |
---|