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 38CB0A0350; Fri, 26 Jun 2020 13:19:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 560801BEC5; Fri, 26 Jun 2020 13:19:28 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 466B41BEC4 for ; Fri, 26 Jun 2020 13:19:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593170365; 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=OM4PoYQIpzF5+ldbIBJ2YYBp4v93Iw2jRvqWiLd8cXQ=; b=TSqX131hkhHCkvlB/nQZvfXjkXHBdSOQkZmrAM/o9S9BkMBCAvQ8YOC21j94BIFIURywED AcqfCM2V3oG/FnwMBBMQIyiJgaU0rCKlQYn5suaV7PgnGBbwOcYTc5iyvwUbhwGUSbPVJ0 Wak4RH6TyDocdFffFPGVeCC9TS3bRs0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-ivv6rLD4OkOJ2AxaohdLxA-1; Fri, 26 Jun 2020 07:19:24 -0400 X-MC-Unique: ivv6rLD4OkOJ2AxaohdLxA-1 Received: by mail-wm1-f69.google.com with SMTP id b13so8362192wme.9 for ; Fri, 26 Jun 2020 04:19:24 -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=OM4PoYQIpzF5+ldbIBJ2YYBp4v93Iw2jRvqWiLd8cXQ=; b=uELaEiB1InaKmLVYmapqswJEeMw25iLVTBQ1EVzvqYKgpzn/f6eOtwsh8I+ax/V8n0 baDCUVsLlVJC9ow8p7sP4RMF1Ri8xuL2y/O+YqGyqlC/M8ez3Qfu4LuRp9mrIx76RiMY ySnXtFlulX4Pn1IxILIOhnU6Ovfpl3niwYySnJSmYmjlScXHcLfs4HfBG0gYuRBAdIUb J2C1DGkZ88IFNO5wmXGrrJrXTX3CkntaMDv6GgpPPpPqLwK9loY1MUcZ5f3jgi3c2v20 nuYMWCApdOlU+EEE8mJtiGCf8laJLxszruFPkvRqPzr3eVYJuC6OePGlvDc4qKuMGEdQ X8qA== X-Gm-Message-State: AOAM533iMcTiMbTLuLgOKGvsdpZTET5CWi4kCpDyPhaCnEmdT3NAhQqN lnPFJKXnViLageqQN2KvtpZxanGxoC1Z0fUaBrj0CprFL/YZ5Eftm2vRXbvnR78UEAbQaTzJ18R vVGU= X-Received: by 2002:a5d:6781:: with SMTP id v1mr3039075wru.383.1593170361800; Fri, 26 Jun 2020 04:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8OV8IYMWORQPMvUd8O7+xj1dJPrRghfk016TeV8V136BwOKwNxyCzbwUChqFo7eqooHqO3w== X-Received: by 2002:a5d:6781:: with SMTP id v1mr3039052wru.383.1593170361503; Fri, 26 Jun 2020 04:19:21 -0700 (PDT) Received: from amorenoz.users.ipa.redhat.com ([92.176.159.3]) by smtp.gmail.com with ESMTPSA id e4sm10082269wrt.97.2020.06.26.04.19.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2020 04:19:20 -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-18-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:19:18 +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-18-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 14/14] vhost: split vDPA header file 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:27 PM, Maxime Coquelin wrote: > This patch split the vDPA header file in two, making > rte_vdpa_device structure opaque to the application. > > Applications should only include rte_vdpa.h, while drivers > should include both rte_vdpa.h and rte_vdpa_dev.h. > > Signed-off-by: Maxime Coquelin > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 1 + > drivers/vdpa/mlx5/mlx5_vdpa.h | 1 + > lib/librte_vhost/Makefile | 3 +- > lib/librte_vhost/meson.build | 3 +- > lib/librte_vhost/rte_vdpa.h | 142 ------------------------------ > lib/librte_vhost/rte_vdpa_dev.h | 147 ++++++++++++++++++++++++++++++++ > lib/librte_vhost/vdpa.c | 1 + > lib/librte_vhost/vhost.h | 1 + > 8 files changed, 155 insertions(+), 144 deletions(-) > create mode 100644 lib/librte_vhost/rte_vdpa_dev.h > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c > index 4163047744..f81d13a2c8 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h > index ea09576c5a..de4154b183 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa.h > +++ b/drivers/vdpa/mlx5/mlx5_vdpa.h > @@ -12,6 +12,7 @@ > #pragma GCC diagnostic ignored "-Wpedantic" > #endif > #include > +#include > #include > #ifdef PEDANTIC > #pragma GCC diagnostic error "-Wpedantic" > diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile > index e592795f22..b7ff7dc4b3 100644 > --- a/lib/librte_vhost/Makefile > +++ b/lib/librte_vhost/Makefile > @@ -41,7 +41,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \ > vhost_user.c virtio_net.c vdpa.c > > # install includes > -SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_vhost.h rte_vdpa.h > +SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_vhost.h rte_vdpa.h \ > + rte_vdpa_dev.h > > # only compile vhost crypto when cryptodev is enabled > ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) > diff --git a/lib/librte_vhost/meson.build b/lib/librte_vhost/meson.build > index f80632848c..882a0eaf41 100644 > --- a/lib/librte_vhost/meson.build > +++ b/lib/librte_vhost/meson.build > @@ -21,5 +21,6 @@ cflags += '-fno-strict-aliasing' > sources = files('fd_man.c', 'iotlb.c', 'socket.c', 'vdpa.c', > 'vhost.c', 'vhost_user.c', > 'virtio_net.c', 'vhost_crypto.c') > -headers = files('rte_vhost.h', 'rte_vdpa.h', 'rte_vhost_crypto.h') > +headers = files('rte_vhost.h', 'rte_vdpa.h', 'rte_vdpa_dev.h', > + 'rte_vhost_crypto.h') > deps += ['ethdev', 'cryptodev', 'hash', 'pci'] > diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h > index 776ed67c16..5065e2130e 100644 > --- a/lib/librte_vhost/rte_vdpa.h > +++ b/lib/librte_vhost/rte_vdpa.h > @@ -11,13 +11,6 @@ > * Device specific vhost lib > */ > > -#include > - > -#include > -#include "rte_vhost.h" > - > -#define MAX_VDPA_NAME_LEN 128 > - > /** Maximum name length for statistics counters */ > #define RTE_VDPA_STATS_NAME_SIZE 64 > > @@ -48,103 +41,6 @@ struct rte_vdpa_stat_name { > char name[RTE_VDPA_STATS_NAME_SIZE]; /**< The statistic name */ > }; > > -/** > - * vdpa device operations > - */ > -struct rte_vdpa_dev_ops { > - /** Get capabilities of this device */ > - int (*get_queue_num)(struct rte_vdpa_device *dev, uint32_t *queue_num); > - > - /** Get supported features of this device */ > - int (*get_features)(struct rte_vdpa_device *dev, uint64_t *features); > - > - /** Get supported protocol features of this device */ > - int (*get_protocol_features)(struct rte_vdpa_device *dev, > - uint64_t *protocol_features); > - > - /** Driver configure/close the device */ > - int (*dev_conf)(int vid); > - int (*dev_close)(int vid); > - > - /** Enable/disable this vring */ > - int (*set_vring_state)(int vid, int vring, int state); > - > - /** Set features when changed */ > - int (*set_features)(int vid); > - > - /** Destination operations when migration done */ > - int (*migration_done)(int vid); > - > - /** Get the vfio group fd */ > - int (*get_vfio_group_fd)(int vid); > - > - /** Get the vfio device fd */ > - int (*get_vfio_device_fd)(int vid); > - > - /** Get the notify area info of the queue */ > - int (*get_notify_area)(int vid, int qid, > - uint64_t *offset, uint64_t *size); > - > - /** Get statistics name */ > - int (*get_stats_names)(struct rte_vdpa_device *dev, > - struct rte_vdpa_stat_name *stats_names, > - unsigned int size); > - > - /** Get statistics of the queue */ > - int (*get_stats)(struct rte_vdpa_device *dev, int qid, > - struct rte_vdpa_stat *stats, unsigned int n); > - > - /** Reset statistics of the queue */ > - int (*reset_stats)(struct rte_vdpa_device *dev, int qid); > - > - /** Reserved for future extension */ > - void *reserved[2]; > -}; > - > -/** > - * vdpa device structure includes device address and device operations. > - */ > -struct rte_vdpa_device { > - TAILQ_ENTRY(rte_vdpa_device) next; > - /** Generic device information */ > - struct rte_device *device; > - /** vdpa device operations */ > - struct rte_vdpa_dev_ops *ops; > -} __rte_cache_aligned; > - > -/** > - * @warning > - * @b EXPERIMENTAL: this API may change without prior notice > - * > - * Register a vdpa device > - * > - * @param addr > - * the vdpa device address > - * @param ops > - * the vdpa device operations > - * @return > - * vDPA device pointer on success, NULL on failure > - */ > -__rte_experimental > -struct rte_vdpa_device * > -rte_vdpa_register_device(struct rte_device *rte_dev, > - struct rte_vdpa_dev_ops *ops); > - > -/** > - * @warning > - * @b EXPERIMENTAL: this API may change without prior notice > - * > - * Unregister a vdpa device > - * > - * @param did > - * vDPA device pointer > - * @return > - * device id on success, -1 on failure > - */ > -__rte_experimental > -int > -rte_vdpa_unregister_device(struct rte_vdpa_device *); > - > /** > * @warning > * @b EXPERIMENTAL: this API may change without prior notice > @@ -175,44 +71,6 @@ __rte_experimental > struct rte_device * > rte_vdpa_get_rte_device(struct rte_vdpa_device *vdpa_dev); > > -/** > - * @warning > - * @b EXPERIMENTAL: this API may change without prior notice > - * > - * Enable/Disable host notifier mapping for a vdpa port. > - * > - * @param vid > - * vhost device id > - * @param enable > - * true for host notifier map, false for host notifier unmap > - * @return > - * 0 on success, -1 on failure > - */ > -__rte_experimental > -int > -rte_vhost_host_notifier_ctrl(int vid, bool enable); > - > -/** > - * @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_vdpa_dev.h b/lib/librte_vhost/rte_vdpa_dev.h > new file mode 100644 > index 0000000000..fecaa8e081 > --- /dev/null > +++ b/lib/librte_vhost/rte_vdpa_dev.h > @@ -0,0 +1,147 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2018 Intel Corporation > + */ > + > +#ifndef _RTE_VDPA_H_DEV_ > +#define _RTE_VDPA_H_DEV_ > + > +#include > + > +#include "rte_vhost.h" > + > +/** > + * vdpa device operations > + */ > +struct rte_vdpa_dev_ops { > + /** Get capabilities of this device */ > + int (*get_queue_num)(struct rte_vdpa_device *dev, uint32_t *queue_num); > + > + /** Get supported features of this device */ > + int (*get_features)(struct rte_vdpa_device *dev, uint64_t *features); > + > + /** Get supported protocol features of this device */ > + int (*get_protocol_features)(struct rte_vdpa_device *dev, > + uint64_t *protocol_features); > + > + /** Driver configure/close the device */ > + int (*dev_conf)(int vid); > + int (*dev_close)(int vid); > + > + /** Enable/disable this vring */ > + int (*set_vring_state)(int vid, int vring, int state); > + > + /** Set features when changed */ > + int (*set_features)(int vid); > + > + /** Destination operations when migration done */ > + int (*migration_done)(int vid); > + > + /** Get the vfio group fd */ > + int (*get_vfio_group_fd)(int vid); > + > + /** Get the vfio device fd */ > + int (*get_vfio_device_fd)(int vid); > + > + /** Get the notify area info of the queue */ > + int (*get_notify_area)(int vid, int qid, > + uint64_t *offset, uint64_t *size); > + > + /** Get statistics name */ > + int (*get_stats_names)(struct rte_vdpa_device *dev, > + struct rte_vdpa_stat_name *stats_names, > + unsigned int size); > + > + /** Get statistics of the queue */ > + int (*get_stats)(struct rte_vdpa_device *dev, int qid, > + struct rte_vdpa_stat *stats, unsigned int n); > + > + /** Reset statistics of the queue */ > + int (*reset_stats)(struct rte_vdpa_device *dev, int qid); > + > + /** Reserved for future extension */ > + void *reserved[2]; > +}; > + > +/** > + * vdpa device structure includes device address and device operations. > + */ > +struct rte_vdpa_device { > + TAILQ_ENTRY(rte_vdpa_device) next; > + /** Generic device information */ > + struct rte_device *device; > + /** vdpa device operations */ > + struct rte_vdpa_dev_ops *ops; > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Register a vdpa device > + * > + * @param rte_dev > + * the generic device pointer > + * @param ops > + * the vdpa device operations > + * @return > + * vDPA device pointer on success, NULL on failure > + */ > +__rte_experimental > +struct rte_vdpa_device * > +rte_vdpa_register_device(struct rte_device *rte_dev, > + struct rte_vdpa_dev_ops *ops); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Unregister a vdpa device > + * > + * @param dev > + * vDPA device pointer > + * @return > + * device id on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vdpa_unregister_device(struct rte_vdpa_device *dev); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice > + * > + * Enable/Disable host notifier mapping for a vdpa port. > + * > + * @param vid > + * vhost device id > + * @param enable > + * true for host notifier map, false for host notifier unmap > + * @return > + * 0 on success, -1 on failure > + */ > +__rte_experimental > +int > +rte_vhost_host_notifier_ctrl(int vid, bool enable); > + > +/** > + * @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); > + > +#endif /* _RTE_VDPA_DEV_H_ */ > diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c > index 864770d506..04c4b25473 100644 > --- a/lib/librte_vhost/vdpa.c > +++ b/lib/librte_vhost/vdpa.c > @@ -17,6 +17,7 @@ > #include > > #include "rte_vdpa.h" > +#include "rte_vdpa_dev.h" > #include "vhost.h" > > /** Double linked list of vDPA devices. */ > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index 819857a65a..941a42637e 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -22,6 +22,7 @@ > > #include "rte_vhost.h" > #include "rte_vdpa.h" > +#include "rte_vdpa_dev.h" > > /* Used to indicate that the device is running on a data core */ > #define VIRTIO_DEV_RUNNING 1 > Acked-by: Adrián Moreno -- Adrián Moreno