Lines Matching +full:multi +full:- +full:port

1 // SPDX-License-Identifier: GPL-2.0+
44 switch (st->tpid) { in sparx5_tc_flower_es0_tpid()
46 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_es0_tpid()
51 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_es0_tpid()
56 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_flower_es0_tpid()
58 err = -EINVAL; in sparx5_tc_flower_es0_tpid()
70 flow_rule_match_basic(st->frule, &mt); in sparx5_tc_flower_handler_basic_usage()
72 if (mt.mask->n_proto) { in sparx5_tc_flower_handler_basic_usage()
73 st->l3_proto = be16_to_cpu(mt.key->n_proto); in sparx5_tc_flower_handler_basic_usage()
74 if (!sparx5_vcap_is_known_etype(st->admin, st->l3_proto)) { in sparx5_tc_flower_handler_basic_usage()
75 err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_ETYPE, in sparx5_tc_flower_handler_basic_usage()
76 st->l3_proto, ~0); in sparx5_tc_flower_handler_basic_usage()
79 } else if (st->l3_proto == ETH_P_IP) { in sparx5_tc_flower_handler_basic_usage()
80 err = vcap_rule_add_key_bit(st->vrule, VCAP_KF_IP4_IS, in sparx5_tc_flower_handler_basic_usage()
84 } else if (st->l3_proto == ETH_P_IPV6) { in sparx5_tc_flower_handler_basic_usage()
85 err = vcap_rule_add_key_bit(st->vrule, VCAP_KF_IP4_IS, in sparx5_tc_flower_handler_basic_usage()
89 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_basic_usage()
90 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
99 if (mt.mask->ip_proto) { in sparx5_tc_flower_handler_basic_usage()
100 st->l4_proto = mt.key->ip_proto; in sparx5_tc_flower_handler_basic_usage()
101 if (st->l4_proto == IPPROTO_TCP) { in sparx5_tc_flower_handler_basic_usage()
102 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
107 } else if (st->l4_proto == IPPROTO_UDP) { in sparx5_tc_flower_handler_basic_usage()
108 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
113 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_basic_usage()
114 err = vcap_rule_add_key_bit(st->vrule, in sparx5_tc_flower_handler_basic_usage()
121 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_handler_basic_usage()
123 st->l4_proto, ~0); in sparx5_tc_flower_handler_basic_usage()
129 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_BASIC); in sparx5_tc_flower_handler_basic_usage()
134 NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_proto parse error"); in sparx5_tc_flower_handler_basic_usage()
145 flow_rule_match_control(st->frule, &mt); in sparx5_tc_flower_handler_control_usage()
147 if (mt.mask->flags) { in sparx5_tc_flower_handler_control_usage()
148 if (mt.mask->flags & FLOW_DIS_FIRST_FRAG) { in sparx5_tc_flower_handler_control_usage()
149 if (mt.key->flags & FLOW_DIS_FIRST_FRAG) { in sparx5_tc_flower_handler_control_usage()
153 if (mt.mask->flags & FLOW_DIS_IS_FRAGMENT) { in sparx5_tc_flower_handler_control_usage()
162 if (mt.mask->flags & FLOW_DIS_IS_FRAGMENT) { in sparx5_tc_flower_handler_control_usage()
171 err = vcap_rule_add_key_u32(st->vrule, in sparx5_tc_flower_handler_control_usage()
178 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); in sparx5_tc_flower_handler_control_usage()
183 NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_frag parse error"); in sparx5_tc_flower_handler_control_usage()
190 if (st->admin->vtype != VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_cvlan_usage()
191 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_flower_handler_cvlan_usage()
193 return -EINVAL; in sparx5_tc_flower_handler_cvlan_usage()
206 if (st->admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_flower_handler_vlan_usage()
215 if (st->admin->vtype == VCAP_TYPE_ES0 && st->tpid) in sparx5_tc_flower_handler_vlan_usage()
242 if (!flow_rule_match_key(st->frule, idx)) in sparx5_tc_use_dissectors()
251 if (st->frule->match.dissector->used_keys ^ st->used_keys) { in sparx5_tc_use_dissectors()
252 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in sparx5_tc_use_dissectors()
254 return -ENOENT; in sparx5_tc_use_dissectors()
267 struct flow_action *act = &rule->action; in sparx5_tc_flower_action_check()
272 NL_SET_ERR_MSG_MOD(fco->common.extack, "No actions"); in sparx5_tc_flower_action_check()
273 return -EINVAL; in sparx5_tc_flower_action_check()
276 if (!flow_action_basic_hw_stats_check(act, fco->common.extack)) in sparx5_tc_flower_action_check()
277 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
280 if (action_mask & BIT(actent->id)) { in sparx5_tc_flower_action_check()
281 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
283 return -EINVAL; in sparx5_tc_flower_action_check()
285 action_mask |= BIT(actent->id); in sparx5_tc_flower_action_check()
292 if (last_actent->id == FLOW_ACTION_GOTO) { in sparx5_tc_flower_action_check()
294 if (!vcap_is_next_lookup(vctrl, fco->common.chain_index, in sparx5_tc_flower_action_check()
295 last_actent->chain_index)) { in sparx5_tc_flower_action_check()
296 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
298 return -EINVAL; in sparx5_tc_flower_action_check()
300 } else if (!vcap_is_last_chain(vctrl, fco->common.chain_index, in sparx5_tc_flower_action_check()
302 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
304 return -EINVAL; in sparx5_tc_flower_action_check()
310 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
312 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
317 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
319 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
324 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
326 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
331 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_action_check()
333 return -EOPNOTSUPP; in sparx5_tc_flower_action_check()
345 switch (admin->vtype) { in sparx5_tc_add_rule_counter()
350 vrule->id); in sparx5_tc_add_rule_counter()
353 vcap_rule_set_counter_id(vrule, vrule->id); in sparx5_tc_add_rule_counter()
358 vrule->id); in sparx5_tc_add_rule_counter()
361 vcap_rule_set_counter_id(vrule, vrule->id); in sparx5_tc_add_rule_counter()
365 __func__, __LINE__, admin->vtype); in sparx5_tc_add_rule_counter()
371 /* Collect all port keysets and apply the first of them, possibly wildcarded */
376 struct sparx5_multiple_rules *multi) in sparx5_tc_select_protocol_keyset() argument
378 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_select_protocol_keyset() local
388 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_select_protocol_keyset()
394 return -EINVAL; in sparx5_tc_select_protocol_keyset()
396 /* Find the keysets that the port configuration supports */ in sparx5_tc_select_protocol_keyset()
400 admin, vrule->vcap_chain_id, in sparx5_tc_select_protocol_keyset()
408 kinfo = vcap_keyfieldset(vctrl, admin->vtype, in sparx5_tc_select_protocol_keyset()
413 /* Find a port keyset that matches the required keys in sparx5_tc_select_protocol_keyset()
420 mru = &multi->rule[kinfo->sw_per_item]; in sparx5_tc_select_protocol_keyset()
421 if (!mru->selected) { in sparx5_tc_select_protocol_keyset()
422 mru->selected = true; in sparx5_tc_select_protocol_keyset()
423 mru->keyset = portkeysetlist.keysets[idx]; in sparx5_tc_select_protocol_keyset()
424 mru->value = kinfo->type_id; in sparx5_tc_select_protocol_keyset()
426 mru->value &= kinfo->type_id; in sparx5_tc_select_protocol_keyset()
427 mru->mask |= kinfo->type_id; in sparx5_tc_select_protocol_keyset()
432 return -EPROTO; in sparx5_tc_select_protocol_keyset()
435 return -ENOENT; in sparx5_tc_select_protocol_keyset()
438 mru = &multi->rule[idx]; in sparx5_tc_select_protocol_keyset()
439 if (!mru->selected) in sparx5_tc_select_protocol_keyset()
443 mru->mask ^= mru->value; in sparx5_tc_select_protocol_keyset()
450 mru = &multi->rule[idx]; in sparx5_tc_select_protocol_keyset()
451 if (!mru->selected) in sparx5_tc_select_protocol_keyset()
454 vcap_set_rule_set_keyset(vrule, mru->keyset); in sparx5_tc_select_protocol_keyset()
458 mru->value, in sparx5_tc_select_protocol_keyset()
459 ~mru->mask); in sparx5_tc_select_protocol_keyset()
460 mru->selected = false; /* mark as done */ in sparx5_tc_select_protocol_keyset()
483 erule->user = VCAP_USER_TC_EXTRA; in sparx5_tc_add_rule_copy()
489 vrule->cookie = erule->cookie; in sparx5_tc_add_rule_copy()
491 err = vcap_set_rule_set_keyset(vrule, rule->keyset); in sparx5_tc_add_rule_copy()
495 vcap_keyset_name(vctrl, rule->keyset), in sparx5_tc_add_rule_copy()
496 vrule->id); in sparx5_tc_add_rule_copy()
501 vcap_rule_mod_key_u32(vrule, VCAP_KF_TYPE, rule->value, ~rule->mask); in sparx5_tc_add_rule_copy()
503 err = vcap_set_rule_set_actionset(vrule, erule->actionset); in sparx5_tc_add_rule_copy()
514 __func__, __LINE__, vrule->id); in sparx5_tc_add_rule_copy()
521 __func__, __LINE__, vrule->id); in sparx5_tc_add_rule_copy()
533 struct sparx5_multiple_rules *multi) in sparx5_tc_add_remaining_rules() argument
538 if (!multi->rule[idx].selected) in sparx5_tc_add_remaining_rules()
542 &multi->rule[idx]); in sparx5_tc_add_remaining_rules()
556 switch (admin->vtype) { in sparx5_tc_set_actionset()
571 return -EINVAL; in sparx5_tc_set_actionset()
574 if (vrule->actionset == VCAP_AFS_NO_VALUE) in sparx5_tc_set_actionset()
590 switch (admin->vtype) { in sparx5_tc_add_rule_link_target()
629 return -EINVAL; in sparx5_tc_add_rule_link()
636 if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
637 to_admin->vtype == VCAP_TYPE_IS0) { in sparx5_tc_add_rule_link()
646 } else if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
647 to_admin->vtype == VCAP_TYPE_IS2) { in sparx5_tc_add_rule_link()
657 } else if (admin->vtype == VCAP_TYPE_IS0 && in sparx5_tc_add_rule_link()
658 (to_admin->vtype == VCAP_TYPE_ES0 || in sparx5_tc_add_rule_link()
659 to_admin->vtype == VCAP_TYPE_ES2)) { in sparx5_tc_add_rule_link()
673 err = -EOPNOTSUPP; in sparx5_tc_add_rule_link()
685 if (act->gate.prio < -1 || act->gate.prio > SPX5_PSFP_SG_MAX_IPV) { in sparx5_tc_flower_parse_act_gate()
687 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
690 if (act->gate.cycletime < SPX5_PSFP_SG_MIN_CYCLE_TIME_NS || in sparx5_tc_flower_parse_act_gate()
691 act->gate.cycletime > SPX5_PSFP_SG_MAX_CYCLE_TIME_NS) { in sparx5_tc_flower_parse_act_gate()
693 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
696 if (act->gate.cycletimeext > SPX5_PSFP_SG_MAX_CYCLE_TIME_NS) { in sparx5_tc_flower_parse_act_gate()
698 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
701 if (act->gate.num_entries >= SPX5_PSFP_GCE_CNT) { in sparx5_tc_flower_parse_act_gate()
703 return -EINVAL; in sparx5_tc_flower_parse_act_gate()
706 sg->gate_state = true; in sparx5_tc_flower_parse_act_gate()
707 sg->ipv = act->gate.prio; in sparx5_tc_flower_parse_act_gate()
708 sg->num_entries = act->gate.num_entries; in sparx5_tc_flower_parse_act_gate()
709 sg->cycletime = act->gate.cycletime; in sparx5_tc_flower_parse_act_gate()
710 sg->cycletimeext = act->gate.cycletimeext; in sparx5_tc_flower_parse_act_gate()
712 for (i = 0; i < sg->num_entries; i++) { in sparx5_tc_flower_parse_act_gate()
713 sg->gce[i].gate_state = !!act->gate.entries[i].gate_state; in sparx5_tc_flower_parse_act_gate()
714 sg->gce[i].interval = act->gate.entries[i].interval; in sparx5_tc_flower_parse_act_gate()
715 sg->gce[i].ipv = act->gate.entries[i].ipv; in sparx5_tc_flower_parse_act_gate()
716 sg->gce[i].maxoctets = act->gate.entries[i].maxoctets; in sparx5_tc_flower_parse_act_gate()
726 pol->type = SPX5_POL_SERVICE; in sparx5_tc_flower_parse_act_police()
727 pol->rate = div_u64(act->police.rate_bytes_ps, 1000) * 8; in sparx5_tc_flower_parse_act_police()
728 pol->burst = act->police.burst; in sparx5_tc_flower_parse_act_police()
729 pol->idx = act->hw_index; in sparx5_tc_flower_parse_act_police()
732 if (pol->rate > DIV_ROUND_UP(SPX5_SDLB_GROUP_RATE_MAX, 1000)) { in sparx5_tc_flower_parse_act_police()
734 return -EINVAL; in sparx5_tc_flower_parse_act_police()
737 if (act->police.exceed.act_id != FLOW_ACTION_DROP) { in sparx5_tc_flower_parse_act_police()
739 return -EOPNOTSUPP; in sparx5_tc_flower_parse_act_police()
742 if (act->police.notexceed.act_id != FLOW_ACTION_PIPE && in sparx5_tc_flower_parse_act_police()
743 act->police.notexceed.act_id != FLOW_ACTION_ACCEPT) { in sparx5_tc_flower_parse_act_police()
745 return -EOPNOTSUPP; in sparx5_tc_flower_parse_act_police()
760 /* Must always have a stream gate - max sdu (filter option) is evaluated in sparx5_tc_flower_psfp_setup()
766 sg->ipv = 0; /* Disabled */ in sparx5_tc_flower_psfp_setup()
767 sg->cycletime = SPX5_PSFP_SG_CYCLE_TIME_DEFAULT; in sparx5_tc_flower_psfp_setup()
768 sg->num_entries = 1; in sparx5_tc_flower_psfp_setup()
769 sg->gate_state = 1; /* Open */ in sparx5_tc_flower_psfp_setup()
770 sg->gate_enabled = 1; in sparx5_tc_flower_psfp_setup()
771 sg->gce[0].gate_state = 1; in sparx5_tc_flower_psfp_setup()
772 sg->gce[0].interval = SPX5_PSFP_SG_CYCLE_TIME_DEFAULT; in sparx5_tc_flower_psfp_setup()
773 sg->gce[0].ipv = 0; in sparx5_tc_flower_psfp_setup()
774 sg->gce[0].maxoctets = 0; /* Disabled */ in sparx5_tc_flower_psfp_setup()
782 /* Add new flow-meter */ in sparx5_tc_flower_psfp_setup()
789 sf->sgid = psfp_sgid; in sparx5_tc_flower_psfp_setup()
791 /* Add new stream-filter and map it to a steam gate */ in sparx5_tc_flower_psfp_setup()
796 /* Streams are classified by ISDX - map ISDX 1:1 to sfid for now. */ in sparx5_tc_flower_psfp_setup()
818 switch (admin->vtype) { in sparx5_tc_action_trap()
848 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_trap()
850 err = -EOPNOTSUPP; in sparx5_tc_action_trap()
863 switch (admin->vtype) { in sparx5_tc_action_vlan_pop()
867 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_pop()
869 return -EOPNOTSUPP; in sparx5_tc_action_vlan_pop()
880 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_pop()
882 err = -EINVAL; in sparx5_tc_action_vlan_pop()
895 switch (admin->vtype) { in sparx5_tc_action_vlan_modify()
904 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_modify()
906 return -EOPNOTSUPP; in sparx5_tc_action_vlan_modify()
921 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_modify()
923 err = -EINVAL; in sparx5_tc_action_vlan_modify()
936 act->vlan.vid); in sparx5_tc_action_vlan_modify()
948 act->vlan.prio); in sparx5_tc_action_vlan_modify()
963 u16 act_tpid = be16_to_cpu(act->vlan.proto); in sparx5_tc_action_vlan_push()
966 switch (admin->vtype) { in sparx5_tc_action_vlan_push()
970 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
972 return -EOPNOTSUPP; in sparx5_tc_action_vlan_push()
976 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
978 return -EOPNOTSUPP; in sparx5_tc_action_vlan_push()
1000 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_action_vlan_push()
1002 err = -EINVAL; in sparx5_tc_action_vlan_push()
1012 switch (admin->vtype) { in sparx5_tc_flower_simplify_rule()
1028 if (vrule->keyset == VCAP_KFS_IP4_OTHER) in sparx5_tc_flower_simplify_rule()
1032 if (vrule->keyset == VCAP_KFS_IP6_STD) in sparx5_tc_flower_simplify_rule()
1060 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_use_template() local
1063 list_for_each_entry(ftp, &port->tc_templates, list) { in sparx5_tc_flower_use_template()
1064 if (ftp->cid != fco->common.chain_index) in sparx5_tc_flower_use_template()
1067 vcap_set_rule_set_keyset(vrule, ftp->keyset); in sparx5_tc_flower_use_template()
1068 sparx5_tc_flower_simplify_rule(admin, vrule, ftp->l3_proto); in sparx5_tc_flower_use_template()
1080 struct netlink_ext_ack *extack = fco->common.extack; in sparx5_tc_flower_replace()
1081 int err, idx, tc_sg_idx = -1, tc_pol_idx = -1; in sparx5_tc_flower_replace()
1087 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_replace() local
1088 struct sparx5_multiple_rules multi = {}; in sparx5_tc_flower_replace() local
1089 struct sparx5 *sparx5 = port->sparx5; in sparx5_tc_flower_replace()
1097 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_replace()
1103 vrule = vcap_alloc_rule(vctrl, ndev, fco->common.chain_index, VCAP_USER_TC, in sparx5_tc_flower_replace()
1104 fco->common.prio, 0); in sparx5_tc_flower_replace()
1108 vrule->cookie = fco->cookie; in sparx5_tc_flower_replace()
1121 fco->common.chain_index); in sparx5_tc_flower_replace()
1126 flow_action_for_each(idx, act, &frule->action) { in sparx5_tc_flower_replace()
1127 switch (act->id) { in sparx5_tc_flower_replace()
1133 tc_sg_idx = act->hw_index; in sparx5_tc_flower_replace()
1144 sf.max_sdu = act->police.mtu; in sparx5_tc_flower_replace()
1163 fco->common.chain_index, in sparx5_tc_flower_replace()
1164 act->chain_index); in sparx5_tc_flower_replace()
1185 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1187 err = -EOPNOTSUPP; in sparx5_tc_flower_replace()
1202 state.l3_proto, &multi); in sparx5_tc_flower_replace()
1204 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1205 "No matching port keyset for filter protocol and keys"); in sparx5_tc_flower_replace()
1218 NL_SET_ERR_MSG_MOD(fco->common.extack, in sparx5_tc_flower_replace()
1223 &multi); in sparx5_tc_flower_replace()
1236 /* Check if VCAP_AF_ISDX_VAL action is set for this rule - and if in sparx5_tc_free_psfp_resources()
1237 * it is used for stream and/or flow-meter classification. in sparx5_tc_free_psfp_resources()
1243 isdx = afield->data.u32.value; in sparx5_tc_free_psfp_resources()
1271 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_free_rule_resources() local
1272 struct sparx5 *sparx5 = port->sparx5; in sparx5_tc_free_rule_resources()
1278 return -EINVAL; in sparx5_tc_free_rule_resources()
1290 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_destroy() local
1291 int err = -ENOENT, count = 0, rule_id; in sparx5_tc_flower_destroy()
1294 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_destroy()
1296 rule_id = vcap_lookup_rule_by_cookie(vctrl, fco->cookie); in sparx5_tc_flower_destroy()
1324 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_stats() local
1330 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_stats()
1331 err = vcap_get_rule_count_by_cookie(vctrl, &ctr, fco->cookie); in sparx5_tc_flower_stats()
1334 flow_stats_update(&fco->stats, 0x0, ctr.value, 0, lastused, in sparx5_tc_flower_stats()
1343 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_template_create() local
1356 if (admin->vtype == VCAP_TYPE_ES0) { in sparx5_tc_flower_template_create()
1359 return -EINVAL; in sparx5_tc_flower_template_create()
1362 count = vcap_admin_rule_count(admin, fco->common.chain_index); in sparx5_tc_flower_template_create()
1366 return -EBUSY; in sparx5_tc_flower_template_create()
1371 return -ENOMEM; in sparx5_tc_flower_template_create()
1373 ftp->cid = fco->common.chain_index; in sparx5_tc_flower_template_create()
1374 ftp->orig = VCAP_KFS_NO_VALUE; in sparx5_tc_flower_template_create()
1375 ftp->keyset = VCAP_KFS_NO_VALUE; in sparx5_tc_flower_template_create()
1377 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower_template_create()
1378 vrule = vcap_alloc_rule(vctrl, ndev, fco->common.chain_index, in sparx5_tc_flower_template_create()
1379 VCAP_USER_TC, fco->common.prio, 0); in sparx5_tc_flower_template_create()
1393 ftp->l3_proto = state.l3_proto; in sparx5_tc_flower_template_create()
1403 err = -ENOENT; in sparx5_tc_flower_template_create()
1407 ftp->keyset = vcap_select_min_rule_keyset(vctrl, admin->vtype, &kslist); in sparx5_tc_flower_template_create()
1409 sparx5_vcap_set_port_keyset(ndev, admin, fco->common.chain_index, in sparx5_tc_flower_template_create()
1411 ftp->keyset, in sparx5_tc_flower_template_create()
1415 ftp->orig = kslist.keysets[0]; in sparx5_tc_flower_template_create()
1418 list_add_tail(&ftp->list, &port->tc_templates); in sparx5_tc_flower_template_create()
1433 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower_template_destroy() local
1435 int err = -ENOENT; in sparx5_tc_flower_template_destroy()
1438 list_for_each_entry_safe(ftp, tmp, &port->tc_templates, list) { in sparx5_tc_flower_template_destroy()
1439 if (ftp->cid != fco->common.chain_index) in sparx5_tc_flower_template_destroy()
1443 fco->common.chain_index, in sparx5_tc_flower_template_destroy()
1444 ftp->l3_proto, ftp->orig, in sparx5_tc_flower_template_destroy()
1446 list_del(&ftp->list); in sparx5_tc_flower_template_destroy()
1456 struct sparx5_port *port = netdev_priv(ndev); in sparx5_tc_flower() local
1459 int err = -EINVAL; in sparx5_tc_flower()
1462 vctrl = port->sparx5->vcap_ctrl; in sparx5_tc_flower()
1463 admin = vcap_find_admin(vctrl, fco->common.chain_index); in sparx5_tc_flower()
1465 NL_SET_ERR_MSG_MOD(fco->common.extack, "Invalid chain"); in sparx5_tc_flower()
1469 switch (fco->command) { in sparx5_tc_flower()
1481 return -EOPNOTSUPP; in sparx5_tc_flower()