]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
Fix performance regression introduced by patch that avoid
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 23 Jun 2009 09:48:05 +0000 (10:48 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 12:02:14 +0000 (13:02 +0100)
message to wrap around the ring.
When we fail to transmit a packet in the ring because it is full
we should not put the packet in the pending_skbs list since
this may cause out of order packets. Instead just keep the
packet in the same pending_tx_queue list and stop processing
the list.

Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
drivers/xen/netchannel2/chan.c
drivers/xen/netchannel2/netchannel2_core.h
drivers/xen/netchannel2/xmit_packet.c

index 08ed641b96eef3b1811d72bc0e0ad3ac0593a7e1..02f88dee5d8a7c87fa0ede5daaf8263e0b56cdaa 100644 (file)
@@ -1042,7 +1042,12 @@ static void process_ring(struct netchannel2_ring_pair *ncrp)
         if (!skb_queue_empty(&ncrp->pending_tx_queue)) {
                 skb = __skb_dequeue(&ncrp->pending_tx_queue);
                 do {
-                        nc2_really_start_xmit(ncrp, skb);
+                       if (!nc2_really_start_xmit(ncrp, skb)) {
+                               /* Requeue the packet so that we will try
+                                  when the ring is less busy */
+                               __skb_queue_head(&ncrp->pending_tx_queue, skb);
+                               break;
+                       }
                         skb = __skb_dequeue(&ncrp->pending_tx_queue);
                 } while (skb != NULL);
 
index f18039b6a06e030a07ce58eb3e219e084d2fb8e9..beb5cc8b316e1407edfb9dbbc81ab7addd4ce7e8 100644 (file)
@@ -1084,7 +1084,7 @@ void resume_receive_map_mode(void);
 struct netchannel2 *nc2_get_interface_for_page(struct page *p);
 
 int nc2_start_xmit(struct sk_buff *skb, struct net_device *dev);
-void nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
+int nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
                            struct sk_buff *skb);
 int prepare_xmit_allocate_resources(struct netchannel2 *nc,
                                     struct sk_buff *skb);
index faaa75f8d1de08f5b6bcdceb71acb1514633997a..ce7dace623d7e5024f2c576983cfe5ca8ca0c667 100644 (file)
@@ -136,8 +136,8 @@ static void set_offload_flags(struct sk_buff *skb,
 /* Once this has been called, the ring must not be flushed until the
    TX hypercall batcher is (assuming this ring has a hypercall
    batcher). */
-void nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
-                           struct sk_buff *skb)
+int nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
+                         struct sk_buff *skb)
 {
         struct skb_cb_overlay *skb_co = get_skb_overlay(skb);
         struct netchannel2 *nc = ncrp->interface;
@@ -154,24 +154,11 @@ void nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
         if (!nc2_can_send_payload_bytes(&ncrp->prod_ring, msg_size)) {
                 /* Aw, crud.  We had to transmit a PAD message at just
                    the wrong time, and our attempt to reserve ring
-                   space failed.  Back all the way back out of
-                   transmitting this packet, stop the queue, and get
-                   out. */
-                nc = ncrp->interface;
-                if (ncrp == &nc->rings) {
-                        /* Requeue the packet so that we'll try again
-                           when the ring's less busy */
-                        __skb_queue_head(&nc->pending_skbs, skb);
-                        nc->is_stopped = 1;
-                        netif_stop_queue(nc->net_device);
-                } else {
-                        /* Just drop it on the floor.  There isn't
-                           really anything else we can do. */
-                        release_tx_packet(ncrp, skb);
-                }
-                return;
+                   space failed.  Delay transmiting this packet 
+                   Make sure we redo the space reserve */
+                ncrp->prod_ring.reserve += msg_size;
+                return 0;
         }
-
         __nc2_avoid_ring_wrap(&ncrp->prod_ring, msg_size);
 
         /* Set up part of the message.  We do the message header
@@ -264,6 +251,8 @@ void nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
         ncrp->need_flush = 1;
 
         EXIT();
+
+       return 1;
 }
 
 /* Arrange that @skb will be sent on ring @ncrp soon.  Assumes that