[PATCH 4/4] nvme-tcp: use ctrl sgl check helper

Prabhakar Kushwaha prabhakar.pkin at gmail.com
Wed Jun 16 18:36:06 PDT 2021


Hi Chaitanya,

On Thu, Jun 10, 2021 at 7:04 AM Chaitanya Kulkarni
<chaitanya.kulkarni at wdc.com> wrote:
>
> Use the helper to check NVMe controller's SGL support.
>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> ---
>  drivers/nvme/host/tcp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 6a65b0516180..c7bd37103cf4 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1993,7 +1993,7 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
>                 goto destroy_admin;
>         }
>
> -       if (!(ctrl->sgls & ((1 << 0) | (1 << 1)))) {
> +       if (!nvme_ctrl_sgl_supported(ctrl)) {
>                 ret = -EOPNOTSUPP;
>                 dev_err(ctrl->device, "Mandatory sgls are not supported!\n");
>                 goto destroy_admin;
> --
> 2.22.1
>
>

base patch defines nvme_ctrl_sgl_supported as below
 +static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl)
 +{
 +    if (!(ctrl->sgls & ((1 << 0) | (1 << 1))))
 +        return true;
 +
 +    return false;
 +}

The "!" is already part of nvme_ctrl_sgl_supported(). There is no
point in keeping "!" at other places.
So, either remove "!" from other places or from nvme_ctrl_sgl_supported().

I request you to check the logic again.
In case you are planning to fix, the best place would be
nvme_ctrl_sgl_supported() to have minimal changes.

 -pk



More information about the Linux-nvme mailing list