Re: [PATCH 11/17] nvmet: make TCP sectype settable via configfs

Simon Horman
2023-08-11T10:24:10Z

On Thu, Aug 10, 2023 at 05:06:24PM +0200, Hannes Reinecke wrote:

...

> +static ssize_t nvmet_addr_tsas_store(struct config_item *item,
> + const char *page, size_t count)
> +{
> + struct nvmet_port *port = to_nvmet_port(item);
> + u8 treq = nvmet_port_disc_addr_treq_mask(port);

Hi Hannes,

treq appears to be unused in this function.

> + u8 sectype;
> + int i;
> +
> + if (nvmet_is_port_enabled(port, __func__))
> + return -EACCES;
> +
> + if (port->disc_addr.trtype != NVMF_TRTYPE_TCP)
> + return -EINVAL;
> +
> + for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_tcp); i++) {
> + if (sysfs_streq(page, nvmet_addr_tsas_tcp[i].name)) {
> + sectype = nvmet_addr_tsas_tcp[i].type;
> + goto found;
> + }
> + }
> +
> + pr_err("Invalid value '%s' for tsas\n", page);
> + return -EINVAL;
> +
> +found:
> + nvmet_port_init_tsas_tcp(port, sectype);
> + return count;
> +}

...