]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/sdp: Implement Nagle algorithm.
authorMichael S. Tsirkin <mst@mellanox.co.il>
Wed, 19 Jul 2006 08:46:11 +0000 (11:46 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:03:51 +0000 (05:03 -0700)
drivers/infiniband/ulp/sdp/sdp_bcopy.c
drivers/infiniband/ulp/sdp/sdp_main.c

index 90007b6d9ffc40117491d169c8b03813f410216f..da595a5665bcd0179bc4a4b832717753b4a48073 100644 (file)
@@ -297,6 +297,16 @@ static inline void update_send_head(struct sock *sk, struct sk_buff *skb)
        }
 }
 
+static inline int sdp_nagle_off(struct sdp_sock *ssk, struct sk_buff *skb)
+{
+       return (ssk->nonagle & TCP_NAGLE_OFF) ||
+               skb->next != (struct sk_buff *)&ssk->isk.sk.sk_write_queue ||
+               skb->len + sizeof(struct sdp_bsdh) >= ssk->xmit_size_goal ||
+               (ssk->tx_tail == ssk->tx_head &&
+                !(ssk->nonagle & TCP_NAGLE_CORK)) ||
+               (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_PSH);
+}
+
 void sdp_post_sends(struct sdp_sock *ssk, int nonagle)
 {
        /* TODO: nonagle? */
@@ -308,7 +318,8 @@ void sdp_post_sends(struct sdp_sock *ssk, int nonagle)
 
        while (ssk->bufs > SDP_MIN_BUFS &&
               ssk->tx_head - ssk->tx_tail < SDP_TX_SIZE &&
-              (skb = ssk->isk.sk.sk_send_head)) {
+              (skb = ssk->isk.sk.sk_send_head) &&
+               sdp_nagle_off(ssk, skb)) {
                update_send_head(&ssk->isk.sk, skb);
                __skb_dequeue(&ssk->isk.sk.sk_write_queue);
                sdp_post_send(ssk, skb, SDP_MID_DATA);
index 7b6dc3c04aee9f9ad8b4fceab679a713694a6e55..e61b4af327f5851773f5aa44dc802cd621ecefd6 100644 (file)
@@ -597,8 +597,19 @@ static void sdp_shutdown(struct sock *sk, int how)
        sdp_post_sends(ssk, 0);
 }
 
+static void sdp_mark_push(struct sdp_sock *ssk, struct sk_buff *skb)
+{
+       TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
+       ssk->pushed_seq = ssk->write_seq;
+}
+
 static inline void sdp_push_pending_frames(struct sock *sk)
 {
+       struct sk_buff *skb = sk->sk_write_queue.prev;
+       if (skb) {
+               sdp_mark_push(sdp_sk(sk), skb);
+               sdp_post_sends(sdp_sk(sk), 0);
+       }
 }
 
 /* SOL_SOCKET level options are handled by sock_setsockopt */
@@ -783,12 +794,6 @@ static int forced_push(struct sdp_sock *sk)
        return 0;
 }
 
-static void sdp_mark_push(struct sdp_sock *ssk, struct sk_buff *skb)
-{
-       TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
-       ssk->pushed_seq = ssk->write_seq;
-}
-
 static inline int select_size(struct sock *sk, struct sdp_sock *ssk)
 {
        return 0;