Re: [PATCH 07/12] nvme: Implement In-Band authentication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/27/21 12:04 AM, Sagi Grimberg wrote:

+/* Assumes that the controller is in state RESETTING */
+static void nvme_dhchap_auth_work(struct work_struct *work)
+{
+    struct nvme_ctrl *ctrl =
+        container_of(work, struct nvme_ctrl, dhchap_auth_work);
+    int ret, q;
+
+    nvme_stop_queues(ctrl);

     blk_mq_quiesce_queue(ctrl->admin_q);

+    /* Authenticate admin queue first */
+    ret = nvme_auth_negotiate(ctrl, NVME_QID_ANY);
+    if (ret) {
+        dev_warn(ctrl->device,
+             "qid 0: error %d setting up authentication\n", ret);
+        goto out;
+    }
+    ret = nvme_auth_wait(ctrl, NVME_QID_ANY);
+    if (ret) {
+        dev_warn(ctrl->device,
+             "qid 0: authentication failed\n");
+        goto out;
+    }
+    dev_info(ctrl->device, "qid 0: authenticated\n");
+
+    for (q = 1; q < ctrl->queue_count; q++) {
+        ret = nvme_auth_negotiate(ctrl, q);
+        if (ret) {
+            dev_warn(ctrl->device,
+                 "qid %d: error %d setting up authentication\n",
+                 q, ret);
+            goto out;
+        }
+    }
+out:
+    /*
+     * Failure is a soft-state; credentials remain valid until
+     * the controller terminates the connection.
+     */
+    if (nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
+        nvme_start_queues(ctrl);
         blk_mq_unquiesce_queue(ctrl->admin_q);

+}

Actually, after recent discussions on the fmds group there shouldn't be a requirement to stop the queues, so I'll be dropping the stop/start queue things.
(And the change in controller state, too, as it isn't required, either).

Cheers,

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



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux