mirror of https://gitee.com/openkylin/linux.git
staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb()
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> Link: https://lore.kernel.org/r/20200515083325.378539-9-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
298913e336
commit
4e5e3cb021
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue