From: Matan Azrad <matan@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/7] ethdev: add function to test port ownership
Date: Sun, 15 Mar 2020 07:45:12 +0000 [thread overview]
Message-ID: <AM0PR0502MB40194C599A51D7E0D77B8E64D2F80@AM0PR0502MB4019.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20200312172047.19973-2-stephen@networkplumber.org>
Hi Stephen
From: Stephen Hemminger
> Applications using a port mask need a method to be able to test for (and
> reject) ethdev ports that are in use for other purposes.
>
There is already function which is thread safe to get this information:
rte_eth_dev_owner_get.
I don't think we need one more.
> Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
> Cc: matan@mellanox.com
> Cc: stable@dpdk.org
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/librte_ethdev/rte_ethdev.c | 9 +++++++++
> lib/librte_ethdev/rte_ethdev.h | 15 +++++++++++++++
> lib/librte_ethdev/rte_ethdev_version.map | 3 +++
> 3 files changed, 27 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 774c721b3484..38f99f417dba 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -685,6 +685,15 @@ rte_eth_dev_owner_unset(const uint16_t port_id,
> const uint64_t owner_id)
> return ret;
> }
>
> +int
> +rte_eth_dev_is_owned_by(uint16_t port_id, uint64_t owner_id) {
> + if (!rte_eth_dev_is_valid_port(port_id))
> + return 0;
> +
> + return rte_eth_devices[port_id].data->owner.id == owner_id; }
> +
> int
> rte_eth_dev_owner_delete(const uint64_t owner_id) { diff --git
> a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index
> d1a593ad112a..91a8f9578282 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -1530,6 +1530,21 @@ uint64_t rte_eth_find_next_owned_by(uint16_t
> port_id,
> (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
> p = rte_eth_find_next_owned_by(p + 1, o))
>
> +/**
> + * Test if a port is owned
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device
> + * @param owner_id
> + * The owner identifier.
> + * RTE_ETH_DEV_NO_OWNER means test if port is not owned.
> + * @return
> + * - 0 if port is out of range or not owned by owner_id
> + * - 1 if device is associated with owner_id
> + */
> +__rte_experimental
> +int rte_eth_dev_is_owned_by(uint16_t port_id, uint64_t owner_id);
> +
> /**
> * Iterates over valid ethdev ports.
> *
> diff --git a/lib/librte_ethdev/rte_ethdev_version.map
> b/lib/librte_ethdev/rte_ethdev_version.map
> index 3f32fdecf722..95231fe3410c 100644
> --- a/lib/librte_ethdev/rte_ethdev_version.map
> +++ b/lib/librte_ethdev/rte_ethdev_version.map
> @@ -230,4 +230,7 @@ EXPERIMENTAL {
>
> # added in 20.02
> rte_flow_dev_dump;
> +
> + # added in 20.05
> + rte_eth_dev_is_owned_by;
> };
> --
> 2.20.1
next prev parent reply other threads:[~2020-03-15 7:45 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 [this message]
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
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=AM0PR0502MB40194C599A51D7E0D77B8E64D2F80@AM0PR0502MB4019.eurprd05.prod.outlook.com \
--to=matan@mellanox.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--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 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).