> @@ -6111,20 +6176,38 @@ static int setup_ip_key_mask(struct 
> virtio_net_ff_selector *selector,
>                            u8 *key,
>                            const struct ethtool_rx_flow_spec *fs)
>  {
> +     struct ipv6hdr *v6_m = (struct ipv6hdr *)&selector->mask;
>       struct iphdr *v4_m = (struct iphdr *)&selector->mask;
> +     struct ipv6hdr *v6_k = (struct ipv6hdr *)key;
>       struct iphdr *v4_k = (struct iphdr *)key;
>  
> -     selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV4;
> -     selector->length = sizeof(struct iphdr);
> +     if (has_ipv6(fs->flow_type)) {
> +             selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV6;
> +             selector->length = sizeof(struct ipv6hdr);
> +
> +             /* exclude tclass, it's not exposed properly struct ip6hdr */

do you mean:

+               /* exclude tclass, it's not exposed properly in struct ipv6hdr 
*/

?

and maybe properly -> directly?

> +             if (fs->h_u.usr_ip6_spec.l4_4_bytes ||
> +                 fs->m_u.usr_ip6_spec.l4_4_bytes ||
> +                 fs->h_u.usr_ip6_spec.tclass ||
> +                 fs->m_u.usr_ip6_spec.tclass ||
> +                 fs->h_u.usr_ip6_spec.l4_proto ||
> +                 fs->m_u.usr_ip6_spec.l4_proto)
> +                     return -EINVAL;
>  
> -     if (fs->h_u.usr_ip4_spec.l4_4_bytes ||
> -         fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 ||
> -         fs->m_u.usr_ip4_spec.l4_4_bytes ||
> -         fs->m_u.usr_ip4_spec.ip_ver ||
> -         fs->m_u.usr_ip4_spec.proto)
> -             return -EINVAL;
> +             parse_ip6(v6_m, v6_k, fs);
> +     } else {
> +             selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV4;
> +             selector->length = sizeof(struct iphdr);
> +
> +             if (fs->h_u.usr_ip4_spec.l4_4_bytes ||
> +                 fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 ||
> +                 fs->m_u.usr_ip4_spec.l4_4_bytes ||
> +                 fs->m_u.usr_ip4_spec.ip_ver ||
> +                 fs->m_u.usr_ip4_spec.proto)
> +                     return -EINVAL;
>  
> -     parse_ip4(v4_m, v4_k, fs);
> +             parse_ip4(v4_m, v4_k, fs);
> +     }
>  
>       return 0;
>  }
> @@ -6194,7 +6277,7 @@ static int build_and_insert(struct virtnet_ff *ff,
>  
>       setup_eth_hdr_key_mask(selector, key, fs, num_hdrs);
>  
> -     if (has_ipv4(fs->flow_type)) {
> +     if (has_ipv4(fs->flow_type) || has_ipv6(fs->flow_type)) {
>               selector = next_selector(selector);
>  
>               err = setup_ip_key_mask(selector, key + sizeof(struct ethhdr), 
> fs);
> -- 
> 2.50.1


Reply via email to