From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
cforno12@linux.ibm.com, mpe@ellerman.id.au,
benh@kernel.crashing.org, paulus@samba.org,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH net-next 11/12] ethernet: ibmveth: use ether_addr_to_u64()
Date: Fri, 15 Oct 2021 15:16:51 -0700 [thread overview]
Message-ID: <20211015221652.827253-12-kuba@kernel.org> (raw)
In-Reply-To: <20211015221652.827253-1-kuba@kernel.org>
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>
---
CC: cforno12@linux.ibm.com
CC: mpe@ellerman.id.au
CC: benh@kernel.crashing.org
CC: paulus@samba.org
CC: linuxppc-dev@lists.ozlabs.org
---
drivers/net/ethernet/ibm/ibmveth.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 836617fb3f40..45ba40cf4d07 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -483,17 +483,6 @@ static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter,
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)
{
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.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 |
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) {
/* add the multicast address to the filter table */
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,
IbmVethMcastAddFilter,
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))
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);
if (rc) {
netdev_err(adapter->netdev, "h_change_logical_lan_mac failed with rc=%d\n", rc);
--
2.31.1
next prev parent reply other threads:[~2021-10-15 22:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 22:16 [PATCH net-next 00/12] ethernet: manual netdev->dev_addr conversions (part 1) Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 01/12] ethernet: adaptec: use eth_hw_addr_set() Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 02/12] ethernet: aeroflex: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 03/12] ethernet: alteon: " Jakub Kicinski
2021-10-19 7:49 ` jes
2021-10-15 22:16 ` [PATCH net-next 04/12] ethernet: amd: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 05/12] ethernet: aquantia: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 06/12] ethernet: bnx2x: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 07/12] ethernet: bcmgenet: " Jakub Kicinski
2021-10-19 22:02 ` Florian Fainelli
2021-10-15 22:16 ` [PATCH net-next 08/12] ethernet: enic: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 09/12] ethernet: ec_bhf: " Jakub Kicinski
2021-10-15 22:16 ` [PATCH net-next 10/12] ethernet: enetc: " Jakub Kicinski
2021-10-15 22:16 ` Jakub Kicinski [this message]
2021-10-15 22:28 ` [PATCH net-next 11/12] ethernet: ibmveth: use ether_addr_to_u64() Tyrel Datwyler
2021-10-15 22:16 ` [PATCH net-next 12/12] ethernet: ixgb: use eth_hw_addr_set() Jakub Kicinski
2021-10-16 8:00 ` [PATCH net-next 00/12] ethernet: manual netdev->dev_addr conversions (part 1) patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211015221652.827253-12-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=cforno12@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).