ethtool: allow flow-type ether without IP protocol field
Subsystems (3)
PATCH 1/1 ethtool: allow flow-type ether without IP protocol field
Set IP protocol mask only when IP protocol field is set. This will allow flow-type ether with vlan rule which don't have protocol field to apply.
ethtool -N ens5f4 flow-type ether proto 0x8100 vlan 0x600\
m 0x1FFF action 3 loc 16
--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/ioctl.c +2 -1
@@ -3025,13 +3025,14 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)case TCP_V4_FLOW :case TCP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_TCP ; + match->mask.basic.ip_proto =0xff ;break ;case UDP_V4_FLOW :case UDP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_UDP ; + match->mask.basic.ip_proto =0xff ;break ; } - match->mask.basic.ip_proto =0xff ; match->dissector.used_keys |=BIT (FLOW_DISSECTOR_KEY_BASIC ); match->dissector.offset[FLOW_DISSECTOR_KEY_BASIC] =
Signature · 1 line
2.21.1
David Miller
maintainerFrom: Vishal Kulkarni <[email protected]>
Date: Wed, 19 Aug 2020 00:25:03 +0530
Quoted 8 lines
Set IP protocol mask only when IP protocol field is set. This will allow flow-type ether with vlan rule which don't have protocol field to apply.
ethtool -N ens5f4 flow-type ether proto
0x8100vlan 0x600\
m0x1FFFaction 3 loc 16Signed-off-by Vishal Kulkarni <[email protected]>
Michal, please review.
Quoted 27 lines
--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/ethtool/ioctl.c +2
-1@@ -3025,13 +3025,14 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)case TCP_V4_FLOW :case TCP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_TCP ; + match->mask.basic.ip_proto =0xff ;break ;case UDP_V4_FLOW :case UDP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_UDP ; + match->mask.basic.ip_proto =0xff ;break ; } - match->mask.basic.ip_proto =0xff ; match->dissector.used_keys |=BIT (FLOW_DISSECTOR_KEY_BASIC ); match->dissector.offset[FLOW_DISSECTOR_KEY_BASIC] =Signature · 1 line
2.21.1
Quoted 35 lines · Vishal Kulkarni
Set IP protocol mask only when IP protocol field is set. This will allow flow-type ether with vlan rule which don't have protocol field to apply.
ethtool -N ens5f4 flow-type ether proto
0x8100vlan 0x600\
m0x1FFFaction 3 loc 16Signed-off-by Vishal Kulkarni <[email protected]>--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/ethtool/ioctl.c +2
-1@@ -3025,13 +3025,14 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)case TCP_V4_FLOW :case TCP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_TCP ; + match->mask.basic.ip_proto =0xff ;break ;case UDP_V4_FLOW :case UDP_V6_FLOW : match->key.basic.ip_proto =IPPROTO_UDP ; + match->mask.basic.ip_proto =0xff ;break ; } - match->mask.basic.ip_proto =0xff ; match->dissector.used_keys |=BIT (FLOW_DISSECTOR_KEY_BASIC ); match->dissector.offset[FLOW_DISSECTOR_KEY_BASIC] =Signature · 1 line
2.21.1
This is certainly correct. We should also handle SCTP_V4_FLOW and SCTP_V6_FLOW in the same way as {TCP,UDP}_V{4,6}_FLOW but that is an unrelated problem which should be handled separately (and also needs to be addressed in the switch statement above this one).
From: Vishal Kulkarni <[email protected]>
Date: Wed, 19 Aug 2020 00:25:03 +0530
Quoted 8 lines
Set IP protocol mask only when IP protocol field is set. This will allow flow-type ether with vlan rule which don't have protocol field to apply.
ethtool -N ens5f4 flow-type ether proto
0x8100vlan 0x600\
m0x1FFFaction 3 loc 16Signed-off-by Vishal Kulkarni <[email protected]>
Applied, thank you.