From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"David S . Miller" <davem@davemloft.net>,
Kalle Valo <kvalo@codeaurora.org>
Subject: [PATCH 15/32] staging: wfx: drop useless link_map_cache
Date: Wed, 1 Apr 2020 13:03:48 +0200 [thread overview]
Message-ID: <20200401110405.80282-16-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200401110405.80282-1-Jerome.Pouiller@silabs.com>
From: Jérôme Pouiller <jerome.pouiller@silabs.com>
Driver does not use link_map_cache anymore. So we can drop it. In add,
we do not have to keep this counter in sync with skb_queue item, so we
can drop explicit spin_locks.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
drivers/staging/wfx/queue.c | 60 ++++++++-----------------------------
drivers/staging/wfx/queue.h | 3 --
2 files changed, 12 insertions(+), 51 deletions(-)
diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c
index 6fa8f4e083d3..82c2781b1f78 100644
--- a/drivers/staging/wfx/queue.c
+++ b/drivers/staging/wfx/queue.c
@@ -94,20 +94,10 @@ void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif)
static void wfx_tx_queue_clear(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff_head *gc_list)
{
- int i;
struct sk_buff *item;
- struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
- spin_lock_bh(&queue->queue.lock);
- while ((item = __skb_dequeue(&queue->queue)) != NULL)
+ while ((item = skb_dequeue(&queue->queue)) != NULL)
skb_queue_head(gc_list, item);
- spin_lock_nested(&stats->pending.lock, 1);
- for (i = 0; i < ARRAY_SIZE(stats->link_map_cache); ++i) {
- stats->link_map_cache[i] -= queue->link_map_cache[i];
- queue->link_map_cache[i] = 0;
- }
- spin_unlock(&stats->pending.lock);
- spin_unlock_bh(&queue->queue.lock);
}
void wfx_tx_queues_clear(struct wfx_dev *wdev)
@@ -163,28 +153,15 @@ int wfx_tx_queue_get_num_queued(struct wfx_queue *queue)
void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff *skb)
{
- struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
- struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
-
- WARN(tx_priv->link_id >= ARRAY_SIZE(stats->link_map_cache), "invalid link-id value");
- spin_lock_bh(&queue->queue.lock);
- __skb_queue_tail(&queue->queue, skb);
-
- ++queue->link_map_cache[tx_priv->link_id];
-
- spin_lock_nested(&stats->pending.lock, 1);
- ++stats->link_map_cache[tx_priv->link_id];
- spin_unlock(&stats->pending.lock);
- spin_unlock_bh(&queue->queue.lock);
+ skb_queue_tail(&queue->queue, skb);
}
static struct sk_buff *wfx_tx_queue_get(struct wfx_dev *wdev,
struct wfx_queue *queue,
u32 link_id_map)
{
- struct sk_buff *skb = NULL;
- struct sk_buff *item;
struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
+ struct sk_buff *item, *skb = NULL;
struct wfx_tx_priv *tx_priv;
spin_lock_bh(&queue->queue.lock);
@@ -195,39 +172,28 @@ static struct sk_buff *wfx_tx_queue_get(struct wfx_dev *wdev,
break;
}
}
+ spin_unlock_bh(&queue->queue.lock);
if (skb) {
+ skb_unlink(skb, &queue->queue);
tx_priv = wfx_skb_tx_priv(skb);
tx_priv->xmit_timestamp = ktime_get();
- __skb_unlink(skb, &queue->queue);
- --queue->link_map_cache[tx_priv->link_id];
-
- spin_lock_nested(&stats->pending.lock, 1);
- __skb_queue_tail(&stats->pending, skb);
- --stats->link_map_cache[tx_priv->link_id];
- spin_unlock(&stats->pending.lock);
+ skb_queue_tail(&stats->pending, skb);
+ if (skb_queue_empty(&queue->queue))
+ wake_up(&stats->wait_link_id_empty);
+ return skb;
}
- spin_unlock_bh(&queue->queue.lock);
- if (skb_queue_empty(&queue->queue))
- wake_up(&stats->wait_link_id_empty);
return skb;
}
int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb)
{
struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
- struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
struct wfx_queue *queue = &wdev->tx_queue[skb_get_queue_mapping(skb)];
WARN_ON(skb_get_queue_mapping(skb) > 3);
- spin_lock_bh(&queue->queue.lock);
- ++queue->link_map_cache[tx_priv->link_id];
- spin_lock_nested(&stats->pending.lock, 1);
- ++stats->link_map_cache[tx_priv->link_id];
- __skb_unlink(skb, &stats->pending);
- spin_unlock(&stats->pending.lock);
- __skb_queue_tail(&queue->queue, skb);
- spin_unlock_bh(&queue->queue.lock);
+ skb_unlink(skb, &stats->pending);
+ skb_queue_tail(&queue->queue, skb);
return 0;
}
@@ -235,9 +201,7 @@ int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb)
{
struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
- spin_lock_bh(&stats->pending.lock);
- __skb_unlink(skb, &stats->pending);
- spin_unlock_bh(&stats->pending.lock);
+ skb_unlink(skb, &stats->pending);
wfx_skb_dtor(wdev, skb);
return 0;
diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h
index 58da216d47dd..dd141cb4bf63 100644
--- a/drivers/staging/wfx/queue.h
+++ b/drivers/staging/wfx/queue.h
@@ -16,18 +16,15 @@
#define WFX_LINK_ID_NO_ASSOC 15
#define WFX_LINK_ID_AFTER_DTIM (WFX_LINK_ID_NO_ASSOC + 1)
#define WFX_LINK_ID_UAPSD (WFX_LINK_ID_NO_ASSOC + 2)
-#define WFX_LINK_ID_MAX (WFX_LINK_ID_NO_ASSOC + 3)
struct wfx_dev;
struct wfx_vif;
struct wfx_queue {
struct sk_buff_head queue;
- int link_map_cache[WFX_LINK_ID_MAX];
};
struct wfx_queue_stats {
- int link_map_cache[WFX_LINK_ID_MAX];
struct sk_buff_head pending;
wait_queue_head_t wait_link_id_empty;
};
--
2.25.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2020-04-01 11:39 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 11:03 [PATCH 00/32] staging: wfx: rework the Tx queue Jerome Pouiller
2020-04-01 11:03 ` [PATCH 01/32] staging: wfx: add sanity checks to hif_join() Jerome Pouiller
2020-04-02 12:42 ` Dan Carpenter
2020-04-02 16:14 ` Jérôme Pouiller
2020-04-01 11:03 ` [PATCH 02/32] staging: wfx: do not stop mac80211 queueing during tx_policy upload Jerome Pouiller
2020-04-01 11:03 ` [PATCH 03/32] staging: wfx: take advantage of ieee80211_{stop/start}_queues Jerome Pouiller
2020-04-01 11:03 ` [PATCH 04/32] staging: wfx: remove "burst" mechanism Jerome Pouiller
2020-04-02 13:05 ` Dan Carpenter
2020-04-02 14:47 ` Jérôme Pouiller
2020-04-01 11:03 ` [PATCH 05/32] staging: wfx: uniformize queue_id retrieval Jerome Pouiller
2020-04-01 11:03 ` [PATCH 06/32] staging: wfx: drop useless queue_id field Jerome Pouiller
2020-04-01 11:03 ` [PATCH 07/32] staging: wfx: avoid useless wake_up Jerome Pouiller
2020-04-01 11:03 ` [PATCH 08/32] staging: wfx: simplify hif_handle_tx_data() Jerome Pouiller
2020-04-02 13:13 ` Dan Carpenter
2020-04-02 14:44 ` Jérôme Pouiller
2020-04-01 11:03 ` [PATCH 09/32] staging: wfx: simplify wfx_tx_queues_empty() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 10/32] staging: wfx: drop unused argument in wfx_get_prio_queue() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 11/32] staging: wfx: simplify wfx_tx_queue_mask_get() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 12/32] staging: wfx: drop useless sta_asleep_mask Jerome Pouiller
2020-04-01 11:03 ` [PATCH 13/32] staging: wfx: drop argument tx_allowed_mask since it is constant now Jerome Pouiller
2020-04-01 11:03 ` [PATCH 14/32] staging: wfx: do not use link_map_cache to track CAB Jerome Pouiller
2020-04-01 11:03 ` Jerome Pouiller [this message]
2020-04-01 11:03 ` [PATCH 16/32] staging: wfx: do not rely anymore on link_id to choose packet in queue Jerome Pouiller
2020-04-01 11:03 ` [PATCH 17/32] staging: wfx: drop unused link_id field Jerome Pouiller
2020-04-01 11:03 ` [PATCH 18/32] staging: wfx: drop unused raw_link_id field Jerome Pouiller
2020-04-01 11:03 ` [PATCH 19/32] staging: wfx: rename wfx_tx_get_raw_link_id() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 20/32] staging: wfx: replace wfx_tx_queues_get_after_dtim() by wfx_tx_queues_has_cab() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 21/32] staging: wfx: introduce a counter of pending frames Jerome Pouiller
2020-04-01 11:03 ` [PATCH 22/32] staging: wfx: change the way to choose frame to send Jerome Pouiller
2020-04-01 11:03 ` [PATCH 23/32] staging: wfx: drop now useless field edca_params Jerome Pouiller
2020-04-01 11:03 ` [PATCH 24/32] staging: wfx: drop struct wfx_queue_stats Jerome Pouiller
2020-04-01 11:03 ` [PATCH 25/32] staging: wfx: simplify usage of wfx_tx_queues_put() Jerome Pouiller
2020-04-01 11:03 ` [PATCH 26/32] staging: wfx: improve interface between data_tx.c and queue.c Jerome Pouiller
2020-04-01 11:04 ` [PATCH 27/32] staging: wfx: relocate wfx_skb_dtor() prior its callers Jerome Pouiller
2020-04-01 11:04 ` [PATCH 28/32] staging: wfx: repair wfx_flush() Jerome Pouiller
2020-04-01 11:04 ` [PATCH 29/32] staging: wfx: wfx_flush() did not ensure that frames are processed Jerome Pouiller
2020-04-01 11:04 ` [PATCH 30/32] staging: wfx: fix potential deadlock in wfx_tx_flush() Jerome Pouiller
2020-04-01 11:04 ` [PATCH 31/32] staging: wfx: fix case where AP stop with CAB traffic pending Jerome Pouiller
2020-04-01 11:04 ` [PATCH 32/32] staging: wfx: remove hack about tx_rate policies Jerome Pouiller
2020-04-03 8:03 ` [PATCH 00/32] staging: wfx: rework the Tx queue Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200401110405.80282-16-Jerome.Pouiller@silabs.com \
--to=jerome.pouiller@silabs.com \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).