diff mbox

[CLOUD-DEVv2] ddf: examples: add ddf module skeleton and ddf application

Message ID 1498118627-3763-2-git-send-email-bogdan.pricope@linaro.org
State New
Headers show

Commit Message

Bogdan Pricope June 22, 2017, 8:03 a.m. UTC
Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
 example/Makefile.am                     |  4 +-
 example/ddf_app/Makefile.am             | 10 ++++
 example/ddf_app/odp_ddf_app.c           | 49 +++++++++++++++++++
 example/ddf_ifs/Makefile.am             | 27 +++++++++++
 example/ddf_ifs/ddf_ifs.c               | 28 +++++++++++
 example/ddf_ifs/ddf_ifs.h               | 18 +++++++
 example/ddf_ifs/ddf_ifs_api.h           | 25 ++++++++++
 example/ddf_ifs/ddf_ifs_dev_dpdk.c      | 25 ++++++++++
 example/ddf_ifs/ddf_ifs_dev_dpdk.h      | 24 +++++++++
 example/ddf_ifs/ddf_ifs_devio_direct.c  | 51 +++++++++++++++++++
 example/ddf_ifs/ddf_ifs_devio_direct.h  | 20 ++++++++
 example/ddf_ifs/ddf_ifs_driver.c        | 69 ++++++++++++++++++++++++++
 example/ddf_ifs/ddf_ifs_driver.h        | 20 ++++++++
 example/ddf_ifs/ddf_ifs_enumr_class.c   | 47 ++++++++++++++++++
 example/ddf_ifs/ddf_ifs_enumr_class.h   | 20 ++++++++
 example/ddf_ifs/ddf_ifs_enumr_dpdk.c    | 86 +++++++++++++++++++++++++++++++++
 example/ddf_ifs/ddf_ifs_enumr_dpdk.h    | 20 ++++++++
 example/ddf_ifs/ddf_ifs_enumr_generic.c | 57 ++++++++++++++++++++++
 example/ddf_ifs/ddf_ifs_enumr_generic.h | 20 ++++++++
 example/ddf_ifs/odp.conf                |  4 ++
 example/m4/configure.m4                 |  2 +
 21 files changed, 625 insertions(+), 1 deletion(-)
 create mode 100644 example/ddf_app/Makefile.am
 create mode 100644 example/ddf_app/odp_ddf_app.c
 create mode 100644 example/ddf_ifs/Makefile.am
 create mode 100644 example/ddf_ifs/ddf_ifs.c
 create mode 100644 example/ddf_ifs/ddf_ifs.h
 create mode 100644 example/ddf_ifs/ddf_ifs_api.h
 create mode 100644 example/ddf_ifs/ddf_ifs_dev_dpdk.c
 create mode 100644 example/ddf_ifs/ddf_ifs_dev_dpdk.h
 create mode 100644 example/ddf_ifs/ddf_ifs_devio_direct.c
 create mode 100644 example/ddf_ifs/ddf_ifs_devio_direct.h
 create mode 100644 example/ddf_ifs/ddf_ifs_driver.c
 create mode 100644 example/ddf_ifs/ddf_ifs_driver.h
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_class.c
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_class.h
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_dpdk.c
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_dpdk.h
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_generic.c
 create mode 100644 example/ddf_ifs/ddf_ifs_enumr_generic.h
 create mode 100644 example/ddf_ifs/odp.conf

-- 
1.9.1

Comments

Yi He June 23, 2017, 8:37 a.m. UTC | #1
for this patch:

Reviewed-and-tested-by: Yi He <yi.he@linaro.org>



On 22 June 2017 at 16:03, Bogdan Pricope <bogdan.pricope@linaro.org> wrote:

> Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

> ---

>  example/Makefile.am                     |  4 +-

>  example/ddf_app/Makefile.am             | 10 ++++

>  example/ddf_app/odp_ddf_app.c           | 49 +++++++++++++++++++

>  example/ddf_ifs/Makefile.am             | 27 +++++++++++

>  example/ddf_ifs/ddf_ifs.c               | 28 +++++++++++

>  example/ddf_ifs/ddf_ifs.h               | 18 +++++++

>  example/ddf_ifs/ddf_ifs_api.h           | 25 ++++++++++

>  example/ddf_ifs/ddf_ifs_dev_dpdk.c      | 25 ++++++++++

>  example/ddf_ifs/ddf_ifs_dev_dpdk.h      | 24 +++++++++

>  example/ddf_ifs/ddf_ifs_devio_direct.c  | 51 +++++++++++++++++++

>  example/ddf_ifs/ddf_ifs_devio_direct.h  | 20 ++++++++

>  example/ddf_ifs/ddf_ifs_driver.c        | 69 ++++++++++++++++++++++++++

>  example/ddf_ifs/ddf_ifs_driver.h        | 20 ++++++++

>  example/ddf_ifs/ddf_ifs_enumr_class.c   | 47 ++++++++++++++++++

>  example/ddf_ifs/ddf_ifs_enumr_class.h   | 20 ++++++++

>  example/ddf_ifs/ddf_ifs_enumr_dpdk.c    | 86

> +++++++++++++++++++++++++++++++++

>  example/ddf_ifs/ddf_ifs_enumr_dpdk.h    | 20 ++++++++

>  example/ddf_ifs/ddf_ifs_enumr_generic.c | 57 ++++++++++++++++++++++

>  example/ddf_ifs/ddf_ifs_enumr_generic.h | 20 ++++++++

>  example/ddf_ifs/odp.conf                |  4 ++

>  example/m4/configure.m4                 |  2 +

>  21 files changed, 625 insertions(+), 1 deletion(-)

>  create mode 100644 example/ddf_app/Makefile.am

>  create mode 100644 example/ddf_app/odp_ddf_app.c

>  create mode 100644 example/ddf_ifs/Makefile.am

>  create mode 100644 example/ddf_ifs/ddf_ifs.c

>  create mode 100644 example/ddf_ifs/ddf_ifs.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_api.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_dev_dpdk.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_dev_dpdk.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_devio_direct.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_devio_direct.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_driver.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_driver.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_class.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_class.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_dpdk.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_dpdk.h

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_generic.c

>  create mode 100644 example/ddf_ifs/ddf_ifs_enumr_generic.h

>  create mode 100644 example/ddf_ifs/odp.conf

>

> diff --git a/example/Makefile.am b/example/Makefile.am

> index dfc07b6..b209585 100644

> --- a/example/Makefile.am

> +++ b/example/Makefile.am

> @@ -8,4 +8,6 @@ SUBDIRS = classifier \

>           switch \

>           time \

>           timer \

> -         traffic_mgmt

> +         traffic_mgmt \

> +         ddf_ifs \

> +         ddf_app

> diff --git a/example/ddf_app/Makefile.am b/example/ddf_app/Makefile.am

> new file mode 100644

> index 0000000..e654202

> --- /dev/null

> +++ b/example/ddf_app/Makefile.am

> @@ -0,0 +1,10 @@

> +include $(top_srcdir)/example/Makefile.inc

> +

> +bin_PROGRAMS = odp_ddf_app$(EXEEXT)

> +odp_ddf_app_LDFLAGS = $(AM_LDFLAGS) -shared

> +odp_ddf_app_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example

> +

> +noinst_HEADERS = \

> +                 $(top_srcdir)/example/example_debug.h

> +

> +dist_odp_ddf_app_SOURCES = odp_ddf_app.c

> diff --git a/example/ddf_app/odp_ddf_app.c b/example/ddf_app/odp_ddf_app.c

> new file mode 100644

> index 0000000..af864ee

> --- /dev/null

> +++ b/example/ddf_app/odp_ddf_app.c

> @@ -0,0 +1,49 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +/** enable strtok */

> +#ifndef _GNU_SOURCE

> +#define _GNU_SOURCE

> +#endif

> +

> +#include <stdio.h>

> +#include <stdlib.h>

> +

> +#include <example_debug.h>

> +#include <odp_api.h>

> +#include <odp_drv.h>

> +#include <odp/helper/odph_api.h>

> +

> +int main(int argc, char *argv[])

> +{

> +       odp_instance_t instance;

> +

> +       (void)argc;

> +       (void)argv;

> +

> +       EXAMPLE_DBG("Start DDF Application...\n");

> +

> +       /* Initialize ODP before calling anything else */

> +       if (odp_init_global(&instance, NULL, NULL)) {

> +               EXAMPLE_ERR("Error: ODP global init failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       if (odp_init_local(instance, ODP_THREAD_CONTROL)) {

> +               EXAMPLE_ERR("Error: ODP local init failed.\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       /* Print ddf objects*/

> +       odpdrv_print_all();

> +

> +       /* Terminate ODP */

> +       odp_term_local();

> +       odp_term_global(instance);

> +

> +       EXAMPLE_DBG("Exit DDF Application.\n");

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/Makefile.am b/example/ddf_ifs/Makefile.am

> new file mode 100644

> index 0000000..aa892ac

> --- /dev/null

> +++ b/example/ddf_ifs/Makefile.am

> @@ -0,0 +1,27 @@

> +LIB   = $(top_builddir)/lib

> +

> +AM_CPPFLAGS +=  -I$(srcdir) \

> +               -I$(top_srcdir)/include \

> +               -I$(top_srcdir)/platform/@with_platform@/include \

> +               -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@

> +

> +lib_LTLIBRARIES = $(LIB)/libddf_ifs.la

> +

> +noinst_HEADERS = \

> +                $(srcdir)/ddf_ifs.h \

> +                $(srcdir)/ddf_ifs_enumr_class.h \

> +                $(srcdir)/ddf_ifs_enumr_dpdk.h \

> +                $(srcdir)/ddf_ifs_enumr_generic.h \

> +                $(srcdir)/ddf_ifs_dev_dpdk.h \

> +                $(srcdir)/ddf_ifs_devio_direct.h \

> +                $(srcdir)/ddf_ifs_driver.h \

> +                $(srcdir)/ddf_ifs_api.h

> +

> +__LIB__libddf_ifs_la_SOURCES = \

> +               ddf_ifs.c \

> +               ddf_ifs_enumr_class.c \

> +               ddf_ifs_enumr_dpdk.c \

> +               ddf_ifs_enumr_generic.c \

> +               ddf_ifs_dev_dpdk.c \

> +               ddf_ifs_devio_direct.c \

> +               ddf_ifs_driver.c

> diff --git a/example/ddf_ifs/ddf_ifs.c b/example/ddf_ifs/ddf_ifs.c

> new file mode 100644

> index 0000000..fa2276f

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs.c

> @@ -0,0 +1,28 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs.h"

> +#include "ddf_ifs_enumr_class.h"

> +#include "ddf_ifs_devio_direct.h"

> +#include "ddf_ifs_driver.h"

> +

> +static ODPDRV_CONSTRUCTOR void ddf_ifs_construct(void)

> +{

> +       printf("%s()\n", __func__);

> +

> +       register_enumerator_class();

> +

> +       register_devio_direct();

> +

> +       register_driver();

> +}

> +

> +static __attribute__((destructor)) void ddf_ifs_destruct(void)

> +{

> +       printf("%s()\n", __func__);

> +}

> diff --git a/example/ddf_ifs/ddf_ifs.h b/example/ddf_ifs/ddf_ifs.h

> new file mode 100644

> index 0000000..ff8bc27

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs.h

> @@ -0,0 +1,18 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_H_

> +#define _ODP_DDF_IFS_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_api.h b/example/ddf_ifs/ddf_ifs_api.h

> new file mode 100644

> index 0000000..0d948ae

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_api.h

> @@ -0,0 +1,25 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_API_H_

> +#define _ODP_DDF_IFS_API_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +#define DDF_IFS_DEV_API_NAME "ifs_api"

> +#define DDF_IFS_DEV_API_VER 0

> +#define DDF_IFS_DEVIO_API_NAME "devio_api"

> +#define DDF_IFS_DEVIO_API_VER 0

> +

> +#define DDF_IFS_DRV_NAME "ddf_ifs_drv"

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_API_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_dev_dpdk.c

> b/example/ddf_ifs/ddf_ifs_dev_dpdk.c

> new file mode 100644

> index 0000000..4d08e51

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_dev_dpdk.c

> @@ -0,0 +1,25 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include <string.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_dev_dpdk.h"

> +

> +odpdrv_device_t dpdk_device_create(odpdrv_enumr_t enumr,

> +                                  const char *dev_addr,

> +                                  void *enum_data)

> +{

> +       odpdrv_device_param_t param;

> +

> +       printf("\t%s(%s)\n", __func__, dev_addr);

> +

> +       param.enumerator = enumr;

> +       strcpy(param.address, dev_addr);

> +       param.enum_dev = enum_data;

> +

> +       return odpdrv_device_create(&param);

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_dev_dpdk.h

> b/example/ddf_ifs/ddf_ifs_dev_dpdk.h

> new file mode 100644

> index 0000000..84583a3

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_dev_dpdk.h

> @@ -0,0 +1,24 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_DEV_DPDK_H_

> +#define _ODP_DDF_IFS_DEV_DPDK_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +#include "odp_drv.h"

> +

> +odpdrv_device_t dpdk_device_create(odpdrv_enumr_t enumr,

> +                                  const char *dev_addr,

> +                                  void *enum_data);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_DEV_DPDK_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_devio_direct.c

> b/example/ddf_ifs/ddf_ifs_devio_direct.c

> new file mode 100644

> index 0000000..ec451d6

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_devio_direct.c

> @@ -0,0 +1,51 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_api.h"

> +#include "ddf_ifs_devio_direct.h"

> +

> +static odpdrv_devio_t devio_direct;

> +

> +static int devio_direct_probe(odpdrv_device_t dev)

> +{

> +       (void)dev;

> +

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +static int devio_direct_remove(void)

> +{

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +int register_devio_direct(void)

> +{

> +       odpdrv_devio_param_t param = {

> +               .api_name = DDF_IFS_DEVIO_API_NAME,

> +               .api_version = DDF_IFS_DEVIO_API_VER,

> +               .enumr_api_name = DDF_IFS_DEV_API_NAME,

> +               .enumr_api_version = DDF_IFS_DEV_API_VER,

> +               .probe = devio_direct_probe,

> +               .remove = devio_direct_remove,

> +               .ops = NULL

> +               };

> +

> +       printf("\t%s()\n", __func__);

> +

> +       devio_direct = odpdrv_devio_register(&param);

> +       if (ODPDRV_DEVIO_INVALID == devio_direct) {

> +               printf("\tError: failed to %s()\n", __func__);

> +               return -1;

> +       }

> +

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_devio_direct.h

> b/example/ddf_ifs/ddf_ifs_devio_direct.h

> new file mode 100644

> index 0000000..9c00460

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_devio_direct.h

> @@ -0,0 +1,20 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_DEVIO_DIRECT_H_

> +#define _ODP_DDF_IFS_DEVIO_DIRECT_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +int register_devio_direct(void);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_DEVIO_DIRECT_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_driver.c b/example/ddf_ifs/ddf_ifs_

> driver.c

> new file mode 100644

> index 0000000..53f9475

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_driver.c

> @@ -0,0 +1,69 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include <string.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_api.h"

> +#include "ddf_ifs_driver.h"

> +

> +static odpdrv_driver_t ddf_ifs_driver;

> +static int drv_data = 12;

> +

> +static int ddf_ifs_driver_probe(odpdrv_device_t dev, odpdrv_devio_t

> devio,

> +                               int devio_idx)

> +{

> +       printf("%s(dev, devio, devio_idx = %d)\n", __func__, devio_idx);

> +

> +       (void)devio;

> +

> +       odpdrv_device_set_data(dev, (void *)&drv_data);

> +

> +       return 0;

> +}

> +

> +static int ddf_ifs_driver_unbind(odpdrv_device_t dev,

> +                                void (*callback)(odpdrv_device_t dev),

> +                                uint32_t flags)

> +{

> +       printf("%s()\n", __func__);

> +

> +       if (!(flags & ODPDRV_DRV_UNBIND_IMMEDIATE))

> +               return -1; /* unsupported*/

> +

> +       callback(dev);

> +

> +       return 0;

> +}

> +

> +static int ddf_ifs_driver_remove(void)

> +{

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +int register_driver(void)

> +{

> +       odpdrv_driver_param_t param = {

> +               .name = DDF_IFS_DRV_NAME,

> +               .devios = {{DDF_IFS_DEVIO_API_NAME, DDF_IFS_DEVIO_API_VER},

> +                                  {"", 0}, {"", 0} },

> +               .probe = ddf_ifs_driver_probe,

> +               .unbind = ddf_ifs_driver_unbind,

> +               .remove = ddf_ifs_driver_remove,

> +               };

> +

> +       printf("\t%s()\n", __func__);

> +

> +       ddf_ifs_driver = odpdrv_driver_register(&param);

> +       if (ODPDRV_DRIVER_INVALID == ddf_ifs_driver) {

> +               printf("Error: Failed to %s()\n", __func__);

> +               return -1;

> +       }

> +

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_driver.h b/example/ddf_ifs/ddf_ifs_

> driver.h

> new file mode 100644

> index 0000000..e990c34

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_driver.h

> @@ -0,0 +1,20 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_DRIVER_H_

> +#define _ODP_DDF_IFS_DRIVER_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +int register_driver(void);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_DRIVER_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_class.c

> b/example/ddf_ifs/ddf_ifs_enumr_class.c

> new file mode 100644

> index 0000000..8450dee

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_class.c

> @@ -0,0 +1,47 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_enumr_class.h"

> +#include "ddf_ifs_enumr_dpdk.h"

> +#include "ddf_ifs_enumr_generic.h"

> +

> +static odpdrv_enumr_class_t enumr_class;

> +

> +static int enumr_class_ifs_probe(void)

> +{

> +       printf("%s()\n", __func__);

> +

> +       if (register_enumerator_dpdk(enumr_class))

> +               return -1;

> +

> +       if (register_enumerator_generic(enumr_class))

> +               return -1;

> +

> +       return 0;

> +}

> +

> +static int enumr_class_ifs_remove(void)

> +{

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +int register_enumerator_class(void)

> +{

> +       odpdrv_enumr_class_param_t param = {

> +               .name = "enumr_class_ifs",

> +               .probe = enumr_class_ifs_probe,

> +               .remove = enumr_class_ifs_remove

> +               };

> +

> +       printf("\t%s()\n", __func__);

> +       enumr_class = odpdrv_enumr_class_register(&param);

> +

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_class.h

> b/example/ddf_ifs/ddf_ifs_enumr_class.h

> new file mode 100644

> index 0000000..a3cb037

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_class.h

> @@ -0,0 +1,20 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_ENUMR_CLASS_H_

> +#define _ODP_DDF_IFS_ENUMR_CLASS_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +int register_enumerator_class(void);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_ENUMR_CLASS_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_dpdk.c

> b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c

> new file mode 100644

> index 0000000..782f7b7

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c

> @@ -0,0 +1,86 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_api.h"

> +#include "ddf_ifs_enumr_dpdk.h"

> +#include "ddf_ifs_dev_dpdk.h"

> +

> +static odpdrv_enumr_t dpdk_enumr;

> +

> +#define TEST_DPDK_DEV_CNT 3

> +#define DDF_DPDK_DEV_MAX 10

> +

> +static odpdrv_device_t dpdk_dev[DDF_DPDK_DEV_MAX];

> +static int dpdk_dev_cnt;

> +static int dpdk_enumr_probe(void)

> +{

> +       int dpdk_dev_cnt_detected = TEST_DPDK_DEV_CNT; /* detected with

> +                                                         dpdk APIs*/

> +       char dev_addr[ODPDRV_NAME_ADDR_SZ];

> +       int i;

> +

> +       printf("%s() - %d devices found\n", __func__,

> dpdk_dev_cnt_detected);

> +

> +       if (dpdk_dev_cnt_detected > DDF_DPDK_DEV_MAX) {

> +               dpdk_dev_cnt_detected = DDF_DPDK_DEV_MAX;

> +               printf("\tWarning: dpdk device count scaled down to %d\n",

> +                      dpdk_dev_cnt_detected);

> +       }

> +       for (i = 0; i < dpdk_dev_cnt_detected; i++) {

> +               sprintf(dev_addr, "0000:01:00.%d", i);

> +               dpdk_dev[dpdk_dev_cnt] = dpdk_device_create(dpdk_enumr,

> +                                                           dev_addr,

> +                                                           NULL);

> +               if (dpdk_dev[dpdk_dev_cnt] == ODPDRV_DEVICE_INVALID)

> +                       printf("\tError: unable to create device: %s\n",

> +                              dev_addr);

> +               else

> +                       dpdk_dev_cnt++;

> +       }

> +

> +       return 0;

> +}

> +

> +static int dpdk_enumr_remove(void)

> +{

> +       printf("%s()\n", __func__);

> +       return 0;

> +}

> +

> +static int dpdk_enumr_register_notif(void (*event_handler) (uint64_t

> event),

> +                                    int64_t event_mask)

> +{

> +       (void)event_handler;

> +       (void)event_mask;

> +

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +int register_enumerator_dpdk(odpdrv_enumr_class_t enumr_class)

> +{

> +       struct odpdrv_enumr_param_t param = {

> +               .enumr_class = enumr_class,

> +               .api_name = DDF_IFS_DEV_API_NAME,

> +               .api_version = DDF_IFS_DEV_API_VER,

> +               .probe = dpdk_enumr_probe,

> +               .remove = dpdk_enumr_remove,

> +               .register_notifier = dpdk_enumr_register_notif

> +       };

> +

> +       printf("\t%s()\n", __func__);

> +

> +       dpdk_enumr = odpdrv_enumr_register(&param);

> +       if (ODPDRV_ENUMR_INVALID == dpdk_enumr) {

> +               printf("\tError: failed to register_enumerator_dpdk()\n");

> +               return -1;

> +       }

> +

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_dpdk.h

> b/example/ddf_ifs/ddf_ifs_enumr_dpdk.h

> new file mode 100644

> index 0000000..e670d54

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_dpdk.h

> @@ -0,0 +1,20 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_ENUMR_DPDK_H_

> +#define _ODP_DDF_IFS_ENUMR_DPDK_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +int register_enumerator_dpdk(odpdrv_enumr_class_t enumr_class);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_ENUMR_DPDK_H_*/

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_generic.c

> b/example/ddf_ifs/ddf_ifs_enumr_generic.c

> new file mode 100644

> index 0000000..f5e1a2c

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_generic.c

> @@ -0,0 +1,57 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#include <stdio.h>

> +#include "odp_drv.h"

> +#include "ddf_ifs_api.h"

> +#include "ddf_ifs_enumr_generic.h"

> +

> +static odpdrv_enumr_t gen_enumr;

> +

> +static int gen_enumr_probe(void)

> +{

> +       printf("%s() - no devices found\n", __func__);

> +       return 0;

> +}

> +

> +static int gen_enumr_remove(void)

> +{

> +       printf("%s()\n", __func__);

> +       return 0;

> +}

> +

> +static int gen_enumr_register_notif(void (*event_handler) (uint64_t

> event),

> +                                   int64_t event_mask)

> +{

> +       (void)event_handler;

> +       (void)event_mask;

> +

> +       printf("%s()\n", __func__);

> +

> +       return 0;

> +}

> +

> +int register_enumerator_generic(odpdrv_enumr_class_t enumr_class)

> +{

> +       struct odpdrv_enumr_param_t param = {

> +               .enumr_class = enumr_class,

> +               .api_name = DDF_IFS_DEV_API_NAME,

> +               .api_version = DDF_IFS_DEV_API_VER,

> +               .probe = gen_enumr_probe,

> +               .remove = gen_enumr_remove,

> +               .register_notifier = gen_enumr_register_notif

> +       };

> +

> +       printf("\t%s()\n", __func__);

> +

> +       gen_enumr = odpdrv_enumr_register(&param);

> +       if (ODPDRV_ENUMR_INVALID == gen_enumr) {

> +               printf("\tError:failed to %s()\n", __func__);

> +               return -1;

> +       }

> +

> +       return 0;

> +}

> diff --git a/example/ddf_ifs/ddf_ifs_enumr_generic.h

> b/example/ddf_ifs/ddf_ifs_enumr_generic.h

> new file mode 100644

> index 0000000..0eeb073

> --- /dev/null

> +++ b/example/ddf_ifs/ddf_ifs_enumr_generic.h

> @@ -0,0 +1,20 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +#ifndef _ODP_DDF_IFS_ENUMR_GENERIC_H_

> +#define _ODP_DDF_IFS_ENUMR_GENERIC_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +int register_enumerator_generic(odpdrv_enumr_class_t enumr_class);

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif /*_ODP_DDF_IFS_ENUMR_GENERIC_H_*/

> diff --git a/example/ddf_ifs/odp.conf b/example/ddf_ifs/odp.conf

> new file mode 100644

> index 0000000..14968a7

> --- /dev/null

> +++ b/example/ddf_ifs/odp.conf

> @@ -0,0 +1,4 @@

> +module:

> +{

> +       modules = ("libddf_ifs.so.0");

> +};

> diff --git a/example/m4/configure.m4 b/example/m4/configure.m4

> index 620db04..9e7973b 100644

> --- a/example/m4/configure.m4

> +++ b/example/m4/configure.m4

> @@ -21,4 +21,6 @@ AC_CONFIG_FILES([example/classifier/Makefile

>                  example/time/Makefile

>                  example/timer/Makefile

>                  example/traffic_mgmt/Makefile

> +                example/ddf_ifs/Makefile

> +                example/ddf_app/Makefile

>                  example/Makefile])

> --

> 1.9.1

>

>
diff mbox

Patch

diff --git a/example/Makefile.am b/example/Makefile.am
index dfc07b6..b209585 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -8,4 +8,6 @@  SUBDIRS = classifier \
 	  switch \
 	  time \
 	  timer \
-	  traffic_mgmt
+	  traffic_mgmt \
+	  ddf_ifs \
+	  ddf_app
diff --git a/example/ddf_app/Makefile.am b/example/ddf_app/Makefile.am
new file mode 100644
index 0000000..e654202
--- /dev/null
+++ b/example/ddf_app/Makefile.am
@@ -0,0 +1,10 @@ 
+include $(top_srcdir)/example/Makefile.inc
+
+bin_PROGRAMS = odp_ddf_app$(EXEEXT)
+odp_ddf_app_LDFLAGS = $(AM_LDFLAGS) -shared
+odp_ddf_app_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+noinst_HEADERS = \
+		  $(top_srcdir)/example/example_debug.h
+
+dist_odp_ddf_app_SOURCES = odp_ddf_app.c
diff --git a/example/ddf_app/odp_ddf_app.c b/example/ddf_app/odp_ddf_app.c
new file mode 100644
index 0000000..af864ee
--- /dev/null
+++ b/example/ddf_app/odp_ddf_app.c
@@ -0,0 +1,49 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/** enable strtok */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <example_debug.h>
+#include <odp_api.h>
+#include <odp_drv.h>
+#include <odp/helper/odph_api.h>
+
+int main(int argc, char *argv[])
+{
+	odp_instance_t instance;
+
+	(void)argc;
+	(void)argv;
+
+	EXAMPLE_DBG("Start DDF Application...\n");
+
+	/* Initialize ODP before calling anything else */
+	if (odp_init_global(&instance, NULL, NULL)) {
+		EXAMPLE_ERR("Error: ODP global init failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_init_local(instance, ODP_THREAD_CONTROL)) {
+		EXAMPLE_ERR("Error: ODP local init failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	/* Print ddf objects*/
+	odpdrv_print_all();
+
+	/* Terminate ODP */
+	odp_term_local();
+	odp_term_global(instance);
+
+	EXAMPLE_DBG("Exit DDF Application.\n");
+	return 0;
+}
diff --git a/example/ddf_ifs/Makefile.am b/example/ddf_ifs/Makefile.am
new file mode 100644
index 0000000..aa892ac
--- /dev/null
+++ b/example/ddf_ifs/Makefile.am
@@ -0,0 +1,27 @@ 
+LIB   = $(top_builddir)/lib
+
+AM_CPPFLAGS +=  -I$(srcdir) \
+		-I$(top_srcdir)/include \
+		-I$(top_srcdir)/platform/@with_platform@/include \
+		-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@
+
+lib_LTLIBRARIES = $(LIB)/libddf_ifs.la
+
+noinst_HEADERS = \
+		 $(srcdir)/ddf_ifs.h \
+		 $(srcdir)/ddf_ifs_enumr_class.h \
+		 $(srcdir)/ddf_ifs_enumr_dpdk.h \
+		 $(srcdir)/ddf_ifs_enumr_generic.h \
+		 $(srcdir)/ddf_ifs_dev_dpdk.h \
+		 $(srcdir)/ddf_ifs_devio_direct.h \
+		 $(srcdir)/ddf_ifs_driver.h \
+		 $(srcdir)/ddf_ifs_api.h
+
+__LIB__libddf_ifs_la_SOURCES = \
+		ddf_ifs.c \
+		ddf_ifs_enumr_class.c \
+		ddf_ifs_enumr_dpdk.c \
+		ddf_ifs_enumr_generic.c \
+		ddf_ifs_dev_dpdk.c \
+		ddf_ifs_devio_direct.c \
+		ddf_ifs_driver.c
diff --git a/example/ddf_ifs/ddf_ifs.c b/example/ddf_ifs/ddf_ifs.c
new file mode 100644
index 0000000..fa2276f
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs.c
@@ -0,0 +1,28 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include "odp_drv.h"
+#include "ddf_ifs.h"
+#include "ddf_ifs_enumr_class.h"
+#include "ddf_ifs_devio_direct.h"
+#include "ddf_ifs_driver.h"
+
+static ODPDRV_CONSTRUCTOR void ddf_ifs_construct(void)
+{
+	printf("%s()\n", __func__);
+
+	register_enumerator_class();
+
+	register_devio_direct();
+
+	register_driver();
+}
+
+static __attribute__((destructor)) void ddf_ifs_destruct(void)
+{
+	printf("%s()\n", __func__);
+}
diff --git a/example/ddf_ifs/ddf_ifs.h b/example/ddf_ifs/ddf_ifs.h
new file mode 100644
index 0000000..ff8bc27
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs.h
@@ -0,0 +1,18 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_H_
+#define _ODP_DDF_IFS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_api.h b/example/ddf_ifs/ddf_ifs_api.h
new file mode 100644
index 0000000..0d948ae
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_api.h
@@ -0,0 +1,25 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_API_H_
+#define _ODP_DDF_IFS_API_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DDF_IFS_DEV_API_NAME "ifs_api"
+#define DDF_IFS_DEV_API_VER 0
+#define DDF_IFS_DEVIO_API_NAME "devio_api"
+#define DDF_IFS_DEVIO_API_VER 0
+
+#define DDF_IFS_DRV_NAME "ddf_ifs_drv"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_API_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_dev_dpdk.c b/example/ddf_ifs/ddf_ifs_dev_dpdk.c
new file mode 100644
index 0000000..4d08e51
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_dev_dpdk.c
@@ -0,0 +1,25 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "odp_drv.h"
+#include "ddf_ifs_dev_dpdk.h"
+
+odpdrv_device_t dpdk_device_create(odpdrv_enumr_t enumr,
+				   const char *dev_addr,
+				   void *enum_data)
+{
+	odpdrv_device_param_t param;
+
+	printf("\t%s(%s)\n", __func__, dev_addr);
+
+	param.enumerator = enumr;
+	strcpy(param.address, dev_addr);
+	param.enum_dev = enum_data;
+
+	return odpdrv_device_create(&param);
+}
diff --git a/example/ddf_ifs/ddf_ifs_dev_dpdk.h b/example/ddf_ifs/ddf_ifs_dev_dpdk.h
new file mode 100644
index 0000000..84583a3
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_dev_dpdk.h
@@ -0,0 +1,24 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_DEV_DPDK_H_
+#define _ODP_DDF_IFS_DEV_DPDK_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "odp_drv.h"
+
+odpdrv_device_t dpdk_device_create(odpdrv_enumr_t enumr,
+				   const char *dev_addr,
+				   void *enum_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_DEV_DPDK_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_devio_direct.c b/example/ddf_ifs/ddf_ifs_devio_direct.c
new file mode 100644
index 0000000..ec451d6
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_devio_direct.c
@@ -0,0 +1,51 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include "odp_drv.h"
+#include "ddf_ifs_api.h"
+#include "ddf_ifs_devio_direct.h"
+
+static odpdrv_devio_t devio_direct;
+
+static int devio_direct_probe(odpdrv_device_t dev)
+{
+	(void)dev;
+
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+static int devio_direct_remove(void)
+{
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+int register_devio_direct(void)
+{
+	odpdrv_devio_param_t param = {
+		.api_name = DDF_IFS_DEVIO_API_NAME,
+		.api_version = DDF_IFS_DEVIO_API_VER,
+		.enumr_api_name = DDF_IFS_DEV_API_NAME,
+		.enumr_api_version = DDF_IFS_DEV_API_VER,
+		.probe = devio_direct_probe,
+		.remove = devio_direct_remove,
+		.ops = NULL
+		};
+
+	printf("\t%s()\n", __func__);
+
+	devio_direct = odpdrv_devio_register(&param);
+	if (ODPDRV_DEVIO_INVALID == devio_direct) {
+		printf("\tError: failed to %s()\n", __func__);
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/example/ddf_ifs/ddf_ifs_devio_direct.h b/example/ddf_ifs/ddf_ifs_devio_direct.h
new file mode 100644
index 0000000..9c00460
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_devio_direct.h
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_DEVIO_DIRECT_H_
+#define _ODP_DDF_IFS_DEVIO_DIRECT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int register_devio_direct(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_DEVIO_DIRECT_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_driver.c b/example/ddf_ifs/ddf_ifs_driver.c
new file mode 100644
index 0000000..53f9475
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_driver.c
@@ -0,0 +1,69 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "odp_drv.h"
+#include "ddf_ifs_api.h"
+#include "ddf_ifs_driver.h"
+
+static odpdrv_driver_t ddf_ifs_driver;
+static int drv_data = 12;
+
+static int ddf_ifs_driver_probe(odpdrv_device_t dev, odpdrv_devio_t devio,
+				int devio_idx)
+{
+	printf("%s(dev, devio, devio_idx = %d)\n", __func__, devio_idx);
+
+	(void)devio;
+
+	odpdrv_device_set_data(dev, (void *)&drv_data);
+
+	return 0;
+}
+
+static int ddf_ifs_driver_unbind(odpdrv_device_t dev,
+				 void (*callback)(odpdrv_device_t dev),
+				 uint32_t flags)
+{
+	printf("%s()\n", __func__);
+
+	if (!(flags & ODPDRV_DRV_UNBIND_IMMEDIATE))
+		return -1; /* unsupported*/
+
+	callback(dev);
+
+	return 0;
+}
+
+static int ddf_ifs_driver_remove(void)
+{
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+int register_driver(void)
+{
+	odpdrv_driver_param_t param = {
+		.name = DDF_IFS_DRV_NAME,
+		.devios = {{DDF_IFS_DEVIO_API_NAME, DDF_IFS_DEVIO_API_VER},
+				   {"", 0}, {"", 0} },
+		.probe = ddf_ifs_driver_probe,
+		.unbind = ddf_ifs_driver_unbind,
+		.remove = ddf_ifs_driver_remove,
+		};
+
+	printf("\t%s()\n", __func__);
+
+	ddf_ifs_driver = odpdrv_driver_register(&param);
+	if (ODPDRV_DRIVER_INVALID == ddf_ifs_driver) {
+		printf("Error: Failed to %s()\n", __func__);
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/example/ddf_ifs/ddf_ifs_driver.h b/example/ddf_ifs/ddf_ifs_driver.h
new file mode 100644
index 0000000..e990c34
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_driver.h
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_DRIVER_H_
+#define _ODP_DDF_IFS_DRIVER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int register_driver(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_DRIVER_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_enumr_class.c b/example/ddf_ifs/ddf_ifs_enumr_class.c
new file mode 100644
index 0000000..8450dee
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_class.c
@@ -0,0 +1,47 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include "odp_drv.h"
+#include "ddf_ifs_enumr_class.h"
+#include "ddf_ifs_enumr_dpdk.h"
+#include "ddf_ifs_enumr_generic.h"
+
+static odpdrv_enumr_class_t enumr_class;
+
+static int enumr_class_ifs_probe(void)
+{
+	printf("%s()\n", __func__);
+
+	if (register_enumerator_dpdk(enumr_class))
+		return -1;
+
+	if (register_enumerator_generic(enumr_class))
+		return -1;
+
+	return 0;
+}
+
+static int enumr_class_ifs_remove(void)
+{
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+int register_enumerator_class(void)
+{
+	odpdrv_enumr_class_param_t param = {
+		.name = "enumr_class_ifs",
+		.probe = enumr_class_ifs_probe,
+		.remove = enumr_class_ifs_remove
+		};
+
+	printf("\t%s()\n", __func__);
+	enumr_class = odpdrv_enumr_class_register(&param);
+
+	return 0;
+}
diff --git a/example/ddf_ifs/ddf_ifs_enumr_class.h b/example/ddf_ifs/ddf_ifs_enumr_class.h
new file mode 100644
index 0000000..a3cb037
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_class.h
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_ENUMR_CLASS_H_
+#define _ODP_DDF_IFS_ENUMR_CLASS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int register_enumerator_class(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_ENUMR_CLASS_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_enumr_dpdk.c b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c
new file mode 100644
index 0000000..782f7b7
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c
@@ -0,0 +1,86 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include "odp_drv.h"
+#include "ddf_ifs_api.h"
+#include "ddf_ifs_enumr_dpdk.h"
+#include "ddf_ifs_dev_dpdk.h"
+
+static odpdrv_enumr_t dpdk_enumr;
+
+#define TEST_DPDK_DEV_CNT 3
+#define DDF_DPDK_DEV_MAX 10
+
+static odpdrv_device_t dpdk_dev[DDF_DPDK_DEV_MAX];
+static int dpdk_dev_cnt;
+static int dpdk_enumr_probe(void)
+{
+	int dpdk_dev_cnt_detected = TEST_DPDK_DEV_CNT; /* detected with
+							  dpdk APIs*/
+	char dev_addr[ODPDRV_NAME_ADDR_SZ];
+	int i;
+
+	printf("%s() - %d devices found\n", __func__, dpdk_dev_cnt_detected);
+
+	if (dpdk_dev_cnt_detected > DDF_DPDK_DEV_MAX) {
+		dpdk_dev_cnt_detected = DDF_DPDK_DEV_MAX;
+		printf("\tWarning: dpdk device count scaled down to %d\n",
+		       dpdk_dev_cnt_detected);
+	}
+	for (i = 0; i < dpdk_dev_cnt_detected; i++) {
+		sprintf(dev_addr, "0000:01:00.%d", i);
+		dpdk_dev[dpdk_dev_cnt] = dpdk_device_create(dpdk_enumr,
+							    dev_addr,
+							    NULL);
+		if (dpdk_dev[dpdk_dev_cnt] == ODPDRV_DEVICE_INVALID)
+			printf("\tError: unable to create device: %s\n",
+			       dev_addr);
+		else
+			dpdk_dev_cnt++;
+	}
+
+	return 0;
+}
+
+static int dpdk_enumr_remove(void)
+{
+	printf("%s()\n", __func__);
+	return 0;
+}
+
+static int dpdk_enumr_register_notif(void (*event_handler) (uint64_t event),
+				     int64_t event_mask)
+{
+	(void)event_handler;
+	(void)event_mask;
+
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+int register_enumerator_dpdk(odpdrv_enumr_class_t enumr_class)
+{
+	struct odpdrv_enumr_param_t param = {
+		.enumr_class = enumr_class,
+		.api_name = DDF_IFS_DEV_API_NAME,
+		.api_version = DDF_IFS_DEV_API_VER,
+		.probe = dpdk_enumr_probe,
+		.remove = dpdk_enumr_remove,
+		.register_notifier = dpdk_enumr_register_notif
+	};
+
+	printf("\t%s()\n", __func__);
+
+	dpdk_enumr = odpdrv_enumr_register(&param);
+	if (ODPDRV_ENUMR_INVALID == dpdk_enumr) {
+		printf("\tError: failed to register_enumerator_dpdk()\n");
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/example/ddf_ifs/ddf_ifs_enumr_dpdk.h b/example/ddf_ifs/ddf_ifs_enumr_dpdk.h
new file mode 100644
index 0000000..e670d54
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_dpdk.h
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_ENUMR_DPDK_H_
+#define _ODP_DDF_IFS_ENUMR_DPDK_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int register_enumerator_dpdk(odpdrv_enumr_class_t enumr_class);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_ENUMR_DPDK_H_*/
diff --git a/example/ddf_ifs/ddf_ifs_enumr_generic.c b/example/ddf_ifs/ddf_ifs_enumr_generic.c
new file mode 100644
index 0000000..f5e1a2c
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_generic.c
@@ -0,0 +1,57 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include "odp_drv.h"
+#include "ddf_ifs_api.h"
+#include "ddf_ifs_enumr_generic.h"
+
+static odpdrv_enumr_t gen_enumr;
+
+static int gen_enumr_probe(void)
+{
+	printf("%s() - no devices found\n", __func__);
+	return 0;
+}
+
+static int gen_enumr_remove(void)
+{
+	printf("%s()\n", __func__);
+	return 0;
+}
+
+static int gen_enumr_register_notif(void (*event_handler) (uint64_t event),
+				    int64_t event_mask)
+{
+	(void)event_handler;
+	(void)event_mask;
+
+	printf("%s()\n", __func__);
+
+	return 0;
+}
+
+int register_enumerator_generic(odpdrv_enumr_class_t enumr_class)
+{
+	struct odpdrv_enumr_param_t param = {
+		.enumr_class = enumr_class,
+		.api_name = DDF_IFS_DEV_API_NAME,
+		.api_version = DDF_IFS_DEV_API_VER,
+		.probe = gen_enumr_probe,
+		.remove = gen_enumr_remove,
+		.register_notifier = gen_enumr_register_notif
+	};
+
+	printf("\t%s()\n", __func__);
+
+	gen_enumr = odpdrv_enumr_register(&param);
+	if (ODPDRV_ENUMR_INVALID == gen_enumr) {
+		printf("\tError:failed to %s()\n", __func__);
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/example/ddf_ifs/ddf_ifs_enumr_generic.h b/example/ddf_ifs/ddf_ifs_enumr_generic.h
new file mode 100644
index 0000000..0eeb073
--- /dev/null
+++ b/example/ddf_ifs/ddf_ifs_enumr_generic.h
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_DDF_IFS_ENUMR_GENERIC_H_
+#define _ODP_DDF_IFS_ENUMR_GENERIC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int register_enumerator_generic(odpdrv_enumr_class_t enumr_class);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_ODP_DDF_IFS_ENUMR_GENERIC_H_*/
diff --git a/example/ddf_ifs/odp.conf b/example/ddf_ifs/odp.conf
new file mode 100644
index 0000000..14968a7
--- /dev/null
+++ b/example/ddf_ifs/odp.conf
@@ -0,0 +1,4 @@ 
+module:
+{
+	modules = ("libddf_ifs.so.0");
+};
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 620db04..9e7973b 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -21,4 +21,6 @@  AC_CONFIG_FILES([example/classifier/Makefile
 		 example/time/Makefile
 		 example/timer/Makefile
 		 example/traffic_mgmt/Makefile
+		 example/ddf_ifs/Makefile
+		 example/ddf_app/Makefile
 		 example/Makefile])