net:ethernet:aquantia: Extra spinlocks removed.
authorPavel Belous <pavel.belous@aquantia.com>
Mon, 28 Aug 2017 18:52:08 +0000 (21:52 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Aug 2017 22:11:43 +0000 (15:11 -0700)
This patch removes datapath spinlocks which does not perform any
useful work.

Fixes: 6e70637f9f1e ("net: ethernet: aquantia: Add ring support code")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
drivers/net/ethernet/aquantia/atlantic/aq_utils.h
drivers/net/ethernet/aquantia/atlantic/aq_vec.c

index 9ee1c501678409719f460912c6316b803c2dc7fc..08b727506575e7acf258a737972b4a4b54ed5ae4 100644 (file)
@@ -597,14 +597,11 @@ exit:
 }
 
 int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
-__releases(&ring->lock)
-__acquires(&ring->lock)
 {
        struct aq_ring_s *ring = NULL;
        unsigned int frags = 0U;
        unsigned int vec = skb->queue_mapping % self->aq_nic_cfg.vecs;
        unsigned int tc = 0U;
-       unsigned int trys = AQ_CFG_LOCK_TRYS;
        int err = NETDEV_TX_OK;
        bool is_nic_in_bad_state;
 
@@ -628,36 +625,21 @@ __acquires(&ring->lock)
                goto err_exit;
        }
 
-       do {
-               if (spin_trylock(&ring->header.lock)) {
-                       frags = aq_nic_map_skb(self, skb, ring);
-
-                       if (likely(frags)) {
-                               err = self->aq_hw_ops.hw_ring_tx_xmit(
-                                                               self->aq_hw,
-                                                               ring, frags);
-                               if (err >= 0) {
-                                       if (aq_ring_avail_dx(ring) <
-                                           AQ_CFG_SKB_FRAGS_MAX + 1)
-                                               aq_nic_ndev_queue_stop(
-                                                               self,
-                                                               ring->idx);
-
-                                       ++ring->stats.tx.packets;
-                                       ring->stats.tx.bytes += skb->len;
-                               }
-                       } else {
-                               err = NETDEV_TX_BUSY;
-                       }
+       frags = aq_nic_map_skb(self, skb, ring);
 
-                       spin_unlock(&ring->header.lock);
-                       break;
-               }
-       } while (--trys);
+       if (likely(frags)) {
+               err = self->aq_hw_ops.hw_ring_tx_xmit(self->aq_hw,
+                                                     ring,
+                                                     frags);
+               if (err >= 0) {
+                       if (aq_ring_avail_dx(ring) < AQ_CFG_SKB_FRAGS_MAX + 1)
+                               aq_nic_ndev_queue_stop(self, ring->idx);
 
-       if (!trys) {
+                       ++ring->stats.tx.packets;
+                       ring->stats.tx.bytes += skb->len;
+               }
+       } else {
                err = NETDEV_TX_BUSY;
-               goto err_exit;
        }
 
 err_exit:
index 9a0817938eca38526e4c746680efe2845e9b1e51..ec5579fb8268b29c6040f524fe20495b43fa617d 100644 (file)
@@ -101,7 +101,6 @@ int aq_ring_init(struct aq_ring_s *self)
        self->hw_head = 0;
        self->sw_head = 0;
        self->sw_tail = 0;
-       spin_lock_init(&self->header.lock);
        return 0;
 }
 
index f6012b34abe690471e3e317ccf3731e3f45506fc..e12bcdfb874a4409f8ccec886f626b19b48b2b52 100644 (file)
@@ -17,7 +17,6 @@
 #define AQ_DIMOF(_ARY_)  ARRAY_SIZE(_ARY_)
 
 struct aq_obj_s {
-       spinlock_t lock; /* spinlock for nic/rings processing */
        atomic_t flags;
 };
 
index ad5b4d4dac7f6c7a5626ce5b86b9ca6d1a37f012..fee446af748ff1a64a984cf4b5ec12dce46471d1 100644 (file)
@@ -34,8 +34,6 @@ struct aq_vec_s {
 #define AQ_VEC_RX_ID 1
 
 static int aq_vec_poll(struct napi_struct *napi, int budget)
-__releases(&self->lock)
-__acquires(&self->lock)
 {
        struct aq_vec_s *self = container_of(napi, struct aq_vec_s, napi);
        struct aq_ring_s *ring = NULL;
@@ -47,7 +45,7 @@ __acquires(&self->lock)
 
        if (!self) {
                err = -EINVAL;
-       } else if (spin_trylock(&self->header.lock)) {
+       } else {
                for (i = 0U, ring = self->ring[0];
                        self->tx_rings > i; ++i, ring = self->ring[i]) {
                        if (self->aq_hw_ops->hw_ring_tx_head_update) {
@@ -105,11 +103,8 @@ __acquires(&self->lock)
                        self->aq_hw_ops->hw_irq_enable(self->aq_hw,
                                        1U << self->aq_ring_param.vec_idx);
                }
-
-err_exit:
-               spin_unlock(&self->header.lock);
        }
-
+err_exit:
        return work_done;
 }
 
@@ -185,8 +180,6 @@ int aq_vec_init(struct aq_vec_s *self, struct aq_hw_ops *aq_hw_ops,
        self->aq_hw_ops = aq_hw_ops;
        self->aq_hw = aq_hw;
 
-       spin_lock_init(&self->header.lock);
-
        for (i = 0U, ring = self->ring[0];
                self->tx_rings > i; ++i, ring = self->ring[i]) {
                err = aq_ring_init(&ring[AQ_VEC_TX_ID]);