All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schultz <aschultz@tpip.net>
To: pablo <pablo@netfilter.org>
Cc: netdev <netdev@vger.kernel.org>, laforge <laforge@gnumonks.org>,
	Lionel Gauthier <Lionel.Gauthier@eurecom.fr>,
	openbsc <openbsc@lists.osmocom.org>
Subject: Re: [PATCH net-next v2 1/6] gtp: make GTP sockets in gtp_newlink optional
Date: Thu, 2 Feb 2017 15:30:51 +0100 (CET)	[thread overview]
Message-ID: <1114368875.730626.1486045851291.JavaMail.zimbra@tpip.net> (raw)
In-Reply-To: <20170202141011.GB23901@salvia>



----- On Feb 2, 2017, at 3:10 PM, pablo pablo@netfilter.org wrote:

> On Mon, Jan 30, 2017 at 05:37:08PM +0100, Andreas Schultz wrote:
>> Having both GTPv0-U and GTPv1-U is not always desirable.
>> Fallback from GTPv1-U to GTPv0-U was depreciated from 3GPP
>> Rel-8 onwards. Post Rel-8 implementation are discuraged
>> from listening on the v0 port (see 3GPP TS 29.281, Sect. 1).
>> 
>> A future change will completely decouple the sockets from the
>> network device. Till then, at least one of the sockets needs to
>> be specified (either v0 or v1), the other is optional.
>> 
>> Signed-off-by: Andreas Schultz <aschultz@tpip.net>
>> ---
>>  drivers/net/gtp.c | 142 +++++++++++++++++++++++++++++-------------------------
>>  1 file changed, 76 insertions(+), 66 deletions(-)
>> 
>> diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
>> index bda0c64..18944f4 100644
>> --- a/drivers/net/gtp.c
>> +++ b/drivers/net/gtp.c
>> @@ -259,28 +259,30 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp,
>> struct sk_buff *skb,
>>  	return iptunnel_pull_header(skb, hdrlen, skb->protocol, xnet);
>>  }
>>  
>> -static void gtp_encap_disable(struct gtp_dev *gtp)
>> -{
>> -	if (gtp->sock0 && gtp->sock0->sk) {
>> -		udp_sk(gtp->sock0->sk)->encap_type = 0;
>> -		rcu_assign_sk_user_data(gtp->sock0->sk, NULL);
>> -	}
>> -	if (gtp->sock1u && gtp->sock1u->sk) {
>> -		udp_sk(gtp->sock1u->sk)->encap_type = 0;
>> -		rcu_assign_sk_user_data(gtp->sock1u->sk, NULL);
>> -	}
>> -
>> -	gtp->sock0 = NULL;
>> -	gtp->sock1u = NULL;
>> -}
>> -
>>  static void gtp_encap_destroy(struct sock *sk)
>>  {
>>  	struct gtp_dev *gtp;
>>  
>>  	gtp = rcu_dereference_sk_user_data(sk);
>> -	if (gtp)
>> -		gtp_encap_disable(gtp);
>> +	if (gtp) {
>> +		udp_sk(sk)->encap_type = 0;
>> +		rcu_assign_sk_user_data(sk, NULL);
>> +	}
>> +}
>> +
>> +static void gtp_encap_disable_sock(struct socket *sock)
> 
> Nitpick: Please, use sk for consistency:
> 
>        static void gtp_encap_disable_sock(struct socket *sk)
> 

Throughout the net subsystem 'struct socket` is always using sock
for variable names and 'struct sock' is using sk. I have been
following that convention, but can change to sk if you really want.

Andreas

  reply	other threads:[~2017-02-02 14:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 16:37 [PATCH net-next v2 0/6] gtp: misc improvements Andreas Schultz
2017-01-30 16:37 ` [PATCH net-next v2 1/6] gtp: make GTP sockets in gtp_newlink optional Andreas Schultz
2017-02-02 14:10   ` Pablo Neira Ayuso
2017-02-02 14:30     ` Andreas Schultz [this message]
2017-02-02 14:32       ` Pablo Neira Ayuso
2017-02-06 13:51   ` Harald Welte
2017-01-30 16:37 ` [PATCH net-next v2 2/6] gtp: merge gtp_get_net and gtp_genl_find_dev Andreas Schultz
2017-02-06 13:55   ` Harald Welte
2017-02-13 14:13     ` Andreas Schultz
2017-02-13 14:51       ` Pablo Neira Ayuso
2017-01-30 16:37 ` [PATCH net-next v2 3/6] gtp: unify genl_find_pdp and prepare for per socket lookup Andreas Schultz
2017-02-02 14:19   ` Pablo Neira Ayuso
2017-02-02 14:27     ` Andreas Schultz
2017-02-02 14:31       ` Pablo Neira Ayuso
2017-02-06 13:56   ` Harald Welte
2017-01-30 16:37 ` [PATCH net-next v2 4/6] gtp: consolidate pdp context destruction into helper Andreas Schultz
2017-02-06 13:58   ` Harald Welte
2017-02-13 14:14     ` Andreas Schultz
2017-01-30 16:37 ` [PATCH net-next v2 5/6] gtp: add socket to pdp context Andreas Schultz
2017-02-02 13:56   ` Pablo Neira Ayuso
2017-02-02 14:12     ` Andreas Schultz
2017-02-02 14:28       ` Pablo Neira Ayuso
2017-02-02 14:38         ` Andreas Schultz
2017-02-02 14:46           ` Pablo Neira Ayuso
2017-02-02 15:07             ` Andreas Schultz
2017-02-06 14:04               ` Harald Welte
2017-01-30 16:37 ` [PATCH net-next v2 6/6] gtp: consolidate gtp socket rx path Andreas Schultz
2017-01-31 18:05 ` [PATCH net-next v2 0/6] gtp: misc improvements David Miller
2017-02-06 13:46   ` Harald Welte

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=1114368875.730626.1486045851291.JavaMail.zimbra@tpip.net \
    --to=aschultz@tpip.net \
    --cc=Lionel.Gauthier@eurecom.fr \
    --cc=laforge@gnumonks.org \
    --cc=netdev@vger.kernel.org \
    --cc=openbsc@lists.osmocom.org \
    --cc=pablo@netfilter.org \
    /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 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.