From 59513c3e137b21d6dbebb289c7be58f3a3dbe9ee Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Mon, 1 Jun 2020 05:50:46 +0000 Subject: [PATCH] common/mlx5: move netlink files under Linux directory File mlx5_nl.c is using Netlink APIs which are Linux specifics. Move it (including file mlx5_nl.h) to common/mlx5/linux directory. Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/common/mlx5/Makefile | 2 +- drivers/common/mlx5/linux/meson.build | 1 + drivers/common/mlx5/{ => linux}/mlx5_nl.c | 27 +++++++++++++---------- drivers/common/mlx5/{ => linux}/mlx5_nl.h | 0 drivers/common/mlx5/meson.build | 1 - 5 files changed, 17 insertions(+), 14 deletions(-) rename drivers/common/mlx5/{ => linux}/mlx5_nl.c (98%) rename drivers/common/mlx5/{ => linux}/mlx5_nl.h (100%) diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile index 19b1466b52..40bf2a51e5 100644 --- a/drivers/common/mlx5/Makefile +++ b/drivers/common/mlx5/Makefile @@ -16,7 +16,7 @@ SRCS-y += linux/mlx5_glue.c endif SRCS-y += mlx5_devx_cmds.c SRCS-y += mlx5_common.c -SRCS-y += mlx5_nl.c +SRCS-y += linux/mlx5_nl.c SRCS-y += mlx5_common_mp.c SRCS-y += mlx5_common_mr.c ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index a123fd6027..04f7e03d16 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -45,6 +45,7 @@ if static_ibverbs ext_deps += declare_dependency(link_args:ibv_ldflags.split()) endif +sources += files('mlx5_nl.c') if not dlopen_ibverbs sources += files('mlx5_glue.c') endif diff --git a/drivers/common/mlx5/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c similarity index 98% rename from drivers/common/mlx5/mlx5_nl.c rename to drivers/common/mlx5/linux/mlx5_nl.c index 1a1033a40b..2943704e5e 100644 --- a/drivers/common/mlx5/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -429,9 +429,10 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) return -rte_errno; } #ifdef RTE_LIBRTE_MLX5_DEBUG - char m[18]; + char m[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, RTE_ETHER_ADDR_FMT_SIZE, + RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -557,15 +558,17 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx, goto error; return 0; error: - DRV_LOG(DEBUG, - "Interface %u cannot %s MAC address" - " %02X:%02X:%02X:%02X:%02X:%02X %s", - iface_idx, - add ? "add" : "remove", - mac->addr_bytes[0], mac->addr_bytes[1], - mac->addr_bytes[2], mac->addr_bytes[3], - mac->addr_bytes[4], mac->addr_bytes[5], - strerror(rte_errno)); +#ifdef RTE_LIBRTE_MLX5_DEBUG + { + char m[RTE_ETHER_ADDR_FMT_SIZE]; + + rte_ether_format_addr(m, RTE_ETHER_ADDR_FMT_SIZE, mac); + DRV_LOG(DEBUG, + "Interface %u cannot %s MAC address %s %s", + iface_idx, + add ? "add" : "remove", m, strerror(rte_errno)); + } +#endif return -rte_errno; } @@ -1406,7 +1409,7 @@ mlx5_nl_vlan_vmwa_create(struct mlx5_nl_vlan_vmwa_context *vmwa, DRV_LOG(WARNING, "netlink: VLAN %s create failure (%d)", name, ret); } - // Try to get ifindex of created or pre-existing device. + /* Try to get ifindex of created or pre-existing device. */ ret = if_nametoindex(name); if (!ret) { DRV_LOG(WARNING, "VLAN %s failed to get index (%d)", name, diff --git a/drivers/common/mlx5/mlx5_nl.h b/drivers/common/mlx5/linux/mlx5_nl.h similarity index 100% rename from drivers/common/mlx5/mlx5_nl.h rename to drivers/common/mlx5/linux/mlx5_nl.h diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index 9806865b91..0a8980f2d3 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -13,7 +13,6 @@ deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] sources += files( 'mlx5_devx_cmds.c', 'mlx5_common.c', - 'mlx5_nl.c', 'mlx5_common_mp.c', 'mlx5_common_mr.c', ) -- 2.20.1