Commit 979594c5 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dev_addr-const'



Jakub Kicinski says:

====================
net: constify netdev->dev_addr

Take care of a few stragglers and make netdev->dev_addr const.

netdev->dev_addr can be held on the address tree like any other
address now.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1388d4ad 2c193f2c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, const u8 *addr,
					u8 vf_qid, bool set) {return 0; }
static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
					struct bnx2x_config_rss_params *params) {return 0; }
+2 −1
Original line number Diff line number Diff line
@@ -1178,7 +1178,8 @@ static struct net_device * __init i82596_probe(void)
	DEB(DEB_PROBE,printk(KERN_INFO "%s: 82596 at %#3lx,", dev->name, dev->base_addr));

	for (i = 0; i < 6; i++)
		DEB(DEB_PROBE,printk(" %2.2X", dev->dev_addr[i] = eth_addr[i]));
		DEB(DEB_PROBE,printk(" %2.2X", eth_addr[i]));
	eth_hw_addr_set(dev, eth_addr);

	DEB(DEB_PROBE,printk(" IRQ %d.\n", dev->irq));

+10 −9
Original line number Diff line number Diff line
@@ -1942,6 +1942,8 @@ enum netdev_ml_priv_type {
 *	@unlink_list:	As netif_addr_lock() can be called recursively,
 *			keep a list of interfaces to be deleted.
 *
 *	@dev_addr_shadow:	Copy of @dev_addr to catch direct writes.
 *
 *	FIXME: cleanup struct net_device such that network protocol info
 *	moves out.
 */
@@ -2117,7 +2119,7 @@ struct net_device {
 * Cache lines mostly used on receive path (including eth_type_trans())
 */
	/* Interface address info used in eth_type_trans() */
	unsigned char		*dev_addr;
	const unsigned char	*dev_addr;

	struct netdev_rx_queue	*_rx;
	unsigned int		num_rx_queues;
@@ -2268,6 +2270,8 @@ struct net_device {

	/* protected by rtnl_lock */
	struct bpf_xdp_entity	xdp_state[__MAX_XDP_MODE];

	u8 dev_addr_shadow[MAX_ADDR_LEN];
};
#define to_net_dev(d) container_of(d, struct net_device, dev)

@@ -4268,10 +4272,13 @@ void __hw_addr_unsync_dev(struct netdev_hw_addr_list *list,
void __hw_addr_init(struct netdev_hw_addr_list *list);

/* Functions used for device addresses handling */
void dev_addr_mod(struct net_device *dev, unsigned int offset,
		  const void *addr, size_t len);

static inline void
__dev_addr_set(struct net_device *dev, const void *addr, size_t len)
{
	memcpy(dev->dev_addr, addr, len);
	dev_addr_mod(dev, 0, addr, len);
}

static inline void dev_addr_set(struct net_device *dev, const u8 *addr)
@@ -4279,19 +4286,13 @@ static inline void dev_addr_set(struct net_device *dev, const u8 *addr)
	__dev_addr_set(dev, addr, dev->addr_len);
}

static inline void
dev_addr_mod(struct net_device *dev, unsigned int offset,
	     const void *addr, size_t len)
{
	memcpy(&dev->dev_addr[offset], addr, len);
}

int dev_addr_add(struct net_device *dev, const unsigned char *addr,
		 unsigned char addr_type);
int dev_addr_del(struct net_device *dev, const unsigned char *addr,
		 unsigned char addr_type);
void dev_addr_flush(struct net_device *dev);
int dev_addr_init(struct net_device *dev);
void dev_addr_check(struct net_device *dev);

/* Functions used for unicast addresses handling */
int dev_uc_add(struct net_device *dev, const unsigned char *addr);
+5 −0
Original line number Diff line number Diff line
@@ -455,4 +455,9 @@ config ETHTOOL_NETLINK
	  netlink. It provides better extensibility and some new features,
	  e.g. notification messages.

config NETDEV_ADDR_LIST_TEST
	tristate "Unit tests for device address list"
	default KUNIT_ALL_TESTS
	depends on KUNIT

endif   # if NET
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ obj-y += dev.o dev_addr_lists.o dst.o netevent.o \
			sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \
			fib_notifier.o xdp.o flow_offload.o gro.o

obj-$(CONFIG_NETDEV_ADDR_LIST_TEST) += dev_addr_lists_test.o

obj-y += net-sysfs.o
obj-$(CONFIG_PAGE_POOL) += page_pool.o
obj-$(CONFIG_PROC_FS) += net-procfs.o
Loading