• Rob Herring's avatar
    net: calxedaxgmac: fix various errors in xgmac_set_rx_mode · 2ee68f62
    Rob Herring authored
    Fix xgmac_set_rx_mode to handle several conditions that were not handled
    correctly as Lennert Buytenhek describes:
    
    If we have, say, 100 unicast addresses, and 5 multicast addresses, the
    unicast address count check will evaluate to true, and set use_hash to
    true.  The multicast address check will however evaluate to false, and
    use_hash won't be set to true again, and XGMAC_FRAME_FILTER_HMC won't
    be OR'd into XGMAC_FRAME_FILTER, but since use_hash was still true
    from the unicast check, netdev_for_each_mc_addr() will program the
    multicast addresses into the hash table instead of using the MAC
    address registers, but since the HMC bit wasn't set, the hash table
    won't be checked for multicast addresses on receive, and we'll stop
    receiving multicast packets entirely.
    
    Also, there is no code that zeroes out MAC address registers reg..31
    at the end of this function, meaning that under the right conditions,
    unicast/multicast addresses that were previously in the filter but
    were then deleted won't be cleared out.
    Reported-by: default avatarLennert Buytenhek <buytenh@wantstofly.org>
    Signed-off-by: default avatarRob Herring <rob.herring@calxeda.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2ee68f62
xgmac.c 55.5 KB