linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Michael Tuexen <tuexen@fh-muenster.de>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCHv2 net-next 02/17] udp6: move the mss check after udp gso tunnel processing
Date: Fri, 09 Oct 2020 13:59:26 +0000	[thread overview]
Message-ID: <CA+FuTSd1MZusO_9W8tkn99jGCu94o3K+6e8zROz_FNEMWt6Crg@mail.gmail.com> (raw)
In-Reply-To: <CADvbK_en7mePKdmMaLr9V8hTdmjf2bSVpSrid2CjharJtvD6YQ@mail.gmail.com>

On Thu, Oct 8, 2020 at 9:49 PM Xin Long <lucien.xin@gmail.com> wrote:
>
> On Thu, Oct 8, 2020 at 8:45 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > On Thu, Oct 8, 2020 at 5:48 AM Xin Long <lucien.xin@gmail.com> wrote:
> > >
> > > For some protocol's gso, like SCTP, it's using GSO_BY_FRAGS for
> > > gso_size. When using UDP to encapsulate its packet, it will
> > > return error in udp6_ufo_fragment() as skb->len < gso_size,
> > > and it will never go to the gso tunnel processing.
> > >
> > > So we should move this check after udp gso tunnel processing,
> > > the same as udp4_ufo_fragment() does. While at it, also tidy
> > > the variables up.
> >
> > Please don't mix a new feature and code cleanup.
> Hi, Willem,
>
> Tidying up variables are not worth a single patch, that's what I was
> thinking. I can leave the variables as it is if you wish in this patch.
>
> >
> > This patch changes almost every line of the function due to
> > indentation changes. But the only relevant part is
> >
> > "
> >         mss = skb_shinfo(skb)->gso_size;
> >         if (unlikely(skb->len <= mss))
> >                 goto out;
> >
> >         if (skb->encapsulation && skb_shinfo(skb)->gso_type &
> >             (SKB_GSO_UDP_TUNNEL|SKB_GSO_UDP_TUNNEL_CSUM))
> >                 segs = skb_udp_tunnel_segment(skb, features, true);
> >         else {
> >                 /* irrelevant here */
> >         }
> >
> > out:
> >         return segs;
> > }
> > "
> >
> > Is it a sufficient change to just skip the mss check if mss = GSO_BY_FRAGS?
> It is sufficient.
>
> But I think we'd better keep the code here consistent with ipv4's if
> there's no other reason to do 'skb->len <= mss' check at the first.
>
> We can go with if-else as you showed above now, then do a cleanup in
> the future. What do you think?

I do think that's a better approach, thanks.

Mixing in feature changes with 150+ lines of code refactoring makes it
hard to spot the behavioral change.

Too often the additional purportedly noop refactoring proves to have
subtle behavioral changes after all. It's easier to review for this if
that patch is separate. Not saying it's the case here, of course.

Refactoring also adds a layer of indirection when using git blame to
understand code or for people who have the existing code memorized, so
has a fairly high bar imho.

WARNING: multiple messages have this Message-ID (diff)
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Michael Tuexen <tuexen@fh-muenster.de>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCHv2 net-next 02/17] udp6: move the mss check after udp gso tunnel processing
Date: Fri, 9 Oct 2020 09:59:26 -0400	[thread overview]
Message-ID: <CA+FuTSd1MZusO_9W8tkn99jGCu94o3K+6e8zROz_FNEMWt6Crg@mail.gmail.com> (raw)
Message-ID: <20201009135926.iVxlGx_OOlYqQJ4mfu_3DwTyMSchGrmVwgLdfTyZFP8@z> (raw)
In-Reply-To: <CADvbK_en7mePKdmMaLr9V8hTdmjf2bSVpSrid2CjharJtvD6YQ@mail.gmail.com>

On Thu, Oct 8, 2020 at 9:49 PM Xin Long <lucien.xin@gmail.com> wrote:
>
> On Thu, Oct 8, 2020 at 8:45 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > On Thu, Oct 8, 2020 at 5:48 AM Xin Long <lucien.xin@gmail.com> wrote:
> > >
> > > For some protocol's gso, like SCTP, it's using GSO_BY_FRAGS for
> > > gso_size. When using UDP to encapsulate its packet, it will
> > > return error in udp6_ufo_fragment() as skb->len < gso_size,
> > > and it will never go to the gso tunnel processing.
> > >
> > > So we should move this check after udp gso tunnel processing,
> > > the same as udp4_ufo_fragment() does. While at it, also tidy
> > > the variables up.
> >
> > Please don't mix a new feature and code cleanup.
> Hi, Willem,
>
> Tidying up variables are not worth a single patch, that's what I was
> thinking. I can leave the variables as it is if you wish in this patch.
>
> >
> > This patch changes almost every line of the function due to
> > indentation changes. But the only relevant part is
> >
> > "
> >         mss = skb_shinfo(skb)->gso_size;
> >         if (unlikely(skb->len <= mss))
> >                 goto out;
> >
> >         if (skb->encapsulation && skb_shinfo(skb)->gso_type &
> >             (SKB_GSO_UDP_TUNNEL|SKB_GSO_UDP_TUNNEL_CSUM))
> >                 segs = skb_udp_tunnel_segment(skb, features, true);
> >         else {
> >                 /* irrelevant here */
> >         }
> >
> > out:
> >         return segs;
> > }
> > "
> >
> > Is it a sufficient change to just skip the mss check if mss == GSO_BY_FRAGS?
> It is sufficient.
>
> But I think we'd better keep the code here consistent with ipv4's if
> there's no other reason to do 'skb->len <= mss' check at the first.
>
> We can go with if-else as you showed above now, then do a cleanup in
> the future. What do you think?

I do think that's a better approach, thanks.

Mixing in feature changes with 150+ lines of code refactoring makes it
hard to spot the behavioral change.

Too often the additional purportedly noop refactoring proves to have
subtle behavioral changes after all. It's easier to review for this if
that patch is separate. Not saying it's the case here, of course.

Refactoring also adds a layer of indirection when using git blame to
understand code or for people who have the existing code memorized, so
has a fairly high bar imho.

  parent reply	other threads:[~2020-10-09 13:59 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  9:47 [PATCHv2 net-next 00/17] sctp: Implement RFC6951: UDP Encapsulation of SCTP Xin Long
2020-10-08  9:47 ` Xin Long
2020-10-08  9:47 ` [PATCHv2 net-next 01/17] udp: check udp sock encap_type in __udp_lib_err Xin Long
2020-10-08  9:47   ` Xin Long
2020-10-08  9:47   ` [PATCHv2 net-next 02/17] udp6: move the mss check after udp gso tunnel processing Xin Long
2020-10-08  9:47     ` Xin Long
2020-10-08  9:47     ` [PATCHv2 net-next 03/17] udp: do checksum properly in skb_udp_tunnel_segment Xin Long
2020-10-08  9:47       ` Xin Long
2020-10-08  9:48       ` [PATCHv2 net-next 04/17] udp: support sctp over udp " Xin Long
2020-10-08  9:48         ` Xin Long
2020-10-08  9:48         ` [PATCHv2 net-next 05/17] sctp: create udp4 sock and add its encap_rcv Xin Long
2020-10-08  9:48           ` Xin Long
2020-10-08  9:48           ` [PATCHv2 net-next 06/17] sctp: create udp6 sock and set " Xin Long
2020-10-08  9:48             ` Xin Long
2020-10-08  9:48             ` [PATCHv2 net-next 07/17] sctp: add encap_err_lookup for udp encap socks Xin Long
2020-10-08  9:48               ` Xin Long
2020-10-08  9:48               ` [PATCHv2 net-next 08/17] sctp: add encap_port for netns sock asoc and transport Xin Long
2020-10-08  9:48                 ` Xin Long
2020-10-08  9:48                 ` [PATCHv2 net-next 09/17] sctp: add SCTP_REMOTE_UDP_ENCAPS_PORT sockopt Xin Long
2020-10-08  9:48                   ` Xin Long
2020-10-08  9:48                   ` [PATCHv2 net-next 10/17] sctp: allow changing transport encap_port by peer packets Xin Long
2020-10-08  9:48                     ` Xin Long
2020-10-08  9:48                     ` [PATCHv2 net-next 11/17] sctp: add udphdr to overhead when udp_port is set Xin Long
2020-10-08  9:48                       ` Xin Long
2020-10-08  9:48                       ` [PATCHv2 net-next 12/17] sctp: call sk_setup_caps in sctp_packet_transmit instead Xin Long
2020-10-08  9:48                         ` Xin Long
2020-10-08  9:48                         ` [PATCHv2 net-next 13/17] sctp: support for sending packet over udp4 sock Xin Long
2020-10-08  9:48                           ` Xin Long
2020-10-08  9:48                           ` [PATCHv2 net-next 14/17] sctp: support for sending packet over udp6 sock Xin Long
2020-10-08  9:48                             ` Xin Long
2020-10-08  9:48                             ` [PATCHv2 net-next 15/17] sctp: add the error cause for new encapsulation port restart Xin Long
2020-10-08  9:48                               ` Xin Long
2020-10-08  9:48                               ` [PATCHv2 net-next 16/17] sctp: handle the init chunk matching an existing asoc Xin Long
2020-10-08  9:48                                 ` Xin Long
2020-10-08  9:48                                 ` [PATCHv2 net-next 17/17] sctp: enable udp tunneling socks Xin Long
2020-10-08  9:48                                   ` Xin Long
2020-10-08 15:46                                   ` kernel test robot
2020-10-08 15:46                                     ` kernel test robot
2020-10-09  2:02                                     ` Xin Long
2020-10-09  2:02                                       ` Xin Long
2020-10-08 14:33                               ` [PATCHv2 net-next 15/17] sctp: add the error cause for new encapsulation port restart kernel test robot
2020-10-08 14:33                                 ` kernel test robot
2020-10-08 13:10                   ` [PATCHv2 net-next 09/17] sctp: add SCTP_REMOTE_UDP_ENCAPS_PORT sockopt kernel test robot
2020-10-08 13:10                     ` kernel test robot
2020-10-08 21:18             ` [PATCHv2 net-next 06/17] sctp: create udp6 sock and set its encap_rcv kernel test robot
2020-10-08 21:18               ` kernel test robot
2020-10-09  1:59               ` Xin Long
2020-10-09  1:59                 ` Xin Long
2020-10-08 18:29           ` [PATCHv2 net-next 05/17] sctp: create udp4 sock and add " kernel test robot
2020-10-08 18:29             ` kernel test robot
2020-10-09  1:59             ` Xin Long
2020-10-09  1:59               ` Xin Long
2020-10-08 10:01         ` [PATCHv2 net-next 04/17] udp: support sctp over udp in skb_udp_tunnel_segment Xin Long
2020-10-08 10:01           ` Xin Long
2020-10-08 10:01       ` [PATCHv2 net-next 03/17] udp: do checksum properly " Xin Long
2020-10-08 10:01         ` Xin Long
2020-10-08 12:44     ` [PATCHv2 net-next 02/17] udp6: move the mss check after udp gso tunnel processing Willem de Bruijn
2020-10-08 12:44       ` Willem de Bruijn
2020-10-09  1:48       ` Xin Long
2020-10-09  1:48         ` Xin Long
2020-10-09 13:59         ` Willem de Bruijn [this message]
2020-10-09 13:59           ` Willem de Bruijn

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=CA+FuTSd1MZusO_9W8tkn99jGCu94o3K+6e8zROz_FNEMWt6Crg@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=tuexen@fh-muenster.de \
    /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).