DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pascal Mazon <pascal.mazon@6wind.com>
To: Moti Haimovsky <motih@mellanox.com>
Cc: ferruh.yigit@intel.com, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH V4 2/2] net/tap: convert to new Rx offloads API
Date: Wed, 10 Jan 2018 17:42:53 +0100	[thread overview]
Message-ID: <f0896ea3-e2cd-8b48-eca7-2d99bad1d462@6wind.com> (raw)
In-Reply-To: <1515601248-39458-2-git-send-email-motih@mellanox.com>

Acked-by: Pascal Mazon <pascal.mazon@6wind.com>

On 10/01/2018 17:20, Moti Haimovsky wrote:
> Ethdev Rx offloads API has changed since:
> commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
> This commit support the new Rx offloads API.
>
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> ---
> V4:
> Modifications according to inputs from Pascal Mazon
> * Removed extra braces.
>
> V3:
> * Fixed coding style warnings
>
> V2:
> * Fixed coding style warnings
> ---
>  drivers/net/tap/rte_eth_tap.c | 66 +++++++++++++++++++++++++++++++++++++------
>  1 file changed, 58 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 1a84adb..8e790d1 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -286,6 +286,43 @@ enum ioctl_mode {
>  	}
>  }
>  
> +static uint64_t
> +tap_rx_offload_get_port_capa(void)
> +{
> +	/*
> +	 * In order to support legacy apps,
> +	 * report capabilities also as port capabilities.
> +	 */
> +	return DEV_RX_OFFLOAD_SCATTER |
> +	       DEV_RX_OFFLOAD_IPV4_CKSUM |
> +	       DEV_RX_OFFLOAD_UDP_CKSUM |
> +	       DEV_RX_OFFLOAD_TCP_CKSUM;
> +}
> +
> +static uint64_t
> +tap_rx_offload_get_queue_capa(void)
> +{
> +	return DEV_RX_OFFLOAD_SCATTER |
> +	       DEV_RX_OFFLOAD_IPV4_CKSUM |
> +	       DEV_RX_OFFLOAD_UDP_CKSUM |
> +	       DEV_RX_OFFLOAD_TCP_CKSUM;
> +}
> +
> +static bool
> +tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)
> +{
> +	uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads;
> +	uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa();
> +	uint64_t port_supp_offloads = tap_rx_offload_get_port_capa();
> +
> +	if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
> +	    offloads)
> +		return false;
> +	if ((port_offloads ^ offloads) & port_supp_offloads)
> +		return false;
> +	return true;
> +}
> +
>  /* Callback to handle the rx burst of packets to the correct interface and
>   * file descriptor(s) in a multi-queue setup.
>   */
> @@ -310,8 +347,9 @@ enum ioctl_mode {
>  		int len;
>  
>  		len = readv(rxq->fd, *rxq->iovecs,
> -			    1 + (rxq->rxmode->enable_scatter ?
> -				 rxq->nb_rx_desc : 1));
> +			    1 +
> +			    (rxq->rxmode->offloads & DEV_RX_OFFLOAD_SCATTER ?
> +			     rxq->nb_rx_desc : 1));
>  		if (len < (int)sizeof(struct tun_pi))
>  			break;
>  
> @@ -366,7 +404,7 @@ enum ioctl_mode {
>  		seg->next = NULL;
>  		mbuf->packet_type = rte_net_get_ptype(mbuf, NULL,
>  						      RTE_PTYPE_ALL_MASK);
> -		if (rxq->rxmode->hw_ip_checksum)
> +		if (rxq->rxmode->offloads & DEV_RX_OFFLOAD_CHECKSUM)
>  			tap_verify_csum(mbuf);
>  
>  		/* account for the receive frame */
> @@ -727,12 +765,12 @@ enum ioctl_mode {
>  	dev_info->min_rx_bufsize = 0;
>  	dev_info->pci_dev = NULL;
>  	dev_info->speed_capa = tap_dev_speed_capa();
> -	dev_info->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM |
> -				     DEV_RX_OFFLOAD_UDP_CKSUM |
> -				     DEV_RX_OFFLOAD_TCP_CKSUM);
> +	dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
> +	dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
> +				    dev_info->rx_queue_offload_capa;
>  	dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa();
> -	dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa |
> -				    tap_tx_offload_get_port_capa();
> +	dev_info->tx_offload_capa = tap_tx_offload_get_port_capa() |
> +				    dev_info->tx_queue_offload_capa;
>  }
>  
>  static int
> @@ -1048,6 +1086,18 @@ enum ioctl_mode {
>  		return -1;
>  	}
>  
> +	/* Verify application offloads are valid for our port and queue. */
> +	if (!tap_rxq_are_offloads_valid(dev, rx_conf->offloads)) {
> +		rte_errno = ENOTSUP;
> +		RTE_LOG(ERR, PMD,
> +			"%p: Rx queue offloads 0x%lx don't match port "
> +			"offloads 0x%lx or supported offloads 0x%lx\n",
> +			(void *)dev, rx_conf->offloads,
> +			dev->data->dev_conf.rxmode.offloads,
> +			(tap_rx_offload_get_port_capa() |
> +			 tap_rx_offload_get_queue_capa()));
> +		return -rte_errno;
> +	}
>  	rxq->mp = mp;
>  	rxq->trigger_seen = 1; /* force initial burst */
>  	rxq->in_port = dev->data->port_id;

  reply	other threads:[~2018-01-10 16:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 19:18 [dpdk-dev] [PATCH V3 0/2] net/tap: convert to new ethdev " Moti Haimovsky
2018-01-04 19:18 ` [dpdk-dev] [PATCH V3 1/2] net/tap: convert to new Tx " Moti Haimovsky
2018-01-05  8:18   ` Pascal Mazon
2018-01-04 19:18 ` [dpdk-dev] [PATCH V3 2/2] net/tap: convert to new Rx " Moti Haimovsky
2018-01-05  8:26   ` Pascal Mazon
2018-01-10 16:20   ` [dpdk-dev] [PATCH V4 1/2] net/tap: convert to new Tx " Moti Haimovsky
2018-01-10 16:20     ` [dpdk-dev] [PATCH V4 2/2] net/tap: convert to new Rx " Moti Haimovsky
2018-01-10 16:42       ` Pascal Mazon [this message]
2018-01-17 14:04       ` [dpdk-dev] [PATCH V5 1/2] net/tap: use new Tx " Moti Haimovsky
2018-01-17 14:04         ` [dpdk-dev] [PATCH V5 2/2] net/tap: use new Rx " Moti Haimovsky
2018-03-02 21:44           ` Ferruh Yigit
2018-03-12 14:20             ` Shahaf Shuler
2018-03-12 16:59               ` Ferruh Yigit
2018-03-12 17:58                 ` Shahaf Shuler
2018-03-12 19:05                   ` Ferruh Yigit
2018-03-13  7:08                     ` Shahaf Shuler
2018-03-13 11:56                       ` Ferruh Yigit
2018-03-14  5:49                         ` Shahaf Shuler
2018-03-14 22:40                           ` Ferruh Yigit
2018-03-15  6:16                             ` Shahaf Shuler
2018-03-15 14:34                               ` Ferruh Yigit
2018-01-18 14:02         ` [dpdk-dev] [PATCH V5 1/2] net/tap: use new Tx " Pascal Mazon
2018-01-18 15:19           ` Ferruh Yigit

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=f0896ea3-e2cd-8b48-eca7-2d99bad1d462@6wind.com \
    --to=pascal.mazon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=motih@mellanox.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).