Skip to content

Commit 459b3f7

Browse files
ericwoudgregkh
authored andcommitted
net: ethernet: mtk_ppe_offload: Allow QinQ, double ETH_P_8021Q only
[ Upstream commit 7fe0353 ] mtk_foe_entry_set_vlan() in mtk_ppe.c already supports double vlan tagging, but mtk_flow_offload_replace() in mtk_ppe_offload.c only allows for 1 vlan tag, optionally in combination with pppoe and dsa tags. However, mtk_foe_entry_set_vlan() only allows for setting the vlan id. The protocol cannot be set, it is always ETH_P_8021Q, for inner and outer tag. This patch adds QinQ support to mtk_flow_offload_replace(), only in the case that both inner and outer tags are ETH_P_8021Q. Only PPPoE-in-Q (as before) and Q-in-Q are allowed. A combination of PPPoE and Q-in-Q is not allowed. Signed-off-by: Eric Woudstra <ericwouds@gmail.com> Link: https://patch.msgid.link/20250225201509.20843-1-ericwouds@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 562b4f7 commit 459b3f7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/net/ethernet/mediatek/mtk_ppe_offload.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ struct mtk_flow_data {
3434
u16 vlan_in;
3535

3636
struct {
37-
u16 id;
38-
__be16 proto;
37+
struct {
38+
u16 id;
39+
__be16 proto;
40+
} vlans[2];
3941
u8 num;
4042
} vlan;
4143
struct {
@@ -349,18 +351,19 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f,
349351
case FLOW_ACTION_CSUM:
350352
break;
351353
case FLOW_ACTION_VLAN_PUSH:
352-
if (data.vlan.num == 1 ||
354+
if (data.vlan.num + data.pppoe.num == 2 ||
353355
act->vlan.proto != htons(ETH_P_8021Q))
354356
return -EOPNOTSUPP;
355357

356-
data.vlan.id = act->vlan.vid;
357-
data.vlan.proto = act->vlan.proto;
358+
data.vlan.vlans[data.vlan.num].id = act->vlan.vid;
359+
data.vlan.vlans[data.vlan.num].proto = act->vlan.proto;
358360
data.vlan.num++;
359361
break;
360362
case FLOW_ACTION_VLAN_POP:
361363
break;
362364
case FLOW_ACTION_PPPOE_PUSH:
363-
if (data.pppoe.num == 1)
365+
if (data.pppoe.num == 1 ||
366+
data.vlan.num == 2)
364367
return -EOPNOTSUPP;
365368

366369
data.pppoe.sid = act->pppoe.sid;
@@ -450,12 +453,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f,
450453
if (offload_type == MTK_PPE_PKT_TYPE_BRIDGE)
451454
foe.bridge.vlan = data.vlan_in;
452455

453-
if (data.vlan.num == 1) {
454-
if (data.vlan.proto != htons(ETH_P_8021Q))
455-
return -EOPNOTSUPP;
456+
for (i = 0; i < data.vlan.num; i++)
457+
mtk_foe_entry_set_vlan(eth, &foe, data.vlan.vlans[i].id);
456458

457-
mtk_foe_entry_set_vlan(eth, &foe, data.vlan.id);
458-
}
459459
if (data.pppoe.num == 1)
460460
mtk_foe_entry_set_pppoe(eth, &foe, data.pppoe.sid);
461461

0 commit comments

Comments
 (0)