Commits
Murali Karicheri committed 9e4b6414b39
HACK: net: netcp: add special handling for broadcast/multicast This is a hack to implement special packet processing for specific marked packets. The intended use is: 1. Ethernet interfaces are part of a bridge 2. The switch is enabled (by default it is not) through sysfs command 3. ALE is enabled through sysfs command 4. Bridge forwarding is disabled Bridge forwarding disabled via "ebtables -P FORWARD DROP In this rather odd situation, the bridge will transmit multicast packets (and broadcast) by sending one on each of the slaved interfaces. This results in multiple packets through QoS, which is considered "bad". To avoid this, multicast/broadcast packets can be marked via ebtables for special processing in the NetCP PA module before the packets are queued for transmission. Packets thus recognized are NOT marked for egress via a specific slave port, and thus will be transmitted through all slave ports by the ALE in NetCP switch. To check if the interface is part of a bridge, a netcp_netdevice_event() handler is added to mark the interface part of a bridge or not and is used by the PA module. A new sysfs interface "mcast_filter" has been added to allow user to configure two u32 values: a "match" value and a "mask". As part of the pa tx hook, it checks if the interface is bridged. If true, it checks if special processing is needed by looking at the skb->mark field, it bitwise-ANDs the skb->mark value with the "mask" value and then compares the result with the "match" value. If these do not match, the mark is ignored and the packet is processed normally. However, if the "match" value matches, then the low-order 8 bits of the skb->mark field is used as a bitmask to determine whether the packet should be dropped. If the packet would normally have been directed to slave port 1, then bit 0 of skb->mark is checked; slave port 2 checks bit 1, etc. If the bit is set, then the packet is enqueued; If the bit is NOT set, the packet is silently dropped. An example... User enter echo "12345600 ffffff00" > /sys/devices/platform/soc/2620110.netcp/mcast_filter The runtime configuration scripts execute this command: ebtables -A OUTPUT -d Multicast -j mark \ --mark-set 0x12345601 --mark-target ACCEPT When the bridge attempts to send multicast packet, it will send one packet to each of the slave interfaces. The packet sent by the bridge to slave interface eth0 (ethss slave port 1) will be passed to the NetCP switch, and the ALE will send this packet on all slave ports. The packets sent by the bridge to other slave interfaces (eth1, NetCP switch slave port 2) will be silently dropped. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Reece R. Pollack <x0183204@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Tested-by: Wingman Kwok <w-kwok2@ti.com>