From: Adrian Moreno <amorenoz@redhat.com> To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, amorenoz@redhat.com, chenbo.xia@intel.com Subject: [dpdk-dev] [PATCH 5/5] net/virtio: enable feature checking on virtio-user Date: Wed, 15 Jul 2020 19:18:28 +0200 Message-ID: <20200715171828.95887-6-amorenoz@redhat.com> (raw) In-Reply-To: <20200715171828.95887-1-amorenoz@redhat.com> virtio 1.0 introduced a mechanism for the driver to verify that the feature bits it sets are accepted by the device. This mechanism consists in setting the VIRTIO_STATUS_FEATURE_OK status bit and re-reading it, whitch gives a chance for the device to clear it if the the features were not accepted. This is currently being done only in modern virtio-pci devices but since the appropriate vhost-user messages have been added, it can also be done in virtio-user (vhost-user only). This patch activates this mechanism on virtio-user. Signed-off-by: Adrian Moreno <amorenoz@redhat.com> --- drivers/net/virtio/virtio_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index dc0093bdf..9063bfeb2 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1355,12 +1355,13 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features) PMD_INIT_LOG(DEBUG, "features after negotiate = %" PRIx64, hw->guest_features); - if (hw->modern) { - if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { - PMD_INIT_LOG(ERR, - "VIRTIO_F_VERSION_1 features is not enabled."); - return -1; - } + if (hw->modern && !vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { + PMD_INIT_LOG(ERR, + "VIRTIO_F_VERSION_1 features is not enabled."); + return -1; + } + + if (hw->modern || hw->virtio_user_dev) { vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK); if (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) { PMD_INIT_LOG(ERR, -- 2.26.2
prev parent reply other threads:[~2020-07-15 17:19 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-15 17:18 [dpdk-dev] [PATCH 0/5] Add support for GET/SET_STATUS on virtio-user pmd Adrian Moreno 2020-07-15 17:18 ` [dpdk-dev] [PATCH 1/5] net/virtio: split virtio-net and virtio status Adrian Moreno 2020-07-15 17:18 ` [dpdk-dev] [PATCH 2/5] net/virtio: add DEVICE_NEEDS_RESET status bit Adrian Moreno 2020-07-16 2:26 ` Xia, Chenbo 2020-07-16 7:34 ` Adrian Moreno 2020-07-16 8:14 ` Xia, Chenbo 2020-07-15 17:18 ` [dpdk-dev] [PATCH 3/5] net/virtio: add VIRTIO_SET_STATUS support to Virtio-user Adrian Moreno 2020-07-16 3:15 ` Xia, Chenbo 2020-07-16 7:43 ` Adrian Moreno 2020-07-16 8:58 ` Xia, Chenbo 2020-07-16 9:51 ` Adrian Moreno 2020-07-16 11:18 ` Xia, Chenbo 2020-07-15 17:18 ` [dpdk-dev] [PATCH 4/5] net/virtio: add GET_STATUS support to virtio-user Adrian Moreno 2020-07-16 3:31 ` Xia, Chenbo 2020-07-16 7:53 ` Adrian Moreno 2020-07-16 8:18 ` David Marchand 2020-07-16 8:28 ` Adrian Moreno 2020-07-15 17:18 ` Adrian Moreno [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200715171828.95887-6-amorenoz@redhat.com \ --to=amorenoz@redhat.com \ --cc=chenbo.xia@intel.com \ --cc=dev@dpdk.org \ --cc=maxime.coquelin@redhat.com \ --cc=zhihong.wang@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git