37 int32_t BondingIsBond(uint16_t pid)
39 struct rte_eth_dev_info di;
40 int32_t ret = rte_eth_dev_info_get(pid, &di);
42 SCLogError(
"%s: unable to get device info (err: %s)", DPDKGetPortNameByPortID(pid),
47 return strcmp(di.driver_name,
"net_bonding") == 0 ? 0 : 1;
50 uint16_t BondingMemberDevicesGet(
51 uint16_t bond_pid, uint16_t bonded_devs[], uint16_t bonded_devs_length)
54 #if RTE_VERSION >= RTE_VERSION_NUM(23, 11, 0, 0)
55 int32_t
len = rte_eth_bond_members_get(bond_pid, bonded_devs, bonded_devs_length);
57 int32_t
len = rte_eth_bond_slaves_get(bond_pid, bonded_devs, bonded_devs_length);
61 FatalError(
"%s: no bonded devices found", DPDKGetPortNameByPortID(bond_pid));
63 FatalError(
"%s: unable to get bonded devices (err: %s)", DPDKGetPortNameByPortID(bond_pid),
69 "%s: bond port not supported in DPDK installation", DPDKGetPortNameByPortID(bond_pid));
73 int32_t BondingAllDevicesSameDriver(uint16_t bond_pid)
75 uint16_t bonded_devs[RTE_MAX_ETHPORTS] = { 0 };
76 uint16_t
len = BondingMemberDevicesGet(bond_pid, bonded_devs, RTE_MAX_ETHPORTS);
78 const char *driver_name = NULL, *first_driver_name = NULL;
79 struct rte_eth_dev_info di = { 0 };
81 for (uint16_t i = 0; i <
len; i++) {
82 int32_t ret = rte_eth_dev_info_get(bonded_devs[i], &di);
84 FatalError(
"%s: unable to get device info (err: %s)",
85 DPDKGetPortNameByPortID(bonded_devs[i]), rte_strerror(-ret));
88 first_driver_name = di.driver_name;
90 driver_name = di.driver_name;
91 if (strncmp(first_driver_name, driver_name,
92 MIN(strlen(first_driver_name), strlen(driver_name))) != 0) {
106 const char *BondingDeviceDriverGet(uint16_t bond_pid)
108 uint16_t bonded_devs[RTE_MAX_ETHPORTS] = { 0 };
109 BondingMemberDevicesGet(bond_pid, bonded_devs, RTE_MAX_ETHPORTS);
111 struct rte_eth_dev_info di = { 0 };
112 int32_t ret = rte_eth_dev_info_get(bonded_devs[0], &di);
114 FatalError(
"%s: unable to get device info (err: %s)",
115 DPDKGetPortNameByPortID(bonded_devs[0]), rte_strerror(-ret));
117 return di.driver_name;