OSDN Git Service

net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled
[tomoyo/tomoyo-test1.git] / drivers / net / ethernet / mscc / ocelot.c
index 729ba82..559177e 100644 (file)
@@ -1293,14 +1293,19 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond,
        return mask;
 }
 
-static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot,
+static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port,
                                      struct net_device *bridge)
 {
+       struct ocelot_port *ocelot_port = ocelot->ports[src_port];
        u32 mask = 0;
        int port;
 
+       if (!ocelot_port || ocelot_port->bridge != bridge ||
+           ocelot_port->stp_state != BR_STATE_FORWARDING)
+               return 0;
+
        for (port = 0; port < ocelot->num_phys_ports; port++) {
-               struct ocelot_port *ocelot_port = ocelot->ports[port];
+               ocelot_port = ocelot->ports[port];
 
                if (!ocelot_port)
                        continue;
@@ -1366,7 +1371,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot)
                        struct net_device *bridge = ocelot_port->bridge;
                        struct net_device *bond = ocelot_port->bond;
 
-                       mask = ocelot_get_bridge_fwd_mask(ocelot, bridge);
+                       mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge);
                        mask |= cpu_fwd_mask;
                        mask &= ~BIT(port);
                        if (bond) {