All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: clean up tcp_v6_early_demux() icsk variable
@ 2012-10-05 13:21 Neal Cardwell
  2012-10-05 13:56 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Cardwell @ 2012-10-05 13:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Eric Dumazet, Neal Cardwell

Remove an icsk variable, which by convention should refer to an
inet_connection_sock rather than an inet_sock. In the process, make
the tcp_v6_early_demux() code and formatting a bit more like
tcp_v4_early_demux(), to ease comparisons and maintenance.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv6/tcp_ipv6.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 49c8903..491c41b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1740,11 +1740,11 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
 		skb->destructor = sock_edemux;
 		if (sk->sk_state != TCP_TIME_WAIT) {
 			struct dst_entry *dst = sk->sk_rx_dst;
-			struct inet_sock *icsk = inet_sk(sk);
+
 			if (dst)
 				dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
 			if (dst &&
-			    icsk->rx_dst_ifindex == skb->skb_iif)
+			    inet_sk(sk)->rx_dst_ifindex == skb->skb_iif)
 				skb_dst_set_noref(skb, dst);
 		}
 	}
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: clean up tcp_v6_early_demux() icsk variable
  2012-10-05 13:21 [PATCH net] ipv6: clean up tcp_v6_early_demux() icsk variable Neal Cardwell
@ 2012-10-05 13:56 ` Eric Dumazet
  2012-10-05 16:25   ` Neal Cardwell
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-10-05 13:56 UTC (permalink / raw)
  To: Neal Cardwell; +Cc: David Miller, netdev, Eric Dumazet

On Fri, 2012-10-05 at 09:21 -0400, Neal Cardwell wrote:
> Remove an icsk variable, which by convention should refer to an
> inet_connection_sock rather than an inet_sock. In the process, make
> the tcp_v6_early_demux() code and formatting a bit more like
> tcp_v4_early_demux(), to ease comparisons and maintenance.
> 
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> ---
>  net/ipv6/tcp_ipv6.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 49c8903..491c41b 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -1740,11 +1740,11 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
>  		skb->destructor = sock_edemux;
>  		if (sk->sk_state != TCP_TIME_WAIT) {
>  			struct dst_entry *dst = sk->sk_rx_dst;
> -			struct inet_sock *icsk = inet_sk(sk);
> +
>  			if (dst)
>  				dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
>  			if (dst &&
> -			    icsk->rx_dst_ifindex == skb->skb_iif)
> +			    inet_sk(sk)->rx_dst_ifindex == skb->skb_iif)
>  				skb_dst_set_noref(skb, dst);
>  		}
>  	}

Hi Neal

I would wait net-next being opened, and do a full merge/cleanup

For example ipv6 uses :

if (!pskb_may_pull(skb, skb_transport_offset(skb) + 
                   sizeof(struct tcphdr))) 
th = tcp_hdr(skb);

while ipv4 uses :

if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));

It would be good to use the ipv6 variant (its less instructions and
cleaner)

Same for the "struct net *net = dev_net(skb->dev);" used in ipv4, while
ipv6 doesnt need this extra net variable.

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: clean up tcp_v6_early_demux() icsk variable
  2012-10-05 13:56 ` Eric Dumazet
@ 2012-10-05 16:25   ` Neal Cardwell
  0 siblings, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2012-10-05 16:25 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Netdev, Eric Dumazet

OK, thanks, Eric. This sounds good. We can scrap this one, and we'll
do a full merge/clean-up when net-next is open.

neal

On Fri, Oct 5, 2012 at 9:56 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2012-10-05 at 09:21 -0400, Neal Cardwell wrote:
>> Remove an icsk variable, which by convention should refer to an
>> inet_connection_sock rather than an inet_sock. In the process, make
>> the tcp_v6_early_demux() code and formatting a bit more like
>> tcp_v4_early_demux(), to ease comparisons and maintenance.
>>
>> Signed-off-by: Neal Cardwell <ncardwell@google.com>
>> ---
>>  net/ipv6/tcp_ipv6.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
>> index 49c8903..491c41b 100644
>> --- a/net/ipv6/tcp_ipv6.c
>> +++ b/net/ipv6/tcp_ipv6.c
>> @@ -1740,11 +1740,11 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
>>               skb->destructor = sock_edemux;
>>               if (sk->sk_state != TCP_TIME_WAIT) {
>>                       struct dst_entry *dst = sk->sk_rx_dst;
>> -                     struct inet_sock *icsk = inet_sk(sk);
>> +
>>                       if (dst)
>>                               dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
>>                       if (dst &&
>> -                         icsk->rx_dst_ifindex == skb->skb_iif)
>> +                         inet_sk(sk)->rx_dst_ifindex == skb->skb_iif)
>>                               skb_dst_set_noref(skb, dst);
>>               }
>>       }
>
> Hi Neal
>
> I would wait net-next being opened, and do a full merge/cleanup
>
> For example ipv6 uses :
>
> if (!pskb_may_pull(skb, skb_transport_offset(skb) +
>                    sizeof(struct tcphdr)))
> th = tcp_hdr(skb);
>
> while ipv4 uses :
>
> if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
> th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
>
> It would be good to use the ipv6 variant (its less instructions and
> cleaner)
>
> Same for the "struct net *net = dev_net(skb->dev);" used in ipv4, while
> ipv6 doesnt need this extra net variable.
>
> Thanks
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-05 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05 13:21 [PATCH net] ipv6: clean up tcp_v6_early_demux() icsk variable Neal Cardwell
2012-10-05 13:56 ` Eric Dumazet
2012-10-05 16:25   ` Neal Cardwell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.