Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734769 > unrolled thread
| Started by | Jason Wang <jasowang@redhat.com> |
|---|---|
| First post | 2017-09-19 11:50 +0200 |
| Last post | 2017-09-20 23:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH net-next 2/3] virtio-net: add packet len average only when needed during XDP Jason Wang <jasowang@redhat.com> - 2017-09-19 11:50 +0200
Re: [PATCH net-next 2/3] virtio-net: add packet len average only when needed during XDP David Miller <davem@davemloft.net> - 2017-09-20 23:30 +0200
| From | Jason Wang <jasowang@redhat.com> |
|---|---|
| Date | 2017-09-19 11:50 +0200 |
| Subject | [PATCH net-next 2/3] virtio-net: add packet len average only when needed during XDP |
| Message-ID | <urnke-39c-7@gated-at.bofh.it> |
There's no need to add packet len average in the case of XDP_PASS
since it will be done soon after skb is created.
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/virtio_net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a0ef4b0..db5924c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -656,6 +656,9 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
xdp.data_end = xdp.data + (len - vi->hdr_len);
act = bpf_prog_run_xdp(xdp_prog, &xdp);
+ if (act != XDP_PASS)
+ ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
+
switch (act) {
case XDP_PASS:
/* recalculate offset to account for any header
@@ -671,14 +674,12 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
put_page(page);
head_skb = page_to_skb(vi, rq, xdp_page,
offset, len, PAGE_SIZE);
- ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
return head_skb;
}
break;
case XDP_TX:
if (unlikely(!virtnet_xdp_xmit(vi, &xdp)))
trace_xdp_exception(vi->dev, xdp_prog, act);
- ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
if (unlikely(xdp_page != page))
goto err_xdp;
rcu_read_unlock();
@@ -690,7 +691,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
case XDP_DROP:
if (unlikely(xdp_page != page))
__free_pages(xdp_page, 0);
- ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
goto err_xdp;
}
}
--
2.7.4
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-09-20 23:30 +0200 |
| Subject | Re: [PATCH net-next 2/3] virtio-net: add packet len average only when needed during XDP |
| Message-ID | <urUJb-8w7-13@gated-at.bofh.it> |
| In reply to | #1734769 |
From: Jason Wang <jasowang@redhat.com> Date: Tue, 19 Sep 2017 17:42:42 +0800 > There's no need to add packet len average in the case of XDP_PASS > since it will be done soon after skb is created. > > Cc: John Fastabend <john.fastabend@gmail.com> > Signed-off-by: Jason Wang <jasowang@redhat.com> Applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web