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 8086DA0350; Fri, 26 Jun 2020 13:10:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C0D1B1BEAE; Fri, 26 Jun 2020 13:10:42 +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 83B181BEA7 for ; Fri, 26 Jun 2020 13:10:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593169841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to: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=3q0wlBRhwTtRKrTkov+2uvRkjnnaH19jiNv1VmL+ofQ=; b=QYbooTwtHw2GX0PtZ2vNYlrbZIAyb5JkqSuC3nildPxtXR2QbdwQBW3w3goIsR8EzHbZS4 xMM0CDhYeU0dCOFKyNyVwJUyKWp9waUVs+5DqYG55eVt64CTkd6fyK1lAVc75UPoloTIxj lpVLc0a1iq8PorhseHipKf8cEhO1Pqo= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-351-T_xrfvcqPgGzUcXoFMXjow-1; Fri, 26 Jun 2020 07:10:39 -0400 X-MC-Unique: T_xrfvcqPgGzUcXoFMXjow-1 Received: by mail-wm1-f70.google.com with SMTP id e15so10294985wme.8 for ; Fri, 26 Jun 2020 04:10:39 -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:references:from:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3q0wlBRhwTtRKrTkov+2uvRkjnnaH19jiNv1VmL+ofQ=; b=pr69CHuaRjZ5i9BxX6PUpOeVonCgLiZy6GWxo7uraamD2E4g8aphuCcgMZdn3u7uJM pSxM9Spf1H8zL1s215y/KBP1jku2zvQlIUMW3C3ClUgJubK1kDx1K5CD5v+waQ7Z88BG oHMiLf4oji3bbeB2xpPuVb06x/bo9A8UxUNzqlclroEL/75wmLwrjfYv25++OiKcPGz6 ItoiOMbs7X0BGWBtNSzlMl0atb2jqrK4f6F6bkQbMxcjL1nYkram6dlJ6hvkE6QVeg3U 53CcZnYVMo51PLvC5ou7JIRxFxYSmQzkotpdcrhv0HeafuJGsytrRRF5Zea2b4svVy6K 4zrA== X-Gm-Message-State: AOAM5321H4xz8knF/aJE63eSTQaRfE4TlllPgY0Uyrh5gD6UhINOq+Os GS2qOx8S4TrPg7msa399VkbP9hxfj/iL4uPArbIXITod7bqQXJlHqSrt3Ilp0Yp1FdWsZhJ4EJb HF8c= X-Received: by 2002:a5d:4903:: with SMTP id x3mr3376079wrq.351.1593169836150; Fri, 26 Jun 2020 04:10:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMOPF79d4/lTYYfsfogGS3JFAtQgXaraC0bNyU0l+d5WINtxwl+wM3PvxTB+Ru1/gB+cQAgA== X-Received: by 2002:a5d:4903:: with SMTP id x3mr3376055wrq.351.1593169835950; Fri, 26 Jun 2020 04:10:35 -0700 (PDT) Received: from amorenoz.users.ipa.redhat.com ([92.176.159.3]) by smtp.gmail.com with ESMTPSA id n17sm23680127wrs.2.2020.06.26.04.10.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2020 04:10:35 -0700 (PDT) To: Maxime Coquelin , matan@mellanox.com, xiao.w.wang@intel.com, zhihong.wang@intel.com, chenbo.xia@intel.com, david.marchand@redhat.com, viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com, grive@u256.net, dev@dpdk.org References: <20200624122701.1369327-1-maxime.coquelin@redhat.com> <20200624122701.1369327-12-maxime.coquelin@redhat.com> From: Adrian Moreno Autocrypt: addr=amorenoz@redhat.com; prefer-encrypt=mutual; keydata= mQENBF1syNUBCADQ9dk3fDMxOZ/+OQpmbanpodYxEv8IRtDz8PXw8YX7UyGfozOpLjQ8Fftj ZxuubYNbt2QVbSgviFilFdNWu2eTnN/JaGtfhmTOLPVoakkPHZF8lbgImMoch7L0fH8wN2IM KPxQyPNlX+K9FD5brHsV1lfe1TwAxmhcvLW8yNrVq+9eDIDykxc7tH4exIqXgZroahGxMHKy c8Ti2kJka/t6pDfRaY0J+6J7I1nrn6GXXSMNA45EH8+0N/QlcXhP3rfftnoPeVmpjswzvJqY FNjf/Q5VPLx7RX0Qx+y8mMB2JcChV5Bl7D7x5EUbItj6+Sy7QfOgCtPegk9HSrBCNYaLABEB AAG0I0FkcmlhbiBNb3Jlbm8gPGFtb3Jlbm96QHJlZGhhdC5jb20+iQFUBBMBCAA+FiEEogUD gihhmbOPHy26d5C5fbYeFsUFAl1syNUCGwMFCQHhM4AFCwkIBwIGFQoJCAsCBBYCAwECHgEC F4AACgkQd5C5fbYeFsX7qwgArGHSkX+ILNcujkVzjTG4OtkpJMPFlkn/1PxSEKD0jLuzx14B COzpg/Mqj3Re/QBuOas+ci9bsUA0/2nORtmmEBvzDOJpR5FH1jaGCx8USlY4WM6QqEDNZgTw hsy9KhjFzFjMk+oo3HyItXA+Uq9yrRBTjNBGTXxezMRcMuUZ4MIAfY0IRBglL2BufiuL43jD BvTENNFLoQ/wFV7qkFWSkv+8IjTsxr7M6XUo1QLd29Hn0dvwssN579HL1+BP46i2REpzeBEG L75iVChi+YnIQQNMJ9NYarVabZx4Y1Gn8+7B/1SNArDV+IDgnYgt7E58otoV2Ap310dmtuvE VbxGpbkBDQRdbMjVAQgAqyp9oA7WDu7/Y9T4Ommt69iZx8os7shUIfdgPEy5xrcPn6qGwN1/ HQ4j8nWfBG9uuX1X0RXUZIUEtYTxtED4yaCQMTqDUf9cBAwAA2mYxBfoiNYx8YqxM+sT0/J4 2qmDd+y+20UR4yzHE8AmIbspTzDFIJDAi+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, 26 Jun 2020 13:10:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200624122701.1369327-12-maxime.coquelin@redhat.com> Content-Language: en-US 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 v2 10/14] vhost: introduce wrappers for some vDPA ops 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 6/24/20 2:26 PM, Maxime Coquelin wrote: > This patch is preliminary work to make the vDPA device > structure opaque to the user application. Some callbacks > of the vDPA devices are used to query capabilities before > attaching to a Vhost port. This patch introduces wrappers > for these ops. > > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/rte_vdpa.h | 72 ++++++++++++++++++++++++++ > lib/librte_vhost/rte_vhost_version.map | 3 ++ > lib/librte_vhost/vdpa.c | 28 ++++++++++ > 3 files changed, 103 insertions(+) > > diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h > index dbdc273702..eda56dd556 100644 > --- a/lib/librte_vhost/rte_vdpa.h > +++ b/lib/librte_vhost/rte_vdpa.h > @@ -226,6 +226,78 @@ __rte_experimental > int > rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m); > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Get number of queue pairs supported by the vDPA device > + * > + * @param dev > + * vDP device pointer Here and in the comments of the following function declarations: s/vDP/vDPA/? > + * @param queue_num > + * pointer on where the number of queue is stored > + * @return > + * 0 on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vdpa_get_queue_num(struct rte_vdpa_device *dev, uint32_t *queue_num); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Get the Virtio features supported by the vDPA device > + * > + * @param dev > + * vDP device pointer > + * @param features > + * pointer on where the supported features are stored > + * @return > + * 0 on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vdpa_get_features(struct rte_vdpa_device *dev, uint64_t *features); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Get the Vhost-user protocol features supported by the vDPA device > + * > + * @param dev > + * vDP device pointer > + * @param features > + * pointer on where the supported protocol features are stored > + * @return > + * 0 on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vdpa_get_protocol_features(struct rte_vdpa_device *dev, uint64_t *features); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Synchronize the used ring from mediated ring to guest, log dirty > + * page for each writeable buffer, caller should handle the used > + * ring logging before device stop. > + * > + * @param vid > + * vhost device id > + * @param qid > + * vhost queue id > + * @param vring_m > + * mediated virtio ring pointer > + * @return > + * number of synced used entries on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m); > + > /** > * @warning > * @b EXPERIMENTAL: this API may change without prior notice > diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map > index d9124d0462..7a919102cf 100644 > --- a/lib/librte_vhost/rte_vhost_version.map > +++ b/lib/librte_vhost/rte_vhost_version.map > @@ -70,4 +70,7 @@ EXPERIMENTAL { > rte_vhost_slave_config_change; > rte_vdpa_find_device_by_name; > rte_vdpa_get_rte_device; > + rte_vdpa_get_queue_num; > + rte_vdpa_get_features; > + rte_vdpa_get_protocol_features; > }; > diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c > index dc2a138009..d7f9839eb2 100644 > --- a/lib/librte_vhost/vdpa.c > +++ b/lib/librte_vhost/vdpa.c > @@ -229,6 +229,34 @@ rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m) > return -1; > } > > +int > +rte_vdpa_get_queue_num(struct rte_vdpa_device *dev, uint32_t *queue_num) > +{ > + if (dev == NULL || dev->ops == NULL || dev->ops->get_queue_num == NULL) > + return -1; > + > + return dev->ops->get_queue_num(dev, queue_num); > +} > + > +int > +rte_vdpa_get_features(struct rte_vdpa_device *dev, uint64_t *features) > +{ > + if (dev == NULL || dev->ops == NULL || dev->ops->get_features == NULL) > + return -1; > + > + return dev->ops->get_features(dev, features); > +} > + > +int > +rte_vdpa_get_protocol_features(struct rte_vdpa_device *dev, uint64_t *features) > +{ > + if (dev == NULL || dev->ops == NULL || > + dev->ops->get_protocol_features == NULL) > + return -1; > + > + return dev->ops->get_protocol_features(dev, features); > +} > + > int > rte_vdpa_get_stats_names(struct rte_vdpa_device *dev, > struct rte_vdpa_stat_name *stats_names, > Apart from the typo: Acked-by: Adrián Moreno -- Adrián Moreno