On Sat, Aug 11, 2018 at 1:26 AM, Saeed Mahameed <sae...@mellanox.com> wrote: > Add ip6 support for ethtool flow steering. > > New supported flow types: ip6|tcp6|udp6| > Supported fields: src-ip|dst-ip|src-port|dst-port > > Signed-off-by: Saeed Mahameed <sae...@mellanox.com> > --- > .../mellanox/mlx5/core/en_fs_ethtool.c | 138 ++++++++++++++++++ > 1 file changed, 138 insertions(+) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c > index f2fa189adc4f..646b659fe805 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c > @@ -66,11 +66,14 @@ static struct mlx5e_ethtool_table *get_flow_table(struct > mlx5e_priv *priv, > switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { > case TCP_V4_FLOW: > case UDP_V4_FLOW: > + case TCP_V6_FLOW: > + case UDP_V6_FLOW: > max_tuples = ETHTOOL_NUM_L3_L4_FTS; > prio = MLX5E_ETHTOOL_L3_L4_PRIO + (max_tuples - num_tuples); > eth_ft = &priv->fs.ethtool.l3_l4_ft[prio]; > break; > case IP_USER_FLOW: > + case IPV6_USER_FLOW: > max_tuples = ETHTOOL_NUM_L3_L4_FTS; > prio = MLX5E_ETHTOOL_L3_L4_PRIO + (max_tuples - num_tuples); > eth_ft = &priv->fs.ethtool.l3_l4_ft[prio]; > @@ -142,6 +145,39 @@ set_ip4(void *headers_c, void *headers_v, __be32 > ip4src_m, > MLX5E_FTE_SET(headers_v, ethertype, ETH_P_IP); > } > > +static bool is_zero_ip6(__be32 ip6[4]) > +{ > + int i; > + > + for (i = 0; i < 4; i++) > + if (ip6[i] != 0) > + return false; > + return true; > +} > + > +static void > +set_ip6(void *headers_c, void *headers_v, __be32 ip6src_m[4], > + __be32 ip6src_v[4], __be32 ip6dst_m[4], __be32 ip6dst_v[4]) > +{ > + u8 ip6_sz = MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6); > + > + if (!is_zero_ip6(ip6src_m)) { > + memcpy(MLX5E_FTE_ADDR_OF(headers_v, > src_ipv4_src_ipv6.ipv6_layout.ipv6), > + ip6src_v, ip6_sz); > + memset(MLX5E_FTE_ADDR_OF(headers_c, > src_ipv4_src_ipv6.ipv6_layout.ipv6), > + 0xff, ip6_sz);
ip6src_m is the mask provided by the user, right? so why not use it instead of all-one (0xffs)?