]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
Make it possible for xmit_* methods to fail (even if at present none
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Mon, 1 Jun 2009 10:13:27 +0000 (11:13 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 7 Jul 2009 16:23:47 +0000 (17:23 +0100)
of them do).

drivers/xen/netchannel2/netchannel2_core.h
drivers/xen/netchannel2/posted_buffers.c
drivers/xen/netchannel2/rscb.c
drivers/xen/netchannel2/xmit_packet.c

index 5b85bbc5735ea6d487c6f20e84e425cfd73e97c4..e20763b1f24343933f26e4a88ba25871d89d41aa 100644 (file)
@@ -1013,15 +1013,15 @@ int prepare_xmit_allocate_grant(struct netchannel2_ring_pair *ncrp,
 int prepare_xmit_allocate_grant2(struct netchannel2_ring_pair *ncrp,
                                 struct sk_buff *skb,
                                 int use_subpage_grants);
-void xmit_grant(struct netchannel2_ring_pair *ncrp,
-                struct sk_buff *skb,
-                int use_subpage_grants,
-                volatile void *msg);
+int xmit_grant(struct netchannel2_ring_pair *ncrp,
+              struct sk_buff *skb,
+              int use_subpage_grants,
+              volatile void *msg);
 int prepare_xmit_allocate_post(struct netchannel2 *nc,
                                struct sk_buff *skb);
-void xmit_post(struct netchannel2 *nc,
-               struct sk_buff *skb,
-               volatile void *msg);
+int xmit_post(struct netchannel2 *nc,
+             struct sk_buff *skb,
+             volatile void *msg);
 
 void nc2_replenish_rx_buffers(struct netchannel2 *nc);
 
index 97eba89075d3bd248aa5c117def772bc4bed7696..d6a7835185889b3be34f0b307715e85819e8f734 100644 (file)
@@ -594,8 +594,8 @@ int prepare_xmit_allocate_post(struct netchannel2 *nc, struct sk_buff *skb)
         return 0;
 }
 
-void xmit_post(struct netchannel2 *nc, struct sk_buff *skb,
-               volatile void *msg_buf)
+int xmit_post(struct netchannel2 *nc, struct sk_buff *skb,
+             volatile void *msg_buf)
 {
         volatile struct netchannel2_msg_packet *msg = msg_buf;
         struct skb_cb_overlay *scb;
@@ -641,6 +641,8 @@ void xmit_post(struct netchannel2 *nc, struct sk_buff *skb,
            this packet are now available for the other end to
            fill with new buffers. */
         list_splice(&scb->buffers, &nc->unused_tx_buffer_slots);
+
+       return 0;
 }
 
 /* The other endpoint has sent us a transmit buffer.  Add it to the
index ef889fc50cae442d59de45d0fc3da05d9e8fd7de..65501cb13228cc94666bc3ca13cd3f579efb43ec 100644 (file)
@@ -446,10 +446,10 @@ static int grant_data_area(struct netchannel2_ring_pair *ncrp,
         return 0;
 }
 
-void xmit_grant(struct netchannel2_ring_pair *ncrp,
-                struct sk_buff *skb,
-                int use_subpage_grants,
-                volatile void *msg_buf)
+int xmit_grant(struct netchannel2_ring_pair *ncrp,
+              struct sk_buff *skb,
+              int use_subpage_grants,
+              volatile void *msg_buf)
 {
         volatile struct netchannel2_msg_packet *msg = msg_buf;
         struct skb_cb_overlay *skb_co = get_skb_overlay(skb);
@@ -510,5 +510,7 @@ void xmit_grant(struct netchannel2_ring_pair *ncrp,
             ncrp->interface->extant_bypasses < ncrp->interface->max_bypasses)
                 msg->flags |= NC2_PACKET_FLAG_bypass_candidate;
 #endif
+
+       return 0;
 }
 
index dea97f639adb7a9703a0e106b1d2faa95b89d703..e5f125c4af4577180919383963ebdd5b72394ffb 100644 (file)
@@ -166,30 +166,33 @@ int nc2_really_start_xmit(struct netchannel2_ring_pair *ncrp,
         switch (skb_co->policy) {
 #ifdef CONFIG_XEN_NETDEV2_VMQ
         case transmit_policy_vmq:
-                xmit_vmq(nc, skb, msg);
+                r = xmit_vmq(nc, skb, msg);
                 break;
 #endif
         case transmit_policy_small:
                 /* Nothing to do */
+               r = 0;
                 break;
         case transmit_policy_grant:
-                xmit_grant(ncrp, skb, 1, msg);
+                r = xmit_grant(ncrp, skb, 1, msg);
                 break;
         case transmit_policy_post:
-                xmit_post(nc, skb, msg);
+                r = xmit_post(nc, skb, msg);
                 break;
         case transmit_policy_map:
-                xmit_grant(ncrp, skb, 0, msg);
+                r = xmit_grant(ncrp, skb, 0, msg);
                 break;
         default:
                 BUG();
         }
 
+       if (r < 0)
+               return r;
+
         /* The transmission method may have decided not to use all the
            fragments it reserved, which changes the message size. */
         msg_size = get_transmitted_packet_msg_size(skb);
         msg->hdr.size = msg_size;
-
         ncrp->prod_ring.prod_pvt += msg_size;
 
         BUG_ON(ncrp->prod_ring.bytes_available < msg_size);