DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>, dev@dpdk.org
Cc: Flavio Leitner <fbl@sysclose.org>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>
Subject: Re: [dpdk-dev] [PATCH] net/virtio: include host features supported in guest
Date: Thu, 14 May 2020 14:18:05 +0200	[thread overview]
Message-ID: <5e2fd0dc-4810-1586-47ee-dc036effca5a@redhat.com> (raw)
In-Reply-To: <20200514115647.23604-1-gmuthukr@redhat.com>

Hi,

On 5/14/20 1:56 PM, Gowrishankar Muthukrishnan wrote:
> Virtio pmd driver can not benefit from tso and csum offload
> as they are not included in negotiation check with host. Add
> them in virtio dev init and let negotiation decide the fate.
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>


I think you don't need any patch to achieve that.
Disabling TSO and csum offload by default is done on-purpose, as it is
dependent on the application that drivers the Virtio PMD to support it.

To enable offloads with Virtio PMD, your application has to enable by
setting the proper offloads flags in device's ethdev config. Doing that,
a re-negotiation will happen with the proper Virtio features added:

static int
virtio_dev_configure(struct rte_eth_dev *dev)
{
	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
	const struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode;
...
	uint64_t rx_offloads = rxmode->offloads;
	uint64_t tx_offloads = txmode->offloads;
...

	if (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |
			   DEV_RX_OFFLOAD_TCP_CKSUM))
		req_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM);

	if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO)
		req_features |=
			(1ULL << VIRTIO_NET_F_GUEST_TSO4) |
			(1ULL << VIRTIO_NET_F_GUEST_TSO6);

	if (tx_offloads & (DEV_TX_OFFLOAD_UDP_CKSUM |
			   DEV_TX_OFFLOAD_TCP_CKSUM))
		req_features |= (1ULL << VIRTIO_NET_F_CSUM);

	if (tx_offloads & DEV_TX_OFFLOAD_TCP_TSO)
		req_features |=
			(1ULL << VIRTIO_NET_F_HOST_TSO4) |
			(1ULL << VIRTIO_NET_F_HOST_TSO6);

	/* 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;
	}
...



> --
> This patch has been tested with TSO tests in OVS-DPDK:
> 
> https://patchwork.ozlabs.org/project/openvswitch/list/?series=176886
> 
> ## ------------------------------- ##
> ## openvswitch 2.13.90 test suite. ##
> ## ------------------------------- ##
> 
> OVS-DPDK unit tests
> 
>   1: OVS-DPDK - EAL init                             ok
>   2: OVS-DPDK - add standard DPDK port               ok
>   3: OVS-DPDK - add vhost-user-client port           ok
>   4: OVS-DPDK - ping vhost-user ports                ok
>   5: OVS-DPDK - ping vhost-user-client ports         ok
>   6: OVS-DPDK - validate tso negotiation             ok
> 
> ## ------------- ##
> ## Test results. ##
> ## ------------- ##
> 
> All 6 tests were successful.
> 
> ---
>  drivers/net/virtio/virtio_ethdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 044eb10..91f6f16 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1914,7 +1914,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
>  	}
>  
>  	/* reset device and negotiate default features */
> -	ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
> +	ret = virtio_init_device(eth_dev, VIRTIO_PMD_SUPPORTED_GUEST_FEATURES);
>  	if (ret < 0)
>  		goto err_virtio_init;
>  
> @@ -2064,7 +2064,7 @@ static int eth_virtio_pci_remove(struct rte_pci_device *pci_dev)
>  	int ret;
>  
>  	PMD_INIT_LOG(DEBUG, "configure");
> -	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
> +	req_features = VIRTIO_PMD_SUPPORTED_GUEST_FEATURES;
>  
>  	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
>  		PMD_DRV_LOG(ERR,
> 


  reply	other threads:[~2020-05-14 12:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 11:56 Gowrishankar Muthukrishnan
2020-05-14 12:18 ` Maxime Coquelin [this message]
2020-05-15 16:35   ` Gowrishankar Muthukrishnan
2020-05-16  5:57     ` Gowrishankar Muthukrishnan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e2fd0dc-4810-1586-47ee-dc036effca5a@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=fbl@sysclose.org \
    --cc=gmuthukr@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).