Re: [PATCH V2 1/3] vDPA/ifcvf: dynamic allocate vq data stores

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 26, 2023 at 10:38 AM Zhu, Lingshan <lingshan.zhu@xxxxxxxxx> wrote:
>
>
>
> On 6/26/2023 10:32 AM, Jason Wang wrote:
> > On Mon, Jun 12, 2023 at 3:14 PM Zhu Lingshan <lingshan.zhu@xxxxxxxxx> wrote:
> >> This commit dynamically allocates the data
> >> stores for the virtqueues based on
> >> virtio_pci_common_cfg.num_queues.
> > While at it, it's better to allocate vring_lm_cfg as well and drop
> > IFCVF_MAX_QUEUES.
> Yes, this has been done in 3/3 patch in this series.

Ok, yes, but it seems patch 3 implements a lot of logic so I suggest
moving it to patch 1.

Not sure it's too late since I see the patch has been merged by Michael.

Thanks

>
> Thanks
> Zhu Lingshan
> >
> > Thanks
> >
> >> Signed-off-by: Zhu Lingshan <lingshan.zhu@xxxxxxxxx>
> >> ---
> >>   drivers/vdpa/ifcvf/ifcvf_base.c | 3 +++
> >>   drivers/vdpa/ifcvf/ifcvf_base.h | 2 +-
> >>   drivers/vdpa/ifcvf/ifcvf_main.c | 2 ++
> >>   3 files changed, 6 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c
> >> index 1b5da11f5403..f86495ace825 100644
> >> --- a/drivers/vdpa/ifcvf/ifcvf_base.c
> >> +++ b/drivers/vdpa/ifcvf/ifcvf_base.c
> >> @@ -134,6 +134,9 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)
> >>          }
> >>
> >>          hw->nr_vring = vp_ioread16(&hw->common_cfg->num_queues);
> >> +       hw->vring = kzalloc(sizeof(struct vring_info) * hw->nr_vring, GFP_KERNEL);
> >> +       if (!hw->vring)
> >> +               return -ENOMEM;
> >>
> >>          for (i = 0; i < hw->nr_vring; i++) {
> >>                  vp_iowrite16(i, &hw->common_cfg->queue_select);
> >> diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h
> >> index 3110ffc50caf..fa797184056b 100644
> >> --- a/drivers/vdpa/ifcvf/ifcvf_base.h
> >> +++ b/drivers/vdpa/ifcvf/ifcvf_base.h
> >> @@ -74,7 +74,7 @@ struct ifcvf_hw {
> >>          u64 dev_features;
> >>          struct virtio_pci_common_cfg __iomem *common_cfg;
> >>          void __iomem *dev_cfg;
> >> -       struct vring_info vring[IFCVF_MAX_QUEUES];
> >> +       struct vring_info *vring;
> >>          void __iomem * const *base;
> >>          char config_msix_name[256];
> >>          struct vdpa_callback config_cb;
> >> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> >> index 6e47ac2c669a..2af0de771b49 100644
> >> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> >> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> >> @@ -830,6 +830,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >>          return 0;
> >>
> >>   err:
> >> +       kfree(ifcvf_mgmt_dev->vf.vring);
> >>          kfree(ifcvf_mgmt_dev);
> >>          return ret;
> >>   }
> >> @@ -840,6 +841,7 @@ static void ifcvf_remove(struct pci_dev *pdev)
> >>
> >>          ifcvf_mgmt_dev = pci_get_drvdata(pdev);
> >>          vdpa_mgmtdev_unregister(&ifcvf_mgmt_dev->mdev);
> >> +       kfree(ifcvf_mgmt_dev->vf.vring);
> >>          kfree(ifcvf_mgmt_dev);
> >>   }
> >>
> >> --
> >> 2.39.1
> >>
>

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux