Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Nov 2019 22:57:36 +0000 (UTC)
From:      Eric Joyner <erj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354343 - in head/sys/dev: e1000 oce
Message-ID:  <201911042257.xA4MvaBV016297@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: erj
Date: Mon Nov  4 22:57:36 2019
New Revision: 354343
URL: https://svnweb.freebsd.org/changeset/base/354343

Log:
  net: prefer ETHER_ADDR_LEN over ETH_ADDR_LEN
  
  A couple of drivers and one place in if.c use ETH_ADDR_LEN, even though
  net/ethernet.h provides an equivalent ETHER_ADDR_LEN definition.
  
  Cleanup all of the locations which refer to ETH_ADDR_LEN to use the
  standard ETHER_ADDR_LEN instead.
  
  Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
  
  Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
  Reviewed by:	erj@, jpaetzel@
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D21239

Modified:
  head/sys/dev/e1000/e1000_82540.c
  head/sys/dev/e1000/e1000_82541.c
  head/sys/dev/e1000/e1000_82542.c
  head/sys/dev/e1000/e1000_82543.c
  head/sys/dev/e1000/e1000_defines.h
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_mac.c
  head/sys/dev/e1000/e1000_nvm.c
  head/sys/dev/e1000/e1000_vf.c
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_em.h
  head/sys/dev/oce/oce_hw.c
  head/sys/dev/oce/oce_if.h

Modified: head/sys/dev/e1000/e1000_82540.c
==============================================================================
--- head/sys/dev/e1000/e1000_82540.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_82540.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -696,7 +696,7 @@ s32 e1000_read_mac_addr_82540(struct e1000_hw *hw)
 
 	DEBUGFUNC("e1000_read_mac_addr");
 
-	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
 		offset = i >> 1;
 		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
 		if (ret_val) {
@@ -711,7 +711,7 @@ s32 e1000_read_mac_addr_82540(struct e1000_hw *hw)
 	if (hw->bus.func == E1000_FUNC_1)
 		hw->mac.perm_addr[5] ^= 1;
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 out:

Modified: head/sys/dev/e1000/e1000_82541.c
==============================================================================
--- head/sys/dev/e1000/e1000_82541.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_82541.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -1285,7 +1285,7 @@ static s32 e1000_read_mac_addr_82541(struct e1000_hw *
 
 	DEBUGFUNC("e1000_read_mac_addr");
 
-	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
 		offset = i >> 1;
 		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
 		if (ret_val) {
@@ -1296,7 +1296,7 @@ static s32 e1000_read_mac_addr_82541(struct e1000_hw *
 		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
 	}
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 out:

Modified: head/sys/dev/e1000/e1000_82542.c
==============================================================================
--- head/sys/dev/e1000/e1000_82542.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_82542.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -573,7 +573,7 @@ s32 e1000_read_mac_addr_82542(struct e1000_hw *hw)
 
 	DEBUGFUNC("e1000_read_mac_addr");
 
-	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
 		offset = i >> 1;
 		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
 		if (ret_val) {
@@ -584,7 +584,7 @@ s32 e1000_read_mac_addr_82542(struct e1000_hw *hw)
 		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
 	}
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 out:

Modified: head/sys/dev/e1000/e1000_82543.c
==============================================================================
--- head/sys/dev/e1000/e1000_82543.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_82543.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -1574,7 +1574,7 @@ s32 e1000_read_mac_addr_82543(struct e1000_hw *hw)
 
 	DEBUGFUNC("e1000_read_mac_addr");
 
-	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
 		offset = i >> 1;
 		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
 		if (ret_val) {
@@ -1589,7 +1589,7 @@ s32 e1000_read_mac_addr_82543(struct e1000_hw *hw)
 	if (hw->bus.func == E1000_FUNC_1)
 		hw->mac.perm_addr[5] ^= 1;
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 out:

Modified: head/sys/dev/e1000/e1000_defines.h
==============================================================================
--- head/sys/dev/e1000/e1000_defines.h	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_defines.h	Mon Nov  4 22:57:36 2019	(r354343)
@@ -1206,10 +1206,6 @@
 #define PCIE_LINK_SPEED_5000		0x02
 #define PCIE_DEVICE_CONTROL2_16ms	0x0005
 
-#ifndef ETH_ADDR_LEN
-#define ETH_ADDR_LEN			6
-#endif
-
 #define PHY_REVISION_MASK		0xFFFFFFF0
 #define MAX_PHY_REG_ADDRESS		0x1F  /* 5 bit address bus (0-0x1F) */
 #define MAX_PHY_MULTI_PAGE_REG		0xF

Modified: head/sys/dev/e1000/e1000_hw.h
==============================================================================
--- head/sys/dev/e1000/e1000_hw.h	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_hw.h	Mon Nov  4 22:57:36 2019	(r354343)
@@ -785,8 +785,8 @@ struct e1000_nvm_operations {
 
 struct e1000_mac_info {
 	struct e1000_mac_operations ops;
-	u8 addr[ETH_ADDR_LEN];
-	u8 perm_addr[ETH_ADDR_LEN];
+	u8 addr[ETHER_ADDR_LEN];
+	u8 perm_addr[ETHER_ADDR_LEN];
 
 	enum e1000_mac_type type;
 

Modified: head/sys/dev/e1000/e1000_ich8lan.c
==============================================================================
--- head/sys/dev/e1000/e1000_ich8lan.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_ich8lan.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -2780,7 +2780,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw 
 		 * SHRAL/H) and initial CRC values to the MAC
 		 */
 		for (i = 0; i < hw->mac.rar_entry_count; i++) {
-			u8 mac_addr[ETH_ADDR_LEN] = {0};
+			u8 mac_addr[ETHER_ADDR_LEN] = {0};
 			u32 addr_high, addr_low;
 
 			addr_high = E1000_READ_REG(hw, E1000_RAH(i));

Modified: head/sys/dev/e1000/e1000_mac.c
==============================================================================
--- head/sys/dev/e1000/e1000_mac.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_mac.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -371,7 +371,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32
 void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count)
 {
 	u32 i;
-	u8 mac_addr[ETH_ADDR_LEN] = {0};
+	u8 mac_addr[ETHER_ADDR_LEN] = {0};
 
 	DEBUGFUNC("e1000_init_rx_addrs_generic");
 
@@ -403,7 +403,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *
 	u32 i;
 	s32 ret_val;
 	u16 offset, nvm_alt_mac_addr_offset, nvm_data;
-	u8 alt_mac_addr[ETH_ADDR_LEN];
+	u8 alt_mac_addr[ETHER_ADDR_LEN];
 
 	DEBUGFUNC("e1000_check_alt_mac_addr_generic");
 
@@ -440,7 +440,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *
 
 	if (hw->bus.func == E1000_FUNC_3)
 		nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN3;
-	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
 		offset = nvm_alt_mac_addr_offset + (i >> 1);
 		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
 		if (ret_val) {
@@ -604,7 +604,7 @@ void e1000_update_mc_addr_list_generic(struct e1000_hw
 		hash_bit = hash_value & 0x1F;
 
 		hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit);
-		mc_addr_list += (ETH_ADDR_LEN);
+		mc_addr_list += (ETHER_ADDR_LEN);
 	}
 
 	/* replace the entire MTA table */

Modified: head/sys/dev/e1000/e1000_nvm.c
==============================================================================
--- head/sys/dev/e1000/e1000_nvm.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_nvm.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -1143,7 +1143,7 @@ s32 e1000_read_mac_addr_generic(struct e1000_hw *hw)
 	for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++)
 		hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8));
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 	return E1000_SUCCESS;

Modified: head/sys/dev/e1000/e1000_vf.c
==============================================================================
--- head/sys/dev/e1000/e1000_vf.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/e1000_vf.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -431,7 +431,7 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
 		hash_value = e1000_hash_mc_addr_vf(hw, mc_addr_list);
 		DEBUGOUT1("Hash value = 0x%03X\n", hash_value);
 		hash_list[i] = hash_value & 0x0FFF;
-		mc_addr_list += ETH_ADDR_LEN;
+		mc_addr_list += ETHER_ADDR_LEN;
 	}
 
 	e1000_write_msg_read_ack(hw, msgbuf, E1000_VFMAILBOX_SIZE);
@@ -517,7 +517,7 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw)
 {
 	int i;
 
-	for (i = 0; i < ETH_ADDR_LEN; i++)
+	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		hw->mac.addr[i] = hw->mac.perm_addr[i];
 
 	return E1000_SUCCESS;

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/if_em.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -1002,7 +1002,7 @@ em_if_attach_pre(if_ctx_t ctx)
 	hw->mac.report_tx_early = 1;
 
 	/* Allocate multicast array memory. */
-	adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN *
+	adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN *
 	    MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
 	if (adapter->mta == NULL) {
 		device_printf(dev, "Can not allocate multicast setup array\n");
@@ -1672,7 +1672,7 @@ em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_in
 	if (cnt == MAX_NUM_MULTICAST_ADDRESSES)
 		return (1);
 
-	bcopy(LLADDR(sdl), &mta[cnt * ETH_ADDR_LEN], ETH_ADDR_LEN);
+	bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN);
 
 	return (1);
 }
@@ -1696,7 +1696,7 @@ em_if_multi_set(if_ctx_t ctx)
 	IOCTL_DEBUGOUT("em_set_multi: begin");
 
 	mta = adapter->mta;
-	bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES);
+	bzero(mta, sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES);
 
 	if (adapter->hw.mac.type == e1000_82542 &&
 	    adapter->hw.revision_id == E1000_REVISION_2) {

Modified: head/sys/dev/e1000/if_em.h
==============================================================================
--- head/sys/dev/e1000/if_em.h	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/e1000/if_em.h	Mon Nov  4 22:57:36 2019	(r354343)
@@ -340,7 +340,6 @@
 #define EM_MSIX_MASK		0x01F00000 /* For 82574 use */
 #define EM_MSIX_LINK		0x01000000 /* For 82574 use */
 #define ETH_ZLEN		60
-#define ETH_ADDR_LEN		6
 #define EM_CSUM_OFFLOAD		(CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */
 #define IGB_CSUM_OFFLOAD	(CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \
 				 CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \

Modified: head/sys/dev/oce/oce_hw.c
==============================================================================
--- head/sys/dev/oce/oce_hw.c	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/oce/oce_hw.c	Mon Nov  4 22:57:36 2019	(r354343)
@@ -553,7 +553,7 @@ oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_i
 		return (0);
 
 	bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++],
-	    ETH_ADDR_LEN);
+	    ETHER_ADDR_LEN);
 
 	return (1);
 }

Modified: head/sys/dev/oce/oce_if.h
==============================================================================
--- head/sys/dev/oce/oce_if.h	Mon Nov  4 22:52:02 2019	(r354342)
+++ head/sys/dev/oce/oce_if.h	Mon Nov  4 22:57:36 2019	(r354343)
@@ -200,7 +200,6 @@ extern int mp_ncpus;			/* system's total active cpu co
 #define OCE_IF_CAPABILITIES_NONE 	0
 
 
-#define ETH_ADDR_LEN			6
 #define MAX_VLANFILTER_SIZE		64
 #define MAX_VLANS			4096
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911042257.xA4MvaBV016297>