zrlio / softiwarp

SoftiWARP: Software iWARP kernel driver and user library for Linux
129 stars 46 forks source link

SIW sends RTR WRITE even though RTR READ was negotiated #20

Open gregjoyce opened 7 years ago

gregjoyce commented 7 years ago

siw is the initiator (1.1.1.2)

16:39:36.550313 1.1.1.2.55097 > 1.1.1.1.3333: P 1:25(24) ack 1 win 229 [mpa: start-req C pdlen 4 mpav2: enhanced - ird 1 ord 2 peer2peer write RTR read RTR] (DF) 16:39:36.550801 1.1.1.1.3333 > 1.1.1.2.55097: P 1:25(24) ack 25 win 32768 [mpa: start-rep C pdlen 4 mpav2: enhanced - ird 2 ord 1 peer2peer read RTR] (DF) 16:39:36.550858 1.1.1.2.55097 > 1.1.1.1.3333: P 25:45(20) ack 25 win 229 [mpa: ulplen 14 ddp: v1 TL stag 0 to 0 rdmap: WRITE ] (DF) 16:39:36.551106 1.1.1.1.3333 > 1.1.1.2.55097: P 25:53(28) ack 45 win 32768 [mpa: ulplen 22 ddp: v1 UL inv_stag 0 qn 2 msn 1 mo 0 rdmap: TERM layertype 00 ecode 00 hdrct 00 ] (DF)

gregjoyce commented 7 years ago

@@ -964,7 +969,7 @@ static int siw_proc_mpareply(struct siw_cep *cep)
                }

                if (cep->mpa.v2_ctrl_req.ird & MPA_V2_PEER_TO_PEER)
-                       mpa_p2p_mode = cep->mpa.v2_ctrl_req.ord &
+                       mpa_p2p_mode = v2->ord &
                                (MPA_V2_RDMA_WRITE_RTR | MPA_V2_RDMA_READ_RTR);
gregjoyce commented 7 years ago

When determining the RTR type to send look at the negotiated ord, not the requested one.

larrystevenwise commented 7 years ago

This fix seems correct.

BernardMetzler commented 7 years ago

good catch, thanks! but we have to check first if we proposed anything. if there is no intersection we refuse....:

                        mpa_p2p_mode = cep->mpa.v2_ctrl_req.ord &
                                (MPA_V2_RDMA_WRITE_RTR | MPA_V2_RDMA_READ_RTR);

                /*
                 * Check if we requested P2P mode, and if peer agrees
                 */
                if (mpa_p2p_mode != MPA_V2_RDMA_NO_RTR) {
                        if ((mpa_p2p_mode & v2->ord) == 0) {
                                /*
                                 * We requested RTR mode(s), but the peer
                                 * did not pick any mode we support.
                                 */
                                dprint(DBG_ON,
                                        " RTR mode:  Req %2x, Got %2x\n",
                                        mpa_p2p_mode,
                                        v2->ord & (MPA_V2_RDMA_WRITE_RTR |
                                                   MPA_V2_RDMA_READ_RTR));

                                siw_send_terminate(qp, RDMAP_ERROR_LAYER_LLP,
                                                   LLP_ETYPE_MPA,
                                                   LLP_ECODE_NO_MATCHING_RTR);
                                rv = -EPROTO;
                                goto out_err;
                        }
                        mpa_p2p_mode = v2->ord &
                                (MPA_V2_RDMA_WRITE_RTR | MPA_V2_RDMA_READ_RTR);
                }
        }