netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Willem de Bruijn <willemb@google.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Subject: Re: [RFC PATCH v3 06/10] udp: cope with UDP GRO packet misdirection
Date: Wed, 31 Oct 2018 10:54:16 +0100	[thread overview]
Message-ID: <debe3f0794fa2c0c80890a24b56aa6785a648acb.camel@redhat.com> (raw)
In-Reply-To: <0fbc6f0cea4b3a976a003a593c6365cb4e4a9e99.1540920083.git.pabeni@redhat.com>

On Tue, 2018-10-30 at 18:24 +0100, Paolo Abeni wrote:
> --- a/include/net/udp.h
> +++ b/include/net/udp.h
> @@ -406,17 +406,24 @@ static inline int copy_linear_skb(struct sk_buff *skb, int len, int off,
>  } while(0)
>  
>  #if IS_ENABLED(CONFIG_IPV6)
> -#define __UDPX_INC_STATS(sk, field)					\
> -do {									\
> -	if ((sk)->sk_family == AF_INET)					\
> -		__UDP_INC_STATS(sock_net(sk), field, 0);		\
> -	else								\
> -		__UDP6_INC_STATS(sock_net(sk), field, 0);		\
> -} while (0)
> +#define __UDPX_MIB(sk, ipv4)						\
> +({									\
> +	ipv4 ? (IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_statistics :	\
> +				 sock_net(sk)->mib.udp_statistics) :	\
> +		(IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_stats_in6 :	\
> +				 sock_net(sk)->mib.udp_stats_in6);	\
> +})
>  #else
> -#define __UDPX_INC_STATS(sk, field) __UDP_INC_STATS(sock_net(sk), field, 0)
> +#define __UDPX_MIB(sk, ipv4)						\
> +({									\
> +	IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_statistics :		\
> +			 sock_net(sk)->mib.udp_statistics;		\
> +})
>  #endif
>  
> +#define __UDPX_INC_STATS(sk, field) \
> +	__SNMP_INC_STATS(__UDPX_MIB(sk, (sk)->sk_family == AF_INET, field)
> +

This is broken (complains only if CONFIG_AF_RXRPC is set), will fix in
next iteration (thanks kbuildbot).

But I'd prefer to keep the above helper: it can be used in a follow-up
patch to cleanup a bit udp6_recvmsg().

>  #ifdef CONFIG_PROC_FS
>  struct udp_seq_afinfo {
>  	sa_family_t			family;
> @@ -450,4 +457,32 @@ DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key);
>  void udpv6_encap_enable(void);
>  #endif
>  
> +static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
> +					      struct sk_buff *skb)
> +{
> +	bool ipv4 = skb->protocol == htons(ETH_P_IP);

And this cause a compile warning when # CONFIG_IPV6 is not set, I will
fix in the next iteration (again thanks kbuildbot)

Cheers,

Paolo

  reply	other threads:[~2018-10-31 18:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 17:24 [RFC PATCH v3 00/10] udp: implement GRO support Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 01/10] udp: implement complete book-keeping for encap_needed Paolo Abeni
2018-11-01 20:59   ` Willem de Bruijn
2018-11-02 13:30     ` Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 02/10] udp: implement GRO for plain UDP sockets Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 03/10] udp: add support for UDP_GRO cmsg Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 04/10] ip: factor out protocol delivery helper Paolo Abeni
2018-11-01  6:35   ` Subash Abhinov Kasiviswanathan
2018-11-02 13:30     ` Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 05/10] ipv6: " Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 06/10] udp: cope with UDP GRO packet misdirection Paolo Abeni
2018-10-31  9:54   ` Paolo Abeni [this message]
2018-11-01 21:01     ` Willem de Bruijn
2018-11-02 13:44       ` Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 07/10] selftests: add GRO support to udp bench rx program Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 08/10] selftests: conditionally enable XDP support in udpgso_bench_rx Paolo Abeni
2018-11-01 21:00   ` Willem de Bruijn
2018-10-30 17:24 ` [RFC PATCH v3 09/10] selftests: add some benchmark for UDP GRO Paolo Abeni
2018-10-30 17:24 ` [RFC PATCH v3 10/10] selftests: add functionals test " Paolo Abeni

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=debe3f0794fa2c0c80890a24b56aa6785a648acb.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=subashab@codeaurora.org \
    --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).