net: ftmac100: handle netdev flags IFF_PROMISC and IFF_ALLMULTI
authorSergei Antonov <saproj@gmail.com>
Mon, 16 Jan 2023 18:27:16 +0000 (21:27 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Jan 2023 13:03:40 +0000 (13:03 +0000)
When netdev->flags has IFF_PROMISC or IFF_ALLMULTI, set the
corresponding bits in the MAC Control Register (MACCR).

This change is based on code from the ftgmac100 driver, see
ftgmac100_start_hw() in ftgmac100.c

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/faraday/ftmac100.c

index 6c8c78018ce6a63ea405447e045c6f0ddbc6bb81..139fe66f8bcd2680adb082bd2f54e22dc5e2b8fd 100644 (file)
@@ -182,6 +182,12 @@ static int ftmac100_start_hw(struct ftmac100 *priv)
        if (netdev->mtu > ETH_DATA_LEN)
                maccr |= FTMAC100_MACCR_RX_FTL;
 
+       /* Add other bits as needed */
+       if (netdev->flags & IFF_PROMISC)
+               maccr |= FTMAC100_MACCR_RCV_ALL;
+       if (netdev->flags & IFF_ALLMULTI)
+               maccr |= FTMAC100_MACCR_RX_MULTIPKT;
+
        iowrite32(maccr, priv->base + FTMAC100_OFFSET_MACCR);
        return 0;
 }