virtio_net.c (c845428b7a9157523103100806bc8130d64769c8) virtio_net.c (ef609fd73433ed2a261f571fb616c53ce39a13e0)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* A network driver using virtio.
3 *
4 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
5 */
6//#define DEBUG
7#include <linux/netdevice.h>
8#include <linux/etherdevice.h>

--- 4439 unchanged lines hidden (view full) ---

4448 dev->hw_features |= NETIF_F_GSO_UDP_L4;
4449
4450 dev->features |= NETIF_F_GSO_ROBUST;
4451
4452 if (gso)
4453 dev->features |= dev->hw_features & NETIF_F_ALL_TSO;
4454 /* (!csum && gso) case will be fixed by register_netdev() */
4455 }
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* A network driver using virtio.
3 *
4 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
5 */
6//#define DEBUG
7#include <linux/netdevice.h>
8#include <linux/etherdevice.h>

--- 4439 unchanged lines hidden (view full) ---

4448 dev->hw_features |= NETIF_F_GSO_UDP_L4;
4449
4450 dev->features |= NETIF_F_GSO_ROBUST;
4451
4452 if (gso)
4453 dev->features |= dev->hw_features & NETIF_F_ALL_TSO;
4454 /* (!csum && gso) case will be fixed by register_netdev() */
4455 }
4456 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM))
4457 dev->features |= NETIF_F_RXCSUM;
4456
4457 /* 1. With VIRTIO_NET_F_GUEST_CSUM negotiation, the driver doesn't
4458 * need to calculate checksums for partially checksummed packets,
4459 * as they're considered valid by the upper layer.
4460 * 2. Without VIRTIO_NET_F_GUEST_CSUM negotiation, the driver only
4461 * receives fully checksummed packets. The device may assist in
4462 * validating these packets' checksums, so the driver won't have to.
4463 */
4464 dev->features |= NETIF_F_RXCSUM;
4465
4458 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
4459 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))
4460 dev->features |= NETIF_F_GRO_HW;
4461 if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS))
4462 dev->hw_features |= NETIF_F_GRO_HW;
4463
4464 dev->vlan_features = dev->features;
4465 dev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT;

--- 362 unchanged lines hidden ---
4466 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
4467 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))
4468 dev->features |= NETIF_F_GRO_HW;
4469 if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS))
4470 dev->hw_features |= NETIF_F_GRO_HW;
4471
4472 dev->vlan_features = dev->features;
4473 dev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT;

--- 362 unchanged lines hidden ---