Skip to content

Commit fbf557d

Browse files
Doug Bergerdavem330
authored andcommitted
net: bcmgenet: cleanup ring interrupt masking and unmasking
Since the NAPI interrupts are basically ignored when NAPI is disabled we don't need to mask them within the functions bcmgenet_disable_tx_napi() and bcmgenet_disable_rx_napi(). So wait until all NAPI instances are disabled and mask all of the bcmgenet driver interrupts together in bcmgenet_netif_stop(). The interrupts can still be enabled in the functions bcmgenet_enable_tx_napi() and bcmgenet_enable_rx_napi(), but use the ring context int_enable() method to keep the functionality consistent and the code cleaner. Signed-off-by: Doug Berger <opendmb@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7587935 commit fbf557d

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,33 +2147,24 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv,
21472147
static void bcmgenet_enable_tx_napi(struct bcmgenet_priv *priv)
21482148
{
21492149
unsigned int i;
2150-
u32 int0_enable = UMAC_IRQ_TXDMA_DONE;
2151-
u32 int1_enable = 0;
21522150
struct bcmgenet_tx_ring *ring;
21532151

21542152
for (i = 0; i < priv->hw_params->tx_queues; ++i) {
21552153
ring = &priv->tx_rings[i];
21562154
napi_enable(&ring->napi);
2157-
int1_enable |= (1 << i);
2155+
ring->int_enable(ring);
21582156
}
21592157

21602158
ring = &priv->tx_rings[DESC_INDEX];
21612159
napi_enable(&ring->napi);
2162-
2163-
bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
2164-
bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR);
2160+
ring->int_enable(ring);
21652161
}
21662162

21672163
static void bcmgenet_disable_tx_napi(struct bcmgenet_priv *priv)
21682164
{
21692165
unsigned int i;
2170-
u32 int0_disable = UMAC_IRQ_TXDMA_DONE;
2171-
u32 int1_disable = 0xffff;
21722166
struct bcmgenet_tx_ring *ring;
21732167

2174-
bcmgenet_intrl2_0_writel(priv, int0_disable, INTRL2_CPU_MASK_SET);
2175-
bcmgenet_intrl2_1_writel(priv, int1_disable, INTRL2_CPU_MASK_SET);
2176-
21772168
for (i = 0; i < priv->hw_params->tx_queues; ++i) {
21782169
ring = &priv->tx_rings[i];
21792170
napi_disable(&ring->napi);
@@ -2269,33 +2260,24 @@ static void bcmgenet_init_tx_queues(struct net_device *dev)
22692260
static void bcmgenet_enable_rx_napi(struct bcmgenet_priv *priv)
22702261
{
22712262
unsigned int i;
2272-
u32 int0_enable = UMAC_IRQ_RXDMA_DONE;
2273-
u32 int1_enable = 0;
22742263
struct bcmgenet_rx_ring *ring;
22752264

22762265
for (i = 0; i < priv->hw_params->rx_queues; ++i) {
22772266
ring = &priv->rx_rings[i];
22782267
napi_enable(&ring->napi);
2279-
int1_enable |= (1 << (UMAC_IRQ1_RX_INTR_SHIFT + i));
2268+
ring->int_enable(ring);
22802269
}
22812270

22822271
ring = &priv->rx_rings[DESC_INDEX];
22832272
napi_enable(&ring->napi);
2284-
2285-
bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
2286-
bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR);
2273+
ring->int_enable(ring);
22872274
}
22882275

22892276
static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)
22902277
{
22912278
unsigned int i;
2292-
u32 int0_disable = UMAC_IRQ_RXDMA_DONE;
2293-
u32 int1_disable = 0xffff << UMAC_IRQ1_RX_INTR_SHIFT;
22942279
struct bcmgenet_rx_ring *ring;
22952280

2296-
bcmgenet_intrl2_0_writel(priv, int0_disable, INTRL2_CPU_MASK_SET);
2297-
bcmgenet_intrl2_1_writel(priv, int1_disable, INTRL2_CPU_MASK_SET);
2298-
22992281
for (i = 0; i < priv->hw_params->rx_queues; ++i) {
23002282
ring = &priv->rx_rings[i];
23012283
napi_disable(&ring->napi);
@@ -2888,9 +2870,9 @@ static void bcmgenet_netif_stop(struct net_device *dev)
28882870

28892871
netif_tx_stop_all_queues(dev);
28902872
phy_stop(priv->phydev);
2891-
bcmgenet_intr_disable(priv);
28922873
bcmgenet_disable_rx_napi(priv);
28932874
bcmgenet_disable_tx_napi(priv);
2875+
bcmgenet_intr_disable(priv);
28942876

28952877
/* Wait for pending work items to complete. Since interrupts are
28962878
* disabled no new work will be scheduled.

0 commit comments

Comments
 (0)