Lines Matching +full:sparx +full:- +full:5

1 // SPDX-License-Identifier: GPL-2.0+
39 /* SparX-5 VCAP fragment types:
41 * 2 = suspicious fragment, 3 = valid follow-up fragment
57 /* 0/0 0/1 1/0 1/1 <-- first_frag */
65 switch (st->tpid) { in sparx5_tc_flower_es0_tpid()
67 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_es0_tpid()
72 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_es0_tpid()
77 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_flower_es0_tpid()
79 err = -EINVAL; in sparx5_tc_flower_es0_tpid()
91 flow_rule_match_basic(st->frule, &mt); in sparx5_tc_flower_handler_basic_usage()
93 if (mt.mask->n_proto) { in sparx5_tc_flower_handler_basic_usage()
94 st->l3_proto = be16_to_cpu(mt.key->n_proto); in sparx5_tc_flower_handler_basic_usage()
95 if (!sparx5_vcap_is_known_etype(st->admin, st->l3_proto)) { in sparx5_tc_flower_handler_basic_usage()
96 err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_ETYPE, in sparx5_tc_flower_handler_basic_usage()
97 st->l3_proto, ~0); in sparx5_tc_flower_handler_basic_usage()
100 } else if (st->l3_proto == ETH_P_IP) { in sparx5_tc_flower_handler_basic_usage()
101 err = vcap_rule_add_key_bit(st->vrule, VCAP_KF_IP4_IS, in sparx5_tc_flower_handler_basic_usage()
105 } else if (st->l3_proto == ETH_P_IPV6) { in sparx5_tc_flower_handler_basic_usage()
106 err = vcap_rule_add_key_bit(st->vrule, VCAP_KF_IP4_IS, in sparx5_tc_flower_handler_basic_usage()
110 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_basic_usage()
111 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
120 if (mt.mask->ip_proto) { in sparx5_tc_flower_handler_basic_usage()
121 st->l4_proto = mt.key->ip_proto; in sparx5_tc_flower_handler_basic_usage()
122 if (st->l4_proto == IPPROTO_TCP) { in sparx5_tc_flower_handler_basic_usage()
123 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
128 } else if (st->l4_proto == IPPROTO_UDP) { in sparx5_tc_flower_handler_basic_usage()
129 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
134 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_basic_usage()
135 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
142 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_handler_basic_usage()
144 st->l4_proto, ~0); in sparx5_tc_flower_handler_basic_usage()
150 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_BASIC); in sparx5_tc_flower_handler_basic_usage()
155 NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_proto parse error"); in sparx5_tc_flower_handler_basic_usage()
162 struct netlink_ext_ack *extack = st->fco->common.extack; in sparx5_tc_flower_handler_control_usage()
167 flow_rule_match_control(st->frule, &mt); in sparx5_tc_flower_handler_control_usage()
169 if (mt.mask->flags & (FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG)) { in sparx5_tc_flower_handler_control_usage()
170 u8 is_frag_key = !!(mt.key->flags & FLOW_DIS_IS_FRAGMENT); in sparx5_tc_flower_handler_control_usage()
171 u8 is_frag_mask = !!(mt.mask->flags & FLOW_DIS_IS_FRAGMENT); in sparx5_tc_flower_handler_control_usage()
174 u8 first_frag_key = !!(mt.key->flags & FLOW_DIS_FIRST_FRAG); in sparx5_tc_flower_handler_control_usage()
175 u8 first_frag_mask = !!(mt.mask->flags & FLOW_DIS_FIRST_FRAG); in sparx5_tc_flower_handler_control_usage()
184 return -EINVAL; in sparx5_tc_flower_handler_control_usage()
191 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_handler_control_usage()
202 mt.mask->flags, extack)) in sparx5_tc_flower_handler_control_usage()
203 return -EOPNOTSUPP; in sparx5_tc_flower_handler_control_usage()
205 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); in sparx5_tc_flower_handler_control_usage()
213 if (st->admin->vtype != VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_cvlan_usage()
214 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_flower_handler_cvlan_usage()
216 return -EINVAL; in sparx5_tc_flower_handler_cvlan_usage()
229 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_vlan_usage()
238 if (st->admin->vtype == VCAP_TYPE_ES0 && st->tpid) in sparx5_tc_flower_handler_vlan_usage()
265 if (!flow_rule_match_key(st->frule, idx)) in sparx5_tc_use_dissectors()
274 if (st->frule->match.dissector->used_keys ^ st->used_keys) { in sparx5_tc_use_dissectors()
275 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_use_dissectors()
277 return -ENOENT; in sparx5_tc_use_dissectors()
290 struct flow_action *act = &rule->action; in sparx5_tc_flower_action_check()
295 NL_SET_ERR_MSG_MOD(fco->common.extack, "No actions"); in sparx5_tc_flower_action_check()
296 return -EINVAL; in sparx5_tc_flower_action_check()
299 if (!flow_action_basic_hw_stats_check(act, fco->common.extack)) in sparx5_tc_flower_action_check()
300 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
303 if (action_mask & BIT(actent->id)) { in sparx5_tc_flower_action_check()
304 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
306 return -EINVAL; in sparx5_tc_flower_action_check()
308 action_mask |= BIT(actent->id); in sparx5_tc_flower_action_check()
315 if (last_actent->id == FLOW_ACTION_GOTO) { in sparx5_tc_flower_action_check()
317 if (!vcap_is_next_lookup(vctrl, fco->common.chain_index, in sparx5_tc_flower_action_check()
318 last_actent->chain_index)) { in sparx5_tc_flower_action_check()
319 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
321 return -EINVAL; in sparx5_tc_flower_action_check()
323 } else if (!vcap_is_last_chain(vctrl, fco->common.chain_index, in sparx5_tc_flower_action_check()
325 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
327 return -EINVAL; in sparx5_tc_flower_action_check()
333 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
335 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
340 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
342 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
347 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
349 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
354 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
356 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
368 switch (admin->vtype) { in sparx5_tc_add_rule_counter()
373 vrule->id); in sparx5_tc_add_rule_counter()
376 vcap_rule_set_counter_id(vrule, vrule->id); in sparx5_tc_add_rule_counter()
381 vrule->id); in sparx5_tc_add_rule_counter()
384 vcap_rule_set_counter_id(vrule, vrule->id); in sparx5_tc_add_rule_counter()
388 __func__, __LINE__, admin->vtype); in sparx5_tc_add_rule_counter()
411 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_select_protocol_keyset()
417 return -EINVAL; in sparx5_tc_select_protocol_keyset()
423 admin, vrule->vcap_chain_id, in sparx5_tc_select_protocol_keyset()
431 kinfo = vcap_keyfieldset(vctrl, admin->vtype, in sparx5_tc_select_protocol_keyset()
443 mru = &multi->rule[kinfo->sw_per_item]; in sparx5_tc_select_protocol_keyset()
444 if (!mru->selected) { in sparx5_tc_select_protocol_keyset()
445 mru->selected = true; in sparx5_tc_select_protocol_keyset()
446 mru->keyset = portkeysetlist.keysets[idx]; in sparx5_tc_select_protocol_keyset()
447 mru->value = kinfo->type_id; in sparx5_tc_select_protocol_keyset()
449 mru->value &= kinfo->type_id; in sparx5_tc_select_protocol_keyset()
450 mru->mask |= kinfo->type_id; in sparx5_tc_select_protocol_keyset()
455 return -EPROTO; in sparx5_tc_select_protocol_keyset()
458 return -ENOENT; in sparx5_tc_select_protocol_keyset()
461 mru = &multi->rule[idx]; in sparx5_tc_select_protocol_keyset()
462 if (!mru->selected) in sparx5_tc_select_protocol_keyset()
466 mru->mask ^= mru->value; in sparx5_tc_select_protocol_keyset()
473 mru = &multi->rule[idx]; in sparx5_tc_select_protocol_keyset()
474 if (!mru->selected) in sparx5_tc_select_protocol_keyset()
477 vcap_set_rule_set_keyset(vrule, mru->keyset); in sparx5_tc_select_protocol_keyset()
481 mru->value, in sparx5_tc_select_protocol_keyset()
482 ~mru->mask); in sparx5_tc_select_protocol_keyset()
483 mru->selected = false; /* mark as done */ in sparx5_tc_select_protocol_keyset()
506 erule->user = VCAP_USER_TC_EXTRA; in sparx5_tc_add_rule_copy()
512 vrule->cookie = erule->cookie; in sparx5_tc_add_rule_copy()
514 err = vcap_set_rule_set_keyset(vrule, rule->keyset); in sparx5_tc_add_rule_copy()
518 vcap_keyset_name(vctrl, rule->keyset), in sparx5_tc_add_rule_copy()
519 vrule->id); in sparx5_tc_add_rule_copy()
524 vcap_rule_mod_key_u32(vrule, VCAP_KF_TYPE, rule->value, ~rule->mask); in sparx5_tc_add_rule_copy()
526 err = vcap_set_rule_set_actionset(vrule, erule->actionset); in sparx5_tc_add_rule_copy()
537 __func__, __LINE__, vrule->id); in sparx5_tc_add_rule_copy()
544 __func__, __LINE__, vrule->id); in sparx5_tc_add_rule_copy()
561 if (!multi->rule[idx].selected) in sparx5_tc_add_remaining_rules()
565 &multi->rule[idx]); in sparx5_tc_add_remaining_rules()
579 switch (admin->vtype) { in sparx5_tc_set_actionset()
594 return -EINVAL; in sparx5_tc_set_actionset()
597 if (vrule->actionset == VCAP_AFS_NO_VALUE) in sparx5_tc_set_actionset()
613 switch (admin->vtype) { in sparx5_tc_add_rule_link_target()
652 return -EINVAL; in sparx5_tc_add_rule_link()
659 if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
660 to_admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_add_rule_link()
669 } else if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
670 to_admin->vtype == VCAP_TYPE_IS2) { in sparx5_tc_add_rule_link()
680 } else if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
681 (to_admin->vtype == VCAP_TYPE_ES0 || in sparx5_tc_add_rule_link()
682 to_admin->vtype == VCAP_TYPE_ES2)) { in sparx5_tc_add_rule_link()
696 err = -EOPNOTSUPP; in sparx5_tc_add_rule_link()
708 if (act->gate.prio < -1 || act->gate.prio > SPX5_PSFP_SG_MAX_IPV) { in sparx5_tc_flower_parse_act_gate()
710 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
713 if (act->gate.cycletime < SPX5_PSFP_SG_MIN_CYCLE_TIME_NS || in sparx5_tc_flower_parse_act_gate()
714 act->gate.cycletime > SPX5_PSFP_SG_MAX_CYCLE_TIME_NS) { in sparx5_tc_flower_parse_act_gate()
716 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
719 if (act->gate.cycletimeext > SPX5_PSFP_SG_MAX_CYCLE_TIME_NS) { in sparx5_tc_flower_parse_act_gate()
721 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
724 if (act->gate.num_entries >= SPX5_PSFP_GCE_CNT) { in sparx5_tc_flower_parse_act_gate()
726 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
729 sg->gate_state = true; in sparx5_tc_flower_parse_act_gate()
730 sg->ipv = act->gate.prio; in sparx5_tc_flower_parse_act_gate()
731 sg->num_entries = act->gate.num_entries; in sparx5_tc_flower_parse_act_gate()
732 sg->cycletime = act->gate.cycletime; in sparx5_tc_flower_parse_act_gate()
733 sg->cycletimeext = act->gate.cycletimeext; in sparx5_tc_flower_parse_act_gate()
735 for (i = 0; i < sg->num_entries; i++) { in sparx5_tc_flower_parse_act_gate()
736 sg->gce[i].gate_state = !!act->gate.entries[i].gate_state; in sparx5_tc_flower_parse_act_gate()
737 sg->gce[i].interval = act->gate.entries[i].interval; in sparx5_tc_flower_parse_act_gate()
738 sg->gce[i].ipv = act->gate.entries[i].ipv; in sparx5_tc_flower_parse_act_gate()
739 sg->gce[i].maxoctets = act->gate.entries[i].maxoctets; in sparx5_tc_flower_parse_act_gate()
749 pol->type = SPX5_POL_SERVICE; in sparx5_tc_flower_parse_act_police()
750 pol->rate = div_u64(act->police.rate_bytes_ps, 1000) * 8; in sparx5_tc_flower_parse_act_police()
751 pol->burst = act->police.burst; in sparx5_tc_flower_parse_act_police()
752 pol->idx = act->hw_index; in sparx5_tc_flower_parse_act_police()
755 if (pol->rate > DIV_ROUND_UP(SPX5_SDLB_GROUP_RATE_MAX, 1000)) { in sparx5_tc_flower_parse_act_police()
757 return -EINVAL; in sparx5_tc_flower_parse_act_police()
760 if (act->police.exceed.act_id != FLOW_ACTION_DROP) { in sparx5_tc_flower_parse_act_police()
762 return -EOPNOTSUPP; in sparx5_tc_flower_parse_act_police()
765 if (act->police.notexceed.act_id != FLOW_ACTION_PIPE && in sparx5_tc_flower_parse_act_police()
766 act->police.notexceed.act_id != FLOW_ACTION_ACCEPT) { in sparx5_tc_flower_parse_act_police()
768 return -EOPNOTSUPP; in sparx5_tc_flower_parse_act_police()
783 /* Must always have a stream gate - max sdu (filter option) is evaluated in sparx5_tc_flower_psfp_setup()
789 sg->ipv = 0; /* Disabled */ in sparx5_tc_flower_psfp_setup()
790 sg->cycletime = SPX5_PSFP_SG_CYCLE_TIME_DEFAULT; in sparx5_tc_flower_psfp_setup()
791 sg->num_entries = 1; in sparx5_tc_flower_psfp_setup()
792 sg->gate_state = 1; /* Open */ in sparx5_tc_flower_psfp_setup()
793 sg->gate_enabled = 1; in sparx5_tc_flower_psfp_setup()
794 sg->gce[0].gate_state = 1; in sparx5_tc_flower_psfp_setup()
795 sg->gce[0].interval = SPX5_PSFP_SG_CYCLE_TIME_DEFAULT; in sparx5_tc_flower_psfp_setup()
796 sg->gce[0].ipv = 0; in sparx5_tc_flower_psfp_setup()
797 sg->gce[0].maxoctets = 0; /* Disabled */ in sparx5_tc_flower_psfp_setup()
805 /* Add new flow-meter */ in sparx5_tc_flower_psfp_setup()
812 sf->sgid = psfp_sgid; in sparx5_tc_flower_psfp_setup()
814 /* Add new stream-filter and map it to a steam gate */ in sparx5_tc_flower_psfp_setup()
819 /* Streams are classified by ISDX - map ISDX 1:1 to sfid for now. */ in sparx5_tc_flower_psfp_setup()
841 switch (admin->vtype) { in sparx5_tc_action_trap()
871 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_trap()
873 err = -EOPNOTSUPP; in sparx5_tc_action_trap()
886 switch (admin->vtype) { in sparx5_tc_action_vlan_pop()
890 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_pop()
892 return -EOPNOTSUPP; in sparx5_tc_action_vlan_pop()
903 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_pop()
905 err = -EINVAL; in sparx5_tc_action_vlan_pop()
918 switch (admin->vtype) { in sparx5_tc_action_vlan_modify()
927 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_modify()
929 return -EOPNOTSUPP; in sparx5_tc_action_vlan_modify()
944 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_modify()
946 err = -EINVAL; in sparx5_tc_action_vlan_modify()
959 act->vlan.vid); in sparx5_tc_action_vlan_modify()
971 act->vlan.prio); in sparx5_tc_action_vlan_modify()
986 u16 act_tpid = be16_to_cpu(act->vlan.proto); in sparx5_tc_action_vlan_push()
989 switch (admin->vtype) { in sparx5_tc_action_vlan_push()
993 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
995 return -EOPNOTSUPP; in sparx5_tc_action_vlan_push()
999 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
1001 return -EOPNOTSUPP; in sparx5_tc_action_vlan_push()
1023 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
1025 err = -EINVAL; in sparx5_tc_action_vlan_push()
1034 int byidx = port->portno / BITS_PER_BYTE; in sparx5_tc_flower_set_port_mask()
1035 int biidx = port->portno % BITS_PER_BYTE; in sparx5_tc_flower_set_port_mask()
1037 ports->value[byidx] |= BIT(biidx); in sparx5_tc_flower_set_port_mask()
1048 if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) { in sparx5_tc_action_mirred()
1049 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_mirred()
1051 return -EOPNOTSUPP; in sparx5_tc_action_mirred()
1059 sparx5_tc_flower_set_port_mask(&ports, act->dev); in sparx5_tc_action_mirred()
1072 if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) { in sparx5_tc_action_redirect()
1073 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_redirect()
1075 return -EOPNOTSUPP; in sparx5_tc_action_redirect()
1083 sparx5_tc_flower_set_port_mask(&ports, act->dev); in sparx5_tc_action_redirect()
1093 switch (admin->vtype) { in sparx5_tc_flower_simplify_rule()
1109 if (vrule->keyset == VCAP_KFS_IP4_OTHER) in sparx5_tc_flower_simplify_rule()
1113 if (vrule->keyset == VCAP_KFS_IP6_STD) in sparx5_tc_flower_simplify_rule()
1144 list_for_each_entry(ftp, &port->tc_templates, list) { in sparx5_tc_flower_use_template()
1145 if (ftp->cid != fco->common.chain_index) in sparx5_tc_flower_use_template()
1148 vcap_set_rule_set_keyset(vrule, ftp->keyset); in sparx5_tc_flower_use_template()
1149 sparx5_tc_flower_simplify_rule(admin, vrule, ftp->l3_proto); in sparx5_tc_flower_use_template()
1161 struct netlink_ext_ack *extack = fco->common.extack; in sparx5_tc_flower_replace()
1162 int err, idx, tc_sg_idx = -1, tc_pol_idx = -1; in sparx5_tc_flower_replace()
1170 struct sparx5 *sparx5 = port->sparx5; in sparx5_tc_flower_replace()
1178 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_replace()
1184 vrule = vcap_alloc_rule(vctrl, ndev, fco->common.chain_index, VCAP_USER_TC, in sparx5_tc_flower_replace()
1185 fco->common.prio, 0); in sparx5_tc_flower_replace()
1189 vrule->cookie = fco->cookie; in sparx5_tc_flower_replace()
1202 fco->common.chain_index); in sparx5_tc_flower_replace()
1207 flow_action_for_each(idx, act, &frule->action) { in sparx5_tc_flower_replace()
1208 switch (act->id) { in sparx5_tc_flower_replace()
1214 tc_sg_idx = act->hw_index; in sparx5_tc_flower_replace()
1225 sf.max_sdu = act->police.mtu; in sparx5_tc_flower_replace()
1254 fco->common.chain_index, in sparx5_tc_flower_replace()
1255 act->chain_index); in sparx5_tc_flower_replace()
1276 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1278 err = -EOPNOTSUPP; in sparx5_tc_flower_replace()
1295 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1309 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1327 /* Check if VCAP_AF_ISDX_VAL action is set for this rule - and if in sparx5_tc_free_psfp_resources()
1328 * it is used for stream and/or flow-meter classification. in sparx5_tc_free_psfp_resources()
1334 isdx = afield->data.u32.value; in sparx5_tc_free_psfp_resources()
1363 struct sparx5 *sparx5 = port->sparx5; in sparx5_tc_free_rule_resources()
1369 return -EINVAL; in sparx5_tc_free_rule_resources()
1382 int err = -ENOENT, count = 0, rule_id; in sparx5_tc_flower_destroy()
1385 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_destroy()
1387 rule_id = vcap_lookup_rule_by_cookie(vctrl, fco->cookie); in sparx5_tc_flower_destroy()
1421 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_stats()
1422 err = vcap_get_rule_count_by_cookie(vctrl, &ctr, fco->cookie); in sparx5_tc_flower_stats()
1425 flow_stats_update(&fco->stats, 0x0, ctr.value, 0, lastused, in sparx5_tc_flower_stats()
1447 if (admin->vtype == VCAP_TYPE_ES0) { in sparx5_tc_flower_template_create()
1450 return -EINVAL; in sparx5_tc_flower_template_create()
1453 count = vcap_admin_rule_count(admin, fco->common.chain_index); in sparx5_tc_flower_template_create()
1457 return -EBUSY; in sparx5_tc_flower_template_create()
1462 return -ENOMEM; in sparx5_tc_flower_template_create()
1464 ftp->cid = fco->common.chain_index; in sparx5_tc_flower_template_create()
1465 ftp->orig = VCAP_KFS_NO_VALUE; in sparx5_tc_flower_template_create()
1466 ftp->keyset = VCAP_KFS_NO_VALUE; in sparx5_tc_flower_template_create()
1468 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_template_create()
1469 vrule = vcap_alloc_rule(vctrl, ndev, fco->common.chain_index, in sparx5_tc_flower_template_create()
1470 VCAP_USER_TC, fco->common.prio, 0); in sparx5_tc_flower_template_create()
1484 ftp->l3_proto = state.l3_proto; in sparx5_tc_flower_template_create()
1494 err = -ENOENT; in sparx5_tc_flower_template_create()
1498 ftp->keyset = vcap_select_min_rule_keyset(vctrl, admin->vtype, &kslist); in sparx5_tc_flower_template_create()
1500 sparx5_vcap_set_port_keyset(ndev, admin, fco->common.chain_index, in sparx5_tc_flower_template_create()
1502 ftp->keyset, in sparx5_tc_flower_template_create()
1506 ftp->orig = kslist.keysets[0]; in sparx5_tc_flower_template_create()
1509 list_add_tail(&ftp->list, &port->tc_templates); in sparx5_tc_flower_template_create()
1526 int err = -ENOENT; in sparx5_tc_flower_template_destroy()
1529 list_for_each_entry_safe(ftp, tmp, &port->tc_templates, list) { in sparx5_tc_flower_template_destroy()
1530 if (ftp->cid != fco->common.chain_index) in sparx5_tc_flower_template_destroy()
1534 fco->common.chain_index, in sparx5_tc_flower_template_destroy()
1535 ftp->l3_proto, ftp->orig, in sparx5_tc_flower_template_destroy()
1537 list_del(&ftp->list); in sparx5_tc_flower_template_destroy()
1550 int err = -EINVAL; in sparx5_tc_flower()
1553 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower()
1554 admin = vcap_find_admin(vctrl, fco->common.chain_index); in sparx5_tc_flower()
1556 NL_SET_ERR_MSG_MOD(fco->common.extack, "Invalid chain"); in sparx5_tc_flower()
1560 switch (fco->command) { in sparx5_tc_flower()
1572 return -EOPNOTSUPP; in sparx5_tc_flower()