> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, July 4, 2017 5:13 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yi...@intel.com>; Stephen Hemminger
> <step...@networkplumber.org>; Richardson, Bruce
> <bruce.richard...@intel.com>; Burakov, Anatoly
> <anatoly.bura...@intel.com>
> Subject: [PATCH v10 10/20] unci: init netlink
> 
> Initialize netlink socket.
> 
> Userspace application will connect to the socket for data transfer.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>
> ---
>  .../linuxapp/eal/include/exec-env/unci.h           | 33 ++++++++++
>  lib/librte_eal/linuxapp/unci/Makefile              |  1 +
>  lib/librte_eal/linuxapp/unci/unci_dev.h            |  3 +
>  lib/librte_eal/linuxapp/unci/unci_net.c            |  7 +++
>  lib/librte_eal/linuxapp/unci/unci_nl.c             | 72
> ++++++++++++++++++++++
>  5 files changed, 116 insertions(+)
>  create mode 100644 lib/librte_eal/linuxapp/unci/unci_nl.c
> 
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/unci.h
> b/lib/librte_eal/linuxapp/eal/include/exec-env/unci.h
> index 8d4a95777..6d3490aee 100644
> --- a/lib/librte_eal/linuxapp/eal/include/exec-env/unci.h
> +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/unci.h
> @@ -60,6 +60,20 @@
> 
>  #define UNCI_DEVICE "unci"
> 
> +#define UNCI_GENL_MSG_LEN 1536
> +
> +#define UNCI_NL_MSG_LEN 500
> +struct unci_nl_msg {
> +     __u32 cmd_id;
> +     __u32 port_id;
> +     __u32 flag;
> +     __u8 input_buffer[UNCI_NL_MSG_LEN];
> +     __u8 output_buffer[UNCI_NL_MSG_LEN];
> +     size_t input_buffer_len;
> +     size_t output_buffer_len;
> +     int err;
> +};
> +
>  /* can go into include/uapi/linux/if_link.h */  enum {
>       IFLA_UNCI_UNSPEC,
> @@ -70,4 +84,23 @@ enum {
> 
>  #define IFLA_UNCI_MAX (__IFLA_UNCI_MAX - 1)
> 
> +
> +#define UNCI_GENL_VERSION 1
> +
> +enum {
> +     UNCI_ATTR_UNSPEC,
> +     UNCI_ATTR_MSG,
> +     __UNCI_ATTR_MAX,
> +};
> +
> +#define UNCI_ATTR_MAX (__UNCI_ATTR_MAX - 1)
> +
> +enum {
> +     UNCI_CMD_UNSPEC,
> +     UNCI_CMD_MSG,
> +     __UNCI_CMD_MAX,
> +};
> +
> +#define UNCI_CMD_MAX (__UNCI_CMD_MAX - 1)
> +
>  #endif /* _UAPI_LINUX_UNCI_H_ */
> diff --git a/lib/librte_eal/linuxapp/unci/Makefile
> b/lib/librte_eal/linuxapp/unci/Makefile
> index 02e354814..c2a81be7d 100644
> --- a/lib/librte_eal/linuxapp/unci/Makefile
> +++ b/lib/librte_eal/linuxapp/unci/Makefile
> @@ -48,5 +48,6 @@ MODULE_CFLAGS += -Wall -Werror  # all source are
> stored in SRCS-y  #
>  SRCS-$(CONFIG_RTE_UNCI_KMOD) := unci_net.c
> +SRCS-$(CONFIG_RTE_UNCI_KMOD) += unci_nl.c
> 
>  include $(RTE_SDK)/mk/rte.module.mk
> diff --git a/lib/librte_eal/linuxapp/unci/unci_dev.h
> b/lib/librte_eal/linuxapp/unci/unci_dev.h
> index 92b9b8383..a748abf98 100644
> --- a/lib/librte_eal/linuxapp/unci/unci_dev.h
> +++ b/lib/librte_eal/linuxapp/unci/unci_dev.h
> @@ -39,4 +39,7 @@ struct unci_dev {
>       __u32 pid;
>  };
> 
> +int unci_nl_init(void);
> +void unci_nl_release(void);
> +
>  #endif /* _UNCI_DEV_H_ */
> diff --git a/lib/librte_eal/linuxapp/unci/unci_net.c
> b/lib/librte_eal/linuxapp/unci/unci_net.c
> index 42fac3e63..1989b6d23 100644
> --- a/lib/librte_eal/linuxapp/unci/unci_net.c
> +++ b/lib/librte_eal/linuxapp/unci/unci_net.c
> @@ -74,6 +74,12 @@ static struct rtnl_link_ops unci_link_ops __read_mostly
> = {
> 
>  static int __init unci_init(void)
>  {
> +     int ret;
> +
> +     ret = unci_nl_init();
> +     if (ret)
> +             return ret;
> +
>       return rtnl_link_register(&unci_link_ops);
>  }
>  module_init(unci_init);
> @@ -81,6 +87,7 @@ module_init(unci_init);  static void __exit
> unci_exit(void)  {
>       rtnl_link_unregister(&unci_link_ops);
> +     unci_nl_release();
>  }
>  module_exit(unci_exit);
> 
> diff --git a/lib/librte_eal/linuxapp/unci/unci_nl.c
> b/lib/librte_eal/linuxapp/unci/unci_nl.c
> new file mode 100644
> index 000000000..1461a3309
> --- /dev/null
> +++ b/lib/librte_eal/linuxapp/unci/unci_nl.c
> @@ -0,0 +1,72 @@
> +/*-
> + * GPL LICENSE SUMMARY
> + *
> + *   Copyright(c) 2017 Intel Corporation. All rights reserved.
> + *
> + *   This program is free software; you can redistribute it and/or modify
> + *   it under the terms of version 2 of the GNU General Public License as
> + *   published by the Free Software Foundation.
> + *
> + *   This program is distributed in the hope that it will be useful, but
> + *   WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> GNU
> + *   General Public License for more details.
> + *
> + *   You should have received a copy of the GNU General Public License
> + *   along with this program;
> + *   The full GNU General Public License is included in this distribution
> + *   in the file called LICENSE.GPL.
> + *
> + *   Contact Information:
> + *   Intel Corporation
> + */

Again, GPL-only, but the module says it's dual BSD-GPL (and some files indeed 
are licensed under dual license).

Reply via email to