* [PATCH] add Intel 760p/Pro 7600p nvme disk
@ 2021-12-02 2:58 caojun
0 siblings, 0 replies; 5+ messages in thread
From: caojun @ 2021-12-02 2:58 UTC (permalink / raw)
To: keith.busch, axboe, hch, sagi; +Cc: linux-nvme, linux-kernel, caojun
Signed-off-by: caojun <caojun@uniontech.com>
---
drivers/nvme/host/core.c | 16 +++++++++-------
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/host/pci.c | 2 ++
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e64310f22..8e0dbfb6a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2155,14 +2155,16 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
size_t nqnlen;
int off;
- nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
- if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
- strncpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
- return;
- }
+ if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
+ nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
+ if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
+ strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
+ return;
+ }
- if (ctrl->vs >= NVME_VS(1, 2, 1))
- dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+ if (ctrl->vs >= NVME_VS(1, 2, 1))
+ dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+ }
/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 276975506..5f5a91518 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -90,6 +90,11 @@ enum nvme_quirks {
* Set MEDIUM priority on SQ creation
*/
NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
+
+ /*
+ * Ignore device provided subnqn.
+ */
+ NVME_QUIRK_IGNORE_DEV_SUBNQN = (1 << 8),
};
/*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d7cf3202c..fcac05528 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2713,6 +2713,8 @@ static const struct pci_device_id nvme_id_table[] = {
{ PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
NVME_QUIRK_MEDIUM_PRIO_SQ },
+ { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */
+ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
{ PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
.driver_data = NVME_QUIRK_IDENTIFY_CNS, },
{ PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] add Intel 760p/Pro 7600p nvme disk
@ 2021-12-02 3:02 caojun
2021-12-02 17:55 ` Keith Busch
0 siblings, 1 reply; 5+ messages in thread
From: caojun @ 2021-12-02 3:02 UTC (permalink / raw)
To: axboe, hch, sagi; +Cc: linux-nvme, linux-kernel, caojun
Signed-off-by: caojun <caojun@uniontech.com>
---
drivers/nvme/host/core.c | 16 +++++++++-------
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/host/pci.c | 2 ++
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e64310f22..8e0dbfb6a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2155,14 +2155,16 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
size_t nqnlen;
int off;
- nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
- if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
- strncpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
- return;
- }
+ if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
+ nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
+ if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
+ strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
+ return;
+ }
- if (ctrl->vs >= NVME_VS(1, 2, 1))
- dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+ if (ctrl->vs >= NVME_VS(1, 2, 1))
+ dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+ }
/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 276975506..5f5a91518 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -90,6 +90,11 @@ enum nvme_quirks {
* Set MEDIUM priority on SQ creation
*/
NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
+
+ /*
+ * Ignore device provided subnqn.
+ */
+ NVME_QUIRK_IGNORE_DEV_SUBNQN = (1 << 8),
};
/*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d7cf3202c..fcac05528 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2713,6 +2713,8 @@ static const struct pci_device_id nvme_id_table[] = {
{ PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
NVME_QUIRK_MEDIUM_PRIO_SQ },
+ { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */
+ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
{ PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
.driver_data = NVME_QUIRK_IDENTIFY_CNS, },
{ PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] add Intel 760p/Pro 7600p nvme disk
2021-12-02 3:02 caojun
@ 2021-12-02 17:55 ` Keith Busch
[not found] ` <tencent_5722FB4254C69E931F449D17@qq.com>
0 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2021-12-02 17:55 UTC (permalink / raw)
To: caojun; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel
On Thu, Dec 02, 2021 at 11:02:30AM +0800, caojun wrote:
> Signed-off-by: caojun <caojun@uniontech.com>
What is the purpose of this patch? All of this code already exists from
3 years ago.
> ---
> drivers/nvme/host/core.c | 16 +++++++++-------
> drivers/nvme/host/nvme.h | 5 +++++
> drivers/nvme/host/pci.c | 2 ++
> 3 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index e64310f22..8e0dbfb6a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2155,14 +2155,16 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
> size_t nqnlen;
> int off;
>
> - nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
> - if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
> - strncpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
> - return;
> - }
> + if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
> + nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
> + if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
> + strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
> + return;
> + }
>
> - if (ctrl->vs >= NVME_VS(1, 2, 1))
> - dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
> + if (ctrl->vs >= NVME_VS(1, 2, 1))
> + dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
> + }
>
> /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
> off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 276975506..5f5a91518 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -90,6 +90,11 @@ enum nvme_quirks {
> * Set MEDIUM priority on SQ creation
> */
> NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
> +
> + /*
> + * Ignore device provided subnqn.
> + */
> + NVME_QUIRK_IGNORE_DEV_SUBNQN = (1 << 8),
> };
>
> /*
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index d7cf3202c..fcac05528 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2713,6 +2713,8 @@ static const struct pci_device_id nvme_id_table[] = {
> { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
> .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
> NVME_QUIRK_MEDIUM_PRIO_SQ },
> + { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */
> + .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
> { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
> .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
> { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
> --
> 2.20.1
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-03 15:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-02 2:58 [PATCH] add Intel 760p/Pro 7600p nvme disk caojun
-- strict thread matches above, loose matches on Subject: below --
2021-12-02 3:02 caojun
2021-12-02 17:55 ` Keith Busch
[not found] ` <tencent_5722FB4254C69E931F449D17@qq.com>
2021-12-03 15:07 ` Keith Busch
2021-12-03 15:24 ` Michael Fuckner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox