net: s390: constify and use eth_hw_addr_set()
authorJakub Kicinski <kuba@kernel.org>
Thu, 21 Oct 2021 13:12:11 +0000 (06:12 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 22 Oct 2021 17:16:11 +0000 (10:16 -0700)
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Make sure local references to netdev->dev_addr are constant.

Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/s390/net/lcs.c
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index c18fd48e02b61eeefb1822685556e3c665dd7b2d..2a6479740600efa73ec6023f8ec2d360c1f4f303 100644 (file)
@@ -2162,7 +2162,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
        card->dev->ml_priv = card;
        card->dev->netdev_ops = &lcs_netdev_ops;
        card->dev->dev_port = card->portno;
-       memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);
+       eth_hw_addr_set(card->dev, card->mac);
 #ifdef CONFIG_IP_MULTICAST
        if (!lcs_check_multicast_support(card))
                card->dev->netdev_ops = &lcs_mc_netdev_ops;
index e9807d2996a9d77053b997594e8753a53647e9bc..15999a8160544a8c39c7ddfff44dfec0c0ec705b 100644 (file)
@@ -4375,7 +4375,7 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
            !(adp_cmd->hdr.flags & QETH_SETADP_FLAGS_VIRTUAL_MAC))
                return -EADDRNOTAVAIL;
 
-       ether_addr_copy(card->dev->dev_addr, adp_cmd->data.change_addr.addr);
+       eth_hw_addr_set(card->dev, adp_cmd->data.change_addr.addr);
        return 0;
 }
 
@@ -5046,7 +5046,7 @@ int qeth_vm_request_mac(struct qeth_card *card)
                QETH_CARD_TEXT(card, 2, "badmac");
                QETH_CARD_HEX(card, 2, response->mac, ETH_ALEN);
        } else {
-               ether_addr_copy(card->dev->dev_addr, response->mac);
+               eth_hw_addr_set(card->dev, response->mac);
        }
 
 out:
index dc6c00768d9195713ff53a9e152e89da6b839ab4..5b6187f2d9d60a8b5ce6bad547a4e18e2441a6c5 100644 (file)
@@ -71,7 +71,7 @@ static int qeth_l2_send_setdelmac_cb(struct qeth_card *card,
        return qeth_l2_setdelmac_makerc(card, cmd->hdr.return_code);
 }
 
-static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac,
+static int qeth_l2_send_setdelmac(struct qeth_card *card, const __u8 *mac,
                           enum qeth_ipa_cmds ipacmd)
 {
        struct qeth_ipa_cmd *cmd;
@@ -88,7 +88,7 @@ static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac,
        return qeth_send_ipa_cmd(card, iob, qeth_l2_send_setdelmac_cb, NULL);
 }
 
-static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac)
+static int qeth_l2_send_setmac(struct qeth_card *card, const __u8 *mac)
 {
        int rc;
 
@@ -377,7 +377,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
        if (rc)
                return rc;
        ether_addr_copy(old_addr, dev->dev_addr);
-       ether_addr_copy(dev->dev_addr, addr->sa_data);
+       eth_hw_addr_set(dev, addr->sa_data);
 
        if (card->info.dev_addr_is_registered)
                qeth_l2_remove_mac(card, old_addr);
index 6fd3e288f059554c1aec07f8f773f1258a04659b..e6e9213102117a055aa38b97a41d69d534a35558 100644 (file)
@@ -913,8 +913,7 @@ static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card,
        if (!is_valid_ether_addr(cmd->data.create_destroy_addr.mac_addr))
                return -EADDRNOTAVAIL;
 
-       ether_addr_copy(card->dev->dev_addr,
-                       cmd->data.create_destroy_addr.mac_addr);
+       eth_hw_addr_set(card->dev, cmd->data.create_destroy_addr.mac_addr);
        return 0;
 }