net: microchip: sparx5: Discard frames with SMAC multicast addresses
authorSteen Hegelund <steen.hegelund@microchip.com>
Tue, 14 Feb 2023 10:40:40 +0000 (11:40 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 16 Feb 2023 07:59:48 +0000 (08:59 +0100)
A valid frame should never use a multicast address as its source MAC
address, so discard these invalid frames.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microchip/sparx5/sparx5_port.c

index 246259b2ae94c68dec3e887c6e6a59f7a76a1c3f..3a1b1a1f5a1951069f9c3e5ee5e3a10c1be55eb6 100644 (file)
@@ -1071,6 +1071,11 @@ int sparx5_port_init(struct sparx5 *sparx5,
        /* Discard pause frame 01-80-C2-00-00-01 */
        spx5_wr(PAUSE_DISCARD, sparx5, ANA_CL_CAPTURE_BPDU_CFG(port->portno));
 
+       /* Discard SMAC multicast */
+       spx5_rmw(ANA_CL_FILTER_CTRL_FILTER_SMAC_MC_DIS_SET(0),
+                ANA_CL_FILTER_CTRL_FILTER_SMAC_MC_DIS,
+                sparx5, ANA_CL_FILTER_CTRL(port->portno));
+
        if (conf->portmode == PHY_INTERFACE_MODE_QSGMII ||
            conf->portmode == PHY_INTERFACE_MODE_SGMII) {
                err = sparx5_serdes_set(sparx5, port, conf);