* [PATCH 0/4] driver: net: Use ETH_ALEN
@ 2012-03-19 3:37 Joe Perches
2012-03-19 3:37 ` [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it Joe Perches
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: linux-wireless, netdev; +Cc: linux-kernel, e1000-devel
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(-)
--
1.7.8.111.gad25c.dirty
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it
2012-03-19 3:37 [PATCH 0/4] driver: net: Use ETH_ALEN Joe Perches
@ 2012-03-19 3:37 ` Joe Perches
2012-03-19 20:58 ` David Miller
2012-03-19 3:37 ` [PATCH 2/4] atlx: Use ETH_ALEN Joe Perches
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, linux-kernel
Just use ETH_ALEN.
Signed-off-by: Joe Perches <joe@perches.com>
---
include/linux/if_vlan.h | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 13aff1e..33a6e19 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -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 */
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] atlx: Use ETH_ALEN
2012-03-19 3:37 [PATCH 0/4] driver: net: Use ETH_ALEN Joe Perches
2012-03-19 3:37 ` [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it Joe Perches
@ 2012-03-19 3:37 ` Joe Perches
2012-03-19 20:58 ` David Miller
2012-03-19 3:37 ` Joe Perches
2012-03-19 3:37 ` [PATCH 4/4] rtlwifi: Remove unused ETH_ADDR_LEN defines Joe Perches
3 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Jay Cliburn, Chris Snook, netdev
No 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.
Signed-off-by: Joe Perches <joe@perches.com>
---
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(-)
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index 071f4c8..6762dc4 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -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;
}
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.h b/drivers/net/ethernet/atheros/atlx/atl2.h
index bf9016e..3ebe19f 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.h
+++ b/drivers/net/ethernet/atheros/atlx/atl2.h
@@ -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; */
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.h b/drivers/net/ethernet/atheros/atlx/atlx.h
index 14054b7..448f5dc 100644
--- a/drivers/net/ethernet/atheros/atlx/atlx.h
+++ b/drivers/net/ethernet/atheros/atlx/atlx.h
@@ -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 6
struct atlx_spi_flash_dev {
const char *manu_name; /* manufacturer id */
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] igbvf: Use ETH_ALEN
2012-03-19 3:37 [PATCH 0/4] driver: net: Use ETH_ALEN Joe Perches
@ 2012-03-19 3:37 ` Joe Perches
2012-03-19 3:37 ` [PATCH 2/4] atlx: Use ETH_ALEN Joe Perches
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: linux-kernel
Cc: Jeff Kirsher, Jesse Brandeburg, Bruce Allan, Carolyn Wyborny,
Don Skidmore, Greg Rose, Peter P Waskiewicz Jr, Alex Duyck,
John Ronciak, e1000-devel, netdev
Remove an unnecessary #define and use memcpy
instead of a loop to copy an ethernet address.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/ethernet/intel/igbvf/defines.h | 4 ----
drivers/net/ethernet/intel/igbvf/vf.c | 7 ++-----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/igbvf/defines.h b/drivers/net/ethernet/intel/igbvf/defines.h
index 33f40d3..3e18045 100644
--- a/drivers/net/ethernet/intel/igbvf/defines.h
+++ b/drivers/net/ethernet/intel/igbvf/defines.h
@@ -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
diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c
index 1955197..30a6cc4 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.c
+++ b/drivers/net/ethernet/intel/igbvf/vf.c
@@ -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;
}
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] igbvf: Use ETH_ALEN
@ 2012-03-19 3:37 ` Joe Perches
0 siblings, 0 replies; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: linux-kernel
Cc: e1000-devel, Bruce Allan, Jesse Brandeburg, John Ronciak, netdev
Remove an unnecessary #define and use memcpy
instead of a loop to copy an ethernet address.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/ethernet/intel/igbvf/defines.h | 4 ----
drivers/net/ethernet/intel/igbvf/vf.c | 7 ++-----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/igbvf/defines.h b/drivers/net/ethernet/intel/igbvf/defines.h
index 33f40d3..3e18045 100644
--- a/drivers/net/ethernet/intel/igbvf/defines.h
+++ b/drivers/net/ethernet/intel/igbvf/defines.h
@@ -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
diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c
index 1955197..30a6cc4 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.c
+++ b/drivers/net/ethernet/intel/igbvf/vf.c
@@ -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;
}
--
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
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] rtlwifi: Remove unused ETH_ADDR_LEN defines
2012-03-19 3:37 [PATCH 0/4] driver: net: Use ETH_ALEN Joe Perches
` (2 preceding siblings ...)
2012-03-19 3:37 ` Joe Perches
@ 2012-03-19 3:37 ` Joe Perches
3 siblings, 0 replies; 10+ messages in thread
From: Joe Perches @ 2012-03-19 3:37 UTC (permalink / raw)
To: Larry Finger, Chaoming Li
Cc: John W. Linville, linux-wireless, netdev, linux-kernel
Just neatening.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 1 -
drivers/net/wireless/rtlwifi/rtl8192de/reg.h | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
index 43806d9..e4d738f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
@@ -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
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
index 9bc4623..ebb1d5f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
@@ -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
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it
2012-03-19 3:37 ` [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it Joe Perches
@ 2012-03-19 20:58 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-03-19 20:58 UTC (permalink / raw)
To: joe; +Cc: kaber, netdev, linux-kernel
From: Joe Perches <joe@perches.com>
Date: Sun, 18 Mar 2012 20:37:56 -0700
> Just use ETH_ALEN.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] atlx: Use ETH_ALEN
2012-03-19 3:37 ` [PATCH 2/4] atlx: Use ETH_ALEN Joe Perches
@ 2012-03-19 20:58 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-03-19 20:58 UTC (permalink / raw)
To: joe; +Cc: linux-kernel, jcliburn, chris.snook, netdev
From: Joe Perches <joe@perches.com>
Date: Sun, 18 Mar 2012 20:37:57 -0700
> No 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.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] igbvf: Use ETH_ALEN
2012-03-19 3:37 ` Joe Perches
@ 2012-03-19 20:58 ` David Miller
-1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-03-19 20:58 UTC (permalink / raw)
To: joe
Cc: linux-kernel, jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
carolyn.wyborny, donald.c.skidmore, gregory.v.rose,
peter.p.waskiewicz.jr, alexander.h.duyck, john.ronciak,
e1000-devel, netdev
From: Joe Perches <joe@perches.com>
Date: Sun, 18 Mar 2012 20:37:58 -0700
> Remove an unnecessary #define and use memcpy
> instead of a loop to copy an ethernet address.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] igbvf: Use ETH_ALEN
@ 2012-03-19 20:58 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-03-19 20:58 UTC (permalink / raw)
To: joe
Cc: e1000-devel, bruce.w.allan, jesse.brandeburg, linux-kernel,
john.ronciak, netdev
From: Joe Perches <joe@perches.com>
Date: Sun, 18 Mar 2012 20:37:58 -0700
> Remove an unnecessary #define and use memcpy
> instead of a loop to copy an ethernet address.
>
> Signed-off-by: Joe Perches <joe@perches.com>
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
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-03-19 20:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19 3:37 [PATCH 0/4] driver: net: Use ETH_ALEN Joe Perches
2012-03-19 3:37 ` [PATCH 1/4] if_vlan: Remove VLAN_ETH_ALEN define and the 1 use of it Joe Perches
2012-03-19 20:58 ` David Miller
2012-03-19 3:37 ` [PATCH 2/4] atlx: Use ETH_ALEN Joe Perches
2012-03-19 20:58 ` David Miller
2012-03-19 3:37 ` [PATCH 3/4] igbvf: " Joe Perches
2012-03-19 3:37 ` Joe Perches
2012-03-19 20:58 ` David Miller
2012-03-19 20:58 ` David Miller
2012-03-19 3:37 ` [PATCH 4/4] rtlwifi: Remove unused ETH_ADDR_LEN defines Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.