From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 320F1199B1; Thu, 7 Sep 2017 14:14:01 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id E1580CD5C1; Thu, 7 Sep 2017 14:10:16 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: stephen@networkplumber.org, stable@dpdk.org Date: Thu, 7 Sep 2017 14:13:38 +0200 Message-Id: <20170907121347.16208-2-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170907121347.16208-1-olivier.matz@6wind.com> References: <20170831134015.1383-1-olivier.matz@6wind.com> <20170907121347.16208-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 01/10] net/virtio: revert "do not claim to support LRO" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2017 12:14:01 -0000 This reverts commit 701a64622c26 ("net/virtio: do not claim to support LRO") Setting rxmode->enable_lro is a way to tell the host that the guest is ok to receive tso packets. From the guest point of view, it is like enabling LRO on a physical driver. Fixes: 701a64622c26 ("net/virtio: do not claim to support LRO") Cc: stable@dpdk.org Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_ethdev.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index e320811ed..eb2d95acd 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1659,9 +1659,11 @@ virtio_dev_configure(struct rte_eth_dev *dev) { const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; struct virtio_hw *hw = dev->data->dev_private; + uint64_t req_features; int ret; PMD_INIT_LOG(DEBUG, "configure"); + req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES; if (dev->data->dev_conf.intr_conf.rxq) { ret = virtio_init_device(dev, hw->req_guest_features); @@ -1675,10 +1677,23 @@ virtio_dev_configure(struct rte_eth_dev *dev) "virtio does not support IP checksum"); return -ENOTSUP; } + if (rxmode->enable_lro) + req_features |= + (1ULL << VIRTIO_NET_F_GUEST_TSO4) | + (1ULL << VIRTIO_NET_F_GUEST_TSO6); - if (rxmode->enable_lro) { + /* if request features changed, reinit the device */ + if (req_features != hw->req_guest_features) { + ret = virtio_init_device(dev, req_features); + if (ret < 0) + return ret; + } + + if (rxmode->enable_lro && + (!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) || + !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4))) { PMD_DRV_LOG(NOTICE, - "virtio does not support Large Receive Offload"); + "Large Receive Offload not available on this host"); return -ENOTSUP; } @@ -1904,6 +1919,8 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } tso_mask = (1ULL << VIRTIO_NET_F_GUEST_TSO4) | (1ULL << VIRTIO_NET_F_GUEST_TSO6); + if ((host_features & tso_mask) == tso_mask) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; dev_info->tx_offload_capa = 0; if (hw->guest_features & (1ULL << VIRTIO_NET_F_CSUM)) { -- 2.11.0