Skip to content

Commit 44d706f

Browse files
HoratiuVulturkuba-moo
authored andcommitted
net: lan966x: Add support for IS1 VCAP ethernet protocol types
IS1 VCAP has it's own list of supported ethernet protocol types which is different than the IS2 VCAP. Therefore separate the list of known protocol types based on the VCAP type. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b3762a9 commit 44d706f

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,34 @@
55
#include "vcap_api_client.h"
66
#include "vcap_tc.h"
77

8-
static bool lan966x_tc_is_known_etype(u16 etype)
8+
static bool lan966x_tc_is_known_etype(struct vcap_tc_flower_parse_usage *st,
9+
u16 etype)
910
{
10-
switch (etype) {
11-
case ETH_P_ALL:
12-
case ETH_P_ARP:
13-
case ETH_P_IP:
14-
case ETH_P_IPV6:
15-
return true;
11+
switch (st->admin->vtype) {
12+
case VCAP_TYPE_IS1:
13+
switch (etype) {
14+
case ETH_P_ALL:
15+
case ETH_P_ARP:
16+
case ETH_P_IP:
17+
case ETH_P_IPV6:
18+
return true;
19+
}
20+
break;
21+
case VCAP_TYPE_IS2:
22+
switch (etype) {
23+
case ETH_P_ALL:
24+
case ETH_P_ARP:
25+
case ETH_P_IP:
26+
case ETH_P_IPV6:
27+
case ETH_P_SNAP:
28+
case ETH_P_802_2:
29+
return true;
30+
}
31+
break;
32+
default:
33+
NL_SET_ERR_MSG_MOD(st->fco->common.extack,
34+
"VCAP type not supported");
35+
return false;
1636
}
1737

1838
return false;
@@ -69,7 +89,7 @@ lan966x_tc_flower_handler_basic_usage(struct vcap_tc_flower_parse_usage *st)
6989
flow_rule_match_basic(st->frule, &match);
7090
if (match.mask->n_proto) {
7191
st->l3_proto = be16_to_cpu(match.key->n_proto);
72-
if (!lan966x_tc_is_known_etype(st->l3_proto)) {
92+
if (!lan966x_tc_is_known_etype(st, st->l3_proto)) {
7393
err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_ETYPE,
7494
st->l3_proto, ~0);
7595
if (err)

0 commit comments

Comments
 (0)