ath79: ag71xx: preserve port mirror flags during swconfig apply
authorMilan Krstic <milan.krstic@gmail.com>
Mon, 21 Jan 2019 21:26:33 +0000 (22:26 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 22 Jan 2019 08:05:59 +0000 (09:05 +0100)
The swconfig load operation always triggers 'apply' function which in
this driver currently clears port mirroring flags effectively undoing
port mirroring configuration.

Signed-off-by: Milan Krstic <milan.krstic@gmail.com>
target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c

index 173c16a53dfd41b9f78a4fc4355f25ad9acd3230..77f7670c2b8cb1b40e720228c1b43699c99ebe6a 100644 (file)
@@ -742,6 +742,10 @@ static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask)
                        portmask = ar7240sw_port_mask(as, AR7240_PORT_CPU);
        }
 
+       /* preserve mirror rx&tx flags */
+       ctrl |= ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)) &
+               (AR7240_PORT_CTRL_MIRROR_RX | AR7240_PORT_CTRL_MIRROR_TX);
+
        /* allow the port to talk to all other ports, but exclude its
         * own ID to prevent frames from being reflected back to the
         * port that they came from */