All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Moti Haimovsky <motih@mellanox.com>
Cc: ferruh.yigit@intel.com, stephen@networkplumber.org, dev@dpdk.org
Subject: Re: [PATCH V3 1/2] net/failsafe: convert to new Tx offloads API
Date: Mon, 15 Jan 2018 16:57:36 +0100	[thread overview]
Message-ID: <20180115155736.jk6uzuu5bqj4mcff@bidouze.vm.6wind.com> (raw)
In-Reply-To: <1515595223-36144-1-git-send-email-motih@mellanox.com>

Hi Moti,

Thanks for the patches.
I have some nitpicks, but overall it is good. Sorry for doing the review
so late, the changes should not take long, it's mostly syntax.

For the commit title, I'd prefer "use" instead of "convert to"

   [PATCH V3 1/2] net/failsafe: use new Tx offloads API

As the old API is still supported and used.

On Wed, Jan 10, 2018 at 04:40:22PM +0200, Moti Haimovsky wrote:

..

> @@ -84,9 +85,18 @@
>  fs_dev_configure(struct rte_eth_dev *dev)
>  {
>  	struct sub_device *sdev;
> +	uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa;
> +	uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;

I'm not fond of compound variable definition and initialization.
Initialization should be done after the definition list.

>  	uint8_t i;
>  	int ret;
>  
> +	if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
> +		rte_errno = ENOTSUP;
> +		ERROR("Some Tx offloads are not supported, "
> +		      "requested 0x%lx supported 0x%lx\n",

Please use PRIx64 instead of %lx for displaying uint64_t.

> +		      tx_offloads, supp_tx_offloads);
> +		return -rte_errno;
> +	}
>  	FOREACH_SUBDEV(sdev, i, dev) {
>  		int rmv_interrupt = 0;
>  		int lsc_interrupt = 0;
> @@ -311,6 +321,22 @@
>  	return ret;
>  }
>  
> +static bool
> +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)

_are seems unnecessary here:

        if (fs_txq_offloads_valid() == false) {
                ...
        }

reads well enough and is shorter.

> +{
> +	uint64_t port_offloads = dev->data->dev_conf.txmode.offloads;
> +	uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa;
> +	uint64_t port_supp_offloads = PRIV(dev)->infos.tx_offload_capa;
> +
> +	if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
> +	     offloads)
> +		return false;
> +	/* Verify we have no conflict with port offloads */
> +	if ((port_offloads ^ offloads) & port_supp_offloads)
> +		return false;
> +	return true;
> +}
> +
>  static void
>  fs_tx_queue_release(void *queue)
>  {
> @@ -347,6 +373,22 @@
>  		fs_tx_queue_release(txq);
>  		dev->data->tx_queues[tx_queue_id] = NULL;
>  	}
> +	/*
> +	 * Don't verify queue offloads for applications which
> +	 * use the old API.
> +	 */
> +	if (tx_conf != NULL &&
> +	   !!(tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) &&

No need for !!

> +	   !fs_txq_are_offloads_valid(dev, tx_conf->offloads)) {

Please check against explicit "false" instead of using '!'.

-- 
Gaëtan Rivet
6WIND

  parent reply	other threads:[~2018-01-15 15:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 19:31 [PATCH 0/2] net/failsafe: convert to new ethdev offloads API Moti Haimovsky
2018-01-04 19:31 ` [PATCH 1/2] net/failsafe: convert to new Tx " Moti Haimovsky
2018-01-04 19:50   ` [PATCH V2 0/2] net/failsafe: convert to new ethdev " Moti Haimovsky
2018-01-04 19:50     ` [PATCH V2 1/2] net/failsafe: convert to new Tx " Moti Haimovsky
2018-01-04 20:15       ` Stephen Hemminger
2018-01-10 14:40       ` [PATCH V3 " Moti Haimovsky
2018-01-10 14:40         ` [PATCH V3 2/2] net/failsafe: convert to new Rx " Moti Haimovsky
2018-01-15 16:02           ` Gaëtan Rivet
2018-01-15 15:57         ` Gaëtan Rivet [this message]
2018-01-17 14:30         ` [PATCH v4 1/2] net/failsafe: use new Tx " Moti Haimovsky
2018-01-17 14:30           ` [PATCH v4 2/2] net/failsafe: use new Rx " Moti Haimovsky
2018-01-17 17:30           ` [PATCH v4 1/2] net/failsafe: use new Tx " Gaëtan Rivet
2018-01-17 19:24             ` Ferruh Yigit
2018-01-04 19:50     ` [PATCH V2 2/2] net/failsafe: convert to new Rx " Moti Haimovsky
2018-01-04 19:31 ` [PATCH " Moti Haimovsky

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=20180115155736.jk6uzuu5bqj4mcff@bidouze.vm.6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=motih@mellanox.com \
    --cc=stephen@networkplumber.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.