]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/rdma/ib_verbs.h
scsi: target: iscsi: Wait for all commands to finish before freeing a session
[mirror_ubuntu-bionic-kernel.git] / include / rdma / ib_verbs.h
index fd84cda5ed7cec7577c2ae96d1b0e39275e53acf..ad7547c7ffc26abad63a2b8761ffb2562f6734da 100644 (file)
@@ -68,6 +68,7 @@
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
+extern struct workqueue_struct *ib_comp_unbound_wq;
 
 union ib_gid {
        u8      raw[16];
@@ -283,8 +284,8 @@ struct ib_rss_caps {
 };
 
 enum ib_tm_cap_flags {
-       /*  Support tag matching on RC transport */
-       IB_TM_CAP_RC                = 1 << 0,
+       /*  Support tag matching with rendezvous offload for RC transport */
+       IB_TM_CAP_RNDV_RC = 1 << 0,
 };
 
 struct ib_tm_caps {
@@ -307,7 +308,7 @@ enum ib_cq_creation_flags {
 
 struct ib_cq_init_attr {
        unsigned int    cqe;
-       int             comp_vector;
+       u32             comp_vector;
        u32             flags;
 };
 
@@ -878,6 +879,7 @@ struct ib_mr_status {
 __attribute_const__ enum ib_rate mult_to_ib_rate(int mult);
 
 enum rdma_ah_attr_type {
+       RDMA_AH_ATTR_TYPE_UNDEFINED,
        RDMA_AH_ATTR_TYPE_IB,
        RDMA_AH_ATTR_TYPE_ROCE,
        RDMA_AH_ATTR_TYPE_OPA,
@@ -983,9 +985,9 @@ struct ib_wc {
                u32             invalidate_rkey;
        } ex;
        u32                     src_qp;
+       u32                     slid;
        int                     wc_flags;
        u16                     pkey_index;
-       u32                     slid;
        u8                      sl;
        u8                      dlid_path_bits;
        u8                      port_num;       /* valid only for DR SMPs on switches */
@@ -1131,7 +1133,7 @@ struct ib_qp_init_attr {
        struct ib_qp_cap        cap;
        enum ib_sig_type        sq_sig_type;
        enum ib_qp_type         qp_type;
-       enum ib_qp_create_flags create_flags;
+       u32                     create_flags;
 
        /*
         * Only needed for special QP types, or when using the RW API.
@@ -1263,21 +1265,27 @@ struct ib_qp_attr {
 };
 
 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,
-       IB_WR_LSO,
-       IB_WR_SEND_WITH_INV,
-       IB_WR_RDMA_READ_WITH_INV,
-       IB_WR_LOCAL_INV,
-       IB_WR_REG_MR,
-       IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
-       IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
+       /* These are shared with userspace */
+       IB_WR_RDMA_WRITE = IB_UVERBS_WR_RDMA_WRITE,
+       IB_WR_RDMA_WRITE_WITH_IMM = IB_UVERBS_WR_RDMA_WRITE_WITH_IMM,
+       IB_WR_SEND = IB_UVERBS_WR_SEND,
+       IB_WR_SEND_WITH_IMM = IB_UVERBS_WR_SEND_WITH_IMM,
+       IB_WR_RDMA_READ = IB_UVERBS_WR_RDMA_READ,
+       IB_WR_ATOMIC_CMP_AND_SWP = IB_UVERBS_WR_ATOMIC_CMP_AND_SWP,
+       IB_WR_ATOMIC_FETCH_AND_ADD = IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD,
+       IB_WR_LSO = IB_UVERBS_WR_TSO,
+       IB_WR_SEND_WITH_INV = IB_UVERBS_WR_SEND_WITH_INV,
+       IB_WR_RDMA_READ_WITH_INV = IB_UVERBS_WR_RDMA_READ_WITH_INV,
+       IB_WR_LOCAL_INV = IB_UVERBS_WR_LOCAL_INV,
+       IB_WR_MASKED_ATOMIC_CMP_AND_SWP =
+               IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP,
+       IB_WR_MASKED_ATOMIC_FETCH_AND_ADD =
+               IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD,
+
+       /* These are kernel only and can not be issued by userspace */
+       IB_WR_REG_MR = 0x20,
        IB_WR_REG_SIG_MR,
+
        /* reserve values for low level drivers' internal use.
         * These values will not be used at all in the ib core layer.
         */
@@ -1550,9 +1558,10 @@ struct ib_ah {
 typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
 
 enum ib_poll_context {
-       IB_POLL_DIRECT,         /* caller context, no hw completions */
-       IB_POLL_SOFTIRQ,        /* poll from softirq context */
-       IB_POLL_WORKQUEUE,      /* poll from workqueue */
+       IB_POLL_DIRECT,            /* caller context, no hw completions */
+       IB_POLL_SOFTIRQ,           /* poll from softirq context */
+       IB_POLL_WORKQUEUE,         /* poll from workqueue */
+       IB_POLL_UNBOUND_WORKQUEUE, /* poll from unbound workqueue */
 };
 
 struct ib_cq {
@@ -1569,6 +1578,7 @@ struct ib_cq {
                struct irq_poll         iop;
                struct work_struct      work;
        };
+       struct workqueue_struct *comp_wq;
 };
 
 struct ib_srq {
@@ -3586,6 +3596,20 @@ static inline int ib_check_mr_access(int flags)
        return 0;
 }
 
+static inline bool ib_access_writable(int access_flags)
+{
+       /*
+        * We have writable memory backing the MR if any of the following
+        * access flags are set.  "Local write" and "remote write" obviously
+        * require write access.  "Remote atomic" can do things like fetch and
+        * add, which will modify memory, and "MW bind" can change permissions
+        * by binding a window.
+        */
+       return access_flags &
+               (IB_ACCESS_LOCAL_WRITE   | IB_ACCESS_REMOTE_WRITE |
+                IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND);
+}
+
 /**
  * ib_check_mr_status: lightweight check of MR status.
  *     This routine may provide status checks on a selected
@@ -3789,18 +3813,24 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr,
        grh->traffic_class = traffic_class;
 }
 
-/*Get AH type */
+/**
+ * rdma_ah_find_type - Return address handle type.
+ *
+ * @dev: Device to be checked
+ * @port_num: Port number
+ */
 static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev,
-                                                      u32 port_num)
+                                                      u8 port_num)
 {
-       if ((rdma_protocol_roce(dev, port_num)) ||
-           (rdma_protocol_iwarp(dev, port_num)))
+       if (rdma_protocol_roce(dev, port_num))
                return RDMA_AH_ATTR_TYPE_ROCE;
-       else if ((rdma_protocol_ib(dev, port_num)) &&
-                (rdma_cap_opa_ah(dev, port_num)))
-               return RDMA_AH_ATTR_TYPE_OPA;
-       else
+       if (rdma_protocol_ib(dev, port_num)) {
+               if (rdma_cap_opa_ah(dev, port_num))
+                       return RDMA_AH_ATTR_TYPE_OPA;
                return RDMA_AH_ATTR_TYPE_IB;
+       }
+
+       return RDMA_AH_ATTR_TYPE_UNDEFINED;
 }
 
 /**