mlx5 change local ibverb to OFED 4.0 lib
authorHanoh Haim <[email protected]>
Mon, 27 Feb 2017 13:28:14 +0000 (15:28 +0200)
committerHanoh Haim <[email protected]>
Mon, 27 Feb 2017 13:44:34 +0000 (15:44 +0200)
Signed-off-by: Hanoh Haim <[email protected]>
18 files changed:
doc/trex_book.asciidoc
external_libs/ibverbs/include/infiniband/driver.h
external_libs/ibverbs/include/infiniband/driver_exp.h
external_libs/ibverbs/include/infiniband/kern-abi.h
external_libs/ibverbs/include/infiniband/kern-abi_exp.h
external_libs/ibverbs/include/infiniband/mlx5_hw.h
external_libs/ibverbs/include/infiniband/verbs.h
external_libs/ibverbs/include/infiniband/verbs_exp.h
external_libs/ibverbs/libibverbs.a
external_libs/ibverbs/libibverbs.la [deleted file]
external_libs/ibverbs/libibverbs.lai [deleted file]
external_libs/ibverbs/libibverbs.so
external_libs/ibverbs/libibverbs.so.1
external_libs/ibverbs/libibverbs.so.1.0.0
linux_dpdk/ws_main.py
scripts/dumy_libs/libibverbs.so.1 [deleted file]
scripts/dumy_libs/libnl-3.so.200 [deleted file]
scripts/dumy_libs/libnl-route-3.so.200 [deleted file]

index 3f0db6c..6d614f1 100755 (executable)
@@ -2813,6 +2813,62 @@ There is a task to automate the production of thess reports
    Cause: rte_eth_dev_filter_ctrl: err=-22, port=2
 ----
 
+==== Build with native OFED 
+
+In some case there is a need to build the dpdk-mlx5 with different OFED (not just 4.0 maybe newer) 
+to do so run this on native machine 
+
+[source,bash]
+---- 
+[csi-trex-07]> ./b configure
+Setting top to                           : /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core 
+Setting out to                           : /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/linux_dpdk/build_dpdk 
+Checking for program 'g++, c++'          : /bin/g++ 
+Checking for program 'ar'                : /bin/ar 
+Checking for program 'gcc, cc'           : /bin/gcc 
+Checking for program 'ar'                : /bin/ar 
+Checking for program 'ldd'               : /bin/ldd 
+Checking for library z                   : yes 
+Checking for OFED                        : Found needed version 4.0   #1 
+Checking for library ibverbs             : yes 
+'configure' finished successfully (1.826s)
+---- 
+<1> make sure it was identify 
+
+
+[source,python]
+---- 
+        index fba7540..a55fe6b 100755
+        --- a/linux_dpdk/ws_main.py
+        +++ b/linux_dpdk/ws_main.py
+        @@ -143,8 +143,11 @@ def missing_pkg_msg(fedora, ubuntu):
+         def check_ofed(ctx):
+             ctx.start_msg('Checking for OFED')
+             ofed_info='/usr/bin/ofed_info'
+        -    ofed_ver= '-3.4-'
+        -    ofed_ver_show= 'v3.4'
+        +
+        +    ofed_ver_re = re.compile('.*[-](\d)[.](\d)[-].*')
+        +
+        +    ofed_ver= 40                                     <1>
+        +    ofed_ver_show= '4.0'
+        
+        
+        --- a/scripts/dpdk_setup_ports.py
+        +++ b/scripts/dpdk_setup_ports.py
+        @@ -366,8 +366,8 @@ Other network devices
+         
+                 ofed_ver_re = re.compile('.*[-](\d)[.](\d)[-].*')
+         
+        -        ofed_ver= 34
+        -        ofed_ver_show= '3.4-1'
+        +        ofed_ver= 40                                 <2>
+        +        ofed_ver_show= '4.0'
+---- 
+<1> change to new version 
+<2> change to new version 
+
 
 === Cisco VIC support 
 
index b59bc45..6b0edf5 100644 (file)
@@ -86,12 +86,6 @@ enum verbs_qp_mask {
        VERBS_QP_RESERVED       = 1 << 1
 };
 
-struct verbs_mw {
-       struct ibv_mw           mw;
-       uint32_t                handle;
-       enum ibv_mw_type        type;
-};
-
 struct verbs_qp {
        struct ibv_qp           qp;
        uint32_t                comp_mask;
@@ -111,6 +105,16 @@ int ibv_cmd_query_device(struct ibv_context *context,
                         struct ibv_device_attr *device_attr,
                         uint64_t *raw_fw_ver,
                         struct ibv_query_device *cmd, size_t cmd_size);
+int ibv_cmd_query_device_ex(struct ibv_context *context,
+                           const struct ibv_query_device_ex_input *input,
+                           struct ibv_device_attr_ex *attr, size_t attr_size,
+                           uint64_t *raw_fw_ver,
+                           struct ibv_query_device_ex *cmd,
+                           size_t cmd_core_size,
+                           size_t cmd_size,
+                           struct ibv_query_device_resp_ex *resp,
+                           size_t resp_core_size,
+                           size_t resp_size);
 int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num,
                       struct ibv_port_attr *port_attr,
                       struct ibv_query_port *cmd, size_t cmd_size);
@@ -135,12 +139,17 @@ int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
                   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
                   size_t cmd_size,
                   struct ibv_reg_mr_resp *resp, size_t resp_size);
+int ibv_cmd_rereg_mr(struct ibv_mr *mr, uint32_t flags, void *addr,
+                    size_t length, uint64_t hca_va, int access,
+                    struct ibv_pd *pd, struct ibv_rereg_mr *cmd,
+                    size_t cmd_sz, struct ibv_rereg_mr_resp *resp,
+                    size_t resp_sz);
 int ibv_cmd_dereg_mr(struct ibv_mr *mr);
 int ibv_cmd_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type,
-                    struct verbs_mw *mw, struct ibv_alloc_mw *cmd,
+                    struct ibv_mw *mw, struct ibv_alloc_mw *cmd,
                     size_t cmd_size,
                     struct ibv_alloc_mw_resp *resp, size_t resp_size);
-int ibv_cmd_dealloc_mw(struct verbs_mw *mw,
+int ibv_cmd_dealloc_mw(struct ibv_mw *mw,
                       struct ibv_dealloc_mw *cmd, size_t cmd_size);
 int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
                      struct ibv_comp_channel *channel,
@@ -197,7 +206,9 @@ int ibv_cmd_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
 int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr,
                          struct ibv_recv_wr **bad_wr);
 int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
-                     struct ibv_ah_attr *attr);
+                     struct ibv_ah_attr *attr,
+                     struct ibv_create_ah_resp *resp,
+                     size_t resp_size);
 int ibv_cmd_destroy_ah(struct ibv_ah *ah);
 int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
 int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
@@ -211,10 +222,10 @@ int ibv_cmd_destroy_flow(struct ibv_flow *flow_id);
 
 int ibv_dontfork_range(void *base, size_t size);
 int ibv_dofork_range(void *base, size_t size);
-void ibv_cmd_query_device_assign(struct ibv_device_attr *device_attr,
-                                uint64_t *raw_fw_ver,
-                                struct ibv_query_device_resp *resp);
 
+void copy_query_dev_fields(struct ibv_device_attr *device_attr,
+                                 struct ibv_query_device_resp *resp,
+                                 uint64_t *raw_fw_ver);
 /*
  * sysfs helper functions
  */
index 31e4a5a..4cc6d80 100644 (file)
@@ -125,13 +125,6 @@ int ibv_exp_cmd_create_rwq_ind_table(struct ibv_context *context,
                                     size_t resp_core_size,
                                     size_t resp_size);
 int ibv_exp_cmd_destroy_rwq_ind_table(struct ibv_exp_rwq_ind_table *rwq_ind_table);
-int ibv_exp_cmd_rereg_mr(struct ibv_mr *mr, uint32_t flags, void *addr,
-                        size_t length, uint64_t hca_va, int access,
-                        struct ibv_pd *pd, struct ibv_exp_rereg_mr_attr *attr,
-                        struct ibv_exp_rereg_mr *cmd,
-                        size_t lib_cmd_sz, size_t drv_cmd_sz,
-                        struct ibv_exp_rereg_mr_resp *resp,
-                        size_t lib_resp_sz, size_t drv_resp_sz);
 /*
  * ibv_exp_cmd_getenv
  *
index a6964bb..f77f4c4 100644 (file)
@@ -102,10 +102,16 @@ enum {
 
 #define IB_USER_VERBS_CMD_FLAG_EXTENDED                0x80ul
 
+/* use this mask for creating extended commands */
+#define IB_USER_VERBS_CMD_EXTENDED_MASK \
+       (IB_USER_VERBS_CMD_FLAG_EXTENDED << \
+        IB_USER_VERBS_CMD_FLAGS_SHIFT)
+
 
 enum {
-       IB_USER_VERBS_CMD_CREATE_FLOW = (IB_USER_VERBS_CMD_FLAG_EXTENDED <<
-                                        IB_USER_VERBS_CMD_FLAGS_SHIFT) +
+       IB_USER_VERBS_CMD_QUERY_DEVICE_EX = IB_USER_VERBS_CMD_EXTENDED_MASK |
+                                           IB_USER_VERBS_CMD_QUERY_DEVICE,
+       IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_EXTENDED_MASK +
                                        IB_USER_VERBS_CMD_THRESHOLD,
        IB_USER_VERBS_CMD_DESTROY_FLOW
 };
@@ -147,18 +153,10 @@ struct ex_hdr {
        };
 };
 
-enum ibv_event_rsc_type {
-       IBV_EVENT_RSC_CQ,
-       IBV_EVENT_RSC_QP,
-       IBV_EVENT_RSC_DCT,
-       IBV_EVENT_RSC_SRQ,
-       IBV_EVENT_RSC_DEVICE,
-};
-
 struct ibv_kern_async_event {
        __u64 element;
        __u32 event_type;
-       __u32 rsc_type;
+       __u32 reserved;
 };
 
 struct ibv_comp_event {
@@ -256,6 +254,29 @@ struct ibv_query_device_resp {
        __u8  reserved[4];
 };
 
+struct ibv_query_device_ex {
+       struct ex_hdr   hdr;
+       __u32           comp_mask;
+       __u32           reserved;
+};
+
+struct ibv_odp_caps_resp {
+       __u64 general_caps;
+       struct {
+               __u32 rc_odp_caps;
+               __u32 uc_odp_caps;
+               __u32 ud_odp_caps;
+       } per_transport_caps;
+       __u32 reserved;
+};
+
+struct ibv_query_device_resp_ex {
+       struct ibv_query_device_resp base;
+       __u32 comp_mask;
+       __u32 response_length;
+       struct ibv_odp_caps_resp odp_caps;
+};
+
 struct ibv_query_port {
        __u32 command;
        __u16 in_words;
@@ -349,6 +370,26 @@ struct ibv_reg_mr_resp {
        __u32 rkey;
 };
 
+struct ibv_rereg_mr {
+       __u32 command;
+       __u16 in_words;
+       __u16 out_words;
+       __u64 response;
+       __u32 mr_handle;
+       __u32 flags;
+       __u64 start;
+       __u64 length;
+       __u64 hca_va;
+       __u32 pd_handle;
+       __u32 access_flags;
+       __u64 driver_data[0];
+};
+
+struct ibv_rereg_mr_resp {
+       __u32 lkey;
+       __u32 rkey;
+};
+
 struct ibv_dereg_mr {
        __u32 command;
        __u16 in_words;
@@ -376,6 +417,7 @@ struct ibv_dealloc_mw {
        __u16 in_words;
        __u16 out_words;
        __u32 mw_handle;
+       __u32 reserved;
 };
 
 struct ibv_create_comp_channel {
index b03f19f..56a4367 100644 (file)
@@ -310,7 +310,8 @@ struct ibv_exp_query_device_resp {
        __u32 max_device_ctx;
        struct ibv_exp_mp_rq_caps_resp mp_rq_caps;
        __u16 wq_vlan_offloads_cap;
-       __u8 reserved1[6];
+       __u8 reserved1[2];
+       __u32 ec_w_mask;
        struct ibv_exp_ec_caps_resp ec_caps;
        struct ibv_exp_masked_atomic_caps masked_atomic_caps;
        __u16 rx_pad_end_addr_align;
@@ -443,9 +444,9 @@ struct ibv_exp_modify_qp {
        __u64 dct_key;
        __u32 exp_attr_mask;
        __u32 flow_entropy;
-       __u64 driver_data[0];
        __u32 rate_limit;
        __u32 reserved1;
+       __u64 driver_data[0];
 };
 
 enum ibv_exp_create_cq_comp_mask {
@@ -573,14 +574,8 @@ struct ibv_exp_create_wq {
        __u64 user_handle;
        __u32 pd_handle;
        __u32 cq_handle;
-       __u32 srq_handle;
        __u32 max_recv_wr;
        __u32 max_recv_sge;
-       __u32 reserved;
-       struct ibv_exp_cmd_wq_mp_rq mp_rq;
-       __u16 wq_vlan_offloads;
-       __u8 reserved1[6];
-       __u64 flags;
 };
 
 struct ibv_exp_create_wq_resp {
@@ -598,22 +593,25 @@ struct ib_exp_destroy_wq {
        __u32 wq_handle;
 };
 
+struct ibv_destroy_wq_resp {
+       __u32 comp_mask;
+       __u32 response_length;
+       __u32 events_reported;
+       __u32 reserved;
+};
+
 struct ib_exp_modify_wq  {
        struct ex_hdr hdr;
        __u32 comp_mask;
        __u32 wq_handle;
        __u32 wq_state;
        __u32 curr_wq_state;
-       __u16 wq_vlan_offloads;
-       __u8 reserved[6];
 };
 
 struct ibv_exp_create_rwq_ind_table {
        struct ex_hdr hdr;
        __u32 comp_mask;
-       __u32 pd_handle;
        __u32 log_ind_tbl_size;
-       __u32 reserved;
        /* Following are wq handles based on log_ind_tbl_size, must be 64 bytes aligned.
         * __u32 wq_handle1
         * __u32 wq_handle2
index 2ac217d..bcef160 100644 (file)
@@ -31,6 +31,7 @@
 #define MLX5_CQ_DB_REQ_NOT                     (0 << 24)
 #define MLX5E_CQE_FORMAT_MASK 0xc
 
+
 enum mlx5_alloc_type { MXM_MLX5_ALLOC_TYPE_DUMMY };
 enum mlx5_rsc_type   { MXM_MLX5_RSC_TYPE_DUMMY };
 enum mlx5_db_method { MXM_MLX5_DB_TYPE_DUMMY };
@@ -51,13 +52,11 @@ enum {
        MLX5_OPCODE_SEND_IMM = 0x0b,
        MLX5_OPCODE_TSO = 0x0e,
        MLX5_OPC_MOD_MPW = 0x01,
-    MLX5_OPCODE_LSO_MPW =  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_BIND_MW = 0x18,
        MLX5_OPCODE_FMR = 0x19,
        MLX5_OPCODE_LOCAL_INVAL = 0x1b,
        MLX5_OPCODE_CONFIG_CMD = 0x1f,
@@ -249,7 +248,7 @@ struct mlx5_wqe_umr_ctrl_seg {
        uint8_t         flags;
        uint8_t         rsvd0[3];
        uint16_t        klm_octowords;
-       uint16_t        bsf_octowords;
+       uint16_t        translation_offset;
        uint64_t        mkey_mask;
        uint8_t         rsvd1[32];
 };
@@ -571,6 +570,7 @@ struct mlx5_wq {
        volatile uint32_t              *db;
        int                             wqe_shift;
        int                             offset;
+       uint32_t                        *wr_data;
 };
 
 
@@ -640,6 +640,7 @@ struct mlx5_qp {
 struct mlx5_ah {
        struct ibv_ah                   ibv_ah;
        struct mlx5_wqe_av              av;
+       int                             kern_ah;
 };
 
 
index 6a8d7cc..342d052 100644 (file)
@@ -41,6 +41,7 @@
 #include <stddef.h>
 #include <errno.h>
 #include <infiniband/ofa_verbs.h>
+#include <string.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -124,7 +125,11 @@ enum ibv_device_cap_flags {
        IBV_DEVICE_RC_RNR_NAK_GEN       = 1 << 12,
        IBV_DEVICE_SRQ_RESIZE           = 1 << 13,
        IBV_DEVICE_N_NOTIFY_CQ          = 1 << 14,
+       IBV_DEVICE_MEM_WINDOW           = 1 << 17,
        IBV_DEVICE_XRC                  = 1 << 20,
+       IBV_DEVICE_MEM_MGT_EXTENSIONS   = 1 << 21,
+       IBV_DEVICE_MEM_WINDOW_TYPE_2A   = 1 << 23,
+       IBV_DEVICE_MEM_WINDOW_TYPE_2B   = 1 << 24,
        IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
 };
 
@@ -145,7 +150,7 @@ struct ibv_device_attr {
        uint32_t                hw_ver;
        int                     max_qp;
        int                     max_qp_wr;
-       int                     device_cap_flags;
+       uint32_t                device_cap_flags;
        int                     max_sge;
        int                     max_sge_rd;
        int                     max_cq;
@@ -177,6 +182,39 @@ struct ibv_device_attr {
        uint8_t                 phys_port_cnt;
 };
 
+/* An extensible input struct for possible future extensions of the
+ * ibv_query_device_ex verb. */
+struct ibv_query_device_ex_input {
+       uint32_t                comp_mask;
+};
+
+enum ibv_odp_transport_cap_bits {
+       IBV_ODP_SUPPORT_SEND     = 1 << 0,
+       IBV_ODP_SUPPORT_RECV     = 1 << 1,
+       IBV_ODP_SUPPORT_WRITE    = 1 << 2,
+       IBV_ODP_SUPPORT_READ     = 1 << 3,
+       IBV_ODP_SUPPORT_ATOMIC   = 1 << 4,
+};
+
+struct ibv_odp_caps {
+       uint64_t general_caps;
+       struct {
+               uint32_t rc_odp_caps;
+               uint32_t uc_odp_caps;
+               uint32_t ud_odp_caps;
+       } per_transport_caps;
+};
+
+enum ibv_odp_general_caps {
+       IBV_ODP_SUPPORT = 1 << 0,
+};
+
+struct ibv_device_attr_ex {
+       struct ibv_device_attr  orig_attr;
+       uint32_t                comp_mask;
+       struct ibv_odp_caps     odp_caps;
+};
+
 enum ibv_mtu {
        IBV_MTU_256  = 1,
        IBV_MTU_512  = 2,
@@ -327,6 +365,7 @@ enum ibv_wc_opcode {
        IBV_WC_COMP_SWAP,
        IBV_WC_FETCH_ADD,
        IBV_WC_BIND_MW,
+       IBV_WC_LOCAL_INV,
 /*
  * Set value of IBV_WC_RECV so consumers can test if a completion is a
  * receive by testing (opcode & IBV_WC_RECV).
@@ -337,7 +376,8 @@ enum ibv_wc_opcode {
 
 enum ibv_wc_flags {
        IBV_WC_GRH              = 1 << 0,
-       IBV_WC_WITH_IMM         = 1 << 1
+       IBV_WC_WITH_IMM         = 1 << 1,
+       IBV_WC_WITH_INV         = 1 << 3
 };
 
 struct ibv_wc {
@@ -346,7 +386,10 @@ struct ibv_wc {
        enum ibv_wc_opcode      opcode;
        uint32_t                vendor_err;
        uint32_t                byte_len;
-       uint32_t                imm_data;       /* in network byte order */
+       /* When (wc_flags & IBV_WC_WITH_IMM): Immediate data in network byte order.
+        * When (wc_flags & IBV_WC_WITH_INV): Stores the invalidated rkey.
+        */
+       uint32_t                imm_data;
        uint32_t                qp_num;
        uint32_t                src_qp;
        int                     wc_flags;
@@ -361,7 +404,16 @@ enum ibv_access_flags {
        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_MW_BIND              = (1<<4),
+       IBV_ACCESS_ZERO_BASED           = (1<<5),
+       IBV_ACCESS_ON_DEMAND            = (1<<6),
+};
+
+struct ibv_mw_bind_info {
+       struct ibv_mr   *mr;
+       uint64_t         addr;
+       uint64_t         length;
+       int              mw_access_flags; /* use ibv_access_flags */
 };
 
 struct ibv_pd {
@@ -389,7 +441,8 @@ enum ibv_rereg_mr_flags {
        IBV_REREG_MR_CHANGE_TRANSLATION = (1 << 0),
        IBV_REREG_MR_CHANGE_PD          = (1 << 1),
        IBV_REREG_MR_CHANGE_ACCESS      = (1 << 2),
-       IBV_REREG_MR_KEEP_VALID         = (1 << 3)
+       IBV_REREG_MR_KEEP_VALID         = (1 << 3),
+       IBV_REREG_MR_FLAGS_SUPPORTED    = ((IBV_REREG_MR_KEEP_VALID << 1) - 1)
 };
 
 struct ibv_mr {
@@ -411,6 +464,8 @@ struct ibv_mw {
        struct ibv_context     *context;
        struct ibv_pd          *pd;
        uint32_t                rkey;
+       uint32_t                handle;
+       enum ibv_mw_type        type;
 };
 
 struct ibv_global_route {
@@ -678,7 +733,10 @@ enum ibv_wr_opcode {
        IBV_WR_SEND_WITH_IMM,
        IBV_WR_RDMA_READ,
        IBV_WR_ATOMIC_CMP_AND_SWP,
-       IBV_WR_ATOMIC_FETCH_AND_ADD
+       IBV_WR_ATOMIC_FETCH_AND_ADD,
+       IBV_WR_LOCAL_INV,
+       IBV_WR_BIND_MW,
+       IBV_WR_SEND_WITH_INV,
 };
 
 enum ibv_send_flags {
@@ -728,6 +786,11 @@ struct ibv_send_wr {
 
                uint32_t                xrc_remote_srq_num;
        };
+       struct {
+               struct ibv_mw   *mw;
+               uint32_t                rkey;
+               struct ibv_mw_bind_info bind_info;
+       } bind_mw;
 };
 
 struct ibv_recv_wr {
@@ -739,11 +802,8 @@ struct ibv_recv_wr {
 
 struct ibv_mw_bind {
        uint64_t                wr_id;
-       struct ibv_mr          *mr;
-       void                   *addr;
-       size_t                  length;
        int                     send_flags;
-       int                     mw_access_flags;
+       struct ibv_mw_bind_info bind_info;
 };
 
 struct ibv_srq {
@@ -964,7 +1024,7 @@ struct ibv_context_ops {
        int                     (*dealloc_pd)(struct ibv_pd *pd);
        struct ibv_mr *         (*reg_mr)(struct ibv_pd *pd, void *addr, size_t length,
                                          int access);
-       struct ibv_mr *         (*rereg_mr)(struct ibv_mr *mr,
+       int                     (*rereg_mr)(struct ibv_mr *mr,
                                            int flags,
                                            struct ibv_pd *pd, void *addr,
                                            size_t length,
@@ -1032,6 +1092,10 @@ enum verbs_context_mask {
 };
 
 struct verbs_context {
+       int (*query_device_ex)(struct ibv_context *context,
+                      const struct ibv_query_device_ex_input *input,
+                      struct ibv_device_attr_ex *attr,
+                      size_t attr_size);
        /*  "grows up" - new fields go here */
        int (*_reserved_2) (void);
        int (*destroy_flow) (struct ibv_flow *flow);
@@ -1234,6 +1298,26 @@ static inline int ibv_close_xrcd(struct ibv_xrcd *xrcd)
 struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr,
                          size_t length, int access);
 
+
+enum ibv_rereg_mr_err_code {
+       /* Old MR is valid, invalid input */
+       IBV_REREG_MR_ERR_INPUT = -1,
+       /* Old MR is valid, failed via dont fork on new address range */
+       IBV_REREG_MR_ERR_DONT_FORK_NEW = -2,
+       /* New MR is valid, failed via do fork on old address range */
+       IBV_REREG_MR_ERR_DO_FORK_OLD = -3,
+       /* MR shouldn't be used, command error */
+       IBV_REREG_MR_ERR_CMD = -4,
+       /* MR shouldn't be used, command error, invalid fork state on new address range */
+       IBV_REREG_MR_ERR_CMD_AND_DO_FORK_NEW = -5,
+};
+
+/**
+ * ibv_rereg_mr - Re-Register a memory region
+ */
+int ibv_rereg_mr(struct ibv_mr *mr, int flags,
+                struct ibv_pd *pd, void *addr,
+                size_t length, int access);
 /**
  * ibv_dereg_mr - Deregister a memory region
  */
@@ -1243,18 +1327,16 @@ int ibv_dereg_mr(struct ibv_mr *mr);
  * ibv_alloc_mw - Allocate a memory window
  */
 static inline struct ibv_mw *ibv_alloc_mw(struct ibv_pd *pd,
-               enum ibv_mw_type type)
+                                         enum ibv_mw_type type)
 {
+       struct ibv_mw *mw;
+
        if (!pd->context->ops.alloc_mw) {
                errno = ENOSYS;
                return NULL;
        }
 
-       struct ibv_mw *mw = pd->context->ops.alloc_mw(pd, type);
-       if (mw) {
-               mw->context = pd->context;
-               mw->pd      = pd;
-       }
+       mw = pd->context->ops.alloc_mw(pd, type);
        return mw;
 }
 
@@ -1267,15 +1349,28 @@ static inline int ibv_dealloc_mw(struct ibv_mw *mw)
 }
 
 /**
- * ibv_inc_rkey - increase the 8 lsb in the given rkey
+ * ibv_inc_rkey - Increase the 8 lsb in the given rkey
  */
 static inline uint32_t ibv_inc_rkey(uint32_t rkey)
 {
        const uint32_t mask = 0x000000ff;
-       uint8_t newtag = (uint8_t) ((rkey + 1) & mask);
+       uint8_t newtag = (uint8_t)((rkey + 1) & mask);
+
        return (rkey & ~mask) | newtag;
 }
 
+/**
+ * ibv_bind_mw - Bind a memory window to a region
+ */
+static inline int ibv_bind_mw(struct ibv_qp *qp, struct ibv_mw *mw,
+                             struct ibv_mw_bind *mw_bind)
+{
+       if (mw->type != IBV_MW_TYPE_1)
+               return EINVAL;
+
+       return mw->context->ops.bind_mw(qp, mw, mw_bind);
+}
+
 /**
  * ibv_create_comp_channel - Create a completion event channel
  */
@@ -1488,6 +1583,33 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini
        return vctx->create_qp_ex(context, qp_init_attr_ex);
 }
 
+/**
+ * ibv_query_device_ex - Get extended device properties
+ */
+static inline int
+ibv_query_device_ex(struct ibv_context *context,
+                   const struct ibv_query_device_ex_input *input,
+                   struct ibv_device_attr_ex *attr)
+{
+       struct verbs_context *vctx;
+       int ret;
+
+       vctx = verbs_get_ctx_op(context, query_device_ex);
+       if (!vctx)
+               goto legacy;
+
+       ret = vctx->query_device_ex(context, input, attr, sizeof(*attr));
+       if (ret == ENOSYS)
+               goto legacy;
+
+       return ret;
+
+legacy:
+       memset(attr, 0, sizeof(*attr));
+       ret = ibv_query_device(context, &attr->orig_attr);
+       return ret;
+}
+
 /**
  * ibv_open_qp - Open a shareable queue pair.
  */
index ae94deb..9fef818 100644 (file)
@@ -165,8 +165,9 @@ enum ibv_exp_device_attr_comp_mask {
        IBV_EXP_DEVICE_ATTR_RX_PAD_END_ALIGN    = (1 << 20),
        IBV_EXP_DEVICE_ATTR_TSO_CAPS            = (1 << 21),
        IBV_EXP_DEVICE_ATTR_PACKET_PACING_CAPS  = (1 << 22),
+       IBV_EXP_DEVICE_ATTR_EC_GF_BASE          = (1 << 23),
        /* set supported bits for validity check */
-       IBV_EXP_DEVICE_ATTR_RESERVED            = (1 << 23),
+       IBV_EXP_DEVICE_ATTR_RESERVED            = (1 << 24),
 };
 
 struct ibv_exp_device_calc_cap {
@@ -197,7 +198,7 @@ enum ibv_odp_general_cap_bits {
        IBV_EXP_ODP_SUPPORT = 1 << 0,
 };
 
-enum ibv_odp_transport_cap_bits {
+enum ibv_exp_odp_transport_cap_bits {
        IBV_EXP_ODP_SUPPORT_SEND     = 1 << 0,
        IBV_EXP_ODP_SUPPORT_RECV     = 1 << 1,
        IBV_EXP_ODP_SUPPORT_WRITE    = 1 << 2,
@@ -349,6 +350,11 @@ struct ibv_exp_device_attr {
        int                     rx_pad_end_addr_align;
        struct ibv_exp_tso_caps tso_caps;
        struct ibv_exp_packet_pacing_caps packet_pacing_caps;
+       uint32_t ec_w_mask;
+};
+
+enum {
+       IBV_EXP_ACCESS_FLAGS_SHIFT = 0x0F
 };
 
 enum ibv_exp_access_flags {
@@ -428,10 +434,10 @@ enum ibv_exp_wr_opcode {
        IBV_EXP_WR_RDMA_READ            = IBV_WR_RDMA_READ,
        IBV_EXP_WR_ATOMIC_CMP_AND_SWP   = IBV_WR_ATOMIC_CMP_AND_SWP,
        IBV_EXP_WR_ATOMIC_FETCH_AND_ADD = IBV_WR_ATOMIC_FETCH_AND_ADD,
+       IBV_EXP_WR_LOCAL_INV            = IBV_WR_LOCAL_INV,
+       IBV_EXP_WR_BIND_MW              = IBV_WR_BIND_MW,
+       IBV_EXP_WR_SEND_WITH_INV        = IBV_WR_SEND_WITH_INV,
 
-       IBV_EXP_WR_SEND_WITH_INV        = 8 + IBV_EXP_START_ENUM,
-       IBV_EXP_WR_LOCAL_INV            = 10 + IBV_EXP_START_ENUM,
-       IBV_EXP_WR_BIND_MW              = 14 + IBV_EXP_START_ENUM,
        IBV_EXP_WR_TSO                  = 15 + IBV_EXP_START_ENUM,
        IBV_EXP_WR_SEND_ENABLE          = 0x20 + IBV_EXP_START_ENUM,
        IBV_EXP_WR_RECV_ENABLE,
@@ -1083,22 +1089,6 @@ struct ibv_exp_cq_attr {
        uint32_t                cq_cap_flags;
 };
 
-enum ibv_exp_rereg_mr_flags {
-       IBV_EXP_REREG_MR_CHANGE_TRANSLATION     = IBV_REREG_MR_CHANGE_TRANSLATION,
-       IBV_EXP_REREG_MR_CHANGE_PD              = IBV_REREG_MR_CHANGE_PD,
-       IBV_EXP_REREG_MR_CHANGE_ACCESS          = IBV_REREG_MR_CHANGE_ACCESS,
-       IBV_EXP_REREG_MR_KEEP_VALID             = IBV_REREG_MR_KEEP_VALID,
-       IBV_EXP_REREG_MR_FLAGS_SUPPORTED        = ((IBV_EXP_REREG_MR_KEEP_VALID << 1) - 1)
-};
-
-enum ibv_exp_rereg_mr_attr_mask {
-       IBV_EXP_REREG_MR_ATTR_RESERVED          = (1 << 0)
-};
-
-struct ibv_exp_rereg_mr_attr {
-       uint32_t        comp_mask;  /* use ibv_exp_rereg_mr_attr_mask */
-};
-
 /*
  * Flags for ibv_exp_reg_shared_mr_in struct comp_mask
  */
@@ -1317,7 +1307,7 @@ enum ibv_exp_wc_opcode {
        IBV_EXP_WC_COMP_SWAP,
        IBV_EXP_WC_FETCH_ADD,
        IBV_EXP_WC_BIND_MW,
-       IBV_EXP_WC_LOCAL_INV            =       7,
+       IBV_EXP_WC_LOCAL_INV,
        IBV_EXP_WC_MASKED_COMP_SWAP     =       9,
        IBV_EXP_WC_MASKED_FETCH_ADD     =       10,
        IBV_EXP_WC_TSO,
@@ -1333,8 +1323,8 @@ enum ibv_exp_wc_opcode {
 enum ibv_exp_wc_flags {
        IBV_EXP_WC_GRH          = IBV_WC_GRH,
        IBV_EXP_WC_WITH_IMM     = IBV_WC_WITH_IMM,
+       IBV_EXP_WC_WITH_INV     = IBV_WC_WITH_INV,
 
-       IBV_EXP_WC_WITH_INV                     = IBV_EXP_START_FLAG << 2,
        IBV_EXP_WC_WITH_SL                      = IBV_EXP_START_FLAG << 4,
        IBV_EXP_WC_WITH_SLID                    = IBV_EXP_START_FLAG << 5,
        IBV_EXP_WC_WITH_TIMESTAMP               = IBV_EXP_START_FLAG << 6,
@@ -1515,18 +1505,6 @@ struct ibv_exp_mkey_list_container_attr {
        uint32_t comp_mask; /*use ibv_exp_alloc_mkey_list_comp_mask */
 };
 
-/*
- * Flags for ibv_exp_rereg_out struct comp_mask
- */
-enum ibv_exp_rereg_mr_comp_mask {
-       IBV_EXP_REREG_MR_RESERVED       = (1 << 0)
-};
-
-struct ibv_exp_rereg_out {
-       int need_dofork;
-       uint32_t comp_mask; /* use ibv_exp_rereg_mr_comp_mask */
-};
-
 /*
  * Flags for ibv_exp_dereg_out struct comp_mask
  */
@@ -2218,6 +2196,8 @@ struct ibv_exp_peer_abort_peek;
 
 struct verbs_context_exp {
        /*  "grows up" - new fields go here */
+       struct ibv_ah * (*drv_exp_ibv_create_kah)(struct ibv_pd *pd,
+                                                 struct ibv_exp_ah_attr *attr_exp);
        int (*exp_peer_peek_cq)(struct ibv_cq *ibcq,
                                struct ibv_exp_peer_peek *peek_ctx);
        int (*exp_peer_abort_peek_cq)(struct ibv_cq *ibcq,
@@ -2285,12 +2265,8 @@ struct verbs_context_exp {
                              const char *value, int overwrite);
        struct verbs_environment *venv;
        int (*drv_exp_dereg_mr)(struct ibv_mr *mr, struct ibv_exp_dereg_out *out);
-       int (*exp_rereg_mr)(struct ibv_mr *mr, int flags, struct ibv_pd *pd,
-                           void *addr, size_t length, uint64_t access,
-                           struct ibv_exp_rereg_mr_attr *attr);
-       int (*drv_exp_rereg_mr)(struct ibv_mr *mr, int flags, struct ibv_pd *pd,
-                               void *addr, size_t length, uint64_t access,
-                               struct ibv_exp_rereg_mr_attr *attr, struct ibv_exp_rereg_out *out);
+       void (*ABI_placeholder2)(void);
+       void (*ABI_placeholder1)(void);
        int (*drv_exp_prefetch_mr)(struct ibv_mr *mr,
                                   struct ibv_exp_prefetch_attr *attr);
        int (*lib_exp_prefetch_mr)(struct ibv_mr *mr,
@@ -2368,6 +2344,7 @@ struct verbs_context_exp {
                        /* must be located as last field        */
 };
 
+#define ETHERNET_LL_SIZE 6
 
 static inline struct verbs_context_exp *verbs_get_exp_ctx(struct ibv_context *ctx)
 {
@@ -2955,7 +2932,7 @@ static inline int ibv_exp_query_port(struct ibv_context *context,
                                      &port_attr->port_attr);
 
        /* Check that only valid flags were given */
-       if ((!port_attr->comp_mask & IBV_EXP_QUERY_PORT_ATTR_MASK1) ||
+       if (!(port_attr->comp_mask & IBV_EXP_QUERY_PORT_ATTR_MASK1) ||
            (port_attr->comp_mask & ~IBV_EXP_QUERY_PORT_ATTR_MASKS) ||
            (port_attr->mask1 & ~IBV_EXP_QUERY_PORT_MASK)) {
                errno = EINVAL;
@@ -3356,28 +3333,6 @@ ibv_exp_alloc_mkey_list_memory(struct ibv_exp_mkey_list_container_attr *attr)
        return vctx->lib_exp_alloc_mkey_list_memory(attr);
 }
 
-/**
- * ibv_rereg_mr - Re-Register a memory region
- *
- * For exp_access use ibv_exp_access_flags
- */
-static inline int ibv_exp_rereg_mr(struct ibv_mr *mr, int flags,
-                                  struct ibv_pd *pd, void *addr,
-                                  size_t length, uint64_t exp_access,
-                                  struct ibv_exp_rereg_mr_attr *attr)
-{
-       struct verbs_context_exp *vctx;
-
-       vctx = verbs_get_exp_ctx_op(mr->context, exp_rereg_mr);
-       if (!vctx)
-               return errno = ENOSYS;
-
-       IBV_EXP_RET_EINVAL_ON_INVALID_COMP_MASK(attr->comp_mask,
-                                               IBV_EXP_REREG_MR_ATTR_RESERVED - 1);
-
-       return vctx->exp_rereg_mr(mr, flags, pd, addr, length, exp_access, attr);
-}
-
 /**
  * ibv_exp_create_res_domain - create resource domain
  */
index e62d4c4..3565b61 100644 (file)
Binary files a/external_libs/ibverbs/libibverbs.a and b/external_libs/ibverbs/libibverbs.a differ
diff --git a/external_libs/ibverbs/libibverbs.la b/external_libs/ibverbs/libibverbs.la
deleted file mode 100644 (file)
index 332deb3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# libibverbs.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4.2
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libibverbs.so.1'
-
-# Names of this library.
-library_names='libibverbs.so.1.0.0 libibverbs.so.1 libibverbs.so'
-
-# The name of the static archive.
-old_library='libibverbs.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=' -lnl-route-3 -lnl-3 -lpthread -ldl'
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libibverbs.
-current=1
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=no
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
diff --git a/external_libs/ibverbs/libibverbs.lai b/external_libs/ibverbs/libibverbs.lai
deleted file mode 100644 (file)
index 3580def..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# libibverbs.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4.2
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libibverbs.so.1'
-
-# Names of this library.
-library_names='libibverbs.so.1.0.0 libibverbs.so.1 libibverbs.so'
-
-# The name of the static archive.
-old_library='libibverbs.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=' -lnl-route-3 -lnl-3 -lpthread -ldl'
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libibverbs.
-current=1
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
index bd93569..dbcd20a 100644 (file)
Binary files a/external_libs/ibverbs/libibverbs.so and b/external_libs/ibverbs/libibverbs.so differ
index bd93569..dbcd20a 100644 (file)
Binary files a/external_libs/ibverbs/libibverbs.so.1 and b/external_libs/ibverbs/libibverbs.so.1 differ
index bd93569..dbcd20a 100644 (file)
Binary files a/external_libs/ibverbs/libibverbs.so.1.0.0 and b/external_libs/ibverbs/libibverbs.so.1.0.0 differ
index a55fe6b..190b391 100755 (executable)
@@ -1101,7 +1101,7 @@ files_list=[
             'daemon_server'
             ];
 
-files_dir=['cap2','avl','cfg','ko','automation', 'external_libs', 'python-lib','stl','exp','dumy_libs']
+files_dir=['cap2','avl','cfg','ko','automation', 'external_libs', 'python-lib','stl','exp']
 
 
 class Env(object):
diff --git a/scripts/dumy_libs/libibverbs.so.1 b/scripts/dumy_libs/libibverbs.so.1
deleted file mode 100644 (file)
index bd93569..0000000
Binary files a/scripts/dumy_libs/libibverbs.so.1 and /dev/null differ
diff --git a/scripts/dumy_libs/libnl-3.so.200 b/scripts/dumy_libs/libnl-3.so.200
deleted file mode 100644 (file)
index 9eaaac9..0000000
Binary files a/scripts/dumy_libs/libnl-3.so.200 and /dev/null differ
diff --git a/scripts/dumy_libs/libnl-route-3.so.200 b/scripts/dumy_libs/libnl-route-3.so.200
deleted file mode 100644 (file)
index 9e1835f..0000000
Binary files a/scripts/dumy_libs/libnl-route-3.so.200 and /dev/null differ