DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Liang, Cunming" <cunming.liang@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition
Date: Mon, 27 Oct 2014 00:58:58 +0000
Message-ID: <D0158A423229094DA7ABF71CF2FA0DA3118529CD@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772582139EBDC@IRSMSX105.ger.corp.intel.com>

Ok, I'll roll back to v4.

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, October 24, 2014 7:05 PM
> To: dev@dpdk.org
> Cc: nhorman@tuxdriver.com; Richardson, Bruce; De Lara Guarch, Pablo; Liang,
> Cunming
> Subject: RE: [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition
> 
> 
> 
> > -----Original Message-----
> > From: y@ecsmtp.sh.intel.com [mailto:y@ecsmtp.sh.intel.com]
> > Sent: Friday, October 24, 2014 6:55 AM
> > To: dev@dpdk.org
> > Cc: nhorman@tuxdriver.com; Richardson, Bruce; Ananyev, Konstantin; De Lara
> Guarch, Pablo; Liang, Cunming
> > Subject: [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition
> >
> > From: Cunming Liang <cunming.liang@intel.com>
> >
> > Per definition, rte_eth_rx_burst/rte_eth_tx_burst/rte_eth_rx_queue_count
> returns the packet number.
> > When RTE_LIBRTE_ETHDEV_DEBUG turns on, retval of FUNC_PTR_OR_ERR_RTE
> was set to -ENOTSUP.
> > It makes confusing.
> > The patch always return 0 no matter no packet or there's error.
> > Meanwhile set errno in such kind of checking.
> >
> > Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> > ---
> >  lib/librte_ether/rte_ethdev.c |   10 +++++++---
> >  1 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> > index 50f10d9..6675f28 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -81,12 +81,14 @@
> >  /* Macros for checking for restricting functions to primary instance only */
> >  #define PROC_PRIMARY_OR_ERR_RET(retval) do { \
> >  	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> > +		rte_errno = -E_RTE_SECONDARY;				\
> >  		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> >  		return (retval); \
> >  	} \
> >  } while(0)
> >  #define PROC_PRIMARY_OR_RET() do { \
> >  	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> > +		rte_errno = -E_RTE_SECONDARY;				\
> >  		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> >  		return; \
> >  	} \
> > @@ -95,12 +97,14 @@
> >  /* Macros to check for invlaid function pointers in dev_ops structure */
> >  #define FUNC_PTR_OR_ERR_RET(func, retval) do { \
> >  	if ((func) == NULL) { \
> > +		rte_errno = -ENOTSUP; \
> >  		PMD_DEBUG_TRACE("Function not supported\n"); \
> >  		return (retval); \
> >  	} \
> >  } while(0)
> >  #define FUNC_PTR_OR_RET(func) do { \
> >  	if ((func) == NULL) { \
> > +		rte_errno = -ENOTSUP; \
> >  		PMD_DEBUG_TRACE("Function not supported\n"); \
> >  		return; \
> >  	} \
> > @@ -2530,7 +2534,7 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t
> queue_id,
> >  		return 0;
> >  	}
> >  	dev = &rte_eth_devices[port_id];
> > -	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, -ENOTSUP);
> > +	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
> >  	if (queue_id >= dev->data->nb_rx_queues) {
> >  		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
> >  		return 0;
> > @@ -2551,7 +2555,7 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t
> queue_id,
> >  	}
> >  	dev = &rte_eth_devices[port_id];
> >
> > -	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, -ENOTSUP);
> > +	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
> >  	if (queue_id >= dev->data->nb_tx_queues) {
> >  		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
> >  		return 0;
> > @@ -2570,7 +2574,7 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t
> queue_id)
> >  		return 0;
> >  	}
> >  	dev = &rte_eth_devices[port_id];
> > -	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
> > +	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
> >  	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
> >  }
> 
> There are few things that worry me with that approach:
> 
> 1.  Different behaviour of rte_eth_rx_burst/rte_eth_tx_burst  for
> RTE_LIBRTE_ETHDEV_DEBUG switched on/off.
> So application might need to differentiate its code depending on
> RTE_LIBRTE_ETHDEV_DEBUG value.
> 
> 2. Even for RTE_LIBRTE_ETHDEV_DEBUG is on the behaviour of rte_eth_rx_burst/
> rte_eth_tx_burst will be inconsistent:
> It sets rte_errno if dev->rx_pkt_burst == NULL, but doesn't do the same for other
> error conditions:
> When port_id or queue_id is invalid.
> 
> 3. Modifying FUNC_PTR_OR_ERR_RET() to set rte_errno, we make behaviour of
> other rte_ethdev functions inconsistent too:
> Now for some error conditions they do set rte_errno, for others they don't.
> 
> So if it would be me, I'll just:
> - leave FUNC_PTR_OR_*_RET unmodified.
> - changes rte_eth_rx_burst/tx_burst for RTE_LIBRTE_ETHDEV_DEBUG something
> like:
> 
> - FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, -ENOTSUP);
> + FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
> 
> I think, that just error logging is enough here.
> 
> Konstantin
> 
> >
> > --
> > 1.7.4.1

  reply	other threads:[~2014-10-27  0:51 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  6:12 [dpdk-dev] [PATCH 0/5] app/test: unit test to measure cycles per packet Cunming Liang
2014-08-25  6:12 ` [dpdk-dev] [PATCH 1/5] app/test: unit test for rx and tx cycles/packet Cunming Liang
2014-08-25  6:12 ` [dpdk-dev] [PATCH 2/5] app/test: measure standalone rx or " Cunming Liang
2014-08-25  6:12 ` [dpdk-dev] [PATCH 3/5] ixgbe/vpmd: add fix to store unaligned mbuf point array Cunming Liang
2014-08-25  6:12 ` [dpdk-dev] [PATCH 4/5] app/test: add unit test to measure RX burst cycles Cunming Liang
2014-08-25  6:12 ` [dpdk-dev] [PATCH 5/5] app/test: allow to create packets in different sizes Cunming Liang
2014-09-03  1:46 ` [dpdk-dev] [PATCH 0/5] app/test: unit test to measure cycles per packet Zhan, Zhaochen
2014-10-10 12:29 ` [dpdk-dev] [PATCH v2 0/4] " Cunming Liang
2014-10-10 12:29   ` [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet Cunming Liang
2014-10-10 17:52     ` Neil Horman
2014-10-12 11:10       ` Liang, Cunming
     [not found]         ` <E115CCD9D858EF4F90C690B0DCB4D8972262B720@IRSMSX108.ger.corp.intel.com>
2014-10-14  0:54           ` Liang, Cunming
2014-10-21 10:33         ` Neil Horman
2014-10-21 10:43           ` Richardson, Bruce
2014-10-21 13:37             ` Neil Horman
2014-10-21 22:43               ` Ananyev, Konstantin
2014-10-21 13:17           ` Liang, Cunming
2014-10-22 14:03             ` Neil Horman
2014-10-22 14:48               ` Liang, Cunming
2014-10-22 14:53               ` Ananyev, Konstantin
2014-10-22 15:09                 ` Richardson, Bruce
2014-10-24  3:06                   ` Liang, Cunming
2014-10-10 12:29   ` [dpdk-dev] [PATCH v2 2/4] app/test: measure standalone rx or " Cunming Liang
2014-10-10 12:30   ` [dpdk-dev] [PATCH v2 3/4] app/test: add unit test to measure RX burst cycles Cunming Liang
2014-10-10 12:30   ` [dpdk-dev] [PATCH v2 4/4] app/test: allow to create packets in different sizes Cunming Liang
2014-10-20  8:13   ` [dpdk-dev] [PATCH v3 0/2] app/test: unit test to measure cycles per packet Cunming Liang
2014-10-20  8:13     ` [dpdk-dev] [PATCH v3 1/2] app/test: allow to create packets in different sizes Cunming Liang
2014-10-20  8:13     ` [dpdk-dev] [PATCH v3 2/2] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-21  2:40     ` [dpdk-dev] [PATCH v3 0/2] app/test: unit test to measure cycles per packet Liu, Yong
2014-10-24  5:39     ` [dpdk-dev] [PATCH v4 0/3] " Cunming Liang
2014-10-24  5:39       ` [dpdk-dev] [PATCH v4 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-24  5:39       ` [dpdk-dev] [PATCH v4 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-24  5:39       ` [dpdk-dev] [PATCH v4 3/3] ethdev: fix wrong error return refer to API definition Cunming Liang
2014-10-24  5:57       ` [dpdk-dev] [PATCH v5 0/3] app/test: unit test to measure cycles per packet Cunming Liang
2014-10-24  5:58         ` [dpdk-dev] [PATCH v5 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-24  5:58         ` [dpdk-dev] [PATCH v5 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-10-24  5:58         ` [dpdk-dev] [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang
2014-10-27  1:20         ` [dpdk-dev] [PATCH v6 0/3] app/test: unit test to measure cycles per packet Cunming Liang
2014-10-27  1:20           ` [dpdk-dev] [PATCH v6 1/3] app/test: allow to create packets in different sizes Cunming Liang
2014-10-27  1:20           ` [dpdk-dev] [PATCH v6 2/3] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-11-11 23:28             ` Thomas Monjalon
2014-11-12  6:32               ` Liang, Cunming
2014-10-27  1:20           ` [dpdk-dev] [PATCH v6 3/3] ethdev: fix wrong error return refere to API definition Cunming Liang
2014-10-27 16:03             ` Ananyev, Konstantin
2014-10-27  1:45           ` [dpdk-dev] [PATCH v6 0/3] app/test: unit test to measure cycles per packet Liu, Yong
2014-10-29  5:06           ` Liang, Cunming
2014-11-12  6:24           ` [dpdk-dev] [PATCH v7 0/7] " Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 1/7] app/test: allow to create packets in different sizes Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 2/7] ixgbe:clean scattered_rx configure in dev_stop Cunming Liang
2014-11-12  7:53               ` Thomas Monjalon
2014-11-12  8:21                 ` Liang, Cunming
2014-11-12  9:24                   ` Thomas Monjalon
2014-11-12 10:29                     ` Liang, Cunming
2014-11-12 10:32                       ` Thomas Monjalon
2014-11-12 10:42                         ` Liang, Cunming
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 3/7] ether: new API to format eth_addr in string Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 4/7] app/testpmd: cleanup eth_addr print Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 5/7] examples: " Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 6/7] app/test: measure the cost of rx/tx routines by cycle number Cunming Liang
2014-11-12  6:24             ` [dpdk-dev] [PATCH v7 7/7] ethdev: fix wrong error return refere to API definition Cunming Liang
2014-11-12 23:50             ` [dpdk-dev] [PATCH v7 0/7] app/test: unit test to measure cycles per packet Thomas Monjalon
2014-10-24  5:59       ` [dpdk-dev] [PATCH v4 0/3] " Liang, Cunming
     [not found]       ` <1414130090-17910-1-git-send-email-y>
     [not found]         ` <1414130090-17910-4-git-send-email-y>
2014-10-24 11:04           ` [dpdk-dev] [PATCH v5 3/3] ethdev: fix wrong error return refere to API definition Ananyev, Konstantin
2014-10-27  0:58             ` Liang, Cunming [this message]
2014-10-28 12:21   ` [dpdk-dev] [PATCH v2 0/4] app/test: unit test to measure cycles per packet Neil Horman

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=D0158A423229094DA7ABF71CF2FA0DA3118529CD@shsmsx102.ccr.corp.intel.com \
    --to=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git