enetc: Factor out the traffic start/stop procedures
authorClaudiu Manoil <claudiu.manoil@nxp.com>
Tue, 21 Jul 2020 07:55:18 +0000 (10:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 22:38:30 +0000 (15:38 -0700)
commitbbb96dc7fa1a82cd176994e8af4d7b1079b22a52
tree8bfa54adf369dadf0e85c8499a87ee469467e10d
parent02293dd4b79ec16ae0f680222768fb1582f03b42
enetc: Factor out the traffic start/stop procedures

A reliable traffic pause (and reconfiguration) procedure
is needed to be able to safely make h/w configuration
changes during run-time, like changing the mode in which the
interrupts are operating (i.e. with or without coalescing),
as opposed to making on-the-fly register updates that
may be subject to h/w or s/w concurrency issues.
To this end, the code responsible of the run-time device
configurations that basically starts resp. stops the traffic
flow through the device has been extracted from the
the enetc_open/_close procedures, to the separate standalone
enetc_start/_stop procedures. Traffic stop should be as
graceful as possible, it lets the executing napi threads to
to finish while the interrupts stay disabled.  But since
the napi thread will try to re-enable interrupts by clearing
the device's unmask register, the enable_irq/ disable_irq
API has been used to avoid this potential concurrency issue
and make the traffic pause procedure more reliable.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/enetc/enetc.c