[ofa-general] Re: [PATCH 2/10] IB/core: Add creation flags to QPs

Jack Morgenstein jackm at dev.mellanox.co.il
Thu Mar 20 05:45:22 PDT 2008


On Thursday 20 March 2008 01:06, Roland Dreier wrote:
> As I recall, the XRC patches want this flags field too.  But does it
> work there if we just add another XRC QP type too?
> 
Not as simple.  XRC has 2 QP types -- a regular XRC QP, and a receive-only
XRC QP (created only by a userspace app for receiving into XRC SRQs only,
but owned by the kernel -- so that the creating app can terminate without
the XRC RCV QP being destroyed).

There are many places where I test for IB_QPT_XRC -- and I would need to test for all the
XRC qp types in these places. Just doing a grep on the kernel_patches/fixes for the mlx4 driver yields:

..../ofed_kernel/kernel_patches/fixes> grep IB_QPT_XRC mlx4*
mlx4_0070_xrc.patch:+           if (!init_attr->srq && init_attr->qp_type != IB_QPT_XRC) {
mlx4_0070_xrc.patch:+           if (!init_attr->srq && init_attr->qp_type != IB_QPT_XRC) {
mlx4_0070_xrc.patch:+   if (init_attr->qp_type == IB_QPT_XRC)
mlx4_0070_xrc.patch:+           if (!init_attr->srq && init_attr->qp_type != IB_QPT_XRC)
mlx4_0070_xrc.patch:+   if (!pd->uobject && !init_attr->srq && init_attr->qp_type != IB_QPT_XRC)
mlx4_0070_xrc.patch:+           if (!qp->ibqp.srq && qp->ibqp.qp_type != IB_QPT_XRC)
mlx4_0070_xrc.patch:+           if (!qp->ibqp.srq && qp->ibqp.qp_type != IB_QPT_XRC)
mlx4_0070_xrc.patch:+   case IB_QPT_XRC:
mlx4_0070_xrc.patch:+           if (init_attr->qp_type == IB_QPT_XRC)
mlx4_0070_xrc.patch:+   case IB_QPT_XRC:        return MLX4_QP_ST_XRC;
mlx4_0070_xrc.patch:+           if (ibqp->qp_type == IB_QPT_XRC)
mlx4_0070_xrc.patch:+   if (!ibqp->srq && ibqp->qp_type != IB_QPT_XRC &&
mlx4_0070_xrc.patch:+           if (!ibqp->srq && ibqp->qp_type != IB_QPT_XRC)
mlx4_0120_xrc_kernel.patch:+            case IB_QPT_XRC:
mlx4_0125_xrc_kernel_missed.patch:mlx4: fix some missed spots for IB_QPT_XRC qps.
mlx4_0125_xrc_kernel_missed.patch:+     case IB_QPT_XRC:
mlx4_0125_xrc_kernel_missed.patch:+static const int mlx4_ib_qp_attr_mask_table[IB_QPT_XRC + 1] = {
mlx4_0125_xrc_kernel_missed.patch:+             [IB_QPT_XRC] = (IB_QP_PKEY_INDEX                |
mlx4_0125_xrc_kernel_missed.patch:+         qp->ibqp.qp_type == IB_QPT_XRC) {
mlx4_0170_shrinking_wqe.patch:          if (!ibqp->srq && ibqp->qp_type != IB_QPT_XRC)
mlx4_0210_xrc_rcv.patch:+               if (!(ibqp->qp_type == IB_QPT_XRC &&
mlx4_0210_xrc_rcv.patch:+       if (init_attr->qp_type == IB_QPT_XRC &&
mlx4_0210_xrc_rcv.patch:+       ia.qp_type = IB_QPT_XRC;
mlx4_0210_xrc_rcv.patch:+           qp->ibqp.qp_type == IB_QPT_XRC) {

Its much simpler if I just have a create-flag:
mlx4_0210_xrc_rcv.patch:+       MLX4_XRC_RCV    = 1 << 1,
mlx4_0210_xrc_rcv.patch:+                     mqp->flags & MLX4_XRC_RCV)) {
mlx4_0210_xrc_rcv.patch:+           init_attr->create_flags & QP_CREATE_XRC_RCV)
mlx4_0210_xrc_rcv.patch:+               qp->flags |= MLX4_XRC_RCV;

Furthermore, what happens if a "create-flag" applies to more than a single base-qp type?
Do we then create multiple new QP types for this flag, one for each base type?

I think the create_flags (essentially, a create-modifier) is the better choice.

- Jack



More information about the general mailing list