[dpdk-dev] [PATCH 05/15] net/virtio: save notify bar ID in virtio HW struct

Maxime Coquelin maxime.coquelin at redhat.com
Thu Aug 29 09:59:50 CEST 2019


SAving the notify bar ID in the virtio HW struct will be
used by the virtio-vdpa driver in its .get_notify_area()
callback.

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 drivers/net/virtio/virtio_pci.c | 6 ++++--
 drivers/net/virtio/virtio_pci.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 4468e89cb..762847d70 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -617,12 +617,14 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
 			ret = rte_pci_read_config(dev,
 					&hw->notify_off_multiplier,
 					4, pos + sizeof(cap));
-			if (ret != 4)
+			if (ret != 4) {
 				PMD_INIT_LOG(DEBUG,
 					"failed to read notify_off_multiplier, ret %d",
 					ret);
-			else
+			} else {
 				hw->notify_base = get_cfg_addr(dev, &cap);
+				hw->notify_region = cap.bar;
+			}
 			break;
 		case VIRTIO_PCI_CAP_DEVICE_CFG:
 			hw->dev_cfg = get_cfg_addr(dev, &cap);
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 56f89a454..afdcc906f 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -256,6 +256,7 @@ struct virtio_hw {
 	uint32_t    notify_off_multiplier;
 	uint8_t     *isr;
 	uint16_t    *notify_base;
+	uint8_t     notify_region;
 	struct virtio_pci_common_cfg *common_cfg;
 	struct virtio_net_config *dev_cfg;
 	void	    *virtio_user_dev;
-- 
2.21.0



More information about the dev mailing list