Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ethernet: mtk_ppe_offload: Allow QinQ, double ETH_P_8021Q only

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>

authored by

Eric Woudstra and committed by
Paolo Abeni
7fe03536 a0a9d4d2

+11 -11
+11 -11
drivers/net/ethernet/mediatek/mtk_ppe_offload.c
··· 34 34 u16 vlan_in; 35 35 36 36 struct { 37 - u16 id; 38 - __be16 proto; 37 + struct { 38 + u16 id; 39 + __be16 proto; 40 + } vlans[2]; 39 41 u8 num; 40 42 } vlan; 41 43 struct { ··· 351 349 case FLOW_ACTION_CSUM: 352 350 break; 353 351 case FLOW_ACTION_VLAN_PUSH: 354 - if (data.vlan.num == 1 || 352 + if (data.vlan.num + data.pppoe.num == 2 || 355 353 act->vlan.proto != htons(ETH_P_8021Q)) 356 354 return -EOPNOTSUPP; 357 355 358 - data.vlan.id = act->vlan.vid; 359 - data.vlan.proto = act->vlan.proto; 356 + data.vlan.vlans[data.vlan.num].id = act->vlan.vid; 357 + data.vlan.vlans[data.vlan.num].proto = act->vlan.proto; 360 358 data.vlan.num++; 361 359 break; 362 360 case FLOW_ACTION_VLAN_POP: 363 361 break; 364 362 case FLOW_ACTION_PPPOE_PUSH: 365 - if (data.pppoe.num == 1) 363 + if (data.pppoe.num == 1 || 364 + data.vlan.num == 2) 366 365 return -EOPNOTSUPP; 367 366 368 367 data.pppoe.sid = act->pppoe.sid; ··· 453 450 if (offload_type == MTK_PPE_PKT_TYPE_BRIDGE) 454 451 foe.bridge.vlan = data.vlan_in; 455 452 456 - if (data.vlan.num == 1) { 457 - if (data.vlan.proto != htons(ETH_P_8021Q)) 458 - return -EOPNOTSUPP; 453 + for (i = 0; i < data.vlan.num; i++) 454 + mtk_foe_entry_set_vlan(eth, &foe, data.vlan.vlans[i].id); 459 455 460 - mtk_foe_entry_set_vlan(eth, &foe, data.vlan.id); 461 - } 462 456 if (data.pppoe.num == 1) 463 457 mtk_foe_entry_set_pppoe(eth, &foe, data.pppoe.sid); 464 458