From 0fa21ec991180b7bdd93562d02266cffad91b24e Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Wed, 15 Nov 2023 14:28:30 +0200 Subject: [PATCH 1/5] pyverbs: Fix compilation error in Fedora 39 Error compiling Cython file: ------------------------------------------------------------ ... """ super().__init__() self.pd = pd self.init_attr.pd = pd.pd if pd_context: self.init_attr.alloc = pd_alloc ^ ------------------------------------------------------------ /home/leonro/src/rdma-core/pyverbs/pd.pyx:230:35: Cannot assign type 'void *(ibv_pd *, void *, size_t, size_t, uint64_t) except? NULL' to 'void *(*)(ibv_pd *, void *, size_t, size_t, uint64_t) noexcept'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void *(ibv_pd *, void *, size_t, size_t, uint64_t) except? NULL'. Error compiling Cython file: ------------------------------------------------------------ ... super().__init__() self.pd = pd self.init_attr.pd = pd.pd if pd_context: self.init_attr.alloc = pd_alloc self.init_attr.free = pd_free ^ ------------------------------------------------------------ Signed-off-by: Leon Romanovsky Signed-off-by: Edward Srouji --- pyverbs/pd.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyverbs/pd.pyx b/pyverbs/pd.pyx index e12af1977..2d84e0b68 100644 --- a/pyverbs/pd.pyx +++ b/pyverbs/pd.pyx @@ -1,5 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2019, Mellanox Technologies. All rights reserved. + +#cython: legacy_implicit_noexcept=True + from libc.stdint cimport uintptr_t, uint32_t from libc.stdlib cimport malloc import weakref From c0377a2fc0741d3956c0cb6710b226c8539d242f Mon Sep 17 00:00:00 2001 From: Edward Srouji Date: Thu, 28 Dec 2023 13:42:43 +0200 Subject: [PATCH 2/5] pyverbs: Fix runtime warnings in Fedora 39 Adapt to Cython 3 to get rid of such warnings: ":241: UserWarning: enum class rdma_port_space not importable from pyverbs.librdmacm_enums. You are probably using a cpdef enum declared in a .pxd file that does not have a .py or .pyx file. :241: UserWarning: enum class ibv_send_flags not importable from pyverbs.libibverbs. You are probably using a cpdef enum declared in a .pxd file that does not have a .py or .pyx file." By adding empty .pyx files with the same name as current .pxd, or by renaming relevant .pxd files where it's possible. Signed-off-by: Edward Srouji --- pyverbs/CMakeLists.txt | 4 +++ pyverbs/libibverbs.pxd | 2 ++ pyverbs/libibverbs.pyx | 0 pyverbs/libibverbs_enums.pyx | 0 pyverbs/librdmacm.pxd | 2 ++ pyverbs/librdmacm.pyx | 0 pyverbs/librdmacm_enums.pyx | 0 pyverbs/providers/efa/CMakeLists.txt | 1 + .../efa/{efadv_enums.pxd => efa_enums.pxd} | 0 pyverbs/providers/efa/efa_enums.pyx | 22 ------------ pyverbs/providers/efa/efadv.pyx | 2 +- pyverbs/providers/efa/libefa.pxd | 2 ++ pyverbs/providers/efa/libefa.pyx | 0 pyverbs/providers/mlx5/CMakeLists.txt | 1 + pyverbs/providers/mlx5/libmlx5.pxd | 4 ++- pyverbs/providers/mlx5/libmlx5.pyx | 0 .../mlx5/{mlx5dv_enums.pxd => mlx5_enums.pxd} | 30 ---------------- pyverbs/providers/mlx5/mlx5_enums.pyx | 35 ++++++++++++++++++- pyverbs/providers/mlx5/mlx5dv.pyx | 2 +- pyverbs/providers/mlx5/mlx5dv_objects.pyx | 2 +- 20 files changed, 52 insertions(+), 57 deletions(-) create mode 100644 pyverbs/libibverbs.pyx create mode 100644 pyverbs/libibverbs_enums.pyx create mode 100644 pyverbs/librdmacm.pyx create mode 100644 pyverbs/librdmacm_enums.pyx rename pyverbs/providers/efa/{efadv_enums.pxd => efa_enums.pxd} (100%) create mode 100644 pyverbs/providers/efa/libefa.pyx create mode 100644 pyverbs/providers/mlx5/libmlx5.pyx rename pyverbs/providers/mlx5/{mlx5dv_enums.pxd => mlx5_enums.pxd} (87%) mode change 120000 => 100644 pyverbs/providers/mlx5/mlx5_enums.pyx diff --git a/pyverbs/CMakeLists.txt b/pyverbs/CMakeLists.txt index a83db3a67..4ce7ee9c4 100644 --- a/pyverbs/CMakeLists.txt +++ b/pyverbs/CMakeLists.txt @@ -31,6 +31,10 @@ rdma_cython_module(pyverbs "" enums.pyx flow.pyx fork.pyx + libibverbs.pyx + libibverbs_enums.pyx + librdmacm.pyx + librdmacm_enums.pyx mem_alloc.pyx mr.pyx pd.pyx diff --git a/pyverbs/libibverbs.pxd b/pyverbs/libibverbs.pxd index 3f75a011f..ba1a2a4ff 100644 --- a/pyverbs/libibverbs.pxd +++ b/pyverbs/libibverbs.pxd @@ -1,6 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2018, Mellanox Technologies. All rights reserved. See COPYING file +#cython: language_level=3 + include 'libibverbs_enums.pxd' from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t from posix.time cimport timespec diff --git a/pyverbs/libibverbs.pyx b/pyverbs/libibverbs.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/libibverbs_enums.pyx b/pyverbs/libibverbs_enums.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/librdmacm.pxd b/pyverbs/librdmacm.pxd index 0dc966a3a..487a097f4 100644 --- a/pyverbs/librdmacm.pxd +++ b/pyverbs/librdmacm.pxd @@ -1,6 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2019, Mellanox Technologies. All rights reserved. See COPYING file +#cython: language_level=3 + include 'libibverbs.pxd' include 'librdmacm_enums.pxd' from libc.stdint cimport uint8_t, uint32_t diff --git a/pyverbs/librdmacm.pyx b/pyverbs/librdmacm.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/librdmacm_enums.pyx b/pyverbs/librdmacm_enums.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/providers/efa/CMakeLists.txt b/pyverbs/providers/efa/CMakeLists.txt index aa9733008..1852dcebd 100644 --- a/pyverbs/providers/efa/CMakeLists.txt +++ b/pyverbs/providers/efa/CMakeLists.txt @@ -4,4 +4,5 @@ rdma_cython_module(pyverbs/providers/efa efa efa_enums.pyx efadv.pyx + libefa.pyx ) diff --git a/pyverbs/providers/efa/efadv_enums.pxd b/pyverbs/providers/efa/efa_enums.pxd similarity index 100% rename from pyverbs/providers/efa/efadv_enums.pxd rename to pyverbs/providers/efa/efa_enums.pxd diff --git a/pyverbs/providers/efa/efa_enums.pyx b/pyverbs/providers/efa/efa_enums.pyx index b3432f146..e69de29bb 100644 --- a/pyverbs/providers/efa/efa_enums.pyx +++ b/pyverbs/providers/efa/efa_enums.pyx @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) -# Copyright 2020-2024 Amazon.com, Inc. or its affiliates. All rights reserved. - -#cython: language_level=3 - -cdef extern from 'infiniband/efadv.h': - - cpdef enum: - EFADV_DEVICE_ATTR_CAPS_RDMA_READ - EFADV_DEVICE_ATTR_CAPS_CQ_WITH_SGID - EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE - - cpdef enum: - EFADV_QP_DRIVER_TYPE_SRD - - cpdef enum: - EFADV_WC_EX_WITH_SGID - - cpdef enum: - EFADV_MR_ATTR_VALIDITY_RECV_IC_ID - EFADV_MR_ATTR_VALIDITY_RDMA_READ_IC_ID - EFADV_MR_ATTR_VALIDITY_RDMA_RECV_IC_ID diff --git a/pyverbs/providers/efa/efadv.pyx b/pyverbs/providers/efa/efadv.pyx index bf8cdba4e..dd8d49380 100644 --- a/pyverbs/providers/efa/efadv.pyx +++ b/pyverbs/providers/efa/efadv.pyx @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright 2020-2024 Amazon.com, Inc. or its affiliates. All rights reserved. -cimport pyverbs.providers.efa.efadv_enums as dve +cimport pyverbs.providers.efa.efa_enums as dve cimport pyverbs.providers.efa.libefa as dv from pyverbs.addr cimport GID diff --git a/pyverbs/providers/efa/libefa.pxd b/pyverbs/providers/efa/libefa.pxd index ca6471a84..53355e05d 100644 --- a/pyverbs/providers/efa/libefa.pxd +++ b/pyverbs/providers/efa/libefa.pxd @@ -1,6 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright 2020-2024 Amazon.com, Inc. or its affiliates. All rights reserved. +#cython: language_level=3 + from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t cimport pyverbs.libibverbs as v diff --git a/pyverbs/providers/efa/libefa.pyx b/pyverbs/providers/efa/libefa.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/providers/mlx5/CMakeLists.txt b/pyverbs/providers/mlx5/CMakeLists.txt index 5ede08626..17b1eb4f4 100644 --- a/pyverbs/providers/mlx5/CMakeLists.txt +++ b/pyverbs/providers/mlx5/CMakeLists.txt @@ -7,6 +7,7 @@ rdma_cython_module(pyverbs/providers/mlx5 mlx5 dr_matcher.pyx dr_rule.pyx dr_table.pyx + libmlx5.pyx mlx5_enums.pyx mlx5_vfio.pyx mlx5dv.pyx diff --git a/pyverbs/providers/mlx5/libmlx5.pxd b/pyverbs/providers/mlx5/libmlx5.pxd index cc4fdd648..a73edb4e0 100644 --- a/pyverbs/providers/mlx5/libmlx5.pxd +++ b/pyverbs/providers/mlx5/libmlx5.pxd @@ -1,7 +1,9 @@ # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. See COPYING file -include 'mlx5dv_enums.pxd' +#cython: language_level=3 + +include 'mlx5_enums.pxd' from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t from posix.types cimport off_t diff --git a/pyverbs/providers/mlx5/libmlx5.pyx b/pyverbs/providers/mlx5/libmlx5.pyx new file mode 100644 index 000000000..e69de29bb diff --git a/pyverbs/providers/mlx5/mlx5dv_enums.pxd b/pyverbs/providers/mlx5/mlx5_enums.pxd similarity index 87% rename from pyverbs/providers/mlx5/mlx5dv_enums.pxd rename to pyverbs/providers/mlx5/mlx5_enums.pxd index 34f5617f9..39996cede 100644 --- a/pyverbs/providers/mlx5/mlx5dv_enums.pxd +++ b/pyverbs/providers/mlx5/mlx5_enums.pxd @@ -305,21 +305,6 @@ cdef extern from 'infiniband/mlx5dv.h': cdef unsigned long long MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID -_MLX5DV_RES_TYPE_QP = MLX5DV_RES_TYPE_QP -_MLX5DV_RES_TYPE_RWQ = MLX5DV_RES_TYPE_RWQ -_MLX5DV_RES_TYPE_DBR = MLX5DV_RES_TYPE_DBR -_MLX5DV_RES_TYPE_SRQ = MLX5DV_RES_TYPE_SRQ -_MLX5DV_PP_ALLOC_FLAGS_DEDICATED_INDEX = MLX5DV_PP_ALLOC_FLAGS_DEDICATED_INDEX -_MLX5DV_UAR_ALLOC_TYPE_BF = MLX5DV_UAR_ALLOC_TYPE_BF -_MLX5DV_UAR_ALLOC_TYPE_NC = MLX5DV_UAR_ALLOC_TYPE_NC -MLX5DV_QUERY_PORT_VPORT_ = MLX5DV_QUERY_PORT_VPORT -MLX5DV_QUERY_PORT_VPORT_VHCA_ID_ = MLX5DV_QUERY_PORT_VPORT_VHCA_ID -MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RX_ = MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RX -MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TX_ = MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TX -MLX5DV_QUERY_PORT_VPORT_REG_C0_ = MLX5DV_QUERY_PORT_VPORT_REG_C0 -MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID_ = MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID - - cdef extern from 'infiniband/mlx5_user_ioctl_verbs.h': cdef enum mlx5_ib_uapi_flow_table_type: pass @@ -335,18 +320,3 @@ cdef extern from 'infiniband/mlx5_api.h': cdef int MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL cdef int MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 cdef int MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL - -MLX5DV_FLOW_TABLE_TYPE_RDMA_RX_ = MLX5DV_FLOW_TABLE_TYPE_RDMA_RX -MLX5DV_FLOW_TABLE_TYPE_RDMA_TX_ = MLX5DV_FLOW_TABLE_TYPE_RDMA_TX -MLX5DV_FLOW_TABLE_TYPE_NIC_RX_ = MLX5DV_FLOW_TABLE_TYPE_NIC_RX -MLX5DV_FLOW_TABLE_TYPE_NIC_TX_ = MLX5DV_FLOW_TABLE_TYPE_NIC_TX -MLX5DV_FLOW_TABLE_TYPE_FDB_ = MLX5DV_FLOW_TABLE_TYPE_FDB - -MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2_ = \ - MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 -MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL_ = \ - MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL -MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2_ = \ - MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 -MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL_ = \ - MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL diff --git a/pyverbs/providers/mlx5/mlx5_enums.pyx b/pyverbs/providers/mlx5/mlx5_enums.pyx deleted file mode 120000 index ba0e916f9..000000000 --- a/pyverbs/providers/mlx5/mlx5_enums.pyx +++ /dev/null @@ -1 +0,0 @@ -mlx5dv_enums.pxd \ No newline at end of file diff --git a/pyverbs/providers/mlx5/mlx5_enums.pyx b/pyverbs/providers/mlx5/mlx5_enums.pyx new file mode 100644 index 000000000..21fb95b6e --- /dev/null +++ b/pyverbs/providers/mlx5/mlx5_enums.pyx @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) +# Copyright (c) 2024 Nvidia All rights reserved. + +#cython: language_level=3 + +_MLX5DV_RES_TYPE_QP = MLX5DV_RES_TYPE_QP +_MLX5DV_RES_TYPE_RWQ = MLX5DV_RES_TYPE_RWQ +_MLX5DV_RES_TYPE_DBR = MLX5DV_RES_TYPE_DBR +_MLX5DV_RES_TYPE_SRQ = MLX5DV_RES_TYPE_SRQ +_MLX5DV_PP_ALLOC_FLAGS_DEDICATED_INDEX = MLX5DV_PP_ALLOC_FLAGS_DEDICATED_INDEX +_MLX5DV_UAR_ALLOC_TYPE_BF = MLX5DV_UAR_ALLOC_TYPE_BF +_MLX5DV_UAR_ALLOC_TYPE_NC = MLX5DV_UAR_ALLOC_TYPE_NC + +MLX5DV_QUERY_PORT_VPORT_ = MLX5DV_QUERY_PORT_VPORT +MLX5DV_QUERY_PORT_VPORT_VHCA_ID_ = MLX5DV_QUERY_PORT_VPORT_VHCA_ID +MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RX_ = MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RX +MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TX_ = MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TX +MLX5DV_QUERY_PORT_VPORT_REG_C0_ = MLX5DV_QUERY_PORT_VPORT_REG_C0 +MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID_ = MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID + +MLX5DV_FLOW_TABLE_TYPE_RDMA_RX_ = MLX5DV_FLOW_TABLE_TYPE_RDMA_RX +MLX5DV_FLOW_TABLE_TYPE_RDMA_TX_ = MLX5DV_FLOW_TABLE_TYPE_RDMA_TX +MLX5DV_FLOW_TABLE_TYPE_NIC_RX_ = MLX5DV_FLOW_TABLE_TYPE_NIC_RX +MLX5DV_FLOW_TABLE_TYPE_NIC_TX_ = MLX5DV_FLOW_TABLE_TYPE_NIC_TX +MLX5DV_FLOW_TABLE_TYPE_FDB_ = MLX5DV_FLOW_TABLE_TYPE_FDB + +MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2_ = \ + MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 +MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL_ = \ + MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL +MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2_ = \ + MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 +MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL_ = \ + MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL diff --git a/pyverbs/providers/mlx5/mlx5dv.pyx b/pyverbs/providers/mlx5/mlx5dv.pyx index deada022b..f553d5e2c 100644 --- a/pyverbs/providers/mlx5/mlx5dv.pyx +++ b/pyverbs/providers/mlx5/mlx5dv.pyx @@ -14,7 +14,7 @@ from pyverbs.providers.mlx5.mlx5dv_crypto cimport Mlx5CryptoLoginAttr, Mlx5Crypt from pyverbs.pyverbs_error import PyverbsUserError, PyverbsRDMAError, PyverbsError from pyverbs.providers.mlx5.dr_action cimport DrActionFlowCounter, DrActionDestTir from pyverbs.providers.mlx5.mlx5dv_sched cimport Mlx5dvSchedLeaf -cimport pyverbs.providers.mlx5.mlx5dv_enums as dve +cimport pyverbs.providers.mlx5.mlx5_enums as dve cimport pyverbs.providers.mlx5.libmlx5 as dv from pyverbs.mem_alloc import posix_memalign from pyverbs.qp cimport QPInitAttrEx, QPEx diff --git a/pyverbs/providers/mlx5/mlx5dv_objects.pyx b/pyverbs/providers/mlx5/mlx5dv_objects.pyx index ec6eeb6d5..e7776205a 100644 --- a/pyverbs/providers/mlx5/mlx5dv_objects.pyx +++ b/pyverbs/providers/mlx5/mlx5dv_objects.pyx @@ -12,7 +12,7 @@ Note: This is not be confused with Mlx5 which holds the ibv__ex that from libc.stdint cimport uintptr_t, uint32_t from pyverbs.pyverbs_error import PyverbsUserError, PyverbsRDMAError -cimport pyverbs.providers.mlx5.mlx5dv_enums as dve +cimport pyverbs.providers.mlx5.mlx5_enums as dve cimport pyverbs.libibverbs as v From 4dbbf9bf4adc28d425a0331ccdcc0d2c87eed4d6 Mon Sep 17 00:00:00 2001 From: Edward Srouji Date: Thu, 18 Jan 2024 11:01:44 +0200 Subject: [PATCH 3/5] pyverbs: Adapt includes in Fedora 39 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace Cython includes with cimports to work around a Cython 3 bug (#5860 on the Cython GitHub) that causes the following compilation errors: build/pyverbs/device.c:14743:18: error: redefinition of ‘__Pyx_Enum_enum__space_ibv_event_type_to_py’ 14743 | static PyObject *__Pyx_Enum_enum__space_ibv_event_type_to_py(enum ibv_event_type __pyx_v_c_val) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ build/pyverbs/device.c:10914:18: note: previous definition of ‘__Pyx_Enum_enum__space_ibv_event_type_to_py’ with type ‘PyObject *(enum ibv_event_type)’ {aka ‘struct _object *(enum ibv_event_type)’} 10914 | static PyObject *__Pyx_Enum_enum__space_ibv_event_type_to_py(enum ibv_event_type __pyx_v_c_val) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Edward Srouji --- pyverbs/libibverbs.pxd | 3 ++- pyverbs/librdmacm.pxd | 5 +++-- pyverbs/providers/mlx5/libmlx5.pxd | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyverbs/libibverbs.pxd b/pyverbs/libibverbs.pxd index ba1a2a4ff..fe7912608 100644 --- a/pyverbs/libibverbs.pxd +++ b/pyverbs/libibverbs.pxd @@ -3,9 +3,10 @@ #cython: language_level=3 -include 'libibverbs_enums.pxd' from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t from posix.time cimport timespec +from pyverbs.libibverbs_enums cimport * + cdef extern from 'infiniband/verbs.h': diff --git a/pyverbs/librdmacm.pxd b/pyverbs/librdmacm.pxd index 487a097f4..0d6fa912f 100644 --- a/pyverbs/librdmacm.pxd +++ b/pyverbs/librdmacm.pxd @@ -3,9 +3,10 @@ #cython: language_level=3 -include 'libibverbs.pxd' -include 'librdmacm_enums.pxd' from libc.stdint cimport uint8_t, uint32_t +from pyverbs.librdmacm_enums cimport * +from pyverbs.libibverbs cimport * + cdef extern from '': diff --git a/pyverbs/providers/mlx5/libmlx5.pxd b/pyverbs/providers/mlx5/libmlx5.pxd index a73edb4e0..7bcca0ef4 100644 --- a/pyverbs/providers/mlx5/libmlx5.pxd +++ b/pyverbs/providers/mlx5/libmlx5.pxd @@ -3,13 +3,12 @@ #cython: language_level=3 -include 'mlx5_enums.pxd' - from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t from posix.types cimport off_t from libcpp cimport bool cimport libc.stdio as s +from pyverbs.providers.mlx5.mlx5_enums cimport * cimport pyverbs.libibverbs as v From 1462a873796b1be8df48ce4a3e50c5632ceb1fee Mon Sep 17 00:00:00 2001 From: Edward Srouji Date: Tue, 16 Jan 2024 17:16:40 +0200 Subject: [PATCH 4/5] build: Fix cmake warning Fix the following CMake warning in recent versions: "CMake Warning (dev) at CMakeLists.txt:231 (FIND_PACKAGE): Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed. Run "cmake --help-policy CMP0148" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it." Signed-off-by: Edward Srouji --- CMakeLists.txt | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3269a85f0..98985e7ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,19 +214,27 @@ if (NOT HAVE_WORKING_WERROR) message(FATAL_ERROR "-Werror doesn't work (compiler always creates warnings?). Werror is required for CMake.") endif() -# Look for Python. We prefer some variant of python 3 if the system has it. -FIND_PACKAGE(PythonInterp 3 QUIET) -if (PythonInterp_FOUND) - # pyverbs can only use python3: - if (NO_PYVERBS) - set(CYTHON_EXECUTABLE "") +# Use Python modules based on CMake version for backward compatibility +set(CYTHON_EXECUTABLE "") +if (${CMAKE_VERSION} VERSION_LESS "3.12") + # Look for Python. We prefer some variant of python 3 if the system has it + FIND_PACKAGE(PythonInterp 3 QUIET) + if (PythonInterp_FOUND) + # pyverbs can only use python3: + if (NOT NO_PYVERBS) + FIND_PACKAGE(cython) + endif() else() - FIND_PACKAGE(cython) + # But we still must have python (be it 2) for the build process + FIND_PACKAGE(PythonInterp REQUIRED) endif() else() - # But we still must have python (be it 2) for the build process: - FIND_PACKAGE(PythonInterp REQUIRED) - set(CYTHON_EXECUTABLE "") + # FindPython looks preferably for Python3. If not found, version 2 is searched + FIND_PACKAGE(Python COMPONENTS Interpreter REQUIRED) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + if (NOT NO_PYVERBS AND Python_VERSION_MAJOR EQUAL 3) + FIND_PACKAGE(cython) + endif() endif() find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin") @@ -450,8 +458,15 @@ if (CYTHON_EXECUTABLE) # find a matching -devel installation but will happily return a non-matching # one too. We need them both to match exactly to guarantee cython does the # right thing. - FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} - EXACT REQUIRED) + if (${CMAKE_VERSION} VERSION_LESS "3.12") + FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} + EXACT REQUIRED) + else() + FIND_PACKAGE(Python ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR} + EXACT COMPONENTS Development REQUIRED) + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) + set(PYTHON_INCLUDE_DIRS ${Python_INCLUDE_DIRS}) + endif() # Get a default installation path execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c From 20ab7802e6ea9a7664efc6b2eb321ead300e93f6 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Wed, 15 Nov 2023 14:17:32 +0200 Subject: [PATCH 5/5] cbuild: Update to Fedora 39 Use latest Fedora release Signed-off-by: Leon Romanovsky --- buildlib/azure-pipelines.yml | 4 ++-- buildlib/cbuild | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildlib/azure-pipelines.yml b/buildlib/azure-pipelines.yml index 91b9135a5..ca0bb5ecd 100644 --- a/buildlib/azure-pipelines.yml +++ b/buildlib/azure-pipelines.yml @@ -34,7 +34,7 @@ resources: image: ucfconsort.azurecr.io/rdma-core/centos9:44.0 endpoint: ucfconsort_registry - container: fedora - image: ucfconsort.azurecr.io/rdma-core/fc38:46.0 + image: ucfconsort.azurecr.io/rdma-core/fc39:49.0 endpoint: ucfconsort_registry - container: xenial image: ucfconsort.azurecr.io/rdma-core/ubuntu-16.04:28.0 @@ -195,7 +195,7 @@ stages: CONTAINER: centos9 SPEC: redhat/rdma-core.spec RPMBUILD_OPTS: --define 'EXTRA_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=1' - fedora38: + fedora39: CONTAINER: fedora SPEC: redhat/rdma-core.spec RPMBUILD_OPTS: --define 'EXTRA_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=1' diff --git a/buildlib/cbuild b/buildlib/cbuild index 691feca7a..3e8714bd7 100755 --- a/buildlib/cbuild +++ b/buildlib/cbuild @@ -220,10 +220,10 @@ class centos9(Environment): (" ".join(sorted(self.pkgs)))) return res -class fc38(Environment): - docker_parent = "fedora:38"; +class fc39(Environment): + docker_parent = "fedora:39"; pkgs = centos8.pkgs | {"util-linux"} - name = "fc38"; + name = "fc39"; specfile = "redhat/rdma-core.spec"; ninja_cmd = "ninja-build"; is_rpm = True; @@ -626,7 +626,7 @@ environments = [centos7(), jammy(), jessie(), stretch(), - fc38(), + fc39(), leap(), tumbleweed(), debian_experimental(),