All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: Add .get_address ctrl callback
@ 2018-03-08 21:56 Keith Busch
  2018-03-08 22:10 ` Sagi Grimberg
  2018-03-09  8:21 ` Johannes Thumshirn
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2018-03-08 21:56 UTC (permalink / raw)


The nvme-fabrics exports the controller address to sysfs, and we'd
like to have parity with this feature for PCIe. This patch provides
the appropiate callback and returns the controller address as the pci
domain:bus:device.function.

Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index b6f43b738f03..9a3057a03499 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2416,6 +2416,13 @@ static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
 	return 0;
 }
 
+static int nvme_pci_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
+{
+	struct pci_dev *pdev = to_pci_dev(to_nvme_dev(ctrl)->dev);
+
+	return snprintf(buf, size, "%s", dev_name(&pdev->dev));
+}
+
 static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
 	.name			= "pcie",
 	.module			= THIS_MODULE,
@@ -2425,6 +2432,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
 	.reg_read64		= nvme_pci_reg_read64,
 	.free_ctrl		= nvme_pci_free_ctrl,
 	.submit_async_event	= nvme_pci_submit_async_event,
+	.get_address		= nvme_pci_get_address,
 };
 
 static int nvme_dev_map(struct nvme_dev *dev)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] nvme-pci: Add .get_address ctrl callback
  2018-03-08 21:56 [PATCH] nvme-pci: Add .get_address ctrl callback Keith Busch
@ 2018-03-08 22:10 ` Sagi Grimberg
  2018-03-09  8:21 ` Johannes Thumshirn
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2018-03-08 22:10 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] nvme-pci: Add .get_address ctrl callback
  2018-03-08 21:56 [PATCH] nvme-pci: Add .get_address ctrl callback Keith Busch
  2018-03-08 22:10 ` Sagi Grimberg
@ 2018-03-09  8:21 ` Johannes Thumshirn
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2018-03-09  8:21 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-09  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 21:56 [PATCH] nvme-pci: Add .get_address ctrl callback Keith Busch
2018-03-08 22:10 ` Sagi Grimberg
2018-03-09  8:21 ` Johannes Thumshirn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.