[05/15] net/virtio: save notify bar ID in virtio HW struct
Checks
Commit Message
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@redhat.com>
---
drivers/net/virtio/virtio_pci.c | 6 ++++--
drivers/net/virtio/virtio_pci.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
Comments
On Thu, Aug 29, 2019 at 09:59:50AM +0200, Maxime Coquelin wrote:
> SAving the notify bar ID in the virtio HW struct will be
s/SAving/Saving/
> used by the virtio-vdpa driver in its .get_notify_area()
> callback.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/net/virtio/virtio_pci.c | 6 ++++--
> drivers/net/virtio/virtio_pci.h | 1 +
> 2 files changed, 5 insertions(+), 2 deletions(-)
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
>
> 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
>
@@ -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);
@@ -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;