All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 08/19] staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb()
Date: Fri, 15 May 2020 10:33:14 +0200	[thread overview]
Message-ID: <20200515083325.378539-9-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

wfx_tx_confirm_cb() is a big function. A big part of its body aims to
fill the rates list. So, create a new function wfx_tx_fill_rates() and
make wfx_tx_confirm_cb() smaller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c | 63 ++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 5d029b0718e9..2ba3b5c3d1a7 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -496,30 +496,14 @@ static void wfx_skb_dtor(struct wfx_dev *wdev,
 	ieee80211_tx_status_irqsafe(wdev->hw, skb);
 }
 
-void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
+static void wfx_tx_fill_rates(struct wfx_dev *wdev,
+			      struct ieee80211_tx_info *tx_info,
+			      const struct hif_cnf_tx *arg)
 {
-	int i;
-	int tx_count;
-	struct sk_buff *skb;
 	struct ieee80211_tx_rate *rate;
-	struct ieee80211_tx_info *tx_info;
-	const struct wfx_tx_priv *tx_priv;
-	bool has_sta;
+	int tx_count;
+	int i;
 
-	skb = wfx_pending_get(wvif->wdev, arg->packet_id);
-	if (!skb) {
-		dev_warn(wvif->wdev->dev,
-			 "received unknown packet_id (%#.8x) from chip\n",
-			 arg->packet_id);
-		return;
-	}
-	tx_info = IEEE80211_SKB_CB(skb);
-	tx_priv = wfx_skb_tx_priv(skb);
-	has_sta = tx_priv->has_sta;
-	_trace_tx_stats(arg, skb,
-			wfx_pending_get_pkt_us_delay(wvif->wdev, skb));
-
-	// You can touch to tx_priv, but don't touch to tx_info->status.
 	tx_count = arg->ack_failures;
 	if (!arg->status || arg->ack_failures)
 		tx_count += 1; // Also report success
@@ -530,15 +514,12 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 		if (tx_count < rate->count &&
 		    arg->status == HIF_STATUS_TX_FAIL_RETRIES &&
 		    arg->ack_failures)
-			dev_dbg(wvif->wdev->dev,
-				"all retries were not consumed: %d != %d\n",
+			dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n",
 				rate->count, tx_count);
 		if (tx_count <= rate->count && tx_count &&
-		    arg->txed_rate != wfx_get_hw_rate(wvif->wdev, rate))
-			dev_dbg(wvif->wdev->dev,
-				"inconsistent tx_info rates: %d != %d\n",
-				arg->txed_rate,
-				wfx_get_hw_rate(wvif->wdev, rate));
+		    arg->txed_rate != wfx_get_hw_rate(wdev, rate))
+			dev_dbg(wdev->dev, "inconsistent tx_info rates: %d != %d\n",
+				arg->txed_rate, wfx_get_hw_rate(wdev, rate));
 		if (tx_count > rate->count) {
 			tx_count -= rate->count;
 		} else if (!tx_count) {
@@ -550,8 +531,30 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 		}
 	}
 	if (tx_count)
-		dev_dbg(wvif->wdev->dev, "%d more retries than expected\n",
-			tx_count);
+		dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count);
+}
+
+void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
+{
+	struct ieee80211_tx_info *tx_info;
+	const struct wfx_tx_priv *tx_priv;
+	struct sk_buff *skb;
+	bool has_sta;
+
+	skb = wfx_pending_get(wvif->wdev, arg->packet_id);
+	if (!skb) {
+		dev_warn(wvif->wdev->dev, "received unknown packet_id (%#.8x) from chip\n",
+			 arg->packet_id);
+		return;
+	}
+	tx_info = IEEE80211_SKB_CB(skb);
+	tx_priv = wfx_skb_tx_priv(skb);
+	has_sta = tx_priv->has_sta;
+	_trace_tx_stats(arg, skb,
+			wfx_pending_get_pkt_us_delay(wvif->wdev, skb));
+
+	// You can touch to tx_priv, but don't touch to tx_info->status.
+	wfx_tx_fill_rates(wvif->wdev, tx_info, arg);
 	skb_trim(skb, skb->len - wfx_tx_get_icv_len(tx_priv->hw_key));
 
 	// From now, you can touch to tx_info->status, but do not touch to
-- 
2.26.2


WARNING: multiple messages have this Message-ID (diff)
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 08/19] staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb()
Date: Fri, 15 May 2020 10:33:14 +0200	[thread overview]
Message-ID: <20200515083325.378539-9-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

wfx_tx_confirm_cb() is a big function. A big part of its body aims to
fill the rates list. So, create a new function wfx_tx_fill_rates() and
make wfx_tx_confirm_cb() smaller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c | 63 ++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 5d029b0718e9..2ba3b5c3d1a7 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -496,30 +496,14 @@ static void wfx_skb_dtor(struct wfx_dev *wdev,
 	ieee80211_tx_status_irqsafe(wdev->hw, skb);
 }
 
-void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
+static void wfx_tx_fill_rates(struct wfx_dev *wdev,
+			      struct ieee80211_tx_info *tx_info,
+			      const struct hif_cnf_tx *arg)
 {
-	int i;
-	int tx_count;
-	struct sk_buff *skb;
 	struct ieee80211_tx_rate *rate;
-	struct ieee80211_tx_info *tx_info;
-	const struct wfx_tx_priv *tx_priv;
-	bool has_sta;
+	int tx_count;
+	int i;
 
-	skb = wfx_pending_get(wvif->wdev, arg->packet_id);
-	if (!skb) {
-		dev_warn(wvif->wdev->dev,
-			 "received unknown packet_id (%#.8x) from chip\n",
-			 arg->packet_id);
-		return;
-	}
-	tx_info = IEEE80211_SKB_CB(skb);
-	tx_priv = wfx_skb_tx_priv(skb);
-	has_sta = tx_priv->has_sta;
-	_trace_tx_stats(arg, skb,
-			wfx_pending_get_pkt_us_delay(wvif->wdev, skb));
-
-	// You can touch to tx_priv, but don't touch to tx_info->status.
 	tx_count = arg->ack_failures;
 	if (!arg->status || arg->ack_failures)
 		tx_count += 1; // Also report success
@@ -530,15 +514,12 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 		if (tx_count < rate->count &&
 		    arg->status == HIF_STATUS_TX_FAIL_RETRIES &&
 		    arg->ack_failures)
-			dev_dbg(wvif->wdev->dev,
-				"all retries were not consumed: %d != %d\n",
+			dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n",
 				rate->count, tx_count);
 		if (tx_count <= rate->count && tx_count &&
-		    arg->txed_rate != wfx_get_hw_rate(wvif->wdev, rate))
-			dev_dbg(wvif->wdev->dev,
-				"inconsistent tx_info rates: %d != %d\n",
-				arg->txed_rate,
-				wfx_get_hw_rate(wvif->wdev, rate));
+		    arg->txed_rate != wfx_get_hw_rate(wdev, rate))
+			dev_dbg(wdev->dev, "inconsistent tx_info rates: %d != %d\n",
+				arg->txed_rate, wfx_get_hw_rate(wdev, rate));
 		if (tx_count > rate->count) {
 			tx_count -= rate->count;
 		} else if (!tx_count) {
@@ -550,8 +531,30 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 		}
 	}
 	if (tx_count)
-		dev_dbg(wvif->wdev->dev, "%d more retries than expected\n",
-			tx_count);
+		dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count);
+}
+
+void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
+{
+	struct ieee80211_tx_info *tx_info;
+	const struct wfx_tx_priv *tx_priv;
+	struct sk_buff *skb;
+	bool has_sta;
+
+	skb = wfx_pending_get(wvif->wdev, arg->packet_id);
+	if (!skb) {
+		dev_warn(wvif->wdev->dev, "received unknown packet_id (%#.8x) from chip\n",
+			 arg->packet_id);
+		return;
+	}
+	tx_info = IEEE80211_SKB_CB(skb);
+	tx_priv = wfx_skb_tx_priv(skb);
+	has_sta = tx_priv->has_sta;
+	_trace_tx_stats(arg, skb,
+			wfx_pending_get_pkt_us_delay(wvif->wdev, skb));
+
+	// You can touch to tx_priv, but don't touch to tx_info->status.
+	wfx_tx_fill_rates(wvif->wdev, tx_info, arg);
 	skb_trim(skb, skb->len - wfx_tx_get_icv_len(tx_priv->hw_key));
 
 	// From now, you can touch to tx_info->status, but do not touch to
-- 
2.26.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2020-05-15  8:35 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  8:33 [PATCH 00/19] staging: wfx: various fixes Jerome Pouiller
2020-05-15  8:33 ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 01/19] staging: wfx: fix warning when unregister a frozen device Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 02/19] staging: wfx: apply 80-columns rule to strings Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 03/19] staging: wfx: check pointers returned by allocations Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 04/19] staging: wfx: fix value of scan timeout Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 05/19] staging: wfx: fix coherency of hif_scan() prototype Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15 13:53   ` Greg Kroah-Hartman
2020-05-15 13:53     ` Greg Kroah-Hartman
2020-05-15 14:01     ` Greg Kroah-Hartman
2020-05-15 14:01       ` Greg Kroah-Hartman
2020-05-15 15:03     ` Jérôme Pouiller
2020-05-15 15:03       ` Jérôme Pouiller
2020-05-15 15:09       ` Greg Kroah-Hartman
2020-05-15 15:09         ` Greg Kroah-Hartman
2020-05-15  8:33 ` [PATCH 06/19] staging: wfx: fix indentation Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 07/19] staging: wfx: fix status of dropped frames Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` Jerome Pouiller [this message]
2020-05-15  8:33   ` [PATCH 08/19] staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 09/19] staging: wfx: call wfx_tx_update_sta() before to destroy tx_priv Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 10/19] staging: wfx: fix potential use-after-free Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 11/19] staging: wfx: rename wfx_do_unjoin() into wfx_reset() Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 12/19] staging: wfx: merge wfx_stop_ap() with wfx_reset() Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 13/19] staging: wfx: fix potential dead lock between join and scan Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 14/19] staging: wfx: fix PS parameters when multiple vif are in use Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 15/19] staging: wfx: drop unnecessary filter configuration when disabling filter Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 16/19] staging: wfx: fix error reporting in wfx_start_ap() Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 17/19] staging: wfx: remove false-positive WARN() Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 18/19] staging: wfx: trace acknowledges not linked to any stations Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller
2020-05-15  8:33 ` [PATCH 19/19] staging: wfx: remove false positive warning Jerome Pouiller
2020-05-15  8:33   ` Jerome Pouiller

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=20200515083325.378539-9-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.