aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2018-03-27 12:44:51 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-27 13:33:20 -0400
commita8e8fbebde5ded18e94c36220397521021d941ce (patch)
treea5e601f614c88f93b9b7919153cdbd70d66ab8c5
parente0a65e3c5e3b7b11ec9320524b8fcc210f2026e9 (diff)
sfc: fix flow type handling for RSS filters
The FLOW_RSS flag was causing us to insert UDP filters when TCP was wanted. Fixes: 42356d9a137b ("sfc: support RSS spreading of ethtool ntuple filters") Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index e07c8bc8f4bd..3143588ffd77 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -1088,6 +1088,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx,
1088 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; 1088 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec;
1089 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; 1089 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec;
1090 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; 1090 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec;
1091 u32 flow_type = rule->flow_type & ~(FLOW_EXT | FLOW_RSS);
1091 struct ethhdr *mac_entry = &rule->h_u.ether_spec; 1092 struct ethhdr *mac_entry = &rule->h_u.ether_spec;
1092 struct ethhdr *mac_mask = &rule->m_u.ether_spec; 1093 struct ethhdr *mac_mask = &rule->m_u.ether_spec;
1093 enum efx_filter_flags flags = 0; 1094 enum efx_filter_flags flags = 0;
@@ -1121,14 +1122,14 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx,
1121 if (rule->flow_type & FLOW_RSS) 1122 if (rule->flow_type & FLOW_RSS)
1122 spec.rss_context = rss_context; 1123 spec.rss_context = rss_context;
1123 1124
1124 switch (rule->flow_type & ~(FLOW_EXT | FLOW_RSS)) { 1125 switch (flow_type) {
1125 case TCP_V4_FLOW: 1126 case TCP_V4_FLOW:
1126 case UDP_V4_FLOW: 1127 case UDP_V4_FLOW:
1127 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE | 1128 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE |
1128 EFX_FILTER_MATCH_IP_PROTO); 1129 EFX_FILTER_MATCH_IP_PROTO);
1129 spec.ether_type = htons(ETH_P_IP); 1130 spec.ether_type = htons(ETH_P_IP);
1130 spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V4_FLOW ? 1131 spec.ip_proto = flow_type == TCP_V4_FLOW ? IPPROTO_TCP
1131 IPPROTO_TCP : IPPROTO_UDP); 1132 : IPPROTO_UDP;
1132 if (ip_mask->ip4dst) { 1133 if (ip_mask->ip4dst) {
1133 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) 1134 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK)
1134 return -EINVAL; 1135 return -EINVAL;
@@ -1162,8 +1163,8 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx,
1162 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE | 1163 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE |
1163 EFX_FILTER_MATCH_IP_PROTO); 1164 EFX_FILTER_MATCH_IP_PROTO);
1164 spec.ether_type = htons(ETH_P_IPV6); 1165 spec.ether_type = htons(ETH_P_IPV6);
1165 spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V6_FLOW ? 1166 spec.ip_proto = flow_type == TCP_V6_FLOW ? IPPROTO_TCP
1166 IPPROTO_TCP : IPPROTO_UDP); 1167 : IPPROTO_UDP;
1167 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) { 1168 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) {
1168 if (!ip6_mask_is_full(ip6_mask->ip6dst)) 1169 if (!ip6_mask_is_full(ip6_mask->ip6dst))
1169 return -EINVAL; 1170 return -EINVAL;