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

Signed-off-by: Vishal Kulkarni <vishal@chelsio.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
This commit is contained in:
Vishal Kulkarni 2020-08-19 00:25:03 +05:30 committed by Jianping Liu
parent afd248c5e1
commit e033fadb1f
1 changed files with 2 additions and 1 deletions

View File

@ -2982,13 +2982,14 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
case TCP_V4_FLOW: case TCP_V4_FLOW:
case TCP_V6_FLOW: case TCP_V6_FLOW:
match->key.basic.ip_proto = IPPROTO_TCP; match->key.basic.ip_proto = IPPROTO_TCP;
match->mask.basic.ip_proto = 0xff;
break; break;
case UDP_V4_FLOW: case UDP_V4_FLOW:
case UDP_V6_FLOW: case UDP_V6_FLOW:
match->key.basic.ip_proto = IPPROTO_UDP; match->key.basic.ip_proto = IPPROTO_UDP;
match->mask.basic.ip_proto = 0xff;
break; break;
} }
match->mask.basic.ip_proto = 0xff;
match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_BASIC); match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_BASIC);
match->dissector.offset[FLOW_DISSECTOR_KEY_BASIC] = match->dissector.offset[FLOW_DISSECTOR_KEY_BASIC] =