DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Fredrik A Lindgren" <Fredrik.a.Lindgren@tietoevry.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Question: typedef of eventdev_info_get_t bug?
Date: Mon, 1 Feb 2021 10:02:16 +0000	[thread overview]
Message-ID: <VI1PR04MB4303A0A5649D8399667FB2DCC3B69@VI1PR04MB4303.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <BYAPR11MB3143A661523FD40B75A99BA5D7B69@BYAPR11MB3143.namprd11.prod.outlook.com>

Hi Harry,

You are correct, multiple structs with dev_infos_get defined in them caused me to jump to wrong implementation.

Still a bit "wrong" that comment for eventdev_info_get_t for event setup states returns 0 on success.

Using older version of https://github.com/Xilinx/dma_ip_drivers/tree/master/QDMA/DPDK targeting dpdk-19.11 for a corporate internal project as such can't give much details.
That version had a issue with no return statements in the infos_get function which was causing me issues.

Br,
Fredrik

-----Original Message-----
From: Van Haaren, Harry <harry.van.haaren@intel.com> 
Sent: den 1 februari 2021 10:44
To: Fredrik A Lindgren <Fredrik.a.Lindgren@tieto.com>; dev@dpdk.org
Subject: RE: Question: typedef of eventdev_info_get_t bug?

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Fredrik A Lindgren
> Sent: Monday, February 1, 2021 9:22 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] Question: typedef of eventdev_info_get_t bug?
> 
> While debugging a driver I was looking at the code and realized that 
> eventdev_info_get_t typedef is defined with void return value but 
> documentation for it says it should return 0

Hi Fredrik,

Be aware that your snippets of code below is mixing Event-dev and Eth-dev.
This is likely the cause of confusion.


> lib/librte_eventdev/eventdev_pmd.h:
> 
> ...
> * @return
> *   Returns 0 on success
> */
> typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
>                                                           struct 
> rte_event_dev_info *dev_info); ...
> struct rte_eventdev_ops {
>                              eventdev_info_get_t dev_infos_get;              /**< Get device info. */
> ...
> 
> While return value from it is used in lib/librte_ethdev/rte_ethdev.c:
> 
> int
> rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info 
> *dev_info) ...
>    diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>    if (diag != 0) {
> ...

At the Eventdev layer, info_get() can return int (particularly 0 on success, or -ERROR values).
At the Eventdev PMD layer, info_get() has a return void (the PMD cannot indicate failure on providing its info)

Hence, the info_get() typedef (for the PMD) is void, but the Eventdev layer itself checks some dev_id values etc, and can return -EINVAL or -ENOTSUP in case the PMD doesn't support info_get().


> Driver I'm debugging doesn't have any return statement in it's 
> dev_infos_get function which seems to cause it to have "result" of 
> last operation done in that function as return value.
> Though this behavior may be compiler specific but it should probably 
> be clarified and updated (change prototype of stop using return value) to avoid issue with it.

Perhaps provide some more detail on Eventdev/Ethdev that you're debugging a driver on, provide some links to specific parts of the code? It seems like (from Eventdev anyway) its meant to work this way.

> Br,
> Fredrik

Regards, -Harry

  reply	other threads:[~2021-02-01 10:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  9:21 Fredrik A Lindgren
2021-02-01  9:44 ` Van Haaren, Harry
2021-02-01 10:02   ` Fredrik A Lindgren [this message]
2021-02-01 10:31     ` Van Haaren, Harry
2021-02-01 12:49       ` Fredrik A Lindgren
2021-02-01 13:23         ` Van Haaren, Harry

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=VI1PR04MB4303A0A5649D8399667FB2DCC3B69@VI1PR04MB4303.eurprd04.prod.outlook.com \
    --to=fredrik.a.lindgren@tietoevry.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@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).