Commit 049fde13 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: drop useless field from struct wfx_tx_priv

The device need to receive a skb with necessary space for the ICV. So,
the driver adds this space before to send the frame.

Currently, once the frame is sent, the driver restore the original
content of the skb. However, this step is useless. Mac80211 don't do it
when software encryption is enabled.

Once we have removed this step, it appears that it is no more necessary
to keep hw_key in tx_priv. Then, it is possible to simplify a bunch of
code in the Tx path.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200825085828.399505-6-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0a3279d3
...@@ -336,7 +336,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -336,7 +336,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
{ {
struct hif_msg *hif_msg; struct hif_msg *hif_msg;
struct hif_req_tx *req; struct hif_req_tx *req;
struct wfx_tx_priv *tx_priv;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
...@@ -350,14 +349,11 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -350,14 +349,11 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
// From now tx_info->control is unusable // From now tx_info->control is unusable
memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv));
// Fill tx_priv
tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data;
tx_priv->hw_key = hw_key;
// Fill hif_msg // Fill hif_msg
WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb"); WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb");
WARN(offset & 1, "attempt to transmit an unaligned frame"); WARN(offset & 1, "attempt to transmit an unaligned frame");
skb_put(skb, wfx_tx_get_icv_len(tx_priv->hw_key)); skb_put(skb, wfx_tx_get_icv_len(hw_key));
skb_push(skb, wmsg_len); skb_push(skb, wmsg_len);
memset(skb->data, 0, wmsg_len); memset(skb->data, 0, wmsg_len);
hif_msg = (struct hif_msg *)skb->data; hif_msg = (struct hif_msg *)skb->data;
...@@ -489,7 +485,6 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev, ...@@ -489,7 +485,6 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev,
void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
{ {
struct ieee80211_tx_info *tx_info; struct ieee80211_tx_info *tx_info;
const struct wfx_tx_priv *tx_priv;
struct wfx_vif *wvif; struct wfx_vif *wvif;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -499,18 +494,15 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) ...@@ -499,18 +494,15 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
arg->packet_id); arg->packet_id);
return; return;
} }
tx_info = IEEE80211_SKB_CB(skb);
wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface);
WARN_ON(!wvif); WARN_ON(!wvif);
if (!wvif) if (!wvif)
return; return;
tx_info = IEEE80211_SKB_CB(skb);
tx_priv = wfx_skb_tx_priv(skb);
_trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb));
// You can touch to tx_priv, but don't touch to tx_info->status. // Note that wfx_pending_get_pkt_us_delay() get data from tx_info
_trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb));
wfx_tx_fill_rates(wdev, tx_info, arg); wfx_tx_fill_rates(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 // From now, you can touch to tx_info->status, but do not touch to
// tx_priv anymore // tx_priv anymore
// FIXME: use ieee80211_tx_info_clear_status() // FIXME: use ieee80211_tx_info_clear_status()
......
...@@ -35,8 +35,7 @@ struct tx_policy_cache { ...@@ -35,8 +35,7 @@ struct tx_policy_cache {
struct wfx_tx_priv { struct wfx_tx_priv {
ktime_t xmit_timestamp; ktime_t xmit_timestamp;
struct ieee80211_key_conf *hw_key; };
} __packed;
void wfx_tx_policy_init(struct wfx_vif *wvif); void wfx_tx_policy_init(struct wfx_vif *wvif);
void wfx_tx_policy_upload_work(struct work_struct *work); void wfx_tx_policy_upload_work(struct work_struct *work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment