On Wed, Feb 14, 2024 at 9:59 PM Si-Wei Liu <si-wei....@oracle.com> wrote: > > > > On 2/14/2024 10:54 AM, Eugenio Perez Martin wrote: > > On Wed, Feb 14, 2024 at 1:39 PM Si-Wei Liu <si-wei....@oracle.com> wrote: > >> Introduce new API. No functional change on existing API. > >> > >> Acked-by: Jason Wang <jasow...@redhat.com> > >> Signed-off-by: Si-Wei Liu <si-wei....@oracle.com> > > I'm ok with the new function, but doesn't the compiler complain > > because adding a static function is not used? > Hmmm, which one? vhost_vdpa_net_get_nc_vdpa is used by > vhost_vdpa_net_first_nc_vdpa internally, and > vhost_vdpa_net_first_nc_vdpa is used by vhost_vdpa_net_cvq_start (Patch > 01). I think we should be fine? >
Ouch, you're totally right. Reviewed-by: Eugenio Pérez <epere...@redhat.com> Thanks! > -Siwei > > > >> --- > >> net/vhost-vdpa.c | 13 +++++++++---- > >> 1 file changed, 9 insertions(+), 4 deletions(-) > >> > >> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c > >> index 06c83b4..4168cad 100644 > >> --- a/net/vhost-vdpa.c > >> +++ b/net/vhost-vdpa.c > >> @@ -281,13 +281,18 @@ static ssize_t vhost_vdpa_receive(NetClientState > >> *nc, const uint8_t *buf, > >> } > >> > >> > >> -/** From any vdpa net client, get the netclient of the first queue pair */ > >> -static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s) > >> +/** From any vdpa net client, get the netclient of the i-th queue pair */ > >> +static VhostVDPAState *vhost_vdpa_net_get_nc_vdpa(VhostVDPAState *s, int > >> i) > >> { > >> NICState *nic = qemu_get_nic(s->nc.peer); > >> - NetClientState *nc0 = qemu_get_peer(nic->ncs, 0); > >> + NetClientState *nc_i = qemu_get_peer(nic->ncs, i); > >> + > >> + return DO_UPCAST(VhostVDPAState, nc, nc_i); > >> +} > >> > >> - return DO_UPCAST(VhostVDPAState, nc, nc0); > >> +static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s) > >> +{ > >> + return vhost_vdpa_net_get_nc_vdpa(s, 0); > >> } > >> > >> static void vhost_vdpa_net_log_global_enable(VhostVDPAState *s, bool > >> enable) > >> -- > >> 1.8.3.1 > >> >