Commit a43ad59a authored by David S. Miller's avatar David S. Miller

Merge branch 'virtio_net-mergeable-XDP'

Jason Wang says:

====================
Fix several issues of virtio-net mergeable XDP

Please review the patches that tries to fix several issues of
virtio-net mergeable XDP.

Changes from V1:
- check against 1 before decreasing instead of resetting to 1
- typoe fixes
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 419fc888 3d62b2a0
...@@ -707,6 +707,13 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -707,6 +707,13 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
void *data; void *data;
u32 act; u32 act;
/* Transient failure which in theory could occur if
* in-flight packets from before XDP was enabled reach
* the receive path after XDP is loaded.
*/
if (unlikely(hdr->hdr.gso_type))
goto err_xdp;
/* This happens when rx buffer size is underestimated /* This happens when rx buffer size is underestimated
* or headroom is not enough because of the buffer * or headroom is not enough because of the buffer
* was refilled before XDP is set. This should only * was refilled before XDP is set. This should only
...@@ -727,14 +734,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -727,14 +734,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
xdp_page = page; xdp_page = page;
} }
/* Transient failure which in theory could occur if
* in-flight packets from before XDP was enabled reach
* the receive path after XDP is loaded. In practice I
* was not able to create this condition.
*/
if (unlikely(hdr->hdr.gso_type))
goto err_xdp;
/* Allow consuming headroom but reserve enough space to push /* Allow consuming headroom but reserve enough space to push
* the descriptor on if we get an XDP_TX return code. * the descriptor on if we get an XDP_TX return code.
*/ */
...@@ -775,7 +774,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -775,7 +774,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
} }
*xdp_xmit = true; *xdp_xmit = true;
if (unlikely(xdp_page != page)) if (unlikely(xdp_page != page))
goto err_xdp; put_page(page);
rcu_read_unlock(); rcu_read_unlock();
goto xdp_xmit; goto xdp_xmit;
case XDP_REDIRECT: case XDP_REDIRECT:
...@@ -787,7 +786,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -787,7 +786,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
} }
*xdp_xmit = true; *xdp_xmit = true;
if (unlikely(xdp_page != page)) if (unlikely(xdp_page != page))
goto err_xdp; put_page(page);
rcu_read_unlock(); rcu_read_unlock();
goto xdp_xmit; goto xdp_xmit;
default: default:
...@@ -875,7 +874,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -875,7 +874,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
rcu_read_unlock(); rcu_read_unlock();
err_skb: err_skb:
put_page(page); put_page(page);
while (--num_buf) { while (num_buf-- > 1) {
buf = virtqueue_get_buf(rq->vq, &len); buf = virtqueue_get_buf(rq->vq, &len);
if (unlikely(!buf)) { if (unlikely(!buf)) {
pr_debug("%s: rx error: %d buffers missing\n", pr_debug("%s: rx error: %d buffers missing\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment