s390/qeth: don't keep track of MAC address's cast type
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Wed, 20 Dec 2017 19:10:59 +0000 (20:10 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Dec 2017 20:23:45 +0000 (15:23 -0500)
Instead of tracking the uc/mc state in each MAC address object, just
check the multicast bit in the address itself.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_l2.h
drivers/s390/net/qeth_l2_main.c

index 09b1c4ef3dc98ea1bd1e6c9a65ab7e43d630922e..3223601cc3ac1f1c5aa82c631b7865757459c2a7 100644 (file)
@@ -23,7 +23,6 @@ bool qeth_l2_vnicc_is_in_use(struct qeth_card *card);
 
 struct qeth_mac {
        u8 mac_addr[OSA_ADDR_LEN];
-       u8 is_uc:1;
        u8 disp_flag:2;
        struct hlist_node hnode;
 };
index 5863ea170ff26447630ed22acd5174db23bf0ee2..88dd92954eec17efe4ad2004240f3c39714a5d82 100644 (file)
@@ -186,22 +186,16 @@ static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac)
 
 static int qeth_l2_write_mac(struct qeth_card *card, struct qeth_mac *mac)
 {
-       if (mac->is_uc) {
-               return qeth_l2_send_setdelmac(card, mac->mac_addr,
-                                               IPA_CMD_SETVMAC);
-       } else {
+       if (is_multicast_ether_addr_64bits(mac->mac_addr))
                return qeth_l2_send_setgroupmac(card, mac->mac_addr);
-       }
+       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_SETVMAC);
 }
 
 static int qeth_l2_remove_mac(struct qeth_card *card, struct qeth_mac *mac)
 {
-       if (mac->is_uc) {
-               return qeth_l2_send_setdelmac(card, mac->mac_addr,
-                                               IPA_CMD_DELVMAC);
-       } else {
+       if (is_multicast_ether_addr_64bits(mac->mac_addr))
                return qeth_l2_send_delgroupmac(card, mac->mac_addr);
-       }
+       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_DELVMAC);
 }
 
 static void qeth_l2_del_all_macs(struct qeth_card *card)
@@ -597,27 +591,23 @@ static void qeth_promisc_to_bridge(struct qeth_card *card)
  * only if there is not in the hash table storage already
  *
 */
-static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha,
-                           u8 is_uc)
+static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha)
 {
        u32 mac_hash = get_unaligned((u32 *)(&ha->addr[2]));
        struct qeth_mac *mac;
 
        hash_for_each_possible(card->mac_htable, mac, hnode, mac_hash) {
-               if (is_uc == mac->is_uc &&
-                   !memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) {
+               if (!memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) {
                        mac->disp_flag = QETH_DISP_ADDR_DO_NOTHING;
                        return;
                }
        }
 
        mac = kzalloc(sizeof(struct qeth_mac), GFP_ATOMIC);
-
        if (!mac)
                return;
 
        memcpy(mac->mac_addr, ha->addr, OSA_ADDR_LEN);
-       mac->is_uc = is_uc;
        mac->disp_flag = QETH_DISP_ADDR_ADD;
 
        hash_add(card->mac_htable, &mac->hnode, mac_hash);
@@ -643,10 +633,9 @@ static void qeth_l2_set_rx_mode(struct net_device *dev)
        spin_lock_bh(&card->mclock);
 
        netdev_for_each_mc_addr(ha, dev)
-               qeth_l2_add_mac(card, ha, 0);
-
+               qeth_l2_add_mac(card, ha);
        netdev_for_each_uc_addr(ha, dev)
-               qeth_l2_add_mac(card, ha, 1);
+               qeth_l2_add_mac(card, ha);
 
        hash_for_each_safe(card->mac_htable, i, tmp, mac, hnode) {
                if (mac->disp_flag == QETH_DISP_ADDR_DELETE) {