lkml.org 
[lkml]   [2021]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] nvme-tcp: Check if request has started before processing it
From
Date
On 5/8/21 1:22 AM, Sagi Grimberg wrote:
>
>>>> Well, that would require a modification to the CQE specification, no?
>>>> fmds was not amused when I proposed that :-(
>>>
>>> Why would that require a modification to the CQE? it's just using say
>>> 4 msbits of the command_id to a running sequence...
>>
>> I think Hannes was under the impression that the counter proposal wasn't
>> part of the "command_id". The host can encode whatever it wants in that
>> value, and the controller just has to return the same value.
>
> Yea, maybe something like this?
> --
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index e6612971f4eb..7af48827ea56 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1006,7 +1006,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns,
> struct request *req)
>                return BLK_STS_IOERR;
>        }
>
> -       cmd->common.command_id = req->tag;
> +       cmd->common.command_id = nvme_cid(req);
>        trace_nvme_setup_cmd(req, cmd);
>        return ret;
> }
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 05f31a2c64bb..96abfb0e2ddd 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -158,6 +158,7 @@ enum nvme_quirks {
> struct nvme_request {
>        struct nvme_command     *cmd;
>        union nvme_result       result;
> +       u8                      genctr;
>        u8                      retries;
>        u8                      flags;
>        u16                     status;
> @@ -497,6 +498,48 @@ struct nvme_ctrl_ops {
>        int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
> };
>
> +/*
> + * nvme command_id is constructed as such:
> + * | xxxx | xxxxxxxxxxxx |
> + *   gen    request tag
> + */
> +#define nvme_cid_install_genctr(gen)           ((gen & 0xf) << 12)
> +#define nvme_genctr_from_cid(cid)              ((cid & 0xf000) >> 12)
> +#define nvme_tag_from_cid(cid)                 (cid & 0xfff)
> +

That is a good idea, but we should ensure to limit the number of
commands a controller can request, too.
As per spec each controller can support a full 32 bit worth of requests,
and if we limit that arbitrarily from the stack we'll need to cap the
number of requests a controller or fabrics driver can request.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

\
 
 \ /
  Last update: 2021-05-09 13:31    [W:0.191 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site