[openib-general] [PATCH][1/4] Core QP API
Roland Dreier
roland at topspin.com
Fri Aug 13 10:49:25 PDT 2004
Index: src/linux-kernel/infiniband/include/ib_verbs.h
===================================================================
--- src/linux-kernel/infiniband/include/ib_verbs.h (revision 621)
+++ src/linux-kernel/infiniband/include/ib_verbs.h (working copy)
@@ -112,9 +112,9 @@
u32 byte_len;
u32 imm_data;
u32 qp;
- int pkey_index;
int grh_flag:1;
int imm_data_valid:1;
+ u16 pkey_index;
u16 slid;
u8 sl;
u8 dlid_path_bits;
@@ -125,14 +125,221 @@
IB_CQ_NEXT_COMP
};
-enum ib_mr_access_flags {
- IB_MR_LOCAL_WRITE = 1,
- IB_MR_REMOTE_WRITE = (1<<1),
- IB_MR_REMOTE_READ = (1<<2),
- IB_MR_REMOTE_ATOMIC = (1<<3),
- IB_MR_MW_BIND = (1<<4)
+struct ib_qp_cap {
+ u32 max_send_wr;
+ u32 max_recv_wr;
+ u32 max_send_sge;
+ u32 max_recv_sge;
+ u32 max_inline_data;
};
+enum ib_sig_type {
+ IB_SIGNAL_ALL_WR,
+ IB_SIGNAL_REQ_WR
+};
+
+enum ib_qp_type {
+ IB_QPT_RC,
+ IB_QPT_UC,
+ IB_QPT_UD,
+ IB_QPT_SMI,
+ IB_QPT_GSI,
+ IB_QPT_RAW_IPV6,
+ IB_QPT_RAW_ETY
+};
+
+struct ib_qp_init_attr {
+ void *qp_context;
+ struct ib_cq *send_cq;
+ struct ib_cq *recv_cq;
+ struct ib_srq *srq;
+ struct ib_qp_cap cap;
+ enum ib_sig_type sq_sig_type;
+ enum ib_sig_type rq_sig_type;
+ enum ib_qp_type qp_type;
+ u8 port_num; /* special QP types only */
+};
+
+enum ib_rnr_timeout {
+ IB_RNR_TIMER_655_36 = 0,
+ IB_RNR_TIMER_000_01 = 1,
+ IB_RNR_TIMER_000_02 = 2,
+ IB_RNR_TIMER_000_03 = 3,
+ IB_RNR_TIMER_000_04 = 4,
+ IB_RNR_TIMER_000_06 = 5,
+ IB_RNR_TIMER_000_08 = 6,
+ IB_RNR_TIMER_000_12 = 7,
+ IB_RNR_TIMER_000_16 = 8,
+ IB_RNR_TIMER_000_24 = 9,
+ IB_RNR_TIMER_000_32 = 10,
+ IB_RNR_TIMER_000_48 = 11,
+ IB_RNR_TIMER_000_64 = 12,
+ IB_RNR_TIMER_000_96 = 13,
+ IB_RNR_TIMER_001_28 = 14,
+ IB_RNR_TIMER_001_92 = 15,
+ IB_RNR_TIMER_002_56 = 16,
+ IB_RNR_TIMER_003_84 = 17,
+ IB_RNR_TIMER_005_12 = 18,
+ IB_RNR_TIMER_007_68 = 19,
+ IB_RNR_TIMER_010_24 = 20,
+ IB_RNR_TIMER_015_36 = 21,
+ IB_RNR_TIMER_020_48 = 22,
+ IB_RNR_TIMER_030_72 = 23,
+ IB_RNR_TIMER_040_96 = 24,
+ IB_RNR_TIMER_061_44 = 25,
+ IB_RNR_TIMER_081_92 = 26,
+ IB_RNR_TIMER_122_88 = 27,
+ IB_RNR_TIMER_163_84 = 28,
+ IB_RNR_TIMER_245_76 = 29,
+ IB_RNR_TIMER_327_68 = 30,
+ IB_RNR_TIMER_491_52 = 31
+};
+
+enum ib_qp_attr_mask {
+ IB_QP_STATE = 1,
+ IB_QP_EN_SQD_ASYNC_NOTIFY = (1<<1),
+ IB_QP_ACCESS_FLAGS = (1<<3),
+ IB_QP_PKEY_INDEX = (1<<4),
+ IB_QP_PORT = (1<<5),
+ IB_QP_QKEY = (1<<6),
+ IB_QP_AV = (1<<7),
+ IB_QP_PATH_MTU = (1<<8),
+ IB_QP_TIMEOUT = (1<<9),
+ IB_QP_RETRY_CNT = (1<<10),
+ IB_QP_RNR_RETRY = (1<<11),
+ IB_QP_RQ_PSN = (1<<12),
+ IB_QP_MAX_QP_RD_ATOMIC = (1<<13),
+ IB_QP_ALT_PATH = (1<<14),
+ IB_QP_MIN_RNR_TIMER = (1<<15),
+ IB_QP_SQ_PSN = (1<<16),
+ IB_QP_MAX_DEST_RD_ATOMIC = (1<<17),
+ IB_QP_PATH_MIG_STATE = (1<<18),
+ IB_QP_CAP = (1<<19),
+ IB_QP_DEST_QPN = (1<<20)
+};
+
+enum ib_qp_state {
+ IB_QPS_RESET,
+ IB_QPS_INIT,
+ IB_QPS_RTR,
+ IB_QPS_RTS,
+ IB_QPS_SQD,
+ IB_QPS_SQE,
+ IB_QPS_ERR
+};
+
+enum ib_mtu {
+ IB_MTU_256 = 1,
+ IB_MTU_512 = 2,
+ IB_MTU_1024 = 3,
+ IB_MTU_2048 = 4,
+ IB_MTU_4096 = 5
+};
+
+enum ib_mig_state {
+ IB_MIG_MIGRATED,
+ IB_MIG_REARM,
+ IB_MIG_ARMED
+};
+
+struct ib_qp_attr {
+ enum ib_qp_state qp_state;
+ enum ib_mtu path_mtu;
+ enum ib_mig_state path_mig_state;
+ u32 qkey;
+ u32 rq_psn;
+ u32 sq_psn;
+ u32 dest_qp_num;
+ int qp_access_flags;
+ struct ib_qp_cap cap;
+ struct ib_ah_attr ah_attr;
+ struct ib_ah_attr alt_ah_attr;
+ u16 pkey_index;
+ u16 alt_pkey_index;
+ u8 en_sqd_async_notify;
+ u8 sq_draining;
+ u8 max_rd_atomic;
+ u8 max_dest_rd_atomic;
+ u8 min_rnr_timer;
+ u8 port;
+ u8 timeout;
+ u8 retry_cnt;
+ u8 rnr_retry;
+ u8 alt_port;
+ u8 alt_timeout;
+};
+
+enum ib_wr_opcode {
+ IB_WR_RDMA_WRITE,
+ IB_WR_RDMA_WRITE_WITH_IMM,
+ IB_WR_SEND,
+ IB_WR_SEND_WITH_IMM,
+ IB_WR_RDMA_READ,
+ IB_WR_ATOMIC_CMP_AND_SWP,
+ IB_WR_ATOMIC_FETCH_AND_ADD
+};
+
+enum ib_send_flags {
+ IB_SEND_FENCE = 1,
+ IB_SEND_SIGNALED = (1<<1),
+ IB_SEND_SOLICITED = (1<<2),
+ IB_SEND_INLINE = (1<<3)
+};
+
+enum ib_recv_flags {
+ IB_RECV_SIGNALED = 1
+};
+
+struct ib_sge {
+ u64 addr;
+ u32 length;
+ u32 lkey;
+};
+
+struct ib_send_wr {
+ struct ib_send_wr *next;
+ u64 wr_id;
+ struct ib_sge *sg_list;
+ int num_sge;
+ enum ib_wr_opcode opcode;
+ int send_flags;
+ u32 imm_data;
+ union {
+ struct {
+ u64 remote_addr;
+ u32 rkey;
+ } rdma;
+ struct {
+ u64 remote_addr;
+ u64 compare_add;
+ u64 swap;
+ u32 rkey;
+ } atomic;
+ struct {
+ struct ib_ah *ah;
+ u32 remote_qpn;
+ u32 remote_qkey;
+ u16 pkey_index; /* valid for GSI only */
+ } ud;
+ } wr;
+};
+
+struct ib_recv_wr {
+ struct ib_recv_wr *next;
+ u64 wr_id;
+ struct ib_sge *sg_list;
+ int num_sge;
+ int recv_flags;
+};
+
+enum ib_access_flags {
+ IB_ACCESS_LOCAL_WRITE = 1,
+ IB_ACCESS_REMOTE_WRITE = (1<<1),
+ IB_ACCESS_REMOTE_READ = (1<<2),
+ IB_ACCESS_REMOTE_ATOMIC = (1<<3),
+ IB_ACCESS_MW_BIND = (1<<4)
+};
+
struct ib_phys_buf {
u64 addr;
u64 size;
@@ -153,7 +360,14 @@
IB_MR_REREG_ACCESS = (1<<2)
};
-struct ib_mw_bind;
+struct ib_mw_bind {
+ struct ib_mr *mr;
+ u64 wr_id;
+ u64 addr;
+ u32 length;
+ int send_flags;
+ int mw_access_flags;
+};
struct ib_pd {
struct ib_device *device;
@@ -175,6 +389,15 @@
atomic_t usecnt; /* count number of work queues */
};
+struct ib_qp {
+ struct ib_device *device;
+ struct ib_pd *pd;
+ struct ib_cq *send_cq;
+ struct ib_cq *recv_cq;
+ void *qp_context;
+ u32 qp_num;
+};
+
struct ib_mr {
struct ib_device *device;
struct ib_pd *pd;
@@ -218,13 +441,24 @@
int (*query_ah)(struct ib_ah *ah,
struct ib_ah_attr *ah_attr);
int (*destroy_ah)(struct ib_ah *ah);
- ib_qp_create_func qp_create;
- ib_special_qp_create_func special_qp_create;
- ib_qp_modify_func qp_modify;
- ib_qp_query_func qp_query;
- ib_qp_destroy_func qp_destroy;
- ib_send_post_func send_post;
- ib_receive_post_func receive_post;
+ struct ib_qp * (*create_qp)(struct ib_pd *pd,
+ struct ib_qp_init_attr *qp_init_attr,
+ struct ib_qp_cap *qp_cap);
+ int (*modify_qp)(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_cap *qp_cap);
+ int (*query_qp)(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_init_attr *qp_init_attr);
+ int (*destroy_qp)(struct ib_qp *qp);
+ int (*post_send)(struct ib_qp *qp,
+ struct ib_send_wr *send_wr,
+ struct ib_send_wr **bad_send_wr);
+ int (*post_recv)(struct ib_qp *qp,
+ struct ib_recv_wr *recv_wr,
+ struct ib_recv_wr **bad_recv_wr);
struct ib_cq * (*create_cq)(struct ib_device *device,
int *cqe);
int (*destroy_cq)(struct ib_cq *cq);
@@ -279,6 +513,36 @@
int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
int ib_destroy_ah(struct ib_ah *ah);
+struct ib_qp *ib_create_qp(struct ib_pd *pd,
+ struct ib_qp_init_attr *qp_init_attr,
+ struct ib_qp_cap *qp_cap);
+
+int ib_modify_qp(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_cap *qp_cap);
+
+int ib_query_qp(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_init_attr *qp_init_attr);
+
+int ib_destroy_qp(struct ib_qp *qp);
+
+static inline int ib_post_send(struct ib_qp *qp,
+ struct ib_send_wr *send_wr,
+ struct ib_send_wr **bad_send_wr)
+{
+ return qp->device->post_send(qp, send_wr, bad_send_wr);
+}
+
+static inline int ib_post_recv(struct ib_qp *qp,
+ struct ib_recv_wr *recv_wr,
+ struct ib_recv_wr **bad_recv_wr)
+{
+ return qp->device->post_recv(qp, recv_wr, bad_recv_wr);
+}
+
struct ib_cq *ib_create_cq(struct ib_device *device,
ib_comp_handler comp_handler,
void *cq_context, int cqe);
Index: src/linux-kernel/infiniband/include/ts_ib_core.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core.h (revision 621)
+++ src/linux-kernel/infiniband/include/ts_ib_core.h (working copy)
@@ -63,36 +63,6 @@
int index,
tTS_IB_GID gid);
-int ib_qp_create(struct ib_qp_create_param *param,
- struct ib_qp **qp,
- u32 *qpn);
-int ib_special_qp_create(struct ib_qp_create_param *param,
- tTS_IB_PORT port,
- enum ib_special_qp_type qp_type,
- struct ib_qp **qp);
-int ib_qp_modify(struct ib_qp *qp,
- struct ib_qp_attribute *attr);
-int ib_qp_query(struct ib_qp *qp,
- struct ib_qp_attribute *attr);
-int ib_qp_query_qpn(struct ib_qp *qp,
- u32 *qpn);
-int ib_qp_destroy(struct ib_qp *qp);
-
-static inline int ib_send(struct ib_qp *qp,
- struct ib_send_param *param,
- int num_work_requests)
-{
- IB_CHECK_MAGIC(qp, QP);
- return qp->device->send_post(qp, param, num_work_requests);
-}
-static inline int ib_receive(struct ib_qp *qp,
- struct ib_receive_param *param,
- int num_work_requests)
-{
- IB_CHECK_MAGIC(qp, QP);
- return qp->device->receive_post(qp, param, num_work_requests);
-}
-
int ib_fmr_pool_create(struct ib_pd *pd,
struct ib_fmr_pool_param *params,
struct ib_fmr_pool **pool);
@@ -140,7 +110,7 @@
int ib_cached_pkey_find(struct ib_device *device,
tTS_IB_PORT port,
u16 pkey,
- int *index);
+ u16 *index);
#endif /* _TS_IB_CORE_H */
Index: src/linux-kernel/infiniband/include/ts_ib_core_types.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core_types.h (revision 621)
+++ src/linux-kernel/infiniband/include/ts_ib_core_types.h (working copy)
@@ -52,14 +52,6 @@
struct ib_device;
-enum ib_mtu {
- IB_MTU_256 = 1,
- IB_MTU_512 = 2,
- IB_MTU_1024 = 3,
- IB_MTU_2048 = 4,
- IB_MTU_4096 = 5
-};
-
enum ib_port_state {
IB_PORT_STATE_NOP = 0,
IB_PORT_STATE_DOWN = 1,
@@ -76,7 +68,7 @@
};
struct ib_port_properties {
- enum ib_mtu max_mtu;
+ int max_mtu;
__u32 max_message_size;
__u16 lid;
__u8 lmc;
@@ -130,7 +122,7 @@
__u8 tclass;
__u16 pkey;
tTS_IB_SL sl;
- enum ib_mtu mtu;
+ int mtu;
enum ib_rate rate;
__u8 packet_life;
__u8 preference;
@@ -199,18 +191,6 @@
#ifdef __KERNEL__
-enum ib_op {
- IB_OP_RECEIVE,
- IB_OP_SEND,
- IB_OP_SEND_IMMEDIATE,
- IB_OP_RDMA_WRITE,
- IB_OP_RDMA_WRITE_IMMEDIATE,
- IB_OP_RDMA_READ,
- IB_OP_COMPARE_SWAP,
- IB_OP_FETCH_ADD,
- IB_OP_MEMORY_WINDOW_BIND
-};
-
enum ib_async_event {
IB_QP_PATH_MIGRATED,
IB_EEC_PATH_MIGRATED,
@@ -237,17 +217,8 @@
int dead;
};
-struct ib_qp {
- IB_DECLARE_MAGIC
- struct ib_device *device;
- u32 qpn;
- struct ib_async_obj async_obj;
- struct list_head async_handler_list;
- spinlock_t async_handler_lock;
- void *private;
-};
-
struct ib_fmr_pool; /* actual definition in core_fmr.c */
+struct ib_pd;
struct ib_fmr {
IB_DECLARE_MAGIC
@@ -296,110 +267,11 @@
IB_STATIC_RATE_12X_TO_1X = 11
};
-enum ib_rnr_timeout {
- IB_RNR_TIMER_655_36 = 0,
- IB_RNR_TIMER_000_01 = 1,
- IB_RNR_TIMER_000_02 = 2,
- IB_RNR_TIMER_000_03 = 3,
- IB_RNR_TIMER_000_04 = 4,
- IB_RNR_TIMER_000_06 = 5,
- IB_RNR_TIMER_000_08 = 6,
- IB_RNR_TIMER_000_12 = 7,
- IB_RNR_TIMER_000_16 = 8,
- IB_RNR_TIMER_000_24 = 9,
- IB_RNR_TIMER_000_32 = 10,
- IB_RNR_TIMER_000_48 = 11,
- IB_RNR_TIMER_000_64 = 12,
- IB_RNR_TIMER_000_96 = 13,
- IB_RNR_TIMER_001_28 = 14,
- IB_RNR_TIMER_001_92 = 15,
- IB_RNR_TIMER_002_56 = 16,
- IB_RNR_TIMER_003_84 = 17,
- IB_RNR_TIMER_005_12 = 18,
- IB_RNR_TIMER_007_68 = 19,
- IB_RNR_TIMER_010_24 = 20,
- IB_RNR_TIMER_015_36 = 21,
- IB_RNR_TIMER_020_48 = 22,
- IB_RNR_TIMER_030_72 = 23,
- IB_RNR_TIMER_040_96 = 24,
- IB_RNR_TIMER_061_44 = 25,
- IB_RNR_TIMER_081_92 = 26,
- IB_RNR_TIMER_122_88 = 27,
- IB_RNR_TIMER_163_84 = 28,
- IB_RNR_TIMER_245_76 = 29,
- IB_RNR_TIMER_327_68 = 30,
- IB_RNR_TIMER_491_52 = 31
-};
-
enum ib_device_properties_mask {
IB_DEVICE_SYSTEM_IMAGE_GUID = 1 << 0
};
-enum ib_transport {
- IB_TRANSPORT_RC = 0,
- IB_TRANSPORT_UC = 1,
- IB_TRANSPORT_RD = 2,
- IB_TRANSPORT_UD = 3,
-};
-
-enum ib_special_qp_type {
- IB_SMI_QP,
- IB_GSI_QP,
- IB_RAW_IPV6_QP,
- IB_RAW_ETHERTYPE_QP
-};
-
-enum ib_wq_signal_policy {
- IB_WQ_SIGNAL_ALL,
- IB_WQ_SIGNAL_SELECTABLE
-};
-
-enum ib_qp_state {
- IB_QP_STATE_RESET,
- IB_QP_STATE_INIT,
- IB_QP_STATE_RTR,
- IB_QP_STATE_RTS,
- IB_QP_STATE_SQD,
- IB_QP_STATE_SQE,
- IB_QP_STATE_ERROR
-};
-
-enum ib_migration_state {
- IB_MIGRATED,
- IB_REARM,
- IB_ARMED
-};
-
-enum ib_qp_attribute_mask {
- IB_QP_ATTRIBUTE_STATE = 1 << 0,
- IB_QP_ATTRIBUTE_SEND_PSN = 1 << 1,
- IB_QP_ATTRIBUTE_RECEIVE_PSN = 1 << 2,
- IB_QP_ATTRIBUTE_DESTINATION_QPN = 1 << 3,
- IB_QP_ATTRIBUTE_QKEY = 1 << 4,
- IB_QP_ATTRIBUTE_PATH_MTU = 1 << 5,
- IB_QP_ATTRIBUTE_MIGRATION_STATE = 1 << 6,
- IB_QP_ATTRIBUTE_INITIATOR_DEPTH = 1 << 7,
- IB_QP_ATTRIBUTE_RESPONDER_RESOURCES = 1 << 8,
- IB_QP_ATTRIBUTE_RETRY_COUNT = 1 << 9,
- IB_QP_ATTRIBUTE_RNR_RETRY_COUNT = 1 << 10,
- IB_QP_ATTRIBUTE_RNR_TIMEOUT = 1 << 11,
- IB_QP_ATTRIBUTE_PKEY_INDEX = 1 << 12,
- IB_QP_ATTRIBUTE_PORT = 1 << 13,
- IB_QP_ATTRIBUTE_ADDRESS = 1 << 14,
- IB_QP_ATTRIBUTE_LOCAL_ACK_TIMEOUT = 1 << 15,
- IB_QP_ATTRIBUTE_ALT_PKEY_INDEX = 1 << 16,
- IB_QP_ATTRIBUTE_ALT_PORT = 1 << 17,
- IB_QP_ATTRIBUTE_ALT_ADDRESS = 1 << 18,
- IB_QP_ATTRIBUTE_ALT_LOCAL_ACK_TIMEOUT = 1 << 19,
- IB_QP_ATTRIBUTE_RDMA_ATOMIC_ENABLE = 1 << 20,
- IB_QP_ATTRIBUTE_SQD_ASYNC_EVENT_ENABLE = 1 << 21
-};
-
enum ib_memory_access {
- IB_ACCESS_LOCAL_WRITE = 1 << 0,
- IB_ACCESS_REMOTE_WRITE = 1 << 1,
- IB_ACCESS_REMOTE_READ = 1 << 2,
- IB_ACCESS_REMOTE_ATOMIC = 1 << 3,
IB_ACCESS_ENABLE_WINDOW = 1 << 4
};
@@ -422,107 +294,6 @@
tTS_IB_GUID system_image_guid;
};
-struct ib_address_vector {
- int service_level;
- enum ib_static_rate static_rate;
- int source_path_bits;
- u16 dlid;
- tTS_IB_PORT port;
- u32 flow_label;
- int source_gid_index;
- u8 hop_limit;
- u8 traffic_class;
- tTS_IB_GID dgid;
- int use_grh:1;
-};
-
-struct ib_qp_limit {
- int max_outstanding_send_request;
- int max_outstanding_receive_request;
- int max_send_gather_element;
- int max_receive_scatter_element;
-};
-
-struct ib_qp_create_param {
- struct ib_qp_limit limit;
- struct ib_pd *pd;
- struct ib_cq *send_queue;
- struct ib_cq *receive_queue;
- enum ib_wq_signal_policy send_policy;
- enum ib_wq_signal_policy receive_policy;
- struct ib_rdd *rd_domain;
- enum ib_transport transport;
- void *device_specific;
-};
-
-struct ib_qp_attribute {
- enum ib_qp_attribute_mask valid_fields;
- enum ib_qp_state state;
- tTS_IB_PSN send_psn;
- tTS_IB_PSN receive_psn;
- u32 destination_qpn;
- u32 qkey;
- enum ib_mtu path_mtu;
- enum ib_migration_state migration_state;
- int initiator_depth;
- int responder_resources;
- u8 retry_count;
- u8 rnr_retry_count;
- enum ib_rnr_timeout rnr_timeout;
- int pkey_index;
- tTS_IB_PORT port;
- struct ib_address_vector address;
- u8 local_ack_timeout;
- int alt_pkey_index;
- tTS_IB_PORT alt_port;
- struct ib_address_vector alt_address;
- u8 alt_local_ack_timeout;
- int enable_atomic:1;
- int enable_rdma_read:1;
- int enable_rdma_write:1;
- int sqd_async_event_enable:1;
- int sq_drained:1;
-};
-
-struct ib_gather_scatter {
- u64 address;
- u32 length;
- u32 key;
-};
-
-struct ib_send_param {
- u64 work_request_id;
- enum ib_op op;
- struct ib_gather_scatter *gather_list;
- int num_gather_entries;
- u64 remote_address;
- u32 rkey;
- u32 dest_qpn;
- u32 dest_qkey;
- struct ib_ah *dest_address;
- u32 immediate_data;
- u64 compare_add;
- u64 swap;
- u32 eecn;
- u16 ethertype;
- enum ib_static_rate static_rate;
- int pkey_index;
- void *device_specific;
- int solicited_event:1;
- int signaled:1;
- int immediate_data_valid:1;
- int fence:1;
- int inline_data:1;
-};
-
-struct ib_receive_param {
- u64 work_request_id;
- struct ib_gather_scatter *scatter_list;
- int num_scatter_entries;
- void *device_specific;
- int signaled:1;
-};
-
struct ib_fmr_pool_param {
int max_pages_per_fmr;
enum ib_memory_access access;
@@ -561,25 +332,6 @@
tTS_IB_PORT port,
int index,
tTS_IB_GID gid);
-typedef int (*ib_qp_create_func)(struct ib_pd *pd,
- struct ib_qp_create_param *param,
- struct ib_qp *qp);
-typedef int (*ib_special_qp_create_func)(struct ib_pd *pd,
- struct ib_qp_create_param *param,
- tTS_IB_PORT port,
- enum ib_special_qp_type qp_type,
- struct ib_qp *qp);
-typedef int (*ib_qp_modify_func)(struct ib_qp *qp,
- struct ib_qp_attribute *attr);
-typedef int (*ib_qp_query_func)(struct ib_qp *qp,
- struct ib_qp_attribute *attr);
-typedef int (*ib_qp_destroy_func)(struct ib_qp *qp);
-typedef int (*ib_send_post_func)(struct ib_qp *qp,
- struct ib_send_param *param,
- int num_work_requests);
-typedef int (*ib_receive_post_func)(struct ib_qp *qp,
- struct ib_receive_param *param,
- int num_work_requests);
typedef int (*ib_fmr_create_func)(struct ib_pd *pd,
enum ib_memory_access access,
int max_pages,
Index: src/linux-kernel/infiniband/core/core_ah.c
===================================================================
--- src/linux-kernel/infiniband/core/core_ah.c (revision 607)
+++ src/linux-kernel/infiniband/core/core_ah.c (working copy)
@@ -21,17 +21,10 @@
$Id$
*/
-#include "core_priv.h"
-
-#include "ts_kernel_trace.h"
-#include "ts_kernel_services.h"
-
-#include <linux/version.h>
-#include <linux/module.h>
-
#include <linux/errno.h>
-#include <linux/slab.h>
+#include "core_priv.h"
+
struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
{
struct ib_ah *ah;
Index: src/linux-kernel/infiniband/core/core_async.c
===================================================================
--- src/linux-kernel/infiniband/core/core_async.c (revision 576)
+++ src/linux-kernel/infiniband/core/core_async.c (working copy)
@@ -112,28 +112,8 @@
switch (event_table[record->event].mod) {
case QP:
- {
- struct ib_qp *qp = record->modifier.qp;
+ break;
- if (!IB_TEST_MAGIC(qp, QP)) {
- TS_REPORT_WARN(MOD_KERNEL_IB, "Bad magic 0x%lx at %p for QP",
- IB_GET_MAGIC(qp), qp);
- ret = -EINVAL;
- goto error;
- }
-
- if (qp->device != record->device) {
- ret = -EINVAL;
- goto error;
- }
-
- spin_lock_irqsave(&qp->async_handler_lock, flags);
- handler->list_lock = &qp->async_handler_lock;
- list_add_tail(&handler->list, &qp->async_handler_list);
- spin_unlock_irqrestore(&qp->async_handler_lock, flags);
- }
- break;
-
case CQ:
printk(KERN_WARNING "Async events for CQs not supported\n");
break;
@@ -192,9 +172,6 @@
unsigned long flags = 0; /* initialize to shut up gcc */
switch (event_table[event_record->event].mod) {
- case QP:
- async_obj = &event_record->modifier.qp->async_obj;
- break;
default:
break;
}
@@ -243,9 +220,6 @@
switch (event_table[event->record.event].mod) {
case QP:
sprintf(mod_buf, " (QP %p)", event->record.modifier.qp);
- handler_list = &event->record.modifier.qp->async_handler_list;
- handler_lock = &event->record.modifier.qp->async_handler_lock;
- async_obj = &event->record.modifier.qp->async_obj;
break;
case CQ:
Index: src/linux-kernel/infiniband/core/core_cache.c
===================================================================
--- src/linux-kernel/infiniband/core/core_cache.c (revision 576)
+++ src/linux-kernel/infiniband/core/core_cache.c (working copy)
@@ -239,7 +239,7 @@
int ib_cached_pkey_find(struct ib_device *device,
tTS_IB_PORT port,
u16 pkey,
- int *index)
+ u16 *index)
{
struct ib_device_private *priv;
unsigned int seq;
Index: src/linux-kernel/infiniband/core/core_cq.c
===================================================================
--- src/linux-kernel/infiniband/core/core_cq.c (revision 589)
+++ src/linux-kernel/infiniband/core/core_cq.c (working copy)
@@ -21,9 +21,6 @@
$Id$
*/
-#include <linux/version.h>
-#include <linux/module.h>
-
#include <linux/errno.h>
#include "core_priv.h"
Index: src/linux-kernel/infiniband/core/core_device.c
===================================================================
--- src/linux-kernel/infiniband/core/core_device.c (revision 607)
+++ src/linux-kernel/infiniband/core/core_device.c (working copy)
@@ -52,11 +52,11 @@
IB_MANDATORY_FUNC(dealloc_pd),
IB_MANDATORY_FUNC(create_ah),
IB_MANDATORY_FUNC(destroy_ah),
- IB_MANDATORY_FUNC(special_qp_create),
- IB_MANDATORY_FUNC(qp_modify),
- IB_MANDATORY_FUNC(qp_destroy),
- IB_MANDATORY_FUNC(send_post),
- IB_MANDATORY_FUNC(receive_post),
+ IB_MANDATORY_FUNC(create_qp),
+ IB_MANDATORY_FUNC(modify_qp),
+ IB_MANDATORY_FUNC(destroy_qp),
+ IB_MANDATORY_FUNC(post_send),
+ IB_MANDATORY_FUNC(post_recv),
IB_MANDATORY_FUNC(create_cq),
IB_MANDATORY_FUNC(destroy_cq),
IB_MANDATORY_FUNC(poll_cq),
Index: src/linux-kernel/infiniband/core/core_mcast.c
===================================================================
--- src/linux-kernel/infiniband/core/core_mcast.c (revision 621)
+++ src/linux-kernel/infiniband/core/core_mcast.c (working copy)
@@ -21,16 +21,10 @@
$Id$
*/
-#include "core_priv.h"
-
-#include "ts_kernel_trace.h"
-#include "ts_kernel_services.h"
-
-#include <linux/version.h>
-#include <linux/module.h>
-
#include <linux/errno.h>
+#include "core_priv.h"
+
int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
{
return qp->device->attach_mcast ?
Index: src/linux-kernel/infiniband/core/core_mw.c
===================================================================
--- src/linux-kernel/infiniband/core/core_mw.c (revision 613)
+++ src/linux-kernel/infiniband/core/core_mw.c (working copy)
@@ -22,14 +22,9 @@
*/
#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/module.h>
#include "core_priv.h"
-#include "ts_kernel_trace.h"
-#include "ts_kernel_services.h"
-
struct ib_mw *ib_alloc_mw(struct ib_pd *pd)
{
struct ib_mw *mw;
Index: src/linux-kernel/infiniband/core/core_qp.c
===================================================================
--- src/linux-kernel/infiniband/core/core_qp.c (revision 576)
+++ src/linux-kernel/infiniband/core/core_qp.c (working copy)
@@ -21,147 +21,72 @@
$Id$
*/
-#include "core_priv.h"
-
-#include "ts_kernel_trace.h"
-#include "ts_kernel_services.h"
-
-#include <linux/version.h>
-#include <linux/module.h>
-
#include <linux/errno.h>
-#include <linux/slab.h>
-int ib_qp_create(struct ib_qp_create_param *param,
- struct ib_qp **qp_handle,
- u32 *qpn)
-{
- struct ib_pd *pd;
- struct ib_qp *qp;
- int ret;
+#include "core_priv.h"
- pd = param->pd;
-
- if (!pd->device->qp_create) {
- return -ENOSYS;
- }
-
- qp = kmalloc(sizeof *qp, GFP_KERNEL);
- if (!qp) {
- return -ENOMEM;
- }
-
- INIT_LIST_HEAD(&qp->async_handler_list);
- spin_lock_init(&qp->async_handler_lock);
- ib_async_obj_init(&qp->async_obj, qp);
-
- ret = pd->device->qp_create(pd, param, qp);
-
- if (!ret) {
- IB_SET_MAGIC(qp, QP);
- qp->device = pd->device;
- *qp_handle = qp;
- *qpn = qp->qpn;
- } else {
- kfree(qp);
- }
-
- return ret;
-}
-EXPORT_SYMBOL(ib_qp_create);
-
-int ib_special_qp_create(struct ib_qp_create_param *param,
- tTS_IB_PORT port,
- enum ib_special_qp_type qp_type,
- struct ib_qp **qp_handle)
+struct ib_qp *ib_create_qp(struct ib_pd *pd,
+ struct ib_qp_init_attr *qp_init_attr,
+ struct ib_qp_cap *qp_cap)
{
- struct ib_pd *pd;
struct ib_qp *qp;
- int ret;
- pd = param->pd;
+ qp = pd->device->create_qp(pd, qp_init_attr, qp_cap);
- if (!pd->device->special_qp_create) {
- return -ENOSYS;
+ if (!IS_ERR(qp)) {
+ qp->device = pd->device;
+ qp->pd = pd;
+ qp->send_cq = qp_init_attr->send_cq;
+ qp->recv_cq = qp_init_attr->recv_cq;
+ atomic_inc(&pd->usecnt);
+ atomic_inc(&qp_init_attr->send_cq->usecnt);
+ atomic_inc(&qp_init_attr->recv_cq->usecnt);
}
- qp = kmalloc(sizeof *qp, GFP_KERNEL);
- if (!qp) {
- return -ENOMEM;
- }
-
- INIT_LIST_HEAD(&qp->async_handler_list);
- spin_lock_init(&qp->async_handler_lock);
- ib_async_obj_init(&qp->async_obj, qp);
-
- ret = pd->device->special_qp_create(pd, param, port, qp_type, qp);
-
- if (!ret) {
- IB_SET_MAGIC(qp, QP);
- qp->device = pd->device;
- *qp_handle = qp;
- } else {
- kfree(qp);
- }
-
- return ret;
+ return qp;
}
-EXPORT_SYMBOL(ib_special_qp_create);
+EXPORT_SYMBOL(ib_create_qp);
-int ib_qp_modify(struct ib_qp *qp,
- struct ib_qp_attribute *attr)
+int ib_modify_qp(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_cap *qp_cap)
{
- IB_CHECK_MAGIC(qp, QP);
- return qp->device->qp_modify ? qp->device->qp_modify(qp, attr) : -ENOSYS;
+ return qp->device->modify_qp(qp, qp_attr, qp_attr_mask, qp_cap);
}
-EXPORT_SYMBOL(ib_qp_modify);
+EXPORT_SYMBOL(ib_modify_qp);
-int ib_qp_query(struct ib_qp *qp,
- struct ib_qp_attribute *attr)
+int ib_query_qp(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask,
+ struct ib_qp_init_attr *qp_init_attr)
{
- IB_CHECK_MAGIC(qp, QP);
- return qp->device->qp_query ? qp->device->qp_query(qp, attr) : -ENOSYS;
+ return qp->device->query_qp ?
+ qp->device->query_qp(qp, qp_attr, qp_attr_mask, qp_init_attr) :
+ -ENOSYS;
}
-EXPORT_SYMBOL(ib_qp_query);
+EXPORT_SYMBOL(ib_query_qp);
-int ib_qp_query_qpn(struct ib_qp *qp,
- u32 *qpn)
+int ib_destroy_qp(struct ib_qp *qp)
{
- IB_CHECK_MAGIC(qp, QP);
+ struct ib_pd *pd;
+ struct ib_cq *scq, *rcq;
+ int ret;
- *qpn = qp->qpn;
- return 0;
-}
-EXPORT_SYMBOL(ib_qp_query_qpn);
+ pd = qp->pd;
+ scq = qp->send_cq;
+ rcq = qp->recv_cq;
-int ib_qp_destroy(struct ib_qp *qp_handle)
-{
- struct ib_qp *qp = qp_handle;
- int ret;
- unsigned long flags;
-
- IB_CHECK_MAGIC(qp, QP);
-
- if (!qp->device->qp_destroy) {
- return -ENOSYS;
- }
-
- if (!list_empty(&qp->async_handler_list)) {
- return -EBUSY;
- }
-
- ret = qp->device->qp_destroy(qp);
+ ret = qp->device->destroy_qp(qp);
if (!ret) {
- IB_CLEAR_MAGIC(qp);
- spin_lock_irqsave(&qp->async_obj.lock, flags);
- if (!qp->async_obj.pending)
- kfree(qp);
- spin_unlock_irqrestore(&qp->async_obj.lock, flags);
+ atomic_dec(&pd->usecnt);
+ atomic_dec(&scq->usecnt);
+ atomic_dec(&rcq->usecnt);
}
return ret;
}
-EXPORT_SYMBOL(ib_qp_destroy);
+EXPORT_SYMBOL(ib_destroy_qp);
/*
Local Variables:
More information about the general
mailing list