net: systemport: Only inspect valid switch port & queues
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 1 Nov 2017 18:29:47 +0000 (11:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Nov 2017 07:49:28 +0000 (16:49 +0900)
Hesoteric board configurations where port 0 is not available would still
make SYSTEMPORT inspect the switch port 0, queue 0, which, not being
enabled, would cause transmit timeouts over time. Just ignore those
unconfigured rings instead.

Fixes: 84ff33eeb23d ("net: systemport: Establish DSA network device queue mapping")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bcmsysport.c
drivers/net/ethernet/broadcom/bcmsysport.h

index dcee843d05d7b126f4e4d539edffdb1bbe5c967e..e6da9b165bbe47ae14bab98ef0d62f87fe0b9555 100644 (file)
@@ -1420,8 +1420,12 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
        /* Configure QID and port mapping */
        reg = tdma_readl(priv, TDMA_DESC_RING_MAPPING(index));
        reg &= ~(RING_QID_MASK | RING_PORT_ID_MASK << RING_PORT_ID_SHIFT);
-       reg |= ring->switch_queue & RING_QID_MASK;
-       reg |= ring->switch_port << RING_PORT_ID_SHIFT;
+       if (ring->inspect) {
+               reg |= ring->switch_queue & RING_QID_MASK;
+               reg |= ring->switch_port << RING_PORT_ID_SHIFT;
+       } else {
+               reg |= RING_IGNORE_STATUS;
+       }
        tdma_writel(priv, reg, TDMA_DESC_RING_MAPPING(index));
        tdma_writel(priv, 0, TDMA_DESC_RING_PCP_DEI_VID(index));
 
@@ -2108,6 +2112,7 @@ static int bcm_sysport_map_queues(struct net_device *dev,
                 */
                ring->switch_queue = q;
                ring->switch_port = port;
+               ring->inspect = true;
                priv->ring_map[q + port * num_tx_queues] = ring;
 
                /* Set all queues as being used now */
index 82f70a6783cba0d64aaee85ae36019cde0a9fb55..f5a984c1c986535f3421bafd9c851ec995ccf3b0 100644 (file)
@@ -714,6 +714,7 @@ struct bcm_sysport_tx_ring {
        unsigned long   bytes;          /* bytes statistics */
        unsigned int    switch_queue;   /* switch port queue number */
        unsigned int    switch_port;    /* switch port queue number */
+       bool            inspect;        /* inspect switch port and queue */
 };
 
 /* Driver private structure */