Commits
Grygorii Strashko committed 31434ca71bd
HACK: drivers: net: cpsw: add broadcast/multicast rate limit support Add broadcast/multicast rate limit support via switch config ioctl to limit the number of broadcast/multicast packets processed by ALE. For CPSW ALE multicast (MC) / broadcast (BC) Rate limit, ENABLE_RATE_LIMIT bit has to be set in ALE_CONTROL Register. The MC/BC Rate limit feature expected to limit number of BC/MC packets per sec which need to be configured as below: - ale_port.BCASTMCAST/_LIMIT fields and ALE_PRESCALE register have to be configured to achieve desired MC/BC Rate limit: number_of_packets/sec = (Fclk / ALE_PRESCALE) * port.BCASTMCAST/_LIMIT where: ALE_PRESCALE width is 19bit and min value 0x10. with Fclk = 125MHz and port.BCASTMCAST/_LIMIT = 1 max number_of_packets/sec = (125MHz / 0x10) * 1 = 7 812 500 min number_of_packets/sec = (125MHz / 0xFFFFF) * 1 = 119 above values are more than enough (with higher Fclk they will be just better), so port.BCASTMCAST/_LIMIT can be selected to be 1 while ALE_PRESCALE is calculated as: ALE_PRESCALE = Fclk / number_of_packets - RATE_LIMIT_TX bit has to be set in ALE_CONTROL Register to 1 for TX and 0 for RX - ENABLE_RATE_LIMIT bit has to be set in ALE_CONTROL Register This patch implements above logic. Testing: # ifconfig - check "RX packets:X" # switch-config --add-multi 01:00:5E:00:00:05 -n 7 # switch-config -l -n 1 -L 1000 -B 1000 # on host PC generate BC/MC traffic (packeth: gen-b->num_packets=10000 gen-b->delay=100 # ifconfig - check "RX packets:X+1000" TODO: The patch is marked as a hack because switch-configuration in general uses some non-standard private ioctls. This needs to be moved to a standard kernel framework. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>