Skip to content

Commit

Permalink
mac80211: move TX station pointer and restructure TX
Browse files Browse the repository at this point in the history
Remove the control.sta pointer from ieee80211_tx_info to free up
sufficient space in the TX skb control buffer for the upcoming
Transmit Power Control (TPC).
Instead, the pointer is now on the stack in a new control struct
that is passed as a function parameter to the drivers' tx method.

Signed-off-by: Thomas Huehn <[email protected]>
Signed-off-by: Alina Friedrichsen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
[reworded commit message]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
thuehn authored and jmberg-intel committed Jul 31, 2012
1 parent ab09587 commit 36323f8
Show file tree
Hide file tree
Showing 53 changed files with 232 additions and 132 deletions.
4 changes: 3 additions & 1 deletion drivers/net/wireless/adm8211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,9 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
}

/* Put adm8211_tx_hdr on skb and transmit */
static void adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
static void adm8211_tx(struct ieee80211_hw *dev,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct adm8211_tx_hdr *txhdr;
size_t payload_len, hdrlen;
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,9 @@ static void at76_mac80211_tx_callback(struct urb *urb)
ieee80211_wake_queues(priv->hw);
}

static void at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
static void at76_mac80211_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct at76_priv *priv = hw->priv;
struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath5k/mac80211-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
\********************/

static void
ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
ath5k_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct ath5k_hw *ah = hw->priv;
u16 qnum = skb_get_queue_mapping(skb);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ struct ath_tx_control {
struct ath_txq *txq;
struct ath_node *an;
u8 paprd;
struct ieee80211_sta *sta;
};

#define ATH_TX_ERROR 0x01
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath9k/htc.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv);

int ath9k_tx_init(struct ath9k_htc_priv *priv);
int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
struct ieee80211_sta *sta,
struct sk_buff *skb, u8 slot, bool is_cab);
void ath9k_tx_cleanup(struct ath9k_htc_priv *priv);
bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv,
goto next;
}

ret = ath9k_htc_tx_start(priv, skb, tx_slot, true);
ret = ath9k_htc_tx_start(priv, NULL, skb, tx_slot, true);
if (ret != 0) {
ath9k_htc_tx_clear_slot(priv, tx_slot);
dev_kfree_skb_any(skb);
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/wireless/ath/ath9k/htc_drv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,9 @@ void ath9k_htc_ani_work(struct work_struct *work)
/* mac80211 Callbacks */
/**********************/

static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
static void ath9k_htc_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr;
struct ath9k_htc_priv *priv = hw->priv;
Expand All @@ -883,7 +885,7 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
goto fail_tx;
}

ret = ath9k_htc_tx_start(priv, skb, slot, false);
ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false);
if (ret != 0) {
ath_dbg(common, XMIT, "Tx failed\n");
goto clear_slot;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ static void ath9k_htc_tx_data(struct ath9k_htc_priv *priv,
}

int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
struct ieee80211_sta *sta,
struct sk_buff *skb,
u8 slot, bool is_cab)
{
struct ieee80211_hdr *hdr;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = tx_info->control.sta;
struct ieee80211_vif *vif = tx_info->control.vif;
struct ath9k_htc_sta *ista;
struct ath9k_htc_vif *avp = NULL;
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
return r;
}

static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
static void ath9k_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
Expand Down Expand Up @@ -754,6 +756,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)

memset(&txctl, 0, sizeof(struct ath_tx_control));
txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)];
txctl.sta = control->sta;

ath_dbg(common, XMIT, "transmitting packet, skb: %p\n", skb);

Expand Down
9 changes: 5 additions & 4 deletions drivers/net/wireless/ath/ath9k/xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,11 +1773,12 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
TX_STAT_INC(txq->axq_qnum, queued);
}

static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
static void setup_frame_info(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct sk_buff *skb,
int framelen)
{
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = tx_info->control.sta;
struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
const struct ieee80211_rate *rate;
Expand Down Expand Up @@ -1935,7 +1936,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = info->control.sta;
struct ieee80211_sta *sta = txctl->sta;
struct ieee80211_vif *vif = info->control.vif;
struct ath_softc *sc = hw->priv;
struct ath_txq *txq = txctl->txq;
Expand Down Expand Up @@ -1979,7 +1980,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
!ieee80211_is_data(hdr->frame_control))
info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;

setup_frame_info(hw, skb, frmlen);
setup_frame_info(hw, sta, skb, frmlen);

/*
* At this point, the vif, hw_key and sta pointers in the tx control
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/ath/carl9170/carl9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len);
void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len);

/* TX */
void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
void carl9170_op_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb);
void carl9170_tx_janitor(struct work_struct *work);
void carl9170_tx_process_status(struct ar9170 *ar,
const struct carl9170_rsp *cmd);
Expand Down
16 changes: 8 additions & 8 deletions drivers/net/wireless/ath/carl9170/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,14 +867,15 @@ static bool carl9170_tx_cts_check(struct ar9170 *ar,
return false;
}

static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
static int carl9170_tx_prepare(struct ar9170 *ar,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr;
struct _carl9170_tx_superframe *txc;
struct carl9170_vif_info *cvif;
struct ieee80211_tx_info *info;
struct ieee80211_tx_rate *txrate;
struct ieee80211_sta *sta;
struct carl9170_tx_info *arinfo;
unsigned int hw_queue;
int i;
Expand Down Expand Up @@ -910,8 +911,6 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
else
cvif = NULL;

sta = info->control.sta;

txc = (void *)skb_push(skb, sizeof(*txc));
memset(txc, 0, sizeof(*txc));

Expand Down Expand Up @@ -1457,20 +1456,21 @@ static bool carl9170_tx_ampdu_queue(struct ar9170 *ar,
return false;
}

void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
void carl9170_op_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct ar9170 *ar = hw->priv;
struct ieee80211_tx_info *info;
struct ieee80211_sta *sta;
struct ieee80211_sta *sta = control->sta;
bool run;

if (unlikely(!IS_STARTED(ar)))
goto err_free;

info = IEEE80211_SKB_CB(skb);
sta = info->control.sta;

if (unlikely(carl9170_tx_prepare(ar, skb)))
if (unlikely(carl9170_tx_prepare(ar, sta, skb)))
goto err_free;

carl9170_tx_accounting(ar, skb);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3407,7 +3407,8 @@ static void b43_tx_work(struct work_struct *work)
}

static void b43_op_tx(struct ieee80211_hw *hw,
struct sk_buff *skb)
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct b43_wl *wl = hw_to_b43_wl(hw);

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/b43legacy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,7 @@ static void b43legacy_tx_work(struct work_struct *work)
}

static void b43legacy_op_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br)
}
}

static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
static void brcms_ops_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct brcms_info *wl = hw->priv;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
Expand All @@ -276,7 +278,7 @@ static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
goto done;
}
brcms_c_sendpkt_mac80211(wl->wlc, skb, hw);
tx_info->rate_driver_data[0] = tx_info->control.sta;
tx_info->rate_driver_data[0] = control->sta;
done:
spin_unlock_bh(&wl->lock);
}
Expand Down
12 changes: 8 additions & 4 deletions drivers/net/wireless/iwlegacy/3945-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ il3945_build_tx_cmd_basic(struct il_priv *il, struct il_device_cmd *cmd,
* start C_TX command process
*/
static int
il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
il3945_tx_skb(struct il_priv *il,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
Expand Down Expand Up @@ -512,7 +514,7 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
hdr_len = ieee80211_hdrlen(fc);

/* Find idx into station table for destination station */
sta_id = il_sta_id_or_broadcast(il, info->control.sta);
sta_id = il_sta_id_or_broadcast(il, sta);
if (sta_id == IL_INVALID_STATION) {
D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1);
goto drop;
Expand Down Expand Up @@ -2859,7 +2861,9 @@ il3945_mac_stop(struct ieee80211_hw *hw)
}

static void
il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
il3945_mac_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct il_priv *il = hw->priv;

Expand All @@ -2868,7 +2872,7 @@ il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);

if (il3945_tx_skb(il, skb))
if (il3945_tx_skb(il, control->sta, skb))
dev_kfree_skb_any(skb);

D_MAC80211("leave\n");
Expand Down
26 changes: 15 additions & 11 deletions drivers/net/wireless/iwlegacy/4965-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,8 +1526,11 @@ il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb,
}

static void
il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info, __le16 fc)
il4965_tx_cmd_build_rate(struct il_priv *il,
struct il_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info,
struct ieee80211_sta *sta,
__le16 fc)
{
const u8 rts_retry_limit = 60;
u32 rate_flags;
Expand Down Expand Up @@ -1561,9 +1564,7 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd,
rate_idx = info->control.rates[0].idx;
if ((info->control.rates[0].flags & IEEE80211_TX_RC_MCS) || rate_idx < 0
|| rate_idx > RATE_COUNT_LEGACY)
rate_idx =
rate_lowest_index(&il->bands[info->band],
info->control.sta);
rate_idx = rate_lowest_index(&il->bands[info->band], sta);
/* For 5 GHZ band, remap mac80211 rate indices into driver indices */
if (info->band == IEEE80211_BAND_5GHZ)
rate_idx += IL_FIRST_OFDM_RATE;
Expand Down Expand Up @@ -1630,11 +1631,12 @@ il4965_tx_cmd_build_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info,
* start C_TX command process
*/
int
il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
il4965_tx_skb(struct il_priv *il,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = info->control.sta;
struct il_station_priv *sta_priv = NULL;
struct il_tx_queue *txq;
struct il_queue *q;
Expand Down Expand Up @@ -1680,7 +1682,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
sta_id = il->hw_params.bcast_id;
else {
/* Find idx into station table for destination station */
sta_id = il_sta_id_or_broadcast(il, info->control.sta);
sta_id = il_sta_id_or_broadcast(il, sta);

if (sta_id == IL_INVALID_STATION) {
D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1);
Expand Down Expand Up @@ -1786,7 +1788,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
/* TODO need this for burst mode later on */
il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id);

il4965_tx_cmd_build_rate(il, tx_cmd, info, fc);
il4965_tx_cmd_build_rate(il, tx_cmd, info, sta, fc);

il_update_stats(il, true, fc, len);
/*
Expand Down Expand Up @@ -5828,7 +5830,9 @@ il4965_mac_stop(struct ieee80211_hw *hw)
}

void
il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
il4965_mac_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct il_priv *il = hw->priv;

Expand All @@ -5837,7 +5841,7 @@ il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);

if (il4965_tx_skb(il, skb))
if (il4965_tx_skb(il, control->sta, skb))
dev_kfree_skb_any(skb);

D_MACDUMP("leave\n");
Expand Down
8 changes: 6 additions & 2 deletions drivers/net/wireless/iwlegacy/4965.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq,
int il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq);
void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags,
struct ieee80211_tx_info *info);
int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb);
int il4965_tx_skb(struct il_priv *il,
struct ieee80211_sta *sta,
struct sk_buff *skb);
int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid, u16 * ssn);
int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
Expand Down Expand Up @@ -163,7 +165,9 @@ void il4965_eeprom_release_semaphore(struct il_priv *il);
int il4965_eeprom_check_version(struct il_priv *il);

/* mac80211 handlers (for 4965) */
void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
void il4965_mac_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb);
int il4965_mac_start(struct ieee80211_hw *hw);
void il4965_mac_stop(struct ieee80211_hw *hw);
void il4965_configure_filter(struct ieee80211_hw *hw,
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/iwlwifi/dvm/agn.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success);


/* tx */
int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb);
int iwlagn_tx_skb(struct iwl_priv *priv,
struct ieee80211_sta *sta,
struct sk_buff *skb);
int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid, u16 *ssn);
int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
Expand Down
Loading

0 comments on commit 36323f8

Please sign in to comment.