From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1A7FA09FF; Wed, 6 Jan 2021 10:33:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89EE6160920; Wed, 6 Jan 2021 10:33:54 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 96F6A16091F for ; Wed, 6 Jan 2021 10:33:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609925632; 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=mDxedPjngTbyzzPGAEKJLWmT/WE6beeJaH/cf1bvYvk=; b=DCbGOfS6uJPfomstOFWENXfw8IDIAmjywJo1qu1ft/6TR/KTj8RxvnHMA1xfXzwKgaxHCn xnb9kGtrXdlOgQGGltlsbbr/Fnev/X8seu/c8V7/aovd7zILivxNBfDt87SWvbgGV614uB n4Q829aDRMsHJz/Qp2thtnxnAhhEo8E= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-yqyjZHXRPM-NrvB6-zob9w-1; Wed, 06 Jan 2021 04:33:49 -0500 X-MC-Unique: yqyjZHXRPM-NrvB6-zob9w-1 Received: by mail-vs1-f72.google.com with SMTP id l13so412146vsn.7 for ; Wed, 06 Jan 2021 01:33:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mDxedPjngTbyzzPGAEKJLWmT/WE6beeJaH/cf1bvYvk=; b=HFeOkhziWunsvDjg2npjAjdunSdMPKgi9avfOYJeQWlf6ZaTTWyRn8E+DDCUEiuZ/C d0Suq5mYGNe1c2JtQw0vx/IltgvXSYuJle2hnlmGtglAv0YujGRXySIpe3JPDksGcbNb UexKSR4aa87SLPhK+BGsr30vmFxbbdjm+9SmY4bOe7nEhIwhelzoXBhsbjPrJNBp8dNF 2QqWuhMW8sCPRO+0C8XWZsrIw+5Xa7Wmbcqc4/u4aZHTSZhq392T1YCFmkQojHevr7JF 2Koi0MCmCo9Cu8CW5otPszhOEjZIzXcw5Gw8yIAzgl5C5WotAp0UUEr6t60Z+3GUc1Bn 7+nw== X-Gm-Message-State: AOAM532EVknAWbUFxohDFe40z5Nn4uZcst5eP8FeQ0p9hbcSoRSOv7gP pXGDdLm4bR8MDTZa0jveLmPdnTvWtds1jkhmMxb3Gws7PSjEBEl4kskwy1IiapYWYkY/ZU7AnOP bbLijGKUDryLrO8XWPFI= X-Received: by 2002:a1f:dac7:: with SMTP id r190mr2842243vkg.22.1609925628525; Wed, 06 Jan 2021 01:33:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQOpXtI3oOQPvSm2jnCDiOaWF8f6VB3XePjLCHjNgyQa5AusBNasqHIhVfIlBH8OPSX/y0CDMGuRm4ZzQlBJE= X-Received: by 2002:a1f:dac7:: with SMTP id r190mr2842224vkg.22.1609925628190; Wed, 06 Jan 2021 01:33:48 -0800 (PST) MIME-Version: 1.0 References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-12-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-12-maxime.coquelin@redhat.com> From: David Marchand Date: Wed, 6 Jan 2021 10:33:37 +0100 Message-ID: To: Maxime Coquelin Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 11/40] net/virtio: validate features at bus level 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 Sender: "dev" On Sun, Dec 20, 2020 at 10:15 PM Maxime Coquelin wrote: > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 00aa38e4ef..91a93b2b6e 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1315,17 +1315,16 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features) > PMD_INIT_LOG(DEBUG, "features after negotiate = %" PRIx64, > hw->guest_features); > > - if (hw->bus_type == VIRTIO_BUS_PCI_MODERN && !vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { > - PMD_INIT_LOG(ERR, > - "VIRTIO_F_VERSION_1 features is not enabled."); > + if (VTPCI_OPS(hw)->features_ok(hw) < 0) { > + PMD_INIT_LOG(ERR, "Features not OK at bus level\n"); We have a log which gives more context in the modern features_ok() callback. I don't think we need both log messages. > return -1; > } > > - if (hw->bus_type == VIRTIO_BUS_PCI_MODERN || hw->bus_type == VIRTIO_BUS_USER) { > + if (vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { > vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK); > + > if (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) { > - PMD_INIT_LOG(ERR, > - "failed to set FEATURES_OK status!"); > + PMD_INIT_LOG(ERR, "Failed to set FEATURES_OK status!"); > return -1; > } > } > diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c > index 599d8afa6b..3de7980b4f 100644 > --- a/drivers/net/virtio/virtio_pci.c > +++ b/drivers/net/virtio/virtio_pci.c [snip] > @@ -332,6 +339,17 @@ modern_set_features(struct virtio_hw *hw, uint64_t features) > &hw->common_cfg->guest_feature); > } > > +static int > +modern_features_ok(struct virtio_hw *hw) > +{ > + if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { > + PMD_INIT_LOG(ERR, "Version 1+ required with modern devices\n"); > + return -1; > + } > + > + return 0; > +} > + > static uint8_t > modern_get_status(struct virtio_hw *hw) > { -- David Marchand