Lines Matching +full:value +full:- +full:start
1 // SPDX-License-Identifier: GPL-2.0+
7 * https://github.com/microchip-ung/sparx-5_reginfo
66 .vtype = VCAP_TYPE_IS0, /* CLM-0 */
72 .last_cid = SPARX5_VCAP_CID_IS0_L2 - 1,
73 .blockno = 8, /* Maps block 8-9 */
78 .vtype = VCAP_TYPE_IS0, /* CLM-1 */
84 .last_cid = SPARX5_VCAP_CID_IS0_L4 - 1,
85 .blockno = 6, /* Maps block 6-7 */
90 .vtype = VCAP_TYPE_IS0, /* CLM-2 */
97 .blockno = 4, /* Maps block 4-5 */
102 .vtype = VCAP_TYPE_IS2, /* IS2-0 */
108 .last_cid = SPARX5_VCAP_CID_IS2_L2 - 1,
109 .blockno = 0, /* Maps block 0-1 */
114 .vtype = VCAP_TYPE_IS2, /* IS2-1 */
121 .blockno = 2, /* Maps block 2-3 */
173 fname, sparx5_vcaps[admin->vtype].name); in sparx5_vcap_type_err()
179 u32 value; in sparx5_vcap_wait_super_update() local
181 read_poll_timeout(spx5_rd, value, in sparx5_vcap_wait_super_update()
182 !VCAP_SUPER_CTRL_UPDATE_SHOT_GET(value), 500, 10000, in sparx5_vcap_wait_super_update()
189 u32 value; in sparx5_vcap_wait_es0_update() local
191 read_poll_timeout(spx5_rd, value, in sparx5_vcap_wait_es0_update()
192 !VCAP_ES0_CTRL_UPDATE_SHOT_GET(value), 500, 10000, in sparx5_vcap_wait_es0_update()
199 u32 value; in sparx5_vcap_wait_es2_update() local
201 read_poll_timeout(spx5_rd, value, in sparx5_vcap_wait_es2_update()
202 !VCAP_ES2_CTRL_UPDATE_SHOT_GET(value), 500, 10000, in sparx5_vcap_wait_es2_update()
211 u32 size = count - 1; in _sparx5_vcap_range_init()
213 switch (admin->vtype) { in _sparx5_vcap_range_init()
267 _sparx5_vcap_range_init(sparx5, admin, admin->first_valid_addr, in sparx5_vcap_block_init()
268 admin->last_valid_addr - in sparx5_vcap_block_init()
269 admin->first_valid_addr); in sparx5_vcap_block_init()
278 return vcap_keyset_name(port->sparx5->vcap_ctrl, keyset); in sparx5_vcap_keyset_name()
284 return (rule->vcap_chain_id >= SPARX5_VCAP_CID_IS0_L0 && in sparx5_vcap_is0_is_first_chain()
285 rule->vcap_chain_id < SPARX5_VCAP_CID_IS0_L1) || in sparx5_vcap_is0_is_first_chain()
286 ((rule->vcap_chain_id >= SPARX5_VCAP_CID_IS0_L2 && in sparx5_vcap_is0_is_first_chain()
287 rule->vcap_chain_id < SPARX5_VCAP_CID_IS0_L3)) || in sparx5_vcap_is0_is_first_chain()
288 ((rule->vcap_chain_id >= SPARX5_VCAP_CID_IS0_L4 && in sparx5_vcap_is0_is_first_chain()
289 rule->vcap_chain_id < SPARX5_VCAP_CID_IS0_L5)); in sparx5_vcap_is0_is_first_chain()
295 return (rule->vcap_chain_id >= SPARX5_VCAP_CID_IS2_L0 && in sparx5_vcap_is2_is_first_chain()
296 rule->vcap_chain_id < SPARX5_VCAP_CID_IS2_L1) || in sparx5_vcap_is2_is_first_chain()
297 ((rule->vcap_chain_id >= SPARX5_VCAP_CID_IS2_L2 && in sparx5_vcap_is2_is_first_chain()
298 rule->vcap_chain_id < SPARX5_VCAP_CID_IS2_L3)); in sparx5_vcap_is2_is_first_chain()
303 return (rule->vcap_chain_id >= SPARX5_VCAP_CID_ES2_L0 && in sparx5_vcap_es2_is_first_chain()
304 rule->vcap_chain_id < SPARX5_VCAP_CID_ES2_L1); in sparx5_vcap_es2_is_first_chain()
315 range = port->portno / BITS_PER_TYPE(u32); in sparx5_vcap_add_ingress_range_port_mask()
316 /* Port bit set to match-any */ in sparx5_vcap_add_ingress_range_port_mask()
317 port_mask = ~BIT(port->portno % BITS_PER_TYPE(u32)); in sparx5_vcap_add_ingress_range_port_mask()
331 /* Port bit set to match-any */ in sparx5_vcap_add_wide_port_mask()
332 memset(port_mask.value, 0, sizeof(port_mask.value)); in sparx5_vcap_add_wide_port_mask()
334 range = port->portno / BITS_PER_BYTE; in sparx5_vcap_add_wide_port_mask()
335 port_mask.mask[range] = ~BIT(port->portno % BITS_PER_BYTE); in sparx5_vcap_add_wide_port_mask()
347 * 0-2: Physical/Logical egress port number 0-31, 32–63, 64. in sparx5_vcap_add_egress_range_port_mask()
348 * 3-5: Virtual Interface Number 0-31, 32-63, 64. in sparx5_vcap_add_egress_range_port_mask()
349 * 6: CPU queue Number 0-7. in sparx5_vcap_add_egress_range_port_mask()
351 * Use physical/logical port ranges (0-2) in sparx5_vcap_add_egress_range_port_mask()
353 range = port->portno / BITS_PER_TYPE(u32); in sparx5_vcap_add_egress_range_port_mask()
354 /* Port bit set to match-any */ in sparx5_vcap_add_egress_range_port_mask()
355 port_mask = ~BIT(port->portno % BITS_PER_TYPE(u32)); in sparx5_vcap_add_egress_range_port_mask()
408 u32 value) in sparx5_vcap_is0_get_port_etype_keysets() argument
410 switch (ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL_GET(value)) { in sparx5_vcap_is0_get_port_etype_keysets()
427 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_is0_get_port_keysets()
428 int portno = port->portno; in sparx5_vcap_is0_get_port_keysets()
429 u32 value; in sparx5_vcap_is0_get_port_keysets() local
431 value = spx5_rd(sparx5, ANA_CL_ADV_CL_CFG(portno, lookup)); in sparx5_vcap_is0_get_port_keysets()
435 sparx5_vcap_is0_get_port_etype_keysets(keysetlist, value); in sparx5_vcap_is0_get_port_keysets()
438 switch (ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL_GET(value)) { in sparx5_vcap_is0_get_port_keysets()
441 value); in sparx5_vcap_is0_get_port_keysets()
454 switch (ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL_GET(value)) { in sparx5_vcap_is0_get_port_keysets()
457 value); in sparx5_vcap_is0_get_port_keysets()
470 sparx5_vcap_is0_get_port_etype_keysets(keysetlist, value); in sparx5_vcap_is0_get_port_keysets()
481 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_is2_get_port_keysets()
482 int portno = port->portno; in sparx5_vcap_is2_get_port_keysets()
483 u32 value; in sparx5_vcap_is2_get_port_keysets() local
485 value = spx5_rd(sparx5, ANA_ACL_VCAP_S2_KEY_SEL(portno, lookup)); in sparx5_vcap_is2_get_port_keysets()
489 switch (ANA_ACL_VCAP_S2_KEY_SEL_ARP_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
500 switch (ANA_ACL_VCAP_S2_KEY_SEL_IP4_UC_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
513 switch (ANA_ACL_VCAP_S2_KEY_SEL_IP4_MC_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
528 switch (ANA_ACL_VCAP_S2_KEY_SEL_IP6_UC_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
544 switch (ANA_ACL_VCAP_S2_KEY_SEL_IP6_MC_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
566 switch (ANA_ACL_VCAP_S2_KEY_SEL_NON_ETH_KEY_SEL_GET(value)) { in sparx5_vcap_is2_get_port_keysets()
568 /* IS2 non-classified frames generate MAC_ETYPE */ in sparx5_vcap_is2_get_port_keysets()
579 u32 value) in sparx5_vcap_es2_get_port_ipv4_keysets() argument
581 switch (EACL_VCAP_ES2_KEY_SEL_IP4_KEY_SEL_GET(value)) { in sparx5_vcap_es2_get_port_ipv4_keysets()
610 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_es0_get_port_keysets()
611 int portno = port->portno; in sparx5_vcap_es0_get_port_keysets()
612 u32 value; in sparx5_vcap_es0_get_port_keysets() local
614 value = spx5_rd(sparx5, REW_RTAG_ETAG_CTRL(portno)); in sparx5_vcap_es0_get_port_keysets()
617 switch (REW_RTAG_ETAG_CTRL_ES0_ISDX_KEY_ENA_GET(value)) { in sparx5_vcap_es0_get_port_keysets()
635 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_es2_get_port_keysets()
636 int portno = port->portno; in sparx5_vcap_es2_get_port_keysets()
637 u32 value; in sparx5_vcap_es2_get_port_keysets() local
639 value = spx5_rd(sparx5, EACL_VCAP_ES2_KEY_SEL(portno, lookup)); in sparx5_vcap_es2_get_port_keysets()
643 switch (EACL_VCAP_ES2_KEY_SEL_ARP_KEY_SEL_GET(value)) { in sparx5_vcap_es2_get_port_keysets()
654 sparx5_vcap_es2_get_port_ipv4_keysets(keysetlist, value); in sparx5_vcap_es2_get_port_keysets()
657 switch (EACL_VCAP_ES2_KEY_SEL_IP6_KEY_SEL_GET(value)) { in sparx5_vcap_es2_get_port_keysets()
679 value); in sparx5_vcap_es2_get_port_keysets()
698 int lookup, err = -EINVAL; in sparx5_vcap_get_port_keyset()
701 switch (admin->vtype) { in sparx5_vcap_get_port_keyset()
722 sparx5_vcap_type_err(port->sparx5, admin, __func__); in sparx5_vcap_get_port_keyset()
734 switch (admin->vtype) { in sparx5_vcap_is_known_etype()
771 if (!kslist || kslist->cnt == 0) in sparx5_vcap_validate_keyset()
778 switch (admin->vtype) { in sparx5_vcap_validate_keyset()
780 lookup = sparx5_vcap_is0_cid_to_lookup(rule->vcap_chain_id); in sparx5_vcap_validate_keyset()
785 lookup = sparx5_vcap_is2_cid_to_lookup(rule->vcap_chain_id); in sparx5_vcap_validate_keyset()
793 lookup = sparx5_vcap_es2_cid_to_lookup(rule->vcap_chain_id); in sparx5_vcap_validate_keyset()
799 sparx5_vcap_type_err(port->sparx5, admin, __func__); in sparx5_vcap_validate_keyset()
804 for (idx = 0; idx < kslist->cnt; ++idx) in sparx5_vcap_validate_keyset()
806 if (kslist->keysets[idx] == keysets[jdx]) in sparx5_vcap_validate_keyset()
807 return kslist->keysets[idx]; in sparx5_vcap_validate_keyset()
811 sparx5_vcap_keyset_name(ndev, kslist->keysets[0])); in sparx5_vcap_validate_keyset()
813 return -ENOENT; in sparx5_vcap_validate_keyset()
825 if (field && field->width == SPX5_PORTS) in sparx5_vcap_ingress_add_default_fields()
827 else if (field && field->width == BITS_PER_TYPE(u32)) in sparx5_vcap_ingress_add_default_fields()
832 sparx5_vcap_keyset_name(ndev, rule->keyset)); in sparx5_vcap_ingress_add_default_fields()
834 if (admin->vtype == VCAP_TYPE_IS0) in sparx5_vcap_ingress_add_default_fields()
854 vcap_rule_add_key_u32(rule, VCAP_KF_IF_EGR_PORT_NO, port->portno, ~0); in sparx5_vcap_es0_add_default_fields()
891 switch (admin->vtype) { in sparx5_vcap_add_default_fields()
904 sparx5_vcap_type_err(port->sparx5, admin, __func__); in sparx5_vcap_add_default_fields()
912 memset(admin->cache.keystream, 0, STREAMSIZE); in sparx5_vcap_cache_erase()
913 memset(admin->cache.maskstream, 0, STREAMSIZE); in sparx5_vcap_cache_erase()
914 memset(admin->cache.actionstream, 0, STREAMSIZE); in sparx5_vcap_cache_erase()
915 memset(&admin->cache.counter, 0, sizeof(admin->cache.counter)); in sparx5_vcap_cache_erase()
921 u32 start, in sparx5_vcap_is0_cache_write() argument
927 keystr = &admin->cache.keystream[start]; in sparx5_vcap_is0_cache_write()
928 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_is0_cache_write()
929 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_is0_cache_write()
934 /* Avoid 'match-off' by setting value & mask */ in sparx5_vcap_is0_cache_write()
955 spx5_wr(admin->cache.counter, sparx5, in sparx5_vcap_is0_cache_write()
962 u32 start, in sparx5_vcap_is2_cache_write() argument
968 keystr = &admin->cache.keystream[start]; in sparx5_vcap_is2_cache_write()
969 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_is2_cache_write()
970 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_is2_cache_write()
975 /* Avoid 'match-off' by setting value & mask */ in sparx5_vcap_is2_cache_write()
995 start = start & 0xfff; /* counter limit */ in sparx5_vcap_is2_cache_write()
996 if (admin->vinst == 0) in sparx5_vcap_is2_cache_write()
997 spx5_wr(admin->cache.counter, sparx5, in sparx5_vcap_is2_cache_write()
998 ANA_ACL_CNT_A(start)); in sparx5_vcap_is2_cache_write()
1000 spx5_wr(admin->cache.counter, sparx5, in sparx5_vcap_is2_cache_write()
1001 ANA_ACL_CNT_B(start)); in sparx5_vcap_is2_cache_write()
1002 spx5_wr(admin->cache.sticky, sparx5, in sparx5_vcap_is2_cache_write()
1011 mutex_lock(&sparx5->queue_stats_lock); in sparx5_es0_write_esdx_counter()
1013 spx5_wr(admin->cache.counter, sparx5, in sparx5_es0_write_esdx_counter()
1016 mutex_unlock(&sparx5->queue_stats_lock); in sparx5_es0_write_esdx_counter()
1022 u32 start, in sparx5_vcap_es0_cache_write() argument
1028 keystr = &admin->cache.keystream[start]; in sparx5_vcap_es0_cache_write()
1029 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_es0_cache_write()
1030 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_es0_cache_write()
1035 /* Avoid 'match-off' by setting value & mask */ in sparx5_vcap_es0_cache_write()
1055 spx5_wr(admin->cache.counter, sparx5, VCAP_ES0_VCAP_CNT_DAT(0)); in sparx5_vcap_es0_cache_write()
1056 sparx5_es0_write_esdx_counter(sparx5, admin, start); in sparx5_vcap_es0_cache_write()
1063 u32 start, in sparx5_vcap_es2_cache_write() argument
1069 keystr = &admin->cache.keystream[start]; in sparx5_vcap_es2_cache_write()
1070 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_es2_cache_write()
1071 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_es2_cache_write()
1076 /* Avoid 'match-off' by setting value & mask */ in sparx5_vcap_es2_cache_write()
1096 start = start & 0x7ff; /* counter limit */ in sparx5_vcap_es2_cache_write()
1097 spx5_wr(admin->cache.counter, sparx5, EACL_ES2_CNT(start)); in sparx5_vcap_es2_cache_write()
1098 spx5_wr(admin->cache.sticky, sparx5, VCAP_ES2_VCAP_CNT_DAT(0)); in sparx5_vcap_es2_cache_write()
1106 u32 start, in sparx5_vcap_cache_write() argument
1110 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_cache_write()
1112 switch (admin->vtype) { in sparx5_vcap_cache_write()
1114 sparx5_vcap_is0_cache_write(sparx5, admin, sel, start, count); in sparx5_vcap_cache_write()
1117 sparx5_vcap_is2_cache_write(sparx5, admin, sel, start, count); in sparx5_vcap_cache_write()
1120 sparx5_vcap_es0_cache_write(sparx5, admin, sel, start, count); in sparx5_vcap_cache_write()
1123 sparx5_vcap_es2_cache_write(sparx5, admin, sel, start, count); in sparx5_vcap_cache_write()
1134 u32 start, in sparx5_vcap_is0_cache_read() argument
1140 keystr = &admin->cache.keystream[start]; in sparx5_vcap_is0_cache_read()
1141 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_is0_cache_read()
1142 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_is0_cache_read()
1159 admin->cache.counter = in sparx5_vcap_is0_cache_read()
1161 admin->cache.sticky = in sparx5_vcap_is0_cache_read()
1169 u32 start, in sparx5_vcap_is2_cache_read() argument
1175 keystr = &admin->cache.keystream[start]; in sparx5_vcap_is2_cache_read()
1176 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_is2_cache_read()
1177 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_is2_cache_read()
1194 start = start & 0xfff; /* counter limit */ in sparx5_vcap_is2_cache_read()
1195 if (admin->vinst == 0) in sparx5_vcap_is2_cache_read()
1196 admin->cache.counter = in sparx5_vcap_is2_cache_read()
1197 spx5_rd(sparx5, ANA_ACL_CNT_A(start)); in sparx5_vcap_is2_cache_read()
1199 admin->cache.counter = in sparx5_vcap_is2_cache_read()
1200 spx5_rd(sparx5, ANA_ACL_CNT_B(start)); in sparx5_vcap_is2_cache_read()
1201 admin->cache.sticky = in sparx5_vcap_is2_cache_read()
1212 mutex_lock(&sparx5->queue_stats_lock); in sparx5_es0_read_esdx_counter()
1216 mutex_unlock(&sparx5->queue_stats_lock); in sparx5_es0_read_esdx_counter()
1218 admin->cache.counter = counter; in sparx5_es0_read_esdx_counter()
1224 u32 start, in sparx5_vcap_es0_cache_read() argument
1230 keystr = &admin->cache.keystream[start]; in sparx5_vcap_es0_cache_read()
1231 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_es0_cache_read()
1232 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_es0_cache_read()
1249 admin->cache.counter = in sparx5_vcap_es0_cache_read()
1251 admin->cache.sticky = admin->cache.counter; in sparx5_vcap_es0_cache_read()
1252 sparx5_es0_read_esdx_counter(sparx5, admin, start); in sparx5_vcap_es0_cache_read()
1259 u32 start, in sparx5_vcap_es2_cache_read() argument
1265 keystr = &admin->cache.keystream[start]; in sparx5_vcap_es2_cache_read()
1266 mskstr = &admin->cache.maskstream[start]; in sparx5_vcap_es2_cache_read()
1267 actstr = &admin->cache.actionstream[start]; in sparx5_vcap_es2_cache_read()
1284 start = start & 0x7ff; /* counter limit */ in sparx5_vcap_es2_cache_read()
1285 admin->cache.counter = in sparx5_vcap_es2_cache_read()
1286 spx5_rd(sparx5, EACL_ES2_CNT(start)); in sparx5_vcap_es2_cache_read()
1287 admin->cache.sticky = in sparx5_vcap_es2_cache_read()
1296 u32 start, in sparx5_vcap_cache_read() argument
1300 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_cache_read()
1302 switch (admin->vtype) { in sparx5_vcap_cache_read()
1304 sparx5_vcap_is0_cache_read(sparx5, admin, sel, start, count); in sparx5_vcap_cache_read()
1307 sparx5_vcap_is2_cache_read(sparx5, admin, sel, start, count); in sparx5_vcap_cache_read()
1310 sparx5_vcap_es0_cache_read(sparx5, admin, sel, start, count); in sparx5_vcap_cache_read()
1313 sparx5_vcap_es2_cache_read(sparx5, admin, sel, start, count); in sparx5_vcap_cache_read()
1327 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_range_init()
1395 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_update()
1397 switch (admin->vtype) { in sparx5_vcap_update()
1479 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_move()
1484 mv_size = count - 1; in sparx5_vcap_move()
1486 mv_num_pos = offset - 1; in sparx5_vcap_move()
1489 mv_num_pos = -offset - 1; in sparx5_vcap_move()
1493 switch (admin->vtype) { in sparx5_vcap_move()
1539 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_is0_set_port_keyset()
1540 int portno = port->portno; in sparx5_vcap_is0_set_port_keyset()
1541 u32 value; in sparx5_vcap_is0_set_port_keyset() local
1545 value = sparx5_vcap_is0_keyset_to_etype_ps(keyset); in sparx5_vcap_is0_set_port_keyset()
1546 spx5_rmw(ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL_SET(value), in sparx5_vcap_is0_set_port_keyset()
1552 value = sparx5_vcap_is0_keyset_to_etype_ps(keyset); in sparx5_vcap_is0_set_port_keyset()
1553 spx5_rmw(ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL_SET(value), in sparx5_vcap_is0_set_port_keyset()
1559 value = sparx5_vcap_is0_keyset_to_etype_ps(keyset); in sparx5_vcap_is0_set_port_keyset()
1560 spx5_rmw(ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL_SET(value), in sparx5_vcap_is0_set_port_keyset()
1628 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_is2_set_port_keyset()
1629 int portno = port->portno; in sparx5_vcap_is2_set_port_keyset()
1630 u32 value; in sparx5_vcap_is2_set_port_keyset() local
1634 value = sparx5_vcap_is2_keyset_to_arp_ps(keyset); in sparx5_vcap_is2_set_port_keyset()
1635 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_ARP_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1641 value = sparx5_vcap_is2_keyset_to_ipv4_ps(keyset); in sparx5_vcap_is2_set_port_keyset()
1642 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_IP4_UC_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1646 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_IP4_MC_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1652 value = sparx5_vcap_is2_keyset_to_ipv6_uc_ps(keyset); in sparx5_vcap_is2_set_port_keyset()
1653 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_IP6_UC_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1657 value = sparx5_vcap_is2_keyset_to_ipv6_mc_ps(keyset); in sparx5_vcap_is2_set_port_keyset()
1658 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_IP6_MC_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1664 value = VCAP_IS2_PS_NONETH_MAC_ETYPE; in sparx5_vcap_is2_set_port_keyset()
1665 spx5_rmw(ANA_ACL_VCAP_S2_KEY_SEL_NON_ETH_KEY_SEL_SET(value), in sparx5_vcap_is2_set_port_keyset()
1721 struct sparx5 *sparx5 = port->sparx5; in sparx5_vcap_es2_set_port_keyset()
1722 int portno = port->portno; in sparx5_vcap_es2_set_port_keyset()
1723 u32 value; in sparx5_vcap_es2_set_port_keyset() local
1727 value = sparx5_vcap_es2_keyset_to_ipv4_ps(keyset); in sparx5_vcap_es2_set_port_keyset()
1728 spx5_rmw(EACL_VCAP_ES2_KEY_SEL_IP4_KEY_SEL_SET(value), in sparx5_vcap_es2_set_port_keyset()
1734 value = sparx5_vcap_es2_keyset_to_ipv6_ps(keyset); in sparx5_vcap_es2_set_port_keyset()
1735 spx5_rmw(EACL_VCAP_ES2_KEY_SEL_IP6_KEY_SEL_SET(value), in sparx5_vcap_es2_set_port_keyset()
1741 value = sparx5_vcap_es2_keyset_to_arp_ps(keyset); in sparx5_vcap_es2_set_port_keyset()
1742 spx5_rmw(EACL_VCAP_ES2_KEY_SEL_ARP_KEY_SEL_SET(value), in sparx5_vcap_es2_set_port_keyset()
1761 switch (admin->vtype) { in sparx5_vcap_set_port_keyset()
1787 sparx5_vcap_type_err(port->sparx5, admin, __func__); in sparx5_vcap_set_port_keyset()
1806 for (lookup = 0; lookup < admin->lookups; ++lookup) { in sparx5_vcap_is0_port_key_selection()
1831 for (lookup = 0; lookup < admin->lookups; ++lookup) { in sparx5_vcap_is2_port_key_selection()
1871 for (lookup = 0; lookup < admin->lookups; ++lookup) in sparx5_vcap_es2_port_key_selection()
1881 switch (admin->vtype) { in sparx5_vcap_port_key_selection()
1906 switch (admin->vtype) { in sparx5_vcap_port_key_deselection()
1908 for (lookup = 0; lookup < admin->lookups; ++lookup) in sparx5_vcap_port_key_deselection()
1927 for (lookup = 0; lookup < admin->lookups; ++lookup) in sparx5_vcap_port_key_deselection()
1944 mutex_destroy(&admin->lock); in sparx5_vcap_admin_free()
1945 kfree(admin->cache.keystream); in sparx5_vcap_admin_free()
1946 kfree(admin->cache.maskstream); in sparx5_vcap_admin_free()
1947 kfree(admin->cache.actionstream); in sparx5_vcap_admin_free()
1960 return ERR_PTR(-ENOMEM); in sparx5_vcap_admin_alloc()
1961 INIT_LIST_HEAD(&admin->list); in sparx5_vcap_admin_alloc()
1962 INIT_LIST_HEAD(&admin->rules); in sparx5_vcap_admin_alloc()
1963 INIT_LIST_HEAD(&admin->enabled); in sparx5_vcap_admin_alloc()
1964 mutex_init(&admin->lock); in sparx5_vcap_admin_alloc()
1965 admin->vtype = cfg->vtype; in sparx5_vcap_admin_alloc()
1966 admin->vinst = cfg->vinst; in sparx5_vcap_admin_alloc()
1967 admin->ingress = cfg->ingress; in sparx5_vcap_admin_alloc()
1968 admin->lookups = cfg->lookups; in sparx5_vcap_admin_alloc()
1969 admin->lookups_per_instance = cfg->lookups_per_instance; in sparx5_vcap_admin_alloc()
1970 admin->first_cid = cfg->first_cid; in sparx5_vcap_admin_alloc()
1971 admin->last_cid = cfg->last_cid; in sparx5_vcap_admin_alloc()
1972 admin->cache.keystream = in sparx5_vcap_admin_alloc()
1974 admin->cache.maskstream = in sparx5_vcap_admin_alloc()
1976 admin->cache.actionstream = in sparx5_vcap_admin_alloc()
1978 if (!admin->cache.keystream || !admin->cache.maskstream || in sparx5_vcap_admin_alloc()
1979 !admin->cache.actionstream) { in sparx5_vcap_admin_alloc()
1981 return ERR_PTR(-ENOMEM); in sparx5_vcap_admin_alloc()
1993 switch (admin->vtype) { in sparx5_vcap_block_alloc()
2000 for (idx = cfg->blockno; idx < cfg->blockno + cfg->blocks; in sparx5_vcap_block_alloc()
2004 spx5_wr(VCAP_SUPER_MAP_CORE_MAP_SET(cfg->map_id), in sparx5_vcap_block_alloc()
2007 admin->first_valid_addr = cfg->blockno * SUPER_VCAP_BLK_SIZE; in sparx5_vcap_block_alloc()
2008 admin->last_used_addr = admin->first_valid_addr + in sparx5_vcap_block_alloc()
2009 cfg->blocks * SUPER_VCAP_BLK_SIZE; in sparx5_vcap_block_alloc()
2010 admin->last_valid_addr = admin->last_used_addr - 1; in sparx5_vcap_block_alloc()
2013 admin->first_valid_addr = 0; in sparx5_vcap_block_alloc()
2014 admin->last_used_addr = cfg->count; in sparx5_vcap_block_alloc()
2015 admin->last_valid_addr = cfg->count - 1; in sparx5_vcap_block_alloc()
2025 admin->first_valid_addr = 0; in sparx5_vcap_block_alloc()
2026 admin->last_used_addr = cfg->count; in sparx5_vcap_block_alloc()
2027 admin->last_valid_addr = cfg->count - 1; in sparx5_vcap_block_alloc()
2054 * - Create administrative state for each available VCAP in sparx5_vcap_init()
2055 * - Lists of rules in sparx5_vcap_init()
2056 * - Address information in sparx5_vcap_init()
2057 * - Initialize VCAP blocks in sparx5_vcap_init()
2058 * - Configure port keysets in sparx5_vcap_init()
2062 return -ENOMEM; in sparx5_vcap_init()
2064 sparx5->vcap_ctrl = ctrl; in sparx5_vcap_init()
2066 ctrl->vcaps = sparx5_vcaps; in sparx5_vcap_init()
2067 ctrl->stats = &sparx5_vcap_stats; in sparx5_vcap_init()
2069 ctrl->ops = &sparx5_vcap_ops; in sparx5_vcap_init()
2071 INIT_LIST_HEAD(&ctrl->list); in sparx5_vcap_init()
2083 if (cfg->vinst == 0) in sparx5_vcap_init()
2085 list_add_tail(&admin->list, &ctrl->list); in sparx5_vcap_init()
2087 dir = vcap_debugfs(sparx5->dev, sparx5->debugfs_root, ctrl); in sparx5_vcap_init()
2089 if (sparx5->ports[idx]) in sparx5_vcap_init()
2090 vcap_port_debugfs(sparx5->dev, dir, ctrl, in sparx5_vcap_init()
2091 sparx5->ports[idx]->ndev); in sparx5_vcap_init()
2098 struct vcap_control *ctrl = sparx5->vcap_ctrl; in sparx5_vcap_destroy()
2104 list_for_each_entry_safe(admin, admin_next, &ctrl->list, list) { in sparx5_vcap_destroy()
2107 list_del(&admin->list); in sparx5_vcap_destroy()