DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	James Hershaw <james.hershaw@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v4 2/6] ethdev: add API to get hardware creation of bonding port
Date: Wed, 18 Oct 2023 15:48:17 +0800	[thread overview]
Message-ID: <20231018074821.1908906-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231018074821.1908906-1-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

After bonding port notification, member port hardware may create the
bonding port. We want to get the result of creatition, so we add this
API to do the getting action.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/rte_eth_bond.h     | 15 ++++++++++++++
 drivers/net/bonding/rte_eth_bond_api.c | 28 ++++++++++++++++++++++++++
 drivers/net/bonding/version.map        |  1 +
 lib/ethdev/ethdev_driver.h             | 20 ++++++++++++++++++
 4 files changed, 64 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
index f6c773615c..987269b323 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -398,6 +398,21 @@ __rte_experimental
 int
 rte_eth_bond_notify_members(uint16_t bonding_port_id);
 
+/**
+ * Get the status of specified bonding port created by member port hardware.
+ *
+ * @param bonding_port_id
+ *   Port ID of bonding device.
+ * @param member_port_id
+ *   Port ID of member device.
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int
+rte_eth_bond_hw_create_get(uint16_t bonding_port_id, uint16_t member_port_id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 239f86ee92..317c3c1542 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1170,3 +1170,31 @@ rte_eth_bond_notify_members(uint16_t bonding_port_id)
 
 	return 0;
 }
+
+int
+rte_eth_bond_hw_create_get(uint16_t bonding_port_id, uint16_t member_port_id)
+{
+	uint32_t i;
+	struct rte_eth_dev *bonding_dev;
+	struct rte_eth_dev *member_dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonding_port_id(bonding_port_id) != 0)
+		return -EINVAL;
+
+	bonding_dev = &rte_eth_devices[bonding_port_id];
+	internals = bonding_dev->data->dev_private;
+	for (i = 0; i < internals->member_count; i++) {
+		if (internals->members[i].port_id == member_port_id)
+			break;
+	}
+
+	if (i == internals->member_count)
+		return -EINVAL;
+
+	member_dev = &rte_eth_devices[member_port_id];
+	if (*member_dev->dev_ops->bond_hw_create_get == NULL)
+		return -ENOTSUP;
+
+	return member_dev->dev_ops->bond_hw_create_get(member_dev, bonding_dev);
+}
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index 3bd5e8ad11..3cfff51269 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -32,6 +32,7 @@ EXPERIMENTAL {
 	global:
 	rte_eth_bond_8023ad_member_info;
 	rte_eth_bond_active_members_get;
+	rte_eth_bond_hw_create_get;
 	rte_eth_bond_member_add;
 	rte_eth_bond_member_remove;
 	rte_eth_bond_members_get;
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index f626f971e5..18ff5db969 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1231,6 +1231,21 @@ typedef int (*eth_map_aggr_tx_affinity_t)(struct rte_eth_dev *dev, uint16_t tx_q
 typedef int (*eth_bond_notify_member)(struct rte_eth_dev *dev,
 				      struct rte_eth_dev *bonding_dev);
 
+/**
+ * @internal
+ * Get the status of specified bonding port created by member port hardware.
+ *
+ * @param dev
+ *   Member port (ethdev) handle.
+ * @param bonding_dev
+ *   Bonding port (ethdev) handle.
+ *
+ * @return
+ *   Negative on error, 0 on success.
+ */
+typedef int (*eth_bond_hw_create_get)(struct rte_eth_dev *dev,
+					  struct rte_eth_dev *bonding_dev);
+
 /**
  * @internal A structure containing the functions exported by an Ethernet driver.
  */
@@ -1473,6 +1488,11 @@ struct eth_dev_ops {
 
 	/** Notify the member port of bonding port information */
 	eth_bond_notify_member bond_notify_member;
+	/**
+	 * Get the status of whether bonding port is successfully created by
+	 * the member port hardware.
+	 */
+	eth_bond_hw_create_get bond_hw_create_get;
 };
 
 /**
-- 
2.39.1


  parent reply	other threads:[~2023-10-18  7:49 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  2:40 [PATCH 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-05  2:40 ` [PATCH 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-05  2:40 ` [PATCH 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-05  2:40 ` [PATCH 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-05  2:40 ` [PATCH 4/8] net/bonding: add bonding port arguments Chaoyong He
2023-10-05  2:40 ` [PATCH 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-05  2:40 ` [PATCH 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-05  2:40 ` [PATCH 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-05  2:40 ` [PATCH 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-07  1:34 ` [PATCH v2 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-07  1:34   ` [PATCH v2 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-07 15:49     ` Stephen Hemminger
2023-10-08  1:37       ` Chaoyong He
2023-10-07  1:34   ` [PATCH v2 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-07  1:34   ` [PATCH v2 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-07  1:34   ` [PATCH v2 4/8] net/bonding: add bonding port arguments Chaoyong He
2023-10-07  1:34   ` [PATCH v2 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-07  1:34   ` [PATCH v2 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-07  1:34   ` [PATCH v2 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-07  1:34   ` [PATCH v2 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-08  1:50   ` [PATCH v3 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-08  1:50     ` [PATCH v3 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-08  2:49       ` lihuisong (C)
2023-10-09  3:11         ` 回复: " Long Wu
2023-10-17  8:27           ` lihuisong (C)
2023-10-18  2:16             ` Chaoyong He
2023-10-08  1:50     ` [PATCH v3 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-08  1:50     ` [PATCH v3 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-08  1:50     ` [PATCH v3 4/8] net/bonding: add bonding port arguments Chaoyong He
2023-10-08  1:50     ` [PATCH v3 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-08  1:50     ` [PATCH v3 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-08  1:50     ` [PATCH v3 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-17  8:33       ` lihuisong (C)
2023-10-17  9:25         ` Chaoyong He
2023-10-17 11:34           ` lihuisong (C)
2023-10-18  1:53             ` Chaoyong He
2023-10-17 15:56         ` Stephen Hemminger
2023-10-08  1:50     ` [PATCH v3 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-13  2:22     ` [PATCH v3 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-13 12:53       ` Ferruh Yigit
2023-10-18  7:48     ` [PATCH v4 0/6] " Chaoyong He
2023-10-18  7:48       ` [PATCH v4 1/6] ethdev: add member notification for bonding port Chaoyong He
2023-10-18  7:48       ` Chaoyong He [this message]
2023-10-18  7:48       ` [PATCH v4 3/6] net/bonding: add bonding port arguments Chaoyong He
2023-10-18  7:48       ` [PATCH v4 4/6] net/bonding: support add port by data name Chaoyong He
2023-10-18  7:48       ` [PATCH v4 5/6] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-18  7:48       ` [PATCH v4 6/6] net/bonding: add commands for bonding port notification Chaoyong He
2023-11-15 16:01       ` [PATCH v4 0/6] Enhance the bond framework to support offload Ferruh Yigit
2023-11-16  1:45         ` Chaoyong He
2023-12-26  2:37       ` [PATCH v5 00/14] " Chaoyong He
2023-12-26  2:37         ` [PATCH v5 01/14] ethdev: add member notification for bonding port Chaoyong He
2023-12-26  2:37         ` [PATCH v5 02/14] ethdev: add API to get firmware creation of " Chaoyong He
2023-12-26  2:37         ` [PATCH v5 03/14] net/bonding: add bonding port arguments Chaoyong He
2023-12-26  2:37         ` [PATCH v5 04/14] net/bonding: support add port by data name Chaoyong He
2023-12-26  2:37         ` [PATCH v5 05/14] net/bonding: support checking valid bonding port ID Chaoyong He
2023-12-26  2:37         ` [PATCH v5 06/14] net/bonding: add commands for bonding port notification Chaoyong He
2023-12-26  2:37         ` [PATCH v5 07/14] net/bonding: create new rte flow header file Chaoyong He
2023-12-26  2:37         ` [PATCH v5 08/14] net/nfp: add bond firmware creation initialization Chaoyong He
2023-12-26  2:37         ` [PATCH v5 09/14] net/nfp: reset bond configuration of firmware Chaoyong He
2023-12-26  2:37         ` [PATCH v5 10/14] net/nfp: handle link event of bond firmware creation Chaoyong He
2023-12-26  2:37         ` [PATCH v5 11/14] net/nfp: support bond member notification Chaoyong He
2023-12-26  2:37         ` [PATCH v5 12/14] net/nfp: handle bond packets from firmware Chaoyong He
2023-12-26  2:37         ` [PATCH v5 13/14] net/nfp: support getting bond firmware creation Chaoyong He
2023-12-26  2:37         ` [PATCH v5 14/14] net/nfp: support offloading bond-flow Chaoyong He
2023-12-26  7:28         ` [PATCH v6 00/14] Enhance the bond framework to support offload Chaoyong He
2023-12-26  7:28           ` [PATCH v6 01/14] ethdev: add member notification for bonding port Chaoyong He
2023-12-26  7:28           ` [PATCH v6 02/14] ethdev: add API to get firmware creation of " Chaoyong He
2023-12-26  7:28           ` [PATCH v6 03/14] net/bonding: add bonding port arguments Chaoyong He
2023-12-26  7:28           ` [PATCH v6 04/14] net/bonding: support add port by data name Chaoyong He
2023-12-26  7:28           ` [PATCH v6 05/14] net/bonding: support checking valid bonding port ID Chaoyong He
2023-12-26  7:28           ` [PATCH v6 06/14] net/bonding: add commands for bonding port notification Chaoyong He
2023-12-26  7:28           ` [PATCH v6 07/14] net/bonding: create new rte flow header file Chaoyong He
2023-12-26  7:28           ` [PATCH v6 08/14] net/nfp: add bond firmware creation initialization Chaoyong He
2023-12-26  7:28           ` [PATCH v6 09/14] net/nfp: reset bond configuration of firmware Chaoyong He
2023-12-26  7:28           ` [PATCH v6 10/14] net/nfp: handle link event of bond firmware creation Chaoyong He
2023-12-26  7:28           ` [PATCH v6 11/14] net/nfp: support bond member notification Chaoyong He
2023-12-26  7:28           ` [PATCH v6 12/14] net/nfp: handle bond packets from firmware Chaoyong He
2023-12-26  7:28           ` [PATCH v6 13/14] net/nfp: support getting bond firmware creation Chaoyong He
2023-12-26  7:28           ` [PATCH v6 14/14] net/nfp: support offloading bond-flow Chaoyong He
2024-09-22 22:30           ` [PATCH v6 00/14] Enhance the bond framework to support offload 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=20231018074821.1908906-3-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=james.hershaw@corigine.com \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.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).