Lines Matching +full:lan966x +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0+
13 switch (st->admin->vtype) { in lan966x_tc_is_known_etype()
15 switch (etype) { in lan966x_tc_is_known_etype()
24 switch (etype) { in lan966x_tc_is_known_etype()
37 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in lan966x_tc_is_known_etype()
48 struct netlink_ext_ack *extack = st->fco->common.extack; in lan966x_tc_flower_handler_control_usage()
52 flow_rule_match_control(st->frule, &match); in lan966x_tc_flower_handler_control_usage()
53 if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) { in lan966x_tc_flower_handler_control_usage()
54 if (match.key->flags & FLOW_DIS_IS_FRAGMENT) in lan966x_tc_flower_handler_control_usage()
55 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_control_usage()
59 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_control_usage()
66 if (match.mask->flags & FLOW_DIS_FIRST_FRAG) { in lan966x_tc_flower_handler_control_usage()
67 if (match.key->flags & FLOW_DIS_FIRST_FRAG) in lan966x_tc_flower_handler_control_usage()
68 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_control_usage()
72 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_control_usage()
81 match.mask->flags, extack)) in lan966x_tc_flower_handler_control_usage()
82 return -EOPNOTSUPP; in lan966x_tc_flower_handler_control_usage()
84 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); in lan966x_tc_flower_handler_control_usage()
99 flow_rule_match_basic(st->frule, &match); in lan966x_tc_flower_handler_basic_usage()
100 if (match.mask->n_proto) { in lan966x_tc_flower_handler_basic_usage()
101 st->l3_proto = be16_to_cpu(match.key->n_proto); in lan966x_tc_flower_handler_basic_usage()
102 if (!lan966x_tc_is_known_etype(st, st->l3_proto)) { in lan966x_tc_flower_handler_basic_usage()
103 err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_ETYPE, in lan966x_tc_flower_handler_basic_usage()
104 st->l3_proto, ~0); in lan966x_tc_flower_handler_basic_usage()
107 } else if (st->l3_proto == ETH_P_IP) { in lan966x_tc_flower_handler_basic_usage()
108 err = vcap_rule_add_key_bit(st->vrule, VCAP_KF_IP4_IS, in lan966x_tc_flower_handler_basic_usage()
112 } else if (st->l3_proto == ETH_P_IPV6 && in lan966x_tc_flower_handler_basic_usage()
113 st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_basic_usage()
115 } else if (st->l3_proto == ETH_P_SNAP && in lan966x_tc_flower_handler_basic_usage()
116 st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_basic_usage()
117 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
123 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
128 } else if (st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_basic_usage()
129 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
135 err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_ETYPE, in lan966x_tc_flower_handler_basic_usage()
136 st->l3_proto, ~0); in lan966x_tc_flower_handler_basic_usage()
141 if (match.mask->ip_proto) { in lan966x_tc_flower_handler_basic_usage()
142 st->l4_proto = match.key->ip_proto; in lan966x_tc_flower_handler_basic_usage()
144 if (st->l4_proto == IPPROTO_TCP) { in lan966x_tc_flower_handler_basic_usage()
145 if (st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_basic_usage()
146 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
153 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
158 } else if (st->l4_proto == IPPROTO_UDP) { in lan966x_tc_flower_handler_basic_usage()
159 if (st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_basic_usage()
160 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
167 err = vcap_rule_add_key_bit(st->vrule, in lan966x_tc_flower_handler_basic_usage()
173 err = vcap_rule_add_key_u32(st->vrule, in lan966x_tc_flower_handler_basic_usage()
175 st->l4_proto, ~0); in lan966x_tc_flower_handler_basic_usage()
181 st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_BASIC); in lan966x_tc_flower_handler_basic_usage()
184 NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_proto parse error"); in lan966x_tc_flower_handler_basic_usage()
191 if (st->admin->vtype != VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_cvlan_usage()
192 NL_SET_ERR_MSG_MOD(st->fco->common.extack, in lan966x_tc_flower_handler_cvlan_usage()
194 return -EINVAL; in lan966x_tc_flower_handler_cvlan_usage()
206 if (st->admin->vtype == VCAP_TYPE_IS1) { in lan966x_tc_flower_handler_vlan_usage()
266 struct flow_action *act = &rule->action; in lan966x_tc_flower_action_check()
271 NL_SET_ERR_MSG_MOD(fco->common.extack, "No actions"); in lan966x_tc_flower_action_check()
272 return -EINVAL; in lan966x_tc_flower_action_check()
275 if (!flow_action_basic_hw_stats_check(act, fco->common.extack)) in lan966x_tc_flower_action_check()
276 return -EOPNOTSUPP; in lan966x_tc_flower_action_check()
279 if (action_mask & BIT(actent->id)) { in lan966x_tc_flower_action_check()
280 NL_SET_ERR_MSG_MOD(fco->common.extack, in lan966x_tc_flower_action_check()
282 return -EINVAL; in lan966x_tc_flower_action_check()
284 action_mask |= BIT(actent->id); in lan966x_tc_flower_action_check()
291 if (last_actent->id == FLOW_ACTION_GOTO) { in lan966x_tc_flower_action_check()
293 if (!vcap_is_next_lookup(vctrl, fco->common.chain_index, in lan966x_tc_flower_action_check()
294 last_actent->chain_index)) { in lan966x_tc_flower_action_check()
295 NL_SET_ERR_MSG_MOD(fco->common.extack, in lan966x_tc_flower_action_check()
297 return -EINVAL; in lan966x_tc_flower_action_check()
299 } else if (!vcap_is_last_chain(vctrl, fco->common.chain_index, in lan966x_tc_flower_action_check()
301 NL_SET_ERR_MSG_MOD(fco->common.extack, in lan966x_tc_flower_action_check()
303 return -EINVAL; in lan966x_tc_flower_action_check()
309 NL_SET_ERR_MSG_MOD(fco->common.extack, in lan966x_tc_flower_action_check()
311 return -EOPNOTSUPP; in lan966x_tc_flower_action_check()
324 switch (admin->vtype) { in lan966x_tc_set_actionset()
335 return -EINVAL; in lan966x_tc_set_actionset()
339 if (vrule->actionset == VCAP_AFS_NO_VALUE) in lan966x_tc_set_actionset()
355 switch (admin->vtype) { in lan966x_tc_add_rule_link_target()
389 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_add_rule_link()
391 return -EINVAL; in lan966x_tc_add_rule_link()
394 diff = vcap_chain_offset(vctrl, f->common.chain_index, to_cid); in lan966x_tc_add_rule_link()
399 if (admin->vtype == VCAP_TYPE_IS1 && to_admin->vtype == VCAP_TYPE_IS2) { in lan966x_tc_add_rule_link()
400 /* This works for IS1->IS2 */ in lan966x_tc_add_rule_link()
409 } else if (admin->vtype == VCAP_TYPE_IS1 && in lan966x_tc_add_rule_link()
410 to_admin->vtype == VCAP_TYPE_ES0) { in lan966x_tc_add_rule_link()
411 /* This works for IS1->ES0 */ in lan966x_tc_add_rule_link()
422 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_add_rule_link()
424 return -EOPNOTSUPP; in lan966x_tc_add_rule_link()
435 switch (admin->vtype) { in lan966x_tc_add_rule_counter()
438 vrule->id); in lan966x_tc_add_rule_counter()
458 err = lan966x_tc_flower_action_check(port->lan966x->vcap_ctrl, in lan966x_tc_flower_add()
459 port->dev, f, ingress); in lan966x_tc_flower_add()
463 vrule = vcap_alloc_rule(port->lan966x->vcap_ctrl, port->dev, in lan966x_tc_flower_add()
464 f->common.chain_index, VCAP_USER_TC, in lan966x_tc_flower_add()
465 f->common.prio, 0); in lan966x_tc_flower_add()
469 vrule->cookie = f->cookie; in lan966x_tc_flower_add()
475 f->common.chain_index); in lan966x_tc_flower_add()
481 flow_action_for_each(idx, act, &frule->action) { in lan966x_tc_flower_add()
482 switch (act->id) { in lan966x_tc_flower_add()
484 if (admin->vtype != VCAP_TYPE_IS2) { in lan966x_tc_flower_add()
485 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_flower_add()
487 err = -EOPNOTSUPP; in lan966x_tc_flower_add()
508 err = lan966x_tc_add_rule_link(port->lan966x->vcap_ctrl, in lan966x_tc_flower_add()
510 f, act->chain_index); in lan966x_tc_flower_add()
516 if (admin->vtype != VCAP_TYPE_ES0) { in lan966x_tc_flower_add()
517 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_flower_add()
519 err = -EOPNOTSUPP; in lan966x_tc_flower_add()
531 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_flower_add()
533 err = -EOPNOTSUPP; in lan966x_tc_flower_add()
552 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_flower_add()
564 int err = -ENOENT, rule_id; in lan966x_tc_flower_del()
566 vctrl = port->lan966x->vcap_ctrl; in lan966x_tc_flower_del()
568 rule_id = vcap_lookup_rule_by_cookie(vctrl, f->cookie); in lan966x_tc_flower_del()
572 err = vcap_del_rule(vctrl, port->dev, rule_id); in lan966x_tc_flower_del()
574 NL_SET_ERR_MSG_MOD(f->common.extack, in lan966x_tc_flower_del()
590 err = vcap_get_rule_count_by_cookie(port->lan966x->vcap_ctrl, in lan966x_tc_flower_stats()
591 &count, f->cookie); in lan966x_tc_flower_stats()
595 flow_stats_update(&f->stats, 0x0, count.value, 0, 0, in lan966x_tc_flower_stats()
607 admin = vcap_find_admin(port->lan966x->vcap_ctrl, in lan966x_tc_flower()
608 f->common.chain_index); in lan966x_tc_flower()
610 NL_SET_ERR_MSG_MOD(f->common.extack, "Invalid chain"); in lan966x_tc_flower()
611 return -EINVAL; in lan966x_tc_flower()
614 switch (f->command) { in lan966x_tc_flower()
622 return -EOPNOTSUPP; in lan966x_tc_flower()