Hi Chaoyong,
It is better to separate patch 3/8 and patch 6/8 from this series.
在 2023/10/8 9:50, Chaoyong He 写道:
From: Long Wu <long...@corigine.com>
Add API to support checking if the port id is a bonding
port id.
Signed-off-by: Long Wu <long...@corigine.com>
Reviewed-by: James Hershaw <james.hers...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
---
drivers/net/bonding/rte_eth_bond.h | 13 +++++++++++++
drivers/net/bonding/rte_eth_bond_api.c | 7 +++++++
drivers/net/bonding/version.map | 1 +
3 files changed, 21 insertions(+)
diff --git a/drivers/net/bonding/rte_eth_bond.h
b/drivers/net/bonding/rte_eth_bond.h
index 3f427b6bab..e8152a155f 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -461,6 +461,19 @@ __rte_experimental
int
rte_eth_bond_hw_create_get(uint16_t bonding_port_id, uint16_t member_port_id);
+/**
+ * Check whether bonding port id is valid.
+ *
+ * @param bonding_port_id
+ * Port ID of bonding device.
+ *
+ * @return
+ * 0 on success, negative value otherwise.
+ */
+__rte_experimental
+int
+rte_eth_bond_valid_bonding_port_id(uint16_t bonding_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 0113dfdc16..80d71529cc 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1214,3 +1214,10 @@ rte_eth_bond_hw_create_get(uint16_t bonding_port_id,
uint16_t member_port_id)
return member_dev->dev_ops->bond_hw_create_get(member_dev, bonding_dev);
}
+
+
+int
+rte_eth_bond_valid_bonding_port_id(uint16_t port_id)
+{
+ return valid_bonding_port_id(port_id);
+}
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index 3cfff51269..bf5e50521e 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -39,4 +39,5 @@ EXPERIMENTAL {
rte_eth_bond_notify_member_flag_get;
rte_eth_bond_notify_member_flag_set;
rte_eth_bond_notify_members;
+ rte_eth_bond_valid_bonding_port_id;
};