From: Josef Bacik <jbacik@fb.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: <davem@davemloft.net>, <kraigatgoog@gmail.com>,
<eric.dumazet@gmail.com>, <tom@herbertland.com>,
<netdev@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH 1/5 net-next] inet: replace ->bind_conflict with ->rcv_saddr_equal
Date: Wed, 21 Dec 2016 10:16:54 -0500 [thread overview]
Message-ID: <1482333414.24490.12@smtp.office365.com> (raw)
In-Reply-To: <1482332814.2260.6.camel@stressinduktion.org>
On Wed, Dec 21, 2016 at 10:06 AM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Tue, 2016-12-20 at 15:07 -0500, Josef Bacik wrote:
>> The only difference between inet6_csk_bind_conflict and
>> inet_csk_bind_conflict
>> is how they check the rcv_saddr. Since we want to be able to check
>> the saddr in
>> other places just drop the protocol specific ->bind_conflict and
>> replace it with
>> ->rcv_saddr_equal, then make inet_csk_bind_conflict the one true
>> bind conflict
>> function.
>>
>> Signed-off-by: Josef Bacik <jbacik@fb.com>
>>
>
>
>
>> ---
>> include/net/inet6_connection_sock.h | 5 -----
>> include/net/inet_connection_sock.h | 9 +++------
>> net/dccp/ipv4.c | 3 ++-
>> net/dccp/ipv6.c | 2 +-
>> net/ipv4/inet_connection_sock.c | 22 +++++++-------------
>> net/ipv4/tcp_ipv4.c | 3 ++-
>> net/ipv4/udp.c | 1 +
>> net/ipv6/inet6_connection_sock.c | 40
>> -------------------------------------
>> net/ipv6/tcp_ipv6.c | 4 ++--
>> 9 files changed, 18 insertions(+), 71 deletions(-)
>>
>> diff --git a/include/net/inet6_connection_sock.h
>> b/include/net/inet6_connection_sock.h
>> index 3212b39..8ec87b6 100644
>> --- a/include/net/inet6_connection_sock.h
>> +++ b/include/net/inet6_connection_sock.h
>> @@ -15,16 +15,11 @@
>>
>> #include <linux/types.h>
>>
>> -struct inet_bind_bucket;
>> struct request_sock;
>> struct sk_buff;
>> struct sock;
>> struct sockaddr;
>>
>> -int inet6_csk_bind_conflict(const struct sock *sk,
>> - const struct inet_bind_bucket *tb, bool relax,
>> - bool soreuseport_ok);
>> -
>> struct dst_entry *inet6_csk_route_req(const struct sock *sk,
>> struct flowi6 *fl6,
>> const struct request_sock *req, u8 proto);
>>
>> diff --git a/include/net/inet_connection_sock.h
>> b/include/net/inet_connection_sock.h
>> index ec0479a..9cd43c5 100644
>> --- a/include/net/inet_connection_sock.h
>> +++ b/include/net/inet_connection_sock.h
>> @@ -62,9 +62,9 @@ struct inet_connection_sock_af_ops {
>> char __user *optval, int __user *optlen);
>> #endif
>> void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
>> - int (*bind_conflict)(const struct sock *sk,
>> - const struct inet_bind_bucket *tb,
>> - bool relax, bool soreuseport_ok);
>> + int (*rcv_saddr_equal)(const struct sock *sk1,
>> + const struct sock *sk2,
>> + bool match_wildcard);
>> void (*mtu_reduced)(struct sock *sk);
>> };
>>
>>
>
> The patch looks as a nice code cleanup already!
>
> Have you looked if we can simply have one rcv_saddr_equal for both
> ipv4
> and ipv6 that e.g. uses sk->sk_family instead of function pointers?
> This could give us even more possibilities to remove some indirect
> functions calls and thus might relieve some cycles?
I was going to do that but I'm not familiar enough with how sockets
work to be comfortable. My main concern is we have the ipv6_only()
check on a socket, which seems to indicate to me that you can have a
socket that can do both ipv4/ipv6, so what if we're specifically going
through the ipv6 code, but we aren't ipv6_only() and we end up doing
the ipv4 address compare when we really need to do the ipv6 address
compare? If this can't happen (and honestly as I type it out it sounds
crazier than it did in my head) then yeah I'll totally do that as well
and we can just have a global function without the protocol specific
callbacks, but I need you or somebody to tell me I'm crazy and that it
would be ok to have it all in one function. Thanks,
Josef
next prev parent reply other threads:[~2016-12-21 15:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 20:06 [RFC][PATCH 0/5 net-next] Rework inet_csk_get_port Josef Bacik
2016-12-20 20:07 ` [PATCH 1/5 net-next] inet: replace ->bind_conflict with ->rcv_saddr_equal Josef Bacik
2016-12-21 15:06 ` Hannes Frederic Sowa
2016-12-21 15:16 ` Josef Bacik [this message]
2016-12-22 20:00 ` Hannes Frederic Sowa
2016-12-21 15:23 ` Hannes Frederic Sowa
2016-12-21 15:59 ` Josef Bacik
2016-12-21 18:28 ` David Miller
2016-12-20 20:07 ` [PATCH 2/5 net-next] inet: kill smallest_size and smallest_port Josef Bacik
2016-12-21 18:30 ` David Miller
2016-12-21 19:29 ` Eric Dumazet
2016-12-21 19:32 ` Josef Bacik
2016-12-20 20:07 ` [PATCH 3/5 net-next] inet: don't check for bind conflicts twice when searching for a port Josef Bacik
2016-12-21 15:08 ` Hannes Frederic Sowa
2016-12-21 15:12 ` Josef Bacik
2016-12-20 20:07 ` [PATCH 4/5 net-next] inet: split inet_csk_get_port into two functions Josef Bacik
2016-12-20 20:07 ` [PATCH 5/5 net-next] inet: reset tb->fastreuseport when adding a reuseport sk Josef Bacik
2016-12-21 16:49 ` Craig Gallek
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=1482333414.24490.12@smtp.office365.com \
--to=jbacik@fb.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hannes@stressinduktion.org \
--cc=kernel-team@fb.com \
--cc=kraigatgoog@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.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).