Re: [PATCH net-next 1/2] tcp: TCP experimental option for SMC

Eric Dumazet
2017-10-16T16:13:27Z

On Mon, 2017-10-16 at 17:42 +0200, Ursula Braun wrote:
...

> +static void smc_set_capability(struct inet_request_sock *ireq,
> + const struct tcp_options_received *rx_opt)
> +{
> +#if IS_ENABLED(CONFIG_SMC)
> + if (!static_key_false(&tcp_have_smc))
> + return;
> +
> + if (rx_opt->smc_ok)
> + ireq->smc_ok = 1;
> + else
> + ireq->smc_ok = 0;
> +#endif
> +}

I do not think this static_key_false(&tcp_have_smc)) makes sense here.

1) If you have a SYN packet while the key is not set
2) Then tcp_have_smc is changed
3) ACK packets comes, and finds random value in ireq->smc_ok

So really here you have to set this field.

static void smc_set_capability(struct inet_request_sock *ireq,
const struct tcp_options_received *rx_opt)
{
#if IS_ENABLED(CONFIG_SMC)
ireq->smc_ok = rx_opt->smc_ok;
#endif
}