From: Amir Vadai Date: Wed, 24 Feb 2010 08:59:31 +0000 (+0200) Subject: sdp: Fix bug in crossing SrcAvail X-Git-Tag: v4.1.12-92~264^2~5^2~214 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f1629caa8c69d64d51a2c1b190fb6c6ea0cee411;p=users%2Fjedix%2Flinux-maple.git sdp: Fix bug in crossing SrcAvail * Handle RdmaRdCompl in interrupt, before splitted to two Q's This way the handling is sequencial, and no race could occure between RdmaRdCompl and SrcAvailCancel * Fixed an error when checking that RdmaRdCompl is not for old SrcAvail Signed-off-by: Amir Vadai --- diff --git a/drivers/infiniband/ulp/sdp/sdp_rx.c b/drivers/infiniband/ulp/sdp/sdp_rx.c index 44d9f1a2e5a84..f1b6d439770dd 100644 --- a/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -464,10 +464,6 @@ static int sdp_process_rx_ctl_skb(struct sdp_sock *ssk, struct sk_buff *skb) break; case SDP_MID_RDMARDCOMPL: { - struct sdp_rrch *rrch = (struct sdp_rrch *)(h+1); - sdp_dbg_data(sk, "RdmaRdCompl message arrived\n"); - sdp_handle_rdma_read_compl(ssk, ntohl(h->mseq_ack), - ntohl(rrch->len)); __kfree_skb(skb); } break; case SDP_MID_SENDSM: @@ -579,6 +575,15 @@ static int sdp_process_rx_skb(struct sdp_sock *ssk, struct sk_buff *skb) ntohl(h->mseq), ntohl(h->mseq_ack)); ssk->srcavail_cancel_mseq = ntohl(h->mseq); } + + + if (h->mid == SDP_MID_RDMARDCOMPL) { + struct sdp_rrch *rrch = (struct sdp_rrch *)(h+1); + sdp_dbg_data(sk, "RdmaRdCompl message arrived\n"); + sdp_handle_rdma_read_compl(ssk, ntohl(h->mseq_ack), + ntohl(rrch->len)); + } + skb_queue_tail(&ssk->rx_ctl_q, skb); return 0; diff --git a/drivers/infiniband/ulp/sdp/sdp_zcopy.c b/drivers/infiniband/ulp/sdp/sdp_zcopy.c index e5a59c082d7c5..04b30977ca0d6 100644 --- a/drivers/infiniband/ulp/sdp/sdp_zcopy.c +++ b/drivers/infiniband/ulp/sdp/sdp_zcopy.c @@ -190,7 +190,7 @@ static int sdp_wait_rdmardcompl(struct sdp_sock *ssk, long *timeo_p, break; } - if (ssk->rx_sa) { + if (ssk->rx_sa && (tx_sa->bytes_acked < tx_sa->bytes_sent)) { sdp_dbg_data(sk, "Crossing SrcAvail - aborting this\n"); tx_sa->abort_flags |= TX_SA_CROSS_SEND; SDPSTATS_COUNTER_INC(zcopy_cross_send); @@ -346,7 +346,7 @@ void sdp_handle_sendsm(struct sdp_sock *ssk, u32 mseq_ack) goto out; } - if (mseq_ack < ssk->tx_sa->mseq) { + if (ssk->tx_sa->mseq > mseq_ack) { sdp_dbg_data(sk, "SendSM arrived for old SrcAvail. " "SendSM mseq_ack: 0x%x, SrcAvail mseq: 0x%x\n", mseq_ack, ssk->tx_sa->mseq); @@ -383,7 +383,7 @@ void sdp_handle_rdma_read_compl(struct sdp_sock *ssk, u32 mseq_ack, goto out; } - if (ssk->tx_sa->mseq < mseq_ack) { + if (ssk->tx_sa->mseq > mseq_ack) { sdp_dbg_data(sk, "RdmaRdCompl arrived for old SrcAvail. " "SendSM mseq_ack: 0x%x, SrcAvail mseq: 0x%x\n", mseq_ack, ssk->tx_sa->mseq);