Message ID | 20230627113652.65283-3-maxime.coquelin@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8134973vqr; Tue, 27 Jun 2023 04:56:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HXc/ZgIVEmI2pbie9a8UJn8ibehaT/7MzBFIE9xrke7WcBQAf7UJsdRFVh+w4xPbzDuKP X-Received: by 2002:a17:907:a01:b0:973:d1ce:dbe8 with SMTP id bb1-20020a1709070a0100b00973d1cedbe8mr25836997ejc.46.1687867012742; Tue, 27 Jun 2023 04:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687867012; cv=none; d=google.com; s=arc-20160816; b=XLBxj+gxrox8rCCzRqYvpdNgalsAxQrkDg68ECSCG6PZyR1+9eTyhudoqAhUldbO2j bk1kpovBda8Czazp6Or3TZPTYNryLr7m8dL+BHY2MrbBXddUSdl0POLPIJuEai8FtBxH tpblaqyXGJDsS/PWkpCDo7IVym7PBax6T2coeA5GdfOx6o9bSXQ5y5ARTE1wH4581GGN pVYB/gNbkMZ0FI70TQmEwqlypQ2HDyH18etjK54szL18Tod3Tv/8UnoQD8AByzB5WaKa gjZNbAVWxtH8peSgQF/1uR2UV13PCSuCoduCct1VJ2ZX4Q5CAXgmAvprxsrPUNvWAJv4 Zrkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M8uI9NITXhdIkfxIh/YGGZnndpIynq2QI9XP50PGOk8=; fh=S1rZK6DPg0mAED4KjNm0cP4EEY87q6FXHFEeosELg0E=; b=NwotmVmr5o6zCg6d4tk2h3pm7v6Lrw/iPyTcSLFaHwmdVm+YvK7LKID/ZkXdQRomps EL0mA4Ym6GdXGuC7qPWvQV5OIBuU/BI20QOc+j6ftgqXv1RfsD813WtuRU/95q3W/3fH nMJEL4u29tlxkQT9sPku7wsnmz6/f8cwUvl9tRd7bqZfTpEfM1RTUb4xkeSLWpT8lgDw reMs05KvM/rth18I0aK4pfbZ6sCjhSnQVU0zDmEszPukwX90RWtrToxtZhW/6hSMpvfG Fq61bFrnpKBz6IcgzXeuTbHWsW5dINOeh9mR8zqtMftNsstTBiwgELas9F4rJAFlq8o5 NwOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JuSF3Wmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020a170906b09a00b00988919c8a70si3924471ejy.59.2023.06.27.04.56.27; Tue, 27 Jun 2023 04:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JuSF3Wmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231588AbjF0LiN (ORCPT <rfc822;nicolai.engesland@gmail.com> + 99 others); Tue, 27 Jun 2023 07:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231410AbjF0LiH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Jun 2023 07:38:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E62F010FC for <linux-kernel@vger.kernel.org>; Tue, 27 Jun 2023 04:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687865848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M8uI9NITXhdIkfxIh/YGGZnndpIynq2QI9XP50PGOk8=; b=JuSF3WmxLz7lhAimun51C0IfTJZPne1q7B5fpzfgTfwrxKKBHpiVK/tupIqLo0olX2v0Xu 96Cm9mCHcc1IuRokYbeFCqs38ylBdcVqKcgf6QpQ9b3U8idUwrhW4enXlDD0RZP6feGc51 NzbpPWG/+1TmlxOkNVXXNxQWoFdnNGM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-6Rwe48HYN8aT70oaGUc4YA-1; Tue, 27 Jun 2023 07:37:24 -0400 X-MC-Unique: 6Rwe48HYN8aT70oaGUc4YA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 472F13C0FC8D; Tue, 27 Jun 2023 11:37:24 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0A63F5CD0; Tue, 27 Jun 2023 11:37:21 +0000 (UTC) From: Maxime Coquelin <maxime.coquelin@redhat.com> To: xieyongji@bytedance.com, jasowang@redhat.com, mst@redhat.com, david.marchand@redhat.com, lulu@redhat.com Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, Maxime Coquelin <maxime.coquelin@redhat.com> Subject: [PATCH v1 2/2] vduse: enable Virtio-net device type Date: Tue, 27 Jun 2023 13:36:52 +0200 Message-ID: <20230627113652.65283-3-maxime.coquelin@redhat.com> In-Reply-To: <20230627113652.65283-1-maxime.coquelin@redhat.com> References: <20230627113652.65283-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769856841111051805?= X-GMAIL-MSGID: =?utf-8?q?1769856841111051805?= |
Series |
vduse: add support for networking devices
|
|
Commit Message
Maxime Coquelin
June 27, 2023, 11:36 a.m. UTC
This patch adds Virtio-net device type to the supported
devices types. Initialization fails if the device does
not support VIRTIO_F_VERSION_1 feature, in order to
guarantee the configuration space is read-only.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On Tue, Jun 27, 2023 at 7:37 PM Maxime Coquelin <maxime.coquelin@redhat.com> wrote: > > This patch adds Virtio-net device type to the supported > devices types. Initialization fails if the device does > not support VIRTIO_F_VERSION_1 feature, in order to > guarantee the configuration space is read-only. > > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Thanks > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index c1c2f4c711ae..89088fa27026 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -142,6 +142,7 @@ static struct workqueue_struct *vduse_irq_bound_wq; > > static u32 allowed_device_id[] = { > VIRTIO_ID_BLOCK, > + VIRTIO_ID_NET, > }; > > static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa) > @@ -1668,6 +1669,10 @@ static bool features_is_valid(struct vduse_dev_config *config) > (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE))) > return false; > > + if ((config->device_id == VIRTIO_ID_NET) && > + !(config->features & (1ULL << VIRTIO_F_VERSION_1))) > + return false; > + > return true; > } > > @@ -2023,6 +2028,7 @@ static const struct vdpa_mgmtdev_ops vdpa_dev_mgmtdev_ops = { > > static struct virtio_device_id id_table[] = { > { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, > + { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, > { 0 }, > }; > > -- > 2.41.0 >
On Tue, Jun 27, 2023 at 7:37 PM Maxime Coquelin <maxime.coquelin@redhat.com> wrote: > > This patch adds Virtio-net device type to the supported > devices types. Initialization fails if the device does > not support VIRTIO_F_VERSION_1 feature, in order to > guarantee the configuration space is read-only. > > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> > --- Reviewed-by: Xie Yongji <xieyongji@bytedance.com> Thanks, Yongji
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index c1c2f4c711ae..89088fa27026 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -142,6 +142,7 @@ static struct workqueue_struct *vduse_irq_bound_wq; static u32 allowed_device_id[] = { VIRTIO_ID_BLOCK, + VIRTIO_ID_NET, }; static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa) @@ -1668,6 +1669,10 @@ static bool features_is_valid(struct vduse_dev_config *config) (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE))) return false; + if ((config->device_id == VIRTIO_ID_NET) && + !(config->features & (1ULL << VIRTIO_F_VERSION_1))) + return false; + return true; } @@ -2023,6 +2028,7 @@ static const struct vdpa_mgmtdev_ops vdpa_dev_mgmtdev_ops = { static struct virtio_device_id id_table[] = { { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, + { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, { 0 }, };