[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKD1Yr2ekC+dBO+o10Ot4ZMNHg+Qd47WbPHQRbAL6kLHvQ73hA@mail.gmail.com>
Date: Sat, 26 Apr 2014 12:40:12 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: David Miller <davem@...emloft.net>
Cc: David.Laight@...lab.com,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net-next v5 1/3] net: ipv6: Unduplicate
{raw,udp}v6_sendmsg code
On Sat, Apr 26, 2014 at 1:51 AM, David Miller <davem@...emloft.net> wrote:
> This consolidation makes the code much worse, not better.
This is because the three codepaths differ at the beginning, have a
common middle, and then later on UDP differs because it supports
corking and udplite, and because it does a ip6_dst_store at the end
(which I'd argue l2tp and ping should do as well but...).
I thought reducing duplication was useful, so I sent a patch to factor
out the duplicated code in the middle. The problem is that since the
codepaths also differ at the end, it has to pass in a lot of
parameters in, and pointers to local variables that we need later on.
I see a few ways to proceed here.
1. Refactor all these codepaths into a ip6_datagram_sendmsg that
handles all the code all the way to sending the packet. That would
basically look like udpv6_sendmsg does today, but it would also
support non-UDP sockets. A few more if statements, but no more
duplicated code.
2. Rework raw and l2tp (which are almost identical), into one
function, make ping use that function, and leave UDP alone.
3. Duplicate the cmsg / flowlabel parsing code into ping6.
4. Do nothing and have ping6 not support these APIs.
Thoughts?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists