Commit 37358164 authored by Jens Axboe's avatar Jens Axboe
Browse files

Merge tag 'nvme-6.8-2024-02-01' of git://git.infradead.org/nvme into block-6.8

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.8

 - Remove duplicated enums (Guixen)
 - Use appropriate controller state accessors (Keith)
 - Retryable authentication (Hannes)
 - Add missing module descriptions (Chaitanya)
 - Fibre-channel fixes for blktests (Daniel)
 - Various type correctness updates (Caleb)
 - Improve fabrics connection debugging prints (Nitin)
 - Passthrough command verbose error logging (Adam)"

* tag 'nvme-6.8-2024-02-01' of git://git.infradead.org/nvme: (31 commits)
  nvme: allow passthru cmd error logging
  nvme-fc: show hostnqn when connecting to fc target
  nvme-rdma: show hostnqn when connecting to rdma target
  nvme-tcp: show hostnqn when connecting to tcp target
  nvmet-fc: use RCU list iterator for assoc_list
  nvmet-fc: take ref count on tgtport before delete assoc
  nvmet-fc: avoid deadlock on delete association path
  nvmet-fc: abort command when there is no binding
  nvmet-fc: do not tack refs on tgtports from assoc
  nvmet-fc: remove null hostport pointer check
  nvmet-fc: hold reference on hostport match
  nvmet-fc: free queue and assoc directly
  nvmet-fc: defer cleanup using RCU properly
  nvmet-fc: release reference on target port
  nvmet-fcloop: swap the list_add_tail arguments
  nvme-fc: do not wait in vain when unloading module
  nvme-fc: log human-readable opcode on timeout
  nvme: split out fabrics version of nvme_opcode_str()
  nvme: take const cmd pointer in read-only helpers
  nvme: remove redundant status mask
  ...
parents 5af2c3f4 9f079dda
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -471,4 +471,5 @@ int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key)
}
EXPORT_SYMBOL_GPL(nvme_auth_generate_key);

MODULE_DESCRIPTION("NVMe Authentication framework");
MODULE_LICENSE("GPL v2");
+1 −0
Original line number Diff line number Diff line
@@ -181,5 +181,6 @@ static void __exit nvme_keyring_exit(void)

MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>");
MODULE_DESCRIPTION("NVMe Keyring implementation");
module_init(nvme_keyring_init);
module_exit(nvme_keyring_exit);
+7 −6
Original line number Diff line number Diff line
@@ -797,6 +797,7 @@ static int apple_nvme_init_request(struct blk_mq_tag_set *set,

static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
{
	enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);
	u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
	bool dead = false, freeze = false;
	unsigned long flags;
@@ -808,8 +809,8 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
	if (csts & NVME_CSTS_CFS)
		dead = true;

	if (anv->ctrl.state == NVME_CTRL_LIVE ||
	    anv->ctrl.state == NVME_CTRL_RESETTING) {
	if (state == NVME_CTRL_LIVE ||
	    state == NVME_CTRL_RESETTING) {
		freeze = true;
		nvme_start_freeze(&anv->ctrl);
	}
@@ -881,7 +882,7 @@ static enum blk_eh_timer_return apple_nvme_timeout(struct request *req)
	unsigned long flags;
	u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);

	if (anv->ctrl.state != NVME_CTRL_LIVE) {
	if (nvme_ctrl_state(&anv->ctrl) != NVME_CTRL_LIVE) {
		/*
		 * From rdma.c:
		 * If we are resetting, connecting or deleting we should
@@ -985,10 +986,10 @@ static void apple_nvme_reset_work(struct work_struct *work)
	u32 boot_status, aqa;
	struct apple_nvme *anv =
		container_of(work, struct apple_nvme, ctrl.reset_work);
	enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);

	if (anv->ctrl.state != NVME_CTRL_RESETTING) {
		dev_warn(anv->dev, "ctrl state %d is not RESETTING\n",
			 anv->ctrl.state);
	if (state != NVME_CTRL_RESETTING) {
		dev_warn(anv->dev, "ctrl state %d is not RESETTING\n", state);
		ret = -ENODEV;
		goto out;
	}
+9 −10
Original line number Diff line number Diff line
@@ -48,11 +48,6 @@ struct nvme_dhchap_queue_context {

static struct workqueue_struct *nvme_auth_wq;

#define nvme_auth_flags_from_qid(qid) \
	(qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED
#define nvme_auth_queue_from_qid(ctrl, qid) \
	(qid == 0) ? (ctrl)->fabrics_q : (ctrl)->connect_q

static inline int ctrl_max_dhchaps(struct nvme_ctrl *ctrl)
{
	return ctrl->opts->nr_io_queues + ctrl->opts->nr_write_queues +
@@ -63,10 +58,15 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
			    void *data, size_t data_len, bool auth_send)
{
	struct nvme_command cmd = {};
	blk_mq_req_flags_t flags = nvme_auth_flags_from_qid(qid);
	struct request_queue *q = nvme_auth_queue_from_qid(ctrl, qid);
	nvme_submit_flags_t flags = NVME_SUBMIT_RETRY;
	struct request_queue *q = ctrl->fabrics_q;
	int ret;

	if (qid != 0) {
		flags |= NVME_SUBMIT_NOWAIT | NVME_SUBMIT_RESERVED;
		q = ctrl->connect_q;
	}

	cmd.auth_common.opcode = nvme_fabrics_command;
	cmd.auth_common.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
	cmd.auth_common.spsp0 = 0x01;
@@ -80,8 +80,7 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
	}

	ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, data_len,
				     qid == 0 ? NVME_QID_ANY : qid,
				     0, flags);
				     qid == 0 ? NVME_QID_ANY : qid, flags);
	if (ret > 0)
		dev_warn(ctrl->device,
			"qid %d auth_send failed with status %d\n", qid, ret);
@@ -897,7 +896,7 @@ static void nvme_ctrl_auth_work(struct work_struct *work)
	 * If the ctrl is no connected, bail as reconnect will handle
	 * authentication.
	 */
	if (ctrl->state != NVME_CTRL_LIVE)
	if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE)
		return;

	/* Authenticate admin queue first */
+5 −5
Original line number Diff line number Diff line
@@ -171,15 +171,15 @@ static const char * const nvme_statuses[] = {
	[NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command",
};

const unsigned char *nvme_get_error_status_str(u16 status)
const char *nvme_get_error_status_str(u16 status)
{
	status &= 0x7ff;
	if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status])
		return nvme_statuses[status & 0x7ff];
		return nvme_statuses[status];
	return "Unknown";
}

const unsigned char *nvme_get_opcode_str(u8 opcode)
const char *nvme_get_opcode_str(u8 opcode)
{
	if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode])
		return nvme_ops[opcode];
@@ -187,7 +187,7 @@ const unsigned char *nvme_get_opcode_str(u8 opcode)
}
EXPORT_SYMBOL_GPL(nvme_get_opcode_str);

const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
const char *nvme_get_admin_opcode_str(u8 opcode)
{
	if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode])
		return nvme_admin_ops[opcode];
@@ -195,7 +195,7 @@ const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
}
EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str);

const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) {
const char *nvme_get_fabrics_opcode_str(u8 opcode) {
	if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode])
		return nvme_fabrics_ops[opcode];
	return "Unknown";
Loading