From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 2DC122BD3 for ; Tue, 15 Jan 2019 12:24:35 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 03:24:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="311959855" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by fmsmga005.fm.intel.com with ESMTP; 15 Jan 2019 03:24:32 -0800 Date: Tue, 15 Jan 2019 19:22:13 +0800 From: Tiwei Bie To: Darek Stojaczyk Cc: dev@dpdk.org, Zhihong Wang , Cunming Liang , Maxime Coquelin , James R Harris , Changpeng Liu Message-ID: <20190115112213.GA15290@dpdk-tbie.sh.intel.com> References: <20190114042829.24499-1-dariusz.stojaczyk@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190114042829.24499-1-dariusz.stojaczyk@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] vhost: add external message handling callbacks to the public API 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: , X-List-Received-Date: Tue, 15 Jan 2019 11:24:35 -0000 On Mon, Jan 14, 2019 at 05:28:29AM +0100, Darek Stojaczyk wrote: > External message callbacks are used e.g. by vhost crypto > to parse crypto-specific vhost-user messages. > > We are now publishing the API to register those callbacks, > so that other backends outside of DPDK can use them as well. > > Signed-off-by: Darek Stojaczyk > --- > lib/librte_vhost/rte_vhost.h | 66 ++++++++++++++++++++++++++++++++++++ > lib/librte_vhost/vhost.c | 13 +++++++ > lib/librte_vhost/vhost.h | 54 ++--------------------------- > 3 files changed, 81 insertions(+), 52 deletions(-) > > diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h > index d280ac420..a11f9ca04 100644 > --- a/lib/librte_vhost/rte_vhost.h > +++ b/lib/librte_vhost/rte_vhost.h > @@ -111,6 +111,56 @@ struct rte_vhost_vring { > uint16_t size; > }; > > +/* The possible results of a message handling function */ Better to change /* to /**, so doxygen can generate doc for it. > +enum vh_result { > + /* Message handling failed */ > + VH_RESULT_ERR = -1, > + /* Message handling successful */ > + VH_RESULT_OK = 0, > + /* Message handling successful and reply prepared */ > + VH_RESULT_REPLY = 1, > +}; Maybe better to prefix with rte_ and RTE_? How about rte_vhost_result and RTE_VHOST_RESULT_*? > + [...] > > +/** > + * Register external message handling callbacks > + * > + * @param vid > + * vhost device ID > + * @param ops > + * virtio external callbacks to register > + * @param ctx > + * additional context passed to the callbacks > + * @return > + * 0 on success, -1 on failure > + */ > +int __rte_experimental > +rte_vhost_extern_callback_register(int vid, > + struct rte_vhost_user_extern_ops const * const ops, void *ctx); This symbol also needs to be added to the .map file for shared library. For the rest, Reviewed-by: Tiwei Bie