Skip to content

Commit 666f166

Browse files
ffainellikelmously
authored andcommitted
net: systemport: Fixed queue mapping in internal ring map
BugLink: https://bugs.launchpad.net/bugs/1862429 [ Upstream commit 5a9ef19 ] We would not be transmitting using the correct SYSTEMPORT transmit queue during ndo_select_queue() which looks up the internal TX ring map because while establishing the mapping we would be off by 4, so for instance, when we populate switch port mappings we would be doing: switch port 0, queue 0 -> ring index #0 switch port 0, queue 1 -> ring index #1 ... switch port 0, queue 3 -> ring index #3 switch port 1, queue 0 -> ring index #8 (4 + 4 * 1) ... instead of using ring index #4. This would cause our ndo_select_queue() to use the fallback queue mechanism which would pick up an incorrect ring for that switch port. Fix this by using the correct switch queue number instead of SYSTEMPORT queue number. Fixes: 25c4407 ("net: systemport: Simplify queue mapping logic") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
1 parent 4a4278c commit 666f166

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,7 @@ static int bcm_sysport_map_queues(struct notifier_block *nb,
23242324
ring->switch_queue = qp;
23252325
ring->switch_port = port;
23262326
ring->inspect = true;
2327-
priv->ring_map[q + port * num_tx_queues] = ring;
2327+
priv->ring_map[qp + port * num_tx_queues] = ring;
23282328
qp++;
23292329
}
23302330

@@ -2339,7 +2339,7 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb,
23392339
struct net_device *slave_dev;
23402340
unsigned int num_tx_queues;
23412341
struct net_device *dev;
2342-
unsigned int q, port;
2342+
unsigned int q, qp, port;
23432343

23442344
priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
23452345
if (priv->netdev != info->master)
@@ -2365,7 +2365,8 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb,
23652365
continue;
23662366

23672367
ring->inspect = false;
2368-
priv->ring_map[q + port * num_tx_queues] = NULL;
2368+
qp = ring->switch_queue;
2369+
priv->ring_map[qp + port * num_tx_queues] = NULL;
23692370
}
23702371

23712372
return 0;

0 commit comments

Comments
 (0)