]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sunvnet: track port queues correctly
authorShannon Nelson <shannon.nelson@oracle.com>
Tue, 14 Mar 2017 17:24:41 +0000 (10:24 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 24 Apr 2017 04:43:20 +0000 (21:43 -0700)
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>
(cherry-picked from commit e1f1e5f711265ee9d881afd12ff252b2d01e1174)

Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/net/ethernet/sun/sunvnet_common.c
drivers/net/ethernet/sun/sunvnet_common.h

index d94409c4b972d75262f8c5a8b836f8e2af89fb34..9255fe72a23536e4091df840eaa34442ab4a4689 100644 (file)
@@ -1764,11 +1764,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));
 }
@@ -1779,5 +1793,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);
index f356533206a35f3b3ddf57be32710eb0795ce7db..9712fbffaf5b1ff083e4eef3b102d6f6830d72a5 100644 (file)
@@ -110,22 +110,15 @@ struct vnet_mcast_entry {
 };
 
 struct vnet {
-       /* Protects port_list and port_hash.  */
-       spinlock_t              lock;
-
+       spinlock_t              lock; /* Protects port_list and port_hash.  */
        struct net_device       *dev;
-
        u32                     msg_enable;
-
+       u8                      q_used[VNET_MAX_TXQS];
        struct list_head        port_list;
-
        struct hlist_head       port_hash[VNET_PORT_HASH_SIZE];
-
        struct vnet_mcast_entry *mcast_list;
-
        struct list_head        list;
        u64                     local_mac;
-
        int                     nports;
 };