[openib-general] [PATCH] CM: new call to return QP attributes for use modifying the QP
Libor Michalek
libor at topspin.com
Wed Jan 26 16:06:03 PST 2005
On Wed, Jan 26, 2005 at 02:38:49AM -0800, Sean Hefty wrote:
> This patch implements the new CM call to return a default set of QP
> attributes that can be used to call ib_modify_qp. The code was
> restructured in areas as a result of saving the necessary data.
>
> I have test code that is nearly complete that will exercise the CM APIs
> and can be used as sample code. It runs in the kernel only, but shouldn't
> be too difficult to port to user-mode.
> +static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
> + struct ib_qp_attr *qp_attr,
> + int *qp_attr_mask)
> +{
> + unsigned long flags;
> + int ret;
> +
> + spin_lock_irqsave(&cm_id_priv->lock, flags);
> + switch (cm_id_priv->id.state) {
> + case IB_CM_REQ_RCVD:
> + case IB_CM_MRA_REQ_SENT:
> + case IB_CM_REP_RCVD:
> + case IB_CM_MRA_REP_SENT:
> + case IB_CM_REP_SENT:
> + case IB_CM_MRA_REP_RCVD:
> + case IB_CM_ESTABLISHED:
> + *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_DEST_QPN |
> + IB_QP_RQ_PSN | IB_QP_MAX_QP_RD_ATOMIC |
> + IB_QP_MIN_RNR_TIMER;
> + qp_attr->ah_attr = cm_id_priv->av.ah_attr;
> + qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn);
> + qp_attr->rq_psn = be32_to_cpu(cm_id_priv->recv_psn);
> + qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
> + qp_attr->min_rnr_timer = 0;
> + if (cm_id_priv->alt_av.ah_attr.dlid) {
> + *qp_attr_mask |= IB_QP_ALT_PATH;
> + qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr;
> + }
> + ret = 0;
> + break;
> + default:
> + ret = -EINVAL;
> + break;
> + }
> + spin_unlock_irqrestore(&cm_id_priv->lock, flags);
> + return ret;
> +}
Sean,
The initiator_depth field can translate to either qp_attr->max_rd_atomic
or qp_attr->max_dest_rd_atomic, depending on whether the field was saved
as the result of sending or receiving a REQ/REP respectively. So you'll
probably want {remote,local}_initiator_depth.
Also for RTR don't you need the PATH_MTU?
-Libor
More information about the general
mailing list