From: Mohamed Khalfella <mkhalfella@purestorage.com>
To: Jesse Taube <jtaubepe@redhat.com>
Cc: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
John Meneghini <jmeneghi@redhat.com>,
Chris Leech <cleech@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] nvmet: Add traffic based keep alive support to configfs
Date: Wed, 23 Sep 2026 14:45:37 -0700 [thread overview]
Message-ID: <20260923214537.GI2931-mkhalfella@purestorage.com> (raw)
In-Reply-To: <20260923202003.1776271-1-jtaubepe@redhat.com>
On Wed 2026-09-23 16:20:03 -0400, Jesse Taube wrote:
> Add the ability to turn on and off tbkas (traffic based keep alive
> support) via configfs. This is useful for testing and debugging.
>
> Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
Reviewed-by: Mohamed Khalfella <mkhalfella@purestorage.com>
> V1 -> V2:
> - Add tbkas to nvmet_ctrl
> - Force reconnect controllers when tbkas is set
> - Use ctrl->tbkas in nvmet_execute_identify_ctrl and nvmet_req_init
> ---
> drivers/nvme/target/admin-cmd.c | 4 +++-
> drivers/nvme/target/configfs.c | 29 +++++++++++++++++++++++++++++
> drivers/nvme/target/core.c | 4 +++-
> drivers/nvme/target/nvmet.h | 2 ++
> 4 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index 7764a3c0195c..26028be8fe4d 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -696,7 +696,9 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
>
> /* XXX: figure out what to do about RTD3R/RTD3 */
> id->oaes = cpu_to_le32(NVMET_AEN_CFG_OPTIONAL);
> - ctratt = NVME_CTRL_ATTR_HID_128_BIT | NVME_CTRL_ATTR_TBKAS;
> + ctratt = NVME_CTRL_ATTR_HID_128_BIT;
> + if (ctrl->tbkas)
> + ctratt |= NVME_CTRL_ATTR_TBKAS;
> if (nvmet_is_pci_ctrl(ctrl))
> ctratt |= NVME_CTRL_ATTR_RHII;
> id->ctratt = cpu_to_le32(ctratt);
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index 6286e38436dd..2b879b1d4c3c 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -1369,6 +1369,34 @@ static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
> }
> CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
>
> +static ssize_t nvmet_subsys_attr_tbkas_show(struct config_item *item,
> + char *page)
> +{
> + return snprintf(page, PAGE_SIZE, "%d\n", to_subsys(item)->tbkas);
> +}
> +
> +static ssize_t nvmet_subsys_attr_tbkas_store(struct config_item *item,
> + const char *page, size_t count)
> +{
> + struct nvmet_subsys *subsys = to_subsys(item);
> + struct nvmet_ctrl *ctrl;
> + bool tbkas;
> +
> + if (kstrtobool(page, &tbkas))
> + return -EINVAL;
> +
> + down_write(&nvmet_config_sem);
> + subsys->tbkas = tbkas;
> +
> + /* Force reconnect */
> + list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
> + ctrl->ops->delete_ctrl(ctrl);
> + up_write(&nvmet_config_sem);
> +
> + return count;
> +}
> +CONFIGFS_ATTR(nvmet_subsys_, attr_tbkas);
> +
> static ssize_t nvmet_subsys_attr_cntlid_min_show(struct config_item *item,
> char *page)
> {
> @@ -1706,6 +1734,7 @@ static struct configfs_attribute *nvmet_subsys_attrs[] = {
> &nvmet_subsys_attr_attr_qid_max,
> &nvmet_subsys_attr_attr_ieee_oui,
> &nvmet_subsys_attr_attr_firmware,
> + &nvmet_subsys_attr_attr_tbkas,
> #ifdef CONFIG_BLK_DEV_INTEGRITY
> &nvmet_subsys_attr_attr_pi_enable,
> #endif
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 43871a8f56ca..6b4bda231bd9 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1227,7 +1227,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_sq *sq,
> goto fail;
> }
>
> - if (sq->ctrl)
> + if (sq->ctrl && sq->ctrl->tbkas)
> sq->ctrl->reset_tbkas = true;
>
> return true;
> @@ -1677,6 +1677,7 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args)
> mutex_lock(&subsys->lock);
>
> ctrl->max_qid = subsys->max_qid;
> + ctrl->tbkas = subsys->tbkas;
>
> ctrl->sqs = kzalloc_objs(struct nvmet_sq *, ctrl->max_qid + 1);
> if (!ctrl->sqs)
> @@ -1865,6 +1866,7 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
> }
>
> subsys->ieee_oui = 0;
> + subsys->tbkas = true;
>
> subsys->firmware_rev = kstrndup(UTS_RELEASE, NVMET_FR_MAX_SIZE, GFP_KERNEL);
> if (!subsys->firmware_rev) {
> diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
> index dbda55895f4f..2bc0e87ea981 100644
> --- a/drivers/nvme/target/nvmet.h
> +++ b/drivers/nvme/target/nvmet.h
> @@ -270,6 +270,7 @@ struct nvmet_ctrl {
> u16 cntlid;
> u16 max_qid;
> u32 kato;
> + bool tbkas;
>
> struct nvmet_port *port;
>
> @@ -343,6 +344,7 @@ struct nvmet_subsys {
> bool subsys_discovered;
> char *subsysnqn;
> bool pi_support;
> + bool tbkas;
>
> struct config_group group;
>
> --
> 2.55.0
>
next prev parent reply other threads:[~2026-09-23 21:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 20:20 Jesse Taube
2026-09-23 21:45 ` Mohamed Khalfella [this message]
2026-09-25 7:37 ` Christoph Hellwig
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=20260923214537.GI2931-mkhalfella@purestorage.com \
--to=mkhalfella@purestorage.com \
--cc=cleech@redhat.com \
--cc=hch@lst.de \
--cc=jmeneghi@redhat.com \
--cc=jtaubepe@redhat.com \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.petersen@oracle.com \
--cc=sagi@grimberg.me \
/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
all inboxes | Powered by JetHome®