net: mscc: ocelot: export a single ocelot_mm_irq()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 15 Apr 2023 17:05:45 +0000 (20:05 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 18 Apr 2023 02:01:18 +0000 (19:01 -0700)
When the switch emits an IRQ, we don't know what caused it, and we
iterate through all ports to check the MAC Merge status.

Move that iteration inside the ocelot lib; we will change the locking in
a future change and it would be good to encapsulate that lock completely
within the ocelot lib.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/ethernet/mscc/ocelot_mm.c
include/soc/mscc/ocelot.h

index dddb28984bdfc41b089bcf6205bc4ae466e1b54e..478893c06f563bffe527b5d130e38d0296dec39a 100644 (file)
@@ -2610,12 +2610,9 @@ static const struct felix_info felix_info_vsc9959 = {
 static irqreturn_t felix_irq_handler(int irq, void *data)
 {
        struct ocelot *ocelot = (struct ocelot *)data;
-       int port;
 
        ocelot_get_txtstamp(ocelot);
-
-       for (port = 0; port < ocelot->num_phys_ports; port++)
-               ocelot_port_mm_irq(ocelot, port);
+       ocelot_mm_irq(ocelot);
 
        return IRQ_HANDLED;
 }
index 0a8f21ae23f027f4731d365442950c5893015121..ddaf1fb05e485c381c502b52e9ccc4e7507f8617 100644 (file)
@@ -49,7 +49,7 @@ static enum ethtool_mm_verify_status ocelot_mm_verify_status(u32 val)
        }
 }
 
-void ocelot_port_mm_irq(struct ocelot *ocelot, int port)
+static void ocelot_mm_update_port_status(struct ocelot *ocelot, int port)
 {
        struct ocelot_port *ocelot_port = ocelot->ports[port];
        struct ocelot_mm_state *mm = &ocelot->mm[port];
@@ -91,7 +91,15 @@ void ocelot_port_mm_irq(struct ocelot *ocelot, int port)
 
        mutex_unlock(&mm->lock);
 }
-EXPORT_SYMBOL_GPL(ocelot_port_mm_irq);
+
+void ocelot_mm_irq(struct ocelot *ocelot)
+{
+       int port;
+
+       for (port = 0; port < ocelot->num_phys_ports; port++)
+               ocelot_mm_update_port_status(ocelot, port);
+}
+EXPORT_SYMBOL_GPL(ocelot_mm_irq);
 
 int ocelot_port_set_mm(struct ocelot *ocelot, int port,
                       struct ethtool_mm_cfg *cfg,
index 277e6d1f2096eda8b7ed26022b63356852d991f8..eb8e3935375def18073ee93f3d00628706915a8a 100644 (file)
@@ -1148,7 +1148,7 @@ int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
                            struct ocelot_policer *pol);
 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
 
-void ocelot_port_mm_irq(struct ocelot *ocelot, int port);
+void ocelot_mm_irq(struct ocelot *ocelot);
 int ocelot_port_set_mm(struct ocelot *ocelot, int port,
                       struct ethtool_mm_cfg *cfg,
                       struct netlink_ext_ack *extack);