Back to home page

OSCL-LXR

 
 

    


0001 /* QLogic qedr NIC Driver
0002  * Copyright (c) 2015-2016  QLogic Corporation
0003  *
0004  * This software is available to you under a choice of one of two
0005  * licenses.  You may choose to be licensed under the terms of the GNU
0006  * General Public License (GPL) Version 2, available from the file
0007  * COPYING in the main directory of this source tree, or the
0008  * OpenIB.org BSD license below:
0009  *
0010  *     Redistribution and use in source and binary forms, with or
0011  *     without modification, are permitted provided that the following
0012  *     conditions are met:
0013  *
0014  *      - Redistributions of source code must retain the above
0015  *        copyright notice, this list of conditions and the following
0016  *        disclaimer.
0017  *
0018  *      - Redistributions in binary form must reproduce the above
0019  *        copyright notice, this list of conditions and the following
0020  *        disclaimer in the documentation and /or other materials
0021  *        provided with the distribution.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0024  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0025  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0026  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0027  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0028  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0029  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0030  * SOFTWARE.
0031  */
0032 #ifndef __QEDR_H__
0033 #define __QEDR_H__
0034 
0035 #include <linux/pci.h>
0036 #include <linux/xarray.h>
0037 #include <rdma/ib_addr.h>
0038 #include <linux/qed/qed_if.h>
0039 #include <linux/qed/qed_chain.h>
0040 #include <linux/qed/qed_rdma_if.h>
0041 #include <linux/qed/qede_rdma.h>
0042 #include <linux/qed/roce_common.h>
0043 #include <linux/completion.h>
0044 #include "qedr_hsi_rdma.h"
0045 
0046 #define QEDR_NODE_DESC "QLogic 579xx RoCE HCA"
0047 #define DP_NAME(_dev) dev_name(&(_dev)->ibdev.dev)
0048 #define IS_IWARP(_dev) ((_dev)->rdma_type == QED_RDMA_TYPE_IWARP)
0049 #define IS_ROCE(_dev) ((_dev)->rdma_type == QED_RDMA_TYPE_ROCE)
0050 
0051 #define DP_DEBUG(dev, module, fmt, ...)                 \
0052     pr_debug("(%s) " module ": " fmt,               \
0053          DP_NAME(dev) ? DP_NAME(dev) : "", ## __VA_ARGS__)
0054 
0055 #define QEDR_MSG_INIT "INIT"
0056 #define QEDR_MSG_MISC "MISC"
0057 #define QEDR_MSG_CQ   "  CQ"
0058 #define QEDR_MSG_MR   "  MR"
0059 #define QEDR_MSG_RQ   "  RQ"
0060 #define QEDR_MSG_SQ   "  SQ"
0061 #define QEDR_MSG_QP   "  QP"
0062 #define QEDR_MSG_SRQ  " SRQ"
0063 #define QEDR_MSG_GSI  " GSI"
0064 #define QEDR_MSG_IWARP  " IW"
0065 
0066 #define QEDR_CQ_MAGIC_NUMBER    (0x11223344)
0067 
0068 #define FW_PAGE_SIZE        (RDMA_RING_PAGE_SIZE)
0069 #define FW_PAGE_SHIFT       (12)
0070 
0071 struct qedr_dev;
0072 
0073 struct qedr_cnq {
0074     struct qedr_dev     *dev;
0075     struct qed_chain    pbl;
0076     struct qed_sb_info  *sb;
0077     char            name[32];
0078     u64         n_comp;
0079     __le16          *hw_cons_ptr;
0080     u8          index;
0081 };
0082 
0083 #define QEDR_MAX_SGID 128
0084 
0085 struct qedr_device_attr {
0086     u32 vendor_id;
0087     u32 vendor_part_id;
0088     u32 hw_ver;
0089     u64 fw_ver;
0090     u64 node_guid;
0091     u64 sys_image_guid;
0092     u8  max_cnq;
0093     u8  max_sge;
0094     u16 max_inline;
0095     u32 max_sqe;
0096     u32 max_rqe;
0097     u8  max_qp_resp_rd_atomic_resc;
0098     u8  max_qp_req_rd_atomic_resc;
0099     u64 max_dev_resp_rd_atomic_resc;
0100     u32 max_cq;
0101     u32 max_qp;
0102     u32 max_mr;
0103     u64 max_mr_size;
0104     u32 max_cqe;
0105     u32 max_mw;
0106     u32 max_mr_mw_fmr_pbl;
0107     u64 max_mr_mw_fmr_size;
0108     u32 max_pd;
0109     u32 max_ah;
0110     u8  max_pkey;
0111     u32 max_srq;
0112     u32 max_srq_wr;
0113     u8  max_srq_sge;
0114     u8  max_stats_queues;
0115     u32 dev_caps;
0116 
0117     u64 page_size_caps;
0118     u8  dev_ack_delay;
0119     u32 reserved_lkey;
0120     u32 bad_pkey_counter;
0121     struct qed_rdma_events events;
0122 };
0123 
0124 #define QEDR_ENET_STATE_BIT (0)
0125 
0126 struct qedr_dev {
0127     struct ib_device    ibdev;
0128     struct qed_dev      *cdev;
0129     struct pci_dev      *pdev;
0130     struct net_device   *ndev;
0131 
0132     enum ib_atomic_cap  atomic_cap;
0133 
0134     void *rdma_ctx;
0135     struct qedr_device_attr attr;
0136 
0137     const struct qed_rdma_ops *ops;
0138     struct qed_int_info int_info;
0139 
0140     struct qed_sb_info  *sb_array;
0141     struct qedr_cnq     *cnq_array;
0142     int         num_cnq;
0143     int         sb_start;
0144 
0145     void __iomem        *db_addr;
0146     u64         db_phys_addr;
0147     u32         db_size;
0148     u16         dpi;
0149 
0150     union ib_gid *sgid_tbl;
0151 
0152     /* Lock for sgid table */
0153     spinlock_t sgid_lock;
0154 
0155     u64         guid;
0156 
0157     u32         dp_module;
0158     u8          dp_level;
0159     u8          num_hwfns;
0160 #define QEDR_IS_CMT(dev)        ((dev)->num_hwfns > 1)
0161     u8          affin_hwfn_idx;
0162     u8          gsi_ll2_handle;
0163 
0164     uint            wq_multiplier;
0165     u8          gsi_ll2_mac_address[ETH_ALEN];
0166     int         gsi_qp_created;
0167     struct qedr_cq      *gsi_sqcq;
0168     struct qedr_cq      *gsi_rqcq;
0169     struct qedr_qp      *gsi_qp;
0170     enum qed_rdma_type  rdma_type;
0171     struct xarray       qps;
0172     struct xarray       srqs;
0173     struct workqueue_struct *iwarp_wq;
0174     u16         iwarp_max_mtu;
0175 
0176     unsigned long enet_state;
0177 
0178     u8 user_dpm_enabled;
0179 };
0180 
0181 #define QEDR_MAX_SQ_PBL         (0x8000)
0182 #define QEDR_MAX_SQ_PBL_ENTRIES     (0x10000 / sizeof(void *))
0183 #define QEDR_SQE_ELEMENT_SIZE       (sizeof(struct rdma_sq_sge))
0184 #define QEDR_MAX_SQE_ELEMENTS_PER_SQE   (ROCE_REQ_MAX_SINGLE_SQ_WQE_SIZE / \
0185                      QEDR_SQE_ELEMENT_SIZE)
0186 #define QEDR_MAX_SQE_ELEMENTS_PER_PAGE  ((RDMA_RING_PAGE_SIZE) / \
0187                      QEDR_SQE_ELEMENT_SIZE)
0188 #define QEDR_MAX_SQE            ((QEDR_MAX_SQ_PBL_ENTRIES) *\
0189                      (RDMA_RING_PAGE_SIZE) / \
0190                      (QEDR_SQE_ELEMENT_SIZE) /\
0191                      (QEDR_MAX_SQE_ELEMENTS_PER_SQE))
0192 /* RQ */
0193 #define QEDR_MAX_RQ_PBL         (0x2000)
0194 #define QEDR_MAX_RQ_PBL_ENTRIES     (0x10000 / sizeof(void *))
0195 #define QEDR_RQE_ELEMENT_SIZE       (sizeof(struct rdma_rq_sge))
0196 #define QEDR_MAX_RQE_ELEMENTS_PER_RQE   (RDMA_MAX_SGE_PER_RQ_WQE)
0197 #define QEDR_MAX_RQE_ELEMENTS_PER_PAGE  ((RDMA_RING_PAGE_SIZE) / \
0198                      QEDR_RQE_ELEMENT_SIZE)
0199 #define QEDR_MAX_RQE            ((QEDR_MAX_RQ_PBL_ENTRIES) *\
0200                      (RDMA_RING_PAGE_SIZE) / \
0201                      (QEDR_RQE_ELEMENT_SIZE) /\
0202                      (QEDR_MAX_RQE_ELEMENTS_PER_RQE))
0203 
0204 #define QEDR_CQE_SIZE   (sizeof(union rdma_cqe))
0205 #define QEDR_MAX_CQE_PBL_SIZE (512 * 1024)
0206 #define QEDR_MAX_CQE_PBL_ENTRIES (((QEDR_MAX_CQE_PBL_SIZE) / \
0207                   sizeof(u64)) - 1)
0208 #define QEDR_MAX_CQES ((u32)((QEDR_MAX_CQE_PBL_ENTRIES) * \
0209                  (QED_CHAIN_PAGE_SIZE) / QEDR_CQE_SIZE))
0210 
0211 #define QEDR_ROCE_MAX_CNQ_SIZE      (0x4000)
0212 
0213 #define QEDR_MAX_PORT           (1)
0214 #define QEDR_PORT           (1)
0215 
0216 #define QEDR_UVERBS(CMD_NAME) (1ull << IB_USER_VERBS_CMD_##CMD_NAME)
0217 
0218 #define QEDR_ROCE_PKEY_MAX 1
0219 #define QEDR_ROCE_PKEY_TABLE_LEN 1
0220 #define QEDR_ROCE_PKEY_DEFAULT 0xffff
0221 
0222 struct qedr_pbl {
0223     struct list_head list_entry;
0224     void *va;
0225     dma_addr_t pa;
0226 };
0227 
0228 struct qedr_ucontext {
0229     struct ib_ucontext ibucontext;
0230     struct qedr_dev *dev;
0231     struct qedr_pd *pd;
0232     void __iomem *dpi_addr;
0233     struct rdma_user_mmap_entry *db_mmap_entry;
0234     u64 dpi_phys_addr;
0235     u32 dpi_size;
0236     u16 dpi;
0237     bool db_rec;
0238     u8 edpm_mode;
0239 };
0240 
0241 union db_prod32 {
0242     struct rdma_pwm_val16_data data;
0243     u32 raw;
0244 };
0245 
0246 union db_prod64 {
0247     struct rdma_pwm_val32_data data;
0248     u64 raw;
0249 };
0250 
0251 enum qedr_cq_type {
0252     QEDR_CQ_TYPE_GSI,
0253     QEDR_CQ_TYPE_KERNEL,
0254     QEDR_CQ_TYPE_USER,
0255 };
0256 
0257 struct qedr_pbl_info {
0258     u32 num_pbls;
0259     u32 num_pbes;
0260     u32 pbl_size;
0261     u32 pbe_size;
0262     bool two_layered;
0263 };
0264 
0265 struct qedr_userq {
0266     struct ib_umem *umem;
0267     struct qedr_pbl_info pbl_info;
0268     struct qedr_pbl *pbl_tbl;
0269     u64 buf_addr;
0270     size_t buf_len;
0271 
0272     /* doorbell recovery */
0273     void __iomem *db_addr;
0274     struct qedr_user_db_rec *db_rec_data;
0275     struct rdma_user_mmap_entry *db_mmap_entry;
0276     void __iomem *db_rec_db2_addr;
0277     union db_prod32 db_rec_db2_data;
0278 };
0279 
0280 struct qedr_cq {
0281     struct ib_cq ibcq;
0282 
0283     enum qedr_cq_type cq_type;
0284     u32 sig;
0285 
0286     u16 icid;
0287 
0288     /* Lock to protect multiplem CQ's */
0289     spinlock_t cq_lock;
0290     u8 arm_flags;
0291     struct qed_chain pbl;
0292 
0293     void __iomem *db_addr;
0294     union db_prod64 db;
0295 
0296     u8 pbl_toggle;
0297     union rdma_cqe *latest_cqe;
0298     union rdma_cqe *toggle_cqe;
0299 
0300     u32 cq_cons;
0301 
0302     struct qedr_userq q;
0303     u8 destroyed;
0304     u16 cnq_notif;
0305 };
0306 
0307 struct qedr_pd {
0308     struct ib_pd ibpd;
0309     u32 pd_id;
0310     struct qedr_ucontext *uctx;
0311 };
0312 
0313 struct qedr_xrcd {
0314     struct ib_xrcd ibxrcd;
0315     u16 xrcd_id;
0316 };
0317 
0318 struct qedr_qp_hwq_info {
0319     /* WQE Elements */
0320     struct qed_chain pbl;
0321     u64 p_phys_addr_tbl;
0322     u32 max_sges;
0323 
0324     /* WQE */
0325     u16 prod;
0326     u16 cons;
0327     u16 wqe_cons;
0328     u16 gsi_cons;
0329     u16 max_wr;
0330 
0331     /* DB */
0332     void __iomem *db;
0333     union db_prod32 db_data;
0334 
0335     void __iomem *iwarp_db2;
0336     union db_prod32 iwarp_db2_data;
0337 };
0338 
0339 #define QEDR_INC_SW_IDX(p_info, index)                  \
0340     do {                                \
0341         p_info->index = (p_info->index + 1) &           \
0342                 qed_chain_get_capacity(p_info->pbl) \
0343     } while (0)
0344 
0345 struct qedr_srq_hwq_info {
0346     u32 max_sges;
0347     u32 max_wr;
0348     struct qed_chain pbl;
0349     u64 p_phys_addr_tbl;
0350     u32 wqe_prod;
0351     u32 sge_prod;
0352     u32 wr_prod_cnt;
0353     atomic_t wr_cons_cnt;
0354     u32 num_elems;
0355 
0356     struct rdma_srq_producers *virt_prod_pair_addr;
0357     dma_addr_t phy_prod_pair_addr;
0358 };
0359 
0360 struct qedr_srq {
0361     struct ib_srq ibsrq;
0362     struct qedr_dev *dev;
0363 
0364     struct qedr_userq   usrq;
0365     struct qedr_srq_hwq_info hw_srq;
0366     struct ib_umem *prod_umem;
0367     u16 srq_id;
0368     u32 srq_limit;
0369     bool is_xrc;
0370     /* lock to protect srq recv post */
0371     spinlock_t lock;
0372 };
0373 
0374 enum qedr_qp_err_bitmap {
0375     QEDR_QP_ERR_SQ_FULL = 1,
0376     QEDR_QP_ERR_RQ_FULL = 2,
0377     QEDR_QP_ERR_BAD_SR = 4,
0378     QEDR_QP_ERR_BAD_RR = 8,
0379     QEDR_QP_ERR_SQ_PBL_FULL = 16,
0380     QEDR_QP_ERR_RQ_PBL_FULL = 32,
0381 };
0382 
0383 enum qedr_qp_create_type {
0384     QEDR_QP_CREATE_NONE,
0385     QEDR_QP_CREATE_USER,
0386     QEDR_QP_CREATE_KERNEL,
0387 };
0388 
0389 enum qedr_iwarp_cm_flags {
0390     QEDR_IWARP_CM_WAIT_FOR_CONNECT    = BIT(0),
0391     QEDR_IWARP_CM_WAIT_FOR_DISCONNECT = BIT(1),
0392 };
0393 
0394 struct qedr_qp {
0395     struct ib_qp ibqp;  /* must be first */
0396     struct qedr_dev *dev;
0397     struct qedr_qp_hwq_info sq;
0398     struct qedr_qp_hwq_info rq;
0399 
0400     u32 max_inline_data;
0401 
0402     /* Lock for QP's */
0403     spinlock_t q_lock;
0404     struct qedr_cq *sq_cq;
0405     struct qedr_cq *rq_cq;
0406     struct qedr_srq *srq;
0407     enum qed_roce_qp_state state;
0408     u32 id;
0409     struct qedr_pd *pd;
0410     enum ib_qp_type qp_type;
0411     enum qedr_qp_create_type create_type;
0412     struct qed_rdma_qp *qed_qp;
0413     u32 qp_id;
0414     u16 icid;
0415     u16 mtu;
0416     int sgid_idx;
0417     u32 rq_psn;
0418     u32 sq_psn;
0419     u32 qkey;
0420     u32 dest_qp_num;
0421     u8 timeout;
0422 
0423     /* Relevant to qps created from kernel space only (ULPs) */
0424     u8 prev_wqe_size;
0425     u16 wqe_cons;
0426     u32 err_bitmap;
0427     bool signaled;
0428 
0429     /* SQ shadow */
0430     struct {
0431         u64 wr_id;
0432         enum ib_wc_opcode opcode;
0433         u32 bytes_len;
0434         u8 wqe_size;
0435         bool signaled;
0436         dma_addr_t icrc_mapping;
0437         u32 *icrc;
0438         struct qedr_mr *mr;
0439     } *wqe_wr_id;
0440 
0441     /* RQ shadow */
0442     struct {
0443         u64 wr_id;
0444         struct ib_sge sg_list[RDMA_MAX_SGE_PER_RQ_WQE];
0445         u8 wqe_size;
0446 
0447         u8 smac[ETH_ALEN];
0448         u16 vlan;
0449         int rc;
0450     } *rqe_wr_id;
0451 
0452     /* Relevant to qps created from user space only (applications) */
0453     struct qedr_userq usq;
0454     struct qedr_userq urq;
0455 
0456     /* synchronization objects used with iwarp ep */
0457     struct kref refcnt;
0458     struct completion iwarp_cm_comp;
0459     struct completion qp_rel_comp;
0460     unsigned long iwarp_cm_flags; /* enum iwarp_cm_flags */
0461 };
0462 
0463 struct qedr_ah {
0464     struct ib_ah ibah;
0465     struct rdma_ah_attr attr;
0466 };
0467 
0468 enum qedr_mr_type {
0469     QEDR_MR_USER,
0470     QEDR_MR_KERNEL,
0471     QEDR_MR_DMA,
0472     QEDR_MR_FRMR,
0473 };
0474 
0475 struct mr_info {
0476     struct qedr_pbl *pbl_table;
0477     struct qedr_pbl_info pbl_info;
0478     struct list_head free_pbl_list;
0479     struct list_head inuse_pbl_list;
0480     u32 completed;
0481     u32 completed_handled;
0482 };
0483 
0484 struct qedr_mr {
0485     struct ib_mr ibmr;
0486     struct ib_umem *umem;
0487 
0488     struct qed_rdma_register_tid_in_params hw_mr;
0489     enum qedr_mr_type type;
0490 
0491     struct qedr_dev *dev;
0492     struct mr_info info;
0493 
0494     u64 *pages;
0495     u32 npages;
0496 };
0497 
0498 struct qedr_user_mmap_entry {
0499     struct rdma_user_mmap_entry rdma_entry;
0500     struct qedr_dev *dev;
0501     union {
0502         u64 io_address;
0503         void *address;
0504     };
0505     size_t length;
0506     u16 dpi;
0507     u8 mmap_flag;
0508 };
0509 
0510 #define SET_FIELD2(value, name, flag) ((value) |= ((flag) << (name ## _SHIFT)))
0511 
0512 #define QEDR_RESP_IMM   (RDMA_CQE_RESPONDER_IMM_FLG_MASK << \
0513              RDMA_CQE_RESPONDER_IMM_FLG_SHIFT)
0514 #define QEDR_RESP_RDMA  (RDMA_CQE_RESPONDER_RDMA_FLG_MASK << \
0515              RDMA_CQE_RESPONDER_RDMA_FLG_SHIFT)
0516 #define QEDR_RESP_INV   (RDMA_CQE_RESPONDER_INV_FLG_MASK << \
0517              RDMA_CQE_RESPONDER_INV_FLG_SHIFT)
0518 
0519 static inline void qedr_inc_sw_cons(struct qedr_qp_hwq_info *info)
0520 {
0521     info->cons = (info->cons + 1) % info->max_wr;
0522     info->wqe_cons++;
0523 }
0524 
0525 static inline void qedr_inc_sw_prod(struct qedr_qp_hwq_info *info)
0526 {
0527     info->prod = (info->prod + 1) % info->max_wr;
0528 }
0529 
0530 static inline int qedr_get_dmac(struct qedr_dev *dev,
0531                 struct rdma_ah_attr *ah_attr, u8 *mac_addr)
0532 {
0533     union ib_gid zero_sgid = { { 0 } };
0534     struct in6_addr in6;
0535     const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
0536     u8 *dmac;
0537 
0538     if (!memcmp(&grh->dgid, &zero_sgid, sizeof(union ib_gid))) {
0539         DP_ERR(dev, "Local port GID not supported\n");
0540         eth_zero_addr(mac_addr);
0541         return -EINVAL;
0542     }
0543 
0544     memcpy(&in6, grh->dgid.raw, sizeof(in6));
0545     dmac = rdma_ah_retrieve_dmac(ah_attr);
0546     if (!dmac)
0547         return -EINVAL;
0548     ether_addr_copy(mac_addr, dmac);
0549 
0550     return 0;
0551 }
0552 
0553 struct qedr_iw_listener {
0554     struct qedr_dev *dev;
0555     struct iw_cm_id *cm_id;
0556     int     backlog;
0557     void        *qed_handle;
0558 };
0559 
0560 struct qedr_iw_ep {
0561     struct qedr_dev *dev;
0562     struct iw_cm_id *cm_id;
0563     struct qedr_qp  *qp;
0564     void        *qed_context;
0565     struct kref refcnt;
0566 };
0567 
0568 static inline
0569 struct qedr_ucontext *get_qedr_ucontext(struct ib_ucontext *ibucontext)
0570 {
0571     return container_of(ibucontext, struct qedr_ucontext, ibucontext);
0572 }
0573 
0574 static inline struct qedr_dev *get_qedr_dev(struct ib_device *ibdev)
0575 {
0576     return container_of(ibdev, struct qedr_dev, ibdev);
0577 }
0578 
0579 static inline struct qedr_pd *get_qedr_pd(struct ib_pd *ibpd)
0580 {
0581     return container_of(ibpd, struct qedr_pd, ibpd);
0582 }
0583 
0584 static inline struct qedr_xrcd *get_qedr_xrcd(struct ib_xrcd *ibxrcd)
0585 {
0586     return container_of(ibxrcd, struct qedr_xrcd, ibxrcd);
0587 }
0588 
0589 static inline struct qedr_cq *get_qedr_cq(struct ib_cq *ibcq)
0590 {
0591     return container_of(ibcq, struct qedr_cq, ibcq);
0592 }
0593 
0594 static inline struct qedr_qp *get_qedr_qp(struct ib_qp *ibqp)
0595 {
0596     return container_of(ibqp, struct qedr_qp, ibqp);
0597 }
0598 
0599 static inline struct qedr_ah *get_qedr_ah(struct ib_ah *ibah)
0600 {
0601     return container_of(ibah, struct qedr_ah, ibah);
0602 }
0603 
0604 static inline struct qedr_mr *get_qedr_mr(struct ib_mr *ibmr)
0605 {
0606     return container_of(ibmr, struct qedr_mr, ibmr);
0607 }
0608 
0609 static inline struct qedr_srq *get_qedr_srq(struct ib_srq *ibsrq)
0610 {
0611     return container_of(ibsrq, struct qedr_srq, ibsrq);
0612 }
0613 
0614 static inline bool qedr_qp_has_srq(struct qedr_qp *qp)
0615 {
0616     return qp->srq;
0617 }
0618 
0619 static inline bool qedr_qp_has_sq(struct qedr_qp *qp)
0620 {
0621     if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_TGT)
0622         return false;
0623 
0624     return true;
0625 }
0626 
0627 static inline bool qedr_qp_has_rq(struct qedr_qp *qp)
0628 {
0629     if (qp->qp_type == IB_QPT_GSI || qp->qp_type == IB_QPT_XRC_INI ||
0630         qp->qp_type == IB_QPT_XRC_TGT || qedr_qp_has_srq(qp))
0631         return false;
0632 
0633     return true;
0634 }
0635 
0636 static inline struct qedr_user_mmap_entry *
0637 get_qedr_mmap_entry(struct rdma_user_mmap_entry *rdma_entry)
0638 {
0639     return container_of(rdma_entry, struct qedr_user_mmap_entry,
0640                 rdma_entry);
0641 }
0642 #endif