[OpenWrt-Devel] [BUG] lantiq: net: wrong operator

Petr Cvek petrcvekcz at gmail.com
Fri Feb 8 03:23:11 EST 2019


Hello,

There is a wrong code in 0025-NET-MIPS-lantiq-adds-xrx200-net.patch [1], the original code:

+	link->rx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0010);
+	link->tx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0020);

wants to mask the register value and is using a logical AND and not a bitwise AND. 

The fix should be:

+	link->rx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) & 0x0010);
+	link->tx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) & 0x0020);

References:
[1] https://github.com/openwrt/openwrt/blob/master/target/linux/lantiq/patches-4.14/0025-NET-MIPS-lantiq-adds-xrx200-net.patch#L937

Petr Cvek

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list