netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <hkchu@google.com>, <edumazet@google.com>,
	<herbert@gondor.apana.org.au>, <netdev@vger.kernel.org>,
	<davem@davemloft.net>, <yanb@mellanox.com>,
	<shlomop@mellanox.com>
Subject: Re: [PATCH net-next V3 3/3] net: Add GRO support for vxlan traffic
Date: Thu, 9 Jan 2014 08:32:24 +0200	[thread overview]
Message-ID: <52CE4278.6050505@mellanox.com> (raw)
In-Reply-To: <1389219101.31367.21.camel@edumazet-glaptop2.roam.corp.google.com>

On 09/01/2014 00:11, Eric Dumazet wrote:
> On Wed, 2014-01-08 at 22:34 +0200, Or Gerlitz wrote:
>
>> +
>>   /* Notify netdevs that UDP port started listening */
>> -static void vxlan_notify_add_rx_port(struct sock *sk)
>> +static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
>>   {
>>   	struct net_device *dev;
>> +	struct sock *sk = vs->sock->sk;
>>   	struct net *net = sock_net(sk);
>>   	sa_family_t sa_family = sk->sk_family;
>>   	__be16 port = inet_sk(sk)->inet_sport;
>> @@ -569,12 +671,16 @@ static void vxlan_notify_add_rx_port(struct sock *sk)
>>   							    port);
>>   	}
>>   	rcu_read_unlock();
>> +
>> +	if (sa_family == AF_INET)
>> +		call_rcu(&vs->rcu, vxlan_add_udp_offload);
> Why waiting RCU grace period here?

Basically the add operation can be done right away, however, since the 
delete operation can't be done
instantly when we want it, I wanted to protect against a series of 
add/del/add in times T1 < T2 < T3

T1 add(X)
T2 del(X)
T3 add(X)

where the delete is deferred and as a result the 2nd add is done before 
the delete and @ the end offload X is not added in the 2nd time.From 
your other comment below I conclude that I probably miss something about 
the rcu usage here, so will give it further thought.



>
>>   }
>>   
>>   /* Notify netdevs that UDP port is no more listening */
>> -static void vxlan_notify_del_rx_port(struct sock *sk)
>> +static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
>>   {
>>   	struct net_device *dev;
>> +	struct sock *sk = vs->sock->sk;
>>   	struct net *net = sock_net(sk);
>>   	sa_family_t sa_family = sk->sk_family;
>>   	__be16 port = inet_sk(sk)->inet_sport;
>> @@ -586,6 +692,9 @@ static void vxlan_notify_del_rx_port(struct sock *sk)
>>   							    port);
>>   	}
>>   	rcu_read_unlock();
>> +
>> +	if (sa_family == AF_INET)
>> +		call_rcu(&vs->rcu, vxlan_del_udp_offload);
>>   }
> This looks buggy.
>
> You need to :
>
> 1) remove the offload structure from list
> 2) Then wait rcu grace period, and finally free the memory
>
>
>

      reply	other threads:[~2014-01-09  6:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 20:34 [PATCH net-next V3 0/3] net: Add GRO support for UDP encapsulating protocols Or Gerlitz
2014-01-08 20:34 ` [PATCH net-next V3 1/3] " Or Gerlitz
2014-01-08 20:39   ` Or Gerlitz
2014-01-08 21:58   ` Tom Herbert
2014-01-09  6:25     ` Or Gerlitz
2014-01-09  7:09   ` Tom Herbert
2014-01-09  7:14     ` Or Gerlitz
2014-01-08 20:34 ` [PATCH net-next V3 2/3] net: Export gro_find_by_type helpers Or Gerlitz
2014-01-08 20:34 ` [PATCH net-next V3 3/3] net: Add GRO support for vxlan traffic Or Gerlitz
2014-01-08 22:09   ` Eric Dumazet
2014-01-09  6:28     ` Or Gerlitz
2014-01-08 22:11   ` Eric Dumazet
2014-01-09  6:32     ` Or Gerlitz [this message]

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=52CE4278.6050505@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hkchu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=shlomop@mellanox.com \
    --cc=yanb@mellanox.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).