Skip to content

Commit

Permalink
vDPA/ifcvf: manage ifcvf_hw in the mgmt_dev
Browse files Browse the repository at this point in the history
This commit allocates the hw structure in the
management device structure. So the hardware
can be initialized once the management device
is allocated in probe.

Signed-off-by: Zhu Lingshan <[email protected]>
Cc: [email protected]
Message-Id: <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
ls-zhu authored and mstsirkin committed Feb 21, 2023
1 parent 7cfd36b commit 6a3b2f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions drivers/vdpa/ifcvf/ifcvf_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define IFCVF_INFO(pdev, fmt, ...) dev_info(&pdev->dev, fmt, ##__VA_ARGS__)

#define ifcvf_private_to_vf(adapter) \
(&((struct ifcvf_adapter *)adapter)->vf)
(((struct ifcvf_adapter *)adapter)->vf)

/* all vqs and config interrupt has its own vector */
#define MSIX_VECTOR_PER_VQ_AND_CONFIG 1
Expand Down Expand Up @@ -95,7 +95,7 @@ struct ifcvf_hw {
struct ifcvf_adapter {
struct vdpa_device vdpa;
struct pci_dev *pdev;
struct ifcvf_hw vf;
struct ifcvf_hw *vf;
};

struct ifcvf_vring_lm_cfg {
Expand All @@ -110,6 +110,7 @@ struct ifcvf_lm_cfg {

struct ifcvf_vdpa_mgmt_dev {
struct vdpa_mgmt_dev mdev;
struct ifcvf_hw vf;
struct ifcvf_adapter *adapter;
struct pci_dev *pdev;
};
Expand Down
7 changes: 4 additions & 3 deletions drivers/vdpa/ifcvf/ifcvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static struct ifcvf_hw *vdpa_to_vf(struct vdpa_device *vdpa_dev)
{
struct ifcvf_adapter *adapter = vdpa_to_adapter(vdpa_dev);

return &adapter->vf;
return adapter->vf;
}

static u64 ifcvf_vdpa_get_device_features(struct vdpa_device *vdpa_dev)
Expand Down Expand Up @@ -750,7 +750,7 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
return -EOPNOTSUPP;

adapter = ifcvf_mgmt_dev->adapter;
vf = &adapter->vf;
vf = adapter->vf;
pdev = adapter->pdev;
vdpa_dev = &adapter->vdpa;

Expand Down Expand Up @@ -838,10 +838,11 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
adapter->vdpa.mdev = &ifcvf_mgmt_dev->mdev;
ifcvf_mgmt_dev->adapter = adapter;

vf = &adapter->vf;
vf = &ifcvf_mgmt_dev->vf;
vf->dev_type = get_dev_type(pdev);
vf->base = pcim_iomap_table(pdev);
vf->pdev = pdev;
adapter->vf = vf;

ret = ifcvf_init_hw(vf, pdev);
if (ret) {
Expand Down

0 comments on commit 6a3b2f1

Please sign in to comment.