diff mbox series

[3/3] vDPA/ifcvf: set_status() should get a adapter from the mgmt dev

Message ID 20210630082145.5729-4-lingshan.zhu@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series vDPA/ifcvf: implement management netlink framework | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Zhu, Lingshan June 30, 2021, 8:21 a.m. UTC
ifcvf_vdpa_set_status() should get a adapter from the
management device

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jason Wang July 5, 2021, 5:09 a.m. UTC | #1
在 2021/6/30 下午4:21, Zhu Lingshan 写道:
> ifcvf_vdpa_set_status() should get a adapter from the
> management device
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> ---
>   drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 7c2f64ca2163..28c71eef1d2b 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -212,13 +212,15 @@ static u8 ifcvf_vdpa_get_status(struct vdpa_device *vdpa_dev)
>   
>   static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
>   {
> +	struct ifcvf_vdpa_mgmt_dev *ifcvf_mgmt_dev;
>   	struct ifcvf_adapter *adapter;
>   	struct ifcvf_hw *vf;
>   	u8 status_old;
>   	int ret;
>   
>   	vf  = vdpa_to_vf(vdpa_dev);
> -	adapter = dev_get_drvdata(vdpa_dev->dev.parent);


If this is a fix for patch 2, you need to squash this into that one.

Any reason that vdpa_to_adapter() can't work?

And I see:

+struct ifcvf_vdpa_mgmt_dev {
+	struct vdpa_mgmt_dev mdev;
+	struct ifcvf_adapter *adapter;
+	struct pci_dev *pdev;
+};

What's the reason for having a adapter pointer here?

Thanks


> +	ifcvf_mgmt_dev = dev_get_drvdata(vdpa_dev->dev.parent);
> +	adapter = ifcvf_mgmt_dev->adapter;
>   	status_old = ifcvf_get_status(vf);
>   
>   	if (status_old == status)
Zhu, Lingshan July 5, 2021, 9:46 a.m. UTC | #2
On 7/5/2021 1:09 PM, Jason Wang wrote:
>
> 在 2021/6/30 下午4:21, Zhu Lingshan 写道:
>> ifcvf_vdpa_set_status() should get a adapter from the
>> management device
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> ---
>>   drivers/vdpa/ifcvf/ifcvf_main.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c 
>> b/drivers/vdpa/ifcvf/ifcvf_main.c
>> index 7c2f64ca2163..28c71eef1d2b 100644
>> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
>> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>> @@ -212,13 +212,15 @@ static u8 ifcvf_vdpa_get_status(struct 
>> vdpa_device *vdpa_dev)
>>     static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, 
>> u8 status)
>>   {
>> +    struct ifcvf_vdpa_mgmt_dev *ifcvf_mgmt_dev;
>>       struct ifcvf_adapter *adapter;
>>       struct ifcvf_hw *vf;
>>       u8 status_old;
>>       int ret;
>>         vf  = vdpa_to_vf(vdpa_dev);
>> -    adapter = dev_get_drvdata(vdpa_dev->dev.parent);
>
>
> If this is a fix for patch 2, you need to squash this into that one.
sure will squash it to patch 2
>
> Any reason that vdpa_to_adapter() can't work?
will use it in V2.
>
> And I see:
>
> +struct ifcvf_vdpa_mgmt_dev {
> +    struct vdpa_mgmt_dev mdev;
> +    struct ifcvf_adapter *adapter;
> +    struct pci_dev *pdev;
> +};
>
> What's the reason for having a adapter pointer here?
because in ifcvf_remove(), we need to get the management device from 
pdev struct, so need to set the management device pointor
to the pdev drvdata, then need this *adapter pointor to address the adapter.

Thanks
>
>
> Thanks
>
>
>> +    ifcvf_mgmt_dev = dev_get_drvdata(vdpa_dev->dev.parent);
>> +    adapter = ifcvf_mgmt_dev->adapter;
>>       status_old = ifcvf_get_status(vf);
>>         if (status_old == status)
>
diff mbox series

Patch

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index 7c2f64ca2163..28c71eef1d2b 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -212,13 +212,15 @@  static u8 ifcvf_vdpa_get_status(struct vdpa_device *vdpa_dev)
 
 static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
 {
+	struct ifcvf_vdpa_mgmt_dev *ifcvf_mgmt_dev;
 	struct ifcvf_adapter *adapter;
 	struct ifcvf_hw *vf;
 	u8 status_old;
 	int ret;
 
 	vf  = vdpa_to_vf(vdpa_dev);
-	adapter = dev_get_drvdata(vdpa_dev->dev.parent);
+	ifcvf_mgmt_dev = dev_get_drvdata(vdpa_dev->dev.parent);
+	adapter = ifcvf_mgmt_dev->adapter;
 	status_old = ifcvf_get_status(vf);
 
 	if (status_old == status)