netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] networking: Use ETH_ALEN where appropriate
@ 2013-07-29  5:29 Joe Perches
  2013-07-29  5:29 ` [PATCH 1/3] uapi: Convert some uses of 6 to ETH_ALEN Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Joe Perches @ 2013-07-29  5:29 UTC (permalink / raw)
  To: netdev
  Cc: wimax, linux-usb, linux-kernel, virtualization, linux-acpi,
	netfilter-devel, linuxppc-dev, linux-arm-kernel, linux-media

Convert the uses mac addresses to ETH_ALEN so
it's easier to find and verify where mac addresses
need to be __aligned(2)

Joe Perches (3):
  uapi: Convert some uses of 6 to ETH_ALEN
  include: Convert ethernet mac address declarations to use ETH_ALEN
  ethernet: Convert mac address uses of 6 to ETH_ALEN

 drivers/net/ethernet/8390/ax88796.c                |  4 +-
 drivers/net/ethernet/amd/pcnet32.c                 |  6 +--
 drivers/net/ethernet/broadcom/cnic_if.h            |  6 +--
 drivers/net/ethernet/dec/tulip/tulip_core.c        |  8 +--
 drivers/net/ethernet/i825xx/sun3_82586.h           |  4 +-
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |  2 +-
 drivers/net/ethernet/nuvoton/w90p910_ether.c       |  4 +-
 drivers/net/ethernet/pasemi/pasemi_mac.c           | 13 ++---
 drivers/net/ethernet/pasemi/pasemi_mac.h           |  4 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  4 +-
 drivers/net/ethernet/qlogic/qlge/qlge.h            |  2 +-
 include/acpi/actbl2.h                              |  4 +-
 include/linux/dm9000.h                             |  4 +-
 include/linux/fs_enet_pd.h                         |  3 +-
 include/linux/ieee80211.h                          | 59 +++++++++++-----------
 include/linux/mlx4/device.h                        | 11 ++--
 include/linux/mlx4/qp.h                            |  5 +-
 include/linux/mv643xx_eth.h                        |  3 +-
 include/linux/sh_eth.h                             |  3 +-
 include/linux/smsc911x.h                           |  3 +-
 include/linux/uwb/spec.h                           |  5 +-
 include/media/tveeprom.h                           |  4 +-
 include/net/irda/irlan_common.h                    |  3 +-
 include/uapi/linux/dn.h                            |  3 +-
 include/uapi/linux/if_bridge.h                     |  3 +-
 include/uapi/linux/netfilter_bridge/ebt_802_3.h    |  5 +-
 include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h  |  3 +-
 include/uapi/linux/virtio_net.h                    |  2 +-
 include/uapi/linux/wimax/i2400m.h                  |  4 +-
 29 files changed, 103 insertions(+), 81 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] uapi: Convert some uses of 6 to ETH_ALEN
  2013-07-29  5:29 [PATCH 0/3] networking: Use ETH_ALEN where appropriate Joe Perches
@ 2013-07-29  5:29 ` Joe Perches
  2013-07-29  5:29 ` [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN Joe Perches
  2013-07-29  5:29 ` [PATCH 3/3] ethernet: Convert mac address uses of 6 to ETH_ALEN Joe Perches
  2 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2013-07-29  5:29 UTC (permalink / raw)
  To: netdev
  Cc: wimax, Michael S. Tsirkin, linux-kernel, Inaky Perez-Gonzalez,
	linux-wimax, Bart De Schuymer, netfilter-devel, virtualization

Use the #define where appropriate.

Add #include <linux/if_ether.h>
where appropriate too.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/uapi/linux/dn.h                           | 3 ++-
 include/uapi/linux/if_bridge.h                    | 3 ++-
 include/uapi/linux/netfilter_bridge/ebt_802_3.h   | 5 +++--
 include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h | 3 ++-
 include/uapi/linux/virtio_net.h                   | 2 +-
 include/uapi/linux/wimax/i2400m.h                 | 4 ++--
 6 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/dn.h b/include/uapi/linux/dn.h
index 9c50445..5fbdd3d 100644
--- a/include/uapi/linux/dn.h
+++ b/include/uapi/linux/dn.h
@@ -2,6 +2,7 @@
 #define _LINUX_DN_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 /*
 
@@ -120,7 +121,7 @@ struct linkinfo_dn {
  * Ethernet address format (for DECnet)
  */
 union etheraddress {
-        __u8 dne_addr[6];             /* Full ethernet address */
+        __u8 dne_addr[ETH_ALEN];      /* Full ethernet address */
   struct {
                 __u8 dne_hiord[4];    /* DECnet HIORD prefix   */
                 __u8 dne_nodeaddr[2]; /* DECnet node address   */
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 2d70d79..39f621a 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -14,6 +14,7 @@
 #define _UAPI_LINUX_IF_BRIDGE_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 #define SYSFS_BRIDGE_ATTR	"bridge"
 #define SYSFS_BRIDGE_FDB	"brforward"
@@ -88,7 +89,7 @@ struct __port_info {
 };
 
 struct __fdb_entry {
-	__u8 mac_addr[6];
+	__u8 mac_addr[ETH_ALEN];
 	__u8 port_no;
 	__u8 is_local;
 	__u32 ageing_timer_value;
diff --git a/include/uapi/linux/netfilter_bridge/ebt_802_3.h b/include/uapi/linux/netfilter_bridge/ebt_802_3.h
index 5bf8491..f37522a 100644
--- a/include/uapi/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_802_3.h
@@ -2,6 +2,7 @@
 #define _UAPI__LINUX_BRIDGE_EBT_802_3_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 #define EBT_802_3_SAP 0x01
 #define EBT_802_3_TYPE 0x02
@@ -42,8 +43,8 @@ struct hdr_ni {
 };
 
 struct ebt_802_3_hdr {
-	__u8  daddr[6];
-	__u8  saddr[6];
+	__u8  daddr[ETH_ALEN];
+	__u8  saddr[ETH_ALEN];
 	__be16 len;
 	union {
 		struct hdr_ui ui;
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index c6a204c..eac0f65 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -2,6 +2,7 @@
 #define _IPT_CLUSTERIP_H_target
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 enum clusterip_hashmode {
     CLUSTERIP_HASHMODE_SIP = 0,
@@ -22,7 +23,7 @@ struct ipt_clusterip_tgt_info {
 	__u32 flags;
 
 	/* only relevant for new ones */
-	__u8 clustermac[6];
+	__u8 clustermac[ETH_ALEN];
 	__u16 num_total_nodes;
 	__u16 num_local_nodes;
 	__u16 local_nodes[CLUSTERIP_MAX_NODES];
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 227d4ce..172a7f0 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -60,7 +60,7 @@
 
 struct virtio_net_config {
 	/* The config defining mac address (if VIRTIO_NET_F_MAC) */
-	__u8 mac[6];
+	__u8 mac[ETH_ALEN];
 	/* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
 	__u16 status;
 	/* Maximum number of each of transmit and receive queues;
diff --git a/include/uapi/linux/wimax/i2400m.h b/include/uapi/linux/wimax/i2400m.h
index 62d3561..fd198bc 100644
--- a/include/uapi/linux/wimax/i2400m.h
+++ b/include/uapi/linux/wimax/i2400m.h
@@ -122,7 +122,7 @@
 #define __LINUX__WIMAX__I2400M_H__
 
 #include <linux/types.h>
-
+#include <linux/if_ether.h>
 
 /*
  * Host Device Interface (HDI) common to all busses
@@ -487,7 +487,7 @@ struct i2400m_tlv_l4_message_versions {
 struct i2400m_tlv_detailed_device_info {
 	struct i2400m_tlv_hdr hdr;
 	__u8 reserved1[400];
-	__u8 mac_address[6];
+	__u8 mac_address[ETH_ALEN];
 	__u8 reserved2[2];
 } __attribute__((packed));
 
-- 
1.8.1.2.459.gbcd45b4.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN
  2013-07-29  5:29 [PATCH 0/3] networking: Use ETH_ALEN where appropriate Joe Perches
  2013-07-29  5:29 ` [PATCH 1/3] uapi: Convert some uses of 6 to ETH_ALEN Joe Perches
@ 2013-07-29  5:29 ` Joe Perches
  2013-07-29 11:59   ` Rafael J. Wysocki
  2013-08-01 17:50   ` Mauro Carvalho Chehab
  2013-07-29  5:29 ` [PATCH 3/3] ethernet: Convert mac address uses of 6 to ETH_ALEN Joe Perches
  2 siblings, 2 replies; 8+ messages in thread
From: Joe Perches @ 2013-07-29  5:29 UTC (permalink / raw)
  To: netdev
  Cc: Len Brown, Rafael J. Wysocki, Pantelis Antoniou, Vitaly Bordug,
	Steve Glendinning, Mauro Carvalho Chehab, Samuel Ortiz,
	David S. Miller, linux-acpi, linux-kernel, linuxppc-dev,
	linux-usb, linux-media

It's convenient to have ethernet mac addresses use
ETH_ALEN to be able to grep for them a bit easier and
also to ensure that the addresses are __aligned(2).

Add #include <linux/if_ether.h> as necessary.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/acpi/actbl2.h           |  4 ++-
 include/linux/dm9000.h          |  4 ++-
 include/linux/fs_enet_pd.h      |  3 ++-
 include/linux/ieee80211.h       | 59 +++++++++++++++++++++--------------------
 include/linux/mlx4/device.h     | 11 ++++----
 include/linux/mlx4/qp.h         |  5 ++--
 include/linux/mv643xx_eth.h     |  3 ++-
 include/linux/sh_eth.h          |  3 ++-
 include/linux/smsc911x.h        |  3 ++-
 include/linux/uwb/spec.h        |  5 ++--
 include/media/tveeprom.h        |  4 ++-
 include/net/irda/irlan_common.h |  3 ++-
 12 files changed, 61 insertions(+), 46 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index ffaac0e..3f0f11c 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -44,6 +44,8 @@
 #ifndef __ACTBL2_H__
 #define __ACTBL2_H__
 
+#include <linux/if_ether.h>
+
 /*******************************************************************************
  *
  * Additional ACPI Tables (2)
@@ -605,7 +607,7 @@ struct acpi_ibft_nic {
 	u8 secondary_dns[16];
 	u8 dhcp[16];
 	u16 vlan;
-	u8 mac_address[6];
+	u8 mac_address[ETH_ALEN];
 	u16 pci_address;
 	u16 name_length;
 	u16 name_offset;
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index 96e8769..841925f 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -14,6 +14,8 @@
 #ifndef __DM9000_PLATFORM_DATA
 #define __DM9000_PLATFORM_DATA __FILE__
 
+#include <linux/if_ether.h>
+
 /* IO control flags */
 
 #define DM9000_PLATF_8BITONLY	(0x0001)
@@ -27,7 +29,7 @@
 
 struct dm9000_plat_data {
 	unsigned int	flags;
-	unsigned char	dev_addr[6];
+	unsigned char	dev_addr[ETH_ALEN];
 
 	/* allow replacement IO routines */
 
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 51b7934..343d82a 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -18,6 +18,7 @@
 
 #include <linux/string.h>
 #include <linux/of_mdio.h>
+#include <linux/if_ether.h>
 #include <asm/types.h>
 
 #define FS_ENET_NAME	"fs_enet"
@@ -135,7 +136,7 @@ struct fs_platform_info {
 	const struct fs_mii_bus_info *bus_info;
 
 	int rx_ring, tx_ring;	/* number of buffers on rx     */
-	__u8 macaddr[6];	/* mac address                 */
+	__u8 macaddr[ETH_ALEN];	/* mac address                 */
 	int rx_copybreak;	/* limit we copy small frames  */
 	int use_napi;		/* use NAPI                    */
 	int napi_weight;	/* NAPI weight                 */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index b0dc87a..4e101af 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -16,6 +16,7 @@
 #define LINUX_IEEE80211_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 #include <asm/byteorder.h>
 
 /*
@@ -209,28 +210,28 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
 struct ieee80211_hdr {
 	__le16 frame_control;
 	__le16 duration_id;
-	u8 addr1[6];
-	u8 addr2[6];
-	u8 addr3[6];
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	u8 addr3[ETH_ALEN];
 	__le16 seq_ctrl;
-	u8 addr4[6];
+	u8 addr4[ETH_ALEN];
 } __packed __aligned(2);
 
 struct ieee80211_hdr_3addr {
 	__le16 frame_control;
 	__le16 duration_id;
-	u8 addr1[6];
-	u8 addr2[6];
-	u8 addr3[6];
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	u8 addr3[ETH_ALEN];
 	__le16 seq_ctrl;
 } __packed __aligned(2);
 
 struct ieee80211_qos_hdr {
 	__le16 frame_control;
 	__le16 duration_id;
-	u8 addr1[6];
-	u8 addr2[6];
-	u8 addr3[6];
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	u8 addr3[ETH_ALEN];
 	__le16 seq_ctrl;
 	__le16 qos_ctrl;
 } __packed __aligned(2);
@@ -608,8 +609,8 @@ struct ieee80211s_hdr {
 	u8 flags;
 	u8 ttl;
 	__le32 seqnum;
-	u8 eaddr1[6];
-	u8 eaddr2[6];
+	u8 eaddr1[ETH_ALEN];
+	u8 eaddr2[ETH_ALEN];
 } __packed __aligned(2);
 
 /* Mesh flags */
@@ -758,7 +759,7 @@ struct ieee80211_rann_ie {
 	u8 rann_flags;
 	u8 rann_hopcount;
 	u8 rann_ttl;
-	u8 rann_addr[6];
+	u8 rann_addr[ETH_ALEN];
 	__le32 rann_seq;
 	__le32 rann_interval;
 	__le32 rann_metric;
@@ -802,9 +803,9 @@ enum ieee80211_vht_opmode_bits {
 struct ieee80211_mgmt {
 	__le16 frame_control;
 	__le16 duration;
-	u8 da[6];
-	u8 sa[6];
-	u8 bssid[6];
+	u8 da[ETH_ALEN];
+	u8 sa[ETH_ALEN];
+	u8 bssid[ETH_ALEN];
 	__le16 seq_ctrl;
 	union {
 		struct {
@@ -833,7 +834,7 @@ struct ieee80211_mgmt {
 		struct {
 			__le16 capab_info;
 			__le16 listen_interval;
-			u8 current_ap[6];
+			u8 current_ap[ETH_ALEN];
 			/* followed by SSID and Supported rates */
 			u8 variable[0];
 		} __packed reassoc_req;
@@ -966,21 +967,21 @@ struct ieee80211_vendor_ie {
 struct ieee80211_rts {
 	__le16 frame_control;
 	__le16 duration;
-	u8 ra[6];
-	u8 ta[6];
+	u8 ra[ETH_ALEN];
+	u8 ta[ETH_ALEN];
 } __packed __aligned(2);
 
 struct ieee80211_cts {
 	__le16 frame_control;
 	__le16 duration;
-	u8 ra[6];
+	u8 ra[ETH_ALEN];
 } __packed __aligned(2);
 
 struct ieee80211_pspoll {
 	__le16 frame_control;
 	__le16 aid;
-	u8 bssid[6];
-	u8 ta[6];
+	u8 bssid[ETH_ALEN];
+	u8 ta[ETH_ALEN];
 } __packed __aligned(2);
 
 /* TDLS */
@@ -989,14 +990,14 @@ struct ieee80211_pspoll {
 struct ieee80211_tdls_lnkie {
 	u8 ie_type; /* Link Identifier IE */
 	u8 ie_len;
-	u8 bssid[6];
-	u8 init_sta[6];
-	u8 resp_sta[6];
+	u8 bssid[ETH_ALEN];
+	u8 init_sta[ETH_ALEN];
+	u8 resp_sta[ETH_ALEN];
 } __packed;
 
 struct ieee80211_tdls_data {
-	u8 da[6];
-	u8 sa[6];
+	u8 da[ETH_ALEN];
+	u8 sa[ETH_ALEN];
 	__be16 ether_type;
 	u8 payload_type;
 	u8 category;
@@ -1090,8 +1091,8 @@ struct ieee80211_p2p_noa_attr {
 struct ieee80211_bar {
 	__le16 frame_control;
 	__le16 duration;
-	__u8 ra[6];
-	__u8 ta[6];
+	__u8 ra[ETH_ALEN];
+	__u8 ta[ETH_ALEN];
 	__le16 control;
 	__le16 start_seq_num;
 } __packed;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 52c23a8..e37ac2b 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -33,6 +33,7 @@
 #ifndef MLX4_DEVICE_H
 #define MLX4_DEVICE_H
 
+#include <linux/if_ether.h>
 #include <linux/pci.h>
 #include <linux/completion.h>
 #include <linux/radix-tree.h>
@@ -619,7 +620,7 @@ struct mlx4_eth_av {
 	u8		dgid[16];
 	u32		reserved4[2];
 	__be16		vlan;
-	u8		mac[6];
+	u8		mac[ETH_ALEN];
 };
 
 union mlx4_ext_av {
@@ -913,10 +914,10 @@ enum mlx4_net_trans_promisc_mode {
 };
 
 struct mlx4_spec_eth {
-	u8	dst_mac[6];
-	u8	dst_mac_msk[6];
-	u8	src_mac[6];
-	u8	src_mac_msk[6];
+	u8	dst_mac[ETH_ALEN];
+	u8	dst_mac_msk[ETH_ALEN];
+	u8	src_mac[ETH_ALEN];
+	u8	src_mac_msk[ETH_ALEN];
 	u8	ether_type_enable;
 	__be16	ether_type;
 	__be16	vlan_id_msk;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 262deac..6d35147 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -34,6 +34,7 @@
 #define MLX4_QP_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 #include <linux/mlx4/device.h>
 
@@ -143,7 +144,7 @@ struct mlx4_qp_path {
 	u8			feup;
 	u8			fvl_rx;
 	u8			reserved4[2];
-	u8			dmac[6];
+	u8			dmac[ETH_ALEN];
 };
 
 enum { /* fl */
@@ -318,7 +319,7 @@ struct mlx4_wqe_datagram_seg {
 	__be32			dqpn;
 	__be32			qkey;
 	__be16			vlan;
-	u8			mac[6];
+	u8			mac[ETH_ALEN];
 };
 
 struct mlx4_wqe_lso_seg {
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 6e8215b..61a0da3 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -6,6 +6,7 @@
 #define __LINUX_MV643XX_ETH_H
 
 #include <linux/mbus.h>
+#include <linux/if_ether.h>
 
 #define MV643XX_ETH_SHARED_NAME		"mv643xx_eth"
 #define MV643XX_ETH_NAME		"mv643xx_eth_port"
@@ -48,7 +49,7 @@ struct mv643xx_eth_platform_data {
 	 * Use this MAC address if it is valid, overriding the
 	 * address that is already in the hardware.
 	 */
-	u8			mac_addr[6];
+	u8			mac_addr[ETH_ALEN];
 
 	/*
 	 * If speed is 0, autonegotiation is enabled.
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index fc30571..6205eeb 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -2,6 +2,7 @@
 #define __ASM_SH_ETH_H__
 
 #include <linux/phy.h>
+#include <linux/if_ether.h>
 
 enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
 enum {
@@ -18,7 +19,7 @@ struct sh_eth_plat_data {
 	phy_interface_t phy_interface;
 	void (*set_mdio_gate)(void *addr);
 
-	unsigned char mac_addr[6];
+	unsigned char mac_addr[ETH_ALEN];
 	unsigned no_ether_link:1;
 	unsigned ether_link_active_low:1;
 	unsigned needs_init:1;
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 4dde70e..eec3efd 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -22,6 +22,7 @@
 #define __LINUX_SMSC911X_H__
 
 #include <linux/phy.h>
+#include <linux/if_ether.h>
 
 /* platform_device configuration data, should be assigned to
  * the platform_device's dev.platform_data */
@@ -31,7 +32,7 @@ struct smsc911x_platform_config {
 	unsigned int flags;
 	unsigned int shift;
 	phy_interface_t phy_interface;
-	unsigned char mac[6];
+	unsigned char mac[ETH_ALEN];
 };
 
 /* Constants for platform_device irq polarity configuration */
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
index b52e44f..0df24bf 100644
--- a/include/linux/uwb/spec.h
+++ b/include/linux/uwb/spec.h
@@ -32,6 +32,7 @@
 
 #include <linux/types.h>
 #include <linux/bitmap.h>
+#include <linux/if_ether.h>
 
 #define i1480_FW 0x00000303
 /* #define i1480_FW 0x00000302 */
@@ -130,7 +131,7 @@ enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
  * it is also used to define headers sent down and up the wire/radio).
  */
 struct uwb_mac_addr {
-	u8 data[6];
+	u8 data[ETH_ALEN];
 } __attribute__((packed));
 
 
@@ -568,7 +569,7 @@ struct uwb_rc_evt_confirm {
 /* Device Address Management event. [WHCI] section 3.1.3.2. */
 struct uwb_rc_evt_dev_addr_mgmt {
 	struct uwb_rceb rceb;
-	u8 baAddr[6];
+	u8 baAddr[ETH_ALEN];
 	u8 bResultCode;
 } __attribute__((packed));
 
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index 4a1191a..f7119ee 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -12,6 +12,8 @@ enum tveeprom_audio_processor {
 	TVEEPROM_AUDPROC_OTHER,
 };
 
+#include <linux/if_ether.h>
+
 struct tveeprom {
 	u32 has_radio;
 	/* If has_ir == 0, then it is unknown what the IR capabilities are,
@@ -40,7 +42,7 @@ struct tveeprom {
 	u32 revision;
 	u32 serial_number;
 	char rev_str[5];
-	u8 MAC_address[6];
+	u8 MAC_address[ETH_ALEN];
 };
 
 void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index 0af8b8d..550c2d6 100644
--- a/include/net/irda/irlan_common.h
+++ b/include/net/irda/irlan_common.h
@@ -32,6 +32,7 @@
 #include <linux/types.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <linux/if_ether.h>
 
 #include <net/irda/irttp.h>
 
@@ -161,7 +162,7 @@ struct irlan_provider_cb {
 	int access_type;     /* Access type */
 	__u16 send_arb_val;
 
-	__u8 mac_address[6]; /* Generated MAC address for peer device */
+	__u8 mac_address[ETH_ALEN]; /* Generated MAC address for peer device */
 };
 
 /*
-- 
1.8.1.2.459.gbcd45b4.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ethernet: Convert mac address uses of 6 to ETH_ALEN
  2013-07-29  5:29 [PATCH 0/3] networking: Use ETH_ALEN where appropriate Joe Perches
  2013-07-29  5:29 ` [PATCH 1/3] uapi: Convert some uses of 6 to ETH_ALEN Joe Perches
  2013-07-29  5:29 ` [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN Joe Perches
@ 2013-07-29  5:29 ` Joe Perches
  2 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2013-07-29  5:29 UTC (permalink / raw)
  To: netdev
  Cc: Don Fry, Grant Grundler, Sam Creasey, Andrew Gallatin,
	Wan ZongShun, Olof Johansson, Manish Chopra, Sony Chacko,
	Rajesh Borundia, Shahed Shaikh, Jitendra Kalsaria, Ron Mercer,
	linux-driver, linux-kernel, linux-arm-kernel

Use the normal #define to help grep find mac addresses
and ensure that addresses are aligned.

Move one address in pasemi_mac.h for alignment.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/ethernet/8390/ax88796.c                |  4 ++--
 drivers/net/ethernet/amd/pcnet32.c                 |  6 +++---
 drivers/net/ethernet/broadcom/cnic_if.h            |  6 +++---
 drivers/net/ethernet/dec/tulip/tulip_core.c        |  8 +++++---
 drivers/net/ethernet/i825xx/sun3_82586.h           |  4 ++--
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |  2 +-
 drivers/net/ethernet/nuvoton/w90p910_ether.c       |  4 ++--
 drivers/net/ethernet/pasemi/pasemi_mac.c           | 13 +++++++------
 drivers/net/ethernet/pasemi/pasemi_mac.h           |  4 ++--
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  4 ++--
 drivers/net/ethernet/qlogic/qlge/qlge.h            |  2 +-
 11 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index e1d2643..b7232a9 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -707,7 +707,7 @@ static int ax_init_dev(struct net_device *dev)
 
 #ifdef CONFIG_AX88796_93CX6
 	if (ax->plat->flags & AXFLG_HAS_93CX6) {
-		unsigned char mac_addr[6];
+		unsigned char mac_addr[ETH_ALEN];
 		struct eeprom_93cx6 eeprom;
 
 		eeprom.data = ei_local;
@@ -719,7 +719,7 @@ static int ax_init_dev(struct net_device *dev)
 				       (__le16 __force *)mac_addr,
 				       sizeof(mac_addr) >> 1);
 
-		memcpy(dev->dev_addr, mac_addr, 6);
+		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 	}
 #endif
 	if (ax->plat->wordlength == 2) {
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index ed21307..2d8e288 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1521,7 +1521,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 	char *chipname;
 	struct net_device *dev;
 	const struct pcnet32_access *a = NULL;
-	u8 promaddr[6];
+	u8 promaddr[ETH_ALEN];
 	int ret = -ENODEV;
 
 	/* reset the chip */
@@ -1665,10 +1665,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 	}
 
 	/* read PROM address and compare with CSR address */
-	for (i = 0; i < 6; i++)
+	for (i = 0; i < ETH_ALEN; i++)
 		promaddr[i] = inb(ioaddr + i);
 
-	if (memcmp(promaddr, dev->dev_addr, 6) ||
+	if (memcmp(promaddr, dev->dev_addr, ETH_ALEN) ||
 	    !is_valid_ether_addr(dev->dev_addr)) {
 		if (is_valid_ether_addr(promaddr)) {
 			if (pcnet32_debug & NETIF_MSG_PROBE) {
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h
index ec9bb9a..7902e0c 100644
--- a/drivers/net/ethernet/broadcom/cnic_if.h
+++ b/drivers/net/ethernet/broadcom/cnic_if.h
@@ -238,8 +238,8 @@ struct cnic_sock {
 	u16	src_port;
 	u16	dst_port;
 	u16	vlan_id;
-	unsigned char old_ha[6];
-	unsigned char ha[6];
+	unsigned char old_ha[ETH_ALEN];
+	unsigned char ha[ETH_ALEN];
 	u32	mtu;
 	u32	cid;
 	u32	l5_cid;
@@ -308,7 +308,7 @@ struct cnic_dev {
 #define CNIC_F_BNX2_CLASS	3
 #define CNIC_F_BNX2X_CLASS	4
 	atomic_t	ref_count;
-	u8		mac_addr[6];
+	u8		mac_addr[ETH_ALEN];
 
 	int		max_iscsi_conn;
 	int		max_fcoe_conn;
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index c94152f..4e8cfa2 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -1304,7 +1304,9 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct tulip_private *tp;
 	/* See note below on the multiport cards. */
-	static unsigned char last_phys_addr[6] = {0x00, 'L', 'i', 'n', 'u', 'x'};
+	static unsigned char last_phys_addr[ETH_ALEN] = {
+		0x00, 'L', 'i', 'n', 'u', 'x'
+	};
 	static int last_irq;
 	static int multiport_cnt;	/* For four-port boards w/one EEPROM */
 	int i, irq;
@@ -1627,8 +1629,8 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		dev->dev_addr[i] = last_phys_addr[i] + 1;
 #if defined(CONFIG_SPARC)
 		addr = of_get_property(dp, "local-mac-address", &len);
-		if (addr && len == 6)
-			memcpy(dev->dev_addr, addr, 6);
+		if (addr && len == ETH_ALEN)
+			memcpy(dev->dev_addr, addr, ETH_ALEN);
 #endif
 #if defined(__i386__) || defined(__x86_64__)	/* Patch up x86 BIOS bug. */
 		if (last_irq)
diff --git a/drivers/net/ethernet/i825xx/sun3_82586.h b/drivers/net/ethernet/i825xx/sun3_82586.h
index 93346f0..79aef68 100644
--- a/drivers/net/ethernet/i825xx/sun3_82586.h
+++ b/drivers/net/ethernet/i825xx/sun3_82586.h
@@ -133,8 +133,8 @@ struct rfd_struct
   unsigned char  last;		/* Bit15,Last Frame on List / Bit14,suspend */
   unsigned short next;		/* linkoffset to next RFD */
   unsigned short rbd_offset;	/* pointeroffset to RBD-buffer */
-  unsigned char  dest[6];	/* ethernet-address, destination */
-  unsigned char  source[6];	/* ethernet-address, source */
+  unsigned char  dest[ETH_ALEN];	/* ethernet-address, destination */
+  unsigned char  source[ETH_ALEN];	/* ethernet-address, source */
   unsigned short length;	/* 802.3 frame-length */
   unsigned short zero_dummy;	/* dummy */
 };
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 967bae8..d4cdf4d 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -244,7 +244,7 @@ struct myri10ge_priv {
 	int fw_ver_minor;
 	int fw_ver_tiny;
 	int adopted_rx_filter_bug;
-	u8 mac_addr[6];		/* eeprom mac address */
+	u8 mac_addr[ETH_ALEN];		/* eeprom mac address */
 	unsigned long serial_number;
 	int vendor_specific_offset;
 	int fw_multicast_support;
diff --git a/drivers/net/ethernet/nuvoton/w90p910_ether.c b/drivers/net/ethernet/nuvoton/w90p910_ether.c
index e88bdb1..dcfe58f 100644
--- a/drivers/net/ethernet/nuvoton/w90p910_ether.c
+++ b/drivers/net/ethernet/nuvoton/w90p910_ether.c
@@ -922,7 +922,7 @@ static void __init get_mac_address(struct net_device *dev)
 {
 	struct w90p910_ether *ether = netdev_priv(dev);
 	struct platform_device *pdev;
-	char addr[6];
+	char addr[ETH_ALEN];
 
 	pdev = ether->pdev;
 
@@ -934,7 +934,7 @@ static void __init get_mac_address(struct net_device *dev)
 	addr[5] = 0xa8;
 
 	if (is_valid_ether_addr(addr))
-		memcpy(dev->dev_addr, &addr, 0x06);
+		memcpy(dev->dev_addr, &addr, ETH_ALEN);
 	else
 		dev_err(&pdev->dev, "invalid mac address\n");
 }
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index a5f0b5d..f21ae7b 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -191,7 +191,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
 	struct device_node *dn = pci_device_to_OF_node(pdev);
 	int len;
 	const u8 *maddr;
-	u8 addr[6];
+	u8 addr[ETH_ALEN];
 
 	if (!dn) {
 		dev_dbg(&pdev->dev,
@@ -201,8 +201,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
 
 	maddr = of_get_property(dn, "local-mac-address", &len);
 
-	if (maddr && len == 6) {
-		memcpy(mac->mac_addr, maddr, 6);
+	if (maddr && len == ETH_ALEN) {
+		memcpy(mac->mac_addr, maddr, ETH_ALEN);
 		return 0;
 	}
 
@@ -219,14 +219,15 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
 		return -ENOENT;
 	}
 
-	if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0],
-		   &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) {
+	if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
+		   &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
+	    != ETH_ALEN) {
 		dev_warn(&pdev->dev,
 			 "can't parse mac address, not configuring\n");
 		return -EINVAL;
 	}
 
-	memcpy(mac->mac_addr, addr, 6);
+	memcpy(mac->mac_addr, addr, ETH_ALEN);
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.h b/drivers/net/ethernet/pasemi/pasemi_mac.h
index e2f4efa..649fdb4 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.h
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.h
@@ -79,11 +79,11 @@ struct pasemi_mac {
 	int		last_cs;
 	int		num_cs;
 	u32		dma_if;
-	u8		type;
 #define MAC_TYPE_GMAC	1
 #define MAC_TYPE_XAUI	2
 
-	u8		mac_addr[6];
+	u8		mac_addr[ETH_ALEN];
+	u8		type;
 
 	struct net_lro_mgr	lro_mgr;
 	struct net_lro_desc	lro_desc[MAX_LRO_DESCRIPTORS];
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index 9fbb1cd..8375cbd 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -536,10 +536,10 @@ static void netxen_p2_nic_set_multi(struct net_device *netdev)
 {
 	struct netxen_adapter *adapter = netdev_priv(netdev);
 	struct netdev_hw_addr *ha;
-	u8 null_addr[6];
+	u8 null_addr[ETH_ALEN];
 	int i;
 
-	memset(null_addr, 0, 6);
+	memset(null_addr, 0, ETH_ALEN);
 
 	if (netdev->flags & IFF_PROMISC) {
 
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h
index 7e8d682..8994337 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge.h
+++ b/drivers/net/ethernet/qlogic/qlge/qlge.h
@@ -2149,7 +2149,7 @@ struct ql_adapter {
 	struct timer_list timer;
 	atomic_t lb_count;
 	/* Keep local copy of current mac address. */
-	char current_mac_addr[6];
+	char current_mac_addr[ETH_ALEN];
 };
 
 /*
-- 
1.8.1.2.459.gbcd45b4.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN
  2013-07-29  5:29 ` [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN Joe Perches
@ 2013-07-29 11:59   ` Rafael J. Wysocki
  2013-07-29 19:34     ` Joe Perches
  2013-08-01 17:50   ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2013-07-29 11:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, Len Brown, Pantelis Antoniou, Vitaly Bordug,
	Steve Glendinning, Mauro Carvalho Chehab, Samuel Ortiz,
	David S. Miller, linux-acpi, linux-kernel, linuxppc-dev,
	linux-usb, linux-media

On Sunday, July 28, 2013 10:29:04 PM Joe Perches wrote:
> It's convenient to have ethernet mac addresses use
> ETH_ALEN to be able to grep for them a bit easier and
> also to ensure that the addresses are __aligned(2).
> 
> Add #include <linux/if_ether.h> as necessary.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  include/acpi/actbl2.h           |  4 ++-
>  include/linux/dm9000.h          |  4 ++-
>  include/linux/fs_enet_pd.h      |  3 ++-
>  include/linux/ieee80211.h       | 59 +++++++++++++++++++++--------------------
>  include/linux/mlx4/device.h     | 11 ++++----
>  include/linux/mlx4/qp.h         |  5 ++--
>  include/linux/mv643xx_eth.h     |  3 ++-
>  include/linux/sh_eth.h          |  3 ++-
>  include/linux/smsc911x.h        |  3 ++-
>  include/linux/uwb/spec.h        |  5 ++--
>  include/media/tveeprom.h        |  4 ++-
>  include/net/irda/irlan_common.h |  3 ++-
>  12 files changed, 61 insertions(+), 46 deletions(-)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index ffaac0e..3f0f11c 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -44,6 +44,8 @@
>  #ifndef __ACTBL2_H__
>  #define __ACTBL2_H__
>  
> +#include <linux/if_ether.h>
> +
>  /*******************************************************************************
>   *
>   * Additional ACPI Tables (2)
> @@ -605,7 +607,7 @@ struct acpi_ibft_nic {
>  	u8 secondary_dns[16];
>  	u8 dhcp[16];
>  	u16 vlan;
> -	u8 mac_address[6];
> +	u8 mac_address[ETH_ALEN];
>  	u16 pci_address;
>  	u16 name_length;
>  	u16 name_offset;

Please don't touch this file.

It comes from a code base outside of the kernel and should be kept in sync with
the upstream.

Thanks,
Rafael


> diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
> index 96e8769..841925f 100644
> --- a/include/linux/dm9000.h
> +++ b/include/linux/dm9000.h
> @@ -14,6 +14,8 @@
>  #ifndef __DM9000_PLATFORM_DATA
>  #define __DM9000_PLATFORM_DATA __FILE__
>  
> +#include <linux/if_ether.h>
> +
>  /* IO control flags */
>  
>  #define DM9000_PLATF_8BITONLY	(0x0001)
> @@ -27,7 +29,7 @@
>  
>  struct dm9000_plat_data {
>  	unsigned int	flags;
> -	unsigned char	dev_addr[6];
> +	unsigned char	dev_addr[ETH_ALEN];
>  
>  	/* allow replacement IO routines */
>  
> diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
> index 51b7934..343d82a 100644
> --- a/include/linux/fs_enet_pd.h
> +++ b/include/linux/fs_enet_pd.h
> @@ -18,6 +18,7 @@
>  
>  #include <linux/string.h>
>  #include <linux/of_mdio.h>
> +#include <linux/if_ether.h>
>  #include <asm/types.h>
>  
>  #define FS_ENET_NAME	"fs_enet"
> @@ -135,7 +136,7 @@ struct fs_platform_info {
>  	const struct fs_mii_bus_info *bus_info;
>  
>  	int rx_ring, tx_ring;	/* number of buffers on rx     */
> -	__u8 macaddr[6];	/* mac address                 */
> +	__u8 macaddr[ETH_ALEN];	/* mac address                 */
>  	int rx_copybreak;	/* limit we copy small frames  */
>  	int use_napi;		/* use NAPI                    */
>  	int napi_weight;	/* NAPI weight                 */
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index b0dc87a..4e101af 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -16,6 +16,7 @@
>  #define LINUX_IEEE80211_H
>  
>  #include <linux/types.h>
> +#include <linux/if_ether.h>
>  #include <asm/byteorder.h>
>  
>  /*
> @@ -209,28 +210,28 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
>  struct ieee80211_hdr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
> -	u8 addr4[6];
> +	u8 addr4[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_hdr_3addr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
>  } __packed __aligned(2);
>  
>  struct ieee80211_qos_hdr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
>  	__le16 qos_ctrl;
>  } __packed __aligned(2);
> @@ -608,8 +609,8 @@ struct ieee80211s_hdr {
>  	u8 flags;
>  	u8 ttl;
>  	__le32 seqnum;
> -	u8 eaddr1[6];
> -	u8 eaddr2[6];
> +	u8 eaddr1[ETH_ALEN];
> +	u8 eaddr2[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  /* Mesh flags */
> @@ -758,7 +759,7 @@ struct ieee80211_rann_ie {
>  	u8 rann_flags;
>  	u8 rann_hopcount;
>  	u8 rann_ttl;
> -	u8 rann_addr[6];
> +	u8 rann_addr[ETH_ALEN];
>  	__le32 rann_seq;
>  	__le32 rann_interval;
>  	__le32 rann_metric;
> @@ -802,9 +803,9 @@ enum ieee80211_vht_opmode_bits {
>  struct ieee80211_mgmt {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 da[6];
> -	u8 sa[6];
> -	u8 bssid[6];
> +	u8 da[ETH_ALEN];
> +	u8 sa[ETH_ALEN];
> +	u8 bssid[ETH_ALEN];
>  	__le16 seq_ctrl;
>  	union {
>  		struct {
> @@ -833,7 +834,7 @@ struct ieee80211_mgmt {
>  		struct {
>  			__le16 capab_info;
>  			__le16 listen_interval;
> -			u8 current_ap[6];
> +			u8 current_ap[ETH_ALEN];
>  			/* followed by SSID and Supported rates */
>  			u8 variable[0];
>  		} __packed reassoc_req;
> @@ -966,21 +967,21 @@ struct ieee80211_vendor_ie {
>  struct ieee80211_rts {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 ra[6];
> -	u8 ta[6];
> +	u8 ra[ETH_ALEN];
> +	u8 ta[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_cts {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 ra[6];
> +	u8 ra[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_pspoll {
>  	__le16 frame_control;
>  	__le16 aid;
> -	u8 bssid[6];
> -	u8 ta[6];
> +	u8 bssid[ETH_ALEN];
> +	u8 ta[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  /* TDLS */
> @@ -989,14 +990,14 @@ struct ieee80211_pspoll {
>  struct ieee80211_tdls_lnkie {
>  	u8 ie_type; /* Link Identifier IE */
>  	u8 ie_len;
> -	u8 bssid[6];
> -	u8 init_sta[6];
> -	u8 resp_sta[6];
> +	u8 bssid[ETH_ALEN];
> +	u8 init_sta[ETH_ALEN];
> +	u8 resp_sta[ETH_ALEN];
>  } __packed;
>  
>  struct ieee80211_tdls_data {
> -	u8 da[6];
> -	u8 sa[6];
> +	u8 da[ETH_ALEN];
> +	u8 sa[ETH_ALEN];
>  	__be16 ether_type;
>  	u8 payload_type;
>  	u8 category;
> @@ -1090,8 +1091,8 @@ struct ieee80211_p2p_noa_attr {
>  struct ieee80211_bar {
>  	__le16 frame_control;
>  	__le16 duration;
> -	__u8 ra[6];
> -	__u8 ta[6];
> +	__u8 ra[ETH_ALEN];
> +	__u8 ta[ETH_ALEN];
>  	__le16 control;
>  	__le16 start_seq_num;
>  } __packed;
> diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
> index 52c23a8..e37ac2b 100644
> --- a/include/linux/mlx4/device.h
> +++ b/include/linux/mlx4/device.h
> @@ -33,6 +33,7 @@
>  #ifndef MLX4_DEVICE_H
>  #define MLX4_DEVICE_H
>  
> +#include <linux/if_ether.h>
>  #include <linux/pci.h>
>  #include <linux/completion.h>
>  #include <linux/radix-tree.h>
> @@ -619,7 +620,7 @@ struct mlx4_eth_av {
>  	u8		dgid[16];
>  	u32		reserved4[2];
>  	__be16		vlan;
> -	u8		mac[6];
> +	u8		mac[ETH_ALEN];
>  };
>  
>  union mlx4_ext_av {
> @@ -913,10 +914,10 @@ enum mlx4_net_trans_promisc_mode {
>  };
>  
>  struct mlx4_spec_eth {
> -	u8	dst_mac[6];
> -	u8	dst_mac_msk[6];
> -	u8	src_mac[6];
> -	u8	src_mac_msk[6];
> +	u8	dst_mac[ETH_ALEN];
> +	u8	dst_mac_msk[ETH_ALEN];
> +	u8	src_mac[ETH_ALEN];
> +	u8	src_mac_msk[ETH_ALEN];
>  	u8	ether_type_enable;
>  	__be16	ether_type;
>  	__be16	vlan_id_msk;
> diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
> index 262deac..6d35147 100644
> --- a/include/linux/mlx4/qp.h
> +++ b/include/linux/mlx4/qp.h
> @@ -34,6 +34,7 @@
>  #define MLX4_QP_H
>  
>  #include <linux/types.h>
> +#include <linux/if_ether.h>
>  
>  #include <linux/mlx4/device.h>
>  
> @@ -143,7 +144,7 @@ struct mlx4_qp_path {
>  	u8			feup;
>  	u8			fvl_rx;
>  	u8			reserved4[2];
> -	u8			dmac[6];
> +	u8			dmac[ETH_ALEN];
>  };
>  
>  enum { /* fl */
> @@ -318,7 +319,7 @@ struct mlx4_wqe_datagram_seg {
>  	__be32			dqpn;
>  	__be32			qkey;
>  	__be16			vlan;
> -	u8			mac[6];
> +	u8			mac[ETH_ALEN];
>  };
>  
>  struct mlx4_wqe_lso_seg {
> diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
> index 6e8215b..61a0da3 100644
> --- a/include/linux/mv643xx_eth.h
> +++ b/include/linux/mv643xx_eth.h
> @@ -6,6 +6,7 @@
>  #define __LINUX_MV643XX_ETH_H
>  
>  #include <linux/mbus.h>
> +#include <linux/if_ether.h>
>  
>  #define MV643XX_ETH_SHARED_NAME		"mv643xx_eth"
>  #define MV643XX_ETH_NAME		"mv643xx_eth_port"
> @@ -48,7 +49,7 @@ struct mv643xx_eth_platform_data {
>  	 * Use this MAC address if it is valid, overriding the
>  	 * address that is already in the hardware.
>  	 */
> -	u8			mac_addr[6];
> +	u8			mac_addr[ETH_ALEN];
>  
>  	/*
>  	 * If speed is 0, autonegotiation is enabled.
> diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
> index fc30571..6205eeb 100644
> --- a/include/linux/sh_eth.h
> +++ b/include/linux/sh_eth.h
> @@ -2,6 +2,7 @@
>  #define __ASM_SH_ETH_H__
>  
>  #include <linux/phy.h>
> +#include <linux/if_ether.h>
>  
>  enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
>  enum {
> @@ -18,7 +19,7 @@ struct sh_eth_plat_data {
>  	phy_interface_t phy_interface;
>  	void (*set_mdio_gate)(void *addr);
>  
> -	unsigned char mac_addr[6];
> +	unsigned char mac_addr[ETH_ALEN];
>  	unsigned no_ether_link:1;
>  	unsigned ether_link_active_low:1;
>  	unsigned needs_init:1;
> diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
> index 4dde70e..eec3efd 100644
> --- a/include/linux/smsc911x.h
> +++ b/include/linux/smsc911x.h
> @@ -22,6 +22,7 @@
>  #define __LINUX_SMSC911X_H__
>  
>  #include <linux/phy.h>
> +#include <linux/if_ether.h>
>  
>  /* platform_device configuration data, should be assigned to
>   * the platform_device's dev.platform_data */
> @@ -31,7 +32,7 @@ struct smsc911x_platform_config {
>  	unsigned int flags;
>  	unsigned int shift;
>  	phy_interface_t phy_interface;
> -	unsigned char mac[6];
> +	unsigned char mac[ETH_ALEN];
>  };
>  
>  /* Constants for platform_device irq polarity configuration */
> diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
> index b52e44f..0df24bf 100644
> --- a/include/linux/uwb/spec.h
> +++ b/include/linux/uwb/spec.h
> @@ -32,6 +32,7 @@
>  
>  #include <linux/types.h>
>  #include <linux/bitmap.h>
> +#include <linux/if_ether.h>
>  
>  #define i1480_FW 0x00000303
>  /* #define i1480_FW 0x00000302 */
> @@ -130,7 +131,7 @@ enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
>   * it is also used to define headers sent down and up the wire/radio).
>   */
>  struct uwb_mac_addr {
> -	u8 data[6];
> +	u8 data[ETH_ALEN];
>  } __attribute__((packed));
>  
>  
> @@ -568,7 +569,7 @@ struct uwb_rc_evt_confirm {
>  /* Device Address Management event. [WHCI] section 3.1.3.2. */
>  struct uwb_rc_evt_dev_addr_mgmt {
>  	struct uwb_rceb rceb;
> -	u8 baAddr[6];
> +	u8 baAddr[ETH_ALEN];
>  	u8 bResultCode;
>  } __attribute__((packed));
>  
> diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
> index 4a1191a..f7119ee 100644
> --- a/include/media/tveeprom.h
> +++ b/include/media/tveeprom.h
> @@ -12,6 +12,8 @@ enum tveeprom_audio_processor {
>  	TVEEPROM_AUDPROC_OTHER,
>  };
>  
> +#include <linux/if_ether.h>
> +
>  struct tveeprom {
>  	u32 has_radio;
>  	/* If has_ir == 0, then it is unknown what the IR capabilities are,
> @@ -40,7 +42,7 @@ struct tveeprom {
>  	u32 revision;
>  	u32 serial_number;
>  	char rev_str[5];
> -	u8 MAC_address[6];
> +	u8 MAC_address[ETH_ALEN];
>  };
>  
>  void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
> diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
> index 0af8b8d..550c2d6 100644
> --- a/include/net/irda/irlan_common.h
> +++ b/include/net/irda/irlan_common.h
> @@ -32,6 +32,7 @@
>  #include <linux/types.h>
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
> +#include <linux/if_ether.h>
>  
>  #include <net/irda/irttp.h>
>  
> @@ -161,7 +162,7 @@ struct irlan_provider_cb {
>  	int access_type;     /* Access type */
>  	__u16 send_arb_val;
>  
> -	__u8 mac_address[6]; /* Generated MAC address for peer device */
> +	__u8 mac_address[ETH_ALEN]; /* Generated MAC address for peer device */
>  };
>  
>  /*
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN
  2013-07-29 11:59   ` Rafael J. Wysocki
@ 2013-07-29 19:34     ` Joe Perches
  2013-07-29 20:06       ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2013-07-29 19:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: netdev, Len Brown, Pantelis Antoniou, Vitaly Bordug,
	Steve Glendinning, Mauro Carvalho Chehab, Samuel Ortiz,
	David S. Miller, linux-acpi, linux-kernel, linuxppc-dev,
	linux-usb, linux-media

On Mon, 2013-07-29 at 13:59 +0200, Rafael J. Wysocki wrote:
> On Sunday, July 28, 2013 10:29:04 PM Joe Perches wrote:
> > It's convenient to have ethernet mac addresses use
> > ETH_ALEN to be able to grep for them a bit easier and
> > also to ensure that the addresses are __aligned(2).
[]
> > diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
[]
> > @@ -44,6 +44,8 @@
[]
> > +#include <linux/if_ether.h>
> > +
[]
> > @@ -605,7 +607,7 @@ struct acpi_ibft_nic {
[]
> > -	u8 mac_address[6];
> > +	u8 mac_address[ETH_ALEN];

> Please don't touch this file.
> 
> It comes from a code base outside of the kernel and should be kept in sync with
> the upstream.

Which files in include/acpi have this characteristic?
Perhaps an include/acpi/README is appropriate.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN
  2013-07-29 19:34     ` Joe Perches
@ 2013-07-29 20:06       ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2013-07-29 20:06 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, Len Brown, Pantelis Antoniou, Vitaly Bordug,
	Steve Glendinning, Mauro Carvalho Chehab, Samuel Ortiz,
	David S. Miller, linux-acpi, linux-kernel, linuxppc-dev,
	linux-usb, linux-media

On Monday, July 29, 2013 12:34:24 PM Joe Perches wrote:
> On Mon, 2013-07-29 at 13:59 +0200, Rafael J. Wysocki wrote:
> > On Sunday, July 28, 2013 10:29:04 PM Joe Perches wrote:
> > > It's convenient to have ethernet mac addresses use
> > > ETH_ALEN to be able to grep for them a bit easier and
> > > also to ensure that the addresses are __aligned(2).
> []
> > > diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> []
> > > @@ -44,6 +44,8 @@
> []
> > > +#include <linux/if_ether.h>
> > > +
> []
> > > @@ -605,7 +607,7 @@ struct acpi_ibft_nic {
> []
> > > -	u8 mac_address[6];
> > > +	u8 mac_address[ETH_ALEN];
> 
> > Please don't touch this file.
> > 
> > It comes from a code base outside of the kernel and should be kept in sync with
> > the upstream.
> 
> Which files in include/acpi have this characteristic?

Generally, all whose names start with "ac" except for acpi_bus.h,
acpi_drivers.h and acpi_numa.h.

> Perhaps an include/acpi/README is appropriate.

Yes, we can add one.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN
  2013-07-29  5:29 ` [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN Joe Perches
  2013-07-29 11:59   ` Rafael J. Wysocki
@ 2013-08-01 17:50   ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2013-08-01 17:50 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, Len Brown, Rafael J. Wysocki, Pantelis Antoniou,
	Vitaly Bordug, Steve Glendinning, Samuel Ortiz, David S. Miller,
	linux-acpi, linux-kernel, linuxppc-dev, linux-usb, linux-media

Em Sun, 28 Jul 2013 22:29:04 -0700
Joe Perches <joe@perches.com> escreveu:

> It's convenient to have ethernet mac addresses use
> ETH_ALEN to be able to grep for them a bit easier and
> also to ensure that the addresses are __aligned(2).
> 
> Add #include <linux/if_ether.h> as necessary.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  include/acpi/actbl2.h           |  4 ++-
>  include/linux/dm9000.h          |  4 ++-
>  include/linux/fs_enet_pd.h      |  3 ++-
>  include/linux/ieee80211.h       | 59 +++++++++++++++++++++--------------------
>  include/linux/mlx4/device.h     | 11 ++++----
>  include/linux/mlx4/qp.h         |  5 ++--
>  include/linux/mv643xx_eth.h     |  3 ++-
>  include/linux/sh_eth.h          |  3 ++-
>  include/linux/smsc911x.h        |  3 ++-
>  include/linux/uwb/spec.h        |  5 ++--
>  include/media/tveeprom.h        |  4 ++-

I'm ok with the change at media/tveeprom.h.

Please add my ack on the next version after handling Rafael's request
on acpi.

Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

>  include/net/irda/irlan_common.h |  3 ++-
>  12 files changed, 61 insertions(+), 46 deletions(-)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index ffaac0e..3f0f11c 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -44,6 +44,8 @@
>  #ifndef __ACTBL2_H__
>  #define __ACTBL2_H__
>  
> +#include <linux/if_ether.h>
> +
>  /*******************************************************************************
>   *
>   * Additional ACPI Tables (2)
> @@ -605,7 +607,7 @@ struct acpi_ibft_nic {
>  	u8 secondary_dns[16];
>  	u8 dhcp[16];
>  	u16 vlan;
> -	u8 mac_address[6];
> +	u8 mac_address[ETH_ALEN];
>  	u16 pci_address;
>  	u16 name_length;
>  	u16 name_offset;
> diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
> index 96e8769..841925f 100644
> --- a/include/linux/dm9000.h
> +++ b/include/linux/dm9000.h
> @@ -14,6 +14,8 @@
>  #ifndef __DM9000_PLATFORM_DATA
>  #define __DM9000_PLATFORM_DATA __FILE__
>  
> +#include <linux/if_ether.h>
> +
>  /* IO control flags */
>  
>  #define DM9000_PLATF_8BITONLY	(0x0001)
> @@ -27,7 +29,7 @@
>  
>  struct dm9000_plat_data {
>  	unsigned int	flags;
> -	unsigned char	dev_addr[6];
> +	unsigned char	dev_addr[ETH_ALEN];
>  
>  	/* allow replacement IO routines */
>  
> diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
> index 51b7934..343d82a 100644
> --- a/include/linux/fs_enet_pd.h
> +++ b/include/linux/fs_enet_pd.h
> @@ -18,6 +18,7 @@
>  
>  #include <linux/string.h>
>  #include <linux/of_mdio.h>
> +#include <linux/if_ether.h>
>  #include <asm/types.h>
>  
>  #define FS_ENET_NAME	"fs_enet"
> @@ -135,7 +136,7 @@ struct fs_platform_info {
>  	const struct fs_mii_bus_info *bus_info;
>  
>  	int rx_ring, tx_ring;	/* number of buffers on rx     */
> -	__u8 macaddr[6];	/* mac address                 */
> +	__u8 macaddr[ETH_ALEN];	/* mac address                 */
>  	int rx_copybreak;	/* limit we copy small frames  */
>  	int use_napi;		/* use NAPI                    */
>  	int napi_weight;	/* NAPI weight                 */
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index b0dc87a..4e101af 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -16,6 +16,7 @@
>  #define LINUX_IEEE80211_H
>  
>  #include <linux/types.h>
> +#include <linux/if_ether.h>
>  #include <asm/byteorder.h>
>  
>  /*
> @@ -209,28 +210,28 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
>  struct ieee80211_hdr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
> -	u8 addr4[6];
> +	u8 addr4[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_hdr_3addr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
>  } __packed __aligned(2);
>  
>  struct ieee80211_qos_hdr {
>  	__le16 frame_control;
>  	__le16 duration_id;
> -	u8 addr1[6];
> -	u8 addr2[6];
> -	u8 addr3[6];
> +	u8 addr1[ETH_ALEN];
> +	u8 addr2[ETH_ALEN];
> +	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctrl;
>  	__le16 qos_ctrl;
>  } __packed __aligned(2);
> @@ -608,8 +609,8 @@ struct ieee80211s_hdr {
>  	u8 flags;
>  	u8 ttl;
>  	__le32 seqnum;
> -	u8 eaddr1[6];
> -	u8 eaddr2[6];
> +	u8 eaddr1[ETH_ALEN];
> +	u8 eaddr2[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  /* Mesh flags */
> @@ -758,7 +759,7 @@ struct ieee80211_rann_ie {
>  	u8 rann_flags;
>  	u8 rann_hopcount;
>  	u8 rann_ttl;
> -	u8 rann_addr[6];
> +	u8 rann_addr[ETH_ALEN];
>  	__le32 rann_seq;
>  	__le32 rann_interval;
>  	__le32 rann_metric;
> @@ -802,9 +803,9 @@ enum ieee80211_vht_opmode_bits {
>  struct ieee80211_mgmt {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 da[6];
> -	u8 sa[6];
> -	u8 bssid[6];
> +	u8 da[ETH_ALEN];
> +	u8 sa[ETH_ALEN];
> +	u8 bssid[ETH_ALEN];
>  	__le16 seq_ctrl;
>  	union {
>  		struct {
> @@ -833,7 +834,7 @@ struct ieee80211_mgmt {
>  		struct {
>  			__le16 capab_info;
>  			__le16 listen_interval;
> -			u8 current_ap[6];
> +			u8 current_ap[ETH_ALEN];
>  			/* followed by SSID and Supported rates */
>  			u8 variable[0];
>  		} __packed reassoc_req;
> @@ -966,21 +967,21 @@ struct ieee80211_vendor_ie {
>  struct ieee80211_rts {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 ra[6];
> -	u8 ta[6];
> +	u8 ra[ETH_ALEN];
> +	u8 ta[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_cts {
>  	__le16 frame_control;
>  	__le16 duration;
> -	u8 ra[6];
> +	u8 ra[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  struct ieee80211_pspoll {
>  	__le16 frame_control;
>  	__le16 aid;
> -	u8 bssid[6];
> -	u8 ta[6];
> +	u8 bssid[ETH_ALEN];
> +	u8 ta[ETH_ALEN];
>  } __packed __aligned(2);
>  
>  /* TDLS */
> @@ -989,14 +990,14 @@ struct ieee80211_pspoll {
>  struct ieee80211_tdls_lnkie {
>  	u8 ie_type; /* Link Identifier IE */
>  	u8 ie_len;
> -	u8 bssid[6];
> -	u8 init_sta[6];
> -	u8 resp_sta[6];
> +	u8 bssid[ETH_ALEN];
> +	u8 init_sta[ETH_ALEN];
> +	u8 resp_sta[ETH_ALEN];
>  } __packed;
>  
>  struct ieee80211_tdls_data {
> -	u8 da[6];
> -	u8 sa[6];
> +	u8 da[ETH_ALEN];
> +	u8 sa[ETH_ALEN];
>  	__be16 ether_type;
>  	u8 payload_type;
>  	u8 category;
> @@ -1090,8 +1091,8 @@ struct ieee80211_p2p_noa_attr {
>  struct ieee80211_bar {
>  	__le16 frame_control;
>  	__le16 duration;
> -	__u8 ra[6];
> -	__u8 ta[6];
> +	__u8 ra[ETH_ALEN];
> +	__u8 ta[ETH_ALEN];
>  	__le16 control;
>  	__le16 start_seq_num;
>  } __packed;
> diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
> index 52c23a8..e37ac2b 100644
> --- a/include/linux/mlx4/device.h
> +++ b/include/linux/mlx4/device.h
> @@ -33,6 +33,7 @@
>  #ifndef MLX4_DEVICE_H
>  #define MLX4_DEVICE_H
>  
> +#include <linux/if_ether.h>
>  #include <linux/pci.h>
>  #include <linux/completion.h>
>  #include <linux/radix-tree.h>
> @@ -619,7 +620,7 @@ struct mlx4_eth_av {
>  	u8		dgid[16];
>  	u32		reserved4[2];
>  	__be16		vlan;
> -	u8		mac[6];
> +	u8		mac[ETH_ALEN];
>  };
>  
>  union mlx4_ext_av {
> @@ -913,10 +914,10 @@ enum mlx4_net_trans_promisc_mode {
>  };
>  
>  struct mlx4_spec_eth {
> -	u8	dst_mac[6];
> -	u8	dst_mac_msk[6];
> -	u8	src_mac[6];
> -	u8	src_mac_msk[6];
> +	u8	dst_mac[ETH_ALEN];
> +	u8	dst_mac_msk[ETH_ALEN];
> +	u8	src_mac[ETH_ALEN];
> +	u8	src_mac_msk[ETH_ALEN];
>  	u8	ether_type_enable;
>  	__be16	ether_type;
>  	__be16	vlan_id_msk;
> diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
> index 262deac..6d35147 100644
> --- a/include/linux/mlx4/qp.h
> +++ b/include/linux/mlx4/qp.h
> @@ -34,6 +34,7 @@
>  #define MLX4_QP_H
>  
>  #include <linux/types.h>
> +#include <linux/if_ether.h>
>  
>  #include <linux/mlx4/device.h>
>  
> @@ -143,7 +144,7 @@ struct mlx4_qp_path {
>  	u8			feup;
>  	u8			fvl_rx;
>  	u8			reserved4[2];
> -	u8			dmac[6];
> +	u8			dmac[ETH_ALEN];
>  };
>  
>  enum { /* fl */
> @@ -318,7 +319,7 @@ struct mlx4_wqe_datagram_seg {
>  	__be32			dqpn;
>  	__be32			qkey;
>  	__be16			vlan;
> -	u8			mac[6];
> +	u8			mac[ETH_ALEN];
>  };
>  
>  struct mlx4_wqe_lso_seg {
> diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
> index 6e8215b..61a0da3 100644
> --- a/include/linux/mv643xx_eth.h
> +++ b/include/linux/mv643xx_eth.h
> @@ -6,6 +6,7 @@
>  #define __LINUX_MV643XX_ETH_H
>  
>  #include <linux/mbus.h>
> +#include <linux/if_ether.h>
>  
>  #define MV643XX_ETH_SHARED_NAME		"mv643xx_eth"
>  #define MV643XX_ETH_NAME		"mv643xx_eth_port"
> @@ -48,7 +49,7 @@ struct mv643xx_eth_platform_data {
>  	 * Use this MAC address if it is valid, overriding the
>  	 * address that is already in the hardware.
>  	 */
> -	u8			mac_addr[6];
> +	u8			mac_addr[ETH_ALEN];
>  
>  	/*
>  	 * If speed is 0, autonegotiation is enabled.
> diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
> index fc30571..6205eeb 100644
> --- a/include/linux/sh_eth.h
> +++ b/include/linux/sh_eth.h
> @@ -2,6 +2,7 @@
>  #define __ASM_SH_ETH_H__
>  
>  #include <linux/phy.h>
> +#include <linux/if_ether.h>
>  
>  enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
>  enum {
> @@ -18,7 +19,7 @@ struct sh_eth_plat_data {
>  	phy_interface_t phy_interface;
>  	void (*set_mdio_gate)(void *addr);
>  
> -	unsigned char mac_addr[6];
> +	unsigned char mac_addr[ETH_ALEN];
>  	unsigned no_ether_link:1;
>  	unsigned ether_link_active_low:1;
>  	unsigned needs_init:1;
> diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
> index 4dde70e..eec3efd 100644
> --- a/include/linux/smsc911x.h
> +++ b/include/linux/smsc911x.h
> @@ -22,6 +22,7 @@
>  #define __LINUX_SMSC911X_H__
>  
>  #include <linux/phy.h>
> +#include <linux/if_ether.h>
>  
>  /* platform_device configuration data, should be assigned to
>   * the platform_device's dev.platform_data */
> @@ -31,7 +32,7 @@ struct smsc911x_platform_config {
>  	unsigned int flags;
>  	unsigned int shift;
>  	phy_interface_t phy_interface;
> -	unsigned char mac[6];
> +	unsigned char mac[ETH_ALEN];
>  };
>  
>  /* Constants for platform_device irq polarity configuration */
> diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
> index b52e44f..0df24bf 100644
> --- a/include/linux/uwb/spec.h
> +++ b/include/linux/uwb/spec.h
> @@ -32,6 +32,7 @@
>  
>  #include <linux/types.h>
>  #include <linux/bitmap.h>
> +#include <linux/if_ether.h>
>  
>  #define i1480_FW 0x00000303
>  /* #define i1480_FW 0x00000302 */
> @@ -130,7 +131,7 @@ enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
>   * it is also used to define headers sent down and up the wire/radio).
>   */
>  struct uwb_mac_addr {
> -	u8 data[6];
> +	u8 data[ETH_ALEN];
>  } __attribute__((packed));
>  
>  
> @@ -568,7 +569,7 @@ struct uwb_rc_evt_confirm {
>  /* Device Address Management event. [WHCI] section 3.1.3.2. */
>  struct uwb_rc_evt_dev_addr_mgmt {
>  	struct uwb_rceb rceb;
> -	u8 baAddr[6];
> +	u8 baAddr[ETH_ALEN];
>  	u8 bResultCode;
>  } __attribute__((packed));
>  
> diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
> index 4a1191a..f7119ee 100644
> --- a/include/media/tveeprom.h
> +++ b/include/media/tveeprom.h
> @@ -12,6 +12,8 @@ enum tveeprom_audio_processor {
>  	TVEEPROM_AUDPROC_OTHER,
>  };
>  
> +#include <linux/if_ether.h>
> +
>  struct tveeprom {
>  	u32 has_radio;
>  	/* If has_ir == 0, then it is unknown what the IR capabilities are,
> @@ -40,7 +42,7 @@ struct tveeprom {
>  	u32 revision;
>  	u32 serial_number;
>  	char rev_str[5];
> -	u8 MAC_address[6];
> +	u8 MAC_address[ETH_ALEN];
>  };
>  
>  void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
> diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
> index 0af8b8d..550c2d6 100644
> --- a/include/net/irda/irlan_common.h
> +++ b/include/net/irda/irlan_common.h
> @@ -32,6 +32,7 @@
>  #include <linux/types.h>
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
> +#include <linux/if_ether.h>
>  
>  #include <net/irda/irttp.h>
>  
> @@ -161,7 +162,7 @@ struct irlan_provider_cb {
>  	int access_type;     /* Access type */
>  	__u16 send_arb_val;
>  
> -	__u8 mac_address[6]; /* Generated MAC address for peer device */
> +	__u8 mac_address[ETH_ALEN]; /* Generated MAC address for peer device */
>  };
>  
>  /*


-- 

Cheers,
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-01 17:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-29  5:29 [PATCH 0/3] networking: Use ETH_ALEN where appropriate Joe Perches
2013-07-29  5:29 ` [PATCH 1/3] uapi: Convert some uses of 6 to ETH_ALEN Joe Perches
2013-07-29  5:29 ` [PATCH 2/3] include: Convert ethernet mac address declarations to use ETH_ALEN Joe Perches
2013-07-29 11:59   ` Rafael J. Wysocki
2013-07-29 19:34     ` Joe Perches
2013-07-29 20:06       ` Rafael J. Wysocki
2013-08-01 17:50   ` Mauro Carvalho Chehab
2013-07-29  5:29 ` [PATCH 3/3] ethernet: Convert mac address uses of 6 to ETH_ALEN Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).