support socket direct mode bonding
v5 cover support socket direct mode bonding
In socket direct mode, it's possible to bind any two (maybe four in the future) PCIe devices with IDs like xxxx:xx:xx.x and yyyy:yy:yy.y. Bonding member interfaces are unnecessary to have the same PCIe domain/bus/device ID anymore.
Doesn't need to backport to DPDK 20.11
v2: fix ci warnings.
v3: add description in release_21_11.rst.
v4: add description in mlx5.rst.
v5: rebase on top of master-net-mlx
Rongwei Liu (2):
common/mlx5: support pcie device guid query
net/mlx5: support socket direct mode bonding
doc/guides/nics/mlx5.rst | 4 ++ doc/guides/rel_notes/release_21_11.rst | 4 ++ drivers/common/mlx5/linux/mlx5_common_os.c | 40 ++++++++++++++++++++ drivers/common/mlx5/linux/mlx5_common_os.h | 19 ++++++++++ drivers/net/mlx5/linux/mlx5_os.c | 43 +++++++++++++++++----- 5 files changed, 101 insertions(+), 9 deletions(-)
Signature · 1 line
2.27.0
PATCH v5 1/2 common/mlx5: support pcie device guid query
sysfs entry "phys_switch_id" holds each PCIe device' guid.
The devices which reside in the same physical NIC should have the same guid.
--- drivers/common/mlx5/linux/mlx5_common_os.c | 40 ++++++++++++++++++++++ drivers/common/mlx5/linux/mlx5_common_os.h | 19 ++++++++++ 2 files changed, 59 insertions(+)
drivers/common/mlx5/linux/mlx5_common_os.c +40 -0
@@ -2,6 +2,7 @@* Copyright 2020 Mellanox Technologies, Ltd */ +#include <sys/types.h> #include <unistd.h> #include <string.h> #include <stdio.h>
@@ -704,3 +705,42 @@ mlx5_os_open_device(struct mlx5_common_device *cdev, uint32_t classes)DRV_LOG (ERR ,"Failed to open IB device \"%s\"." , ibv->name);return -rte_errno; } +int +mlx5_get_device_guid (const struct rte_pci_addr *dev,uint8_t *guid,size_t len) +{ +char tmp[512 ]; +char cur_ifname[IF_NAMESIZE +1 ]; +FILE *id_file; +DIR *dir; +struct dirent *ptr; +int ret; + +if (guid ==NULL || len <sizeof (u_int64_t) +1 ) +return -1 ; +memset (guid,0 , len); +snprintf (tmp,sizeof (tmp),"/sys/bus/pci/devices/%04x:%02x:%02x.%x/net" , + dev->domain, dev->bus, dev->devid, dev->function); + dir =opendir (tmp); +if (dir ==NULL ) +return -1 ; +/* Traverse to identify PF interface */ +do { + ptr =readdir (dir); +if (ptr ==NULL || ptr->d_type !=DT_DIR ) { +closedir (dir); +return -1 ; + } + }while (strchr (ptr->d_name,'.' ) ||strchr (ptr->d_name,'_' ) || +strchr (ptr->d_name,'v' )); +snprintf (cur_ifname,sizeof (cur_ifname),"%s" , ptr->d_name); +closedir (dir); +snprintf (tmp +strlen (tmp),sizeof (tmp) -strlen (tmp), +"/%s/phys_switch_id" , cur_ifname); +/* Older OFED like 5.3 doesn't support read */ + id_file =fopen (tmp,"r" ); +if (!id_file) +return 0 ; + ret =fscanf (id_file,"%16s" , guid); +fclose (id_file); +return ret; +}
drivers/common/mlx5/linux/mlx5_common_os.h +19 -0
@@ -284,4 +284,23 @@ mlx5_os_free(void *addr)void mlx5_set_context_attr (struct rte_device *dev,struct ibv_context *ctx); +/** +* This is used to query system_image_guid as describing in PRM. +* +* @param dev[in] +* Pointer to a device instance as PCIe id. +* @param guid[out] +* Pointer to the buffer to hold device guid. +* Guid is uint64_t and corresponding to 17 bytes string. +* @param len[in] +* Guid buffer length, 17 bytes at least. +* +* @return +* -1 if internal failure. +* 0 if OFED doesn't support. +* >0 if success. +*/ +int +mlx5_get_device_guid (const struct rte_pci_addr *dev,uint8_t *guid,size_t len); +#endif /* RTE_PMD_MLX5_COMMON_OS_H_ */
Signature · 1 line
2.27.0
PATCH v5 2/2 net/mlx5: support socket direct mode bonding
In reply to Rongwei LiuIn socket direct mode, it's possible to bind any two (maybe four in future) PCIe devices with IDs like xxxx:xx:xx.x and yyyy:yy:yy.y. Bonding member interfaces are unnecessary to have the same PCIe domain/bus/device ID anymore,
Kernel driver uses "system_image_guid" to identify if devices can be bound together or not. Sysfs "phys_switch_id" is used to get "system_image_guid" of each network interface.
OFED 5.4+ is required to support "phys_switch_id".
--- doc/guides/nics/mlx5.rst | 4 +++ doc/guides/rel_notes/release_21_11.rst | 4 +++ drivers/net/mlx5/linux/mlx5_os.c | 43 ++++++++++++++++++++------ 3 files changed, 42 insertions(+), 9 deletions(-)
doc/guides/nics/mlx5.rst +4 -0
@@ -468,6 +468,10 @@ Limitations - TXQ affinity subjects to HW hash once enabled. +- Bonding under socket direct mode + + - Needs OFED 5.4+. + Statistics ----------
doc/guides/rel_notes/release_21_11.rst +4 -0
@@ -217,6 +217,10 @@ New Features * Added PDCP short MAC-I support. * Added raw vector datapath API support. +* **Updated Mellanox mlx5 driver.** + + * Added socket direct mode bonding support. + * **Updated NXP dpaa2_sec crypto PMD.** * Added PDCP short MAC-I support.
drivers/net/mlx5/linux/mlx5_os.c +34 -9
79 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [dpdk-dev] [PATCH v5 2/2] net/mlx5: support socket direct mode bonding
Hi,
Quoted 49 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Tuesday, October 26, 2021 11:49 AM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH v5 2/2] net/mlx5: support socket direct mode bondingIn socket direct mode, it's possible to bind any two (maybe four in future) PCIe devices with IDs like xxxx:xx:xx.x and yyyy:yy:yy.y. Bonding member interfaces are unnecessary to have the same PCIe domain/bus/device ID anymore,
Kernel driver uses "
system_image_guid" to identify if devices can be bound together or not. Sysfs "phys_switch_id" is used to get "system_image_guid" of each network interface.OFED 5.4+ is required to support "
phys_switch_id".Signed-off-by Rongwei Liu <[email protected]>--- doc/guides/nics/mlx5.rst | 4 +++ doc/guides/rel_notes/release_21_11.rst | 4 +++ drivers/net/mlx5/linux/mlx5_os.c | 43 ++++++++++++++++++++------ 3 files changed, 42 insertions(+), 9 deletions(-)doc/guides/nics/mlx5.rst index renamed from doc/guides/nics/mlx5.rst +0
-0
47709d93b3..45f44c97d7100644doc/guides/nics/mlx5.rst +4
-0@@ -468,6 +468,10 @@ Limitations - TXQ affinity subjects to HW hash once enabled. +- Bonding under socket direct mode + + - Needs OFED 5.4+. + Statistics ----------doc/guides/rel_notes/release_21_11.rst +0
-0
doc/guides/rel_notes/release_21_11.rst New Features · line 222
Quoted 6 lines
doc/guides/rel_notes/release_21_11.rst +3
-0@@ -217,6 +217,10 @@ New Features * Added PDCP short MAC-I support. * Added raw vector datapath API support. +* **Updated Mellanox mlx5 driver.** + + * Added socket direct mode bonding support.
This part needs to be in the previously added update in the release notes. Will fix during integration,
Kindest regards
Raslan Darawsheh
Hi,
Quoted 33 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Tuesday, October 26, 2021 11:48 AM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH v5 0/2] support socket direct mode bondingIn socket direct mode, it's possible to bind any two (maybe four in the future) PCIe devices with IDs like xxxx:xx:xx.x and yyyy:yy:yy.y. Bonding member interfaces are unnecessary to have the same PCIe domain/bus/device ID anymore.
Doesn't need to backport to DPDK 20.11
v2: fix ci warnings.
v3: add description inrelease_21_11.rst.
v4: add description inmlx5.rst.
v5: rebase on top of master-net-mlxRongwei Liu (2):
common/mlx5: support pcie device guid query
net/mlx5: support socket direct mode bondingdoc/guides/nics/mlx5.rst | 4 ++ doc/guides/rel_notes/release_21_11.rst | 4 ++ drivers/common/mlx5/linux/mlx5_common_os.c | 40 ++++++++++++++++++++ drivers/common/mlx5/linux/mlx5_common_os.h | 19 ++++++++++ drivers/net/mlx5/linux/mlx5_os.c | 43 +++++++++++++++++----- 5 files changed, 101 insertions(+), 9 deletions(-)
Quoted 2 lines
--
2.27.0
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh