[dpdk-stable] [dpdk-dev] [PATCH v12 4/4] examples/ifpga: add example for ifpga opae API

Huang, Wei wei.huang at intel.com
Fri Jan 29 08:44:23 CET 2021


Hi,

-----Original Message-----
From: Ferruh Yigit <ferruh.yigit at intel.com> 
Sent: Thursday, January 28, 2021 21:35
To: Huang, Wei <wei.huang at intel.com>; dev at dpdk.org; Xu, Rosen <rosen.xu at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
Cc: stable at dpdk.org; Zhang, Tianfei <tianfei.zhang at intel.com>
Subject: Re: [dpdk-dev] [PATCH v12 4/4] examples/ifpga: add example for ifpga opae API

On 1/26/2021 6:45 AM, Wei Huang wrote:
> Below major OPAE APIs are added in this example.
> 1. opae_init_eal() set up EAL environment.
> 2. opae_cleanup_eal() clean up EAL environment.
> 3. opae_enumerate() searches PAC with specific FPGA.
> 4. opae_get_property() gets properties of FPGA.
> 5. opae_partial_reconfigure() perform partial configuration on FPGA.
> 6. opae_get_image_info() gets information of image file.
> 7. opae_update_flash() updates FPGA flash with specific image file.
> 8. opae_cancel_flash_update() cancel process of FPGA flash update.
> 9. opae_probe_device() manually probe specific FPGA with ifpga driver.
> 10. opae_remove_device() manually remove specific FPGA from ifpga driver.
> 11. opae_bind_driver() binds specific FPGA with specified kernel driver.
> 12. opae_unbind_driver() unbinds specific FPGA from kernel driver.
> 13. opae_reboot_device() reboots specific FPGA.
> 
> An example application shows how to call above OPAE APIs.
> You can test each API by running corresponding command.
> A guide is also added to show how to run the example.
> 
> Signed-off-by: Wei Huang <wei.huang at intel.com>
> Acked-by: Tianfei Zhang <tianfei.zhang at intel.com>
> Acked-by: Rosen Xu <rosen.xu at intel.com>
> ---
> v2: fix coding style issue in commands.c
> ---
> v3: add guide for running example
> ---
> v4: fix compilation issue of ifpga.rst
> ---
> v5: add ifpga.rst into sample_app_ug/index.rst
> ---
> v6: implement OPAE APIs in example instead of ifpga rawdev
> ---
>   MAINTAINERS                        |    1 +
>   doc/guides/sample_app_ug/ifpga.rst |  433 +++++++
>   doc/guides/sample_app_ug/index.rst |    1 +
>   examples/ifpga/Makefile            |   45 +
>   examples/ifpga/commands.c          | 1321 ++++++++++++++++++++
>   examples/ifpga/commands.h          |   16 +
>   examples/ifpga/main.c              |   38 +
>   examples/ifpga/meson.build         |   20 +
>   examples/ifpga/opae_api.c          | 1788 ++++++++++++++++++++++++++++
>   examples/ifpga/opae_api.h          |  245 ++++
>   10 files changed, 3908 insertions(+)
>   create mode 100644 doc/guides/sample_app_ug/ifpga.rst
>   create mode 100644 examples/ifpga/Makefile
>   create mode 100644 examples/ifpga/commands.c
>   create mode 100644 examples/ifpga/commands.h
>   create mode 100644 examples/ifpga/main.c
>   create mode 100644 examples/ifpga/meson.build
>   create mode 100644 examples/ifpga/opae_api.c
>   create mode 100644 examples/ifpga/opae_api.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS index eafe9f8c4..04a8fdebb 
> 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1237,6 +1237,7 @@ M: Tianfei zhang <tianfei.zhang at intel.com>
>   T: git://dpdk.org/next/dpdk-next-net-intel
>   F: drivers/raw/ifpga/
>   F: doc/guides/rawdevs/ifpga.rst
> +F: doc/guides/sample_app_ug/ifpga.rst

The new example also needs to be added to the maintainers file.
OK, I will add it maintainers file.

>   
>   IOAT Rawdev
>   M: Bruce Richardson <bruce.richardson at intel.com> diff --git 
> a/doc/guides/sample_app_ug/ifpga.rst 
> b/doc/guides/sample_app_ug/ifpga.rst
> new file mode 100644
> index 000000000..adcac3bdf
> --- /dev/null
> +++ b/doc/guides/sample_app_ug/ifpga.rst
> @@ -0,0 +1,433 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright(c) 2020-2021 Intel Corporation.
> +
> +Intel FPGA Sample Application
> +=============================
> +
> +The Intel FPGA sample application is an example of how to use OPAE 
> +API to manage Intel FPGA.
> +

Can you please explain more what is "OPAE API" in documentation, provide links if possible.
OK, I will add "OPAE" description and link in documentation. 

> +Overview
> +--------
> +
> +The Intel FPGA sample application is a simple application that 
> +demonstrates the use of the OPAE API provided by ifpga driver in the DPDK.
> +This application is a readline-like interface that can be used to 
> +manage Intel FPGA, in a Linux* application environment.
> +
> +Compiling the Application
> +-------------------------
> +
> +To compile the sample application see :doc:`compiling`
> +
> +The application is located in the ``ifpga`` sub-directory.
> +
> +Running the Application
> +-----------------------
> +
> +To run the application in linux environment, issue the following command:
> +
> +.. code-block:: console
> +
> +    $ ./<build_dir>/examples/dpdk-ifpga --proc-type=auto
> +
> +Refer to the *DPDK Getting Started Guide* for general information on 
> +running applications and the Environment Abstraction Layer (EAL) options.
> +
> +Explanation
> +-----------
> +
> +The following sections provide some explanation of the code.
> +
> +EAL Initialization and cmdline Start
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The first task is the initialization of the Environment Abstraction Layer (EAL).
> +This is achieved as follows:
> +
> +.. code-block:: c
> +
> +    int main(int argc, char **argv)
> +    {
> +        ret = opae_init_eal(argc, argv);
> +        if (ret < 0)
> +            rte_panic("Cannot init EAL\n");
> +

Adding code to the documentation will be heachache to maintain, and it will be wrong by time as people update the code but not documentation.
OK, I will remove them from documentation.

I highly suggest removing code snippets from the documentation.


More information about the stable mailing list