OSDN Git Service

IB/rdmavt: Add hardware driver send work request check
authorIra Weiny <ira.weiny@intel.com>
Wed, 3 Feb 2016 22:14:45 +0000 (14:14 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:37:31 +0000 (20:37 -0500)
Some hardware drivers requires additional checks on send WRs.  Create an
optional call back to allow hardware drivers to reject a send WR.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rdmavt/qp.c
include/rdma/rdma_vt.h

index 4711e14..e9e3138 100644 (file)
@@ -1394,6 +1394,10 @@ static int rvt_post_one_wr(struct rvt_qp *qp, struct ib_send_wr *wr)
        if (next == qp->s_last)
                return -ENOMEM;
 
+       if (rdi->driver_f.check_send_wr &&
+           rdi->driver_f.check_send_wr(qp, wr))
+               return -EINVAL;
+
        rkt = &rdi->lkey_table;
        pd = ibpd_to_rvtpd(qp->ibqp.pd);
        wqe = rvt_get_swqe_ptr(qp, qp->s_head);
index 1b77065..52dfa9c 100644 (file)
@@ -265,6 +265,8 @@ struct rvt_driver_provided {
        void (*modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr,
                          int attr_mask, struct ib_udata *udata);
 
+       int (*check_send_wr)(struct rvt_qp *qp, struct ib_send_wr *wr);
+
        void (*notify_create_mad_agent)(struct rvt_dev_info *rdi, int port_idx);
        void (*notify_free_mad_agent)(struct rvt_dev_info *rdi, int port_idx);
 };