[dpdk-dev] [PATCH 1/2] lib: move Netlink code into a common library

Bruce Richardson bruce.richardson at intel.com
Tue Mar 13 14:58:28 CET 2018


On Tue, Mar 13, 2018 at 01:28:26PM +0100, Nelio Laranjeiro wrote:
> Moves TAP PMD generic Netlink library into lib directory to let other PMD
> use Netlink to communicate with kernel.
> 
> As this library uses a socket to communicate with Netlink it does not bring
> any dependency on the libnl.
> 
> Cc: Pascal Mazon <pascal.mazon at 6wind.com>
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
> ---
>  MAINTAINERS                                        |   3 +
>  config/common_base                                 |   6 ++
>  config/common_linuxapp                             |   1 +
>  drivers/net/tap/Makefile                           |   3 +-
>  drivers/net/tap/rte_eth_tap.c                      |  16 +--
>  drivers/net/tap/tap_flow.c                         | 118 ++++++++++-----------
>  drivers/net/tap/tap_netlink.h                      |  42 --------
>  drivers/net/tap/tap_tcmsgs.c                       |  28 ++---
>  drivers/net/tap/tap_tcmsgs.h                       |   2 +-
>  lib/Makefile                                       |   2 +
>  lib/librte_netlink/Makefile                        |  26 +++++
>  lib/librte_netlink/meson.build                     |  13 +++
>  .../librte_netlink/rte_netlink.c                   |  42 ++++----
>  lib/librte_netlink/rte_netlink.h                   |  42 ++++++++
>  lib/librte_netlink/rte_netlink_version.map         |  17 +++
>  lib/meson.build                                    |   2 +-
>  mk/rte.app.mk                                      |   1 +
>  17 files changed, 216 insertions(+), 148 deletions(-)
>  delete mode 100644 drivers/net/tap/tap_netlink.h
>  create mode 100644 lib/librte_netlink/Makefile
>  create mode 100644 lib/librte_netlink/meson.build
>  rename drivers/net/tap/tap_netlink.c => lib/librte_netlink/rte_netlink.c (88%)
>  create mode 100644 lib/librte_netlink/rte_netlink.h
>  create mode 100644 lib/librte_netlink/rte_netlink_version.map
>

<snip>

> diff --git a/lib/librte_netlink/meson.build b/lib/librte_netlink/meson.build
> new file mode 100644
> index 000000000..77592c7d4
> --- /dev/null
> +++ b/lib/librte_netlink/meson.build
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018 6WIND S.A.
> +# Copyright 2018 Mellanox Technologies, Ltd.
> +
> +
> +name = 'netlink'
> +version = 1

Not a big issue, but the above two lines are unnecessary, and can be
omitted. I'd rather than the name of the lib *not* be explicitly called
out, to prevent the temptation of giving the library a different name to
the name of the directory it is in.

> +allow_experimental_apis = true
> +sources = files('rte_netlink.c',)
> +
> +headers = files('rte_netlink.h')
> +
> +deps += ['net']

<snip>

> diff --git a/lib/meson.build b/lib/meson.build
> index ef6159170..873a39785 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -23,7 +23,7 @@ libraries = [ 'compat', # just a header, used for versioning
>  	# add pkt framework libs which use other libs from above
>  	'port', 'table', 'pipeline',
>  	# flow_classify lib depends on pkt framework table lib
> -	'flow_classify']
> +	'flow_classify', 'netlink']

Given that this doesn't depend on anything apart from the core libs,
I think it should be placed earlier in the list, where the majority of
the libs are in alphabetical order. [Yes, I should have put a comment
just before the "acl" lib entry calling out the fact that it was meant
to be an alphabetical list - I forgot, sorry! :-)]

/Bruce


More information about the dev mailing list