From 421d3f85fb242e6edd36a41cd8400a62dd8b4ba3 Mon Sep 17 00:00:00 2001 From: Amir Vadai Date: Wed, 1 Jul 2009 19:38:06 +0300 Subject: [PATCH] sdp: fix bad credits advertised when connection initiated This enables removing the ugly post credits after connection establishment Signed-off-by: Amir Vadai --- drivers/infiniband/ulp/sdp/sdp.h | 3 --- drivers/infiniband/ulp/sdp/sdp_bcopy.c | 27 -------------------------- drivers/infiniband/ulp/sdp/sdp_cma.c | 5 +---- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/infiniband/ulp/sdp/sdp.h b/drivers/infiniband/ulp/sdp/sdp.h index 53f4b9539e2d..d03d6afa7d3f 100644 --- a/drivers/infiniband/ulp/sdp/sdp.h +++ b/drivers/infiniband/ulp/sdp/sdp.h @@ -602,9 +602,6 @@ void sdp_proc_unregister(void); /* sdp_cma.c */ int sdp_cma_handler(struct rdma_cm_id *, struct rdma_cm_event *); -/* sdp_bcopy.c */ -int sdp_post_credits(struct sdp_sock *ssk); - /* sdp_tx.c */ int sdp_tx_ring_create(struct sdp_sock *ssk, struct ib_device *device); void sdp_tx_ring_destroy(struct sdp_sock *ssk); diff --git a/drivers/infiniband/ulp/sdp/sdp_bcopy.c b/drivers/infiniband/ulp/sdp/sdp_bcopy.c index e2c4ffdd52c3..8ccd583bfd42 100644 --- a/drivers/infiniband/ulp/sdp/sdp_bcopy.c +++ b/drivers/infiniband/ulp/sdp/sdp_bcopy.c @@ -160,33 +160,6 @@ out2: mod_timer(&ssk->nagle_timer, jiffies + SDP_NAGLE_TIMEOUT); } -int sdp_post_credits(struct sdp_sock *ssk) -{ - int post_count = 0; - - sdp_dbg_data(&ssk->isk.sk, "credits: %d remote credits: %d " - "tx ring slots left: %d send_head: %p\n", - tx_credits(ssk), remote_credits(ssk), - sdp_tx_ring_slots_left(&ssk->tx_ring), - ssk->isk.sk.sk_send_head); - - if (likely(tx_credits(ssk) > 1) && - likely(sdp_tx_ring_slots_left(&ssk->tx_ring))) { - struct sk_buff *skb; - skb = sdp_stream_alloc_skb(&ssk->isk.sk, - sizeof(struct sdp_bsdh), - GFP_KERNEL); - if (!skb) - return -ENOMEM; - sdp_post_send(ssk, skb, SDP_MID_DATA); - post_count++; - } - - if (post_count) - sdp_xmit_poll(ssk, 0); - return post_count; -} - void sdp_post_sends(struct sdp_sock *ssk, int nonagle) { /* TODO: nonagle? */ diff --git a/drivers/infiniband/ulp/sdp/sdp_cma.c b/drivers/infiniband/ulp/sdp/sdp_cma.c index 83447b10f1d9..2354fff38179 100644 --- a/drivers/infiniband/ulp/sdp/sdp_cma.c +++ b/drivers/infiniband/ulp/sdp/sdp_cma.c @@ -371,7 +371,7 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) ring_posted(sdp_sk(child)->rx_ring)); memset(&hah, 0, sizeof hah); hah.bsdh.mid = SDP_MID_HELLO_ACK; - hah.bsdh.bufs = htons(remote_credits(sdp_sk(child))); + hah.bsdh.bufs = htons(ring_posted(sdp_sk(child)->rx_ring)); hah.bsdh.len = htonl(sizeof(struct sdp_bsdh) + SDP_HAH_SIZE); hah.majv_minv = SDP_MAJV_MINV; hah.ext_max_adverts = 1; /* Doesn't seem to be mandated by spec, @@ -400,9 +400,6 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) rdma_reject(id, NULL, 0); else rc = rdma_accept(id, NULL); - - if (!rc) - rc = sdp_post_credits(sdp_sk(sk)) < 0 ?: 0; break; case RDMA_CM_EVENT_CONNECT_ERROR: sdp_dbg(sk, "RDMA_CM_EVENT_CONNECT_ERROR\n"); -- 2.50.1