All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com
Subject: Re: [dpdk-dev] [PATCH v2 1/6] rte_ethdev: add function to check if device is owned
Date: Wed, 01 Apr 2020 23:42:44 +0200	[thread overview]
Message-ID: <3879228.8TcEBkooeH@xps> (raw)
In-Reply-To: <20200316160923.5335-2-stephen@networkplumber.org>

16/03/2020 17:09, Stephen Hemminger:
> This is a simple helper function to check if device is owned
> (being used as a sub-device).

I would suggest not restricting ownership to sub-device case.

> It is more convienent than having
> applications call rte_eth_dev_owner_get and check the result.

Yes it is more convenient but I don't like adding such simple wrapper.

I propose to extend rte_eth_dev_owner_get() behaviour:
if the owner pointer is NULL, the function returns 0 only
if an owner (not RTE_ETH_DEV_NO_OWNER) is found.

So instead of using your wrapper:
	if (rte_eth_dev_is_owned(port_id))
you can use:
	if (rte_eth_dev_owner_get(port_id, NULL) == 0)

[...]
> +int
> +rte_eth_dev_is_owned(uint16_t port_id)
> +{
> +	struct rte_eth_dev_owner owner;
> +	int ret;
> +
> +	ret = rte_eth_dev_owner_get(port_id, &owner);
> +	if (ret == 0)
> +		ret = (owner.id != RTE_ETH_DEV_NO_OWNER);
> +	return ret;
> +}




  reply	other threads:[~2020-04-01 21:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 17:20 [dpdk-dev] [PATCH 0/7] checking for owned ports in portmask Stephen Hemminger
2020-03-12 17:20 ` [dpdk-dev] [PATCH 1/7] ethdev: add function to test port ownership Stephen Hemminger
2020-03-15  7:45   ` Matan Azrad
2020-03-12 17:20 ` [dpdk-dev] [PATCH 2/7] examples/l2fwd-cat: block attempts to use owned ports Stephen Hemminger
2020-03-15  7:51   ` Matan Azrad
2020-03-12 17:20 ` [dpdk-dev] [PATCH 3/7] examples/l3fwd: " Stephen Hemminger
2020-03-12 17:20 ` [dpdk-dev] [PATCH 4/7] examples/l3fwd-acl: " Stephen Hemminger
2020-03-12 17:20 ` [dpdk-dev] [PATCH 5/7] examples/l3fwd-power: " Stephen Hemminger
2020-03-12 17:20 ` [dpdk-dev] [PATCH 6/7] examples/tep_termination: " Stephen Hemminger
2020-03-12 17:20 ` [dpdk-dev] [PATCH 7/7] examples/vhost: " Stephen Hemminger
2020-03-16 16:09 ` [dpdk-dev] [PATCH v2 0/6] check for owned ports in portmask Stephen Hemminger
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 1/6] rte_ethdev: add function to check if device is owned Stephen Hemminger
2020-04-01 21:42     ` Thomas Monjalon [this message]
2020-04-01 22:24       ` Stephen Hemminger
2020-04-02  8:04         ` Thomas Monjalon
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 2/6] examples/l2fwd-cat: block attempts to use owned ports Stephen Hemminger
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 3/6] examples/l3fwd: " Stephen Hemminger
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 4/6] examples/l3fwd-acl: " Stephen Hemminger
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 5/6] examples/l3fwd-power: " Stephen Hemminger
2020-03-16 16:09   ` [dpdk-dev] [PATCH v2 6/6] examples/tep_termination: " Stephen Hemminger
2020-03-17  8:18   ` [dpdk-dev] [PATCH v2 0/6] check for owned ports in portmask Matan Azrad
2020-04-02 17:19 ` [dpdk-dev] [PATCH v3 0/6] checking " Stephen Hemminger
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 1/6] rte_ethdev: change rte_eth_dev_owner_get to return error if unowned Stephen Hemminger
2020-04-10 15:45     ` Ferruh Yigit
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 2/6] examples/l2fwd-cat: make applicaton aware of port ownership Stephen Hemminger
2020-04-10 15:47     ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 3/6] examples/l3fwd: " Stephen Hemminger
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 4/6] examples/l3fwd-acl: " Stephen Hemminger
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 5/6] examples/l3fwd-power: " Stephen Hemminger
2020-04-02 17:19   ` [dpdk-dev] [PATCH v3 6/6] examples/tep_termination: rework the port setup logic Stephen Hemminger
2020-04-10 16:16     ` [dpdk-dev] [dpdk-stable] " 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=3879228.8TcEBkooeH@xps \
    --to=thomas@monjalon.net \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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.