Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B55F9C61DA4 for ; Fri, 24 Feb 2023 03:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229922AbjBXDMn (ORCPT ); Thu, 23 Feb 2023 22:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjBXDMk (ORCPT ); Thu, 23 Feb 2023 22:12:40 -0500 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 4D02C5EEFE for ; Thu, 23 Feb 2023 19:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677208311; 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: in-reply-to:in-reply-to:references:references; bh=ce5tfl2n/EssbKt11AP0PiIJ95ywSk+f7JnIMaHI1Wk=; b=Bq2S3V4dzEu83xOgYWzZr+zlld+eFtAlNrMtccxw4QQSt9bTCR9/UYBTrJtlo6Ovau8sr2 unWoMfbOYlDDU7vdejsOV5NCWe0akXUgtiaZMyNdjC1rAvqi8Y+NzNSGfMAq2bjGgv6SBe Sm3ArBiFSk5xiRE3i5PXBGjzPJD610Q= Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-241-PQbmh6iENUeWyxnTogFI5g-1; Thu, 23 Feb 2023 22:11:50 -0500 X-MC-Unique: PQbmh6iENUeWyxnTogFI5g-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-1728e0187d7so1175644fac.1 for ; Thu, 23 Feb 2023 19:11:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=ce5tfl2n/EssbKt11AP0PiIJ95ywSk+f7JnIMaHI1Wk=; b=bVFjNb8Oa0Yai/cPImFt1rULoMVXO/qI5wwxIliq5MK0VPW59OlcwbEUr5EPNA4N/4 ZnKpsF5FXevzqOUtEiDuUfooDjMiqz1aGYrOWoBfas6eGULdCvfGxe8BbAjk9z5CQ0/A asl8sVIGYdOpvQ2DTIlzd4YItCaZcdvKCT3lzRGzd+DjdTBI+gKTVcA8crImCuFgVv5m mNAzqhJKye8kUIvNMogWt95cK1fv/ERFj4n76j7C5x9joFe3jArj+negP7r2UJA4Ov+0 u0AqG7E0TbTDjp0RCuJTWteO/+GiC2WnBpWkS1mUq2Taiu9vgXedbYvfiNDHNg40qp7P 09gQ== X-Gm-Message-State: AO0yUKX8VYpjAKAuuN8CuEsEQC9jDhPh+0mnIjhDUn8WQ04hW6X5bpfj S80NrlKvPWbWSWg5xfO9BGBML+jxneSvOBaxrk7+TgCAz/hCBlnZh/amMbjPlv4s8gLrcdY8Ppj JnibH/QQCZC8hmQOG6rl+1vdxD+I9pbjPZ7y68s7vA4VNzrN+ X-Received: by 2002:a05:6808:6c9:b0:383:c688:a8e0 with SMTP id m9-20020a05680806c900b00383c688a8e0mr725788oih.9.1677208309041; Thu, 23 Feb 2023 19:11:49 -0800 (PST) X-Google-Smtp-Source: AK7set+gu9v2kcBbZccH/ZaJz3PndJ8R+g8ZrRudTxgfmD3x81zCiyAktZ0EKcq2Yuereo2Z41aHL/7pYEkRPXgsh0s= X-Received: by 2002:a05:6808:6c9:b0:383:c688:a8e0 with SMTP id m9-20020a05680806c900b00383c688a8e0mr725779oih.9.1677208308153; Thu, 23 Feb 2023 19:11:48 -0800 (PST) MIME-Version: 1.0 References: <20230223-virtio-net-kvmtool-v2-1-8ec93511e67f@rivosinc.com> In-Reply-To: <20230223-virtio-net-kvmtool-v2-1-8ec93511e67f@rivosinc.com> From: Jason Wang Date: Fri, 24 Feb 2023 11:11:37 +0800 Message-ID: Subject: Re: [PATCH v2] virtio-net: Fix probe of virtio-net on kvmtool To: rbradford@rivosinc.com Cc: "Michael S. Tsirkin" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2023 at 3:38 AM Rob Bradford via B4 Relay wrote: > > From: Rob Bradford > > kvmtool does not support the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature > but does advertise the VIRTIO_NET_F_GUEST_TSO{4,6} features. Check that > the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature is present before setting > the NETIF_F_GRO_HW feature bit as otherwise an attempt will be made to > program the virtio-net device using the ctrl queue which will fail. > > This resolves the following error when running on kvmtool: > > [ 1.865992] net eth0: Fail to set guest offload. > [ 1.872491] virtio_net virtio2 eth0: set_features() failed (-22); wanted 0x0000000000134829, left 0x0080000000134829 > > Signed-off-by: Rob Bradford > --- > Changes in v2: > - Use parentheses to group logical OR of features > - Link to v1: > https://lore.kernel.org/r/20230223-virtio-net-kvmtool-v1-1-fc23d29b9d7a@rivosinc.com > --- > drivers/net/virtio_net.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 61e33e4dd0cd..f8341d1a4ccd 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -3780,10 +3780,9 @@ static int virtnet_probe(struct virtio_device *vdev) > } > if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) > dev->features |= NETIF_F_RXCSUM; > - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || > - virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) > - dev->features |= NETIF_F_GRO_HW; > - if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) > + if ((virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || > + virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) && > + virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) > dev->hw_features |= NETIF_F_GRO_HW; Does this mean we won't have NETIF_F_GRO_HW when only TSO4/TSO6 are supported but not GUEST_OFFLOADS? Is this intended? Thanks > > dev->vlan_features = dev->features; > > --- > base-commit: c39cea6f38eefe356d64d0bc1e1f2267e282cdd3 > change-id: 20230223-virtio-net-kvmtool-87f37515be22 > > Best regards, > -- > Rob Bradford >