Repository : ssh://git@diktynna/batman-adv
On branches: ecsv/lm_master,master
commit 0b0f6f99ea3cdb8af1cbd0c40467486ea0e12b72 Author: Jakub Kicinski kuba@kernel.org Date: Thu Sep 2 11:10:37 2021 -0700
batman-adv: create netdev->dev_addr assignment helpers
Recent work on converting address list to a tree made it obvious we need an abstraction around writing netdev->dev_addr. Without such abstraction updating the main device address is invisible to the core.
Introduce a number of helpers which for now just wrap memcpy() but in the future can make necessary changes to the address tree.
Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: David S. Miller davem@davemloft.net [sven@narfation.org: convert to compat helper] Signed-off-by: Sven Eckelmann sven@narfation.org
0b0f6f99ea3cdb8af1cbd0c40467486ea0e12b72 compat-include/linux/etherdevice.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/compat-include/linux/etherdevice.h b/compat-include/linux/etherdevice.h new file mode 100644 index 00000000..f515c348 --- /dev/null +++ b/compat-include/linux/etherdevice.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This file contains macros for maintaining compatibility with older versions + * of the Linux kernel. + */ + +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_ + +#include <linux/version.h> +#include_next <linux/etherdevice.h> + +#if LINUX_VERSION_IS_LESS(5, 15, 0) + +static inline void batadv_eth_hw_addr_set(struct net_device *dev, + const u8 *addr) +{ + ether_addr_copy(dev->dev_addr, addr); +} +#define eth_hw_addr_set batadv_eth_hw_addr_set + +#endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */ + +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_ */