QCA8K_REG_EEE_CTRL_LPI_EN() is used as a bitmask in qca8k_set_mac_eee(), but was defined as a bit shift index instead of BIT(). Wrap it in BIT() so LPI enable bits are set and cleared properly per port. While at it, move out the fixed offset of 2 bits, making _i alone wrapped in parentheses to address a checkpatch warning. Verified on a Netgear R7800 device with the QCA8337 switch on a port with an EEE-enabled peer that with the fix, after enabling EEE via ethtool, the MDIO_STAT1 register indicates the MAC requests TX LPI correctly. Signed-off-by: Tomasz Figa --- drivers/net/dsa/qca/qca8k.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 956338893032..c33871f63cb2 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -174,7 +174,7 @@ /* EEE control registers */ #define QCA8K_REG_EEE_CTRL 0x100 -#define QCA8K_REG_EEE_CTRL_LPI_EN(_i) ((_i + 1) * 2) +#define QCA8K_REG_EEE_CTRL_LPI_EN(_i) BIT(2 + (_i) * 2) /* TRUNK_HASH_EN registers */ #define QCA8K_TRUNK_HASH_EN_CTRL 0x270 -- 2.56.1