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 936ab8c3a0..02ddb496bb 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -427,6 +427,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 port_id + * Port ID of bonding device. + * + * @return + * true means the port is a bonding device, false means not. + */ +__rte_experimental +bool +rte_eth_bond_is_valid_port(uint16_t 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 656ddd35a7..07efc7a7e5 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -1212,3 +1212,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); } + + +bool +rte_eth_bond_is_valid_port(uint16_t port_id) +{ + return (valid_bonding_port_id(port_id) == 0); +} diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map index 3cfff51269..97ef24dcdb 100644 --- a/drivers/net/bonding/version.map +++ b/drivers/net/bonding/version.map @@ -33,6 +33,7 @@ EXPERIMENTAL { rte_eth_bond_8023ad_member_info; rte_eth_bond_active_members_get; rte_eth_bond_hw_create_get; + rte_eth_bond_is_valid_port; rte_eth_bond_member_add; rte_eth_bond_member_remove; rte_eth_bond_members_get; -- 2.39.1