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 9E4BBA04BC for ; Fri, 9 Oct 2020 09:36:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7671A1C114; Fri, 9 Oct 2020 09:36:11 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id C53B51C114 for ; Fri, 9 Oct 2020 09:36:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602228968; 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=ILpSSKMNo/HZ/Fz6Q47ciWDojD2esFGec6oyjamQNQo=; b=AYWZbJqhurQkP35pnTa97E02mEkjgJpYjx7ZFZoySZIvJwznDuO4WQDM2oyAWB5MwbRH39 qxfFsQxDyd+EZfCzHmm9MXH/BMWSPyjMlW2t9VPHt+MEx81Yfh22lSdfsR9sXGnQZt3SeN vWUpDrN/qqzL1daY5YEQkNgMfYEFkn4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-g684tr5QPdWwpPZJ8VG4xA-1; Fri, 09 Oct 2020 03:36:06 -0400 X-MC-Unique: g684tr5QPdWwpPZJ8VG4xA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 032C918A076F; Fri, 9 Oct 2020 07:36:05 +0000 (UTC) Received: from [10.36.110.17] (unknown [10.36.110.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F15A7664D; Fri, 9 Oct 2020 07:36:03 +0000 (UTC) To: "Zhang, Roy Fan" , "dev@dpdk.org" Cc: "Xia, Chenbo" , "Liu, Changpeng" , "Yigit, Ferruh" , "stable@dpdk.org" References: <20201002083615.45470-1-roy.fan.zhang@intel.com> <20201002153601.84097-1-roy.fan.zhang@intel.com> <20201002153601.84097-3-roy.fan.zhang@intel.com> <798b51fb-ec52-1f08-a0ee-4212680da8b0@redhat.com> From: Maxime Coquelin Autocrypt: addr=maxime.coquelin@redhat.com; keydata= mQINBFOEQQIBEADjNLYZZqghYuWv1nlLisptPJp+TSxE/KuP7x47e1Gr5/oMDJ1OKNG8rlNg kLgBQUki3voWhUbMb69ybqdMUHOl21DGCj0BTU3lXwapYXOAnsh8q6RRM+deUpasyT+Jvf3a gU35dgZcomRh5HPmKMU4KfeA38cVUebsFec1HuJAWzOb/UdtQkYyZR4rbzw8SbsOemtMtwOx YdXodneQD7KuRU9IhJKiEfipwqk2pufm2VSGl570l5ANyWMA/XADNhcEXhpkZ1Iwj3TWO7XR uH4xfvPl8nBsLo/EbEI7fbuUULcAnHfowQslPUm6/yaGv6cT5160SPXT1t8U9QDO6aTSo59N jH519JS8oeKZB1n1eLDslCfBpIpWkW8ZElGkOGWAN0vmpLfdyiqBNNyS3eGAfMkJ6b1A24un /TKc6j2QxM0QK4yZGfAxDxtvDv9LFXec8ENJYsbiR6WHRHq7wXl/n8guyh5AuBNQ3LIK44x0 KjGXP1FJkUhUuruGyZsMrDLBRHYi+hhDAgRjqHgoXi5XGETA1PAiNBNnQwMf5aubt+mE2Q5r qLNTgwSo2dpTU3+mJ3y3KlsIfoaxYI7XNsPRXGnZi4hbxmeb2NSXgdCXhX3nELUNYm4ArKBP LugOIT/zRwk0H0+RVwL2zHdMO1Tht1UOFGfOZpvuBF60jhMzbQARAQABtCxNYXhpbWUgQ29x dWVsaW4gPG1heGltZS5jb3F1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BHe+n6jTGEFNrbiOdWpJgc5yHIZZnwXaW54QT UhhSjDL1rV2B4F28w30jYmlRmm2RdN7iCZfbyP3dvFQTzQ4ySquuPkIGcOOHrvZzxbRjzMx1 Mwqu3GQ= Message-ID: Date: Fri, 9 Oct 2020 09:36:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev v2 2/2] vhost/crypto: fix feature negotiation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 10/6/20 10:37 AM, Zhang, Roy Fan wrote: > Hi Maxime, > > Thanks I will verify it after you applied the patch. Thanks, Your patch is now on dpdk-next-virtio/main. I would be glad if you could test it before Ferruh merges it. Thanks, Maxime > Regards, > Fan > >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Tuesday, October 6, 2020 9:10 AM >> To: Zhang, Roy Fan ; dev@dpdk.org >> Cc: Xia, Chenbo ; Liu, Changpeng >> ; Yigit, Ferruh ; >> stable@dpdk.org >> Subject: Re: [dpdk-dev v2 2/2] vhost/crypto: fix feature negotiation >> >> >> >> On 10/2/20 5:36 PM, Fan Zhang wrote: >>> This patch fixes the feature negotiation for vhost crypto during >>> initialization. The patch uses the newly created driver start >>> function to inform the driver type with the fixed vhost features. >>> In addtion the patch provides a new API specifically used by >>> the application to start a vhost-crypto driver. >>> >>> Fixes: 939066d96563 ("vhost/crypto: add public function implementation") >>> Cc: roy.fan.zhang@intel.com >>> >>> Signed-off-by: Fan Zhang >>> --- >>> examples/vhost_crypto/main.c | 3 +- >>> lib/librte_vhost/rte_vhost_crypto.h | 12 ++++++++ >>> lib/librte_vhost/rte_vhost_version.map | 1 + >>> lib/librte_vhost/vhost_crypto.c | 41 +++++++++++++++++--------- >>> 4 files changed, 42 insertions(+), 15 deletions(-) >>> >>> diff --git a/examples/vhost_crypto/main.c >> b/examples/vhost_crypto/main.c >>> index d78fd9b81..11ad49159 100644 >>> --- a/examples/vhost_crypto/main.c >>> +++ b/examples/vhost_crypto/main.c >>> @@ -598,7 +598,8 @@ main(int argc, char *argv[]) >>> rte_vhost_driver_callback_register(lo- >>> socket_files[j], >>> &virtio_crypto_device_ops); >>> >>> - ret = rte_vhost_driver_start(lo->socket_files[j]); >>> + ret = rte_vhost_crypto_driver_start( >>> + lo->socket_files[j]); >>> if (ret < 0) { >>> RTE_LOG(ERR, USER1, "failed to start >> vhost.\n"); >>> goto error_exit; >>> diff --git a/lib/librte_vhost/rte_vhost_crypto.h >> b/lib/librte_vhost/rte_vhost_crypto.h >>> index b54d61db6..c809c46a2 100644 >>> --- a/lib/librte_vhost/rte_vhost_crypto.h >>> +++ b/lib/librte_vhost/rte_vhost_crypto.h >>> @@ -20,6 +20,18 @@ enum rte_vhost_crypto_zero_copy { >>> RTE_VHOST_CRYPTO_MAX_ZERO_COPY_OPTIONS >>> }; >>> >>> +/** >>> + * Start vhost crypto driver >>> + * >>> + * @param path >>> + * The vhost-user socket file path >>> + * @return >>> + * 0 on success, -1 on failure >>> + */ >>> +__rte_experimental >>> +int >>> +rte_vhost_crypto_driver_start(const char *path); >>> + >>> /** >>> * Create Vhost-crypto instance >>> * >>> diff --git a/lib/librte_vhost/rte_vhost_version.map >> b/lib/librte_vhost/rte_vhost_version.map >>> index 55e98e557..9183d6f2f 100644 >>> --- a/lib/librte_vhost/rte_vhost_version.map >>> +++ b/lib/librte_vhost/rte_vhost_version.map >>> @@ -55,6 +55,7 @@ EXPERIMENTAL { >>> rte_vhost_driver_get_protocol_features; >>> rte_vhost_driver_get_queue_num; >>> rte_vhost_crypto_create; >>> + rte_vhost_crypto_driver_start; >>> rte_vhost_crypto_free; >>> rte_vhost_crypto_fetch_requests; >>> rte_vhost_crypto_finalize_requests; >>> diff --git a/lib/librte_vhost/vhost_crypto.c >> b/lib/librte_vhost/vhost_crypto.c >>> index e08f9c6d7..6195958d2 100644 >>> --- a/lib/librte_vhost/vhost_crypto.c >>> +++ b/lib/librte_vhost/vhost_crypto.c >>> @@ -35,13 +35,12 @@ >>> #define VC_LOG_DBG(fmt, args...) >>> #endif >>> >>> -#define VIRTIO_CRYPTO_FEATURES ((1 << VIRTIO_F_NOTIFY_ON_EMPTY) >> | \ >>> - (1 << VIRTIO_RING_F_INDIRECT_DESC) | >> \ >>> - (1 << VIRTIO_RING_F_EVENT_IDX) | \ >>> - (1 << VIRTIO_CRYPTO_SERVICE_CIPHER) | >> \ >>> - (1 << VIRTIO_CRYPTO_SERVICE_MAC) | >> \ >>> - (1 << VIRTIO_NET_F_CTRL_VQ) | >> \ >>> - (1 << VHOST_USER_PROTOCOL_F_CONFIG)) >>> +#define VIRTIO_CRYPTO_FEATURES ((1ULL << >> VIRTIO_F_NOTIFY_ON_EMPTY) | \ >>> + (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | >> \ >>> + (1ULL << VIRTIO_RING_F_EVENT_IDX) | >> \ >>> + (1ULL << VIRTIO_NET_F_CTRL_VQ) | \ >>> + (1ULL << VIRTIO_F_VERSION_1) | >> \ >>> + (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) >>> >>> #define IOVA_TO_VVA(t, r, a, l, p) \ >>> ((t)(uintptr_t)vhost_iova_to_vva(r->dev, r->vq, a, l, p)) >>> @@ -1400,6 +1399,27 @@ >> vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops, >>> return processed; >>> } >>> >>> +int >>> +rte_vhost_crypto_driver_start(const char *path) >>> +{ >>> + uint64_t protocol_features; >>> + int ret; >>> + >>> + ret = rte_vhost_driver_set_features(path, >> VIRTIO_CRYPTO_FEATURES); >>> + if (ret) >>> + return -1; >> >> As rte_vhost_driver_set_features is now called on time, >> use_builtin_virtio_net is set to false before the connection is >> established. >> >> So it should be enough. >> >>> + ret = rte_vhost_driver_get_protocol_features(path, >> &protocol_features); >>> + if (ret) >>> + return -1; >>> + protocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_CONFIG); >>> + ret = rte_vhost_driver_set_protocol_features(path, >> protocol_features); >>> + if (ret) >>> + return -1; >>> + >>> + return vhost_driver_start(path, VIRTIO_DEV_BUILTIN_CRYPTO); >> >> We just have to remove the extra param. >> >> I will to the change and apply it today so that you can test. >> >> Thanks, >> Maxime >> >>> +} >>> + >>> int >>> rte_vhost_crypto_create(int vid, uint8_t cryptodev_id, >>> struct rte_mempool *sess_pool, >>> @@ -1417,13 +1437,6 @@ rte_vhost_crypto_create(int vid, uint8_t >> cryptodev_id, >>> return -EINVAL; >>> } >>> >>> - ret = rte_vhost_driver_set_features(dev->ifname, >>> - VIRTIO_CRYPTO_FEATURES); >>> - if (ret < 0) { >>> - VC_LOG_ERR("Error setting features"); >>> - return -1; >>> - } >>> - >>> vcrypto = rte_zmalloc_socket(NULL, sizeof(*vcrypto), >>> RTE_CACHE_LINE_SIZE, socket_id); >>> if (!vcrypto) { >>> >