提交 7158ff6d 编写于 作者: W Wei Liu 提交者: David S. Miller

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: NWei Liu <wei.liu2@citrix.com>
Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e2d617c0
...@@ -712,7 +712,7 @@ static int xennet_get_responses(struct netfront_info *np, ...@@ -712,7 +712,7 @@ static int xennet_get_responses(struct netfront_info *np,
struct sk_buff *skb = xennet_get_rx_skb(np, cons); struct sk_buff *skb = xennet_get_rx_skb(np, cons);
grant_ref_t ref = xennet_get_rx_ref(np, cons); grant_ref_t ref = xennet_get_rx_ref(np, cons);
int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD); int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD);
int frags = 1; int slots = 1;
int err = 0; int err = 0;
unsigned long ret; unsigned long ret;
...@@ -756,27 +756,27 @@ static int xennet_get_responses(struct netfront_info *np, ...@@ -756,27 +756,27 @@ static int xennet_get_responses(struct netfront_info *np,
if (!(rx->flags & XEN_NETRXF_more_data)) if (!(rx->flags & XEN_NETRXF_more_data))
break; break;
if (cons + frags == rp) { if (cons + slots == rp) {
if (net_ratelimit()) if (net_ratelimit())
dev_warn(dev, "Need more frags\n"); dev_warn(dev, "Need more slots\n");
err = -ENOENT; err = -ENOENT;
break; break;
} }
rx = RING_GET_RESPONSE(&np->rx, cons + frags); rx = RING_GET_RESPONSE(&np->rx, cons + slots);
skb = xennet_get_rx_skb(np, cons + frags); skb = xennet_get_rx_skb(np, cons + slots);
ref = xennet_get_rx_ref(np, cons + frags); ref = xennet_get_rx_ref(np, cons + slots);
frags++; slots++;
} }
if (unlikely(frags > max)) { if (unlikely(slots > max)) {
if (net_ratelimit()) if (net_ratelimit())
dev_warn(dev, "Too many frags\n"); dev_warn(dev, "Too many frags\n");
err = -E2BIG; err = -E2BIG;
} }
if (unlikely(err)) if (unlikely(err))
np->rx.rsp_cons = cons + frags; np->rx.rsp_cons = cons + slots;
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册