aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun/sunvnet_common.c
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@oracle.com>2017-03-14 10:24:41 -0700
committerDavid S. Miller <davem@davemloft.net>2017-03-16 20:29:54 -0700
commite1f1e5f711265ee9d881afd12ff252b2d01e1174 (patch)
treed973d04b411290eb82d6ca53d2eaab9079df3adf /drivers/net/ethernet/sun/sunvnet_common.c
parentsunvnet: add stats to track ldom to ldom packets and bytes (diff)
downloadlinux-dev-e1f1e5f711265ee9d881afd12ff252b2d01e1174.tar.xz
linux-dev-e1f1e5f711265ee9d881afd12ff252b2d01e1174.zip
sunvnet: track port queues correctly
Track our used and unused queue indexies correctly. Otherwise, as ports dropped out and returned, they all eventually ended up with the same queue index. Orabug: 25190537 Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun/sunvnet_common.c')
-rw-r--r--drivers/net/ethernet/sun/sunvnet_common.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c
index 7e95808f8227..f8d1cc7e4977 100644
--- a/drivers/net/ethernet/sun/sunvnet_common.c
+++ b/drivers/net/ethernet/sun/sunvnet_common.c
@@ -1728,11 +1728,25 @@ EXPORT_SYMBOL_GPL(sunvnet_poll_controller_common);
void sunvnet_port_add_txq_common(struct vnet_port *port)
{
struct vnet *vp = port->vp;
- int n;
+ int smallest = 0;
+ int i;
+
+ /* find the first least-used q
+ * When there are more ldoms than q's, we start to
+ * double up on ports per queue.
+ */
+ for (i = 0; i < VNET_MAX_TXQS; i++) {
+ if (vp->q_used[i] == 0) {
+ smallest = i;
+ break;
+ }
+ if (vp->q_used[i] < vp->q_used[smallest])
+ smallest = i;
+ }
- n = vp->nports++;
- n = n & (VNET_MAX_TXQS - 1);
- port->q_index = n;
+ vp->nports++;
+ vp->q_used[smallest]++;
+ port->q_index = smallest;
netif_tx_wake_queue(netdev_get_tx_queue(VNET_PORT_TO_NET_DEVICE(port),
port->q_index));
}
@@ -1743,5 +1757,7 @@ void sunvnet_port_rm_txq_common(struct vnet_port *port)
port->vp->nports--;
netif_tx_stop_queue(netdev_get_tx_queue(VNET_PORT_TO_NET_DEVICE(port),
port->q_index));
+ port->vp->q_used[port->q_index]--;
+ port->q_index = 0;
}
EXPORT_SYMBOL_GPL(sunvnet_port_rm_txq_common);