netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Willem de Bruijn <willemb@google.com>,
	Steffen Klassert <steffen.klassert@secunet.com>
Subject: Re: [RFC PATCH v2 06/10] udp: cope with UDP GRO packet misdirection
Date: Mon, 22 Oct 2018 13:04:36 -0600	[thread overview]
Message-ID: <f87ef4ed8f5c0ab5989d3e067b218005@codeaurora.org> (raw)
In-Reply-To: <63e4ceb238db122d3d831f0809285243701b2284.1539957909.git.pabeni@redhat.com>

On 2018-10-19 08:25, Paolo Abeni wrote:
> In some scenarios, the GRO engine can assemble an UDP GRO packet
> that ultimately lands on a non GRO-enabled socket.
> This patch tries to address the issue explicitly checking for the UDP
> socket features before enqueuing the packet, and eventually segmenting
> the unexpected GRO packet, as needed.
> 
> We must also cope with re-insertion requests: after segmentation the
> UDP code calls the helper introduced by the previous patches, as 
> needed.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> +static inline bool udp_unexpected_gso(struct sock *sk, struct sk_buff
> *skb)
> +{
> +	return !udp_sk(sk)->gro_enabled && skb_is_gso(skb) &&
> +	       skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4;
> +}
> +
> +static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
> +					      struct sk_buff *skb)
> +{
> +	struct sk_buff *segs;
> +
> +	/* the GSO CB lays after the UDP one, no need to save and restore
> any
> +	 * CB fragment, just initialize it
> +	 */
> +	segs = __skb_gso_segment(skb, NETIF_F_SG, false);
> +	if (unlikely(IS_ERR(segs)))
> +		kfree_skb(skb);
> +	else if (segs)
> +		consume_skb(skb);
> +	return segs;
> +}
> +
> +

Hi Paolo

Do we need to check for IS_ERR_OR_NULL(segs)

> 
> +void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int
> proto);
> +
> +static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> +{
> +	struct sk_buff *next, *segs;
> +	int ret;
> +
> +	if (likely(!udp_unexpected_gso(sk, skb)))
> +		return udp_queue_rcv_one_skb(sk, skb);

> +static int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> +{
> +	struct sk_buff *next, *segs;
> +	int ret;
> +
> +	if (likely(!udp_unexpected_gso(sk, skb)))
> +		return udpv6_queue_rcv_one_skb(sk, skb);
> +

Is the "likely" required here?
HW can coalesce all incoming streams of UDP and may not know the socket 
state.
In that case, a socket not having UDP GRO option might see a penalty 
here.


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2018-10-23  3:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 14:25 [RFC PATCH v2 00/10] udp: implement GRO support Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 01/10] udp: implement complete book-keeping for encap_needed Paolo Abeni
2018-10-22 16:06   ` Willem de Bruijn
2018-10-25 13:00     ` Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 02/10] udp: implement GRO for plain UDP sockets Paolo Abeni
2018-10-21 20:06   ` Willem de Bruijn
2018-10-22 10:13     ` Paolo Abeni
2018-10-22 15:15       ` Willem de Bruijn
2018-10-22 11:24   ` Steffen Klassert
2018-10-22 13:41     ` Paolo Abeni
2018-10-22 15:51       ` Willem de Bruijn
2018-10-19 14:25 ` [RFC PATCH v2 03/10] udp: add support for UDP_GRO cmsg Paolo Abeni
2018-10-21 20:07   ` Willem de Bruijn
2018-10-22 15:44     ` Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 04/10] ip: factor out protocol delivery helper Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 05/10] ipv6: " Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 06/10] udp: cope with UDP GRO packet misdirection Paolo Abeni
2018-10-21 20:08   ` Willem de Bruijn
2018-10-22 10:29     ` Paolo Abeni
2018-10-22 16:00       ` Willem de Bruijn
2018-10-22 11:43   ` Steffen Klassert
2018-10-22 12:51     ` Paolo Abeni
2018-10-23 10:29       ` Steffen Klassert
2018-10-22 19:04   ` Subash Abhinov Kasiviswanathan [this message]
2018-10-23  7:59     ` Paolo Abeni
2018-10-24  0:55       ` Subash Abhinov Kasiviswanathan
2018-10-19 14:25 ` [RFC PATCH v2 07/10] selftests: add GRO support to udp bench rx program Paolo Abeni
2018-10-21 20:08   ` Willem de Bruijn
2018-10-22 10:31     ` Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 08/10] selftests: conditionally enable XDP support in udpgso_bench_rx Paolo Abeni
2018-10-21 20:09   ` Willem de Bruijn
2018-10-22 10:37     ` Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 09/10] selftests: add some benchmark for UDP GRO Paolo Abeni
2018-10-19 14:25 ` [RFC PATCH v2 10/10] selftests: add functionals test " Paolo Abeni
2018-10-21 20:09   ` Willem de Bruijn
2018-10-22 10:46     ` Paolo Abeni
2018-10-21 20:05 ` [RFC PATCH v2 00/10] udp: implement GRO support Willem de Bruijn
2018-10-22  9:41   ` Paolo Abeni
2018-10-23 12:10 ` Steffen Klassert
2018-10-23 12:22   ` Paolo Abeni
2018-10-24 10:55     ` Steffen Klassert

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=f87ef4ed8f5c0ab5989d3e067b218005@codeaurora.org \
    --to=subashab@codeaurora.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.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).