From: Stephen Hemminger <stephen@networkplumber.org>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Stephen Hemminger <shemming@brocade.com>
Subject: [dpdk-dev] [PATCH 1/2] ethdev: make rte_eth_dev_is_valid_port public
Date: Wed, 10 Jun 2015 15:06:24 -0700 [thread overview]
Message-ID: <1433973985-17940-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1433973985-17940-1-git-send-email-stephen@networkplumber.org>
From: Stephen Hemminger <shemming@brocade.com>
The function rte_eth_dev_is_valid_port is good way to have all
drivers using same function and solves several hotplug related
bugs from drivers not checking attached flag.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_ether/rte_ethdev.c | 2 +-
lib/librte_ether/rte_ethdev.h | 11 +++++++++++
lib/librte_ether/rte_ether_version.map | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5a94654..ae4d86d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -401,7 +401,7 @@ rte_eth_driver_register(struct eth_driver *eth_drv)
rte_eal_pci_register(ð_drv->pci_drv);
}
-static int
+int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
if (port_id >= RTE_MAX_ETHPORTS ||
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16dbe00..b640e5b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1853,6 +1853,17 @@ extern int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
extern int rte_eth_dev_socket_id(uint8_t port_id);
/*
+ * Check if port_id of device is attached
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device
+ * @return
+ * 0 if port is out of range or not attached
+ * 1 if device is attached
+ */
+extern int rte_eth_dev_is_valid_port(uint8_t port_id);
+
+/*
* Allocate mbuf from mempool, setup the DMA physical address
* and then start RX for specified queue of a port. It is used
* when rx_deferred_start flag of the specified queue is true.
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index a2d25a6..8aa3501 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -63,6 +63,7 @@ DPDK_2.0 {
rte_eth_dev_set_vlan_offload;
rte_eth_dev_set_vlan_pvid;
rte_eth_dev_set_vlan_strip_on_queue;
+ rte_eth_dev_is_valid_port;
rte_eth_dev_socket_id;
rte_eth_dev_start;
rte_eth_dev_stop;
--
2.1.4
next prev parent reply other threads:[~2015-06-10 22:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 22:06 [dpdk-dev] [PATCH 0/2] Trivial bonding patches Stephen Hemminger
2015-06-10 22:06 ` Stephen Hemminger [this message]
2015-06-11 9:13 ` [dpdk-dev] [PATCH 1/2] ethdev: make rte_eth_dev_is_valid_port public Bruce Richardson
2015-06-10 22:06 ` [dpdk-dev] [PATCH 2/2] bonding: fix name and port validation Stephen Hemminger
2015-06-19 15:52 ` Declan Doherty
2015-07-20 0:32 ` [dpdk-dev] [PATCH 0/2] Trivial bonding patches Thomas Monjalon
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=1433973985-17940-2-git-send-email-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=shemming@brocade.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).