[ofa-general] [PATCH] sdp: fix bad HELLO/HELLO_ACK buffer size matching + let recvmsg do posts on data packets too

Amir Vadai amirv at mellanox.co.il
Mon Jun 22 01:18:47 PDT 2009


Signed-off-by: Amir Vadai <amirv at mellanox.co.il>
---
 drivers/infiniband/ulp/sdp/sdp_cma.c |    7 ++++---
 drivers/infiniband/ulp/sdp/sdp_rx.c  |    3 +--
 drivers/infiniband/ulp/sdp/sdp_tx.c  |    2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/sdp/sdp_cma.c b/drivers/infiniband/ulp/sdp/sdp_cma.c
index bbc69c6..83e39dc 100644
--- a/drivers/infiniband/ulp/sdp/sdp_cma.c
+++ b/drivers/infiniband/ulp/sdp/sdp_cma.c
@@ -215,7 +215,7 @@ static int sdp_response_handler(struct sock *sk, struct rdma_cm_id *id,
 	sdp_sk(sk)->max_bufs = ntohs(h->bsdh.bufs);
 	atomic_set(&sdp_sk(sk)->tx_ring.credits, sdp_sk(sk)->max_bufs);
 	sdp_sk(sk)->min_bufs = tx_credits(sdp_sk(sk)) / 4;
-	sdp_sk(sk)->xmit_size_goal = ntohl(h->actrcvsz) - SDP_HEAD_SIZE;
+	sdp_sk(sk)->xmit_size_goal = ntohl(h->actrcvsz) - sizeof(struct sdp_bsdh);
 	sdp_sk(sk)->send_frags = MIN(PAGE_ALIGN(sdp_sk(sk)->xmit_size_goal) /
 		PAGE_SIZE, MAX_SKB_FRAGS) + 1; /* The +1 is to conpensate on not aligned buffers */
 	sdp_sk(sk)->xmit_size_goal = MIN(sdp_sk(sk)->xmit_size_goal, 
@@ -352,7 +352,7 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
 		hh.majv_minv = SDP_MAJV_MINV;
 		sdp_init_buffers(sdp_sk(sk), rcvbuf_initial_size);
 		hh.localrcvsz = hh.desremrcvsz = htonl(sdp_sk(sk)->recv_frags *
-						       PAGE_SIZE + SDP_HEAD_SIZE);
+						       PAGE_SIZE + sizeof(struct sdp_bsdh));
 		hh.max_adverts = 0x1;
 		inet_sk(sk)->saddr = inet_sk(sk)->rcv_saddr =
 			((struct sockaddr_in *)&id->route.addr.src_addr)->sin_addr.s_addr;
@@ -385,7 +385,8 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
 		hah.majv_minv = SDP_MAJV_MINV;
 		hah.ext_max_adverts = 1; /* Doesn't seem to be mandated by spec,
 					    but just in case */
-		hah.actrcvsz = htonl(sdp_sk(child)->recv_frags * PAGE_SIZE + SDP_HEAD_SIZE);
+		hah.actrcvsz = htonl(sdp_sk(child)->recv_frags * PAGE_SIZE +
+			sizeof(struct sdp_bsdh));
 		memset(&conn_param, 0, sizeof conn_param);
 		conn_param.private_data_len = sizeof hah;
 		conn_param.private_data = &hah;
diff --git a/drivers/infiniband/ulp/sdp/sdp_rx.c b/drivers/infiniband/ulp/sdp/sdp_rx.c
index b3611ae..1ef28ac 100644
--- a/drivers/infiniband/ulp/sdp/sdp_rx.c
+++ b/drivers/infiniband/ulp/sdp/sdp_rx.c
@@ -753,8 +753,7 @@ static void sdp_rx_irq(struct ib_cq *cq, void *cq_context)
 				credits_before, tx_credits(ssk));
 
 		if (posts_handler(ssk) || 
-			(!skb_queue_empty(&ssk->rx_ctl_q) &&
-			(sk->sk_socket && (sk->sk_socket->flags & SOCK_ASYNC_WAITDATA)))) {
+			(sk->sk_socket && test_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags))) {
 
 			sdp_prf(&ssk->isk.sk, NULL, "Somebody is doing the post work for me. %d",
 				posts_handler(ssk));
diff --git a/drivers/infiniband/ulp/sdp/sdp_tx.c b/drivers/infiniband/ulp/sdp/sdp_tx.c
index bb0d81d..9cc37a3 100644
--- a/drivers/infiniband/ulp/sdp/sdp_tx.c
+++ b/drivers/infiniband/ulp/sdp/sdp_tx.c
@@ -205,6 +205,8 @@ static int sdp_handle_send_comp(struct sdp_sock *ssk, struct ib_wc *wc)
 	if (unlikely(wc->status)) {
 		if (wc->status != IB_WC_WR_FLUSH_ERR) {
 			struct sock *sk = &ssk->isk.sk;
+			sdp_prf(sk, skb, "Send completion with error. "
+				"Status %d", wc->status);
 			sdp_warn(sk, "Send completion with error. "
 				"Status %d\n", wc->status);
 			sdp_set_error(sk, -ECONNRESET);
-- 
1.5.3.7




More information about the general mailing list