netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@amd.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
	brett.creeley@amd.com, netdev@vger.kernel.org,
	drivers@pensando.io
Subject: Re: [PATCH virtio 3/4] pds_vdpa: clean and reset vqs entries
Date: Fri, 7 Jul 2023 13:12:54 -0700	[thread overview]
Message-ID: <4345f212-c919-d2fe-b47f-919629ef69b0@amd.com> (raw)
In-Reply-To: <CACGkMEtH3u9bKD-49q1HuOaqnOkZc3=t+oirKZC6RZ622nUouQ@mail.gmail.com>



On 7/7/23 12:36 AM, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Fri, Jun 30, 2023 at 8:36 AM Shannon Nelson <shannon.nelson@amd.com> wrote:
>>
>> Make sure that we initialize the vqs[] entries the same
>> way both for initial setup and after a vq reset.
>>
>> Fixes: 151cc834f3dd ("pds_vdpa: add support for vdpa and vdpamgmt interfaces")
>> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
>> Reviewed-by: Brett Creeley <brett.creeley@amd.com>
>> ---
>>   drivers/vdpa/pds/vdpa_dev.c | 24 +++++++++++++++---------
>>   1 file changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/vdpa/pds/vdpa_dev.c b/drivers/vdpa/pds/vdpa_dev.c
>> index 5e761d625ef3..5e1046c9af3d 100644
>> --- a/drivers/vdpa/pds/vdpa_dev.c
>> +++ b/drivers/vdpa/pds/vdpa_dev.c
>> @@ -429,6 +429,18 @@ static void pds_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
>>          }
>>   }
>>
>> +static void pds_vdpa_init_vqs_entry(struct pds_vdpa_device *pdsv, int qid)
>> +{
>> +       memset(&pdsv->vqs[qid], 0, sizeof(pdsv->vqs[0]));
>> +       pdsv->vqs[qid].qid = qid;
>> +       pdsv->vqs[qid].pdsv = pdsv;
>> +       pdsv->vqs[qid].ready = false;
>> +       pdsv->vqs[qid].irq = VIRTIO_MSI_NO_VECTOR;
>> +       pdsv->vqs[qid].notify =
>> +               vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
>> +                                       qid, &pdsv->vqs[qid].notify_pa);
> 
> Nit: It looks to me this would not change. So we probably don't need
> this during reset?

We set it again here because we used memset to clean the struct and need 
to put it back.  But we could grap the value before the memset then 
restore it, and do the map_vq_notify call just the first time.  I'll fix 
that up for v2.

sln

> 
> Thanks
> 
>> +}
>> +
>>   static int pds_vdpa_reset(struct vdpa_device *vdpa_dev)
>>   {
>>          struct pds_vdpa_device *pdsv = vdpa_to_pdsv(vdpa_dev);
>> @@ -451,8 +463,7 @@ static int pds_vdpa_reset(struct vdpa_device *vdpa_dev)
>>                                  dev_err(dev, "%s: reset_vq failed qid %d: %pe\n",
>>                                          __func__, i, ERR_PTR(err));
>>                          pds_vdpa_release_irq(pdsv, i);
>> -                       memset(&pdsv->vqs[i], 0, sizeof(pdsv->vqs[0]));
>> -                       pdsv->vqs[i].ready = false;
>> +                       pds_vdpa_init_vqs_entry(pdsv, i);
>>                  }
>>          }
>>
>> @@ -640,13 +651,8 @@ static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
>>          }
>>          pds_vdpa_cmd_set_mac(pdsv, pdsv->mac);
>>
>> -       for (i = 0; i < pdsv->num_vqs; i++) {
>> -               pdsv->vqs[i].qid = i;
>> -               pdsv->vqs[i].pdsv = pdsv;
>> -               pdsv->vqs[i].irq = VIRTIO_MSI_NO_VECTOR;
>> -               pdsv->vqs[i].notify = vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
>> -                                                             i, &pdsv->vqs[i].notify_pa);
>> -       }
>> +       for (i = 0; i < pdsv->num_vqs; i++)
>> +               pds_vdpa_init_vqs_entry(pdsv, i);
>>
>>          pdsv->vdpa_dev.mdev = &vdpa_aux->vdpa_mdev;
>>
>> --
>> 2.17.1
>>
> 

  reply	other threads:[~2023-07-07 20:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  0:36 [PATCH virtio 0/4] pds_vdpa: mac, reset, and irq updates Shannon Nelson
2023-06-30  0:36 ` [PATCH virtio 1/4] pds_vdpa: reset to vdpa specified mac Shannon Nelson
2023-07-07  7:33   ` Jason Wang
2023-07-07 20:12     ` Shannon Nelson
2023-07-10  3:04       ` Jason Wang
2023-07-10 15:42         ` Shannon Nelson
2023-06-30  0:36 ` [PATCH virtio 2/4] pds_vdpa: always allow offering VIRTIO_NET_F_MAC Shannon Nelson
2023-07-07  7:44   ` Jason Wang
2023-07-07 20:12     ` Shannon Nelson
2023-06-30  0:36 ` [PATCH virtio 3/4] pds_vdpa: clean and reset vqs entries Shannon Nelson
2023-07-07  7:36   ` Jason Wang
2023-07-07 20:12     ` Shannon Nelson [this message]
2023-06-30  0:36 ` [PATCH virtio 4/4] pds_vdpa: alloc irq vectors on DRIVER_OK Shannon Nelson
2023-07-07  7:38   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4345f212-c919-d2fe-b47f-919629ef69b0@amd.com \
    --to=shannon.nelson@amd.com \
    --cc=brett.creeley@amd.com \
    --cc=drivers@pensando.io \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).