aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@mellanox.com>2016-05-23 08:20:48 -0400
committerDoug Ledford <dledford@redhat.com>2016-06-23 11:02:43 -0400
commit5fd251c8b4c52da0d0916470a67fbb77b972125e (patch)
treea1268dd95778cd8d2c08a6877a97294470007e7b /include/rdma
parent16bd020147abeb37dd32cc6442cee2d32b1c1af0 (diff)
IB/core: Introduce Work Queue object and its verbs
Introduce Work Queue object and its create/destroy/modify verbs. QP can be created without internal WQs "packaged" inside it, this QP can be configured to use "external" WQ object as its receive/send queue. WQ is a necessary component for RSS technology since RSS mechanism is supposed to distribute the traffic between multiple Receive Work Queues. WQ associated (many to one) with Completion Queue and it owns WQ properties (PD, WQ size, etc.). WQ has a type, this patch introduces the IB_WQT_RQ (i.e.receive queue), it may be extend to others such as IB_WQT_SQ. (send queue). WQ from type IB_WQT_RQ contains receive work requests. PD is an attribute of a work queue (i.e. send/receive queue), it's used by the hardware for security validation before scattering to a memory region which is pointed by the WQ. For that, an external WQ object needs a PD, letting the hardware makes that validation. When accessing a memory region that is pointed by the WQ its PD is used and not the QP's PD, this behavior is similar to a SRQ and a QP. WQ context is subject to a well-defined state transitions done by the modify_wq verb. When WQ is created its initial state becomes IB_WQS_RESET. >From IB_WQS_RESET it can be modified to itself or to IB_WQS_RDY. >From IB_WQS_RDY it can be modified to itself, to IB_WQS_RESET or to IB_WQS_ERR. >From IB_WQS_ERR it can be modified to IB_WQS_RESET. Note: transition to IB_WQS_ERR might occur implicitly in case there was some HW error. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Matan Barak <matanb@mellanox.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma')
-rw-r--r--include/rdma/ib_verbs.h56
1 files changed, 55 insertions, 1 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7e440d41487a..f2d954ac42f6 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1428,6 +1428,48 @@ struct ib_srq {
1428 } ext; 1428 } ext;
1429}; 1429};
1430 1430
1431enum ib_wq_type {
1432 IB_WQT_RQ
1433};
1434
1435enum ib_wq_state {
1436 IB_WQS_RESET,
1437 IB_WQS_RDY,
1438 IB_WQS_ERR
1439};
1440
1441struct ib_wq {
1442 struct ib_device *device;
1443 struct ib_uobject *uobject;
1444 void *wq_context;
1445 void (*event_handler)(struct ib_event *, void *);
1446 struct ib_pd *pd;
1447 struct ib_cq *cq;
1448 u32 wq_num;
1449 enum ib_wq_state state;
1450 enum ib_wq_type wq_type;
1451 atomic_t usecnt;
1452};
1453
1454struct ib_wq_init_attr {
1455 void *wq_context;
1456 enum ib_wq_type wq_type;
1457 u32 max_wr;
1458 u32 max_sge;
1459 struct ib_cq *cq;
1460 void (*event_handler)(struct ib_event *, void *);
1461};
1462
1463enum ib_wq_attr_mask {
1464 IB_WQ_STATE = 1 << 0,
1465 IB_WQ_CUR_STATE = 1 << 1,
1466};
1467
1468struct ib_wq_attr {
1469 enum ib_wq_state wq_state;
1470 enum ib_wq_state curr_wq_state;
1471};
1472
1431struct ib_qp { 1473struct ib_qp {
1432 struct ib_device *device; 1474 struct ib_device *device;
1433 struct ib_pd *pd; 1475 struct ib_pd *pd;
@@ -1921,7 +1963,14 @@ struct ib_device {
1921 struct ifla_vf_stats *stats); 1963 struct ifla_vf_stats *stats);
1922 int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid, 1964 int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid,
1923 int type); 1965 int type);
1924 1966 struct ib_wq * (*create_wq)(struct ib_pd *pd,
1967 struct ib_wq_init_attr *init_attr,
1968 struct ib_udata *udata);
1969 int (*destroy_wq)(struct ib_wq *wq);
1970 int (*modify_wq)(struct ib_wq *wq,
1971 struct ib_wq_attr *attr,
1972 u32 wq_attr_mask,
1973 struct ib_udata *udata);
1925 struct ib_dma_mapping_ops *dma_ops; 1974 struct ib_dma_mapping_ops *dma_ops;
1926 1975
1927 struct module *owner; 1976 struct module *owner;
@@ -3167,6 +3216,11 @@ int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
3167struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port, 3216struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port,
3168 u16 pkey, const union ib_gid *gid, 3217 u16 pkey, const union ib_gid *gid,
3169 const struct sockaddr *addr); 3218 const struct sockaddr *addr);
3219struct ib_wq *ib_create_wq(struct ib_pd *pd,
3220 struct ib_wq_init_attr *init_attr);
3221int ib_destroy_wq(struct ib_wq *wq);
3222int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *attr,
3223 u32 wq_attr_mask);
3170 3224
3171int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, 3225int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
3172 unsigned int *sg_offset, unsigned int page_size); 3226 unsigned int *sg_offset, unsigned int page_size);