lkml.org 
[lkml]   [2018]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 021/139] virtio-net: disable guest csum during XDP set
    Date
    4.19-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Jason Wang <jasowang@redhat.com>

    [ Upstream commit e59ff2c49ae16e1d179de679aca81405829aee6c ]

    We don't disable VIRTIO_NET_F_GUEST_CSUM if XDP was set. This means we
    can receive partial csumed packets with metadata kept in the
    vnet_hdr. This may have several side effects:

    - It could be overridden by header adjustment, thus is might be not
    correct after XDP processing.
    - There's no way to pass such metadata information through
    XDP_REDIRECT to another driver.
    - XDP does not support checksum offload right now.

    So simply disable guest csum if possible in this the case of XDP.

    Fixes: 3f93522ffab2d ("virtio-net: switch off offloads on demand if possible on XDP set")
    Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
    Cc: Jesper Dangaard Brouer <brouer@redhat.com>
    Cc: Pavel Popa <pashinho1990@gmail.com>
    Cc: David Ahern <dsahern@gmail.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/virtio_net.c | 8 ++------
    1 file changed, 2 insertions(+), 6 deletions(-)

    --- a/drivers/net/virtio_net.c
    +++ b/drivers/net/virtio_net.c
    @@ -70,7 +70,8 @@ static const unsigned long guest_offload
    VIRTIO_NET_F_GUEST_TSO4,
    VIRTIO_NET_F_GUEST_TSO6,
    VIRTIO_NET_F_GUEST_ECN,
    - VIRTIO_NET_F_GUEST_UFO
    + VIRTIO_NET_F_GUEST_UFO,
    + VIRTIO_NET_F_GUEST_CSUM
    };

    struct virtnet_stat_desc {
    @@ -2285,9 +2286,6 @@ static int virtnet_clear_guest_offloads(
    if (!vi->guest_offloads)
    return 0;

    - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))
    - offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM;
    -
    return virtnet_set_guest_offloads(vi, offloads);
    }

    @@ -2297,8 +2295,6 @@ static int virtnet_restore_guest_offload

    if (!vi->guest_offloads)
    return 0;
    - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))
    - offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM;

    return virtnet_set_guest_offloads(vi, offloads);
    }

    \
     
     \ /
      Last update: 2018-12-04 12:33    [W:4.259 / U:1.180 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site