mirror of https://gitee.com/openkylin/linux.git
s390/qeth: don't keep track of MAC address's cast type
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>
This commit is contained in:
parent
c062204f8d
commit
4641b027f7
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue