This small patch sets the address for the unicast filter
in .ndo_set_mac_address and enables/disables filter
in .ndo_set_multicast_list.
Now mac addr can be changed and promisc mode can be enabled.
Index: target/linux/ifxmips/files/drivers/net/ifxmips.c
===================================================================
--- target/linux/ifxmips/files/drivers/net/ifxmips.c (revision 24118)
+++ target/linux/ifxmips/files/drivers/net/ifxmips.c (working copy)
@@ -417,6 +417,32 @@
wmb();
}
+static int ifxmips_mii_eth_mac_addr(struct net_device *dev, void *p)
+{
+ int retcode;
+
+ retcode = eth_mac_addr(dev, p);
+
+ if (retcode)
+ return retcode;
+
+ // set rx_addr for unicast filter
+ ifxmips_w32(((dev->dev_addr[0]<<24)|(dev->dev_addr[1]<<16)|(dev->dev_addr[2]<< 8)|dev->dev_addr[3]), (u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x461b<<2)));
+ ifxmips_w32(((dev->dev_addr[4]<<24)|(dev->dev_addr[5]<<16)), (u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x461c<<2)));
+
+ return 0;
+}
+
+static void ifxmips_mii_set_rx_mode (struct net_device *dev)
+{
+ // rx_mode promisc: unset unicast filter
+ if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI))
+ ifxmips_w32(ifxmips_r32((u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x4614<<2))) & ~(1<<28), (u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x4614<<2)));
+ // enable unicast filter
+ else
+ ifxmips_w32(ifxmips_r32((u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x4614<<2))) | (1<<28), (u32*)(IFXMIPS_PPE32_BASE_ADDR|(0x4614<<2)));
+}
+
static const struct net_device_ops ifxmips_eth_netdev_ops = {
.ndo_init = ifxmips_mii_dev_init,
.ndo_open = ifxmips_ifxmips_mii_open,
@@ -424,8 +450,9 @@
.ndo_start_xmit = ifxmips_mii_tx,
.ndo_tx_timeout = ifxmips_mii_tx_timeout,
.ndo_change_mtu = eth_change_mtu,
- .ndo_set_mac_address = eth_mac_addr,
+ .ndo_set_mac_address = ifxmips_mii_eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
+ .ndo_set_multicast_list = ifxmips_mii_set_rx_mode,
};
static int
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel