etherdevice: introduce broadcast_ether_addr
Subsystems (21)
Johannes Berg
maintainerPATCH 1/1 etherdevice: introduce broadcast_ether_addr
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce broadcast_ether_addr() to fill an address with all ones, making the code clearer and allowing us to get rid of the various constant arrays.
--- include/linux/etherdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/etherdevice.h +11 -0
@@ -138,6 +138,17 @@ static inline void random_ether_addr(u8 *addr) }/** +* broadcast_ether_addr - Assign broadcast address +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Assign the broadcast address to the given address array. +*/ +static inline void broadcast_ether_addr (u8 *addr) +{ +memset (addr,0xff ,ETH_ALEN ); +} + +/** * eth_hw_addr_random - Generate software assigned random Ethernet and * set device flag * @dev: pointer to net_device structure
Signature · 1 line
1.7.10
Quoted 9 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce
broadcast_ether_addr()to fill an address with all ones, making the code clearer and allowing us to get rid of the various constant arrays.
[]
include/linux/etherdevice.h
Quoted 1 line
include/linux/etherdevice.h +0
-0
[]
include/linux/etherdevice.h static inline void random_ether_addr(u8 *addr) · line 149
Quoted 4 lines
include/linux/etherdevice.h +4
-0+static inline void broadcast_ether_addr (u8 *addr) +{ +memset (addr,0xff ,ETH_ALEN ); +}
I think this sort of patch should come as the first patch in a series with some example conversions.
It might be too easy to confuse is_broadcast_ether_addr with this function name too. Maybe set_broadcast_ether_addr might be better.
I really don't see an issue with using memset though. Everyone already knows what that does.
Johannes Berg
maintainerQuoted 21 lines · Joe Perches
Quoted 9 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce
broadcast_ether_addr()to fill an address with all ones, making the code clearer and allowing us to get rid of the various constant arrays.[]
include/linux/etherdevice.h
Quoted 1 line
include/linux/etherdevice.h +0
-0[]
include/linux/etherdevice.h static inline void random_ether_addr(u8 *addr) · line 149
Quoted 4 lines
include/linux/etherdevice.h +4
-0+static inline void broadcast_ether_addr (u8 *addr) +{ +memset (addr,0xff ,ETH_ALEN ); +}I think this sort of patch should come as the first patch in a series with some example conversions.
Quoted 3 lines
It might be too easy to confuse
is_broadcast_ether_addrwith this function name too. Maybeset_broadcast_ether_addrmight be better.
Well, it's void so that'd be a compiler error :-)
Also, it's more like random_ether_addr()
johannes
A message that is not in the archive (sent off-list or not yet received): 1341310587.5131.2.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org
From: Johannes Berg <[email protected]>
Date: Tue, 03 Jul 2012 12:16:27 +0200
Quoted 11 lines
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce
broadcast_ether_addr()to fill an address with all ones, making the code clearer and allowing us to get rid of the various constant arrays.Signed-off-by Johannes Berg <[email protected]>
I would prefer if this were named "eth_something()", thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerPATCH 1/1 etherdevice: introduce eth_broadcast_addr
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce eth_broadcast_addr() to fill an address with all ones, making the code clearer and allowing us to get rid of some constant arrays.
--- include/linux/etherdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/etherdevice.h +11 -0
@@ -138,6 +138,17 @@ static inline void random_ether_addr(u8 *addr) }/** +* eth_broadcast_addr - Assign broadcast address +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Assign the broadcast address to the given address array. +*/ +static inline void eth_broadcast_addr (u8 *addr) +{ +memset (addr,0xff ,ETH_ALEN ); +} + +/** * eth_hw_addr_random - Generate software assigned random Ethernet and * set device flag * @dev: pointer to net_device structure
Signature · 1 line
1.7.10.4
Re: [PATCH] etherdevice: introduce eth_broadcast_addr
Quoted 4 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast
Shouldn't we see all that "lot of code" here in this same commit, now using this new shortcut? If we apply this, we have a new function, but with no users. If you have done the audit, and found the inefficient cases, why isn't it here?
I would think it better to just fix those people who have a pointless static array of all-ones to use the memset. If it was a multi line thing to achieve the eth_broadcast_addr() then it might make sense to exist. But as a one line alias, it does seem somewhat pointless to me.
Paul.
--
Quoted 40 lines
address. Introduce
eth_broadcast_addr()to fill an address with all ones, making the code clearer and allowing us to get rid of some constant arrays.Signed-off-by Johannes Berg <[email protected]>--- include/linux/etherdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+)include/linux/etherdevice.h +11
-1@@ -138,6 +138,17 @@ static inline void random_ether_addr(u8 *addr) }/** +* eth_broadcast_addr - Assign broadcast address +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Assign the broadcast address to the given address array. +*/ +static inline void eth_broadcast_addr (u8 *addr) +{ +memset (addr,0xff ,ETH_ALEN ); +} + +/** * eth_hw_addr_random - Generate software assigned random Ethernet and * set device flag * @dev: pointer to net_device structure -- 1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH] etherdevice: introduce eth_broadcast_addr
From: Paul Gortmaker <[email protected]>
Date: Tue, 10 Jul 2012 20:09:44 -0400
Quoted 9 lines
Quoted 4 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast
Shouldn't we see all that "lot of code" here in this same commit, now using this new shortcut?
I disagree and I intend to apply Johannes's patch as-is to net-next.
A message that is not in the archive (sent off-list or not yet received): 20120710.174142.995966539991957646.davem-fT/PcQaiUtIeIZ0/[email protected]
Re: [PATCH] etherdevice: introduce eth_broadcast_addr
Quoted 12 lines · David Miller
From: Paul Gortmaker <[email protected]>
Date: Tue, 10 Jul 2012 20:09:44 -0400Quoted 9 lines
Quoted 4 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast
Shouldn't we see all that "lot of code" here in this same commit, now using this new shortcut?
If I grepped properly, there are 42 instances of static arrays for for broadcast ethernet addresses in drivers/net and drivers/staging so it'd save some smallish amount of code by using a combination of is_broadcast_ether_addr and this new func.
I think there are 53 instances of the memset(foo, 0xff, 6|ETH_ALEN).
Quoted 1 line
I disagree and I intend to apply Johannes's patch as-is to net-next.
Sounds fine to me.
For some additional style symmetry, how about a conversion of random_ether_address to eth_random_addr too via
o Rename random_ether_addr to eth_random_addr and add a #define random_ether_addr eth_random_addr
o sed 's/\brandom_ether_addr\b/eth_random_addr/g' files_that_use_REA
o remove the #define after awhile
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
cover etherdevice: Rename random_ether_addr to eth_random_addr
net-next commit ad7eee98be ("etherdevice: introduce eth_broadcast_addr") added a new style API. Rename random_ether_addr to eth_random_addr to create some API symmetry.
Joe Perches (8):
etherdevice: Rename random_ether_addr to eth_random_addr
ethernet: Use eth_random_addr
net: usb: Use eth_random_addr
wireless: Use eth_random_addr
drivers/net: Use eth_random_addr
s390: Use eth_random_addr
usb: Use eth_random_addr
arch: Use eth_random_addr
arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/c6x/kernel/soc.c | 2 +- arch/mips/ar7/platform.c | 4 ++-- arch/mips/powertv/powertv_setup.c | 6 +++--- arch/um/drivers/net_kern.c | 2 +- drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +- drivers/net/ethernet/atheros/atlx/atl1.c | 2 +- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/lantiq_etop.c | 2 +- drivers/net/ethernet/micrel/ks8851.c | 2 +- drivers/net/ethernet/micrel/ks8851_mll.c | 2 +- drivers/net/ethernet/smsc/smsc911x.c | 2 +- drivers/net/ethernet/ti/cpsw.c | 2 +- drivers/net/ethernet/tile/tilegx.c | 2 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/usb/smsc75xx.c | 2 +- drivers/net/usb/smsc95xx.c | 2 +- drivers/net/usb/usbnet.c | 2 +- drivers/net/wimax/i2400m/driver.c | 2 +- drivers/net/wireless/adm8211.c | 2 +- drivers/net/wireless/p54/eeprom.c | 2 +- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2800lib.c | 2 +- drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- drivers/usb/atm/xusbatm.c | 4 ++-- drivers/usb/gadget/u_ether.c | 2 +- include/linux/etherdevice.h | 14 ++++++++------ 40 files changed, 52 insertions(+), 50 deletions(-)
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr
Quoted 6 lines · Joe Perches
net-next commit
ad7eee98be("etherdevice: introduceeth_broadcast_addr") added a new style API. Renamerandom_ether_addrtoeth_random_addrto create some API symmetry.Joe Perches (8):
etherdevice: Renamerandom_ether_addrtoeth_random_addr
if you're really renaming the function, then this patch alone will break all of the below users. That should all be a single patch, I'm afraid.
Quoted 58 lines
ethernet: Use
eth_random_addr
net: usb: Useeth_random_addr
wireless: Useeth_random_addr
drivers/net: Useeth_random_addr
s390: Useeth_random_addr
usb: Useeth_random_addr
arch: Useeth_random_addrarch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/c6x/kernel/soc.c | 2 +- arch/mips/ar7/platform.c | 4 ++-- arch/mips/powertv/powertv_setup.c | 6 +++--- arch/um/drivers/net_kern.c | 2 +- drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +- drivers/net/ethernet/atheros/atlx/atl1.c | 2 +- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/lantiq_etop.c | 2 +- drivers/net/ethernet/micrel/ks8851.c | 2 +- drivers/net/ethernet/micrel/ks8851_mll.c | 2 +- drivers/net/ethernet/smsc/smsc911x.c | 2 +- drivers/net/ethernet/ti/cpsw.c | 2 +- drivers/net/ethernet/tile/tilegx.c | 2 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/usb/smsc75xx.c | 2 +- drivers/net/usb/smsc95xx.c | 2 +- drivers/net/usb/usbnet.c | 2 +- drivers/net/wimax/i2400m/driver.c | 2 +- drivers/net/wireless/adm8211.c | 2 +- drivers/net/wireless/p54/eeprom.c | 2 +- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2800lib.c | 2 +- drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- drivers/usb/atm/xusbatm.c | 4 ++-- drivers/usb/gadget/u_ether.c | 2 +- include/linux/etherdevice.h | 14 ++++++++------ 40 files changed, 52 insertions(+), 50 deletions(-)Signature · 7 lines
1.7.8.111.gad25c.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
balbi
David Miller
maintainerRe: [PATCH net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr
From: Felipe Balbi <[email protected]>
Date: Mon, 16 Jul 2012 13:14:38 +0300
Quoted 2 lines
if you're really renaming the function, then this patch alone will break all of the below users. That should all be a single patch, I'm afraid.
It would help if you actually read his patches before saying what they might or might not do.
He provides a macro in the first patch that provides the old name, and this will get removed at the end.
Felipe Balbi
Acked-byRe: [PATCH net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr
Hi,
Quoted 11 lines · David Miller
From: Felipe Balbi <[email protected]>
Date: Mon, 16 Jul 2012 13:14:38 +0300Quoted 2 lines
if you're really renaming the function, then this patch alone will break all of the below users. That should all be a single patch, I'm afraid.
It would help if you actually read his patches before saying what they might or might not do.
He provides a macro in the first patch that provides the old name, and this will get removed at the end.
that's why I put an "if" there. The subject was misleading and I really couldn't bother going search for the patch on the mail archives.
Anyway, if nothing will be broken then for drivers/usb/gadget/:
Signature · 1 line
balbi
David Miller
maintainerRe: [PATCH net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr
From: Felipe Balbi <[email protected]>
Date: Mon, 16 Jul 2012 14:12:19 +0300
Quoted 1 line
Acked-by Felipe Balbi <[email protected]>
You need to provide this in a reply to the patch you actually want to ACK, so that the patch tracking system attaches your ACK to the proper patch.
Thank you.
David Miller
maintainerRe: [PATCH net-next 0/8] etherdevice: Rename random_ether_addr to eth_random_addr
In reply to Joe PerchesFrom: Joe Perches <[email protected]>
Date: Thu, 12 Jul 2012 22:33:04 -0700
Quoted 3 lines
net-next commit
ad7eee98be("etherdevice: introduceeth_broadcast_addr") added a new style API. Renamerandom_ether_addrtoeth_random_addrto create some API symmetry.
Series applied, thanks Joe.
PATCH 1/8 etherdevice: Rename random_ether_addr to eth_random_addr
In reply to Joe PerchesAdd some API symmetry to eth_broadcast_addr and add a #define to the old name for backward compatibility.
--- include/linux/etherdevice.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
include/linux/etherdevice.h +8 -6
@@ -124,19 +124,21 @@ static inline bool is_valid_ether_addr(const u8 *addr) }/** -* random_ether_addr - Generate software assigned random Ethernet address +* eth_random_addr - Generate software assigned random Ethernet address * @addr: Pointer to a six-byte array containing the Ethernet address * * Generate a random Ethernet address (MAC) that is not multicast * and has the local assigned bit set. */ -static inline void random_ether_addr (u8 *addr) +static inline void eth_random_addr (u8 *addr) { -get_random_bytes (addr,ETH_ALEN ); - addr [0 ] &=0xfe ;/* clear multicast bit */ - addr [0 ] |=0x02 ;/* set local assignment bit (IEEE802) */ +get_random_bytes (addr,ETH_ALEN ); + addr[0 ] &=0xfe ;/* clear multicast bit */ + addr[0 ] |=0x02 ;/* set local assignment bit (IEEE802) */ } +#define random_ether_addr (addr) eth_random_addr(addr) +/** * eth_broadcast_addr - Assign broadcast address * @addr: Pointer to a six-byte array containing the Ethernet address
@@ -160,7 +162,7 @@ static inline void eth_broadcast_addr(u8 *addr)static inline void eth_hw_addr_random (struct net_device *dev) { dev->addr_assign_type |=NET_ADDR_RANDOM ; -random_ether_addr (dev->dev_addr); +eth_random_addr (dev->dev_addr); }/**
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 2/8 ethernet: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +- drivers/net/ethernet/atheros/atlx/atl1.c | 2 +- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/lantiq_etop.c | 2 +- drivers/net/ethernet/micrel/ks8851.c | 2 +- drivers/net/ethernet/micrel/ks8851_mll.c | 2 +- drivers/net/ethernet/smsc/smsc911x.c | 2 +- drivers/net/ethernet/ti/cpsw.c | 2 +- drivers/net/ethernet/tile/tilegx.c | 2 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c_hw.c +1 -1
@@ -199,7 +199,7 @@ int atl1c_read_mac_addr(struct atl1c_hw *hw) err =atl1c_get_permanent_address (hw);if (err) -random_ether_addr (hw->perm_mac_addr); +eth_random_addr (hw->perm_mac_addr);memcpy (hw->mac_addr, hw->perm_mac_addr,sizeof (hw->perm_mac_addr));return err;
drivers/net/ethernet/atheros/atlx/atl1.c +1 -1
@@ -538,7 +538,7 @@ static s32 atl1_read_mac_addr(struct atl1_hw *hw)u16 i;if (atl1_get_permanent_address (hw)) { -random_ether_addr (hw->perm_mac_addr); +eth_random_addr (hw->perm_mac_addr); ret =1 ; }
drivers/net/ethernet/atheros/atlx/atl2.c +1 -1
@@ -2346,7 +2346,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw) {if (get_permanent_address (hw)) {/* for test */ -/* FIXME: shouldn't we use random_ether_addr() here? */ +/* FIXME: shouldn't we use eth_random_addr() here? */ hw->perm_mac_addr[0 ] =0x00 ; hw->perm_mac_addr[1 ] =0x13 ; hw->perm_mac_addr[2 ] =0x74 ;
drivers/net/ethernet/ethoc.c +1 -1
@@ -1057,7 +1057,7 @@ static int __devinit ethoc_probe(struct platform_device *pdev)/* Check the MAC again for validity, if it still isn't choose and * program a random one. */ if (!is_valid_ether_addr (netdev->dev_addr)) { -random_ether_addr (netdev->dev_addr); +eth_random_addr (netdev->dev_addr); random_mac = true; }
drivers/net/ethernet/intel/igb/igb_main.c +2 -2
@@ -5008,7 +5008,7 @@ static int igb_vf_configure(struct igb_adapter *adapter, int vf)unsigned int device_id;u16 thisvf_devfn; -random_ether_addr (mac_addr); +eth_random_addr (mac_addr);igb_set_vf_mac (adapter, vf, mac_addr);switch (adapter->hw.mac.type) {
@@ -5417,7 +5417,7 @@ static void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf)/* generate a new mac address as we were hotplug removed/added */ if (!(adapter->vf_data[vf].flags &IGB_VF_FLAG_PF_SET_MAC )) -random_ether_addr (vf_mac); +eth_random_addr (vf_mac);/* process remaining reset events */ igb_vf_reset (adapter, vf);
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -1
@@ -467,7 +467,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)bool enable = ((event_mask &0x10000000U ) !=0 );if (enable) { -random_ether_addr (vf_mac_addr); +eth_random_addr (vf_mac_addr);e_info (probe,"IOV: VF %d is enabled MAC %pM\n" , vfn, vf_mac_addr);/*
drivers/net/ethernet/lantiq_etop.c +1 -1
@@ -645,7 +645,7 @@ ltq_etop_init(struct net_device *dev)memcpy (&mac, &priv->pldata->mac,sizeof (struct sockaddr ));if (!is_valid_ether_addr (mac.sa_data)) {pr_warn ("etop: invalid MAC, using random\n" ); -random_ether_addr (mac.sa_data); +eth_random_addr (mac.sa_data); random_mac = true; }
drivers/net/ethernet/micrel/ks8851.c +1 -1
@@ -422,7 +422,7 @@ static void ks8851_read_mac_addr(struct net_device *dev)* * Get or create the initial mac address for the device and then set that * into the station address register. If there is an EEPROM present, then -* we try that. If no valid mac address is found we use random_ether_addr() +* we try that. If no valid mac address is found we use eth_random_addr() * to create a new one. */ static void ks8851_init_mac (struct ks8851_net *ks)
drivers/net/ethernet/micrel/ks8851_mll.c +1 -1
@@ -1609,7 +1609,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)memcpy (ks->mac_addr, pdata->mac_addr,6 );if (!is_valid_ether_addr (ks->mac_addr)) {/* Use random MAC address if none passed */ -random_ether_addr (ks->mac_addr); +eth_random_addr (ks->mac_addr);netdev_info (netdev,"Using random mac address\n" ); }netdev_info (netdev,"Mac address is: %pM\n" , ks->mac_addr);
drivers/net/ethernet/smsc/smsc911x.c +1 -1
@@ -2488,7 +2488,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)eth_hw_addr_random (dev);smsc911x_set_hw_mac_address (pdata, dev->dev_addr);SMSC_TRACE (pdata, probe, -"MAC Address is set to random_ether_addr" ); +"MAC Address is set to eth_random_addr" ); } }
drivers/net/ethernet/ti/cpsw.c +1 -1
@@ -748,7 +748,7 @@ static int __devinit cpsw_probe(struct platform_device *pdev)memcpy (priv->mac_addr, data->slave_data[0 ].mac_addr,ETH_ALEN );pr_info ("Detected MACID = %pM" , priv->mac_addr); }else { -random_ether_addr (priv->mac_addr); +eth_random_addr (priv->mac_addr);pr_info ("Random MACID = %pM" , priv->mac_addr); }
drivers/net/ethernet/tile/tilegx.c +1 -1
@@ -1844,7 +1844,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)memcpy (dev->dev_addr, mac,6 ); dev->addr_len =6 ; }else { -random_ether_addr (dev->dev_addr); +eth_random_addr (dev->dev_addr); }/* Register the network device. */
drivers/net/ethernet/wiznet/w5100.c +1 -1
@@ -637,7 +637,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)if (data &&is_valid_ether_addr (data->mac_addr)) {memcpy (ndev->dev_addr, data->mac_addr,ETH_ALEN ); }else { -random_ether_addr (ndev->dev_addr); +eth_random_addr (ndev->dev_addr); ndev->addr_assign_type |=NET_ADDR_RANDOM ; }
drivers/net/ethernet/wiznet/w5300.c +1 -1
@@ -557,7 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)if (data &&is_valid_ether_addr (data->mac_addr)) {memcpy (ndev->dev_addr, data->mac_addr,ETH_ALEN ); }else { -random_ether_addr (ndev->dev_addr); +eth_random_addr (ndev->dev_addr); ndev->addr_assign_type |=NET_ADDR_RANDOM ; }
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
@@ -312,7 +312,7 @@ static void axienet_set_mac_address(struct net_device *ndev, void *address)if (address)memcpy (ndev->dev_addr, address,ETH_ALEN );if (!is_valid_ether_addr (ndev->dev_addr)) -random_ether_addr (ndev->dev_addr); +eth_random_addr (ndev->dev_addr);/* Set up unicast MAC address filter set its mac address */ axienet_iow(lp, XAE_UAW0_OFFSET,
Signature · 14 lines
1.7.8.111.gad25c.dirty ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 3/8 net: usb: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/net/usb/smsc75xx.c | 2 +- drivers/net/usb/smsc95xx.c | 2 +- drivers/net/usb/usbnet.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/usb/smsc75xx.c +1 -1
@@ -616,7 +616,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)/* no eeprom, or eeprom values are invalid. generate random MAC */ eth_hw_addr_random (dev->net); -netif_dbg (dev, ifup, dev->net,"MAC address set to random_ether_addr" ); +netif_dbg (dev, ifup, dev->net,"MAC address set to eth_random_addr" ); }static int smsc75xx_set_mac_address (struct usbnet *dev)
drivers/net/usb/smsc95xx.c +1 -1
@@ -647,7 +647,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)/* no eeprom, or eeprom values are invalid. generate random MAC */ eth_hw_addr_random (dev->net); -netif_dbg (dev, ifup, dev->net,"MAC address set to random_ether_addr\n" ); +netif_dbg (dev, ifup, dev->net,"MAC address set to eth_random_addr\n" ); }static int smsc95xx_set_mac_address (struct usbnet *dev)
drivers/net/usb/usbnet.c +1 -1
@@ -1593,7 +1593,7 @@ static int __init usbnet_init(void) BUILD_BUG_ON( FIELD_SIZEOF(struct sk_buff, cb) < sizeof(struct skb_data)); -random_ether_addr (node_id); +eth_random_addr (node_id);return 0 ; }module_init (usbnet_init);
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 4/8 wireless: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/net/wireless/adm8211.c | 2 +- drivers/net/wireless/p54/eeprom.c | 2 +- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2800lib.c | 2 +- drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/wireless/adm8211.c +1 -1
@@ -1854,7 +1854,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,if (!is_valid_ether_addr (perm_addr)) {printk (KERN_WARNING "%s (adm8211): Invalid hwaddr in EEPROM!\n" ,pci_name (pdev)); -random_ether_addr (perm_addr); +eth_random_addr (perm_addr); }SET_IEEE80211_PERM_ADDR (dev, perm_addr);
drivers/net/wireless/p54/eeprom.c +1 -1
@@ -857,7 +857,7 @@ good_eeprom:wiphy_warn (dev->wiphy,"Invalid hwaddr! Using randomly generated MAC addr\n" ); -random_ether_addr (perm_addr); +eth_random_addr (perm_addr);SET_IEEE80211_PERM_ADDR (dev, perm_addr); }
drivers/net/wireless/rt2x00/rt2400pci.c +1 -1
@@ -1455,7 +1455,7 @@ static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rt2x00/rt2500pci.c +1 -1
@@ -1585,7 +1585,7 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rt2x00/rt2500usb.c +1 -1
@@ -1352,7 +1352,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rt2x00/rt2800lib.c +1 -1
@@ -4340,7 +4340,7 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rt2x00/rt61pci.c +1 -1
@@ -2415,7 +2415,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rt2x00/rt73usb.c +1 -1
@@ -1770,7 +1770,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)*/ mac =rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 );if (!is_valid_ether_addr (mac)) { -random_ether_addr (mac); +eth_random_addr (mac);EEPROM (rt2x00dev,"MAC: %pM\n" , mac); }
drivers/net/wireless/rtl818x/rtl8180/dev.c +1 -1
@@ -1078,7 +1078,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,if (!is_valid_ether_addr (mac_addr)) {printk (KERN_WARNING "%s (rtl8180): Invalid hwaddr! Using" " randomly generated MAC addr\n" ,pci_name (pdev)); -random_ether_addr (mac_addr); +eth_random_addr (mac_addr); }SET_IEEE80211_PERM_ADDR (dev, mac_addr);
drivers/net/wireless/rtl818x/rtl8187/dev.c +1 -1
@@ -1486,7 +1486,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,if (!is_valid_ether_addr (mac_addr)) {printk (KERN_WARNING "rtl8187: Invalid hwaddr! Using randomly " "generated MAC address\n" ); -random_ether_addr (mac_addr); +eth_random_addr (mac_addr); }SET_IEEE80211_PERM_ADDR (dev, mac_addr);
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH net-next 4/8] wireless: Use eth_random_addr
Quoted 10 lines · Joe Perches
From: Joe Perches <[email protected]>
Subject: [PATCH net-next 4/8] wireless: Useeth_random_addr
To: "David Miller" <[email protected]>, "John W. Linville" <[email protected]>, "Christian Lamparter" <[email protected]>, "Ivo van Doorn" <[email protected]>, "Gertjan van Wingerde" <[email protected]>, "Helmut Schaa" <[email protected]>, "Herton Ronaldo Krzesinski" <[email protected]>, "Hin-Tak Leung" <[email protected]>, "Larry Finger" <[email protected]>
Cc: "Johannes Berg" <[email protected]>, [email protected], [email protected], [email protected], [email protected]
Date: Friday, 13 July, 2012, 6:33
Convert the existing uses ofrandom_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>
Would it make sense to have a "check & set" macro?
Quoted 220 lines
---
drivers/net/wireless/adm8211.c
| 2 +-
drivers/net/wireless/p54/eeprom.c
| 2 +-
drivers/net/wireless/rt2x00/rt2400pci.c
| 2 +-
drivers/net/wireless/rt2x00/rt2500pci.c
| 2 +-
drivers/net/wireless/rt2x00/rt2500usb.c
| 2 +-
drivers/net/wireless/rt2x00/rt2800lib.c
| 2 +-
drivers/net/wireless/rt2x00/rt61pci.c
| 2 +-
drivers/net/wireless/rt2x00/rt73usb.c
| 2 +-drivers/net/wireless/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)drivers/net/wireless/adm8211.c +0
-1@@ -1854,7 +1854,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, if (!is_valid_ether_addr(perm_addr)) { printk(KERN_WARNING"%s (adm8211): Invalid hwaddr in EEPROM!\n" , pci_name(pdev)); -
random_ether_addr(perm_addr);
+eth_random_addr(perm_addr);
}
SET_IEEE80211_PERM_ADDR(dev,perm_addr);drivers/net/wireless/p54/eeprom.c +0
-0@@ -857,7 +857,7 @@ good_eeprom: wiphy_warn(dev->wiphy,"Invalid hwaddr! Using randomly generated
MAC addr\n");
-random_ether_addr(perm_addr);
+eth_random_addr(perm_addr);SET_IEEE80211_PERM_ADDR(dev, perm_addr);
}drivers/net/wireless/rt2x00/rt2400pci.c +1
-1@@ -1455,7 +1455,7 @@ static intrt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rt2x00/rt2500pci.c +1
-1@@ -1585,7 +1585,7 @@ static intrt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rt2x00/rt2500usb.c +1
-1@@ -1352,7 +1352,7 @@ static intrt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rt2x00/rt2800lib.c +1
-1@@ -4340,7 +4340,7 @@ int rt2800_validate_eeprom(structrt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rt2x00/rt61pci.c +1
-1@@ -2415,7 +2415,7 @@ static intrt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rt2x00/rt73usb.c +1
-1@@ -1770,7 +1770,7 @@ static intrt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) */ mac = rt2x00_eeprom_addr(rt2x00dev,EEPROM_MAC_ADDR_0 ); if (!is_valid_ether_addr(mac)) { -random_ether_addr (mac); +
eth_random_addr(mac);
EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
}drivers/net/wireless/rtl818x/rtl8180/dev.c +0
-0@@ -1078,7 +1078,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, if (!is_valid_ether_addr(mac_addr)) { printk(KERN_WARNING"%s (rtl8180): Invalid hwaddr! Using"
" randomly generated MAC addr\n",pci_name(pdev));
-random_ether_addr(mac_addr);
+eth_random_addr(mac_addr);
}
SET_IEEE80211_PERM_ADDR(dev, mac_addr);drivers/net/wireless/rtl818x/rtl8187/dev.c +0
-0@@ -1486,7 +1486,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, if (!is_valid_ether_addr(mac_addr)) { printk(KERN_WARNING"rtl8187: Invalid hwaddr! Using randomly "
"generated MAC address\n");
-random_ether_addr(mac_addr);
+eth_random_addr(mac_addr);
}
SET_IEEE80211_PERM_ADDR(dev, mac_addr);Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH net-next 4/8] wireless: Use eth_random_addr
In reply to Joe PerchesQuoted 4 lines · Joe Perches
Convert the existing uses of
random_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>
For the rt2x00 parts:
Quoted 4 lines
--- drivers/net/wireless/adm8211.c | 2 +- drivers/net/wireless/p54/eeprom.c | 2 +- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +-
Quoted 9 lines
drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2800lib.c | 2 +- drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)
---
Gertjan
PATCH 5/8 drivers/net: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/net/tun.c | 2 +- drivers/net/wimax/i2400m/driver.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tun.c +1 -1
@@ -22,7 +22,7 @@* Add TUNSETLINK ioctl to set the link encapsulation * * Mark Smith <[email protected]> -* Use random_ether_addr() for tap MAC address. +* Use eth_random_addr() for tap MAC address. * * Harald Roelle <[email protected]> 2004/04/20 * Fixes in packet dropping, queue length setting and queue wakeup.
drivers/net/wimax/i2400m/driver.c +1 -1
@@ -897,7 +897,7 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags) result =i2400m_read_mac_addr (i2400m);if (result <0 ) goto error_read_mac_addr; -random_ether_addr (i2400m->src_mac_addr); +eth_random_addr (i2400m->src_mac_addr); i2400m->pm_notifier.notifier_call = i2400m_pm_notifier;register_pm_notifier (&i2400m->pm_notifier);
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 6/8 s390: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_l2_main.c +1 -1
@@ -647,7 +647,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) }QETH_DBF_HEX (SETUP ,2 , card->dev->dev_addr,OSA_ADDR_LEN ); }else { -random_ether_addr (card->dev->dev_addr); +eth_random_addr (card->dev->dev_addr);memcpy (card->dev->dev_addr, vendor_pre,3 ); }return 0 ;
drivers/s390/net/qeth_l3_main.c +1 -1
@@ -1473,7 +1473,7 @@ static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card,memcpy (card->dev->dev_addr, cmd->data.create_destroy_addr.unique_id,ETH_ALEN ); else - random_ether_addr(card->dev->dev_addr); + eth_random_addr(card->dev->dev_addr);return 0 ; }
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 7/8 usb: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- drivers/usb/atm/xusbatm.c | 4 ++-- drivers/usb/gadget/u_ether.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/atm/xusbatm.c +2 -2
@@ -20,7 +20,7 @@******************************************************************************/ #include <linux/module.h> -#include <linux/etherdevice.h> /* for random_ether_addr() */ +#include <linux/etherdevice.h> /* for eth_random_addr() */ #include "usbatm.h"
@@ -163,7 +163,7 @@ static int xusbatm_atm_start(struct usbatm_data *usbatm,atm_dbg (usbatm,"%s entered\n" , __func__);/* use random MAC as we've no way to get it from the device */ -random_ether_addr (atm_dev->esi); +eth_random_addr (atm_dev->esi);return 0 ; }
drivers/usb/gadget/u_ether.c +1 -1
@@ -724,7 +724,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)if (is_valid_ether_addr (dev_addr))return 0 ; } -random_ether_addr (dev_addr); +eth_random_addr (dev_addr);return 1 ; }
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH net-next 7/8] usb: Use eth_random_addr
Quoted 4 lines · Joe Perches
Convert the existing uses of
random_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>
for drivers/usb/gadget:
Quoted 43 lines
--- drivers/usb/atm/xusbatm.c | 4 ++-- drivers/usb/gadget/u_ether.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/usb/atm/xusbatm.c +2
-2@@ -20,7 +20,7 @@******************************************************************************/ #include <linux/module.h> -#include <linux/etherdevice.h> /* for random_ether_addr() */ +#include <linux/etherdevice.h> /* for eth_random_addr() */ #include "usbatm.h" @@ -163,7 +163,7 @@ static int xusbatm_atm_start(struct usbatm_data *usbatm,atm_dbg (usbatm,"%s entered\n" , __func__);/* use random MAC as we've no way to get it from the device */ -random_ether_addr (atm_dev->esi); +eth_random_addr (atm_dev->esi);return 0 ; }drivers/usb/gadget/u_ether.c +1
-1@@ -724,7 +724,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)if (is_valid_ether_addr (dev_addr))return 0 ; } -random_ether_addr (dev_addr); +eth_random_addr (dev_addr);return 1 ; }Signature · 1 line
1.7.8.111.gad25c.dirty
Signature · 1 line
balbi
PATCH 8/8 arch: Use eth_random_addr
In reply to Joe PerchesConvert the existing uses of random_ether_addr to
the new eth_random_addr.
--- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/c6x/kernel/soc.c | 2 +- arch/mips/ar7/platform.c | 4 ++-- arch/mips/powertv/powertv_setup.c | 6 +++--- arch/um/drivers/net_kern.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-)
arch/blackfin/mach-bf537/boards/stamp.c +1 -1
@@ -873,7 +873,7 @@ static struct adf702x_platform_data adf7021_platform_data = { };static inline void adf702x_mac_init (void ) { -random_ether_addr (adf7021_platform_data.mac_addr); +eth_random_addr (adf7021_platform_data.mac_addr); }#else static inline void adf702x_mac_init (void ) {}
arch/c6x/kernel/soc.c +1 -1
@@ -80,7 +80,7 @@ int soc_mac_addr(unsigned int index, u8 *addr)if (have_fuse_mac)memcpy (addr, c6x_fuse_mac,6 );else -random_ether_addr (addr); +eth_random_addr (addr); }/* adjust for specific EMAC device */
arch/mips/ar7/platform.c +2 -2
@@ -310,10 +310,10 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr) &dev_addr[4], &dev_addr[5]) != 6) {pr_warning ("cannot parse mac address, " "using random address\n" ); -random_ether_addr (dev_addr); +eth_random_addr (dev_addr); } }else -random_ether_addr (dev_addr); +eth_random_addr (dev_addr); }/*****************************************************************************
arch/mips/powertv/powertv_setup.c +3 -3
@@ -254,7 +254,7 @@ early_param("rfmac", rfmac_param);* Generates an Ethernet MAC address that is highly likely to be unique for * this particular system on a network with other systems of the same type. * -* The problem we are solving is that, when random_ether_addr() is used to +* The problem we are solving is that, when eth_random_addr() is used to * generate MAC addresses at startup, there isn't much entropy for the random * number generator to use and the addresses it produces are fairly likely to * be the same as those of other identical systems on the same local network.
@@ -269,7 +269,7 @@ early_param("rfmac", rfmac_param);* Still, this does give us something to work with. * * The approach we take is: -* 1. If we can't get the RF MAC Address, just call random_ether_addr. +* 1. If we can't get the RF MAC Address, just call eth_random_addr. * 2. Use the 24-bit NIC-specific bits of the RF MAC address as the last 24 * bits of the new address. This is very likely to be unique, except for * the current box.
@@ -299,7 +299,7 @@ void platform_random_ether_addr(u8 addr[ETH_ALEN])if (!have_rfmac) {pr_warning ("rfmac not available on command line; " "generating random MAC address\n" ); -random_ether_addr (addr); +eth_random_addr (addr); }else {
arch/um/drivers/net_kern.c +1 -1
@@ -339,7 +339,7 @@ static int setup_etheraddr(char *str, unsigned char *addr, char *name) random:printk (KERN_INFO "Choosing a random ethernet address for device %s\n" , name); -random_ether_addr (addr); +eth_random_addr (addr);return 1 ; }
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH net-next 8/8] arch: Use eth_random_addr
Quoted 6 lines · On Friday 13 July 2012 01:33:12 Joe Perches wrote:
Convert the existing uses of
random_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>--- arch/blackfin/mach-bf537/boards/stamp.c | 2 +-
-mike
Re: [PATCH net-next 8/8] arch: Use eth_random_addr
In reply to Joe PerchesQuoted 7 lines · Joe Perches
Convert the existing uses of
random_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>--- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/c6x/kernel/soc.c | 2 +-
Re: [PATCH net-next 8/8] arch: Use eth_random_addr
In reply to Joe PerchesQuoted 11 lines · Joe Perches
Convert the existing uses of
random_ether_addrto
the neweth_random_addr.Signed-off-by Joe Perches <[email protected]>--- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/c6x/kernel/soc.c | 2 +- arch/mips/ar7/platform.c | 4 ++-- arch/mips/powertv/powertv_setup.c | 6 +++--- arch/um/drivers/net_kern.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-)
Thanks,
Ralf
A message that is not in the archive (sent off-list or not yet received): CAP=VYLqNyAF1gSsKTd3YojeJXK_-pEzXAKyVQbQfwhtwOyMmwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH] etherdevice: introduce eth_broadcast_addr
Quoted 11 lines · Paul Gortmaker
Quoted 4 lines · Johannes Berg
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast
Shouldn't we see all that "lot of code" here in this same commit, now using this new shortcut? If we apply this, we have a new function, but with no users. If you have done the audit, and found the inefficient cases, why isn't it here?
I'm planning to fix the wireless uses (at least the ones I'm responsible for), but I'm just going to stick them into my mac80211-next tree after this patch percolates down there, I don't see a need to send around a ton of patches for it.
Quoted 5 lines
I would think it better to just fix those people who have a pointless static array of all-ones to use the memset. If it was a multi line thing to achieve the
eth_broadcast_addr()then it might make sense to exist. But as a one line alias, it does seem somewhat pointless to me.
At least in my code I'm going to prefer this over the memset for documentation purposes. I'll agree that memset(..., 0xff, ETH_ALEN) is pretty obvious already, but eth_broadcast_addr(...) is even easier to read IMHO.
johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] etherdevice: introduce eth_broadcast_addr
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
Date: Tue, 10 Jul 2012 18:18:44 +0200
Quoted 9 lines
From: Johannes Berg <[email protected]>
A lot of code has either the memset or an inefficient copy from a static array that contains the all-ones broadcast address. Introduce
eth_broadcast_addr()to fill an address with all ones, making the code clearer and allowing us to get rid of some constant arrays.Signed-off-by Johannes Berg <[email protected]>
Applied, thanks.