Fill virtio device info for TX offload.

Signed-off-by: Jijiang Liu <jijiang.liu at intel.com>
---
 drivers/net/virtio/virtio_ethdev.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index cb5dfee..b831c02 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1559,6 +1559,16 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
        dev_info->default_txconf = (struct rte_eth_txconf) {
                .txq_flags = ETH_TXQ_FLAGS_NOOFFLOADS
        };
+
+       if (hw->guest_features & (1u << VIRTIO_NET_F_CSUM))
+               dev_info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
+                               DEV_TX_OFFLOAD_UDP_CKSUM |
+                               DEV_TX_OFFLOAD_TCP_CKSUM |
+                               DEV_TX_OFFLOAD_SCTP_CKSUM;
+
+       if ((hw->guest_features & (1u << VIRTIO_NET_F_HOST_TSO4)) ||
+               (hw->guest_features & (1u << VIRTIO_NET_F_HOST_TSO6)))
+               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO;
 }

 /*
-- 
1.7.7.6

Reply via email to