Commit 974ce34a authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: Ethtool steering, l4 proto support

Add support for l4 proto ip field in ethtool flow steering.

Example: Redirect icmpv6 to rx queue #2

ethtool -U eth0 flow-type ip6 l4proto 58 action 2
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent ca7deb02
...@@ -237,6 +237,11 @@ parse_ip4(void *headers_c, void *headers_v, struct ethtool_rx_flow_spec *fs) ...@@ -237,6 +237,11 @@ parse_ip4(void *headers_c, void *headers_v, struct ethtool_rx_flow_spec *fs)
set_ip4(headers_c, headers_v, l3_mask->ip4src, l3_val->ip4src, set_ip4(headers_c, headers_v, l3_mask->ip4src, l3_val->ip4src,
l3_mask->ip4dst, l3_val->ip4dst); l3_mask->ip4dst, l3_val->ip4dst);
if (l3_mask->proto) {
MLX5E_FTE_SET(headers_c, ip_protocol, l3_mask->proto);
MLX5E_FTE_SET(headers_v, ip_protocol, l3_val->proto);
}
} }
static void static void
...@@ -247,6 +252,11 @@ parse_ip6(void *headers_c, void *headers_v, struct ethtool_rx_flow_spec *fs) ...@@ -247,6 +252,11 @@ parse_ip6(void *headers_c, void *headers_v, struct ethtool_rx_flow_spec *fs)
set_ip6(headers_c, headers_v, l3_mask->ip6src, set_ip6(headers_c, headers_v, l3_mask->ip6src,
l3_val->ip6src, l3_mask->ip6dst, l3_val->ip6dst); l3_val->ip6src, l3_mask->ip6dst, l3_val->ip6dst);
if (l3_mask->l4_proto) {
MLX5E_FTE_SET(headers_c, ip_protocol, l3_mask->l4_proto);
MLX5E_FTE_SET(headers_v, ip_protocol, l3_val->l4_proto);
}
} }
static void static void
...@@ -527,7 +537,7 @@ static int validate_ip4(struct ethtool_rx_flow_spec *fs) ...@@ -527,7 +537,7 @@ static int validate_ip4(struct ethtool_rx_flow_spec *fs)
struct ethtool_usrip4_spec *l3_mask = &fs->m_u.usr_ip4_spec; struct ethtool_usrip4_spec *l3_mask = &fs->m_u.usr_ip4_spec;
int ntuples = 0; int ntuples = 0;
if (l3_mask->l4_4_bytes || l3_mask->tos || l3_mask->proto || if (l3_mask->l4_4_bytes || l3_mask->tos ||
fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4) fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4)
return -EINVAL; return -EINVAL;
if (l3_mask->ip4src) { if (l3_mask->ip4src) {
...@@ -540,6 +550,8 @@ static int validate_ip4(struct ethtool_rx_flow_spec *fs) ...@@ -540,6 +550,8 @@ static int validate_ip4(struct ethtool_rx_flow_spec *fs)
return -EINVAL; return -EINVAL;
ntuples++; ntuples++;
} }
if (l3_mask->proto)
ntuples++;
/* Flow is IPv4 */ /* Flow is IPv4 */
return ++ntuples; return ++ntuples;
} }
...@@ -549,14 +561,15 @@ static int validate_ip6(struct ethtool_rx_flow_spec *fs) ...@@ -549,14 +561,15 @@ static int validate_ip6(struct ethtool_rx_flow_spec *fs)
struct ethtool_usrip6_spec *l3_mask = &fs->m_u.usr_ip6_spec; struct ethtool_usrip6_spec *l3_mask = &fs->m_u.usr_ip6_spec;
int ntuples = 0; int ntuples = 0;
if (l3_mask->l4_4_bytes || l3_mask->tclass || l3_mask->l4_proto) if (l3_mask->l4_4_bytes || l3_mask->tclass)
return -EINVAL; return -EINVAL;
if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6src)) if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6src))
ntuples++; ntuples++;
if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6dst)) if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6dst))
ntuples++; ntuples++;
if (l3_mask->l4_proto)
ntuples++;
/* Flow is IPv6 */ /* Flow is IPv6 */
return ++ntuples; return ++ntuples;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment