Skip to contentSkip to conversation

nvme: don't enable AEN if not supported

PATCH New Weiping Zhang 4 participants 4 messages Jul 2, 2018 – Jul 17, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme: don't enable AEN if not supported

Avoid excuting set_feature command if there is no supported bit in Optional Asynchronous Events Supported (OAES).

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
Reviewed-by Christoph Hellwig <hch at lst.de>
Signed-off-by Weiping Zhang <zhangweiping at didichuxing.com>

---
Change since V1:
* Add extra variable supported_aens sugguested by Christoph.

 drivers/nvme/host/core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +7 -4
index e541fe268bcf..5ff281cce2b9 100644
@@ -1041,14 +1041,17 @@ EXPORT_SYMBOL_GPL(nvme_set_queue_count);
 
 static void nvme_enable_aen(struct nvme_ctrl *ctrl)
 {
-	u32 result;
+	u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;
 	int status;
 
-	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
-			ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
+	if (!supported_aens)
+		return;
+
+	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
+			NULL, 0, &result);
 	if (status)
 		dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
-			 ctrl->oaes & NVME_AEN_SUPPORTED);
+			 supported_aens);
 }
 
 static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
Signature · 1 line
2.14.1
#1 lore raw

PATCH v2 1/1 nvme: don't enable AEN if not supported

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>

Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw

PATCH v2 1/1 nvme: don't enable AEN if not supported

Hi Christoph,

Will you pick this up for 4.19 ?

Johannes Thumshirn <jthumshirn at suse.de> ?2018?7?3??? ??2:42???

Quoted 15 lines

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de> --
Johannes Thumshirn Storage
jthumshirn at suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme