mlx5 Windows support - part #6
Subsystems (2)
cover mlx5 Windows support - part #6
This patch series is part of preparing mlx5 PMD to compile and run under Windows OS. Part #6
Ophir Munk (19):
common/mlx5/windows: add missing DV and IBV definitions mlx5/windows: add mlx5 macros for fs name and path common/mlx5: add rte compatibility header file common/mlx5/windows: add DevX UAR getters net/mlx5/windows: add memory region callbacks net/mlx5/windows: add stubs for MP requests net/mlx5/windows: add ethdev stub operations net/mlx5/windws: add VLAN stubs net/mlx5/windows: support open device net/mlx5/windws: spawn eth devices net/mlx5/linux: wrap adjust flow priority with OS calls net/mlx5/linux: add OS default miss flow action net/mlx5/linux: fix add OS dest_devx_tir action net/mlx5/windows: introduce flow support net/mlx5/windows: create flow matcher object net/mlx5/windows: create flow action dest TIR object net/mlx5/windows: create flow rule
net/mlx5: use HAVE_INFINIBAND_VERBS_H in shared code net/mlx5: fix separating eth_dev_ops per OS
Tal Shnaiderman (16):
common/mlx5/windows: wrap event channel APIs with OS calls net/mlx5/windows: support get mac net/mlx5/windows: support link update net/mlx5/windows: support read clock net/mlx5/windows: support get mtu net/mlx5/windows: support get interface name net/mlx5/windows: support device removed query net/mlx5/windows: support get pdn net/mlx5/windows: initial probing implementation net/mlx5/windows: support VF PCI address net/mlx5: define MLX5_NAMESIZE for device interface size net/mlx5: use OS independent code in ASO feature
mlx5: use init function for ctx list mutex
mlx5: use OS function for dr_sync_domain
mlx5: do not fail on IPv6 broadcast flow creation failure net/mlx5: fix warnings on comparison sign mismatch
drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 7 + drivers/common/mlx5/windows/mlx5_common_os.h | 104 +++ drivers/common/mlx5/windows/mlx5_glue.c | 47 ++ drivers/common/mlx5/windows/mlx5_glue.h | 2 + drivers/common/mlx5/windows/mlx5_win_defs.h | 228 +++++++ drivers/common/mlx5/windows/mlx5_win_ext.h | 8 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 +- drivers/net/mlx5/linux/mlx5_flow_os.h | 68 ++ drivers/net/mlx5/linux/mlx5_os.c | 156 +---- drivers/net/mlx5/linux/mlx5_os.h | 10 +- drivers/net/mlx5/mlx5.c | 158 ++++- drivers/net/mlx5/mlx5.h | 17 +- drivers/net/mlx5/mlx5_devx.c | 15 +- drivers/net/mlx5/mlx5_flow.c | 10 +- drivers/net/mlx5/mlx5_flow.h | 16 +- drivers/net/mlx5/mlx5_flow_age.c | 15 +- drivers/net/mlx5/mlx5_flow_dv.c | 23 +- drivers/net/mlx5/mlx5_flow_verbs.c | 6 + drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/windows/meson.build | 4 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 391 +++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 240 +++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 373 +++++++++++ drivers/net/mlx5/windows/mlx5_mp_os.c | 71 ++ drivers/net/mlx5/windows/mlx5_os.c | 969 ++++++++++++++++++++++++--- drivers/net/mlx5/windows/mlx5_os.h | 19 + drivers/net/mlx5/windows/mlx5_vlan_os.c | 83 +++ 28 files changed, 2730 insertions(+), 323 deletions(-) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_mp_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_vlan_os.c
Signature · 1 line
2.16.1.windows.4
PATCH 1/35 common/mlx5/windows: add missing DV and IBV definitions
From: Ophir Munk <[email protected]>
Add missing DV and IBV definition to file mlx5_win_defs.h. The definitions originated from rdma-core library which is not part of Windows. They are referenced in shared files that must compile under Windows such as mlx5_flow_dv.c and mlx5_rxtx.c.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 141 ++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+)
drivers/common/mlx5/windows/mlx5_win_defs.h +141 -0
@@ -22,4 +22,145 @@ enum {MLX5_CQE_RESP_ERR =14 , MLX5_CQE_INVALID = 15, }; + +enum { +MLX5_OPCODE_NOP =0x00 , +MLX5_OPCODE_SEND_INVAL =0x01 , +MLX5_OPCODE_RDMA_WRITE =0x08 , +MLX5_OPCODE_RDMA_WRITE_IMM =0x09 , +MLX5_OPCODE_SEND =0x0a , +MLX5_OPCODE_SEND_IMM =0x0b , +MLX5_OPCODE_TSO =0x0e , +MLX5_OPCODE_RDMA_READ =0x10 , +MLX5_OPCODE_ATOMIC_CS =0x11 , +MLX5_OPCODE_ATOMIC_FA =0x12 , +MLX5_OPCODE_ATOMIC_MASKED_CS =0x14 , +MLX5_OPCODE_ATOMIC_MASKED_FA =0x15 , +MLX5_OPCODE_FMR =0x19 , +MLX5_OPCODE_LOCAL_INVAL =0x1b , +MLX5_OPCODE_CONFIG_CMD =0x1f , +MLX5_OPCODE_UMR =0x25 , +MLX5_OPCODE_TAG_MATCHING =0x28 +}; + +enum mlx5dv_cq_init_attr_mask { +MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE =1 <<0 , +MLX5DV_CQ_INIT_ATTR_MASK_FLAGS =1 <<1 , +MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE =1 <<2 , +}; + +enum mlx5dv_cqe_comp_res_format { +MLX5DV_CQE_RES_FORMAT_HASH =1 <<0 , +MLX5DV_CQE_RES_FORMAT_CSUM =1 <<1 , +MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX =1 <<2 , +}; + +enum ibv_access_flags { +IBV_ACCESS_LOCAL_WRITE =1 , +IBV_ACCESS_REMOTE_WRITE =1 <<1 , +IBV_ACCESS_REMOTE_READ =1 <<2 , +IBV_ACCESS_REMOTE_ATOMIC =1 <<3 , +IBV_ACCESS_MW_BIND =1 <<4 , +IBV_ACCESS_ZERO_BASED =1 <<5 , +IBV_ACCESS_ON_DEMAND =1 <<6 , +}; + +enum mlx5_ib_uapi_devx_create_event_channel_flags { +MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA =1 <<0 , +}; + +#define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA \ + MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA + +enum { +MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR =0x01 , +MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR =0x02 , +MLX5_CQE_SYNDROME_LOCAL_PROT_ERR =0x04 , +MLX5_CQE_SYNDROME_WR_FLUSH_ERR =0x05 , +MLX5_CQE_SYNDROME_MW_BIND_ERR =0x06 , +MLX5_CQE_SYNDROME_BAD_RESP_ERR =0x10 , +MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR =0x11 , +MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR =0x12 , +MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR =0x13 , +MLX5_CQE_SYNDROME_REMOTE_OP_ERR =0x14 , +MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR =0x15 , +MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR =0x16 , +MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR =0x22 , +}; + +enum { +MLX5_ETH_WQE_L3_CSUM = (1 <<6 ), +MLX5_ETH_WQE_L4_CSUM = (1 <<7 ), +}; + +/* +* RX Hash fields enable to set which incoming packet's field should +* participates in RX Hash. Each flag represent certain packet's field, +* when the flag is set the field that is represented by the flag will +* participate in RX Hash calculation. +* Note: IPV4 and IPV6 flags can't be enabled together on the same QP, +* TCP and UDP flags can't be enabled together on the same QP. +*/ +enum ibv_rx_hash_fields { +IBV_RX_HASH_SRC_IPV4 =1 <<0 , +IBV_RX_HASH_DST_IPV4 =1 <<1 , +IBV_RX_HASH_SRC_IPV6 =1 <<2 , +IBV_RX_HASH_DST_IPV6 =1 <<3 , +IBV_RX_HASH_SRC_PORT_TCP =1 <<4 , +IBV_RX_HASH_DST_PORT_TCP =1 <<5 , +IBV_RX_HASH_SRC_PORT_UDP =1 <<6 , +IBV_RX_HASH_DST_PORT_UDP =1 <<7 , +IBV_RX_HASH_IPSEC_SPI =1 <<8 , +IBV_RX_HASH_INNER = (1 <<31 ), +}; + +enum { +MLX5_RCV_DBR =0 , +MLX5_SND_DBR =1 , +}; + +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 0x0 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL 0x1 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 0x2 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL 0x3 +#endif + +struct mlx5_err_cqe { +uint8_t rsvd0[32 ]; +uint32_t srqn; +uint8_t rsvd1[18 ]; +uint8_t vendor_err_synd; +uint8_t syndrome; +uint32_t s_wqe_opcode_qpn; +uint16_t wqe_counter; +uint8_t signature; +uint8_t op_own; +}; + +struct mlx5_wqe_srq_next_seg { +uint8_t rsvd0[2 ]; +rte_be16_t next_wqe_index; +uint8_t signature; +uint8_t rsvd1[11 ]; +}; + +enum ibv_wq_state { +IBV_WQS_RESET , +IBV_WQS_RDY , +IBV_WQS_ERR , +IBV_WQS_UNKNOWN +}; + +struct mlx5_wqe_data_seg { +rte_be32_t byte_count; +rte_be32_t lkey; +rte_be64_t addr; +};#endif /* __MLX5_WIN_DEFS_H__ */
Signature · 1 line
2.16.1.windows.4
v2 cover mlx5 Windows support - part #6
This patch series is part of preparing mlx5 PMD to compile and run under Windows OS. Part #6
Depends-on: series-14480 ("mlx5 Windows support - part #5")
v2: Fix style issues.
Ophir Munk (18):
common/mlx5/windows: add missing DV and IBV definitions common/mlx5: add rte compatibility header file common/mlx5/windows: add DevX UAR getters net/mlx5/windows: add memory region callbacks net/mlx5/windows: add stubs for MP requests net/mlx5/windows: add ethdev stub operations net/mlx5/windws: add VLAN stubs net/mlx5/windows: support open device net/mlx5/windws: spawn eth devices net/mlx5/linux: wrap adjust flow priority with OS calls net/mlx5/linux: add OS default miss flow action net/mlx5/linux: fix add OS dest_devx_tir action net/mlx5/windows: introduce flow support net/mlx5/windows: create flow matcher object net/mlx5/windows: create flow action dest TIR object net/mlx5/windows: create flow rule
net/mlx5: use HAVE_INFINIBAND_VERBS_H in shared code net/mlx5: fix separating eth_dev_ops per OS
Tal Shnaiderman (17):
mlx5/windows: add mlx5 macros for fs name and path common/mlx5/windows: wrap event channel APIs with OS calls net/mlx5/windows: support get mac net/mlx5/windows: support link update net/mlx5/windows: support read clock net/mlx5/windows: support get mtu net/mlx5/windows: support get interface name net/mlx5/windows: support device removed query net/mlx5/windows: support get pdn net/mlx5/windows: initial probing implementation net/mlx5/windows: support VF PCI address net/mlx5: define MLX5_NAMESIZE for device interface size net/mlx5: use OS independent code in ASO feature
mlx5: use init function for ctx list mutex
mlx5: use OS function for dr_sync_domain
mlx5: do not fail on IPv6 broadcast flow creation failure net/mlx5: fix warnings on comparison sign mismatch
drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 7 + drivers/common/mlx5/windows/mlx5_common_os.h | 104 +++ drivers/common/mlx5/windows/mlx5_glue.c | 47 ++ drivers/common/mlx5/windows/mlx5_glue.h | 2 + drivers/common/mlx5/windows/mlx5_win_defs.h | 228 +++++++ drivers/common/mlx5/windows/mlx5_win_ext.h | 8 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 +- drivers/net/mlx5/linux/mlx5_flow_os.h | 68 ++ drivers/net/mlx5/linux/mlx5_os.c | 156 +---- drivers/net/mlx5/linux/mlx5_os.h | 10 +- drivers/net/mlx5/mlx5.c | 158 ++++- drivers/net/mlx5/mlx5.h | 18 +- drivers/net/mlx5/mlx5_devx.c | 15 +- drivers/net/mlx5/mlx5_flow.c | 10 +- drivers/net/mlx5/mlx5_flow.h | 16 +- drivers/net/mlx5/mlx5_flow_age.c | 15 +- drivers/net/mlx5/mlx5_flow_dv.c | 23 +- drivers/net/mlx5/mlx5_flow_verbs.c | 6 + drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/windows/meson.build | 4 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 391 +++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 240 +++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 373 +++++++++++ drivers/net/mlx5/windows/mlx5_mp_os.c | 71 ++ drivers/net/mlx5/windows/mlx5_os.c | 968 ++++++++++++++++++++++++--- drivers/net/mlx5/windows/mlx5_os.h | 19 + drivers/net/mlx5/windows/mlx5_vlan_os.c | 83 +++ 28 files changed, 2730 insertions(+), 323 deletions(-) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_mp_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_vlan_os.c
Signature · 1 line
2.16.1.windows.4
PATCH v2 1/35 common/mlx5/windows: add missing DV and IBV definitions
From: Ophir Munk <[email protected]>
Add missing DV and IBV definition to file mlx5_win_defs.h. The definitions originated from rdma-core library which is not part of Windows. They are referenced in shared files that must compile under Windows such as mlx5_flow_dv.c and mlx5_rxtx.c.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 141 ++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+)
drivers/common/mlx5/windows/mlx5_win_defs.h +141 -0
@@ -22,4 +22,145 @@ enum {MLX5_CQE_RESP_ERR =14 , MLX5_CQE_INVALID = 15, }; + +enum { +MLX5_OPCODE_NOP =0x00 , +MLX5_OPCODE_SEND_INVAL =0x01 , +MLX5_OPCODE_RDMA_WRITE =0x08 , +MLX5_OPCODE_RDMA_WRITE_IMM =0x09 , +MLX5_OPCODE_SEND =0x0a , +MLX5_OPCODE_SEND_IMM =0x0b , +MLX5_OPCODE_TSO =0x0e , +MLX5_OPCODE_RDMA_READ =0x10 , +MLX5_OPCODE_ATOMIC_CS =0x11 , +MLX5_OPCODE_ATOMIC_FA =0x12 , +MLX5_OPCODE_ATOMIC_MASKED_CS =0x14 , +MLX5_OPCODE_ATOMIC_MASKED_FA =0x15 , +MLX5_OPCODE_FMR =0x19 , +MLX5_OPCODE_LOCAL_INVAL =0x1b , +MLX5_OPCODE_CONFIG_CMD =0x1f , +MLX5_OPCODE_UMR =0x25 , +MLX5_OPCODE_TAG_MATCHING =0x28 +}; + +enum mlx5dv_cq_init_attr_mask { +MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE =1 <<0 , +MLX5DV_CQ_INIT_ATTR_MASK_FLAGS =1 <<1 , +MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE =1 <<2 , +}; + +enum mlx5dv_cqe_comp_res_format { +MLX5DV_CQE_RES_FORMAT_HASH =1 <<0 , +MLX5DV_CQE_RES_FORMAT_CSUM =1 <<1 , +MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX =1 <<2 , +}; + +enum ibv_access_flags { +IBV_ACCESS_LOCAL_WRITE =1 , +IBV_ACCESS_REMOTE_WRITE =1 <<1 , +IBV_ACCESS_REMOTE_READ =1 <<2 , +IBV_ACCESS_REMOTE_ATOMIC =1 <<3 , +IBV_ACCESS_MW_BIND =1 <<4 , +IBV_ACCESS_ZERO_BASED =1 <<5 , +IBV_ACCESS_ON_DEMAND =1 <<6 , +}; + +enum mlx5_ib_uapi_devx_create_event_channel_flags { +MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA =1 <<0 , +}; + +#define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA \ + MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA + +enum { +MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR =0x01 , +MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR =0x02 , +MLX5_CQE_SYNDROME_LOCAL_PROT_ERR =0x04 , +MLX5_CQE_SYNDROME_WR_FLUSH_ERR =0x05 , +MLX5_CQE_SYNDROME_MW_BIND_ERR =0x06 , +MLX5_CQE_SYNDROME_BAD_RESP_ERR =0x10 , +MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR =0x11 , +MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR =0x12 , +MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR =0x13 , +MLX5_CQE_SYNDROME_REMOTE_OP_ERR =0x14 , +MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR =0x15 , +MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR =0x16 , +MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR =0x22 , +}; + +enum { +MLX5_ETH_WQE_L3_CSUM = (1 <<6 ), +MLX5_ETH_WQE_L4_CSUM = (1 <<7 ), +}; + +/* +* RX Hash fields enable to set which incoming packet's field should +* participates in RX Hash. Each flag represent certain packet's field, +* when the flag is set the field that is represented by the flag will +* participate in RX Hash calculation. +* Note: IPV4 and IPV6 flags can't be enabled together on the same QP, +* TCP and UDP flags can't be enabled together on the same QP. +*/ +enum ibv_rx_hash_fields { +IBV_RX_HASH_SRC_IPV4 =1 <<0 , +IBV_RX_HASH_DST_IPV4 =1 <<1 , +IBV_RX_HASH_SRC_IPV6 =1 <<2 , +IBV_RX_HASH_DST_IPV6 =1 <<3 , +IBV_RX_HASH_SRC_PORT_TCP =1 <<4 , +IBV_RX_HASH_DST_PORT_TCP =1 <<5 , +IBV_RX_HASH_SRC_PORT_UDP =1 <<6 , +IBV_RX_HASH_DST_PORT_UDP =1 <<7 , +IBV_RX_HASH_IPSEC_SPI =1 <<8 , +IBV_RX_HASH_INNER = (1 <<31 ), +}; + +enum { +MLX5_RCV_DBR =0 , +MLX5_SND_DBR =1 , +}; + +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 0x0 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL 0x1 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 0x2 +#endif +#ifndef MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL +#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL 0x3 +#endif + +struct mlx5_err_cqe { +uint8_t rsvd0[32 ]; +uint32_t srqn; +uint8_t rsvd1[18 ]; +uint8_t vendor_err_synd; +uint8_t syndrome; +uint32_t s_wqe_opcode_qpn; +uint16_t wqe_counter; +uint8_t signature; +uint8_t op_own; +}; + +struct mlx5_wqe_srq_next_seg { +uint8_t rsvd0[2 ]; +rte_be16_t next_wqe_index; +uint8_t signature; +uint8_t rsvd1[11 ]; +}; + +enum ibv_wq_state { +IBV_WQS_RESET , +IBV_WQS_RDY , +IBV_WQS_ERR , +IBV_WQS_UNKNOWN +}; + +struct mlx5_wqe_data_seg { +rte_be32_t byte_count; +rte_be32_t lkey; +rte_be64_t addr; +};#endif /* __MLX5_WIN_DEFS_H__ */
Signature · 1 line
2.16.1.windows.4
PATCH v2 2/35 mlx5/windows: add mlx5 macros for fs name and path
In reply to Tal Shnaidermanibdev_name and ibdev_path sizes are defined in Windows DevX differently from the sizes used in Linux with IBV_SYSFS_NAME_MAX and IBV_SYSFS_PATH_MAX.
Added MLX5_FS_NAME_MAX and MLX5_FS_NAME_PATH in mlx5_os.h for both OSs.
--- drivers/net/mlx5/linux/mlx5_os.h | 4 ++-- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/windows/mlx5_os.h | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 drivers/net/mlx5/windows/mlx5_os.h
drivers/net/mlx5/linux/mlx5_os.h +2 -2
@@ -10,8 +10,8 @@/* verb enumerations translations to local enums. */ enum { -DEV_SYSFS_NAME_MAX =IBV_SYSFS_NAME_MAX +1 , -DEV_SYSFS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 +MLX5_FS_NAME_MAX =IBV_SYSFS_NAME_MAX +1 , +MLX5_FS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 };#define PCI_DRV_FLAGS (RTE_PCI_DRV_INTR_LSC | \
drivers/net/mlx5/mlx5.h +2 -2
@@ -701,8 +701,8 @@ struct mlx5_dev_ctx_shared {void *pd;/* Protection Domain. */ uint32_t pdn;/* Protection Domain number. */ uint32_t tdn;/* Transport Domain number. */ -char ibdev_name[DEV_SYSFS_NAME_MAX ];/* SYSFS dev name. */ -char ibdev_path[DEV_SYSFS_PATH_MAX ];/* SYSFS dev path for secondary */ +char ibdev_name[MLX5_FS_NAME_MAX ];/* SYSFS dev name. */ +char ibdev_path[MLX5_FS_PATH_MAX ];/* SYSFS dev path for secondary */ struct mlx5_dev_attr device_attr;/* Device properties. */ int numa_node;/* Numa node of backing physical device. */ LIST_ENTRY (mlx5_dev_ctx_shared) mem_event_cb;
drivers/net/mlx5/windows/mlx5_os.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2020 Mellanox Technologies, Ltd +*/ + +#ifndef RTE_PMD_MLX5_OS_H_ +#define RTE_PMD_MLX5_OS_H_ + +#include "mlx5_win_ext.h" + +enum { +MLX5_FS_NAME_MAX =MLX5_DEVX_DEVICE_NAME_SIZE +1 , +MLX5_FS_PATH_MAX =MLX5_DEVX_DEVICE_PNP_SIZE +1 +}; + +#define PCI_DRV_FLAGS 0 + +#endif /* RTE_PMD_MLX5_OS_H_ */
Signature · 1 line
2.16.1.windows.4
PATCH v2 3/35 common/mlx5: add rte compatibility header file
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Add #include <rte_compat.h> to file mlx5_devx_cmds.h. It is required for Windows to identify the __rte_internal definition.
--- drivers/common/mlx5/mlx5_devx_cmds.h | 1 + 1 file changed, 1 insertion(+)
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -7,6 +7,7 @@#include "mlx5_glue.h" #include "mlx5_prm.h" +#include <rte_compat.h> /* * Defines the amount of retries to allocate the first UAR in the page.
Signature · 1 line
2.16.1.windows.4
PATCH v2 4/35 common/mlx5/windows: add DevX UAR getters
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
The following getters are added: mlx5_os_get_devx_uar_mmap_offset, mlx5_os_get_devx_uar_base_addr, mlx5_os_get_devx_uar_reg_addr, mlx5_os_get_devx_uar_page_id. This commit is the Windows equivalent of the Linux implementation in [1].
[1]
commit 8638e19a10aa ("net/mlx5: remove more DV dependencies")
--- drivers/common/mlx5/windows/mlx5_common_os.h | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/common/mlx5/windows/mlx5_common_os.h +75 -0
@@ -6,6 +6,7 @@#define RTE_PMD_MLX5_COMMON_OS_H_ #include <stdio.h> +#include <sys/types.h> #include <rte_errno.h>
@@ -15,6 +16,8 @@#include "mlx5_common_mr.h" #include "mlx5_win_ext.h" +#define MLX5_BF_OFFSET 0x800 +/** * This API allocates aligned or non-aligned memory. The free can be on either * aligned or nonaligned memory. To be protected - even though there may be no
@@ -144,6 +147,78 @@ mlx5_os_get_umem_id(void *umem)return ((struct mlx5_devx_umem *)umem)->umem_id; } +/** +* Get mmap offset. Given a pointer to an DevX UAR object of type +* 'struct mlx5dv_devx_uar *' - return its mmap offset. +* In Windows, mmap_offset is unused. +* +* @param[in] uar +* Pointer to UAR object. +* +* @return +* 0 as mmap_offset is unused +*/ +static inline off_t +mlx5_os_get_devx_uar_mmap_offset (void *uar) +{ +RTE_SET_USED (uar); +return 0 ; +} + +/** +* Get base addr pointer. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its base address. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The base address if UAR is valid, NULL otherwise. +*/ +static inline void * +mlx5_os_get_devx_uar_base_addr (void *uar) +{ +if (!uar) +return NULL ; +return ((devx_uar_handle *)uar)->uar_page; +} + +/** +* Get reg addr pointer. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its reg address. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The reg address if UAR is valid, NULL otherwise. +*/ +static inline void * +mlx5_os_get_devx_uar_reg_addr (void *uar) +{ +if (!uar) +return NULL ; +return ((char *)((devx_uar_handle *)uar)->uar_page) +MLX5_BF_OFFSET ; +} + +/** +* Get page id. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its page id. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The page id if UAR is valid, 0 otherwise. +*/ +static inline uint32_t +mlx5_os_get_devx_uar_page_id (void *uar) +{ +if (!uar) +return 0 ; +return ((devx_uar_handle *)uar)->uar_index; +} +void *mlx5_os_alloc_pd (void *ctx);int mlx5_os_dealloc_pd (void *pd);void *mlx5_os_umem_reg (void *ctx,void *addr,size_t size,uint32_t access);
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v2 04/35] common/mlx5/windows: add DevX UAR getters
Quoted 9 lines · Tal Shnaiderman
From: Ophir Munk <[email protected]>
The following getters are added:
mlx5_os_get_devx_uar_mmap_offset,mlx5_os_get_devx_uar_base_addr,mlx5_os_get_devx_uar_reg_addr,mlx5_os_get_devx_uar_page_id. This commit is the Windows equivalent of the Linux implementation in [1].[1]
commit8638e19a10aa("net/mlx5: remove more DV dependencies")
This commit is not in the repo, I guess you mean:1f66ac5bbe89 ("net/mlx5: remove more Direct Verbs dependencies")
Quoted 3 lines
Signed-off-by Ophir Munk <[email protected]>Acked-by Matan Azrad <[email protected]>
<...>
Re: [dpdk-dev] [PATCH v2 04/35] common/mlx5/windows: add DevX UAR getters
Quoted 20 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, January 8, 2021 2:08 PM
To: Tal Shnaiderman <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Ophir Munk <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 04/35] common/mlx5/windows: add DevX UAR gettersQuoted 7 lines · Tal Shnaiderman
From: Ophir Munk <[email protected]>
The following getters are added:
mlx5_os_get_devx_uar_mmap_offset,mlx5_os_get_devx_uar_base_addr,mlx5_os_get_devx_uar_reg_addr,mlx5_os_get_devx_uar_page_id. This commit is the Windows equivalent of the Linux implementation in [1].
Quoted 6 lines
Quoted 2 lines
[1]
commit8638e19a10aa("net/mlx5: remove more DV dependencies")This commit is not in the repo, I guess you mean:
1f66ac5bbe89("net/mlx5: remove more Direct Verbs dependencies")
Correct. Thanks for noticing.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Ophir Munk <[email protected]>Acked-by Matan Azrad <[email protected]><...>
PATCH v2 5/35 common/mlx5/windows: wrap event channel APIs with OS calls
In reply to Tal ShnaidermanThis commit is the Windows equivalent of the Linux implementation. Windows returns an error ENOTSUP for the APIs to create/destroy event channel or to subscribe an event.
--- drivers/common/mlx5/windows/mlx5_common_os.h | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/common/mlx5/windows/mlx5_common_os.h +29 -0
@@ -219,6 +219,35 @@ mlx5_os_get_devx_uar_page_id(void *uar)return ((devx_uar_handle *)uar)->uar_index; } +static inline void * +mlx5_os_devx_create_event_channel (void *ctx,int flags) +{ + (void )ctx; + (void )flags; + errno =ENOTSUP ; +return NULL ; +} + +static inline void +mlx5_os_devx_destroy_event_channel (void *eventc) +{ + (void )eventc; +} + +static inline int +mlx5_os_devx_subscribe_devx_event (void *eventc, +void *obj, +uint16_t events_sz,uint16_t events_num[], +uint64_t cookie) +{ + (void )eventc; + (void )obj; + (void )events_sz; + (void )events_num; + (void )cookie; +return -ENOTSUP ; +} +void *mlx5_os_alloc_pd (void *ctx);int mlx5_os_dealloc_pd (void *pd);void *mlx5_os_umem_reg (void *ctx,void *addr,size_t size,uint32_t access);
Signature · 1 line
2.16.1.windows.4
PATCH v2 6/35 net/mlx5/windows: add memory region callbacks
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit is the Windows part implementation of [1].
[1]
commit d5ed8aa9449d ("net/mlx5: add memory region callbacks
in per-device cache")'
--- drivers/net/mlx5/windows/mlx5_os.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +17 -0
@@ -295,6 +295,23 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* Set the reg_mr and dereg_mr call backs +* +* @param reg_mr_cb[out] +* Pointer to reg_mr func +* @param dereg_mr_cb[out] +* Pointer to dereg_mr func +* +*/ +void +mlx5_os_set_reg_mr_cb (mlx5_reg_mr_t *reg_mr_cb, +mlx5_dereg_mr_t *dereg_mr_cb) +{ + *reg_mr_cb = mlx5_os_reg_mr; + *dereg_mr_cb = mlx5_os_dereg_mr; +} +const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = {0 };const struct eth_dev_ops mlx5_os_dev_ops = {
Signature · 1 line
2.16.1.windows.4
PATCH v2 7/35 net/mlx5/windows: add stubs for MP requests
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Windows supports the primary process with no secondary process control. This commit adds stubs for requests to start/stop the data-path to the secondary process and for requests to start/stop a queue of the primary process.
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_mp_os.c | 71 +++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_mp_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -4,5 +4,6 @@ includes += include_directories('.') sources += files( 'mlx5_os.c', + 'mlx5_mp_os.c', )
drivers/net/mlx5/windows/mlx5_mp_os.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 8/35 net/mlx5/windows: support get mac
In reply to Tal ShnaidermanThis commits implements API mlx5_get_mac(). It returns the MAC address saved in the device context since its creation.
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 43 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -5,5 +5,6 @@ includes += include_directories('.') sources += files( 'mlx5_os.c', 'mlx5_mp_os.c', + 'mlx5_ethdev_os.c', )
drivers/net/mlx5/windows/mlx5_ethdev_os.c new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 9/35 net/mlx5/windows: add ethdev stub operations
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commits adds ethdev stubs. These APIs are called from shared code that must compile under Linux and Windows. The following stubs are added:mlx5_set_mtumlx5_os_read_dev_countersmlx5_intr_callback_unregistermlx5_os_get_stats_nmlx5_os_stats_initmlx5_set_link_downmlx5_set_link_upmlx5_dev_get_flow_ctrlmlx5_dev_set_flow_ctrlmlx5_get_module_infomlx5_get_module_eeprom
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 199 ++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +199 -0
@@ -41,3 +41,202 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])memcpy (mac, context_obj->mlx5_dev.eth_mac,RTE_ETHER_ADDR_LEN );return 0 ; } + +/** +* Set device MTU. +* +* @param dev +* Pointer to Ethernet device. +* @param mtu +* MTU value to set. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_set_mtu (struct rte_eth_dev *dev,uint16_t mtu) +{ +RTE_SET_USED (dev); +RTE_SET_USED (mtu); +return -ENOTSUP ; +} + +/* +* Unregister callback handler safely. The handler may be active +* while we are trying to unregister it, in this case code -EAGAIN +* is returned by rte_intr_callback_unregister(). This routine checks +* the return code and tries to unregister handler again. +* +* @param handle +* interrupt handle +* @param cb_fn +* pointer to callback routine +* @cb_arg +* opaque callback parameter +*/ +void +mlx5_intr_callback_unregister (const struct rte_intr_handle *handle, +rte_intr_callback_fn cb_fn,void *cb_arg) +{ +RTE_SET_USED (handle); +RTE_SET_USED (cb_fn); +RTE_SET_USED (cb_arg); +} + +/** +* DPDK callback to get flow control status. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] fc_conf +* Flow control output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_dev_get_flow_ctrl (struct rte_eth_dev *dev,struct rte_eth_fc_conf *fc_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (fc_conf); +return -ENOTSUP ; +} + +/** +* DPDK callback to modify flow control parameters. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[in] fc_conf +* Flow control parameters. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_dev_set_flow_ctrl (struct rte_eth_dev *dev,struct rte_eth_fc_conf *fc_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (fc_conf); +return -ENOTSUP ; +} + +/** +* Query the number of statistics provided by ETHTOOL. +* +* @param dev +* Pointer to Ethernet device. +* +* @return +* Number of statistics on success, negative errno value otherwise and +* rte_errno is set. +*/ +int +mlx5_os_get_stats_n (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* Init the structures to read device counters. +* +* @param dev +* Pointer to Ethernet device. +*/ +void +mlx5_os_stats_init (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +} + +/** +* Read device counters table. +* +* @param dev +* Pointer to Ethernet device. +* @param[out] stats +* Counters table output buffer. +* +* @return +* 0 on success and stats is filled, negative errno value otherwise and +* rte_errno is set. +*/ +int +mlx5_os_read_dev_counters (struct rte_eth_dev *dev,uint64_t *stats) +{ +RTE_SET_USED (dev); +RTE_SET_USED (stats); +return -ENOTSUP ; +} + +/** +* DPDK callback to bring the link DOWN. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, a negative errno value otherwise +*/ +int +mlx5_set_link_down (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* DPDK callback to bring the link UP. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, a negative errno value otherwise +*/ +int +mlx5_set_link_up (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* DPDK callback to retrieve plug-in module EEPROM information (type and size). +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] modinfo +* Storage for plug-in module EEPROM information. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_module_info (struct rte_eth_dev *dev, +struct rte_eth_dev_module_info *modinfo) +{ +RTE_SET_USED (dev); +RTE_SET_USED (modinfo); +return -ENOTSUP ; +} + +/** +* DPDK callback to retrieve plug-in module EEPROM data. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] info +* Storage for plug-in module EEPROM data. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int mlx5_get_module_eeprom (struct rte_eth_dev *dev, +struct rte_dev_eeprom_info *info) +{ +RTE_SET_USED (dev); +RTE_SET_USED (info); +return -ENOTSUP ; +}
Signature · 1 line
2.16.1.windows.4
PATCH v2 10/35 net/mlx5/windows: support link update
In reply to Tal ShnaidermanAdd support for mlx5_link_update() to get link speed and link state. Other parameters are currently hard-coded.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +44 -0
@@ -170,6 +170,50 @@ mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)return -ENOTSUP ; } +/** +* DPDK callback to retrieve physical link information. +* +* @param dev +* Pointer to Ethernet device structure. +* @param wait_to_complete +* Wait for request completion. +* +* @return +* 0 if link status was not updated, positive if it was, a negative errno +* value otherwise and rte_errno is set. +*/ +int +mlx5_link_update (struct rte_eth_dev *dev,int wait_to_complete) +{ +RTE_SET_USED (wait_to_complete); +struct mlx5_priv *priv; +mlx5_context_st *context_obj; +struct rte_eth_link dev_link; +int ret; + + ret =0 ; +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; + dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1024 *1024 ); + dev_link.link_status = + (context_obj->mlx5_dev.link_state ==1 && !mlx5_is_removed (dev)) + ?1 :0 ; + dev_link.link_duplex =1 ; +if (dev->data->dev_link.link_speed != dev_link.link_speed || + dev->data->dev_link.link_duplex != dev_link.link_duplex || + dev->data->dev_link.link_autoneg != dev_link.link_autoneg || + dev->data->dev_link.link_status != dev_link.link_status) + ret =1 ; +else + ret =0 ; + dev->data->dev_link = dev_link; +return ret; +} +/** * DPDK callback to bring the link DOWN. *
Signature · 1 line
2.16.1.windows.4
PATCH v2 11/35 net/mlx5/windows: support read clock
In reply to Tal ShnaidermanThis commit adds a new glue function query_rt_values to support the new API mlx5_read_clock().
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/common/mlx5/windows/mlx5_glue.c | 26 ++++++++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 1 + drivers/common/mlx5/windows/mlx5_win_ext.h | 6 ++++++ drivers/net/mlx5/windows/mlx5_ethdev_os.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -594,6 +594,7 @@ struct mlx5_modification_cmd { }; }; +typedef uint64_t u64 ;typedef uint32_t u32 ;typedef uint16_t u16 ;typedef uint8_t u8 ;
drivers/common/mlx5/windows/mlx5_glue.c +26 -0
@@ -283,6 +283,31 @@ mlx5_glue_devx_fs_rule_del(void *flow)return devx_fs_rule_del (flow); } +static int +mlx5_glue_query_rt_values (void *ctx,void *devx_clock) +{ +struct mlx5_context *mlx5_ctx; +struct mlx5_devx_clock *clock; +int err; + +if (!ctx) { + errno =EINVAL ; +return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + clock = (struct mlx5_devx_clock *)devx_clock; + err =devx_hca_clock_query ( + mlx5_ctx->devx_ctx, + &clock->p_iseg_internal_timer, + &clock->clock_frequency_hz, + &clock->is_stable_clock_frequency); +if (err) { + errno = err; +return errno; + } +return 0 ; +} + alignas(RTE_CACHE_LINE_SIZE )const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue ){ .version =MLX5_GLUE_VERSION ,
@@ -304,4 +329,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_fs_rule_add = mlx5_glue_devx_fs_rule_add, .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del, .devx_query_eqn = mlx5_glue_devx_query_eqn, + .query_rt_values = mlx5_glue_query_rt_values, };
drivers/common/mlx5/windows/mlx5_glue.h +1 -0
@@ -51,6 +51,7 @@ struct mlx5_glue {void *(*devx_fs_rule_add)(void *ctx,void *in,uint32_t inlen);int (*devx_fs_rule_del)(void *flow);int (*devx_query_eqn)(void *context,uint32_t cpus,uint32_t *eqn); +int (*query_rt_values)(void *ctx,void *devx_clock); };extern const struct mlx5_glue *mlx5_glue;
drivers/common/mlx5/windows/mlx5_win_ext.h +6 -0
@@ -34,6 +34,12 @@ struct mlx5_pd {devx_device_ctx *devx_ctx; }; +struct mlx5_devx_clock { +void *p_iseg_internal_timer; +u64 clock_frequency_hz; +int is_stable_clock_frequency; +}; +#define GET_DEVX_CTX (ctx) (((mlx5_context_st *)ctx)->devx_ctx)#define GET_OBJ_CTX (obj) (((mlx5_devx_obj_st *)obj)->devx_ctx)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +30 -0
@@ -14,6 +14,7 @@#include <mlx5_win_ext.h> #include <mlx5_malloc.h> #include <mlx5.h> +#include <mlx5_utils.h> /** * Get MAC address by querying netdevice.
@@ -284,3 +285,32 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,RTE_SET_USED (info);return -ENOTSUP ; } + +/** +* Get device current raw clock counter +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] time +* Current raw clock counter of the device. +* +* @return +* 0 if the clock has correctly been read +* The value of errno in case of error +*/ +int +mlx5_read_clock (struct rte_eth_dev *dev,uint64_t *clock) +{ +int err; +struct mlx5_devx_clock mlx5_clock; +struct mlx5_priv *priv = dev->data->dev_private; +mlx5_context_st *context_obj = (mlx5_context_st *)priv->sh->ctx; + + err = mlx5_glue->query_rt_values (context_obj, &mlx5_clock); +if (err !=0 ) { +DRV_LOG (WARNING ,"Could not query the clock" ); +return err; + } + *clock = *(uint64_t volatile *)mlx5_clock.p_iseg_internal_timer; +return 0 ; +}
Signature · 1 line
2.16.1.windows.4
PATCH v2 12/35 net/mlx5/windows: support get mtu
In reply to Tal ShnaidermanThis commit implements API mlx5_get_mtu(). It returns the MTU size as saved in the device context since its creation.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +27 -0
@@ -43,6 +43,33 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])return 0 ; } +/** +* Get device MTU. +* +* @param dev +* Pointer to Ethernet device. +* @param[out] mtu +* MTU value output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_mtu (struct rte_eth_dev *dev,uint16_t *mtu) +{ +struct mlx5_priv *priv; +mlx5_context_st *context_obj; + +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; + *mtu = context_obj->mlx5_dev.mtu_bytes; +return 0 ; +} +/** * Set device MTU. *
Signature · 1 line
2.16.1.windows.4
PATCH v2 13/35 net/mlx5/windows: support get interface name
In reply to Tal ShnaidermanThis commit copies the interface name as saved in the device context since its creation.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +28 -0
@@ -43,6 +43,34 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])return 0 ; } +/** +* Get interface name from private structure. +* +* +* @param[in] dev +* Pointer to Ethernet device. +* @param[out] ifname +* Interface name output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +{ +struct mlx5_priv *priv; +mlx5_context_st *context_obj; + +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; +strncpy (*ifname, context_obj->mlx5_dev.name,IF_NAMESIZE ); +return 0 ; +} +/** * Get device MTU. *
Signature · 1 line
2.16.1.windows.4
PATCH v2 14/35 net/mlx5/windows: support device removed query
In reply to Tal ShnaidermanThis commit implements mlx5_is_removed() API. A new glue call 'init_shutdown_event' is added to support the new API.
--- drivers/common/mlx5/windows/mlx5_glue.c | 21 +++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 1 + drivers/common/mlx5/windows/mlx5_win_ext.h | 2 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 20 ++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-)
drivers/common/mlx5/windows/mlx5_glue.c +21 -0
@@ -308,6 +308,26 @@ mlx5_glue_query_rt_values(void *ctx, void *devx_clock)return 0 ; } +static int +mlx5_glue_devx_init_showdown_event (void *ctx) +{ +struct mlx5_context *mlx5_ctx; +int err; + +if (!ctx) { + errno =EINVAL ; +return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + err =devx_query_shutdown_event (mlx5_ctx->devx_ctx, + &mlx5_ctx->shutdown_event_obj); +if (err) { + errno = err; +return errno; + } +return 0 ; +} + alignas(RTE_CACHE_LINE_SIZE )const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue ){ .version =MLX5_GLUE_VERSION ,
@@ -330,4 +350,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del, .devx_query_eqn = mlx5_glue_devx_query_eqn, .query_rt_values = mlx5_glue_query_rt_values, + .devx_init_showdown_event = mlx5_glue_devx_init_showdown_event, };
drivers/common/mlx5/windows/mlx5_glue.h +1 -0
@@ -52,6 +52,7 @@ struct mlx5_glue {int (*devx_fs_rule_del)(void *flow);int (*devx_query_eqn)(void *context,uint32_t cpus,uint32_t *eqn);int (*query_rt_values)(void *ctx,void *devx_clock); +int (*devx_init_showdown_event)(void *ctx); };extern const struct mlx5_glue *mlx5_glue;
drivers/common/mlx5/windows/mlx5_win_ext.h +1 -1
@@ -14,7 +14,7 @@ extern "C" {typedef struct mlx5_context {devx_device_ctx *devx_ctx;struct devx_device mlx5_dev; - +struct devx_shutdown_event shutdown_event_obj; }mlx5_context_st ; typedef struct {
drivers/net/mlx5/windows/mlx5_ethdev_os.c +20 -0
@@ -369,3 +369,23 @@ mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock) *clock = *(uint64_t volatile *)mlx5_clock.p_iseg_internal_timer;return 0 ; } + +/** +* Check if mlx5 device was removed. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 1 when device is removed, otherwise 0. +*/ +int +mlx5_is_removed (struct rte_eth_dev *dev) +{ +struct mlx5_priv *priv = dev->data->dev_private; +mlx5_context_st *context_obj = (mlx5_context_st *)priv->sh->ctx; + +if (*context_obj->shutdown_event_obj.p_flag) +return 1 ; +return 0 ; +}
Signature · 1 line
2.16.1.windows.4
PATCH v2 15/35 net/mlx5/windws: add VLAN stubs
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit adds stubs to VLAN VM operations. It is the Windows equivalent implementation of [1]. The Linux implementation was based on Netlink APIs which are not supported in Windows.
[1]
commit 7af10d29a4a0 ("net/mlx5/linux: refactor VLAN")
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_vlan_os.c | 83 +++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_vlan_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -6,5 +6,6 @@ sources += files( 'mlx5_os.c', 'mlx5_mp_os.c', 'mlx5_ethdev_os.c', + 'mlx5_vlan_os.c', )
drivers/net/mlx5/windows/mlx5_vlan_os.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 16/35 net/mlx5/windows: support get pdn
In reply to Tal ShnaidermanImplement OS function call to get pdn.
--- drivers/net/mlx5/windows/mlx5_os.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +21 -0
@@ -312,6 +312,27 @@ mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, *dereg_mr_cb = mlx5_os_dereg_mr; } +/** +* Extract pdn of PD object using DevX +* +* @param[in] pd +* Pointer to the DevX PD object. +* @param[out] pdn +* Pointer to the PD object number variable. +* +* @return +* 0 on success, error value otherwise. +*/ +int +mlx5_os_get_pdn (void *pd,uint32_t *pdn) +{ +if (!pd) +return -EINVAL ; + + *pdn = ((struct mlx5_pd *)pd)->pdn; +return 0 ; +} +const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = {0 };const struct eth_dev_ops mlx5_os_dev_ops = {
Signature · 1 line
2.16.1.windows.4
PATCH v2 17/35 net/mlx5/windows: support open device
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_os_open_device() API. It calls glue API open_device() then glue API query_device() to fill in 'struct mlx5_context' with data for later usage.
--- drivers/net/mlx5/windows/mlx5_os.c | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +44 -0
@@ -103,6 +103,50 @@ mlx5_os_set_nonblock_channel_fd(int fd)return -ENOTSUP ; } +/** +* Function API open device under Windows +* +* This function calls the Windows glue APIs to open a device. +* +* @param[in] spawn +* Pointer to the device attributes (name, port, etc). +* @param[out] config +* Pointer to device configuration structure. +* @param[out] sh +* Pointer to shared context structure. +* +* @return +* 0 on success, a positive error value otherwise. +*/ +int +mlx5_os_open_device (const struct mlx5_dev_spawn_data *spawn, +const struct mlx5_dev_config *config, +struct mlx5_dev_ctx_shared *sh) +{ +RTE_SET_USED (config); +int err =0 ; +struct mlx5_context *mlx5_ctx; + +pthread_mutex_init (&sh->txpp.mutex,NULL ); +/* Set numa node from pci probe */ + sh->numa_node = spawn->pci_dev->device.numa_node; + +/* Try to open device with DevX */ + rte_errno =0 ; + sh->ctx = mlx5_glue->open_device (spawn->phys_dev); +if (!sh->ctx) { +DRV_LOG (ERR ,"open_device failed" ); + err = errno; +return err; + } + sh->devx =1 ; + mlx5_ctx = (struct mlx5_context *)sh->ctx; + err = mlx5_glue->query_device (spawn->phys_dev, &mlx5_ctx->mlx5_dev); +if (err) +DRV_LOG (ERR ,"Failed to query device context fields." ); +return err; +} +/** * This function should share events between multiple ports of single IB * device. Currently it has no support under Windows.
Signature · 1 line
2.16.1.windows.4
PATCH v2 18/35 net/mlx5/windows: initial probing implementation
In reply to Tal ShnaidermanThis commit implements mlx5_os_pci_probe API under Windows. It does all required initializations then it gets the PCI device list using glue API get_device_list(). Next, all non MLX5 matched devices are filtered out. The supported NIC types are: CONNECTX4VF, CONNECTX4LXVF, CONNECTX5VF, CONNECTX5EXVF, CONNECTX5BFVF, CONNECTX6VF, MELLANOX_CONNECTX6DXVF. Each device in the list is assigned with default configuration parameters, most of them are 0. The default dv_flow_en parameter value is 1 (which means Windows match and action flows are based on DV code). Next for each PCI device call mlx5_dev_spawn() to create an eth device (struct rte_ethdev). The implementation of device spawn is in the follow up commit. Finally, the device list is free.
--- drivers/net/mlx5/windows/mlx5_os.c | 267 +++++++++++++++++++++++++++++++++++++ 1 file changed, 267 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +267 -0
@@ -9,6 +9,7 @@#include <stdlib.h> #include <rte_windows.h> +#include <rte_ethdev_pci.h> #include <mlx5_glue.h> #include <mlx5_devx_cmds.h>
@@ -26,6 +27,65 @@#include "mlx5_mr.h" #include "mlx5_flow.h" +static const char *MZ_MLX5_PMD_SHARED_DATA ="mlx5_pmd_shared_data" ; + +/* Spinlock for mlx5_shared_data allocation. */ +static rte_spinlock_t mlx5_shared_data_lock =RTE_SPINLOCK_INITIALIZER ; + +/** +* Initialize shared data between primary and secondary process. +* +* A memzone is reserved by primary process and secondary processes attach to +* the memzone. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +static int +mlx5_init_shared_data (void ) +{ +const struct rte_memzone *mz; +int ret =0 ; + +rte_spinlock_lock (&mlx5_shared_data_lock); +if (mlx5_shared_data ==NULL ) { +/* Allocate shared memory. */ + mz =rte_memzone_reserve (MZ_MLX5_PMD_SHARED_DATA , +sizeof (*mlx5_shared_data), +SOCKET_ID_ANY ,0 ); +if (mz ==NULL ) { +DRV_LOG (ERR , +"Cannot allocate mlx5 shared data" ); + ret = -rte_errno; + goto error; + } + mlx5_shared_data = mz->addr; +memset (mlx5_shared_data,0 ,sizeof (*mlx5_shared_data)); +rte_spinlock_init (&mlx5_shared_data->lock); + } +error: +rte_spinlock_unlock (&mlx5_shared_data_lock); +return ret; +} + +/** +* PMD global initialization. +* +* Independent from individual device, this function initializes global +* per-PMD data structures distinguishing primary and secondary processes. +* Hence, each initialization is called once per a process. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +static int +mlx5_init_once (void ) +{ +if (mlx5_init_shared_data ()) +return -rte_errno; +return 0 ; +} +/** * Get mlx5 device attributes. *
@@ -147,6 +207,31 @@ mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,return err; } +/** +* Spawn an Ethernet device from Verbs information. +* +* @param dpdk_dev +* Backing DPDK device. +* @param spawn +* Verbs device parameters (name, port, switch_info) to spawn. +* @param config +* Device configuration parameters. +* +* @return +* NULL pointer. Operation is not supported and rte_errno is set to ENOTSUP. +*/ +static struct rte_eth_dev * +mlx5_dev_spawn (struct rte_device *dpdk_dev, +struct mlx5_dev_spawn_data *spawn, +struct mlx5_dev_config *config) +{ + (void )dpdk_dev; + (void )spawn; + (void )config; + rte_errno = -ENOTSUP ; +return NULL ; +} +/** * This function should share events between multiple ports of single IB * device. Currently it has no support under Windows.
@@ -339,6 +424,188 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* DPDK callback to register a PCI device. +* +* This function spawns Ethernet devices out of a given PCI device. +* +* @param[in] pci_drv +* PCI driver structure (mlx5_driver). +* @param[in] pci_dev +* PCI device information. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *pci_dev) +{ +struct devx_device_bdf *devx_bdf_devs, *orig_devx_bdf_devs; +/* +* Number of found IB Devices matching with requested PCI BDF. +* nd != 1 means there are multiple IB devices over the same +* PCI device and we have representors and master. +*/ +unsigned int nd =0 ; +/* +* Number of found IB device Ports. nd = 1 and np = 1..n means +* we have the single multiport IB device, and there may be +* representors attached to some of found ports. +* Currently not supported. +* unsigned int np = 0; +*/ + +/* +* Number of DPDK ethernet devices to Spawn - either over +* multiple IB devices or multiple ports of single IB device. +* Actually this is the number of iterations to spawn. +*/ +unsigned int ns =0 ; +/* +* Bonding device +* < 0 - no bonding device (single one) +* >= 0 - bonding device (value is slave PF index) +*/ +int bd =-1 ; +struct mlx5_dev_spawn_data *list =NULL ; +struct mlx5_dev_config dev_config; +unsigned int dev_config_vf; +int ret; +uint32_t restore; + +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) { +DRV_LOG (ERR ,"Secondary process is not supported on Windows." ); +return -ENOTSUP ; + } + ret =mlx5_init_once (); +if (ret) { +DRV_LOG (ERR ,"unable to init PMD global data: %s" , +strerror (rte_errno)); +return -rte_errno; + } + errno =0 ; + devx_bdf_devs = mlx5_glue->get_device_list (&ret); + orig_devx_bdf_devs = devx_bdf_devs; +if (!devx_bdf_devs) { + rte_errno = errno ? errno :ENOSYS ; +DRV_LOG (ERR ,"cannot list devices, is ib_uverbs loaded?" ); +return -rte_errno; + } +/* +* First scan the list of all Infiniband devices to find +* matching ones, gathering into the list. +*/ +struct devx_device_bdf *devx_bdf_match[ret +1 ]; + +while (ret-- >0 ) { +if (pci_dev->addr.bus != devx_bdf_devs->bus_id || + pci_dev->addr.devid != devx_bdf_devs->dev_id || + pci_dev->addr.function != devx_bdf_devs->fnc_id) { + devx_bdf_devs++; +continue ; + } + + devx_bdf_match[nd++] = devx_bdf_devs; + } + devx_bdf_match[nd] =NULL ; +if (!nd) { +/* No device matches, just complain and bail out. */ +DRV_LOG (WARNING , +"no DevX device matches PCI device " PCI_PRI_FMT "," +" is DevX Configured?" , + pci_dev->addr.domain, pci_dev->addr.bus, + pci_dev->addr.devid, pci_dev->addr.function); + rte_errno =ENOENT ; + ret = -rte_errno; + goto exit; + } +/* +* Now we can determine the maximal +* amount of devices to be spawned. +*/ + list =mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_dev_spawn_data ), +RTE_CACHE_LINE_SIZE ,SOCKET_ID_ANY ); +if (!list) { +DRV_LOG (ERR ,"spawn data array allocation failure" ); + rte_errno =ENOMEM ; + ret = -rte_errno; + goto exit; + } +memset (&list[ns].info,0 ,sizeof (list[ns].info)); + list[ns].max_port =1 ; + list[ns].phys_port =1 ; + list[ns].phys_dev = devx_bdf_match[ns]; + list[ns].eth_dev =NULL ; + list[ns].pci_dev = pci_dev; + list[ns].pf_bond = bd; + list[ns].ifindex =-1 ;/* Spawn will assign */ + list[ns].info = + (struct mlx5_switch_info ){ + .master =0 , + .representor =0 , + .name_type =MLX5_PHYS_PORT_NAME_TYPE_UPLINK , + .port_name =0 , + .switch_id =0 , + }; +/* Device specific configuration. */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX6VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTXVF : + dev_config_vf =1 ; +break ; +default : + dev_config_vf =0 ; +break ; + } +/* Default configuration. */ +memset (&dev_config,0 ,sizeof (struct mlx5_dev_config )); + dev_config.vf = dev_config_vf; + dev_config.mps =0 ; + dev_config.dbnc =MLX5_ARG_UNSET ; + dev_config.rx_vec_en =1 ; + dev_config.txq_inline_max =MLX5_ARG_UNSET ; + dev_config.txq_inline_min =MLX5_ARG_UNSET ; + dev_config.txq_inline_mpw =MLX5_ARG_UNSET ; + dev_config.txqs_inline =MLX5_ARG_UNSET ; + dev_config.vf_nl_en =0 ; + dev_config.mr_ext_memseg_en =1 ; + dev_config.mprq.max_memcpy_len =MLX5_MPRQ_MEMCPY_DEFAULT_LEN ; + dev_config.mprq.min_rxqs_num =MLX5_MPRQ_MIN_RXQS ; + dev_config.dv_esw_en =0 ; + dev_config.dv_flow_en =1 ; + dev_config.decap_en =0 ; + dev_config.log_hp_size =MLX5_ARG_UNSET ; + list[ns].eth_dev =mlx5_dev_spawn (&pci_dev->device, + &list[ns], + &dev_config); +if (!list[ns].eth_dev) + goto exit; + restore = list[ns].eth_dev->data->dev_flags; +rte_eth_copy_pci_info (list[ns].eth_dev, pci_dev); +/* Restore non-PCI flags cleared by the above call. */ + list[ns].eth_dev->data->dev_flags |= restore; +rte_eth_dev_probing_finish (list[ns].eth_dev); + ret =0 ; +exit: +/* +* Do the routine cleanup: +* - free allocated spawn data array +* - free the device list +*/ +if (list) +mlx5_free (list); +MLX5_ASSERT (orig_devx_bdf_devs); + mlx5_glue->free_device_list (orig_devx_bdf_devs); +return ret; +} +/** * Set the reg_mr and dereg_mr call backs *
Signature · 1 line
2.16.1.windows.4
PATCH v2 19/35 net/mlx5/windws: spawn eth devices
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_dev_spawn() API which allocates an eth device (struct rte_eth_dev) for each PCI device. When working with representors virtual functions (as in Linux), one PCI device may spawn several eth devices: the master device for the main physical function (PF) and several representors for the virtual functions (VFs). However, currently Windows does not work in switch dev mode, therefore, no VFs are created and no representors are spawned. In this case one eth device is created per one PCI main port. In addition to device creation - the device configuration must be correctly set. The device arguments (devargs - set by the user) are parsed but they may be overridden by Windows limitations or hardware configurations. Some associated network parameters are stored in eth device (e.g. ifindex, MAC address, MTU) and some callback (e.g. burst functions) are set.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 6 + drivers/net/mlx5/windows/mlx5_os.c | 456 +++++++++++++++++++++++++++- 2 files changed, 457 insertions(+), 5 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +6 -0
@@ -163,4 +163,10 @@ struct mlx5_wqe_data_seg {rte_be32_t lkey; rte_be64_t addr; }; + +#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP (1 << 4) +#define IBV_DEVICE_RAW_IP_CSUM (1 << 26) +#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING (1 << 0) +#define IBV_RAW_PACKET_CAP_SCATTER_FCS (1 << 1) +#define IBV_QPT_RAW_PACKET 8#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/mlx5_os.c +451 -5
486 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 20/35 net/mlx5/windows: support VF PCI address
In reply to Tal ShnaidermanSupport VF BDF scanning by checking both the BDF and raw BDF provided by DevX. In Linux a PCI address is formatted as: domain, bus, device, function (DBDF). This is right for both a PF and a VF. In Windows a PF also has a DBDF format, but the domain is always 0, while a VF has a special "domain" called "Virtual PCI Bus, Serial" (for example: "Virtual PCI Bus Slot 2 Serial 2") or segment. The full VF format under Windows is called raw DBF. Windows special domain must be considered and DevX must be called to support it.
--- drivers/net/mlx5/windows/mlx5_os.c | 75 +++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 5 deletions(-)
drivers/net/mlx5/windows/mlx5_os.c +70 -5
@@ -870,6 +870,68 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* Detect if a devx_device_bdf object has identical DBDF values to the +* rte_pci_addr found in bus/pci probing +* +* @param[in] devx_bdf +* Pointer to the devx_device_bdf structure. +* @param[in] addr +* Pointer to the rte_pci_addr structure. +* +* @return +* 1 on Device match, 0 on mismatch. +*/ +static int +mlx5_match_devx_bdf_to_addr (struct devx_device_bdf *devx_bdf, +struct rte_pci_addr *addr) +{ +if (addr->domain != (devx_bdf->bus_id >>8 ) || + addr->bus != (devx_bdf->bus_id &0xff ) || + addr->devid != devx_bdf->dev_id || + addr->function != devx_bdf->fnc_id) { +return 0 ; + } +return 1 ; +} + +/** +* Detect if a devx_device_bdf object matches the rte_pci_addr +* found in bus/pci probing +* Compare both the Native/PF BDF and the raw_bdf representing a VF BDF. +* +* @param[in] devx_bdf +* Pointer to the devx_device_bdf structure. +* @param[in] addr +* Pointer to the rte_pci_addr structure. +* +* @return +* 1 on Device match, 0 on mismatch, rte_errno code on failure. +*/ +static int +mlx5_match_devx_devices_to_addr (struct devx_device_bdf *devx_bdf, +struct rte_pci_addr *addr) +{ +int err; +struct devx_device mlx5_dev; + +if (mlx5_match_devx_bdf_to_addr (devx_bdf, addr)) +return 1 ; +/** +* Didn't match on Native/PF BDF, could still +* Match a VF BDF, check it next +*/ + err = mlx5_glue->query_device (devx_bdf, &mlx5_dev); +if (err) { +DRV_LOG (ERR ,"query_device failed" ); + rte_errno = err; +return rte_errno; + } +if (mlx5_match_devx_bdf_to_addr (&mlx5_dev.raw_bdf, addr)) +return 1 ; +return 0 ; +} +/** * DPDK callback to register a PCI device. *
@@ -917,7 +979,7 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct mlx5_dev_spawn_data *list =NULL ;struct mlx5_dev_config dev_config;unsigned int dev_config_vf; -int ret; +int ret, err;uint32_t restore;if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) {
@@ -945,13 +1007,16 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct devx_device_bdf *devx_bdf_match[ret +1 ];while (ret-- >0 ) { -if (pci_dev->addr.bus != devx_bdf_devs->bus_id || - pci_dev->addr.devid != devx_bdf_devs->dev_id || - pci_dev->addr.function != devx_bdf_devs->fnc_id) { + err =mlx5_match_devx_devices_to_addr (devx_bdf_devs, + &pci_dev->addr); +if (!err) { devx_bdf_devs++;continue ; } - +if (err !=1 ) { + ret = -err; + goto exit; + } devx_bdf_match[nd++] = devx_bdf_devs; } devx_bdf_match[nd] =NULL ;
Signature · 1 line
2.16.1.windows.4
PATCH v2 21/35 net/mlx5/linux: wrap adjust flow priority with OS calls
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
mlx5_flow_adjust_priority() is used to adjust priorities according to priorities levels. It is Verbs based and it is called from shared code (mlx5_flow_dv.c). Therefore, wrap it in an OS API.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 20 ++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +20 -0
@@ -365,4 +365,24 @@ mlx5_flow_os_destroy_flow_action(void *action) return mlx5_glue->destroy_flow_action(action); } +/** +* OS wrapper over Verbs API. +* Adjust flow priority based on the highest layer and the request priority. +* +* @param[in] dev +* Pointer to the Ethernet device structure. +* @param[in] priority +* The rule base priority. +* @param[in] subpriority +* The priority based on the items. +* +* @return +* The new priority. +*/ +static inline uint32_t +mlx5_os_flow_adjust_priority (struct rte_eth_dev *dev,int32_t priority, +uint32_t subpriority) +{ +return mlx5_flow_adjust_priority (dev, priority, subpriority); +}#endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
drivers/net/mlx5/mlx5_flow_dv.c +3 -2
@@ -10600,8 +10600,9 @@ flow_dv_translate(struct rte_eth_dev *dev,/* Register matcher. */ matcher.crc =rte_raw_cksum ((const void *)matcher.mask.buf, matcher.mask.size); - matcher.priority =mlx5_flow_adjust_priority (dev, priority, - matcher.priority); + matcher.priority =mlx5_os_flow_adjust_priority (dev, + priority, + matcher.priority);/* reserved field no needs to be set to 0 here. */ tbl_key.domain = attr->transfer; tbl_key.direction = attr->egress;
Signature · 1 line
2.16.1.windows.4
PATCH v2 22/35 net/mlx5/linux: add OS default miss flow action
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Wrap glue call dr_create_flow_action_default_miss() with an OS API. This commit is a follow up on [1].
[1]
commit d4d85aa6f13a ("common/mlx5: add default miss action") commit b293fbf9672b ("net/mlx5: add OS specific flow actions operations")
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 16 ++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 8 +++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +16 -0
@@ -350,6 +350,22 @@ mlx5_flow_os_create_flow_action_drop(void **action)return (*action) ?0 :-1 ; } +/** +* Create flow action: default miss. +* +* @param[out] action +* Pointer to a valid action on success, NULL otherwise. +* +* @return +* 0 on success, or -1 on failure and errno is set. +*/ +static inline int +mlx5_flow_os_create_flow_action_default_miss (void **action) +{ + *action = mlx5_glue->dr_create_flow_action_default_miss (); +return (*action) ?0 :-1 ; +} +/** * Destroy flow action. *
drivers/net/mlx5/mlx5_flow_dv.c +5 -3
@@ -8763,11 +8763,13 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused, "for sample"); goto error; } +int ret; + cache_resource->normal_path_tbl = tbl;if (resource->ft_type ==MLX5DV_FLOW_TABLE_TYPE_FDB ) { - cache_resource->default_miss = - mlx5_glue->dr_create_flow_action_default_miss (); -if (!cache_resource->default_miss) { + ret =mlx5_flow_os_create_flow_action_default_miss + (&cache_resource->default_miss); +if (!ret) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
Signature · 1 line
2.16.1.windows.4
PATCH v2 23/35 net/mlx5/linux: fix add OS dest_devx_tir action
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Wrap glue call dv_create_flow_action_dest_devx_tir() with an OS API.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 26 ++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_devx.c | 7 +++---- 2 files changed, 29 insertions(+), 4 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +26 -0
@@ -366,6 +366,32 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)return (*action) ?0 :-1 ; } +/** +* Create flow action: dest_devx_tir +* +* @param[in] tir +* Pointer to DevX tir object +* @param[out] action +* Pointer to a valid action on success, NULL otherwise. +* +* @return +* 0 on success, or -1 on failure and errno is set. +*/ +static inline int +mlx5_flow_os_create_flow_action_dest_devx_tir (struct mlx5_devx_obj *tir, +void **action) +{ +#ifdef HAVE_IBV_FLOW_DV_SUPPORT + *action = mlx5_glue->dv_create_flow_action_dest_devx_tir (tir->obj); +return (*action) ?0 :-1 ; +#else +/* If no DV support - skip the operation and return success */ +RTE_SET_USED (tir); + *action =0 ; +return 0 ; +#endif +} +/** * Destroy flow action. *
drivers/net/mlx5/mlx5_devx.c +3 -4
@@ -23,7 +23,7 @@#include "mlx5_utils.h" #include "mlx5_devx.h" #include "mlx5_flow.h" - +#include "mlx5_flow_os.h" /** * Modify RQ vlan stripping offload
@@ -942,9 +942,8 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, goto error; }#ifdef HAVE_IBV_FLOW_DV_SUPPORT - hrxq->action = mlx5_glue->dv_create_flow_action_dest_devx_tir - (hrxq->tir->obj); -if (!hrxq->action) { +if (mlx5_flow_os_create_flow_action_dest_devx_tir (hrxq->tir, + &hrxq->action)) { rte_errno = errno; goto error; }
Signature · 1 line
2.16.1.windows.4
PATCH v2 24/35 net/mlx5/windows: introduce flow support
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This patch adds the initial flow framework under Windows OS. It supports a subset of filters (ETH, IPV4, UDP) and a QUEUE action. It is based on DevX mechanism to send commands to the NIC through the kernel. It does not support steering rules (i.e. writing directly to the NIC memory). The Windows framework uses the existing DV framework where file mlx5_flow_dv.c remains intact.
Steps involved in flow creation:
1. Create a domain (RX, TX, FDB). Since domains are created by steering rules and not with DevX, Windows does not require a domain object (this means switch dev mode which requires an FDB domain is not supported).
2. Create a table object. Windows only supports table 0. The call to mlx5_flow_os_create_flow_tbl() silently returns successfully.
3. Create a matcher object. A matcher struct is created by calling mlx5_flow_os_create_flow_matcher(). The matcher validation and translation are part of the DV implementation. The matcher bits that were created by DV in standard PRM format are copied into the matcher struct.
4. Create an action object. The call to mlx5_flow_os_create_flow_action_dest_devx_tir() creates an action struct with the TIR type and id. This struct will be a parameter later in a call to flow creation. All other action calls (e.g. packet reformat, header modification, jump to flow table, etc) return with a non supported error.
5. Create the flow. The call to mlx5_flow_os_create_flow() receives the matcher struct, action struct, and copy them into Windows specific fs_rule struct, then it calls glue API devx_fs_rule_add().
Details on additional APIs:
* mlx5_flow_os_get_type() is called during flow type selection. In Windows it constantly returns MLX5_FLOW_TYPE_DV.
* mlx5_flow_os_item_supported() is called before starting DV items validation or translation. It filters out the OS non supported items in advance.
* mlx5_flow_os_action_supported() is called before starting DV actions validation or translation. It filters out the OS non supported actions in advance.
* mlx5_flow_adjust_priority() is an OS stub for flow priority adjustment. Windows only supports flow priority 0.
* Alarm API: mlx5_os_alarm_cancel() and mlx5_os_alarm_set() are implemented in Windows to match their Linux counterpart, see [1]. Currently they return -ENOTSUP.
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 7 + drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_flow_os.c | 188 ++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 363 ++++++++++++++++++++++++++++ 4 files changed, 559 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.h
drivers/common/mlx5/windows/mlx5_win_defs.h +7 -0
@@ -169,4 +169,11 @@ struct mlx5_wqe_data_seg {#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING (1 << 0)#define IBV_RAW_PACKET_CAP_SCATTER_FCS (1 << 1)#define IBV_QPT_RAW_PACKET 8 + +enum { +MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT =0x0 , +MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_CONTEXT_DEST_TYPE_TIR =0x2 , +MLX5_FLOW_CONTEXT_DEST_TYPE_QP =0x3 , +};#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/meson.build +1 -0
@@ -7,5 +7,6 @@ sources += files( 'mlx5_mp_os.c', 'mlx5_ethdev_os.c', 'mlx5_vlan_os.c', + 'mlx5_flow_os.c', )
drivers/net/mlx5/windows/mlx5_flow_os.c new file +188 -0
188 lines not on this page · raw message
drivers/net/mlx5/windows/mlx5_flow_os.h new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v2 24/35] net/mlx5/windows: introduce flow support
Quoted 45 lines · Tal Shnaiderman
From: Ophir Munk <[email protected]>
This patch adds the initial flow framework under Windows OS. It supports a subset of filters (ETH, IPV4, UDP) and a QUEUE action. It is based on DevX mechanism to send commands to the NIC through the kernel. It does not support steering rules (i.e. writing directly to the NIC memory). The Windows framework uses the existing DV framework where file
mlx5_flow_dv.cremains intact.Steps involved in flow creation:
1. Create a domain (RX, TX, FDB). Since domains are created by steering rules and not with DevX, Windows does not require a domain object (this means switch dev mode which requires an FDB domain is not supported).
2. Create a table object. Windows only supports table 0. The call tomlx5_flow_os_create_flow_tbl()silently returns successfully.
3. Create a matcher object. A matcher struct is created by callingmlx5_flow_os_create_flow_matcher(). The matcher validation and translation are part of the DV implementation. The matcher bits that were created by DV in standard PRM format are copied into the matcher struct.
4. Create an action object. The call tomlx5_flow_os_create_flow_action_dest_devx_tir()creates an action struct with the TIR type and id. This struct will be a parameter later in a call to flow creation. All other action calls (e.g. packet reformat, header modification, jump to flow table, etc) return with a non supported error.
5. Create the flow. The call tomlx5_flow_os_create_flow()receives the matcher struct, action struct, and copy them into Windows specificfs_rulestruct, then it calls glue APIdevx_fs_rule_add().Details on additional APIs:
*mlx5_flow_os_get_type()is called during flow type selection. In Windows it constantly returnsMLX5_FLOW_TYPE_DV.
*mlx5_flow_os_item_supported()is called before starting DV items validation or translation. It filters out the OS non supported items in advance.
*mlx5_flow_os_action_supported()is called before starting DV actions validation or translation. It filters out the OS non supported actions in advance.
*mlx5_flow_adjust_priority()is an OS stub for flow priority adjustment. Windows only supports flow priority 0.
* Alarm API:mlx5_os_alarm_cancel()andmlx5_os_alarm_set()are implemented in Windows to match their Linux counterpart, see [1]. Currently they return-ENOTSUP.
Quoted 2 lines
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")
Can you please provide commit hash for this commit, I can amend it later in the next-net?
Quoted 4 lines
Signed-off-by Ophir Munk <[email protected]>Signed-off-by Dekel Peled <[email protected]>Acked-by Matan Azrad <[email protected]>
<...>
Re: [dpdk-dev] [PATCH v2 24/35] net/mlx5/windows: introduce flow support
08/01/2021 15:38, Ferruh Yigit:
Quoted 46 lines · Tal Shnaiderman
Quoted 45 lines
From: Ophir Munk <[email protected]>
This patch adds the initial flow framework under Windows OS. It supports a subset of filters (ETH, IPV4, UDP) and a QUEUE action. It is based on DevX mechanism to send commands to the NIC through the kernel. It does not support steering rules (i.e. writing directly to the NIC memory). The Windows framework uses the existing DV framework where file
mlx5_flow_dv.cremains intact.Steps involved in flow creation:
1. Create a domain (RX, TX, FDB). Since domains are created by steering rules and not with DevX, Windows does not require a domain object (this means switch dev mode which requires an FDB domain is not supported).
2. Create a table object. Windows only supports table 0. The call tomlx5_flow_os_create_flow_tbl()silently returns successfully.
3. Create a matcher object. A matcher struct is created by callingmlx5_flow_os_create_flow_matcher(). The matcher validation and translation are part of the DV implementation. The matcher bits that were created by DV in standard PRM format are copied into the matcher struct.
4. Create an action object. The call tomlx5_flow_os_create_flow_action_dest_devx_tir()creates an action struct with the TIR type and id. This struct will be a parameter later in a call to flow creation. All other action calls (e.g. packet reformat, header modification, jump to flow table, etc) return with a non supported error.
5. Create the flow. The call tomlx5_flow_os_create_flow()receives the matcher struct, action struct, and copy them into Windows specificfs_rulestruct, then it calls glue APIdevx_fs_rule_add().Details on additional APIs:
*mlx5_flow_os_get_type()is called during flow type selection. In Windows it constantly returnsMLX5_FLOW_TYPE_DV.
*mlx5_flow_os_item_supported()is called before starting DV items validation or translation. It filters out the OS non supported items in advance.
*mlx5_flow_os_action_supported()is called before starting DV actions validation or translation. It filters out the OS non supported actions in advance.
*mlx5_flow_adjust_priority()is an OS stub for flow priority adjustment. Windows only supports flow priority 0.
* Alarm API:mlx5_os_alarm_cancel()andmlx5_os_alarm_set()are implemented in Windows to match their Linux counterpart, see [1]. Currently they return-ENOTSUP.
Quoted 5 lines
Quoted 2 lines
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")Can you please provide commit hash for this commit, I can amend it later in the next-net?
It looks to be garbage.
There is no alarm-related function in this patch.
Please remove these lines from the message.
Re: [dpdk-dev] [PATCH v2 24/35] net/mlx5/windows: introduce flow support
The following lines were originally removed from the commit message and should not have been sent (please consider it a typo mistake):
* Alarm API: mlx5_os_alarm_cancel() and mlx5_os_alarm_set() are implemented in Windows to match their Linux counterpart, see [1]. Currently they return -ENOTSUP.
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")
Quoted 69 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, January 8, 2021 4:55 PM
To: Ferruh Yigit <[email protected]>
Cc: Tal Shnaiderman <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Ophir Munk <[email protected]>; Dekel Peled <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 24/35]net/mlx5/windows: introduce flow support08/01/2021 15:38, Ferruh Yigit:
Quoted 7 lines · Tal Shnaiderman
Quoted 6 lines
From: Ophir Munk <[email protected]>
This patch adds the initial flow framework under Windows OS. It supports a subset of filters (ETH, IPV4, UDP) and a QUEUE action. It is based on DevX mechanism to send commands to the NIC through the kernel. It does not support steering rules (i.e. writing directly to the
NIC memory).
Quoted 7 lines
Quoted 7 lines
The Windows framework uses the existing DV framework where file
mlx5_flow_dv.cremains intact.Steps involved in flow creation:
1. Create a domain (RX, TX, FDB). Since domains are created by steering rules and not with DevX, Windows does not require a domain object (this means switch dev mode which requires an FDB domain is notsupported).
Quoted 32 lines
Quoted 32 lines
2. Create a table object. Windows only supports table 0. The call to
mlx5_flow_os_create_flow_tbl()silently returns successfully.
3. Create a matcher object. A matcher struct is created by callingmlx5_flow_os_create_flow_matcher(). The matcher validation and translation are part of the DV implementation. The matcher bits that were created by DV in standard PRM format are copied into the matcher struct.
4. Create an action object. The call tomlx5_flow_os_create_flow_action_dest_devx_tir()creates an action struct with the TIR type and id. This struct will be a parameter later in a call to flow creation. All other action calls (e.g. packet reformat, header modification, jump to flow table, etc) return with a non supported error.
5. Create the flow. The call tomlx5_flow_os_create_flow()receives the matcher struct, action struct, and copy them into Windows specificfs_rulestruct, then it calls glue APIdevx_fs_rule_add().Details on additional APIs:
*mlx5_flow_os_get_type()is called during flow type selection. In Windows it constantly returnsMLX5_FLOW_TYPE_DV.
*mlx5_flow_os_item_supported()is called before starting DV items validation or translation. It filters out the OS non supported items in advance.
*mlx5_flow_os_action_supported()is called before starting DV actions validation or translation. It filters out the OS non supported actions in advance.
*mlx5_flow_adjust_priority()is an OS stub for flow priority adjustment. Windows only supports flow priority 0.
* Alarm API:mlx5_os_alarm_cancel()andmlx5_os_alarm_set()are implemented in Windows to match their Linux counterpart, see [1]. Currently they return-ENOTSUP.Quoted 5 lines
Quoted 2 lines
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")Can you please provide commit hash for this commit, I can amend it later in the next-net?
It looks to be garbage.
There is no alarm-related function in this patch.
Please remove these lines from the message.
PATCH v2 25/35 net/mlx5/windows: create flow matcher object
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements the mlx5_flow_os_create_flow_matcher() API. It is the Linux rdma-core equivalent implementation. Missing rdma-core parameters (e.g. struct mlx5dv_flow_match_parameters) are added to file mlx5_win_defs.h. The API allocates space to hold the PRM bits in PRM fte_match_param format and copy the DV translated PRM bits into the matcher struct. This matcher struct will be used later by the flow creation API.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 57 +++++++++++++++++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 32 ++++++++++++---- drivers/net/mlx5/windows/mlx5_flow_os.h | 1 + 3 files changed, 83 insertions(+), 7 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +57 -0
@@ -132,6 +132,63 @@ enum {#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL 0x3#endif +enum ibv_flow_flags { +IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK =1 <<0 , +IBV_FLOW_ATTR_FLAGS_DONT_TRAP =1 <<1 , +IBV_FLOW_ATTR_FLAGS_EGRESS =1 <<2 , +}; + +enum ibv_flow_attr_type { +/* Steering according to rule specifications. */ +IBV_FLOW_ATTR_NORMAL =0x0 , +/* +* Default unicast and multicast rule - +* receive all Eth traffic which isn't steered to any QP. +*/ +IBV_FLOW_ATTR_ALL_DEFAULT =0x1 , +/* +* Default multicast rule - +* receive all Eth multicast traffic which isn't steered to any QP. +*/ +IBV_FLOW_ATTR_MC_DEFAULT =0x2 , +/* Sniffer rule - receive all port traffic. */ +IBV_FLOW_ATTR_SNIFFER =0x3 , +}; + +enum mlx5dv_flow_table_type { +MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX =0x0 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX =0x1 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB =0x2 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX =0x3 , +}; + +#define MLX5DV_FLOW_TABLE_TYPE_NIC_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX +#define MLX5DV_FLOW_TABLE_TYPE_NIC_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX +#define MLX5DV_FLOW_TABLE_TYPE_FDB MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB +#define MLX5DV_FLOW_TABLE_TYPE_RDMA_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX + +struct mlx5dv_flow_match_parameters { +size_t match_sz; +uint64_t match_buf[];/* Device spec format */ +}; + +struct mlx5dv_flow_matcher_attr { +enum ibv_flow_attr_type type; +uint32_t flags;/* From enum ibv_flow_flags. */ +uint16_t priority; +uint8_t match_criteria_enable;/* Device spec format. */ +struct mlx5dv_flow_match_parameters *match_mask; +uint64_t comp_mask;/* Use mlx5dv_flow_matcher_attr_mask. */ +enum mlx5dv_flow_table_type ft_type; +}; + +/* Windows specific mlx5_matcher. */ +struct mlx5_matcher { +void *ctx; +struct mlx5dv_flow_matcher_attr attr; +uint64_t match_buf[]; +}; +struct mlx5_err_cqe {uint8_t rsvd0[32 ];uint32_t srqn;
drivers/net/mlx5/windows/mlx5_flow_os.c +25 -7
@@ -76,12 +76,31 @@ mlx5_flow_os_create_flow_matcher(void *ctx,void *table, void **matcher) { -RTE_SET_USED (ctx ); -RTE_SET_USED (attr); + struct mlx5dv_flow_matcher_attr *mattr; +RTE_SET_USED (table); *matcher =NULL ; - rte_errno =ENOTSUP ; -return -rte_errno; + mattr = attr; +if (mattr->type !=IBV_FLOW_ATTR_NORMAL ) { + rte_errno =ENOTSUP ; +return -rte_errno; + } +struct mlx5_matcher *mlx5_matcher = +mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_matcher ) + +MLX5_ST_SZ_BYTES (fte_match_param), +0 ,SOCKET_ID_ANY ); +if (!mlx5_matcher) { + rte_errno =ENOMEM ; +return -rte_errno; + } + mlx5_matcher->ctx = ctx; +memcpy (&mlx5_matcher->attr, attr,sizeof (mlx5_matcher->attr)); +memcpy (&mlx5_matcher->match_buf, + mattr->match_mask->match_buf, +MLX5_ST_SZ_BYTES (fte_match_param)); + *matcher = mlx5_matcher; +return 0 ; }/**
@@ -96,9 +115,8 @@ mlx5_flow_os_create_flow_matcher(void *ctx,int mlx5_flow_os_destroy_flow_matcher (void *matcher) { -RTE_SET_USED (matcher); - rte_errno =ENOTSUP ; -return -rte_errno; +mlx5_free (matcher); +return 0 ; }/**
drivers/net/mlx5/windows/mlx5_flow_os.h +1 -0
@@ -6,6 +6,7 @@#define RTE_PMD_MLX5_FLOW_OS_H_ #include "mlx5_flow.h" +#include "mlx5_malloc.h" #if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )extern const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops;
Signature · 1 line
2.16.1.windows.4
PATCH v2 26/35 net/mlx5/windows: create flow action dest TIR object
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_flow_os_create_flow_action_dest_devx_tir() API as the Linux rdma-core equivalent. Missing rdma-core parameters are added to file mlx5_win_defs.h. The action TIR id and type (MLX5_FLOW_CONTEXT_DEST_TYPE_TIR) are saved in the action struct. The action struct will be added to array of actions and will be used later by the flow creation API.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 17 +++++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 22 +++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +17 -0
@@ -189,6 +189,17 @@ struct mlx5_matcher {uint64_t match_buf[]; }; +/* +* Windows mlx5_action. This struct is the +* equivalent of rdma-core struct mlx5dv_dr_action. +*/ +struct mlx5_action { +int type; +struct { +uint32_t id; + } dest_tir; +}; +struct mlx5_err_cqe {uint8_t rsvd0[32 ];uint32_t srqn;
@@ -233,4 +244,10 @@ enum {MLX5_FLOW_CONTEXT_DEST_TYPE_TIR =0x2 , MLX5_FLOW_CONTEXT_DEST_TYPE_QP = 0x3, }; + +enum { +MLX5_MATCH_OUTER_HEADERS =1 <<0 , +MLX5_MATCH_MISC_PARAMETERS =1 <<1 , +MLX5_MATCH_INNER_HEADERS =1 <<2 , +};#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/mlx5_flow_os.c +15 -7
@@ -134,10 +134,19 @@ int mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir, void **action) { -RTE_SET_USED (tir); - *action =NULL ; - rte_errno =ENOTSUP ; -return -rte_errno; + struct mlx5_action *mlx5_action = +mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_action ), +0 ,SOCKET_ID_ANY ); + +if (!mlx5_action) { + rte_errno =ENOMEM ; +return -rte_errno; + } + mlx5_action->type =MLX5_FLOW_CONTEXT_DEST_TYPE_TIR ; + mlx5_action->dest_tir.id = tir->id; + *action = mlx5_action; +return 0 ; }/**
@@ -152,9 +161,8 @@ mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir,int mlx5_flow_os_destroy_flow_action (void *action) { -RTE_SET_USED (action); - rte_errno =ENOTSUP ; -return -rte_errno; +mlx5_free (action); +return 0 ; }/**
Signature · 1 line
2.16.1.windows.4
PATCH v2 27/35 net/mlx5/windows: create flow rule
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_flow_os_create_flow() API. It is equivalent to Linux rdma-core implementation. The API receives the matcher mask, matcher value and an array of actions. They are copied into a PRM-like struct devx_fs_rule_add_in. Then glue API devx_fs_rule_add() is called.
--- drivers/common/mlx5/mlx5_prm.h | 6 +++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 46 ++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-)
drivers/common/mlx5/mlx5_prm.h +6 -0
@@ -825,6 +825,12 @@ struct mlx5_ifc_fte_match_param_bits {#endif }; +struct mlx5_ifc_dest_format_struct_bits { +u8 destination_type[0x8 ]; +u8 destination_id[0x18 ]; +u8 reserved_0[0x20 ]; +}; +enum {MLX5_MATCH_CRITERIA_ENABLE_OUTER_BIT ,MLX5_MATCH_CRITERIA_ENABLE_MISC_BIT ,
drivers/net/mlx5/windows/mlx5_flow_os.c +36 -10
56 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 28/35 net/mlx5: use HAVE_INFINIBAND_VERBS_H in shared code
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Use macro HAVE_INFINIBAND_VERBS_H to successfully compile files both under Linux and Windows (or any non Linux in general). Under Windows this macro:
1. Hides Verbs references.
2. Exposes required DV structs that are under ifdefs related to rdma core.
Linux code under definitions such as #ifdef HAVE_IBV_FLOW_DV_SUPPORT is required unconditionally under Windows however those definitions are never effective without rdma-core presence. Therefore update the #ifdef condition to consider HAVE_INFINIBAND_VERBS_H as well (undefined macro when running without an rdma-core library).
For example:
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
--- drivers/net/mlx5/mlx5.c | 4 ++-- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_devx.c | 8 ++++---- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow.h | 16 +++++++--------- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/mlx5_flow_verbs.c | 6 ++++++ 7 files changed, 23 insertions(+), 19 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
@@ -187,7 +187,7 @@ static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =static pthread_mutex_t mlx5_dev_ctx_list_mutex =PTHREAD_MUTEX_INITIALIZER ;static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_IPOOL_DECAP_ENCAP] = { .size =sizeof (struct mlx5_flow_dv_encap_decap_resource ), .trunk_size =64 ,
@@ -1148,7 +1148,7 @@ mlx5_alloc_table_hash_list(struct mlx5_priv *priv __rte_unused) {int err =0 ;/* Tables are only used in DV and DR modes. */ -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_dev_ctx_shared *sh = priv->sh;char s[MLX5_HLIST_NAMESIZE ];
drivers/net/mlx5/mlx5.h +2 -2
@@ -36,7 +36,7 @@#define MLX5_SH (dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh)enum mlx5_ipool_index { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )MLX5_IPOOL_DECAP_ENCAP =0 ,/* Pool for encap/decap resource. */ MLX5_IPOOL_PUSH_VLAN ,/* Pool for push vlan resource. */ MLX5_IPOOL_TAG ,/* Pool for tag resource. */
@@ -833,7 +833,7 @@ struct mlx5_hrxq {void *qp;/* Verbs queue pair. */ struct mlx5_devx_obj *tir;/* DevX TIR object. */ }; -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )void *action;/* DV QP action pointer. */ #endif uint64_t hash_fields;/* Verbs Hash fields. */
drivers/net/mlx5/mlx5_devx.c +4 -4
@@ -941,7 +941,7 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, rte_errno = errno; goto error; } -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )if (mlx5_flow_os_create_flow_action_dest_devx_tir (hrxq->tir, &hrxq->action)) { rte_errno = errno;
@@ -1111,7 +1111,7 @@ mlx5_txq_obj_hairpin_new(struct rte_eth_dev *dev, uint16_t idx)return 0 ; } -#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) || !defined(HAVE_INFINIBAND_VERBS_H )/** * Release DevX SQ resources. *
@@ -1421,7 +1421,7 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx)if (txq_ctrl->type ==MLX5_TXQ_TYPE_HAIRPIN )return mlx5_txq_obj_hairpin_new (dev, idx); -#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if !defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) && defined(HAVE_INFINIBAND_VERBS_H )DRV_LOG (ERR ,"Port %u Tx queue %u cannot create with DevX, no UAR." , dev->data->port_id, idx); rte_errno =ENOMEM ;
@@ -1522,7 +1522,7 @@ mlx5_txq_devx_obj_release(struct mlx5_txq_obj *txq_obj)if (txq_obj->txq_ctrl->type ==MLX5_TXQ_TYPE_HAIRPIN ) {if (txq_obj->tis)claim_zero (mlx5_devx_cmd_destroy (txq_obj->tis)); -#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) || !defined(HAVE_INFINIBAND_VERBS_H ) } else {mlx5_txq_release_devx_resources (txq_obj);#endif
drivers/net/mlx5/mlx5_flow.c +1 -1
@@ -73,7 +73,7 @@ const struct mlx5_flow_driver_ops mlx5_flow_null_drv_ops;const struct mlx5_flow_driver_ops *flow_drv_ops[] = { [MLX5_FLOW_TYPE_MIN ] = &mlx5_flow_null_drv_ops, -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_FLOW_TYPE_DV ] = &mlx5_flow_dv_drv_ops, #endif [MLX5_FLOW_TYPE_VERBS ] = &mlx5_flow_verbs_drv_ops,
drivers/net/mlx5/mlx5_flow.h +7 -9
@@ -600,12 +600,6 @@ struct mlx5_flow_dv_dest_array_resource {/**< Action resources. */ }; -/* Verbs specification header. */ -struct ibv_spec_header { -enum ibv_flow_spec_type type; -uint16_t size; -}; -/* PMD flow priority for tunnel */ #define MLX5_TUNNEL_PRIO_GET (rss_desc) \ ((rss_desc)->level >= 2 ? MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4)
@@ -652,7 +646,7 @@ struct mlx5_flow_handle {uint32_t rix_srss;/**< Indicates shared RSS fate action. */ }; -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_flow_handle_dv dvh;#endif } __rte_packed;
@@ -662,7 +656,7 @@ struct mlx5_flow_handle {* structure in Verbs. No DV flows attributes will be accessed. * Macro offsetof() could also be used here. */ -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )#define MLX5_FLOW_HANDLE_VERBS_SIZE \ (sizeof(struct mlx5_flow_handle) - sizeof(struct mlx5_flow_handle_dv))#else
@@ -700,6 +694,7 @@ struct mlx5_flow_dv_workspace {/**< Pointer to the destination array resource. */ }; +#ifdef HAVE_INFINIBAND_VERBS_H /* * Maximal Verbs flow specifications & actions size. * Some elements are mutually exclusive, but enough space should be allocated.
@@ -756,6 +751,7 @@ struct mlx5_flow_verbs_workspace {uint8_t specs[MLX5_VERBS_MAX_SPEC_ACT_SIZE ]; /**< Specifications & actions buffer of verbs flow. */ }; +#endif /* HAVE_INFINIBAND_VERBS_H */ /** Maximal number of device sub-flows supported. */ #define MLX5_NUM_MAX_DEV_FLOWS 32
@@ -773,10 +769,12 @@ struct mlx5_flow { uint8_t skip_scale:1;/**< 1 if skip the scale the table with factor. */ union { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_flow_dv_workspace dv;#endif +#ifdef HAVE_INFINIBAND_VERBS_H struct mlx5_flow_verbs_workspace verbs; +#endif };struct mlx5_flow_handle *handle;uint32_t handle_idx;/* Index of the mlx5 flow handle memory. */
drivers/net/mlx5/mlx5_flow_dv.c +1 -1
@@ -35,7 +35,7 @@#include "mlx5_rxtx.h" #include "rte_pmd_mlx5.h" -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )#ifndef HAVE_IBV_FLOW_DEVX_COUNTERS #define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0
drivers/net/mlx5/mlx5_flow_verbs.c +6 -0
@@ -39,6 +39,12 @@ static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX] = { { 9, 10, 11 }, { 12, 13, 14 }, }; +/* Verbs specification header. */ +struct ibv_spec_header { +enum ibv_flow_spec_type type; +uint16_t size; +}; +/** * Discover the maximum number of priority available. *
Signature · 1 line
2.16.1.windows.4
PATCH v2 29/35 net/mlx5: fix separating eth_dev_ops per OS
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
There are three types of eth_dev_ops: primary, secondary and isolate represented in three callback tables per OS. In this commit the OS specific eth dev tables are unified into shared tables in file mlx5.c. Starting from this commit all operating systems must implement the same eth dev APIs. In case an OS does not support an API - it can return in its implementation an error ENOTSUP.
--- drivers/net/mlx5/linux/mlx5_os.c | 154 +------------------------------------ drivers/net/mlx5/mlx5.c | 150 ++++++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_flow.c | 4 +- drivers/net/mlx5/windows/mlx5_os.c | 110 +------------------------- 5 files changed, 158 insertions(+), 266 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +2 -152
@@ -757,7 +757,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, rte_eth_devices[priv->sh->bond_dev].device; else eth_dev->device = dpdk_dev; - eth_dev->dev_ops = &mlx5_os_dev_sec_ops; + eth_dev->dev_ops = &mlx5_dev_sec_ops; eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status; eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status; err =mlx5_proc_priv_init (eth_dev);
@@ -1432,7 +1432,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,/* Initialize burst functions to prevent crashes before link-up. */ eth_dev->rx_pkt_burst = removed_rx_burst; eth_dev->tx_pkt_burst = removed_tx_burst; - eth_dev->dev_ops = &mlx5_os_dev_ops; + eth_dev->dev_ops = &mlx5_dev_ops; eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status; eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status; eth_dev->rx_queue_count = mlx5_rx_queue_count;
@@ -2611,153 +2611,3 @@ mlx5_os_mac_addr_flush(struct rte_eth_dev *dev) dev->data->mac_addrs, MLX5_MAX_MAC_ADDRESSES, priv->mac_own); } - -const struct eth_dev_ops mlx5_os_dev_ops = { - .dev_configure = mlx5_dev_configure, - .dev_start = mlx5_dev_start, - .dev_stop = mlx5_dev_stop, - .dev_set_link_down = mlx5_set_link_down, - .dev_set_link_up = mlx5_set_link_up, - .dev_close = mlx5_dev_close, - .promiscuous_enable = mlx5_promiscuous_enable, - .promiscuous_disable = mlx5_promiscuous_disable, - .allmulticast_enable = mlx5_allmulticast_enable, - .allmulticast_disable = mlx5_allmulticast_disable, - .link_update = mlx5_link_update, - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get, - .vlan_filter_set = mlx5_vlan_filter_set, - .rx_queue_setup = mlx5_rx_queue_setup, - .rx_hairpin_queue_setup = mlx5_rx_hairpin_queue_setup, - .tx_queue_setup = mlx5_tx_queue_setup, - .tx_hairpin_queue_setup = mlx5_tx_hairpin_queue_setup, - .rx_queue_release = mlx5_rx_queue_release, - .tx_queue_release = mlx5_tx_queue_release, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .flow_ctrl_get = mlx5_dev_get_flow_ctrl, - .flow_ctrl_set = mlx5_dev_set_flow_ctrl, - .mac_addr_remove = mlx5_mac_addr_remove, - .mac_addr_add = mlx5_mac_addr_add, - .mac_addr_set = mlx5_mac_addr_set, - .set_mc_addr_list = mlx5_set_mc_addr_list, - .mtu_set = mlx5_dev_set_mtu, - .vlan_strip_queue_set = mlx5_vlan_strip_queue_set, - .vlan_offload_set = mlx5_vlan_offload_set, - .reta_update = mlx5_dev_rss_reta_update, - .reta_query = mlx5_dev_rss_reta_query, - .rss_hash_update = mlx5_rss_hash_update, - .rss_hash_conf_get = mlx5_rss_hash_conf_get, - .filter_ctrl = mlx5_dev_filter_ctrl, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .rx_queue_intr_enable = mlx5_rx_intr_enable, - .rx_queue_intr_disable = mlx5_rx_intr_disable, - .is_removed = mlx5_is_removed, - .udp_tunnel_port_add = mlx5_udp_tunnel_port_add, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, - .hairpin_cap_get = mlx5_hairpin_cap_get, - .mtr_ops_get = mlx5_flow_meter_ops_get, - .hairpin_bind = mlx5_hairpin_bind, - .hairpin_unbind = mlx5_hairpin_unbind, - .hairpin_get_peer_ports = mlx5_hairpin_get_peer_ports, - .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, - .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, - .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, -}; - -/* Available operations from secondary process. */ -const struct eth_dev_ops mlx5_os_dev_sec_ops = { - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, -}; - -/* Available operations in flow isolated mode. */ -const struct eth_dev_ops mlx5_os_dev_ops_isolate = { - .dev_configure = mlx5_dev_configure, - .dev_start = mlx5_dev_start, - .dev_stop = mlx5_dev_stop, - .dev_set_link_down = mlx5_set_link_down, - .dev_set_link_up = mlx5_set_link_up, - .dev_close = mlx5_dev_close, - .promiscuous_enable = mlx5_promiscuous_enable, - .promiscuous_disable = mlx5_promiscuous_disable, - .allmulticast_enable = mlx5_allmulticast_enable, - .allmulticast_disable = mlx5_allmulticast_disable, - .link_update = mlx5_link_update, - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get, - .vlan_filter_set = mlx5_vlan_filter_set, - .rx_queue_setup = mlx5_rx_queue_setup, - .rx_hairpin_queue_setup = mlx5_rx_hairpin_queue_setup, - .tx_queue_setup = mlx5_tx_queue_setup, - .tx_hairpin_queue_setup = mlx5_tx_hairpin_queue_setup, - .rx_queue_release = mlx5_rx_queue_release, - .tx_queue_release = mlx5_tx_queue_release, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .flow_ctrl_get = mlx5_dev_get_flow_ctrl, - .flow_ctrl_set = mlx5_dev_set_flow_ctrl, - .mac_addr_remove = mlx5_mac_addr_remove, - .mac_addr_add = mlx5_mac_addr_add, - .mac_addr_set = mlx5_mac_addr_set, - .set_mc_addr_list = mlx5_set_mc_addr_list, - .mtu_set = mlx5_dev_set_mtu, - .vlan_strip_queue_set = mlx5_vlan_strip_queue_set, - .vlan_offload_set = mlx5_vlan_offload_set, - .filter_ctrl = mlx5_dev_filter_ctrl, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .rx_queue_intr_enable = mlx5_rx_intr_enable, - .rx_queue_intr_disable = mlx5_rx_intr_disable, - .is_removed = mlx5_is_removed, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, - .hairpin_cap_get = mlx5_hairpin_cap_get, - .mtr_ops_get = mlx5_flow_meter_ops_get, - .hairpin_bind = mlx5_hairpin_bind, - .hairpin_unbind = mlx5_hairpin_unbind, - .hairpin_get_peer_ports = mlx5_hairpin_get_peer_ports, - .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, - .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, - .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, -};
drivers/net/mlx5/mlx5.c +150 -0
156 lines not on this page · raw message
drivers/net/mlx5/mlx5.h +3 -3
@@ -140,9 +140,9 @@ struct mlx5_local_data {extern struct mlx5_shared_data *mlx5_shared_data;/* Dev ops structs */ -extern const struct eth_dev_ops mlx5_os_dev_ops; -extern const struct eth_dev_ops mlx5_os_dev_sec_ops; -extern const struct eth_dev_ops mlx5_os_dev_ops_isolate; +extern const struct eth_dev_ops mlx5_dev_ops; +extern const struct eth_dev_ops mlx5_dev_sec_ops; +extern const struct eth_dev_ops mlx5_dev_ops_isolate;struct mlx5_counter_ctrl {/* Name of the counter. */
drivers/net/mlx5/mlx5_flow.c +2 -2
@@ -6135,9 +6135,9 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, } priv->isolated = !!enable;if (enable) - dev->dev_ops = &mlx5_os_dev_ops_isolate; + dev->dev_ops = &mlx5_dev_ops_isolate;else - dev->dev_ops = &mlx5_os_dev_ops; + dev->dev_ops = &mlx5_dev_ops; dev->rx_descriptor_status = mlx5_rx_descriptor_status; dev->tx_descriptor_status = mlx5_tx_descriptor_status;
drivers/net/mlx5/windows/mlx5_os.c +1 -109
119 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH v2 30/35 net/mlx5: define MLX5_NAMESIZE for device interface size
In reply to Tal ShnaidermanWindows Devx interface name is the same as device name with different size then IF_NAMESIZE. to support it MLX5_NAMESIZE is defined with IF_NAMESIZE value for Linux and MLX5_FS_NAME_MAX value for Windows.
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 ++-- drivers/net/mlx5/linux/mlx5_os.c | 2 +- drivers/net/mlx5/linux/mlx5_os.h | 6 ++---- drivers/net/mlx5/mlx5.h | 4 +++- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 4 ++-- drivers/net/mlx5/windows/mlx5_os.c | 2 +- drivers/net/mlx5/windows/mlx5_os.h | 2 ++ 7 files changed, 13 insertions(+), 11 deletions(-)
drivers/net/mlx5/linux/mlx5_ethdev_os.c +2 -2
@@ -143,7 +143,7 @@ struct ethtool_link_settings {* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[MLX5_NAMESIZE ]) {struct mlx5_priv *priv = dev->data->dev_private;unsigned int ifindex;
@@ -151,7 +151,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])MLX5_ASSERT (priv);MLX5_ASSERT (priv->sh);if (priv->bond_ifindex >0 ) { -memcpy (ifname, priv->bond_name,IF_NAMESIZE ); +memcpy (ifname, priv->bond_name,MLX5_NAMESIZE );return 0 ; } ifindex =mlx5_ifindex (dev);
drivers/net/mlx5/linux/mlx5_os.c +1 -1
@@ -1411,7 +1411,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mac.addr_bytes[4], mac.addr_bytes[5]);#ifdef RTE_LIBRTE_MLX5_DEBUG { -char ifname[IF_NAMESIZE ]; +char ifname[MLX5_NAMESIZE ];if (mlx5_get_ifname (eth_dev, &ifname) ==0 ) DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
drivers/net/mlx5/linux/mlx5_os.h +2 -4
@@ -14,11 +14,9 @@ enum {MLX5_FS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 }; +#define MLX5_NAMESIZE IF_NAMESIZE +#define PCI_DRV_FLAGS (RTE_PCI_DRV_INTR_LSC | \ RTE_PCI_DRV_INTR_RMV | \ RTE_PCI_DRV_PROBE_AGAIN) - -/* mlx5_ethdev_os.c */ - -int mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]);#endif /* RTE_PMD_MLX5_OS_H_ */
drivers/net/mlx5/mlx5.h +3 -1
@@ -950,7 +950,7 @@ struct mlx5_priv {int32_t pf_bond;/* >=0 means PF index in bonding configuration. */ unsigned int if_index;/* Associated kernel network device index. */ uint32_t bond_ifindex;/**< Bond interface index. */ -char bond_name[IF_NAMESIZE ];/**< Bond interface name. */ +char bond_name[MLX5_NAMESIZE ];/**< Bond interface name. */ /* RX/TX queues. */ unsigned int rxqs_n;/* RX queues array size. */ unsigned int txqs_n;/* TX queues array size. */
@@ -1067,6 +1067,8 @@ int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);/* mlx5_ethdev_os.c */ +int mlx5_get_ifname (const struct rte_eth_dev *dev, +char (*ifname)[MLX5_NAMESIZE ]);unsigned int mlx5_ifindex (const struct rte_eth_dev *dev);int mlx5_get_mac (struct rte_eth_dev *dev,uint8_t (*mac)[RTE_ETHER_ADDR_LEN ]);int mlx5_get_mtu (struct rte_eth_dev *dev,uint16_t *mtu);
drivers/net/mlx5/windows/mlx5_ethdev_os.c +2 -2
@@ -56,7 +56,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[MLX5_NAMESIZE ]) {struct mlx5_priv *priv;mlx5_context_st *context_obj;
@@ -67,7 +67,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]) } priv = dev->data->dev_private; context_obj = (mlx5_context_st *)priv->sh->ctx; -strncpy (*ifname, context_obj->mlx5_dev.name,IF_NAMESIZE ); +strncpy (*ifname, context_obj->mlx5_dev.name,MLX5_NAMESIZE );return 0 ; }
drivers/net/mlx5/windows/mlx5_os.c +1 -1
@@ -550,7 +550,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mac.addr_bytes[4], mac.addr_bytes[5]);#ifdef RTE_LIBRTE_MLX5_DEBUG { -char ifname[IF_NAMESIZE ]; +char ifname[MLX5_NAMESIZE ];if (mlx5_get_ifname (eth_dev, &ifname) ==0 ) DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
drivers/net/mlx5/windows/mlx5_os.h +2 -0
@@ -14,4 +14,6 @@ enum {#define PCI_DRV_FLAGS 0 +#define MLX5_NAMESIZE MLX5_FS_NAME_MAX +#endif /* RTE_PMD_MLX5_OS_H_ */
Signature · 1 line
2.16.1.windows.4
PATCH v2 31/35 net/mlx5: use OS independent code in ASO feature
In reply to Tal ShnaidermanModify the ASO feature to use OS independent code
not to break Windows build.
--- drivers/net/mlx5/mlx5_flow_age.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow_age.c +8 -7
@@ -4,6 +4,7 @@#include <mlx5_prm.h> #include <rte_malloc.h> #include <rte_cycles.h> +#include <rte_eal_paging.h> #include <mlx5_malloc.h> #include <mlx5_common_os.h>
@@ -53,7 +54,7 @@ mlx5_aso_cq_create(void *ctx, struct mlx5_aso_cq *cq, uint16_t log_desc_n, int socket, int uar_page_id, uint32_t eqn) { struct mlx5_devx_cq_attr attr = { 0 }; -size_t pgsize =sysconf (_SC_PAGESIZE); +size_t pgsize =rte_mem_page_size ();uint32_t umem_size;uint16_t cq_size =1 << log_desc_n;
@@ -66,7 +67,7 @@ mlx5_aso_cq_create(void *ctx, struct mlx5_aso_cq *cq, uint16_t log_desc_n, rte_errno =ENOMEM ;return -ENOMEM ; } - cq->umem_obj = mlx5_glue->devx_umem_reg (ctx, + cq->umem_obj =mlx5_os_umem_reg (ctx, (void *)(uintptr_t )cq->umem_buf, umem_size,IBV_ACCESS_LOCAL_WRITE );
@@ -143,7 +144,7 @@ mlx5_aso_devx_reg_mr(void *ctx, size_t length, struct mlx5_aso_devx_mr *mr,DRV_LOG (ERR ,"Failed to create ASO bits mem for MR by Devx." );return -1 ; } - mr->umem = mlx5_glue->devx_umem_reg (ctx, mr->buf, length, + mr->umem =mlx5_os_umem_reg (ctx, mr->buf, length,IBV_ACCESS_LOCAL_WRITE );if (!mr->umem) {DRV_LOG (ERR ,"Failed to register Umem for MR by Devx." );
@@ -256,12 +257,12 @@ mlx5_aso_init_sq(struct mlx5_aso_sq *sq)*/ static int mlx5_aso_sq_create (void *ctx,struct mlx5_aso_sq *sq,int socket, -struct mlx5dv_devx_uar *uar,uint32_t pdn, +void *uar,uint32_t pdn,uint32_t eqn,uint16_t log_desc_n) {struct mlx5_devx_create_sq_attr attr = {0 };struct mlx5_devx_modify_sq_attr modify_attr = {0 }; -size_t pgsize =sysconf (_SC_PAGESIZE); +size_t pgsize =rte_mem_page_size ();struct mlx5_devx_wq_attr *wq_attr = &attr.wq_attr;uint32_t sq_desc_n =1 << log_desc_n;uint32_t wq_size =sizeof (struct mlx5_aso_wqe ) * sq_desc_n;
@@ -280,7 +281,7 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,DRV_LOG (ERR ,"Can't allocate wqe buffer." );return -ENOMEM ; } - sq->wqe_umem = mlx5_glue->devx_umem_reg(ctx, + sq->wqe_umem = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)sq->umem_buf, wq_size + sizeof(*sq->db_rec) * 2,
@@ -325,7 +326,7 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket, sq->tail =0 ; sq->sqn = sq->sq->id; sq->db_rec =RTE_PTR_ADD (sq->umem_buf, (uintptr_t )(wq_attr->dbr_addr)); - sq->uar_addr = (volatile uint64_t *)((uint8_t *)uar->base_addr +0x800 ); + sq->uar_addr =mlx5_os_get_devx_uar_reg_addr (uar);mlx5_aso_init_sq (sq);return 0 ; error:
Signature · 1 line
2.16.1.windows.4
PATCH v2 32/35 mlx5: use init function for ctx list mutex
In reply to Tal ShnaidermanThe mutex mlx5_dev_ctx_list_mutex was initialized with PTHREAD_MUTEX_INITIALIZER global macro however this macro is not supported on Windows OS shim implementation of pthreads in DPDK.
Moved the init of this mutex to RTE_INIT to support this mutex on both OSs.
--- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
@@ -184,8 +184,7 @@ int mlx5_logtype; static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =LIST_HEAD_INITIALIZER (); -static pthread_mutex_t mlx5_dev_ctx_list_mutex =PTHREAD_MUTEX_INITIALIZER ; - +static pthread_mutex_t mlx5_dev_ctx_list_mutex; static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_IPOOL_DECAP_ENCAP] = {
@@ -2235,6 +2234,7 @@ RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE)*/ RTE_INIT (rte_mlx5_pmd_init) { +pthread_mutex_init (&mlx5_dev_ctx_list_mutex,NULL );mlx5_common_init ();/* Build the static tables for Verbs conversion. */ mlx5_set_ptype_table ();
Signature · 1 line
2.16.1.windows.4
PATCH v2 33/35 mlx5: use OS function for dr_sync_domain
In reply to Tal Shnaidermanuse OS functions for flow_dv_sync_domain to compile Windows.
mlx5_os_flow_dr_sync_domain is unsupported for Windows.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 6 ++++++ drivers/net/mlx5/mlx5_flow_dv.c | 6 +++--- drivers/net/mlx5/windows/mlx5_flow_os.h | 9 +++++++++ 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +6 -0
@@ -427,4 +427,10 @@ mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, {return mlx5_flow_adjust_priority (dev, priority, subpriority); } + +static inline int +mlx5_os_flow_dr_sync_domain (void *domain,uint32_t flags) +{ +return mlx5_glue->dr_sync_domain (domain, flags); +}#endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
drivers/net/mlx5/mlx5_flow_dv.c +3 -3
@@ -12680,18 +12680,18 @@ flow_dv_sync_domain(struct rte_eth_dev *dev, uint32_t domains, uint32_t flags)int ret =0 ;if ((domains &MLX5_DOMAIN_BIT_NIC_RX ) && priv->sh->rx_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->rx_domain, + ret =mlx5_os_flow_dr_sync_domain (priv->sh->rx_domain, flags);if (ret !=0 )return ret; }if ((domains &MLX5_DOMAIN_BIT_NIC_TX ) && priv->sh->tx_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->tx_domain, flags); + ret =mlx5_os_flow_dr_sync_domain (priv->sh->tx_domain, flags);if (ret !=0 )return ret; }if ((domains &MLX5_DOMAIN_BIT_FDB ) && priv->sh->fdb_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->fdb_domain, flags); + ret =mlx5_os_flow_dr_sync_domain (priv->sh->fdb_domain, flags);if (ret !=0 )return ret; }
drivers/net/mlx5/windows/mlx5_flow_os.h +9 -0
@@ -345,6 +345,15 @@ mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,return 0 ; } +static inline int +mlx5_os_flow_dr_sync_domain (void *domain,uint32_t flags) +{ +RTE_SET_USED (domain); +RTE_SET_USED (flags); + errno =ENOTSUP ; +return errno; +} + int mlx5_flow_os_validate_flow_attributes(struct rte_eth_dev *dev, const struct rte_flow_attr *attributes, bool external,
Signature · 1 line
2.16.1.windows.4
PATCH v2 34/35 mlx5: do not fail on IPv6 broadcast flow creation failure
In reply to Tal ShnaidermanIPv6 broadcast flow creation is unsupported in Windows. do not fail on IPv6 broadcast flow creation on this mast to avoid entire default rules creation failure.
--- drivers/net/mlx5/mlx5_trigger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_trigger.c +6 -2
@@ -1316,8 +1316,12 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) goto error; ret =mlx5_ctrl_flow (dev, &ipv6_multi_spec, &ipv6_multi_mask); -if (ret) - goto error; +if (ret) { +/* Do not fail on IPv6 broadcast creation failure. */ +DRV_LOG (WARNING , +"IPv6 broadcast is not supported" ); + ret =0 ; + } } }/* Add MAC address flows. */
Signature · 1 line
2.16.1.windows.4
PATCH v2 35/35 net/mlx5: fix warnings on comparison sign mismatch
In reply to Tal ShnaidermanThe clang compiler warns on size mismatches of several comparisons.
warning: comparison of integers of different signs
To resolve those the right types is used/cast to.
--- drivers/net/mlx5/mlx5_flow.c | 4 ++-- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/windows/mlx5_flow_os.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow.c +2 -2
@@ -798,7 +798,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, start_reg = priv->mtr_color_reg !=REG_C_2 ?REG_C_2 : (priv->mtr_reg_share ?REG_C_3 :REG_C_4 ); skip_mtr_reg = !!(priv->mtr_en && start_reg ==REG_C_2 ); -if (id > (REG_C_7 - start_reg)) +if (id > (uint32_t )(REG_C_7 - start_reg))return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL ,"invalid tag id" );
@@ -814,7 +814,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev,*/ if (skip_mtr_reg && config->flow_mreg_c [id + start_reg -REG_C_0 ] >= priv->mtr_color_reg) { -if (id >= (REG_C_7 - start_reg)) +if (id >= (uint32_t )(REG_C_7 - start_reg))return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL ,"invalid tag id" );
drivers/net/mlx5/mlx5_flow_dv.c +1 -1
@@ -955,7 +955,7 @@ flow_dv_convert_action_set_regRTE_FLOW_ERROR_TYPE_ACTION ,NULL , "too many items to modify");MLX5_ASSERT (conf->id !=REG_NON ); -MLX5_ASSERT (conf->id <RTE_DIM (reg_to_field)); +MLX5_ASSERT (conf->id < (enum modify_reg )RTE_DIM (reg_to_field)); actions[i] = (struct mlx5_modification_cmd ) { .action_type =MLX5_MODIFICATION_TYPE_SET , .field = reg_to_field[conf->id],
drivers/net/mlx5/windows/mlx5_flow_os.c +1 -1
@@ -188,7 +188,7 @@ mlx5_flow_os_create_flow(void *matcher, void *match_value, void *actions[], void **flow) { struct mlx5_action *action; -int i; +size_t i;struct mlx5_matcher *mlx5_matcher = matcher;struct mlx5_flow_dv_match_params *mlx5_match_value = match_value;uint32_t in[MLX5_ST_SZ_DW (devx_fs_rule_add_in)] = {0 };
Signature · 1 line
2.16.1.windows.4
Hi,
Quoted 92 lines
-----Original Message-----
From: Tal Shnaiderman <[email protected]>
Sent: Monday, December 28, 2020 2:32 PM
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Ophir Munk <[email protected]>
Subject: [PATCH v2 00/35] mlx5 Windows support - part #6This patch series is part of preparing mlx5 PMD to compile and run under Windows OS. Part #6
Depends-on: series-14480 ("mlx5 Windows support - part #5")
v2: Fix style issues.
Ophir Munk (18):
common/mlx5/windows: add missing DV and IBV definitions common/mlx5: add rte compatibility header file common/mlx5/windows: add DevX UAR gettersnet/mlx5/windows: add memory region callbacksnet/mlx5/windows: add stubs for MP requestsnet/mlx5/windows: add ethdev stub operationsnet/mlx5/windws: add VLAN stubsnet/mlx5/windows: support open devicenet/mlx5/windws: spawn eth devicesnet/mlx5/linux: wrap adjust flow priority with OS callsnet/mlx5/linux: add OS default miss flow actionnet/mlx5/linux: fix add OSdest_devx_tiractionnet/mlx5/windows: introduce flow supportnet/mlx5/windows: create flow matcher objectnet/mlx5/windows: create flow action dest TIR objectnet/mlx5/windows: create flow rule
net/mlx5: useHAVE_INFINIBAND_VERBS_Hin shared code net/mlx5: fix separatingeth_dev_opsper OSTal Shnaiderman (17):
mlx5/windows: add mlx5 macros for fs name and path common/mlx5/windows: wrap event channel APIs with OS callsnet/mlx5/windows: support get macnet/mlx5/windows: support link updatenet/mlx5/windows: support read clocknet/mlx5/windows: support get mtunet/mlx5/windows: support get interface namenet/mlx5/windows: support device removed querynet/mlx5/windows: support get pdnnet/mlx5/windows: initial probing implementationnet/mlx5/windows: support VF PCI address net/mlx5: defineMLX5_NAMESIZEfor device interface size net/mlx5: use OS independent code in ASO feature
mlx5: use init function for ctx list mutex
mlx5: use OS function fordr_sync_domain
mlx5: do not fail on IPv6 broadcast flow creation failure net/mlx5: fix warnings on comparison sign mismatchdrivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 7 + drivers/common/mlx5/windows/mlx5_common_os.h | 104 +++ drivers/common/mlx5/windows/mlx5_glue.c | 47 ++ drivers/common/mlx5/windows/mlx5_glue.h | 2 + drivers/common/mlx5/windows/mlx5_win_defs.h | 228 +++++++ drivers/common/mlx5/windows/mlx5_win_ext.h | 8 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 +- drivers/net/mlx5/linux/mlx5_flow_os.h | 68 ++ drivers/net/mlx5/linux/mlx5_os.c | 156 +---- drivers/net/mlx5/linux/mlx5_os.h | 10 +- drivers/net/mlx5/mlx5.c | 158 ++++- drivers/net/mlx5/mlx5.h | 18 +- drivers/net/mlx5/mlx5_devx.c | 15 +- drivers/net/mlx5/mlx5_flow.c | 10 +- drivers/net/mlx5/mlx5_flow.h | 16 +- drivers/net/mlx5/mlx5_flow_age.c | 15 +- drivers/net/mlx5/mlx5_flow_dv.c | 23 +- drivers/net/mlx5/mlx5_flow_verbs.c | 6 + drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/windows/meson.build | 4 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 391 +++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 240 +++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 373 +++++++++++ drivers/net/mlx5/windows/mlx5_mp_os.c | 71 ++ drivers/net/mlx5/windows/mlx5_os.c | 968 ++++++++++++++++++++++++--- drivers/net/mlx5/windows/mlx5_os.h | 19 + drivers/net/mlx5/windows/mlx5_vlan_os.c | 83 +++ 28 files changed, 2730 insertions(+), 323 deletions(-) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_mp_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_os.h create mode 100644 drivers/net/mlx5/windows/mlx5_vlan_os.c
Quoted 2 lines
--
2.16.1.windows.4
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
PATCH 2/35 mlx5/windows: add mlx5 macros for fs name and path
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
ibdev_name and ibdev_path sizes are defined in Windows DevX differently from the sizes used in Linux with IBV_SYSFS_NAME_MAX and IBV_SYSFS_PATH_MAX.
Added MLX5_FS_NAME_MAX and MLX5_FS_NAME_PATH in mlx5_os.h for both OSs.
--- drivers/net/mlx5/linux/mlx5_os.h | 4 ++-- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/windows/mlx5_os.h | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 drivers/net/mlx5/windows/mlx5_os.h
drivers/net/mlx5/linux/mlx5_os.h +2 -2
@@ -10,8 +10,8 @@/* verb enumerations translations to local enums. */ enum { -DEV_SYSFS_NAME_MAX =IBV_SYSFS_NAME_MAX +1 , -DEV_SYSFS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 +MLX5_FS_NAME_MAX =IBV_SYSFS_NAME_MAX +1 , +MLX5_FS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 };#define PCI_DRV_FLAGS (RTE_PCI_DRV_INTR_LSC | \
drivers/net/mlx5/mlx5.h +2 -2
@@ -701,8 +701,8 @@ struct mlx5_dev_ctx_shared {void *pd;/* Protection Domain. */ uint32_t pdn;/* Protection Domain number. */ uint32_t tdn;/* Transport Domain number. */ -char ibdev_name[DEV_SYSFS_NAME_MAX ];/* SYSFS dev name. */ -char ibdev_path[DEV_SYSFS_PATH_MAX ];/* SYSFS dev path for secondary */ +char ibdev_name[MLX5_FS_NAME_MAX ];/* SYSFS dev name. */ +char ibdev_path[MLX5_FS_PATH_MAX ];/* SYSFS dev path for secondary */ struct mlx5_dev_attr device_attr;/* Device properties. */ int numa_node;/* Numa node of backing physical device. */ LIST_ENTRY (mlx5_dev_ctx_shared) mem_event_cb;
drivers/net/mlx5/windows/mlx5_os.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2020 Mellanox Technologies, Ltd +*/ + +#ifndef RTE_PMD_MLX5_OS_H_ +#define RTE_PMD_MLX5_OS_H_ + +#include "mlx5_win_ext.h" + +enum { +MLX5_FS_NAME_MAX =MLX5_DEVX_DEVICE_NAME_SIZE +1 , +MLX5_FS_PATH_MAX =MLX5_DEVX_DEVICE_PNP_SIZE +1 +}; + +#define PCI_DRV_FLAGS 0 + +#endif /* RTE_PMD_MLX5_OS_H_ */
Signature · 1 line
2.16.1.windows.4
PATCH 3/35 common/mlx5: add rte compatibility header file
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Add #include <rte_compat.h> to file mlx5_devx_cmds.h. It is required for Windows to identify the __rte_internal definition.
--- drivers/common/mlx5/mlx5_devx_cmds.h | 1 + 1 file changed, 1 insertion(+)
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -7,6 +7,7 @@#include "mlx5_glue.h" #include "mlx5_prm.h" +#include <rte_compat.h> /* * Defines the amount of retries to allocate the first UAR in the page.
Signature · 1 line
2.16.1.windows.4
PATCH 4/35 common/mlx5/windows: add DevX UAR getters
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
The following getters are added: mlx5_os_get_devx_uar_mmap_offset, mlx5_os_get_devx_uar_base_addr, mlx5_os_get_devx_uar_reg_addr, mlx5_os_get_devx_uar_page_id. This commit is the Windows equivalent of the Linux implementation in [1].
[1]
commit 8638e19a10aa ("net/mlx5: remove more DV dependencies")
--- drivers/common/mlx5/windows/mlx5_common_os.h | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/common/mlx5/windows/mlx5_common_os.h +75 -0
@@ -6,6 +6,7 @@#define RTE_PMD_MLX5_COMMON_OS_H_ #include <stdio.h> +#include <sys/types.h> #include <rte_errno.h>
@@ -15,6 +16,8 @@#include "mlx5_common_mr.h" #include "mlx5_win_ext.h" +#define MLX5_BF_OFFSET 0x800 +/** * This API allocates aligned or non-aligned memory. The free can be on either * aligned or nonaligned memory. To be protected - even though there may be no
@@ -144,6 +147,78 @@ mlx5_os_get_umem_id(void *umem)return ((struct mlx5_devx_umem *)umem)->umem_id; } +/** +* Get mmap offset. Given a pointer to an DevX UAR object of type +* 'struct mlx5dv_devx_uar *' - return its mmap offset. +* In Windows, mmap_offset is unused. +* +* @param[in] uar +* Pointer to UAR object. +* +* @return +* 0 as mmap_offset is unused +*/ +static inline off_t +mlx5_os_get_devx_uar_mmap_offset (void *uar) +{ +RTE_SET_USED (uar); +return 0 ; +} + +/** +* Get base addr pointer. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its base address. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The base address if UAR is valid, NULL otherwise. +*/ +static inline void * +mlx5_os_get_devx_uar_base_addr (void *uar) +{ +if (!uar) +return NULL ; +return ((devx_uar_handle *)uar)->uar_page; +} + +/** +* Get reg addr pointer. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its reg address. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The reg address if UAR is valid, NULL otherwise. +*/ +static inline void * +mlx5_os_get_devx_uar_reg_addr (void *uar) +{ +if (!uar) +return NULL ; +return ((char *)((devx_uar_handle *)uar)->uar_page) +MLX5_BF_OFFSET ; +} + +/** +* Get page id. Given a pointer to an UAR object of type +* 'struct mlx5dv_devx_uar *' - return its page id. +* +* @param[in] uar +* Pointer to an UAR object. +* +* @return +* The page id if UAR is valid, 0 otherwise. +*/ +static inline uint32_t +mlx5_os_get_devx_uar_page_id (void *uar) +{ +if (!uar) +return 0 ; +return ((devx_uar_handle *)uar)->uar_index; +} +void *mlx5_os_alloc_pd (void *ctx);int mlx5_os_dealloc_pd (void *pd);void *mlx5_os_umem_reg (void *ctx,void *addr,size_t size,uint32_t access);
Signature · 1 line
2.16.1.windows.4
PATCH 5/35 common/mlx5/windows: wrap event channel APIs with OS calls
In reply to Tal ShnaidermanThis commit is the Windows equivalent of the Linux implementation. Windows returns an error ENOTSUP for the APIs to create/destroy event channel or to subscribe an event.
--- drivers/common/mlx5/windows/mlx5_common_os.h | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/common/mlx5/windows/mlx5_common_os.h +29 -0
@@ -219,6 +219,35 @@ mlx5_os_get_devx_uar_page_id(void *uar)return ((devx_uar_handle *)uar)->uar_index; } +static inline void * +mlx5_os_devx_create_event_channel (void *ctx,int flags) +{ + (void )ctx; + (void )flags; + errno =ENOTSUP ; +return NULL ; +} + +static inline void +mlx5_os_devx_destroy_event_channel (void *eventc) +{ + (void )eventc; +} + +static inline int +mlx5_os_devx_subscribe_devx_event (void *eventc, +void *obj, +uint16_t events_sz,uint16_t events_num[], +uint64_t cookie) +{ + (void )eventc; + (void )obj; + (void )events_sz; + (void )events_num; + (void )cookie; +return -ENOTSUP ; +} +void *mlx5_os_alloc_pd (void *ctx);int mlx5_os_dealloc_pd (void *pd);void *mlx5_os_umem_reg (void *ctx,void *addr,size_t size,uint32_t access);
Signature · 1 line
2.16.1.windows.4
PATCH 6/35 net/mlx5/windows: add memory region callbacks
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit is the Windows part implementation of [1].
[1]
commit d5ed8aa9449d ("net/mlx5: add memory region callbacks
in per-device cache")'
--- drivers/net/mlx5/windows/mlx5_os.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +17 -0
@@ -295,6 +295,23 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* Set the reg_mr and dereg_mr call backs +* +* @param reg_mr_cb[out] +* Pointer to reg_mr func +* @param dereg_mr_cb[out] +* Pointer to dereg_mr func +* +*/ +void +mlx5_os_set_reg_mr_cb (mlx5_reg_mr_t *reg_mr_cb, +mlx5_dereg_mr_t *dereg_mr_cb) +{ + *reg_mr_cb = mlx5_os_reg_mr; + *dereg_mr_cb = mlx5_os_dereg_mr; +} +const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = {0 };const struct eth_dev_ops mlx5_os_dev_ops = {
Signature · 1 line
2.16.1.windows.4
PATCH 7/35 net/mlx5/windows: add stubs for MP requests
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Windows supports the primary process with no secondary process control. This commit adds stubs for requests to start/stop the data-path to the secondary process and for requests to start/stop a queue of the primary process.
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_mp_os.c | 71 +++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_mp_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -4,5 +4,6 @@ includes += include_directories('.') sources += files( 'mlx5_os.c', + 'mlx5_mp_os.c', )
drivers/net/mlx5/windows/mlx5_mp_os.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 8/35 net/mlx5/windows: support get mac
In reply to Tal ShnaidermanThis commits implements API mlx5_get_mac(). It returns the MAC address saved in the device context since its creation.
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 43 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -5,5 +5,6 @@ includes += include_directories('.') sources += files( 'mlx5_os.c', 'mlx5_mp_os.c', + 'mlx5_ethdev_os.c', )
drivers/net/mlx5/windows/mlx5_ethdev_os.c new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 9/35 net/mlx5/windows: add ethdev stub operations
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commits adds ethdev stubs. These APIs are called from shared code that must compile under Linux and Windows. The following stubs are added:mlx5_set_mtumlx5_os_read_dev_countersmlx5_intr_callback_unregistermlx5_os_get_stats_nmlx5_os_stats_initmlx5_set_link_downmlx5_set_link_upmlx5_dev_get_flow_ctrlmlx5_dev_set_flow_ctrlmlx5_get_module_infomlx5_get_module_eeprom
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 199 ++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +199 -0
@@ -41,3 +41,202 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])memcpy (mac, context_obj->mlx5_dev.eth_mac,RTE_ETHER_ADDR_LEN );return 0 ; } + +/** +* Set device MTU. +* +* @param dev +* Pointer to Ethernet device. +* @param mtu +* MTU value to set. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_set_mtu (struct rte_eth_dev *dev,uint16_t mtu) +{ +RTE_SET_USED (dev); +RTE_SET_USED (mtu); +return -ENOTSUP ; +} + +/* +* Unregister callback handler safely. The handler may be active +* while we are trying to unregister it, in this case code -EAGAIN +* is returned by rte_intr_callback_unregister(). This routine checks +* the return code and tries to unregister handler again. +* +* @param handle +* interrupt handle +* @param cb_fn +* pointer to callback routine +* @cb_arg +* opaque callback parameter +*/ +void +mlx5_intr_callback_unregister (const struct rte_intr_handle *handle, +rte_intr_callback_fn cb_fn,void *cb_arg) +{ +RTE_SET_USED (handle); +RTE_SET_USED (cb_fn); +RTE_SET_USED (cb_arg); +} + +/** +* DPDK callback to get flow control status. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] fc_conf +* Flow control output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_dev_get_flow_ctrl (struct rte_eth_dev *dev,struct rte_eth_fc_conf *fc_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (fc_conf); +return -ENOTSUP ; +} + +/** +* DPDK callback to modify flow control parameters. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[in] fc_conf +* Flow control parameters. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_dev_set_flow_ctrl (struct rte_eth_dev *dev,struct rte_eth_fc_conf *fc_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (fc_conf); +return -ENOTSUP ; +} + +/** +* Query the number of statistics provided by ETHTOOL. +* +* @param dev +* Pointer to Ethernet device. +* +* @return +* Number of statistics on success, negative errno value otherwise and +* rte_errno is set. +*/ +int +mlx5_os_get_stats_n (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* Init the structures to read device counters. +* +* @param dev +* Pointer to Ethernet device. +*/ +void +mlx5_os_stats_init (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +} + +/** +* Read device counters table. +* +* @param dev +* Pointer to Ethernet device. +* @param[out] stats +* Counters table output buffer. +* +* @return +* 0 on success and stats is filled, negative errno value otherwise and +* rte_errno is set. +*/ +int +mlx5_os_read_dev_counters (struct rte_eth_dev *dev,uint64_t *stats) +{ +RTE_SET_USED (dev); +RTE_SET_USED (stats); +return -ENOTSUP ; +} + +/** +* DPDK callback to bring the link DOWN. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, a negative errno value otherwise +*/ +int +mlx5_set_link_down (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* DPDK callback to bring the link UP. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 0 on success, a negative errno value otherwise +*/ +int +mlx5_set_link_up (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); +return -ENOTSUP ; +} + +/** +* DPDK callback to retrieve plug-in module EEPROM information (type and size). +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] modinfo +* Storage for plug-in module EEPROM information. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_module_info (struct rte_eth_dev *dev, +struct rte_eth_dev_module_info *modinfo) +{ +RTE_SET_USED (dev); +RTE_SET_USED (modinfo); +return -ENOTSUP ; +} + +/** +* DPDK callback to retrieve plug-in module EEPROM data. +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] info +* Storage for plug-in module EEPROM data. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int mlx5_get_module_eeprom (struct rte_eth_dev *dev, +struct rte_dev_eeprom_info *info) +{ +RTE_SET_USED (dev); +RTE_SET_USED (info); +return -ENOTSUP ; +}
Signature · 1 line
2.16.1.windows.4
PATCH 10/35 net/mlx5/windows: support link update
In reply to Tal ShnaidermanAdd support for mlx5_link_update() to get link speed and link state. Other parameters are currently hard-coded.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +44 -0
@@ -170,6 +170,50 @@ mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)return -ENOTSUP ; } +/** +* DPDK callback to retrieve physical link information. +* +* @param dev +* Pointer to Ethernet device structure. +* @param wait_to_complete +* Wait for request completion. +* +* @return +* 0 if link status was not updated, positive if it was, a negative errno +* value otherwise and rte_errno is set. +*/ +int +mlx5_link_update (struct rte_eth_dev *dev,int wait_to_complete) +{ +RTE_SET_USED (wait_to_complete); +struct mlx5_priv *priv; +mlx5_context_st *context_obj; +struct rte_eth_link dev_link; +int ret; + + ret =0 ; +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; + dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1024 *1024 ); + dev_link.link_status = + (context_obj->mlx5_dev.link_state ==1 && !mlx5_is_removed (dev)) + ?1 :0 ; + dev_link.link_duplex =1 ; +if (dev->data->dev_link.link_speed != dev_link.link_speed || + dev->data->dev_link.link_duplex != dev_link.link_duplex || + dev->data->dev_link.link_autoneg != dev_link.link_autoneg || + dev->data->dev_link.link_status != dev_link.link_status) + ret =1 ; +else + ret =0 ; + dev->data->dev_link = dev_link; +return ret; +} +/** * DPDK callback to bring the link DOWN. *
Signature · 1 line
2.16.1.windows.4
PATCH 11/35 net/mlx5/windows: support read clock
In reply to Tal ShnaidermanThis commit adds a new glue function query_rt_values to support the new API mlx5_read_clock().
--- drivers/common/mlx5/mlx5_prm.h | 1 + drivers/common/mlx5/windows/mlx5_glue.c | 26 ++++++++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 1 + drivers/common/mlx5/windows/mlx5_win_ext.h | 6 ++++++ drivers/net/mlx5/windows/mlx5_ethdev_os.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+)
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -594,6 +594,7 @@ struct mlx5_modification_cmd { }; }; +typedef uint64_t u64 ;typedef uint32_t u32 ;typedef uint16_t u16 ;typedef uint8_t u8 ;
drivers/common/mlx5/windows/mlx5_glue.c +26 -0
@@ -283,6 +283,31 @@ mlx5_glue_devx_fs_rule_del(void *flow)return devx_fs_rule_del (flow); } +static int +mlx5_glue_query_rt_values (void *ctx,void *devx_clock) +{ +struct mlx5_context *mlx5_ctx; +struct mlx5_devx_clock *clock; +int err; + +if (!ctx) { + errno =EINVAL ; +return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + clock = (struct mlx5_devx_clock *)devx_clock; + err =devx_hca_clock_query ( + mlx5_ctx->devx_ctx, + &clock->p_iseg_internal_timer, + &clock->clock_frequency_hz, + &clock->is_stable_clock_frequency); +if (err) { + errno = err; +return errno; + } +return 0 ; +} + alignas(RTE_CACHE_LINE_SIZE )const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue ){ .version =MLX5_GLUE_VERSION ,
@@ -304,4 +329,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_fs_rule_add = mlx5_glue_devx_fs_rule_add, .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del, .devx_query_eqn = mlx5_glue_devx_query_eqn, + .query_rt_values = mlx5_glue_query_rt_values, };
drivers/common/mlx5/windows/mlx5_glue.h +1 -0
@@ -51,6 +51,7 @@ struct mlx5_glue {void *(*devx_fs_rule_add)(void *ctx,void *in,uint32_t inlen);int (*devx_fs_rule_del)(void *flow);int (*devx_query_eqn)(void *context,uint32_t cpus,uint32_t *eqn); +int (*query_rt_values)(void *ctx,void *devx_clock); };extern const struct mlx5_glue *mlx5_glue;
drivers/common/mlx5/windows/mlx5_win_ext.h +6 -0
@@ -34,6 +34,12 @@ struct mlx5_pd {devx_device_ctx *devx_ctx; }; +struct mlx5_devx_clock { +void *p_iseg_internal_timer; +u64 clock_frequency_hz; +int is_stable_clock_frequency; +}; +#define GET_DEVX_CTX (ctx) (((mlx5_context_st *)ctx)->devx_ctx)#define GET_OBJ_CTX (obj) (((mlx5_devx_obj_st *)obj)->devx_ctx)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +30 -0
@@ -14,6 +14,7 @@#include <mlx5_win_ext.h> #include <mlx5_malloc.h> #include <mlx5.h> +#include <mlx5_utils.h> /** * Get MAC address by querying netdevice.
@@ -284,3 +285,32 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,RTE_SET_USED (info);return -ENOTSUP ; } + +/** +* Get device current raw clock counter +* +* @param dev +* Pointer to Ethernet device structure. +* @param[out] time +* Current raw clock counter of the device. +* +* @return +* 0 if the clock has correctly been read +* The value of errno in case of error +*/ +int +mlx5_read_clock (struct rte_eth_dev *dev,uint64_t *clock) +{ +int err; +struct mlx5_devx_clock mlx5_clock; +struct mlx5_priv *priv = dev->data->dev_private; +mlx5_context_st *context_obj = (mlx5_context_st *)priv->sh->ctx; + + err = mlx5_glue->query_rt_values (context_obj, &mlx5_clock); +if (err !=0 ) { +DRV_LOG (WARNING ,"Could not query the clock" ); +return err; + } + *clock = *(uint64_t volatile *)mlx5_clock.p_iseg_internal_timer; +return 0 ; +}
Signature · 1 line
2.16.1.windows.4
PATCH 12/35 net/mlx5/windows: support get mtu
In reply to Tal ShnaidermanThis commit implements API mlx5_get_mtu(). It returns the MTU size as saved in the device context since its creation.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +27 -0
@@ -43,6 +43,33 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])return 0 ; } +/** +* Get device MTU. +* +* @param dev +* Pointer to Ethernet device. +* @param[out] mtu +* MTU value output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_mtu (struct rte_eth_dev *dev,uint16_t *mtu) +{ +struct mlx5_priv *priv; +mlx5_context_st *context_obj; + +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; + *mtu = context_obj->mlx5_dev.mtu_bytes; +return 0 ; +} +/** * Set device MTU. *
Signature · 1 line
2.16.1.windows.4
PATCH 13/35 net/mlx5/windows: support get interface name
In reply to Tal ShnaidermanThis commit copies the interface name as saved in the device context since its creation.
--- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/net/mlx5/windows/mlx5_ethdev_os.c +28 -0
@@ -43,6 +43,34 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])return 0 ; } +/** +* Get interface name from private structure. +* +* +* @param[in] dev +* Pointer to Ethernet device. +* @param[out] ifname +* Interface name output buffer. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +{ +struct mlx5_priv *priv; +mlx5_context_st *context_obj; + +if (!dev) { + rte_errno =EINVAL ; +return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; +strncpy (*ifname, context_obj->mlx5_dev.name,IF_NAMESIZE ); +return 0 ; +} +/** * Get device MTU. *
Signature · 1 line
2.16.1.windows.4
PATCH 14/35 net/mlx5/windows: support device removed query
In reply to Tal ShnaidermanThis commit implements mlx5_is_removed() API. A new glue call 'init_shutdown_event' is added to support the new API.
--- drivers/common/mlx5/windows/mlx5_glue.c | 21 +++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 1 + drivers/common/mlx5/windows/mlx5_win_ext.h | 2 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 20 ++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-)
drivers/common/mlx5/windows/mlx5_glue.c +21 -0
@@ -308,6 +308,26 @@ mlx5_glue_query_rt_values(void *ctx, void *devx_clock)return 0 ; } +static int +mlx5_glue_devx_init_showdown_event (void *ctx) +{ +struct mlx5_context *mlx5_ctx; +int err; + +if (!ctx) { + errno =EINVAL ; +return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + err =devx_query_shutdown_event (mlx5_ctx->devx_ctx, + &mlx5_ctx->shutdown_event_obj); +if (err) { + errno = err; +return errno; + } +return 0 ; +} + alignas(RTE_CACHE_LINE_SIZE )const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue ){ .version =MLX5_GLUE_VERSION ,
@@ -330,4 +350,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del, .devx_query_eqn = mlx5_glue_devx_query_eqn, .query_rt_values = mlx5_glue_query_rt_values, + .devx_init_showdown_event = mlx5_glue_devx_init_showdown_event, };
drivers/common/mlx5/windows/mlx5_glue.h +1 -0
@@ -52,6 +52,7 @@ struct mlx5_glue {int (*devx_fs_rule_del)(void *flow);int (*devx_query_eqn)(void *context,uint32_t cpus,uint32_t *eqn);int (*query_rt_values)(void *ctx,void *devx_clock); +int (*devx_init_showdown_event)(void *ctx); };extern const struct mlx5_glue *mlx5_glue;
drivers/common/mlx5/windows/mlx5_win_ext.h +1 -1
@@ -14,7 +14,7 @@ extern "C" {typedef struct mlx5_context {devx_device_ctx *devx_ctx;struct devx_device mlx5_dev; - +struct devx_shutdown_event shutdown_event_obj; }mlx5_context_st ; typedef struct {
drivers/net/mlx5/windows/mlx5_ethdev_os.c +20 -0
@@ -369,3 +369,23 @@ mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock) *clock = *(uint64_t volatile *)mlx5_clock.p_iseg_internal_timer;return 0 ; } + +/** +* Check if mlx5 device was removed. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* 1 when device is removed, otherwise 0. +*/ +int +mlx5_is_removed (struct rte_eth_dev *dev) +{ +struct mlx5_priv *priv = dev->data->dev_private; +mlx5_context_st *context_obj = (mlx5_context_st *)priv->sh->ctx; + +if (*context_obj->shutdown_event_obj.p_flag) +return 1 ; +return 0 ; +}
Signature · 1 line
2.16.1.windows.4
PATCH 15/35 net/mlx5/windws: add VLAN stubs
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit adds stubs to VLAN VM operations. It is the Windows equivalent implementation of [1]. The Linux implementation was based on Netlink APIs which are not supported in Windows.
[1]
commit 7af10d29a4a0 ("net/mlx5/linux: refactor VLAN")
--- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_vlan_os.c | 83 +++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_vlan_os.c
drivers/net/mlx5/windows/meson.build +1 -0
@@ -6,5 +6,6 @@ sources += files( 'mlx5_os.c', 'mlx5_mp_os.c', 'mlx5_ethdev_os.c', + 'mlx5_vlan_os.c', )
drivers/net/mlx5/windows/mlx5_vlan_os.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 16/35 net/mlx5/windows: support get pdn
In reply to Tal ShnaidermanImplement OS function call to get pdn.
--- drivers/net/mlx5/windows/mlx5_os.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +21 -0
@@ -312,6 +312,27 @@ mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, *dereg_mr_cb = mlx5_os_dereg_mr; } +/** +* Extract pdn of PD object using DevX +* +* @param[in] pd +* Pointer to the DevX PD object. +* @param[out] pdn +* Pointer to the PD object number variable. +* +* @return +* 0 on success, error value otherwise. +*/ +int +mlx5_os_get_pdn (void *pd,uint32_t *pdn) +{ +if (!pd) +return -EINVAL ; + + *pdn = ((struct mlx5_pd *)pd)->pdn; +return 0 ; +} +const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = {0 };const struct eth_dev_ops mlx5_os_dev_ops = {
Signature · 1 line
2.16.1.windows.4
PATCH 17/35 net/mlx5/windows: support open device
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_os_open_device() API. It calls glue API open_device() then glue API query_device() to fill in 'struct mlx5_context' with data for later usage.
--- drivers/net/mlx5/windows/mlx5_os.c | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +44 -0
@@ -103,6 +103,50 @@ mlx5_os_set_nonblock_channel_fd(int fd)return -ENOTSUP ; } +/** +* Function API open device under Windows +* +* This function calls the Windows glue APIs to open a device. +* +* @param[in] spawn +* Pointer to the device attributes (name, port, etc). +* @param[out] config +* Pointer to device configuration structure. +* @param[out] sh +* Pointer to shared context structure. +* +* @return +* 0 on success, a positive error value otherwise. +*/ +int +mlx5_os_open_device (const struct mlx5_dev_spawn_data *spawn, +const struct mlx5_dev_config *config, +struct mlx5_dev_ctx_shared *sh) +{ +RTE_SET_USED (config); +int err =0 ; +struct mlx5_context *mlx5_ctx; + +pthread_mutex_init (&sh->txpp.mutex,NULL ); +/* Set numa node from pci probe */ + sh->numa_node = spawn->pci_dev->device.numa_node; + +/* Try to open device with DevX */ + rte_errno =0 ; + sh->ctx = mlx5_glue->open_device (spawn->phys_dev); +if (!sh->ctx) { +DRV_LOG (ERR ,"open_device failed" ); + err = errno; +return err; + } + sh->devx =1 ; + mlx5_ctx = (struct mlx5_context *)sh->ctx; + err = mlx5_glue->query_device (spawn->phys_dev, &mlx5_ctx->mlx5_dev); +if (err) +DRV_LOG (ERR ,"Failed to query device context fields." ); +return err; +} +/** * This function should share events between multiple ports of single IB * device. Currently it has no support under Windows.
Signature · 1 line
2.16.1.windows.4
PATCH 18/35 net/mlx5/windows: initial probing implementation
In reply to Tal ShnaidermanThis commit implements mlx5_os_pci_probe API under Windows. It does all required initializations then it gets the PCI device list using glue API get_device_list(). Next, all non MLX5 matched devices are filtered out. The supported NIC types are: CONNECTX4VF, CONNECTX4LXVF, CONNECTX5VF, CONNECTX5EXVF, CONNECTX5BFVF, CONNECTX6VF, MELLANOX_CONNECTX6DXVF. Each device in the list is assigned with default configuration parameters, most of them are 0. The default dv_flow_en parameter value is 1 (which means Windows match and action flows are based on DV code). Next for each PCI device call mlx5_dev_spawn() to create an eth device (struct rte_ethdev). The implementation of device spawn is in the follow up commit. Finally, the device list is free.
--- drivers/net/mlx5/windows/mlx5_os.c | 268 +++++++++++++++++++++++++++++++++++++ 1 file changed, 268 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +268 -0
@@ -9,6 +9,7 @@#include <stdlib.h> #include <rte_windows.h> +#include <rte_ethdev_pci.h> #include <mlx5_glue.h> #include <mlx5_devx_cmds.h>
@@ -26,6 +27,65 @@#include "mlx5_mr.h" #include "mlx5_flow.h" +static const char *MZ_MLX5_PMD_SHARED_DATA ="mlx5_pmd_shared_data" ; + +/* Spinlock for mlx5_shared_data allocation. */ +static rte_spinlock_t mlx5_shared_data_lock =RTE_SPINLOCK_INITIALIZER ; + +/** +* Initialize shared data between primary and secondary process. +* +* A memzone is reserved by primary process and secondary processes attach to +* the memzone. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +static int +mlx5_init_shared_data (void ) +{ +const struct rte_memzone *mz; +int ret =0 ; + +rte_spinlock_lock (&mlx5_shared_data_lock); +if (mlx5_shared_data ==NULL ) { +/* Allocate shared memory. */ + mz =rte_memzone_reserve (MZ_MLX5_PMD_SHARED_DATA , +sizeof (*mlx5_shared_data), +SOCKET_ID_ANY ,0 ); +if (mz ==NULL ) { +DRV_LOG (ERR , +"Cannot allocate mlx5 shared data" ); + ret = -rte_errno; + goto error; + } + mlx5_shared_data = mz->addr; +memset (mlx5_shared_data,0 ,sizeof (*mlx5_shared_data)); +rte_spinlock_init (&mlx5_shared_data->lock); + } +error: +rte_spinlock_unlock (&mlx5_shared_data_lock); +return ret; +} + +/** +* PMD global initialization. +* +* Independent from individual device, this function initializes global +* per-PMD data structures distinguishing primary and secondary processes. +* Hence, each initialization is called once per a process. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +static int +mlx5_init_once (void ) +{ +if (mlx5_init_shared_data ()) +return -rte_errno; +return 0 ; +} +/** * Get mlx5 device attributes. *
@@ -147,6 +207,31 @@ mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,return err; } +/** +* Spawn an Ethernet device from Verbs information. +* +* @param dpdk_dev +* Backing DPDK device. +* @param spawn +* Verbs device parameters (name, port, switch_info) to spawn. +* @param config +* Device configuration parameters. +* +* @return +* NULL pointer. Operation is not supported and rte_errno is set to ENOTSUP. +*/ +static struct rte_eth_dev * +mlx5_dev_spawn (struct rte_device *dpdk_dev, +struct mlx5_dev_spawn_data *spawn, +struct mlx5_dev_config *config) +{ + (void )dpdk_dev; + (void )spawn; + (void )config; + rte_errno = -ENOTSUP ; +return NULL ; +} +/** * This function should share events between multiple ports of single IB * device. Currently it has no support under Windows.
@@ -339,6 +424,189 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* DPDK callback to register a PCI device. +* +* This function spawns Ethernet devices out of a given PCI device. +* +* @param[in] pci_drv +* PCI driver structure (mlx5_driver). +* @param[in] pci_dev +* PCI device information. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +int +mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *pci_dev) +{ +struct devx_device_bdf *devx_bdf_devs, *orig_devx_bdf_devs; +/* +* Number of found IB Devices matching with requested PCI BDF. +* nd != 1 means there are multiple IB devices over the same +* PCI device and we have representors and master. +*/ +unsigned int nd =0 ; +/* +* Number of found IB device Ports. nd = 1 and np = 1..n means +* we have the single multiport IB device, and there may be +* representors attached to some of found ports. +* Currently not supported. +* unsigned int np = 0; +*/ + +/* +* Number of DPDK ethernet devices to Spawn - either over +* multiple IB devices or multiple ports of single IB device. +* Actually this is the number of iterations to spawn. +*/ +unsigned int ns =0 ; +/* +* Bonding device +* < 0 - no bonding device (single one) +* >= 0 - bonding device (value is slave PF index) +*/ +int bd =-1 ; +struct mlx5_dev_spawn_data *list =NULL ; +struct mlx5_dev_config dev_config; +unsigned int dev_config_vf; +int ret; +uint32_t restore; + +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) { +DRV_LOG (ERR ,"Secondary process is not supported on Windows." ); +return -ENOTSUP ; + + } + ret =mlx5_init_once (); +if (ret) { +DRV_LOG (ERR ,"unable to init PMD global data: %s" , +strerror (rte_errno)); +return -rte_errno; + } + errno =0 ; + devx_bdf_devs = mlx5_glue->get_device_list (&ret); + orig_devx_bdf_devs = devx_bdf_devs; +if (!devx_bdf_devs) { + rte_errno = errno ? errno :ENOSYS ; +DRV_LOG (ERR ,"cannot list devices, is ib_uverbs loaded?" ); +return -rte_errno; + } +/* +* First scan the list of all Infiniband devices to find +* matching ones, gathering into the list. +*/ +struct devx_device_bdf *devx_bdf_match[ret +1 ]; + +while (ret-- >0 ) { +if (pci_dev->addr.bus != devx_bdf_devs->bus_id || + pci_dev->addr.devid != devx_bdf_devs->dev_id || + pci_dev->addr.function != devx_bdf_devs->fnc_id) { + devx_bdf_devs++; +continue ; + } + + devx_bdf_match[nd++] = devx_bdf_devs; + } + devx_bdf_match[nd] =NULL ; +if (!nd) { +/* No device matches, just complain and bail out. */ +DRV_LOG (WARNING , +"no DevX device matches PCI device " PCI_PRI_FMT "," +" is DevX Configured?" , + pci_dev->addr.domain, pci_dev->addr.bus, + pci_dev->addr.devid, pci_dev->addr.function); + rte_errno =ENOENT ; + ret = -rte_errno; + goto exit; + } +/* +* Now we can determine the maximal +* amount of devices to be spawned. +*/ + list =mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_dev_spawn_data ), +RTE_CACHE_LINE_SIZE ,SOCKET_ID_ANY ); +if (!list) { +DRV_LOG (ERR ,"spawn data array allocation failure" ); + rte_errno =ENOMEM ; + ret = -rte_errno; + goto exit; + } +memset (&list[ns].info,0 ,sizeof (list[ns].info)); + list[ns].max_port =1 ; + list[ns].phys_port =1 ; + list[ns].phys_dev = devx_bdf_match[ns]; + list[ns].eth_dev =NULL ; + list[ns].pci_dev = pci_dev; + list[ns].pf_bond = bd; + list[ns].ifindex =-1 ;/* Spawn will assign */ + list[ns].info = + (struct mlx5_switch_info ){ + .master =0 , + .representor =0 , + .name_type =MLX5_PHYS_PORT_NAME_TYPE_UPLINK , + .port_name =0 , + .switch_id =0 , + }; +/* Device specific configuration. */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF : +case PCI_DEVICE_ID_MELLANOX_CONNECTX6VF : +case PCI_DEVICE_ID_MELLANOX_CONNECTXVF : + dev_config_vf =1 ; +break ; +default : + dev_config_vf =0 ; +break ; + } +/* Default configuration. */ +memset (&dev_config,0 ,sizeof (struct mlx5_dev_config )); + dev_config.vf = dev_config_vf; + dev_config.mps =0 ; + dev_config.dbnc =MLX5_ARG_UNSET ; + dev_config.rx_vec_en =1 ; + dev_config.txq_inline_max =MLX5_ARG_UNSET ; + dev_config.txq_inline_min =MLX5_ARG_UNSET ; + dev_config.txq_inline_mpw =MLX5_ARG_UNSET ; + dev_config.txqs_inline =MLX5_ARG_UNSET ; + dev_config.vf_nl_en =0 ; + dev_config.mr_ext_memseg_en =1 ; + dev_config.mprq.max_memcpy_len =MLX5_MPRQ_MEMCPY_DEFAULT_LEN ; + dev_config.mprq.min_rxqs_num =MLX5_MPRQ_MIN_RXQS ; + dev_config.dv_esw_en =0 ; + dev_config.dv_flow_en =1 ; + dev_config.decap_en =0 ; + dev_config.log_hp_size =MLX5_ARG_UNSET ; + list[ns].eth_dev =mlx5_dev_spawn (&pci_dev->device, + &list[ns], + &dev_config); +if (!list[ns].eth_dev) + goto exit; + restore = list[ns].eth_dev->data->dev_flags; +rte_eth_copy_pci_info (list[ns].eth_dev, pci_dev); +/* Restore non-PCI flags cleared by the above call. */ + list[ns].eth_dev->data->dev_flags |= restore; +rte_eth_dev_probing_finish (list[ns].eth_dev); + ret =0 ; +exit: +/* +* Do the routine cleanup: +* - free allocated spawn data array +* - free the device list +*/ +if (list) +mlx5_free (list); +MLX5_ASSERT (orig_devx_bdf_devs); + mlx5_glue->free_device_list (orig_devx_bdf_devs); +return ret; +} +/** * Set the reg_mr and dereg_mr call backs *
Signature · 1 line
2.16.1.windows.4
PATCH 19/35 net/mlx5/windws: spawn eth devices
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_dev_spawn() API which allocates an eth device (struct rte_eth_dev) for each PCI device. When working with representors virtual functions (as in Linux), one PCI device may spawn several eth devices: the master device for the main physical function (PF) and several representors for the virtual functions (VFs). However, currently Windows does not work in switch dev mode, therefore, no VFs are created and no representors are spawned. In this case one eth device is created per one PCI main port. In addition to device creation - the device configuration must be correctly set. The device arguments (devargs - set by the user) are parsed but they may be overridden by Windows limitations or hardware configurations. Some associated network parameters are stored in eth device (e.g. ifindex, MAC address, MTU) and some callback (e.g. burst functions) are set.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 6 + drivers/net/mlx5/windows/mlx5_os.c | 456 +++++++++++++++++++++++++++- 2 files changed, 457 insertions(+), 5 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +6 -0
@@ -163,4 +163,10 @@ struct mlx5_wqe_data_seg {rte_be32_t lkey; rte_be64_t addr; }; + +#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP (1 << 4) +#define IBV_DEVICE_RAW_IP_CSUM (1 << 26) +#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING (1 << 0) +#define IBV_RAW_PACKET_CAP_SCATTER_FCS (1 << 1) +#define IBV_QPT_RAW_PACKET 8#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/mlx5_os.c +451 -5
486 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 20/35 net/mlx5/windows: support VF PCI address
In reply to Tal ShnaidermanSupport VF BDF scanning by checking both the BDF and raw BDF provided by DevX. In Linux a PCI address is formatted as: domain, bus, device, function (DBDF). This is right for both a PF and a VF. In Windows a PF also has a DBDF format, but the domain is always 0, while a VF has a special "domain" called "Virtual PCI Bus, Serial" (for example: "Virtual PCI Bus Slot 2 Serial 2") or segment. The full VF format under Windows is called raw DBF. Windows special domain must be considered and DevX must be called to support it.
--- drivers/net/mlx5/windows/mlx5_os.c | 75 +++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 5 deletions(-)
drivers/net/mlx5/windows/mlx5_os.c +70 -5
@@ -870,6 +870,68 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)return -ENOTSUP ; } +/** +* Detect if a devx_device_bdf object has identical DBDF values to the +* rte_pci_addr found in bus/pci probing +* +* @param[in] devx_bdf +* Pointer to the devx_device_bdf structure. +* @param[in] addr +* Pointer to the rte_pci_addr structure. +* +* @return +* 1 on Device match, 0 on mismatch. +*/ +static int +mlx5_match_devx_bdf_to_addr (struct devx_device_bdf *devx_bdf, +struct rte_pci_addr *addr) +{ +if (addr->domain != (devx_bdf->bus_id >>8 ) || + addr->bus != (devx_bdf->bus_id &0xff ) || + addr->devid != devx_bdf->dev_id || + addr->function != devx_bdf->fnc_id) { +return 0 ; + } +return 1 ; +} + +/** +* Detect if a devx_device_bdf object matches the rte_pci_addr +* found in bus/pci probing +* Compare both the Native/PF BDF and the raw_bdf representing a VF BDF. +* +* @param[in] devx_bdf +* Pointer to the devx_device_bdf structure. +* @param[in] addr +* Pointer to the rte_pci_addr structure. +* +* @return +* 1 on Device match, 0 on mismatch, rte_errno code on failure. +*/ +static int +mlx5_match_devx_devices_to_addr (struct devx_device_bdf *devx_bdf, +struct rte_pci_addr *addr) +{ +int err; +struct devx_device mlx5_dev; + +if (mlx5_match_devx_bdf_to_addr (devx_bdf, addr)) +return 1 ; +/** +* Didn't match on Native/PF BDF, could still +* Match a VF BDF, check it next +*/ + err = mlx5_glue->query_device (devx_bdf, &mlx5_dev); +if (err) { +DRV_LOG (ERR ,"query_device failed" ); + rte_errno = err; +return rte_errno; + } +if (mlx5_match_devx_bdf_to_addr (&mlx5_dev.raw_bdf, addr)) +return 1 ; +return 0 ; +} +/** * DPDK callback to register a PCI device. *
@@ -917,7 +979,7 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct mlx5_dev_spawn_data *list =NULL ;struct mlx5_dev_config dev_config;unsigned int dev_config_vf; -int ret; +int ret, err;uint32_t restore;if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) {
@@ -946,13 +1008,16 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct devx_device_bdf *devx_bdf_match[ret +1 ];while (ret-- >0 ) { -if (pci_dev->addr.bus != devx_bdf_devs->bus_id || - pci_dev->addr.devid != devx_bdf_devs->dev_id || - pci_dev->addr.function != devx_bdf_devs->fnc_id) { + err =mlx5_match_devx_devices_to_addr (devx_bdf_devs, + &pci_dev->addr); +if (!err) { devx_bdf_devs++;continue ; } - +if (err !=1 ) { + ret = -err; + goto exit; + } devx_bdf_match[nd++] = devx_bdf_devs; } devx_bdf_match[nd] =NULL ;
Signature · 1 line
2.16.1.windows.4
PATCH 21/35 net/mlx5/linux: wrap adjust flow priority with OS calls
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
mlx5_flow_adjust_priority() is used to adjust priorities according to priorities levels. It is Verbs based and it is called from shared code (mlx5_flow_dv.c). Therefore, wrap it in an OS API.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 20 ++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +20 -0
@@ -365,4 +365,24 @@ mlx5_flow_os_destroy_flow_action(void *action) return mlx5_glue->destroy_flow_action(action); } +/** +* OS wrapper over Verbs API. +* Adjust flow priority based on the highest layer and the request priority. +* +* @param[in] dev +* Pointer to the Ethernet device structure. +* @param[in] priority +* The rule base priority. +* @param[in] subpriority +* The priority based on the items. +* +* @return +* The new priority. +*/ +static inline uint32_t +mlx5_os_flow_adjust_priority (struct rte_eth_dev *dev,int32_t priority, +uint32_t subpriority) +{ +return mlx5_flow_adjust_priority (dev, priority, subpriority); +}#endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
drivers/net/mlx5/mlx5_flow_dv.c +3 -2
@@ -10600,8 +10600,9 @@ flow_dv_translate(struct rte_eth_dev *dev,/* Register matcher. */ matcher.crc =rte_raw_cksum ((const void *)matcher.mask.buf, matcher.mask.size); - matcher.priority =mlx5_flow_adjust_priority (dev, priority, - matcher.priority); + matcher.priority =mlx5_os_flow_adjust_priority (dev, + priority, + matcher.priority);/* reserved field no needs to be set to 0 here. */ tbl_key.domain = attr->transfer; tbl_key.direction = attr->egress;
Signature · 1 line
2.16.1.windows.4
PATCH 22/35 net/mlx5/linux: add OS default miss flow action
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Wrap glue call dr_create_flow_action_default_miss() with an OS API. This commit is a follow up on [1].
[1]
commit d4d85aa6f13a ("common/mlx5: add default miss action") commit b293fbf9672b ("net/mlx5: add OS specific flow actions operations")
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 16 ++++++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 8 +++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +16 -0
@@ -350,6 +350,22 @@ mlx5_flow_os_create_flow_action_drop(void **action)return (*action) ?0 :-1 ; } +/** +* Create flow action: default miss. +* +* @param[out] action +* Pointer to a valid action on success, NULL otherwise. +* +* @return +* 0 on success, or -1 on failure and errno is set. +*/ +static inline int +mlx5_flow_os_create_flow_action_default_miss (void **action) +{ + *action = mlx5_glue->dr_create_flow_action_default_miss (); +return (*action) ?0 :-1 ; +} +/** * Destroy flow action. *
drivers/net/mlx5/mlx5_flow_dv.c +5 -3
@@ -8763,11 +8763,13 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused, "for sample"); goto error; } +int ret; + cache_resource->normal_path_tbl = tbl;if (resource->ft_type ==MLX5DV_FLOW_TABLE_TYPE_FDB ) { - cache_resource->default_miss = - mlx5_glue->dr_create_flow_action_default_miss (); -if (!cache_resource->default_miss) { + ret =mlx5_flow_os_create_flow_action_default_miss + (&cache_resource->default_miss); +if (!ret) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
Signature · 1 line
2.16.1.windows.4
PATCH 23/35 net/mlx5/linux: fix add OS dest_devx_tir action
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Wrap glue call dv_create_flow_action_dest_devx_tir() with an OS API.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 26 ++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_devx.c | 7 +++---- 2 files changed, 29 insertions(+), 4 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +26 -0
@@ -366,6 +366,32 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)return (*action) ?0 :-1 ; } +/** +* Create flow action: dest_devx_tir +* +* @param[in] tir +* Pointer to DevX tir object +* @param[out] action +* Pointer to a valid action on success, NULL otherwise. +* +* @return +* 0 on success, or -1 on failure and errno is set. +*/ +static inline int +mlx5_flow_os_create_flow_action_dest_devx_tir (struct mlx5_devx_obj *tir, +void **action) +{ +#ifdef HAVE_IBV_FLOW_DV_SUPPORT + *action = mlx5_glue->dv_create_flow_action_dest_devx_tir (tir->obj); +return (*action) ?0 :-1 ; +#else +/* If no DV support - skip the operation and return success */ +RTE_SET_USED (tir); + *action =0 ; +return 0 ; +#endif +} +/** * Destroy flow action. *
drivers/net/mlx5/mlx5_devx.c +3 -4
@@ -23,7 +23,7 @@#include "mlx5_utils.h" #include "mlx5_devx.h" #include "mlx5_flow.h" - +#include "mlx5_flow_os.h" /** * Modify RQ vlan stripping offload
@@ -942,9 +942,8 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, goto error; }#ifdef HAVE_IBV_FLOW_DV_SUPPORT - hrxq->action = mlx5_glue->dv_create_flow_action_dest_devx_tir - (hrxq->tir->obj); -if (!hrxq->action) { +if (mlx5_flow_os_create_flow_action_dest_devx_tir (hrxq->tir, + &hrxq->action)) { rte_errno = errno; goto error; }
Signature · 1 line
2.16.1.windows.4
PATCH 24/35 net/mlx5/windows: introduce flow support
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This patch adds the initial flow framework under Windows OS. It supports a subset of filters (ETH, IPV4, UDP) and a QUEUE action. It is based on DevX mechanism to send commands to the NIC through the kernel. It does not support steering rules (i.e. writing directly to the NIC memory). The Windows framework uses the existing DV framework where file mlx5_flow_dv.c remains intact.
Steps involved in flow creation:
1. Create a domain (RX, TX, FDB). Since domains are created by steering rules and not with DevX, Windows does not require a domain object (this means switch dev mode which requires an FDB domain is not supported).
2. Create a table object. Windows only supports table 0. The call to mlx5_flow_os_create_flow_tbl() silently returns successfully.
3. Create a matcher object. A matcher struct is created by calling mlx5_flow_os_create_flow_matcher(). The matcher validation and translation are part of the DV implementation. The matcher bits that were created by DV in standard PRM format are copied into the matcher struct.
4. Create an action object. The call to mlx5_flow_os_create_flow_action_dest_devx_tir() creates an action struct with the TIR type and id. This struct will be a parameter later in a call to flow creation. All other action calls (e.g. packet reformat, header modification, jump to flow table, etc) return with a non supported error.
5. Create the flow. The call to mlx5_flow_os_create_flow() receives the matcher struct, action struct, and copy them into Windows specific fs_rule struct, then it calls glue API devx_fs_rule_add().
Details on additional APIs:
* mlx5_flow_os_get_type() is called during flow type selection. In Windows it constantly returns MLX5_FLOW_TYPE_DV.
* mlx5_flow_os_item_supported() is called before starting DV items validation or translation. It filters out the OS non supported items in advance.
* mlx5_flow_os_action_supported() is called before starting DV actions validation or translation. It filters out the OS non supported actions in advance.
* mlx5_flow_adjust_priority() is an OS stub for flow priority adjustment. Windows only supports flow priority 0.
* Alarm API: mlx5_os_alarm_cancel() and mlx5_os_alarm_set() are implemented in Windows to match their Linux counterpart, see [1]. Currently they return -ENOTSUP.
[1]
("net/mlx5/linux: wrap rte alarm API with mlx5")
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 7 + drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_flow_os.c | 188 ++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.h | 363 ++++++++++++++++++++++++++++ 4 files changed, 559 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.c create mode 100644 drivers/net/mlx5/windows/mlx5_flow_os.h
drivers/common/mlx5/windows/mlx5_win_defs.h +7 -0
@@ -169,4 +169,11 @@ struct mlx5_wqe_data_seg {#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING (1 << 0)#define IBV_RAW_PACKET_CAP_SCATTER_FCS (1 << 1)#define IBV_QPT_RAW_PACKET 8 + +enum { +MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT =0x0 , +MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE =0x1 , +MLX5_FLOW_CONTEXT_DEST_TYPE_TIR =0x2 , +MLX5_FLOW_CONTEXT_DEST_TYPE_QP =0x3 , +};#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/meson.build +1 -0
@@ -7,5 +7,6 @@ sources += files( 'mlx5_mp_os.c', 'mlx5_ethdev_os.c', 'mlx5_vlan_os.c', + 'mlx5_flow_os.c', )
drivers/net/mlx5/windows/mlx5_flow_os.c new file +188 -0
188 lines not on this page · raw message
drivers/net/mlx5/windows/mlx5_flow_os.h new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 25/35 net/mlx5/windows: create flow matcher object
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements the mlx5_flow_os_create_flow_matcher() API. It is the Linux rdma-core equivalent implementation. Missing rdma-core parameters (e.g. struct mlx5dv_flow_match_parameters) are added to file mlx5_win_defs.h. The API allocates space to hold the PRM bits in PRM fte_match_param format and copy the DV translated PRM bits into the matcher struct. This matcher struct will be used later by the flow creation API.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 57 +++++++++++++++++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 32 ++++++++++++---- drivers/net/mlx5/windows/mlx5_flow_os.h | 1 + 3 files changed, 83 insertions(+), 7 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +57 -0
@@ -132,6 +132,63 @@ enum {#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL 0x3#endif +enum ibv_flow_flags { +IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK =1 <<0 , +IBV_FLOW_ATTR_FLAGS_DONT_TRAP =1 <<1 , +IBV_FLOW_ATTR_FLAGS_EGRESS =1 <<2 , +}; + +enum ibv_flow_attr_type { +/* Steering according to rule specifications. */ +IBV_FLOW_ATTR_NORMAL =0x0 , +/* +* Default unicast and multicast rule - +* receive all Eth traffic which isn't steered to any QP. +*/ +IBV_FLOW_ATTR_ALL_DEFAULT =0x1 , +/* +* Default multicast rule - +* receive all Eth multicast traffic which isn't steered to any QP. +*/ +IBV_FLOW_ATTR_MC_DEFAULT =0x2 , +/* Sniffer rule - receive all port traffic. */ +IBV_FLOW_ATTR_SNIFFER =0x3 , +}; + +enum mlx5dv_flow_table_type { +MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX =0x0 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX =0x1 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB =0x2 , +MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX =0x3 , +}; + +#define MLX5DV_FLOW_TABLE_TYPE_NIC_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX +#define MLX5DV_FLOW_TABLE_TYPE_NIC_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX +#define MLX5DV_FLOW_TABLE_TYPE_FDB MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB +#define MLX5DV_FLOW_TABLE_TYPE_RDMA_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX + +struct mlx5dv_flow_match_parameters { +size_t match_sz; +uint64_t match_buf[];/* Device spec format */ +}; + +struct mlx5dv_flow_matcher_attr { +enum ibv_flow_attr_type type; +uint32_t flags;/* From enum ibv_flow_flags. */ +uint16_t priority; +uint8_t match_criteria_enable;/* Device spec format. */ +struct mlx5dv_flow_match_parameters *match_mask; +uint64_t comp_mask;/* Use mlx5dv_flow_matcher_attr_mask. */ +enum mlx5dv_flow_table_type ft_type; +}; + +/* Windows specific mlx5_matcher. */ +struct mlx5_matcher { +void *ctx; +struct mlx5dv_flow_matcher_attr attr; +uint64_t match_buf[]; +}; +struct mlx5_err_cqe {uint8_t rsvd0[32 ];uint32_t srqn;
drivers/net/mlx5/windows/mlx5_flow_os.c +25 -7
@@ -76,12 +76,31 @@ mlx5_flow_os_create_flow_matcher(void *ctx,void *table, void **matcher) { -RTE_SET_USED (ctx ); -RTE_SET_USED (attr); + struct mlx5dv_flow_matcher_attr *mattr; +RTE_SET_USED (table); *matcher =NULL ; - rte_errno =ENOTSUP ; -return -rte_errno; + mattr = attr; +if (mattr->type !=IBV_FLOW_ATTR_NORMAL ) { + rte_errno =ENOTSUP ; +return -rte_errno; + } +struct mlx5_matcher *mlx5_matcher = +mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_matcher ) + +MLX5_ST_SZ_BYTES (fte_match_param), +0 ,SOCKET_ID_ANY ); +if (!mlx5_matcher) { + rte_errno =ENOMEM ; +return -rte_errno; + } + mlx5_matcher->ctx = ctx; +memcpy (&mlx5_matcher->attr, attr,sizeof (mlx5_matcher->attr)); +memcpy (&mlx5_matcher->match_buf, + mattr->match_mask->match_buf, +MLX5_ST_SZ_BYTES (fte_match_param)); + *matcher = mlx5_matcher; +return 0 ; }/**
@@ -96,9 +115,8 @@ mlx5_flow_os_create_flow_matcher(void *ctx,int mlx5_flow_os_destroy_flow_matcher (void *matcher) { -RTE_SET_USED (matcher); - rte_errno =ENOTSUP ; -return -rte_errno; +mlx5_free (matcher); +return 0 ; }/**
drivers/net/mlx5/windows/mlx5_flow_os.h +1 -0
@@ -6,6 +6,7 @@#define RTE_PMD_MLX5_FLOW_OS_H_ #include "mlx5_flow.h" +#include "mlx5_malloc.h" #if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )extern const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops;
Signature · 1 line
2.16.1.windows.4
PATCH 26/35 net/mlx5/windows: create flow action dest TIR object
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_flow_os_create_flow_action_dest_devx_tir() API as the Linux rdma-core equivalent. Missing rdma-core parameters are added to file mlx5_win_defs.h. The action TIR id and type (MLX5_FLOW_CONTEXT_DEST_TYPE_TIR) are saved in the action struct. The action struct will be added to array of actions and will be used later by the flow creation API.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 17 +++++++++++++++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 22 +++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-)
drivers/common/mlx5/windows/mlx5_win_defs.h +17 -0
@@ -189,6 +189,17 @@ struct mlx5_matcher {uint64_t match_buf[]; }; +/* +* Windows mlx5_action. This struct is the +* equivalent of rdma-core struct mlx5dv_dr_action. +*/ +struct mlx5_action { +int type; +struct { +uint32_t id; + } dest_tir; +}; +struct mlx5_err_cqe {uint8_t rsvd0[32 ];uint32_t srqn;
@@ -233,4 +244,10 @@ enum {MLX5_FLOW_CONTEXT_DEST_TYPE_TIR =0x2 , MLX5_FLOW_CONTEXT_DEST_TYPE_QP = 0x3, }; + +enum { +MLX5_MATCH_OUTER_HEADERS =1 <<0 , +MLX5_MATCH_MISC_PARAMETERS =1 <<1 , +MLX5_MATCH_INNER_HEADERS =1 <<2 , +};#endif /* __MLX5_WIN_DEFS_H__ */
drivers/net/mlx5/windows/mlx5_flow_os.c +15 -7
@@ -134,10 +134,19 @@ int mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir, void **action) { -RTE_SET_USED (tir); - *action =NULL ; - rte_errno =ENOTSUP ; -return -rte_errno; + struct mlx5_action *mlx5_action = +mlx5_malloc (MLX5_MEM_ZERO , +sizeof (struct mlx5_action ), +0 ,SOCKET_ID_ANY ); + +if (!mlx5_action) { + rte_errno =ENOMEM ; +return -rte_errno; + } + mlx5_action->type =MLX5_FLOW_CONTEXT_DEST_TYPE_TIR ; + mlx5_action->dest_tir.id = tir->id; + *action = mlx5_action; +return 0 ; }/**
@@ -152,9 +161,8 @@ mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir,int mlx5_flow_os_destroy_flow_action (void *action) { -RTE_SET_USED (action); - rte_errno =ENOTSUP ; -return -rte_errno; +mlx5_free (action); +return 0 ; }/**
Signature · 1 line
2.16.1.windows.4
PATCH 27/35 net/mlx5/windows: create flow rule
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
This commit implements mlx5_flow_os_create_flow() API. It is equivalent to Linux rdma-core implementation. The API receives the matcher mask, matcher value and an array of actions. They are copied into a PRM-like struct devx_fs_rule_add_in. Then glue API devx_fs_rule_add() is called.
--- drivers/common/mlx5/mlx5_prm.h | 6 +++++ drivers/net/mlx5/windows/mlx5_flow_os.c | 46 ++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-)
drivers/common/mlx5/mlx5_prm.h +6 -0
@@ -825,6 +825,12 @@ struct mlx5_ifc_fte_match_param_bits {#endif }; +struct mlx5_ifc_dest_format_struct_bits { +u8 destination_type[0x8 ]; +u8 destination_id[0x18 ]; +u8 reserved_0[0x20 ]; +}; +enum {MLX5_MATCH_CRITERIA_ENABLE_OUTER_BIT ,MLX5_MATCH_CRITERIA_ENABLE_MISC_BIT ,
drivers/net/mlx5/windows/mlx5_flow_os.c +36 -10
56 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 28/35 net/mlx5: use HAVE_INFINIBAND_VERBS_H in shared code
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
Use macro HAVE_INFINIBAND_VERBS_H to successfully compile files both under Linux and Windows (or any non Linux in general). Under Windows this macro:
1. Hides Verbs references.
2. Exposes required DV structs that are under ifdefs related to rdma core.
Linux code under definitions such as #ifdef HAVE_IBV_FLOW_DV_SUPPORT is required unconditionally under Windows however those definitions are never effective without rdma-core presence. Therefore update the #ifdef condition to consider HAVE_INFINIBAND_VERBS_H as well (undefined macro when running without an rdma-core library).
For example:
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
--- drivers/net/mlx5/mlx5.c | 4 ++-- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_devx.c | 8 ++++---- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow.h | 16 +++++++--------- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/mlx5_flow_verbs.c | 6 ++++++ 7 files changed, 23 insertions(+), 19 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
@@ -187,7 +187,7 @@ static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =static pthread_mutex_t mlx5_dev_ctx_list_mutex =PTHREAD_MUTEX_INITIALIZER ;static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_IPOOL_DECAP_ENCAP] = { .size =sizeof (struct mlx5_flow_dv_encap_decap_resource ), .trunk_size =64 ,
@@ -1148,7 +1148,7 @@ mlx5_alloc_table_hash_list(struct mlx5_priv *priv __rte_unused) {int err =0 ;/* Tables are only used in DV and DR modes. */ -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_dev_ctx_shared *sh = priv->sh;char s[MLX5_HLIST_NAMESIZE ];
drivers/net/mlx5/mlx5.h +2 -2
@@ -36,7 +36,7 @@#define MLX5_SH (dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh)enum mlx5_ipool_index { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )MLX5_IPOOL_DECAP_ENCAP =0 ,/* Pool for encap/decap resource. */ MLX5_IPOOL_PUSH_VLAN ,/* Pool for push vlan resource. */ MLX5_IPOOL_TAG ,/* Pool for tag resource. */
@@ -833,7 +833,7 @@ struct mlx5_hrxq {void *qp;/* Verbs queue pair. */ struct mlx5_devx_obj *tir;/* DevX TIR object. */ }; -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )void *action;/* DV QP action pointer. */ #endif uint64_t hash_fields;/* Verbs Hash fields. */
drivers/net/mlx5/mlx5_devx.c +4 -4
@@ -941,7 +941,7 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, rte_errno = errno; goto error; } -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )if (mlx5_flow_os_create_flow_action_dest_devx_tir (hrxq->tir, &hrxq->action)) { rte_errno = errno;
@@ -1111,7 +1111,7 @@ mlx5_txq_obj_hairpin_new(struct rte_eth_dev *dev, uint16_t idx)return 0 ; } -#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) || !defined(HAVE_INFINIBAND_VERBS_H )/** * Release DevX SQ resources. *
@@ -1421,7 +1421,7 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx)if (txq_ctrl->type ==MLX5_TXQ_TYPE_HAIRPIN )return mlx5_txq_obj_hairpin_new (dev, idx); -#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if !defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) && defined(HAVE_INFINIBAND_VERBS_H )DRV_LOG (ERR ,"Port %u Tx queue %u cannot create with DevX, no UAR." , dev->data->port_id, idx); rte_errno =ENOMEM ;
@@ -1522,7 +1522,7 @@ mlx5_txq_devx_obj_release(struct mlx5_txq_obj *txq_obj)if (txq_obj->txq_ctrl->type ==MLX5_TXQ_TYPE_HAIRPIN ) {if (txq_obj->tis)claim_zero (mlx5_devx_cmd_destroy (txq_obj->tis)); -#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET +#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET ) || !defined(HAVE_INFINIBAND_VERBS_H ) } else {mlx5_txq_release_devx_resources (txq_obj);#endif
drivers/net/mlx5/mlx5_flow.c +1 -1
@@ -73,7 +73,7 @@ const struct mlx5_flow_driver_ops mlx5_flow_null_drv_ops;const struct mlx5_flow_driver_ops *flow_drv_ops[] = { [MLX5_FLOW_TYPE_MIN ] = &mlx5_flow_null_drv_ops, -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_FLOW_TYPE_DV ] = &mlx5_flow_dv_drv_ops, #endif [MLX5_FLOW_TYPE_VERBS ] = &mlx5_flow_verbs_drv_ops,
drivers/net/mlx5/mlx5_flow.h +7 -9
@@ -600,12 +600,6 @@ struct mlx5_flow_dv_dest_array_resource {/**< Action resources. */ }; -/* Verbs specification header. */ -struct ibv_spec_header { -enum ibv_flow_spec_type type; -uint16_t size; -}; -/* PMD flow priority for tunnel */ #define MLX5_TUNNEL_PRIO_GET (rss_desc) \ ((rss_desc)->level >= 2 ? MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4)
@@ -652,7 +646,7 @@ struct mlx5_flow_handle {uint32_t rix_srss;/**< Indicates shared RSS fate action. */ }; -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_flow_handle_dv dvh;#endif } __rte_packed;
@@ -662,7 +656,7 @@ struct mlx5_flow_handle {* structure in Verbs. No DV flows attributes will be accessed. * Macro offsetof() could also be used here. */ -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )#define MLX5_FLOW_HANDLE_VERBS_SIZE \ (sizeof(struct mlx5_flow_handle) - sizeof(struct mlx5_flow_handle_dv))#else
@@ -700,6 +694,7 @@ struct mlx5_flow_dv_workspace {/**< Pointer to the destination array resource. */ }; +#ifdef HAVE_INFINIBAND_VERBS_H /* * Maximal Verbs flow specifications & actions size. * Some elements are mutually exclusive, but enough space should be allocated.
@@ -756,6 +751,7 @@ struct mlx5_flow_verbs_workspace {uint8_t specs[MLX5_VERBS_MAX_SPEC_ACT_SIZE ]; /**< Specifications & actions buffer of verbs flow. */ }; +#endif /* HAVE_INFINIBAND_VERBS_H */ /** Maximal number of device sub-flows supported. */ #define MLX5_NUM_MAX_DEV_FLOWS 32
@@ -773,10 +769,12 @@ struct mlx5_flow { uint8_t skip_scale:1;/**< 1 if skip the scale the table with factor. */ union { -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )struct mlx5_flow_dv_workspace dv;#endif +#ifdef HAVE_INFINIBAND_VERBS_H struct mlx5_flow_verbs_workspace verbs; +#endif };struct mlx5_flow_handle *handle;uint32_t handle_idx;/* Index of the mlx5 flow handle memory. */
drivers/net/mlx5/mlx5_flow_dv.c +1 -1
@@ -35,7 +35,7 @@#include "mlx5_rxtx.h" #include "rte_pmd_mlx5.h" -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT ) || !defined(HAVE_INFINIBAND_VERBS_H )#ifndef HAVE_IBV_FLOW_DEVX_COUNTERS #define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0
drivers/net/mlx5/mlx5_flow_verbs.c +6 -0
@@ -39,6 +39,12 @@ static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX] = { { 9, 10, 11 }, { 12, 13, 14 }, }; +/* Verbs specification header. */ +struct ibv_spec_header { +enum ibv_flow_spec_type type; +uint16_t size; +}; +/** * Discover the maximum number of priority available. *
Signature · 1 line
2.16.1.windows.4
PATCH 29/35 net/mlx5: fix separating eth_dev_ops per OS
In reply to Tal ShnaidermanFrom: Ophir Munk <[email protected]>
There are three types of eth_dev_ops: primary, secondary and isolate represented in three callback tables per OS. In this commit the OS specific eth dev tables are unified into shared tables in file mlx5.c. Starting from this commit all operating systems must implement the same eth dev APIs. In case an OS does not support an API - it can return in its implementation an error ENOTSUP.
--- drivers/net/mlx5/linux/mlx5_os.c | 154 +------------------------------------ drivers/net/mlx5/mlx5.c | 150 ++++++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_flow.c | 4 +- drivers/net/mlx5/windows/mlx5_os.c | 110 +------------------------- 5 files changed, 158 insertions(+), 266 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +2 -152
@@ -757,7 +757,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, rte_eth_devices[priv->sh->bond_dev].device; else eth_dev->device = dpdk_dev; - eth_dev->dev_ops = &mlx5_os_dev_sec_ops; + eth_dev->dev_ops = &mlx5_dev_sec_ops; eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status; eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status; err =mlx5_proc_priv_init (eth_dev);
@@ -1432,7 +1432,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,/* Initialize burst functions to prevent crashes before link-up. */ eth_dev->rx_pkt_burst = removed_rx_burst; eth_dev->tx_pkt_burst = removed_tx_burst; - eth_dev->dev_ops = &mlx5_os_dev_ops; + eth_dev->dev_ops = &mlx5_dev_ops; eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status; eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status; eth_dev->rx_queue_count = mlx5_rx_queue_count;
@@ -2611,153 +2611,3 @@ mlx5_os_mac_addr_flush(struct rte_eth_dev *dev) dev->data->mac_addrs, MLX5_MAX_MAC_ADDRESSES, priv->mac_own); } - -const struct eth_dev_ops mlx5_os_dev_ops = { - .dev_configure = mlx5_dev_configure, - .dev_start = mlx5_dev_start, - .dev_stop = mlx5_dev_stop, - .dev_set_link_down = mlx5_set_link_down, - .dev_set_link_up = mlx5_set_link_up, - .dev_close = mlx5_dev_close, - .promiscuous_enable = mlx5_promiscuous_enable, - .promiscuous_disable = mlx5_promiscuous_disable, - .allmulticast_enable = mlx5_allmulticast_enable, - .allmulticast_disable = mlx5_allmulticast_disable, - .link_update = mlx5_link_update, - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get, - .vlan_filter_set = mlx5_vlan_filter_set, - .rx_queue_setup = mlx5_rx_queue_setup, - .rx_hairpin_queue_setup = mlx5_rx_hairpin_queue_setup, - .tx_queue_setup = mlx5_tx_queue_setup, - .tx_hairpin_queue_setup = mlx5_tx_hairpin_queue_setup, - .rx_queue_release = mlx5_rx_queue_release, - .tx_queue_release = mlx5_tx_queue_release, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .flow_ctrl_get = mlx5_dev_get_flow_ctrl, - .flow_ctrl_set = mlx5_dev_set_flow_ctrl, - .mac_addr_remove = mlx5_mac_addr_remove, - .mac_addr_add = mlx5_mac_addr_add, - .mac_addr_set = mlx5_mac_addr_set, - .set_mc_addr_list = mlx5_set_mc_addr_list, - .mtu_set = mlx5_dev_set_mtu, - .vlan_strip_queue_set = mlx5_vlan_strip_queue_set, - .vlan_offload_set = mlx5_vlan_offload_set, - .reta_update = mlx5_dev_rss_reta_update, - .reta_query = mlx5_dev_rss_reta_query, - .rss_hash_update = mlx5_rss_hash_update, - .rss_hash_conf_get = mlx5_rss_hash_conf_get, - .filter_ctrl = mlx5_dev_filter_ctrl, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .rx_queue_intr_enable = mlx5_rx_intr_enable, - .rx_queue_intr_disable = mlx5_rx_intr_disable, - .is_removed = mlx5_is_removed, - .udp_tunnel_port_add = mlx5_udp_tunnel_port_add, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, - .hairpin_cap_get = mlx5_hairpin_cap_get, - .mtr_ops_get = mlx5_flow_meter_ops_get, - .hairpin_bind = mlx5_hairpin_bind, - .hairpin_unbind = mlx5_hairpin_unbind, - .hairpin_get_peer_ports = mlx5_hairpin_get_peer_ports, - .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, - .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, - .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, -}; - -/* Available operations from secondary process. */ -const struct eth_dev_ops mlx5_os_dev_sec_ops = { - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, -}; - -/* Available operations in flow isolated mode. */ -const struct eth_dev_ops mlx5_os_dev_ops_isolate = { - .dev_configure = mlx5_dev_configure, - .dev_start = mlx5_dev_start, - .dev_stop = mlx5_dev_stop, - .dev_set_link_down = mlx5_set_link_down, - .dev_set_link_up = mlx5_set_link_up, - .dev_close = mlx5_dev_close, - .promiscuous_enable = mlx5_promiscuous_enable, - .promiscuous_disable = mlx5_promiscuous_disable, - .allmulticast_enable = mlx5_allmulticast_enable, - .allmulticast_disable = mlx5_allmulticast_disable, - .link_update = mlx5_link_update, - .stats_get = mlx5_stats_get, - .stats_reset = mlx5_stats_reset, - .xstats_get = mlx5_xstats_get, - .xstats_reset = mlx5_xstats_reset, - .xstats_get_names = mlx5_xstats_get_names, - .fw_version_get = mlx5_fw_version_get, - .dev_infos_get = mlx5_dev_infos_get, - .read_clock = mlx5_txpp_read_clock, - .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get, - .vlan_filter_set = mlx5_vlan_filter_set, - .rx_queue_setup = mlx5_rx_queue_setup, - .rx_hairpin_queue_setup = mlx5_rx_hairpin_queue_setup, - .tx_queue_setup = mlx5_tx_queue_setup, - .tx_hairpin_queue_setup = mlx5_tx_hairpin_queue_setup, - .rx_queue_release = mlx5_rx_queue_release, - .tx_queue_release = mlx5_tx_queue_release, - .rx_queue_start = mlx5_rx_queue_start, - .rx_queue_stop = mlx5_rx_queue_stop, - .tx_queue_start = mlx5_tx_queue_start, - .tx_queue_stop = mlx5_tx_queue_stop, - .flow_ctrl_get = mlx5_dev_get_flow_ctrl, - .flow_ctrl_set = mlx5_dev_set_flow_ctrl, - .mac_addr_remove = mlx5_mac_addr_remove, - .mac_addr_add = mlx5_mac_addr_add, - .mac_addr_set = mlx5_mac_addr_set, - .set_mc_addr_list = mlx5_set_mc_addr_list, - .mtu_set = mlx5_dev_set_mtu, - .vlan_strip_queue_set = mlx5_vlan_strip_queue_set, - .vlan_offload_set = mlx5_vlan_offload_set, - .filter_ctrl = mlx5_dev_filter_ctrl, - .rxq_info_get = mlx5_rxq_info_get, - .txq_info_get = mlx5_txq_info_get, - .rx_burst_mode_get = mlx5_rx_burst_mode_get, - .tx_burst_mode_get = mlx5_tx_burst_mode_get, - .rx_queue_intr_enable = mlx5_rx_intr_enable, - .rx_queue_intr_disable = mlx5_rx_intr_disable, - .is_removed = mlx5_is_removed, - .get_module_info = mlx5_get_module_info, - .get_module_eeprom = mlx5_get_module_eeprom, - .hairpin_cap_get = mlx5_hairpin_cap_get, - .mtr_ops_get = mlx5_flow_meter_ops_get, - .hairpin_bind = mlx5_hairpin_bind, - .hairpin_unbind = mlx5_hairpin_unbind, - .hairpin_get_peer_ports = mlx5_hairpin_get_peer_ports, - .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, - .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, - .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, -};
drivers/net/mlx5/mlx5.c +150 -0
156 lines not on this page · raw message
drivers/net/mlx5/mlx5.h +3 -3
@@ -140,9 +140,9 @@ struct mlx5_local_data {extern struct mlx5_shared_data *mlx5_shared_data;/* Dev ops structs */ -extern const struct eth_dev_ops mlx5_os_dev_ops; -extern const struct eth_dev_ops mlx5_os_dev_sec_ops; -extern const struct eth_dev_ops mlx5_os_dev_ops_isolate; +extern const struct eth_dev_ops mlx5_dev_ops; +extern const struct eth_dev_ops mlx5_dev_sec_ops; +extern const struct eth_dev_ops mlx5_dev_ops_isolate;struct mlx5_counter_ctrl {/* Name of the counter. */
drivers/net/mlx5/mlx5_flow.c +2 -2
@@ -6135,9 +6135,9 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, } priv->isolated = !!enable;if (enable) - dev->dev_ops = &mlx5_os_dev_ops_isolate; + dev->dev_ops = &mlx5_dev_ops_isolate;else - dev->dev_ops = &mlx5_os_dev_ops; + dev->dev_ops = &mlx5_dev_ops; dev->rx_descriptor_status = mlx5_rx_descriptor_status; dev->tx_descriptor_status = mlx5_tx_descriptor_status;
drivers/net/mlx5/windows/mlx5_os.c +1 -109
119 lines not on this page · raw message
Signature · 1 line
2.16.1.windows.4
PATCH 30/35 net/mlx5: define MLX5_NAMESIZE for device interface size
In reply to Tal ShnaidermanWindows Devx interface name is the same as device name with different size then IF_NAMESIZE. to support it MLX5_NAMESIZE is defined with IF_NAMESIZE value for Linux and MLX5_FS_NAME_MAX value for Windows.
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 ++-- drivers/net/mlx5/linux/mlx5_os.c | 2 +- drivers/net/mlx5/linux/mlx5_os.h | 6 ++---- drivers/net/mlx5/mlx5.h | 3 ++- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 4 ++-- drivers/net/mlx5/windows/mlx5_os.c | 2 +- drivers/net/mlx5/windows/mlx5_os.h | 2 ++ 7 files changed, 12 insertions(+), 11 deletions(-)
drivers/net/mlx5/linux/mlx5_ethdev_os.c +2 -2
@@ -143,7 +143,7 @@ struct ethtool_link_settings {* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[MLX5_NAMESIZE ]) {struct mlx5_priv *priv = dev->data->dev_private;unsigned int ifindex;
@@ -151,7 +151,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])MLX5_ASSERT (priv);MLX5_ASSERT (priv->sh);if (priv->bond_ifindex >0 ) { -memcpy (ifname, priv->bond_name,IF_NAMESIZE ); +memcpy (ifname, priv->bond_name,MLX5_NAMESIZE );return 0 ; } ifindex =mlx5_ifindex (dev);
drivers/net/mlx5/linux/mlx5_os.c +1 -1
@@ -1411,7 +1411,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mac.addr_bytes[4], mac.addr_bytes[5]);#ifdef RTE_LIBRTE_MLX5_DEBUG { -char ifname[IF_NAMESIZE ]; +char ifname[MLX5_NAMESIZE ];if (mlx5_get_ifname (eth_dev, &ifname) ==0 ) DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
drivers/net/mlx5/linux/mlx5_os.h +2 -4
@@ -14,11 +14,9 @@ enum {MLX5_FS_PATH_MAX =IBV_SYSFS_PATH_MAX +1 }; +#define MLX5_NAMESIZE IF_NAMESIZE +#define PCI_DRV_FLAGS (RTE_PCI_DRV_INTR_LSC | \ RTE_PCI_DRV_INTR_RMV | \ RTE_PCI_DRV_PROBE_AGAIN) - -/* mlx5_ethdev_os.c */ - -int mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]);#endif /* RTE_PMD_MLX5_OS_H_ */
drivers/net/mlx5/mlx5.h +2 -1
@@ -950,7 +950,7 @@ struct mlx5_priv {int32_t pf_bond;/* >=0 means PF index in bonding configuration. */ unsigned int if_index;/* Associated kernel network device index. */ uint32_t bond_ifindex;/**< Bond interface index. */ -char bond_name[IF_NAMESIZE ];/**< Bond interface name. */ +char bond_name[MLX5_NAMESIZE ];/**< Bond interface name. */ /* RX/TX queues. */ unsigned int rxqs_n;/* RX queues array size. */ unsigned int txqs_n;/* TX queues array size. */
@@ -1067,6 +1067,7 @@ int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);/* mlx5_ethdev_os.c */ +int mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[MLX5_NAMESIZE ]);unsigned int mlx5_ifindex (const struct rte_eth_dev *dev);int mlx5_get_mac (struct rte_eth_dev *dev,uint8_t (*mac)[RTE_ETHER_ADDR_LEN ]);int mlx5_get_mtu (struct rte_eth_dev *dev,uint16_t *mtu);
drivers/net/mlx5/windows/mlx5_ethdev_os.c +2 -2
@@ -56,7 +56,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]) +mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[MLX5_NAMESIZE ]) {struct mlx5_priv *priv;mlx5_context_st *context_obj;
@@ -67,7 +67,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]) } priv = dev->data->dev_private; context_obj = (mlx5_context_st *)priv->sh->ctx; -strncpy (*ifname, context_obj->mlx5_dev.name,IF_NAMESIZE ); +strncpy (*ifname, context_obj->mlx5_dev.name,MLX5_NAMESIZE );return 0 ; }
drivers/net/mlx5/windows/mlx5_os.c +1 -1
@@ -550,7 +550,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mac.addr_bytes[4], mac.addr_bytes[5]);#ifdef RTE_LIBRTE_MLX5_DEBUG { -char ifname[IF_NAMESIZE ]; +char ifname[MLX5_NAMESIZE ];if (mlx5_get_ifname (eth_dev, &ifname) ==0 ) DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
drivers/net/mlx5/windows/mlx5_os.h +2 -0
@@ -14,4 +14,6 @@ enum {#define PCI_DRV_FLAGS 0 +#define MLX5_NAMESIZE MLX5_FS_NAME_MAX +#endif /* RTE_PMD_MLX5_OS_H_ */
Signature · 1 line
2.16.1.windows.4
PATCH 31/35 net/mlx5: use OS independent code in ASO feature
In reply to Tal ShnaidermanModify the ASO feature to use OS independent code
not to break Windows build.
--- drivers/net/mlx5/mlx5_flow_age.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow_age.c +8 -7
@@ -4,6 +4,7 @@#include <mlx5_prm.h> #include <rte_malloc.h> #include <rte_cycles.h> +#include <rte_eal_paging.h> #include <mlx5_malloc.h> #include <mlx5_common_os.h>
@@ -53,7 +54,7 @@ mlx5_aso_cq_create(void *ctx, struct mlx5_aso_cq *cq, uint16_t log_desc_n, int socket, int uar_page_id, uint32_t eqn) { struct mlx5_devx_cq_attr attr = { 0 }; -size_t pgsize =sysconf (_SC_PAGESIZE); +size_t pgsize =rte_mem_page_size ();uint32_t umem_size;uint16_t cq_size =1 << log_desc_n;
@@ -66,7 +67,7 @@ mlx5_aso_cq_create(void *ctx, struct mlx5_aso_cq *cq, uint16_t log_desc_n, rte_errno =ENOMEM ;return -ENOMEM ; } - cq->umem_obj = mlx5_glue->devx_umem_reg (ctx, + cq->umem_obj =mlx5_os_umem_reg (ctx, (void *)(uintptr_t )cq->umem_buf, umem_size,IBV_ACCESS_LOCAL_WRITE );
@@ -143,7 +144,7 @@ mlx5_aso_devx_reg_mr(void *ctx, size_t length, struct mlx5_aso_devx_mr *mr,DRV_LOG (ERR ,"Failed to create ASO bits mem for MR by Devx." );return -1 ; } - mr->umem = mlx5_glue->devx_umem_reg (ctx, mr->buf, length, + mr->umem =mlx5_os_umem_reg (ctx, mr->buf, length,IBV_ACCESS_LOCAL_WRITE );if (!mr->umem) {DRV_LOG (ERR ,"Failed to register Umem for MR by Devx." );
@@ -256,12 +257,12 @@ mlx5_aso_init_sq(struct mlx5_aso_sq *sq)*/ static int mlx5_aso_sq_create (void *ctx,struct mlx5_aso_sq *sq,int socket, -struct mlx5dv_devx_uar *uar,uint32_t pdn, +void *uar,uint32_t pdn,uint32_t eqn,uint16_t log_desc_n) {struct mlx5_devx_create_sq_attr attr = {0 };struct mlx5_devx_modify_sq_attr modify_attr = {0 }; -size_t pgsize =sysconf (_SC_PAGESIZE); +size_t pgsize =rte_mem_page_size ();struct mlx5_devx_wq_attr *wq_attr = &attr.wq_attr;uint32_t sq_desc_n =1 << log_desc_n;uint32_t wq_size =sizeof (struct mlx5_aso_wqe ) * sq_desc_n;
@@ -280,7 +281,7 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,DRV_LOG (ERR ,"Can't allocate wqe buffer." );return -ENOMEM ; } - sq->wqe_umem = mlx5_glue->devx_umem_reg(ctx, + sq->wqe_umem = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)sq->umem_buf, wq_size + sizeof(*sq->db_rec) * 2,
@@ -325,7 +326,7 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket, sq->tail =0 ; sq->sqn = sq->sq->id; sq->db_rec =RTE_PTR_ADD (sq->umem_buf, (uintptr_t )(wq_attr->dbr_addr)); - sq->uar_addr = (volatile uint64_t *)((uint8_t *)uar->base_addr +0x800 ); + sq->uar_addr =mlx5_os_get_devx_uar_reg_addr (uar);mlx5_aso_init_sq (sq);return 0 ; error:
Signature · 1 line
2.16.1.windows.4
PATCH 32/35 mlx5: use init function for ctx list mutex
In reply to Tal ShnaidermanThe mutex mlx5_dev_ctx_list_mutex was initialized with PTHREAD_MUTEX_INITIALIZER global macro however this macro is not supported on Windows OS shim implementation of pthreads in DPDK.
Moved the init of this mutex to RTE_INIT to support this mutex on both OSs.
--- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
@@ -184,8 +184,7 @@ int mlx5_logtype; static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =LIST_HEAD_INITIALIZER (); -static pthread_mutex_t mlx5_dev_ctx_list_mutex =PTHREAD_MUTEX_INITIALIZER ; - +static pthread_mutex_t mlx5_dev_ctx_list_mutex; static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) [MLX5_IPOOL_DECAP_ENCAP] = {
@@ -2235,6 +2234,7 @@ RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE)*/ RTE_INIT (rte_mlx5_pmd_init) { +pthread_mutex_init (&mlx5_dev_ctx_list_mutex,NULL );mlx5_common_init ();/* Build the static tables for Verbs conversion. */ mlx5_set_ptype_table ();
Signature · 1 line
2.16.1.windows.4
PATCH 33/35 mlx5: use OS function for dr_sync_domain
In reply to Tal Shnaidermanuse OS functions for flow_dv_sync_domain to compile Windows.
mlx5_os_flow_dr_sync_domain is unsupported for Windows.
--- drivers/net/mlx5/linux/mlx5_flow_os.h | 6 ++++++ drivers/net/mlx5/mlx5_flow_dv.c | 6 +++--- drivers/net/mlx5/windows/mlx5_flow_os.h | 9 +++++++++ 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.h +6 -0
@@ -427,4 +427,10 @@ mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, {return mlx5_flow_adjust_priority (dev, priority, subpriority); } + +static inline int +mlx5_os_flow_dr_sync_domain (void *domain,uint32_t flags) +{ +return mlx5_glue->dr_sync_domain (domain, flags); +}#endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
drivers/net/mlx5/mlx5_flow_dv.c +3 -3
@@ -12680,18 +12680,18 @@ flow_dv_sync_domain(struct rte_eth_dev *dev, uint32_t domains, uint32_t flags)int ret =0 ;if ((domains &MLX5_DOMAIN_BIT_NIC_RX ) && priv->sh->rx_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->rx_domain, + ret =mlx5_os_flow_dr_sync_domain (priv->sh->rx_domain, flags);if (ret !=0 )return ret; }if ((domains &MLX5_DOMAIN_BIT_NIC_TX ) && priv->sh->tx_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->tx_domain, flags); + ret =mlx5_os_flow_dr_sync_domain (priv->sh->tx_domain, flags);if (ret !=0 )return ret; }if ((domains &MLX5_DOMAIN_BIT_FDB ) && priv->sh->fdb_domain !=NULL ) { - ret = mlx5_glue->dr_sync_domain (priv->sh->fdb_domain, flags); + ret =mlx5_os_flow_dr_sync_domain (priv->sh->fdb_domain, flags);if (ret !=0 )return ret; }
drivers/net/mlx5/windows/mlx5_flow_os.h +9 -0
@@ -345,6 +345,15 @@ mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,return 0 ; } +static inline int +mlx5_os_flow_dr_sync_domain (void *domain,uint32_t flags) +{ +RTE_SET_USED (domain); +RTE_SET_USED (flags); + errno =ENOTSUP ; +return errno; +} + int mlx5_flow_os_validate_flow_attributes(struct rte_eth_dev *dev, const struct rte_flow_attr *attributes, bool external,
Signature · 1 line
2.16.1.windows.4
PATCH 34/35 mlx5: do not fail on IPv6 broadcast flow creation failure
In reply to Tal ShnaidermanIPv6 broadcast flow creation is unsupported in Windows. do not fail on IPv6 broadcast flow creation on this mast to avoid entire default rules creation failure.
--- drivers/net/mlx5/mlx5_trigger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_trigger.c +6 -2
@@ -1316,8 +1316,12 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) goto error; ret =mlx5_ctrl_flow (dev, &ipv6_multi_spec, &ipv6_multi_mask); -if (ret) - goto error; +if (ret) { +/* Do not fail on IPv6 broadcast creation failure. */ +DRV_LOG (WARNING , +"IPv6 broadcast is not supported" ); + ret =0 ; + } } }/* Add MAC address flows. */
Signature · 1 line
2.16.1.windows.4
PATCH 35/35 net/mlx5: fix warnings on comparison sign mismatch
In reply to Tal ShnaidermanThe clang compiler warns on size mismatches of several comparisons.
warning: comparison of integers of different signs
To resolve those the right types is used/cast to.
--- drivers/net/mlx5/mlx5_flow.c | 4 ++-- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/windows/mlx5_flow_os.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow.c +2 -2
@@ -798,7 +798,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, start_reg = priv->mtr_color_reg !=REG_C_2 ?REG_C_2 : (priv->mtr_reg_share ?REG_C_3 :REG_C_4 ); skip_mtr_reg = !!(priv->mtr_en && start_reg ==REG_C_2 ); -if (id > (REG_C_7 - start_reg)) +if (id > (uint32_t )(REG_C_7 - start_reg))return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL ,"invalid tag id" );
@@ -814,7 +814,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev,*/ if (skip_mtr_reg && config->flow_mreg_c [id + start_reg -REG_C_0 ] >= priv->mtr_color_reg) { -if (id >= (REG_C_7 - start_reg)) +if (id >= (uint32_t )(REG_C_7 - start_reg))return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL ,"invalid tag id" );
drivers/net/mlx5/mlx5_flow_dv.c +1 -1
@@ -955,7 +955,7 @@ flow_dv_convert_action_set_regRTE_FLOW_ERROR_TYPE_ACTION ,NULL , "too many items to modify");MLX5_ASSERT (conf->id !=REG_NON ); -MLX5_ASSERT (conf->id <RTE_DIM (reg_to_field)); +MLX5_ASSERT (conf->id < (enum modify_reg )RTE_DIM (reg_to_field)); actions[i] = (struct mlx5_modification_cmd ) { .action_type =MLX5_MODIFICATION_TYPE_SET , .field = reg_to_field[conf->id],
drivers/net/mlx5/windows/mlx5_flow_os.c +1 -1
@@ -188,7 +188,7 @@ mlx5_flow_os_create_flow(void *matcher, void *match_value, void *actions[], void **flow) { struct mlx5_action *action; -int i; +size_t i;struct mlx5_matcher *mlx5_matcher = matcher;struct mlx5_flow_dv_match_params *mlx5_match_value = match_value;uint32_t in[MLX5_ST_SZ_DW (devx_fs_rule_add_in)] = {0 };
Signature · 1 line
2.16.1.windows.4