public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Pismenny <borispismenny@gmail.com>
To: Or Gerlitz <gerlitz.or@gmail.com>, David Ahern <dsahern@gmail.com>
Cc: smalin@marvell.com, linux-nvme@lists.infradead.org,
	Sagi Grimberg <sagi@grimberg.me>,
	yorayz@nvidia.com, boris.pismenny@gmail.com,
	Ben Ben-Ishay <benishay@mellanox.com>,
	Yoray Zack <yorayz@mellanox.com>,
	benishay@nvidia.com, David Miller <davem@davemloft.net>,
	axboe@fb.com, Eric Dumazet <edumazet@google.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Linux Netdev List <netdev@vger.kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Or Gerlitz <ogerlitz@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Christoph Hellwig <hch@lst.de>,
	Boris Pismenny <borisp@mellanox.com>
Subject: Re: [PATCH v4 net-next 06/21] nvme-tcp: Add DDP offload control path
Date: Sun, 21 Feb 2021 13:29:39 +0200	[thread overview]
Message-ID: <3f447ef7-3ded-8c1c-fdfa-ec137e11a19a@gmail.com> (raw)
In-Reply-To: <CAJ3xEMjMqK81uNv21poD+DoZCRxYak0DYFZrjDbmWaSxw4R5ig@mail.gmail.com>

On 17/02/2021 15:55, Or Gerlitz wrote:
> On Sun, Feb 14, 2021 at 8:20 PM David Ahern <dsahern@gmail.com> wrote:
>> On 2/11/21 2:10 PM, Boris Pismenny wrote:
>>> @@ -223,6 +229,164 @@ static inline size_t nvme_tcp_pdu_last_send(struct nvme_tcp_request *req,
>>>       return nvme_tcp_pdu_data_left(req) <= len;
>>>  }
>>>
>>> +#ifdef CONFIG_TCP_DDP
>>> +
>>> +static bool nvme_tcp_resync_request(struct sock *sk, u32 seq, u32 flags);
>>> +static const struct tcp_ddp_ulp_ops nvme_tcp_ddp_ulp_ops = {
>>> +     .resync_request         = nvme_tcp_resync_request,
>>> +};
>>> +
>>> +static int nvme_tcp_offload_socket(struct nvme_tcp_queue *queue)
>>> +{
>>> +     struct net_device *netdev = queue->ctrl->offloading_netdev;
>>> +     struct nvme_tcp_ddp_config config = {};
>>> +     int ret;
>>> +
>>> +     if (!(netdev->features & NETIF_F_HW_TCP_DDP))
>>
>> If nvme_tcp_offload_limits does not find a dst_entry on the socket then
>> offloading_netdev may not NULL at this point.
> 
> correct :( will look on that
> 

That's only partially true.
If nvme_tcp_offload_limits finds a dst_entry, but then the netdevice
goes down, then the check here will catch it. This is needed because
nvme_tcp_offload_limits doesn't hold a reference! We opted not to grab a
reference on nvme_tcp_offload_limits because it doesn't create a context.


>>> +             queue->ctrl->offloading_netdev = NULL;
>>> +             return -ENODEV;
>>> +     }
>>> +
>>> +     if (netdev->features & NETIF_F_HW_TCP_DDP &&
>>> +         netdev->tcp_ddp_ops &&
>>> +         netdev->tcp_ddp_ops->tcp_ddp_limits)
>>> +             ret = netdev->tcp_ddp_ops->tcp_ddp_limits(netdev, &limits);
>>> +     else
>>> +             ret = -EOPNOTSUPP;
>>> +
>>> +     if (!ret) {
>>> +             queue->ctrl->offloading_netdev = netdev;
>>
>> you save a reference to the netdev here, but then release the refcnt
>> below. That device could be deleted between this point in time and the
>> initialization of all queues.
> 

That's true, and this is why we repeat the checks there.

We avoid holding the reference here because there is no obvious
complementary release point for nvme_tcp_offload_limits and there is no
hardware context created here, so there is no real need to hold it at
this stage.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-02-21 11:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 21:10 [PATCH v4 net-next 00/21] nvme-tcp receive offloads Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 01/21] net: Introduce direct data placement tcp offload Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 02/21] net: Introduce crc offload for tcp ddp ulp Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 03/21] iov_iter: DDP copy to iter/pages Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 04/21] net: skb copy(+hash) iterators for DDP offloads Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 05/21] net/tls: expose get_netdev_for_sock Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 06/21] nvme-tcp: Add DDP offload control path Boris Pismenny
2021-02-14 18:16   ` David Ahern
2021-02-15  7:57     ` Or Gerlitz
2021-02-17 13:55     ` Or Gerlitz
2021-02-21 11:29       ` Boris Pismenny [this message]
2021-02-11 21:10 ` [PATCH v4 net-next 07/21] nvme-tcp: Add DDP data-path Boris Pismenny
2021-02-14 18:27   ` David Ahern
2021-02-17 14:01     ` Or Gerlitz
2021-02-17 17:00       ` David Ahern
2021-02-21 11:44         ` Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 08/21] nvme-tcp: RX CRC offload Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 09/21] nvme-tcp: Deal with netdevice DOWN events Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 10/21] net/mlx5: Header file changes for nvme-tcp offload Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 11/21] net/mlx5: Add 128B CQE for NVMEoTCP offload Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 12/21] net/mlx5e: TCP flow steering for nvme-tcp Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 13/21] net/mlx5e: NVMEoTCP offload initialization Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 14/21] net/mlx5e: KLM UMR helper macros Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 15/21] net/mlx5e: NVMEoTCP use KLM UMRs Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 16/21] net/mlx5e: NVMEoTCP queue init/teardown Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 17/21] net/mlx5e: NVMEoTCP async ddp invalidation Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 18/21] net/mlx5e: NVMEoTCP ddp setup and resync Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 19/21] net/mlx5e: NVMEoTCP, data-path for DDP+CRC offload Boris Pismenny
2021-02-11 21:10 ` [PATCH v4 net-next 20/21] net/mlx5e: NVMEoTCP statistics Boris Pismenny
2021-02-11 21:32 ` [PATCH v4 net-next 00/21] nvme-tcp receive offloads Randy Dunlap
2021-02-12  5:22   ` Boris Pismenny
2021-02-21  8:52 ` Or Gerlitz

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=3f447ef7-3ded-8c1c-fdfa-ec137e11a19a@gmail.com \
    --to=borispismenny@gmail.com \
    --cc=axboe@fb.com \
    --cc=benishay@mellanox.com \
    --cc=benishay@nvidia.com \
    --cc=boris.pismenny@gmail.com \
    --cc=borisp@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=gerlitz.or@gmail.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=ogerlitz@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=sagi@grimberg.me \
    --cc=smalin@marvell.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yorayz@mellanox.com \
    --cc=yorayz@nvidia.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