[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180423.205518.182649371008846805.davem@davemloft.net>
Date: Mon, 23 Apr 2018 20:55:18 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: borisp@...lanox.com
Cc: netdev@...r.kernel.org, saeedm@...lanox.com, davejwatson@...com,
ktkhai@...tuozzo.com, ilyal@...lanox.com, aviadye@...lanox.com
Subject: Re: [PATCH V6 net-next 07/15] net/tls: Add generic NIC offload
infrastructure
From: Boris Pismenny <borisp@...lanox.com>
Date: Sun, 22 Apr 2018 18:19:49 +0300
> +/* We assume that the socket is already connected */
> +static struct net_device *get_netdev_for_sock(struct sock *sk)
> +{
> + struct inet_sock *inet = inet_sk(sk);
> + struct net_device *netdev = NULL;
> +
> + netdev = dev_get_by_index(sock_net(sk), inet->cork.fl.flowi_oif);
> +
> + return netdev;
> +}
Please do this more directly by looking at sk->sk_dst_cache and taking
the device from dst->dev if non-NULL.
That avoids the dev_get_by_index() demux work, and also if
sk->sk_dst_cache is non-NULL then the socket is indeed connected.
Thanks.
Powered by blists - more mailing lists