From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22945A0519; Fri, 3 Jul 2020 17:52:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AFFB1DC6D; Fri, 3 Jul 2020 17:52:52 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 347181DC6B for ; Fri, 3 Jul 2020 17:52:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593791569; 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:autocrypt:autocrypt; bh=QtftxUGEzuR+8ua4VfyOLVHbKMXRMky1AN2JsRT+l08=; b=FMSrCbnj+LN3nzWVlOKidqWZ1FewrL0TL0ZrbJjQaBGlJIXDgfk/d0TQiIHiugUsWgvql4 d3+2/0821IjrYC0kaGcaYP5GEzmzowMvSJf7465/SQKKYHpJLrS8lWSkF25hdGyzyeroHM TB5/bn9/HMYMdb6upBm1DYCoYL1Iojs= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-gTymd_QkNUWIQcRDbfA_7A-1; Fri, 03 Jul 2020 11:52:48 -0400 X-MC-Unique: gTymd_QkNUWIQcRDbfA_7A-1 Received: by mail-wr1-f69.google.com with SMTP id c6so12888955wru.7 for ; Fri, 03 Jul 2020 08:52:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=QtftxUGEzuR+8ua4VfyOLVHbKMXRMky1AN2JsRT+l08=; b=F/CfRml6yhkdCw+9ngt4NqNhNfTo2Jyb+ao2nnvwo+C2vCFCdBqd7QDe79YyofxL4q M7zXlGeRiUWdo+mOpz+gy4oRI2jb1rzP48C4Gb8T/y1Mi0JABgkpu/hXQ4204uNUN5kM DHkzW//HHzPy1CubtvZViF8raaGTC/q++gl+nPi54uJSrQJAJ2qItObcDivkwTqTN9UA qbX3auJG+3UXJk852gBiBZ2VO4kQ2FH4IgYid2uaBdpnpbRjBO0O8OtS55XiIr6GLmZg LwXgB1dec9YTv0Q7Lse/S3QV074xYFQNZxYlugmX5FjH0y5fW2VV3WVVBOM9yXGgo37j 53pQ== X-Gm-Message-State: AOAM531e8OFmP8d0ASibLCeJ/qHKU74bpgCChptMCi61+ZQyIzKXxYTb MmTK36DzwaBc+DCGnY4juVbgSKtvOekPRWAzILhv9LU9FHkqS574hIRoLhVJNxREb9gYD3IQxLz jCCk= X-Received: by 2002:adf:f10a:: with SMTP id r10mr7049161wro.406.1593791567385; Fri, 03 Jul 2020 08:52:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSXdHl3P9/ShHPyY6PDxbCbB1ujx508OpXLxzHFbLbmpSSkv42/wGSocNtGJ1fdembn7UxPQ== X-Received: by 2002:adf:f10a:: with SMTP id r10mr7049148wro.406.1593791567182; Fri, 03 Jul 2020 08:52:47 -0700 (PDT) Received: from amorenoz.users.ipa.redhat.com ([94.73.58.18]) by smtp.gmail.com with ESMTPSA id m4sm14046722wmi.48.2020.07.03.08.52.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 08:52:46 -0700 (PDT) To: "Xia, Chenbo" , "dev@dpdk.org" Cc: "Wang, Zhihong" , "Wang, Xiao W" , "Yigit, Ferruh" , "maxime.coquelin@redhat.com" References: <20200702074332.1211465-1-amorenoz@redhat.com> <20200702074332.1211465-2-amorenoz@redhat.com> From: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R4yzHE8AmIbspTzDFIJDAi+jKSR8F355z0sfW7CIMDC4ZWrPsskjEy1YN/U10 r6tRRH1kNyrCSbTG0d9MtcQO58h7DLXuzUhErB+BtG52A04t5cweIJTJC+koV5XPeilzlHnm RFoj0ncruGa9Odns21BNt3cy9wLfK+aUnWuAB1uc6bJGQPiAwjkilz7g7MBRUuIQ2Zt7HGLc SwARAQABiQE8BBgBCAAmFiEEogUDgihhmbOPHy26d5C5fbYeFsUFAl1syNUCGwwFCQHhM4AA CgkQd5C5fbYeFsUlSwf8CH+u/IXaE7WeWxwFkMaORfW8cM4q0xrL3M6yRGuQNW+kMjnrvK9U J9G+L1/5uTRbDQ/4LdoKqize8LjehA+iF6ba4t9Npikh8fLKWgaJfQ/hPhH4C3O5gWPOLTW6 ylGxiuER4CdFwQIoAMMslhFA7G+teeOKBq36E+1+zrybI6Xy1UBSlpDK9j4CtTnMQejjuSQb Qhle+l8VroaUHq869wjAhRHHhqmtJKggI+OvzgQpDIwfHIDypb1BuKydi2W6cVYEALUYyCLS dTBDhzj8zR5tPCsga8J7+TclQzkWOiI2C6ZtiWrMsL/Uym3uXk5nsoc7lSj7yLd/MrBRhYfP JQ== Message-ID: Date: Fri, 3 Jul 2020 17:52:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/virtio: add vhost-user protocol features support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 7/3/20 10:40 AM, Xia, Chenbo wrote: > Hi Adrian, > >> -----Original Message----- >> From: Adrian Moreno >> Sent: Thursday, July 2, 2020 3:44 PM >> To: dev@dpdk.org >> Cc: Xia, Chenbo ; Wang, Zhihong >> ; Wang, Xiao W ; Yigit, >> Ferruh ; maxime.coquelin@redhat.com >> Subject: [PATCH v3 1/2] net/virtio: add vhost-user protocol features support >> >> From: Maxime Coquelin >> >> This patch adds support for Vhost-user protocol features. >> It is required to support protocol features that were not in >> initial Vhost-user specification, such as reply-ack, MTU... >> >> Also, this patch prevents Virtio multiqueue feature negotiation >> if the slave does not support MQ protocol feature as stated >> in Vhost-user specification: >> "The multiple queues feature is supported only when the protocol >> feature ``VHOST_USER_PROTOCOL_F_MQ`` (bit 0) is set." >> >> Signed-off-by: Maxime Coquelin >> --- >> drivers/net/virtio/virtio_user/vhost.h | 9 +++++ >> drivers/net/virtio/virtio_user/vhost_user.c | 5 +++ >> .../net/virtio/virtio_user/virtio_user_dev.c | 39 ++++++++++++++++++- >> .../net/virtio/virtio_user/virtio_user_dev.h | 3 ++ >> drivers/net/virtio/virtio_user_ethdev.c | 19 +++++++++ >> 5 files changed, 73 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/virtio/virtio_user/vhost.h >> b/drivers/net/virtio/virtio_user/vhost.h >> index 1e784e58e..9ace1a90c 100644 >> --- a/drivers/net/virtio/virtio_user/vhost.h >> +++ b/drivers/net/virtio/virtio_user/vhost.h >> @@ -44,6 +44,15 @@ struct vhost_vring_addr { >> uint64_t log_guest_addr; >> }; > > [snip] > >> @@ -446,6 +455,10 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char >> *path, int queues, >> return -1; >> } >> >> + if (!is_vhost_user_by_type(dev->path)) >> + dev->unsupported_features |= >> + (1ULL << VHOST_USER_F_PROTOCOL_FEATURES); >> + >> if (!dev->is_server) { >> if (dev->ops->send_request(dev, VHOST_USER_SET_OWNER, >> NULL) < 0) { >> @@ -460,6 +473,26 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char >> *path, int queues, >> strerror(errno)); >> return -1; >> } >> + >> + >> + if (dev->device_features & >> + (1ULL << >> VHOST_USER_F_PROTOCOL_FEATURES)) { >> + if (dev->ops->send_request(dev, >> + >> VHOST_USER_GET_PROTOCOL_FEATURES, >> + &protocol_features)) >> + return -1; >> + >> + dev->protocol_features &= protocol_features; >> + >> + if (dev->ops->send_request(dev, >> + >> VHOST_USER_SET_PROTOCOL_FEATURES, >> + &dev->protocol_features)) >> + return -1; >> + >> + if (!(dev->protocol_features & >> + (1ULL << >> VHOST_USER_PROTOCOL_F_MQ))) >> + dev->unsupported_features |= (1ull << >> VIRTIO_NET_F_MQ); >> + } >> } else { >> /* We just pretend vhost-user can support all these features. >> * Note that this could be problematic that if some feature is >> @@ -469,6 +502,8 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char >> *path, int queues, >> dev->device_features = VIRTIO_USER_SUPPORTED_FEATURES; >> } >> >> + >> + >> if (!mrg_rxbuf) >> dev->unsupported_features |= (1ull << >> VIRTIO_NET_F_MRG_RXBUF); >> >> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h >> b/drivers/net/virtio/virtio_user/virtio_user_dev.h >> index 3b6b6065a..56e638f8a 100644 >> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h >> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h >> @@ -40,6 +40,9 @@ struct virtio_user_dev { >> uint64_t device_features; /* supported features by device */ >> uint64_t frontend_features; /* enabled frontend features */ >> uint64_t unsupported_features; /* unsupported features mask >> */ >> + uint64_t protocol_features; /* negotiated protocol features >> + * (Vhost-user only) >> + */ >> uint8_t status; >> uint16_t port_id; >> uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; >> diff --git a/drivers/net/virtio/virtio_user_ethdev.c >> b/drivers/net/virtio/virtio_user_ethdev.c >> index 798f191c3..ccb5a18e2 100644 >> --- a/drivers/net/virtio/virtio_user_ethdev.c >> +++ b/drivers/net/virtio/virtio_user_ethdev.c >> @@ -68,6 +68,7 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) >> int connectfd; >> struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; >> struct virtio_hw *hw = eth_dev->data->dev_private; >> + uint64_t protocol_features; >> >> connectfd = accept(dev->listenfd, NULL, NULL); >> if (connectfd < 0) >> @@ -81,6 +82,24 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) >> return -1; >> } >> >> + if (dev->device_features & >> + (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) { >> + if (dev->ops->send_request(dev, >> + >> VHOST_USER_GET_PROTOCOL_FEATURES, >> + &protocol_features)) >> + return -1; >> + >> + dev->protocol_features &= protocol_features; >> + >> + if (dev->ops->send_request(dev, >> + >> VHOST_USER_SET_PROTOCOL_FEATURES, >> + &dev->protocol_features)) >> + return -1; >> + } >> + >> + if (!(dev->protocol_features & (1ULL << >> VHOST_USER_PROTOCOL_F_MQ))) >> + dev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ); >> + > > Should this 'if' be put into above '{}' ? This should be under the condition that > VHOST_USER_F_PROTOCOL_FEATURES is supported, right? Like the code > change in 'virtio_user_dev_init'. > You're right. I'll re-send Thanks > Thanks, > Chenbo > >> dev->device_features |= dev->frontend_features; >> >> /* umask vhost-user unsupported features */ >> -- >> 2.26.2 > -- Adrián Moreno