aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Liu <wei.liu2@citrix.com>2013-03-24 21:08:19 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-25 12:19:26 -0400
commit7158ff6d0c6aa3724fb51c6c11143d31e166eb1f (patch)
treee10b0210c7dc85adb2b05c6a617405131d89610b
parente2d617c0ccf658a55552955f07018ecfa0135210 (diff)
xen-netfront: frags -> slots in xennet_get_responses
This function is in fact counting the ring slots required for responses. Separate the concepts of ring slots and skb frags make the code clearer, as now netfront and netback can have different MAX_SKB_FRAGS, slot and frag are not mapped 1:1 any more. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/xen-netfront.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 55276635e69b..d9097a786962 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -712,7 +712,7 @@ static int xennet_get_responses(struct netfront_info *np,
712 struct sk_buff *skb = xennet_get_rx_skb(np, cons); 712 struct sk_buff *skb = xennet_get_rx_skb(np, cons);
713 grant_ref_t ref = xennet_get_rx_ref(np, cons); 713 grant_ref_t ref = xennet_get_rx_ref(np, cons);
714 int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD); 714 int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD);
715 int frags = 1; 715 int slots = 1;
716 int err = 0; 716 int err = 0;
717 unsigned long ret; 717 unsigned long ret;
718 718
@@ -756,27 +756,27 @@ next:
756 if (!(rx->flags & XEN_NETRXF_more_data)) 756 if (!(rx->flags & XEN_NETRXF_more_data))
757 break; 757 break;
758 758
759 if (cons + frags == rp) { 759 if (cons + slots == rp) {
760 if (net_ratelimit()) 760 if (net_ratelimit())
761 dev_warn(dev, "Need more frags\n"); 761 dev_warn(dev, "Need more slots\n");
762 err = -ENOENT; 762 err = -ENOENT;
763 break; 763 break;
764 } 764 }
765 765
766 rx = RING_GET_RESPONSE(&np->rx, cons + frags); 766 rx = RING_GET_RESPONSE(&np->rx, cons + slots);
767 skb = xennet_get_rx_skb(np, cons + frags); 767 skb = xennet_get_rx_skb(np, cons + slots);
768 ref = xennet_get_rx_ref(np, cons + frags); 768 ref = xennet_get_rx_ref(np, cons + slots);
769 frags++; 769 slots++;
770 } 770 }
771 771
772 if (unlikely(frags > max)) { 772 if (unlikely(slots > max)) {
773 if (net_ratelimit()) 773 if (net_ratelimit())
774 dev_warn(dev, "Too many frags\n"); 774 dev_warn(dev, "Too many frags\n");
775 err = -E2BIG; 775 err = -E2BIG;
776 } 776 }
777 777
778 if (unlikely(err)) 778 if (unlikely(err))
779 np->rx.rsp_cons = cons + frags; 779 np->rx.rsp_cons = cons + slots;
780 780
781 return err; 781 return err;
782} 782}