From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Toshiaki Makita <toshiaki.makita1@gmail.com>,
Lorenzo Bianconi <lorenzo@kernel.org>
Subject: Re: [PATCH net-next 3/4] veth: refine napi usage
Date: Fri, 09 Apr 2021 16:57:47 +0200 [thread overview]
Message-ID: <87y2drtsic.fsf@toke.dk> (raw)
In-Reply-To: <b241da0e8aa31773472591e219ada3632a84dfbb.1617965243.git.pabeni@redhat.com>
Paolo Abeni <pabeni@redhat.com> writes:
> After the previous patch, when enabling GRO, locally generated
> TCP traffic experiences some measurable overhead, as it traverses
> the GRO engine without any chance of aggregation.
>
> This change refine the NAPI receive path admission test, to avoid
> unnecessary GRO overhead in most scenarios, when GRO is enabled
> on a veth peer.
>
> Only skbs that are eligible for aggregation enter the GRO layer,
> the others will go through the traditional receive path.
>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> drivers/net/veth.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index ca44e82d1edeb..85f90f33d437e 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -282,6 +282,25 @@ static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
> netif_rx(skb);
> }
>
> +/* return true if the specified skb has chances of GRO aggregation
> + * Don't strive for accuracy, but try to avoid GRO overhead in the most
> + * common scenarios.
> + * When XDP is enabled, all traffic is considered eligible, as the xmit
> + * device has TSO off.
> + * When TSO is enabled on the xmit device, we are likely interested only
> + * in UDP aggregation, explicitly check for that if the skb is suspected
> + * - the sock_wfree destructor is used by UDP, ICMP and XDP sockets -
> + * to belong to locally generated UDP traffic.
> + */
> +static bool veth_skb_is_eligible_for_gro(const struct net_device *dev,
> + const struct net_device *rcv,
> + const struct sk_buff *skb)
> +{
> + return !(dev->features & NETIF_F_ALL_TSO) ||
> + (skb->destructor == sock_wfree &&
> + rcv->features & (NETIF_F_GRO_FRAGLIST | NETIF_F_GRO_UDP_FWD));
> +}
> +
> static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct veth_priv *rcv_priv, *priv = netdev_priv(dev);
> @@ -305,8 +324,10 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
>
> /* The napi pointer is available when an XDP program is
> * attached or when GRO is enabled
> + * Don't bother with napi/GRO if the skb can't be aggregated
> */
> - use_napi = rcu_access_pointer(rq->napi);
> + use_napi = rcu_access_pointer(rq->napi) &&
> + veth_skb_is_eligible_for_gro(dev, rcv, skb);
> skb_record_rx_queue(skb, rxq);
> }
You just changed the 'xdp_rcv' check to this use_napi, and now you're
conditioning it on GRO eligibility, so doesn't this break XDP if that
was the reason NAPI was turned on in the first place?
-Toke
next prev parent reply other threads:[~2021-04-09 14:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 11:04 [PATCH net-next 0/4] veth: allow GRO even without XDP Paolo Abeni
2021-04-09 11:04 ` [PATCH net-next 1/4] veth: use skb_orphan_partial instead of skb_orphan Paolo Abeni
2021-04-09 11:04 ` [PATCH net-next 2/4] veth: allow enabling NAPI even without XDP Paolo Abeni
2021-04-09 14:58 ` Toke Høiland-Jørgensen
2021-04-09 15:20 ` Paolo Abeni
2021-04-16 15:29 ` Toke Høiland-Jørgensen
2021-04-16 17:26 ` Paolo Abeni
2021-04-16 18:19 ` Toke Høiland-Jørgensen
2021-04-09 11:04 ` [PATCH net-next 3/4] veth: refine napi usage Paolo Abeni
2021-04-09 14:57 ` Toke Høiland-Jørgensen [this message]
2021-04-09 15:07 ` Paolo Abeni
2021-04-09 15:18 ` Toke Høiland-Jørgensen
2021-04-09 11:04 ` [PATCH net-next 4/4] self-tests: add veth tests Paolo Abeni
2021-04-12 0:10 ` [PATCH net-next 0/4] veth: allow GRO even without XDP patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y2drtsic.fsf@toke.dk \
--to=toke@redhat.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toshiaki.makita1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).