[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161125.204713.324066411863851415.davem@davemloft.net>
Date: Fri, 25 Nov 2016 20:47:13 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: ubraun@...ux.vnet.ibm.com
Cc: netdev@...r.kernel.org, linux-s390@...r.kernel.org,
schwidefsky@...ibm.com, heiko.carstens@...ibm.com,
utz.bacher@...ibm.com
Subject: Re: [PATCH V3 net-next 02/15] smc: establish new socket family
From: Ursula Braun <ubraun@...ux.vnet.ibm.com>
Date: Thu, 24 Nov 2016 16:06:32 +0100
> +static struct sock *smc_sock_alloc(struct net *net, struct socket *sock)
> +{
> + struct smc_sock *smc;
> + struct sock *sk;
> +
> + sk = sk_alloc(net, PF_SMC, GFP_KERNEL, &smc_proto, 0);
> + if (!sk)
> + return NULL;
> +
> + sock_init_data(sock, sk); /* sets sk_refcnt to 1 */
> + sk->sk_state = SMC_INIT;
> + sk->sk_destruct = smc_destruct;
> + sk->sk_protocol = SMCPROTO_SMC;
> + sk_refcnt_debug_inc(sk);
> +
> + smc = smc_sk(sk);
> + smc->clcsock = NULL;
> + smc->use_fallback = 0;
This is unnecessary, sk_alloc() clears out the memory for you.
> +static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
> + int addr_len)
> +{
...
> + smc->clcsock->sk->sk_reuse = sk->sk_reuse;
> + rc = kernel_bind(smc->clcsock, uaddr, addr_len);
Is it valid to assume smc->clcsock is not NULL right here?
> +struct smc_sock { /* smc sock container */
> + struct sock sk;
> + struct socket *clcsock; /* internal tcp socket */
> + u8 use_fallback : 1; /* fallback to tcp */
> +};
Please use 'bool' and true/false for 'use_fallback'.
Powered by blists - more mailing lists