aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c13
-rw-r--r--drivers/net/ethernet/sfc/efx.c4
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c18
-rw-r--r--drivers/net/ethernet/sfc/falcon.c2
-rw-r--r--drivers/net/ethernet/sfc/filter.h2
-rw-r--r--drivers/net/ethernet/sfc/mcdi.c14
-rw-r--r--drivers/net/ethernet/sfc/mcdi_port.c4
-rw-r--r--drivers/net/ethernet/sfc/selftest.c6
-rw-r--r--drivers/net/ethernet/sfc/siena_sriov.c13
9 files changed, 37 insertions, 39 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 3b397987119d..eb75675f6e32 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -162,8 +162,8 @@ static int efx_ef10_get_mac_address(struct efx_nic *efx, u8 *mac_address)
162 if (outlen < MC_CMD_GET_MAC_ADDRESSES_OUT_LEN) 162 if (outlen < MC_CMD_GET_MAC_ADDRESSES_OUT_LEN)
163 return -EIO; 163 return -EIO;
164 164
165 memcpy(mac_address, 165 ether_addr_copy(mac_address,
166 MCDI_PTR(outbuf, GET_MAC_ADDRESSES_OUT_MAC_ADDR_BASE), ETH_ALEN); 166 MCDI_PTR(outbuf, GET_MAC_ADDRESSES_OUT_MAC_ADDR_BASE));
167 return 0; 167 return 0;
168} 168}
169 169
@@ -3145,12 +3145,10 @@ static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx)
3145 table->dev_uc_count = -1; 3145 table->dev_uc_count = -1;
3146 } else { 3146 } else {
3147 table->dev_uc_count = 1 + netdev_uc_count(net_dev); 3147 table->dev_uc_count = 1 + netdev_uc_count(net_dev);
3148 memcpy(table->dev_uc_list[0].addr, net_dev->dev_addr, 3148 ether_addr_copy(table->dev_uc_list[0].addr, net_dev->dev_addr);
3149 ETH_ALEN);
3150 i = 1; 3149 i = 1;
3151 netdev_for_each_uc_addr(uc, net_dev) { 3150 netdev_for_each_uc_addr(uc, net_dev) {
3152 memcpy(table->dev_uc_list[i].addr, 3151 ether_addr_copy(table->dev_uc_list[i].addr, uc->addr);
3153 uc->addr, ETH_ALEN);
3154 i++; 3152 i++;
3155 } 3153 }
3156 } 3154 }
@@ -3162,8 +3160,7 @@ static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx)
3162 eth_broadcast_addr(table->dev_mc_list[0].addr); 3160 eth_broadcast_addr(table->dev_mc_list[0].addr);
3163 i = 1; 3161 i = 1;
3164 netdev_for_each_mc_addr(mc, net_dev) { 3162 netdev_for_each_mc_addr(mc, net_dev) {
3165 memcpy(table->dev_mc_list[i].addr, 3163 ether_addr_copy(table->dev_mc_list[i].addr, mc->addr);
3166 mc->addr, ETH_ALEN);
3167 i++; 3164 i++;
3168 } 3165 }
3169 } 3166 }
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index d72e0038a740..52589f6a8beb 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1012,7 +1012,7 @@ static int efx_probe_port(struct efx_nic *efx)
1012 return rc; 1012 return rc;
1013 1013
1014 /* Initialise MAC address to permanent address */ 1014 /* Initialise MAC address to permanent address */
1015 memcpy(efx->net_dev->dev_addr, efx->net_dev->perm_addr, ETH_ALEN); 1015 ether_addr_copy(efx->net_dev->dev_addr, efx->net_dev->perm_addr);
1016 1016
1017 return 0; 1017 return 0;
1018} 1018}
@@ -2120,7 +2120,7 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data)
2120 return -EADDRNOTAVAIL; 2120 return -EADDRNOTAVAIL;
2121 } 2121 }
2122 2122
2123 memcpy(net_dev->dev_addr, new_addr, net_dev->addr_len); 2123 ether_addr_copy(net_dev->dev_addr, new_addr);
2124 efx_sriov_mac_address_changed(efx); 2124 efx_sriov_mac_address_changed(efx);
2125 2125
2126 /* Reconfigure the MAC */ 2126 /* Reconfigure the MAC */
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 89fcaffd7de2..0de8b07c24c2 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -727,7 +727,7 @@ static int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)
727} 727}
728 728
729/* MAC address mask including only I/G bit */ 729/* MAC address mask including only I/G bit */
730static const u8 mac_addr_ig_mask[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; 730static const u8 mac_addr_ig_mask[ETH_ALEN] __aligned(2) = {0x01, 0, 0, 0, 0, 0};
731 731
732#define IP4_ADDR_FULL_MASK ((__force __be32)~0) 732#define IP4_ADDR_FULL_MASK ((__force __be32)~0)
733#define PORT_FULL_MASK ((__force __be16)~0) 733#define PORT_FULL_MASK ((__force __be16)~0)
@@ -787,16 +787,16 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx,
787 rule->flow_type = ETHER_FLOW; 787 rule->flow_type = ETHER_FLOW;
788 if (spec.match_flags & 788 if (spec.match_flags &
789 (EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG)) { 789 (EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG)) {
790 memcpy(mac_entry->h_dest, spec.loc_mac, ETH_ALEN); 790 ether_addr_copy(mac_entry->h_dest, spec.loc_mac);
791 if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC) 791 if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC)
792 memset(mac_mask->h_dest, ~0, ETH_ALEN); 792 eth_broadcast_addr(mac_mask->h_dest);
793 else 793 else
794 memcpy(mac_mask->h_dest, mac_addr_ig_mask, 794 ether_addr_copy(mac_mask->h_dest,
795 ETH_ALEN); 795 mac_addr_ig_mask);
796 } 796 }
797 if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) { 797 if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) {
798 memcpy(mac_entry->h_source, spec.rem_mac, ETH_ALEN); 798 ether_addr_copy(mac_entry->h_source, spec.rem_mac);
799 memset(mac_mask->h_source, ~0, ETH_ALEN); 799 eth_broadcast_addr(mac_mask->h_source);
800 } 800 }
801 if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) { 801 if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) {
802 mac_entry->h_proto = spec.ether_type; 802 mac_entry->h_proto = spec.ether_type;
@@ -968,13 +968,13 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx,
968 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC; 968 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC;
969 else 969 else
970 return -EINVAL; 970 return -EINVAL;
971 memcpy(spec.loc_mac, mac_entry->h_dest, ETH_ALEN); 971 ether_addr_copy(spec.loc_mac, mac_entry->h_dest);
972 } 972 }
973 if (!is_zero_ether_addr(mac_mask->h_source)) { 973 if (!is_zero_ether_addr(mac_mask->h_source)) {
974 if (!is_broadcast_ether_addr(mac_mask->h_source)) 974 if (!is_broadcast_ether_addr(mac_mask->h_source))
975 return -EINVAL; 975 return -EINVAL;
976 spec.match_flags |= EFX_FILTER_MATCH_REM_MAC; 976 spec.match_flags |= EFX_FILTER_MATCH_REM_MAC;
977 memcpy(spec.rem_mac, mac_entry->h_source, ETH_ALEN); 977 ether_addr_copy(spec.rem_mac, mac_entry->h_source);
978 } 978 }
979 if (mac_mask->h_proto) { 979 if (mac_mask->h_proto) {
980 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) 980 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK)
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 72652f380243..8ec20b713cc6 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -2183,7 +2183,7 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
2183 } 2183 }
2184 2184
2185 /* Read the MAC addresses */ 2185 /* Read the MAC addresses */
2186 memcpy(efx->net_dev->perm_addr, nvconfig->mac_address[0], ETH_ALEN); 2186 ether_addr_copy(efx->net_dev->perm_addr, nvconfig->mac_address[0]);
2187 2187
2188 netif_dbg(efx, probe, efx->net_dev, "PHY is %d phy_id %d\n", 2188 netif_dbg(efx, probe, efx->net_dev, "PHY is %d phy_id %d\n",
2189 efx->phy_type, efx->mdio.prtad); 2189 efx->phy_type, efx->mdio.prtad);
diff --git a/drivers/net/ethernet/sfc/filter.h b/drivers/net/ethernet/sfc/filter.h
index 3ef298d3c47e..d0ed7f71ea7e 100644
--- a/drivers/net/ethernet/sfc/filter.h
+++ b/drivers/net/ethernet/sfc/filter.h
@@ -243,7 +243,7 @@ static inline int efx_filter_set_eth_local(struct efx_filter_spec *spec,
243 } 243 }
244 if (addr != NULL) { 244 if (addr != NULL) {
245 spec->match_flags |= EFX_FILTER_MATCH_LOC_MAC; 245 spec->match_flags |= EFX_FILTER_MATCH_LOC_MAC;
246 memcpy(spec->loc_mac, addr, ETH_ALEN); 246 ether_addr_copy(spec->loc_mac, addr);
247 } 247 }
248 return 0; 248 return 0;
249} 249}
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index eb59abb57e85..7bd4b14bf3b3 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -1187,6 +1187,9 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
1187 int rc; 1187 int rc;
1188 1188
1189 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); 1189 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
1190 /* we need __aligned(2) for ether_addr_copy */
1191 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST & 1);
1192 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1_OFST & 1);
1190 1193
1191 rc = efx_mcdi_rpc(efx, MC_CMD_GET_BOARD_CFG, NULL, 0, 1194 rc = efx_mcdi_rpc(efx, MC_CMD_GET_BOARD_CFG, NULL, 0,
1192 outbuf, sizeof(outbuf), &outlen); 1195 outbuf, sizeof(outbuf), &outlen);
@@ -1199,11 +1202,10 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
1199 } 1202 }
1200 1203
1201 if (mac_address) 1204 if (mac_address)
1202 memcpy(mac_address, 1205 ether_addr_copy(mac_address,
1203 port_num ? 1206 port_num ?
1204 MCDI_PTR(outbuf, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1) : 1207 MCDI_PTR(outbuf, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1) :
1205 MCDI_PTR(outbuf, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0), 1208 MCDI_PTR(outbuf, GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0));
1206 ETH_ALEN);
1207 if (fw_subtype_list) { 1209 if (fw_subtype_list) {
1208 for (i = 0; 1210 for (i = 0;
1209 i < MCDI_VAR_ARRAY_LEN(outlen, 1211 i < MCDI_VAR_ARRAY_LEN(outlen,
@@ -1532,7 +1534,7 @@ static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
1532 MCDI_SET_DWORD(inbuf, WOL_FILTER_SET_IN_WOL_TYPE, type); 1534 MCDI_SET_DWORD(inbuf, WOL_FILTER_SET_IN_WOL_TYPE, type);
1533 MCDI_SET_DWORD(inbuf, WOL_FILTER_SET_IN_FILTER_MODE, 1535 MCDI_SET_DWORD(inbuf, WOL_FILTER_SET_IN_FILTER_MODE,
1534 MC_CMD_FILTER_MODE_SIMPLE); 1536 MC_CMD_FILTER_MODE_SIMPLE);
1535 memcpy(MCDI_PTR(inbuf, WOL_FILTER_SET_IN_MAGIC_MAC), mac, ETH_ALEN); 1537 ether_addr_copy(MCDI_PTR(inbuf, WOL_FILTER_SET_IN_MAGIC_MAC), mac);
1536 1538
1537 rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_SET, inbuf, sizeof(inbuf), 1539 rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_SET, inbuf, sizeof(inbuf),
1538 outbuf, sizeof(outbuf), &outlen); 1540 outbuf, sizeof(outbuf), &outlen);
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c
index 91d23252f8fa..e5fc4e1574b5 100644
--- a/drivers/net/ethernet/sfc/mcdi_port.c
+++ b/drivers/net/ethernet/sfc/mcdi_port.c
@@ -854,8 +854,8 @@ int efx_mcdi_set_mac(struct efx_nic *efx)
854 854
855 BUILD_BUG_ON(MC_CMD_SET_MAC_OUT_LEN != 0); 855 BUILD_BUG_ON(MC_CMD_SET_MAC_OUT_LEN != 0);
856 856
857 memcpy(MCDI_PTR(cmdbytes, SET_MAC_IN_ADDR), 857 ether_addr_copy(MCDI_PTR(cmdbytes, SET_MAC_IN_ADDR),
858 efx->net_dev->dev_addr, ETH_ALEN); 858 efx->net_dev->dev_addr);
859 859
860 MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_MTU, 860 MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_MTU,
861 EFX_MAX_FRAME_LEN(efx->net_dev->mtu)); 861 EFX_MAX_FRAME_LEN(efx->net_dev->mtu));
diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c
index 26641817a9c7..0fc5baef45b1 100644
--- a/drivers/net/ethernet/sfc/selftest.c
+++ b/drivers/net/ethernet/sfc/selftest.c
@@ -50,7 +50,7 @@ struct efx_loopback_payload {
50} __packed; 50} __packed;
51 51
52/* Loopback test source MAC address */ 52/* Loopback test source MAC address */
53static const unsigned char payload_source[ETH_ALEN] = { 53static const u8 payload_source[ETH_ALEN] __aligned(2) = {
54 0x00, 0x0f, 0x53, 0x1b, 0x1b, 0x1b, 54 0x00, 0x0f, 0x53, 0x1b, 0x1b, 0x1b,
55}; 55};
56 56
@@ -366,8 +366,8 @@ static void efx_iterate_state(struct efx_nic *efx)
366 struct efx_loopback_payload *payload = &state->payload; 366 struct efx_loopback_payload *payload = &state->payload;
367 367
368 /* Initialise the layerII header */ 368 /* Initialise the layerII header */
369 memcpy(&payload->header.h_dest, net_dev->dev_addr, ETH_ALEN); 369 ether_addr_copy((u8 *)&payload->header.h_dest, net_dev->dev_addr);
370 memcpy(&payload->header.h_source, &payload_source, ETH_ALEN); 370 ether_addr_copy((u8 *)&payload->header.h_source, payload_source);
371 payload->header.h_proto = htons(ETH_P_IP); 371 payload->header.h_proto = htons(ETH_P_IP);
372 372
373 /* saddr set later and used as incrementing count */ 373 /* saddr set later and used as incrementing count */
diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c
index 0c38f926871e..9a9205e77896 100644
--- a/drivers/net/ethernet/sfc/siena_sriov.c
+++ b/drivers/net/ethernet/sfc/siena_sriov.c
@@ -1095,7 +1095,7 @@ static void efx_sriov_peer_work(struct work_struct *data)
1095 1095
1096 /* Fill the remaining addresses */ 1096 /* Fill the remaining addresses */
1097 list_for_each_entry(local_addr, &efx->local_addr_list, link) { 1097 list_for_each_entry(local_addr, &efx->local_addr_list, link) {
1098 memcpy(peer->mac_addr, local_addr->addr, ETH_ALEN); 1098 ether_addr_copy(peer->mac_addr, local_addr->addr);
1099 peer->tci = 0; 1099 peer->tci = 0;
1100 ++peer; 1100 ++peer;
1101 ++peer_count; 1101 ++peer_count;
@@ -1303,8 +1303,7 @@ int efx_sriov_init(struct efx_nic *efx)
1303 goto fail_vfs; 1303 goto fail_vfs;
1304 1304
1305 rtnl_lock(); 1305 rtnl_lock();
1306 memcpy(vfdi_status->peers[0].mac_addr, 1306 ether_addr_copy(vfdi_status->peers[0].mac_addr, net_dev->dev_addr);
1307 net_dev->dev_addr, ETH_ALEN);
1308 efx->vf_init_count = efx->vf_count; 1307 efx->vf_init_count = efx->vf_count;
1309 rtnl_unlock(); 1308 rtnl_unlock();
1310 1309
@@ -1452,8 +1451,8 @@ void efx_sriov_mac_address_changed(struct efx_nic *efx)
1452 1451
1453 if (!efx->vf_init_count) 1452 if (!efx->vf_init_count)
1454 return; 1453 return;
1455 memcpy(vfdi_status->peers[0].mac_addr, 1454 ether_addr_copy(vfdi_status->peers[0].mac_addr,
1456 efx->net_dev->dev_addr, ETH_ALEN); 1455 efx->net_dev->dev_addr);
1457 queue_work(vfdi_workqueue, &efx->peer_work); 1456 queue_work(vfdi_workqueue, &efx->peer_work);
1458} 1457}
1459 1458
@@ -1570,7 +1569,7 @@ int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)
1570 vf = efx->vf + vf_i; 1569 vf = efx->vf + vf_i;
1571 1570
1572 mutex_lock(&vf->status_lock); 1571 mutex_lock(&vf->status_lock);
1573 memcpy(vf->addr.mac_addr, mac, ETH_ALEN); 1572 ether_addr_copy(vf->addr.mac_addr, mac);
1574 __efx_sriov_update_vf_addr(vf); 1573 __efx_sriov_update_vf_addr(vf);
1575 mutex_unlock(&vf->status_lock); 1574 mutex_unlock(&vf->status_lock);
1576 1575
@@ -1633,7 +1632,7 @@ int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
1633 vf = efx->vf + vf_i; 1632 vf = efx->vf + vf_i;
1634 1633
1635 ivi->vf = vf_i; 1634 ivi->vf = vf_i;
1636 memcpy(ivi->mac, vf->addr.mac_addr, ETH_ALEN); 1635 ether_addr_copy(ivi->mac, vf->addr.mac_addr);
1637 ivi->tx_rate = 0; 1636 ivi->tx_rate = 0;
1638 tci = ntohs(vf->addr.tci); 1637 tci = ntohs(vf->addr.tci);
1639 ivi->vlan = tci & VLAN_VID_MASK; 1638 ivi->vlan = tci & VLAN_VID_MASK;