driver: net: Use ETH_ALEN
Subsystems (5)
cover driver: net: Use ETH_ALEN
Just some neatening
Joe Perches (4):
if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it
atlx: Use ETH_ALEN
igbvf: Use ETH_ALEN
rtlwifi: Remove unused ETH_ADDR_LEN defines
drivers/net/ethernet/atheros/atlx/atl2.c | 13 +++++-------- drivers/net/ethernet/atheros/atlx/atl2.h | 5 ++--- drivers/net/ethernet/atheros/atlx/atlx.h | 1 - drivers/net/ethernet/intel/igbvf/defines.h | 4 ---- drivers/net/ethernet/intel/igbvf/vf.c | 7 ++----- drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 1 - drivers/net/wireless/rtlwifi/rtl8192de/reg.h | 1 - include/linux/if_vlan.h | 7 +++---- 8 files changed, 12 insertions(+), 27 deletions(-)
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 1/4 if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it
Just use ETH_ALEN.
--- include/linux/if_vlan.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
include/linux/if_vlan.h +3 -4
@@ -18,10 +18,9 @@#include <linux/etherdevice.h> #include <linux/rtnetlink.h> -#define VLAN_HLEN 4/* The additional bytes (on top of the Ethernet header) -* that VLAN requires. +#define VLAN_HLEN 4/* The additional bytes required by VLAN +* (in addition to the Ethernet header) */ -#define VLAN_ETH_ALEN 6/* Octets in one ethernet addr */ #define VLAN_ETH_HLEN 18/* Total octets in header. */ #define VLAN_ETH_ZLEN 64/* Min. octets in frame sans FCS */
@@ -177,7 +176,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) veth = (struct vlan_ethhdr *)skb_push (skb,VLAN_HLEN );/* Move the mac addresses to the beginning of the new header. */ -memmove (skb->data, skb->data +VLAN_HLEN ,2 *VLAN_ETH_ALEN ); +memmove (skb->data, skb->data +VLAN_HLEN ,2 *ETH_ALEN ); skb->mac_header -=VLAN_HLEN ;/* first, the ethernet type */
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it
From: Joe Perches <[email protected]>
Date: Sun, 18 Mar 2012 20:37:56 -0700
Quoted 3 lines
Just use
ETH_ALEN.Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 2/4 atlx: Use ETH_ALEN
In reply to Joe PerchesNo need for yet another #define for this.
Convert NODE_ADDRESS_SIZE use to ETH_ALEN and remove #define. Use memcpy instead of a loop to copy an address.
--- drivers/net/ethernet/atheros/atlx/atl2.c | 13 +++++-------- drivers/net/ethernet/atheros/atlx/atl2.h | 5 ++--- drivers/net/ethernet/atheros/atlx/atlx.h | 1 - 3 files changed, 7 insertions(+), 12 deletions(-)
drivers/net/ethernet/atheros/atlx/atl2.c +5 -8
@@ -2258,7 +2258,7 @@ static int get_permanent_address(struct atl2_hw *hw)u32 Addr[2 ];u32 i, Control;u16 Register; -u8 EthAddr[NODE_ADDRESS_SIZE ]; +u8 EthAddr[ETH_ALEN ];bool KeyValid;if (is_valid_ether_addr (hw->perm_mac_addr))
@@ -2299,7 +2299,7 @@ static int get_permanent_address(struct atl2_hw *hw) *(u16 *) &EthAddr[0 ] =SHORTSWAP (*(u16 *) &Addr[1 ]);if (is_valid_ether_addr (EthAddr)) { -memcpy (hw->perm_mac_addr, EthAddr,NODE_ADDRESS_SIZE ); +memcpy (hw->perm_mac_addr, EthAddr,ETH_ALEN );return 0 ; }return 1 ;
@@ -2334,7 +2334,7 @@ static int get_permanent_address(struct atl2_hw *hw) *(u32 *) &EthAddr[2 ] =LONGSWAP (Addr[0 ]); *(u16 *) &EthAddr[0 ] =SHORTSWAP (*(u16 *)&Addr[1 ]);if (is_valid_ether_addr (EthAddr)) { -memcpy (hw->perm_mac_addr, EthAddr,NODE_ADDRESS_SIZE ); +memcpy (hw->perm_mac_addr, EthAddr,ETH_ALEN );return 0 ; }/* maybe MAC-address is from BIOS */
@@ -2344,7 +2344,7 @@ static int get_permanent_address(struct atl2_hw *hw) *(u16 *) &EthAddr[0 ] =SHORTSWAP (*(u16 *) &Addr[1 ]);if (is_valid_ether_addr (EthAddr)) { -memcpy (hw->perm_mac_addr, EthAddr,NODE_ADDRESS_SIZE ); +memcpy (hw->perm_mac_addr, EthAddr,ETH_ALEN );return 0 ; }
@@ -2358,8 +2358,6 @@ static int get_permanent_address(struct atl2_hw *hw)*/ static s32 atl2_read_mac_addr (struct atl2_hw *hw) { -u16 i; -if (get_permanent_address (hw)) {/* for test */ /* FIXME: shouldn't we use random_ether_addr() here? */
@@ -2371,8 +2369,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw) hw->perm_mac_addr[5 ] =0x38 ; } -for (i =0 ; i <NODE_ADDRESS_SIZE ; i++) - hw->mac_addr[i] = hw->perm_mac_addr[i]; +memcpy (hw->mac_addr, hw->perm_mac_addr,ETH_ALEN );return 0 ; }
drivers/net/ethernet/atheros/atlx/atl2.h +2 -3
@@ -47,7 +47,6 @@ extern int ethtool_ioctl(struct ifreq *ifr);#define PCI_COMMAND_REGISTER PCI_COMMAND#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE -#define ETH_ADDR_LEN ETH_ALEN#define ATL2_WRITE_REG (a, reg, value) (iowrite32((value), \ ((a)->hw_addr + (reg))))
@@ -429,8 +428,8 @@ struct atl2_hw {u8 flash_vendor;u8 dma_fairness; -u8 mac_addr[NODE_ADDRESS_SIZE ]; -u8 perm_mac_addr[NODE_ADDRESS_SIZE ]; +u8 mac_addr[ETH_ALEN ]; +u8 perm_mac_addr[ETH_ALEN ];/* FIXME */ /* bool phy_preamble_sup; */
drivers/net/ethernet/atheros/atlx/atlx.h +0 -1
@@ -484,7 +484,6 @@/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ #define EEPROM_SUM 0xBABA -#define NODE_ADDRESS_SIZE 6struct atlx_spi_flash_dev {const char *manu_name;/* manufacturer id */
Signature · 1 line
1.7.8.111.gad25c.dirty
Re: [PATCH 2/4] atlx: Use ETH_ALEN
From: Joe Perches <[email protected]>
Date: Sun, 18 Mar 2012 20:37:57 -0700
Quoted 6 lines
No need for yet another #define for this.
Convert
NODE_ADDRESS_SIZEuse toETH_ALENand remove #define. Use memcpy instead of a loop to copy an address.Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 3/4 igbvf: Use ETH_ALEN
In reply to Joe PerchesRemove an unnecessary #define and use memcpy
instead of a loop to copy an ethernet address.
--- drivers/net/ethernet/intel/igbvf/defines.h | 4 ---- drivers/net/ethernet/intel/igbvf/vf.c | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/igbvf/defines.h +0 -4
@@ -97,10 +97,6 @@#define E1000_ERR_MAC_INIT 5#define E1000_ERR_MBX 15 -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif -/* SRRCTL bit definitions */ #define E1000_SRRCTL_BSIZEPKT_SHIFT 10/* Shift _right_ */ #define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00
drivers/net/ethernet/intel/igbvf/vf.c +2 -5
@@ -246,7 +246,7 @@ static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,for (i =0 ; i < cnt; i++) { hash_value =e1000_hash_mc_addr_vf (hw, mc_addr_list); hash_list[i] = hash_value &0x0FFFF ; - mc_addr_list +=ETH_ADDR_LEN ; + mc_addr_list +=ETH_ALEN ; } mbx->ops.write_posted (hw, msgbuf,E1000_VFMAILBOX_SIZE );
@@ -333,10 +333,7 @@ static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index)**/ static s32 e1000_read_mac_addr_vf (struct e1000_hw *hw) { -int i; - -for (i =0 ; i <ETH_ADDR_LEN ; i++) - hw->mac.addr[i] = hw->mac.perm_addr[i]; +memcpy (hw->mac.addr, hw->mac.perm_addr,ETH_ALEN );return E1000_SUCCESS ; }
Signature · 12 lines
1.7.8.111.gad25c.dirty ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ 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
Re: [PATCH 3/4] igbvf: Use ETH_ALEN
From: Joe Perches <[email protected]>
Date: Sun, 18 Mar 2012 20:37:58 -0700
Quoted 4 lines
Remove an unnecessary #define and use memcpy
instead of a loop to copy an ethernet address.Signed-off-by Joe Perches <[email protected]>
Applied.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
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 4/4 rtlwifi: Remove unused ETH_ADDR_LEN defines
In reply to Joe PerchesJust neatening.
--- drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 1 - drivers/net/wireless/rtlwifi/rtl8192de/reg.h | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192ce/reg.h +0 -1
@@ -1190,7 +1190,6 @@#define USB_AGG_EN BIT(3) -#define MAC_ADDR_LEN 6#define LAST_ENTRY_OF_TX_PKT_BUFFER 255#define POLLING_LLT_THRESHOLD 20
drivers/net/wireless/rtlwifi/rtl8192de/reg.h +0 -1
@@ -998,7 +998,6 @@#define SCR_RXBCUSEDK BIT(7)/* General definitions */ -#define MAC_ADDR_LEN 6#define LAST_ENTRY_OF_TX_PKT_BUFFER 255#define LAST_ENTRY_OF_TX_PKT_BUFFER_DUAL_MAC 127
Signature · 1 line
1.7.8.111.gad25c.dirty