DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gaetan Rivet <grive@u256.net>
To: dev@dpdk.org
Cc: stable@dpdk.org, Chas Williams <chas3@att.com>
Subject: [dpdk-dev] [PATCH v1 1/2] bonding: fix port id validity check on parsing
Date: Fri, 17 Apr 2020 18:42:06 +0200
Message-ID: <0d0871d076871a3c7d9ea0d2dc479a725151f8c0.1587137703.git.grive@u256.net> (raw)
In-Reply-To: <cover.1587137703.git.grive@u256.net>

If the port_id is equal to RTE_MAX_ETHPORTS, it should be considered
invalid. Additionally, UNUSED ports are also not valid port ids to be
used afterward.

To simplify following the ethdev API rules, use the exposed function
checking whether a port id is valid.

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable@dpdk.org

Cc: Chas Williams <chas3@att.com>
Signed-off-by: Gaetan Rivet <grive@u256.net>
 drivers/net/bonding/rte_eth_bond_args.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index abdf55261..35616fb8b 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -108,9 +108,8 @@ parse_port_id(const char *port_str)
-	if (port_id < 0 || port_id > RTE_MAX_ETHPORTS) {
-		RTE_BOND_LOG(ERR, "Slave port specified (%s) outside expected range",
-				port_str);
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		RTE_BOND_LOG(ERR, "Specified port (%s) is invalid", port_str);
 		return -1;
 	return port_id;

  reply	other threads:[~2020-04-17 16:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 16:42 [dpdk-dev] [PATCH v1 0/2] bonding: fix port id check and PCI addr cmp Gaetan Rivet
2020-04-17 16:42 ` Gaetan Rivet [this message]
2020-11-26  2:45   ` [dpdk-dev] [PATCH v1, 1/2] bonding: fix port id validity check on parsing Min Hu (Connor)
2020-12-07 13:34     ` Ferruh Yigit
2020-04-17 16:42 ` [dpdk-dev] [PATCH v1 2/2] bonding: fix PCI address comparison on non-pci ports Gaetan Rivet
2020-11-26  2:24   ` [dpdk-dev] [v1, " Min Hu (Connor)
2020-12-07 14:07     ` Gaëtan Rivet
2020-12-16 12:14       ` Min Hu (Connor)
2020-12-17 10:53         ` [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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d0871d076871a3c7d9ea0d2dc479a725151f8c0.1587137703.git.grive@u256.net \
    --to=grive@u256.net \
    --cc=chas3@att.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \


* 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 \
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:

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