ethernet: ibmveth: use ether_addr_to_u64()
We'll want to make netdev->dev_addr const, remove the local helper which is missing a const qualifier on the argument and use ether_addr_to_u64(). Similar story to mlx4. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d9ca87233b
commit
5c8b348534
|
@ -483,17 +483,6 @@ retry:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u64 ibmveth_encode_mac_addr(u8 *mac)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
u64 encoded = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < ETH_ALEN; i++)
|
|
||||||
encoded = (encoded << 8) | mac[i];
|
|
||||||
|
|
||||||
return encoded;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ibmveth_open(struct net_device *netdev)
|
static int ibmveth_open(struct net_device *netdev)
|
||||||
{
|
{
|
||||||
struct ibmveth_adapter *adapter = netdev_priv(netdev);
|
struct ibmveth_adapter *adapter = netdev_priv(netdev);
|
||||||
|
@ -553,7 +542,7 @@ static int ibmveth_open(struct net_device *netdev)
|
||||||
adapter->rx_queue.num_slots = rxq_entries;
|
adapter->rx_queue.num_slots = rxq_entries;
|
||||||
adapter->rx_queue.toggle = 1;
|
adapter->rx_queue.toggle = 1;
|
||||||
|
|
||||||
mac_address = ibmveth_encode_mac_addr(netdev->dev_addr);
|
mac_address = ether_addr_to_u64(netdev->dev_addr);
|
||||||
|
|
||||||
rxq_desc.fields.flags_len = IBMVETH_BUF_VALID |
|
rxq_desc.fields.flags_len = IBMVETH_BUF_VALID |
|
||||||
adapter->rx_queue.queue_len;
|
adapter->rx_queue.queue_len;
|
||||||
|
@ -1476,7 +1465,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
|
||||||
netdev_for_each_mc_addr(ha, netdev) {
|
netdev_for_each_mc_addr(ha, netdev) {
|
||||||
/* add the multicast address to the filter table */
|
/* add the multicast address to the filter table */
|
||||||
u64 mcast_addr;
|
u64 mcast_addr;
|
||||||
mcast_addr = ibmveth_encode_mac_addr(ha->addr);
|
mcast_addr = ether_addr_to_u64(ha->addr);
|
||||||
lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
|
lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
|
||||||
IbmVethMcastAddFilter,
|
IbmVethMcastAddFilter,
|
||||||
mcast_addr);
|
mcast_addr);
|
||||||
|
@ -1606,7 +1595,7 @@ static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
|
||||||
if (!is_valid_ether_addr(addr->sa_data))
|
if (!is_valid_ether_addr(addr->sa_data))
|
||||||
return -EADDRNOTAVAIL;
|
return -EADDRNOTAVAIL;
|
||||||
|
|
||||||
mac_address = ibmveth_encode_mac_addr(addr->sa_data);
|
mac_address = ether_addr_to_u64(addr->sa_data);
|
||||||
rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address);
|
rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
netdev_err(adapter->netdev, "h_change_logical_lan_mac failed with rc=%d\n", rc);
|
netdev_err(adapter->netdev, "h_change_logical_lan_mac failed with rc=%d\n", rc);
|
||||||
|
|
Loading…
Reference in New Issue