From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D10E41C32; Tue, 7 Feb 2023 19:11:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7BBB4021F; Tue, 7 Feb 2023 19:11:13 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id AA8AB40151 for ; Tue, 7 Feb 2023 19:11:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675793472; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m2aMlIuakP069azbGsKG8K5/90N88+9muANTw1ITYWs=; b=Gy+aog9/P9qF9cj8W2+gLxJdC0SJJSrL/QXR0DTCdK3EEUmVDIrp8vZjfgQ257h5cfcRGS VLY4AFca9tpkDCwPWxrTEt9Jztdho4XrIW5QZD2fwUhng9rv8PgU7X67fm//lSn2teuy+A M/ykQ8UvfHIqz08BdTJgmeoDCs/Jb0M= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-620-MxeTfUKVNEuEHFN4l4bEtw-1; Tue, 07 Feb 2023 13:11:11 -0500 X-MC-Unique: MxeTfUKVNEuEHFN4l4bEtw-1 Received: by mail-yb1-f198.google.com with SMTP id 200-20020a2505d1000000b0088347752c5fso8618914ybf.18 for ; Tue, 07 Feb 2023 10:11:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m2aMlIuakP069azbGsKG8K5/90N88+9muANTw1ITYWs=; b=XoNWc2fpDOUjG6ng8RF7kb6te2idTwxzNmFSd+OJX0iwXSG+ghkQnpJyAeMDG7ApET SUnxH1VMSWVV6Dy3oDph/24AC9viLNvD88XZetAx/QBeHyvrhxs93CXD6K+sNwhTwVe1 7k6QOIqDpqDlBC9TyYX0XH8FhQaUp9N3P5/8iYaoWuZS4RPfwZLCmnHRoxJNO1XqeaZS 7bpTmUrQ3b96AqzQXWlH+y3Otc8Gz0z4FQHzWVvaUU5woY0I0wk4UpL3/e+1KhumvSOQ 2hkJAOXdPSaziVeATCu9uFeki/mSKXpk1p4FZueacl729I/17iJFRhmfEu3VB2ZsgyHb MWLQ== X-Gm-Message-State: AO0yUKUY28SrBxo82EVQxV+Tl/YRboLN3rjI90TilP1aEXoDA0iQcZVp BoF7NL0EAVQeQJBi5f9c6AD6UdCN1NlN6j2C3j0zBrmChc8hN1Xn7NNBzSBWOS+OPNxLP1VBMn4 +3/+mWO7rBYi6SKyvZCo= X-Received: by 2002:a5b:1c3:0:b0:80b:72cc:3967 with SMTP id f3-20020a5b01c3000000b0080b72cc3967mr507673ybp.123.1675793470637; Tue, 07 Feb 2023 10:11:10 -0800 (PST) X-Google-Smtp-Source: AK7set9gsCoSoXm7ZFokBFPCCvOL8XyM3QSMyMuboSa8jjqnFkJ+zHF6ymoaRFWrNdWMsVQYCnt7N6OA3uUqrI/jxCs= X-Received: by 2002:a5b:1c3:0:b0:80b:72cc:3967 with SMTP id f3-20020a5b01c3000000b0080b72cc3967mr507668ybp.123.1675793470410; Tue, 07 Feb 2023 10:11:10 -0800 (PST) MIME-Version: 1.0 References: <20230207151747.245808-1-maxime.coquelin@redhat.com> <20230207151747.245808-19-maxime.coquelin@redhat.com> In-Reply-To: <20230207151747.245808-19-maxime.coquelin@redhat.com> From: Eugenio Perez Martin Date: Tue, 7 Feb 2023 19:10:34 +0100 Message-ID: Subject: Re: [PATCH v2 18/21] net/virtio-user: add new callback to enable control queue To: Maxime Coquelin Cc: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, stephen@networkplumber.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Feb 7, 2023 at 4:18 PM Maxime Coquelin wrote: > > This patch introduces a new callback that is to be called > when the backend supports control virtqueue. > > Implementation for Vhost-vDPA backend is added in this patch. > > Signed-off-by: Maxime Coquelin > Reviewed-by: Chenbo Xia Small nitpick but as previous one it is ok to leave as it is now. Acked-by: Eugenio P=C3=A9rez > --- > drivers/net/virtio/virtio_user/vhost.h | 1 + > drivers/net/virtio/virtio_user/vhost_vdpa.c | 15 +++++++++++++++ > drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 +++ > 3 files changed, 19 insertions(+) > > diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/= virtio_user/vhost.h > index dfbf6be033..f817cab77a 100644 > --- a/drivers/net/virtio/virtio_user/vhost.h > +++ b/drivers/net/virtio/virtio_user/vhost.h > @@ -82,6 +82,7 @@ struct virtio_user_backend_ops { > int (*get_config)(struct virtio_user_dev *dev, uint8_t *data, uin= t32_t off, uint32_t len); > int (*set_config)(struct virtio_user_dev *dev, const uint8_t *dat= a, uint32_t off, > uint32_t len); > + int (*cvq_enable)(struct virtio_user_dev *dev, int enable); > int (*enable_qp)(struct virtio_user_dev *dev, uint16_t pair_idx, = int enable); > int (*dma_map)(struct virtio_user_dev *dev, void *addr, uint64_t = iova, size_t len); > int (*dma_unmap)(struct virtio_user_dev *dev, void *addr, uint64_= t iova, size_t len); > diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/vi= rtio/virtio_user/vhost_vdpa.c > index a0897f8dd1..3fd13d9fac 100644 > --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c > +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c > @@ -564,6 +564,20 @@ vhost_vdpa_destroy(struct virtio_user_dev *dev) > return 0; > } > > +static int > +vhost_vdpa_cvq_enable(struct virtio_user_dev *dev, int enable) > +{ > + struct vhost_vring_state state =3D { > + .index =3D dev->max_queue_pairs * 2, > + .num =3D enable, > + }; > + > + if (vhost_vdpa_set_vring_enable(dev, &state)) > + return -1; > + > + return 0; Any reason for not to "return vhost_vdpa_set_vring_enable(dev, &state));"? Thanks! > +} > + > static int > vhost_vdpa_enable_queue_pair(struct virtio_user_dev *dev, > uint16_t pair_idx, > @@ -629,6 +643,7 @@ struct virtio_user_backend_ops virtio_ops_vdpa =3D { > .set_status =3D vhost_vdpa_set_status, > .get_config =3D vhost_vdpa_get_config, > .set_config =3D vhost_vdpa_set_config, > + .cvq_enable =3D vhost_vdpa_cvq_enable, > .enable_qp =3D vhost_vdpa_enable_queue_pair, > .dma_map =3D vhost_vdpa_dma_map_batch, > .dma_unmap =3D vhost_vdpa_dma_unmap_batch, > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/n= et/virtio/virtio_user/virtio_user_dev.c > index 1a5386a3f6..b0d603ee12 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -767,6 +767,9 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, ui= nt16_t q_pairs) > for (i =3D q_pairs; i < dev->max_queue_pairs; ++i) > ret |=3D dev->ops->enable_qp(dev, i, 0); > > + if (dev->scvq) > + ret |=3D dev->ops->cvq_enable(dev, 1); > + > dev->queue_pairs =3D q_pairs; > > return ret; > -- > 2.39.1 >