Skip to contentSkip to conversation

net: stmmac: add EthType Rx Frame steering

PATCH Applied Ong Boon Leong 2 participants 3 messages Dec 22, 2021 – Dec 23, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover net: stmmac: add EthType Rx Frame steering

Hi,

Now that VLAN priority RX steering issue patch [1] is merged, this is the remaining patch from the original series to add LLDP and IEEE1588 EtherType RX frame steering in tc flower.

As before, below are the test steps for checking out the newly added features (LLDP and PTP) together with VLAN priority:-

# Setup traffic class and ingress filter

$ IFDEVNAME=eth0
$ tc qdisc add dev $IFDEVNAME ingress
$ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
     map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
     queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0

# Add two VLAN priority based RX Frame Steering

$ tc filter add dev $IFDEVNAME parent ffff: protocol 802.1Q \
     flower vlan_prio 1 hw_tc 1
$ tc filter add dev $IFDEVNAME parent ffff: protocol 802.1Q \
     flower vlan_prio 2 hw_tc 2

# For LLDP

$ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88cc \
     flower hw_tc 5

# For PTP

$ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88f7 \
     flower hw_tc 6

# Show the ingress tc filters

$ tc filter show dev $IFDEVNAME ingress

filter parent ffff: protocol ptp pref 49149 flower chain 0
filter parent ffff: protocol ptp pref 49149 flower chain 0 handle 0x1 hw_tc 6
eth_type 88f7
in_hw in_hw_count 1
filter parent ffff: protocol LLDP pref 49150 flower chain 0
filter parent ffff: protocol LLDP pref 49150 flower chain 0 handle 0x1 hw_tc 5
eth_type 88cc
in_hw in_hw_count 1
filter parent ffff: protocol 802.1Q pref 49151 flower chain 0 filter parent ffff: protocol 802.1Q pref 49151 flower chain 0 handle 0x1 hw_tc 2
vlan_prio 2
in_hw in_hw_count 1
filter parent ffff: protocol 802.1Q pref 49152 flower chain 0 filter parent ffff: protocol 802.1Q pref 49152 flower chain 0 handle 0x1 hw_tc 1
vlan_prio 1
in_hw in_hw_count 1

# Delete tc filters

$ tc filter del dev $IFDEVNAME parent ffff: pref 49149
$ tc filter del dev $IFDEVNAME parent ffff: pref 49150
$ tc filter del dev $IFDEVNAME parent ffff: pref 49151
$ tc filter del dev $IFDEVNAME parent ffff: pref 49152

v1->v2 change:
- change from __be16 to u16 etype
- change ETHER_TYPE_FULL_MASK to use cpu_to_be16() macro

Thanks,
BL

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=aeb7c75cb77478fdbf821628e9c95c4baa9adc63

Ong Boon Leong (1):
net: stmmac: add tc flower filter for EtherType matching

 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   3 +
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 121 ++++++++++++++++++
 2 files changed, 124 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 net: stmmac: add tc flower filter for EtherType matching

This patch adds basic support for EtherType RX frame steering for LLDP and PTP using the hardware offload capabilities.

Example steps for setting up RX frame steering for LLDP and PTP:

$ IFDEVNAME=eth0
$ tc qdisc add dev $IFDEVNAME ingress
$ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
     map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
     queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0

For LLDP

$ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88cc \
     flower hw_tc 5
OR
$ tc filter add dev $IFDEVNAME parent ffff: protocol LLDP \
     flower hw_tc 5

For PTP

$ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88f7 \
     flower hw_tc 6

Show tc ingress filter

$ tc filter show dev $IFDEVNAME ingress

v1->v2:
Thanks to Kurt's and Sebastian's suggestion.
- change from __be16 to u16 etype
- change ETHER_TYPE_FULL_MASK to use cpu_to_be16() macro

---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   3 +
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 121 ++++++++++++++++++
 2 files changed, 124 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +3 -0
index 18a262ef17f..aca3c3f0f0a 100644
@@ -174,11 +174,14 @@ struct stmmac_flow_entry {
 /* Rx Frame Steering */
 enum stmmac_rfs_type {
 	STMMAC_RFS_T_VLAN,
+	STMMAC_RFS_T_LLDP,
+	STMMAC_RFS_T_1588,
 	STMMAC_RFS_T_MAX,
 };
 
 struct stmmac_rfs_entry {
 	unsigned long cookie;
+	u16 etype;
 	int in_use;
 	int type;
 	int tc;
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +121 -0

157 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw
In reply to Ong Boon Leong
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Wed, 22 Dec 2021 22:43:09 +0800 you wrote:

Hi,

Now that VLAN priority RX steering issue patch [1] is merged, this is the remaining patch from the original series to add LLDP and IEEE1588 EtherType RX frame steering in tc flower.

As before, below are the test steps for checking out the newly added features (LLDP and PTP) together with VLAN priority:-

[...]

Here is the summary with links:
- [net-next,v2,1/1] net: stmmac: add tc flower filter for EtherType matching

    https://git.kernel.org/netdev/net-next/c/e48cb313fde3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html