Commit a26eb27a authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: move fragment flag to info flag as dont-fragment

The purpose of this is two-fold:
 1) by moving it out of tx_data.flags, we can in
    another patch move the radiotap parsing so it
    no longer is in the hotpath
 2) if a device implements fragmentation but can
    optionally skip it, the radiotap request for
    not doing fragmentation may be honoured
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 68f2b517
...@@ -375,6 +375,9 @@ struct ieee80211_bss_conf { ...@@ -375,6 +375,9 @@ struct ieee80211_bss_conf {
* @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate. * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate.
* This flag is used to send nullfunc frame at minimum rate when * This flag is used to send nullfunc frame at minimum rate when
* the nullfunc is used for connection monitoring purpose. * the nullfunc is used for connection monitoring purpose.
* @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
* would be fragmented by size (this is optional, only used for
* monitor injection).
* *
* Note: If you have to add new flags to the enumeration, then don't * Note: If you have to add new flags to the enumeration, then don't
* forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
...@@ -408,6 +411,7 @@ enum mac80211_tx_control_flags { ...@@ -408,6 +411,7 @@ enum mac80211_tx_control_flags {
IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27), IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27),
IEEE80211_TX_STATUS_EOSP = BIT(28), IEEE80211_TX_STATUS_EOSP = BIT(28),
IEEE80211_TX_CTL_USE_MINRATE = BIT(29), IEEE80211_TX_CTL_USE_MINRATE = BIT(29),
IEEE80211_TX_CTL_DONTFRAG = BIT(30),
}; };
#define IEEE80211_TX_CTL_STBC_SHIFT 23 #define IEEE80211_TX_CTL_STBC_SHIFT 23
......
...@@ -136,7 +136,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result; ...@@ -136,7 +136,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
#define TX_DROP ((__force ieee80211_tx_result) 1u) #define TX_DROP ((__force ieee80211_tx_result) 1u)
#define TX_QUEUED ((__force ieee80211_tx_result) 2u) #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
#define IEEE80211_TX_FRAGMENTED BIT(0)
#define IEEE80211_TX_UNICAST BIT(1) #define IEEE80211_TX_UNICAST BIT(1)
#define IEEE80211_TX_PS_BUFFERED BIT(2) #define IEEE80211_TX_PS_BUFFERED BIT(2)
......
...@@ -898,7 +898,10 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) ...@@ -898,7 +898,10 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
int hdrlen; int hdrlen;
int fragnum; int fragnum;
if (!(tx->flags & IEEE80211_TX_FRAGMENTED)) if (info->flags & IEEE80211_TX_CTL_DONTFRAG)
return TX_CONTINUE;
if (tx->local->ops->set_frag_threshold)
return TX_CONTINUE; return TX_CONTINUE;
/* /*
...@@ -911,7 +914,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) ...@@ -911,7 +914,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
hdrlen = ieee80211_hdrlen(hdr->frame_control); hdrlen = ieee80211_hdrlen(hdr->frame_control);
/* internal error, why is TX_FRAGMENTED set? */ /* internal error, why isn't DONTFRAG set? */
if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
return TX_DROP; return TX_DROP;
...@@ -1050,17 +1053,13 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, ...@@ -1050,17 +1053,13 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
struct ieee80211_radiotap_iterator iterator; struct ieee80211_radiotap_iterator iterator;
struct ieee80211_radiotap_header *rthdr = struct ieee80211_radiotap_header *rthdr =
(struct ieee80211_radiotap_header *) skb->data; (struct ieee80211_radiotap_header *) skb->data;
bool hw_frag;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len, int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
NULL); NULL);
u16 txflags; u16 txflags;
info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
tx->flags &= ~IEEE80211_TX_FRAGMENTED; IEEE80211_TX_CTL_DONTFRAG;
/* packet is fragmented in HW if we have a non-NULL driver callback */
hw_frag = (tx->local->ops->set_frag_threshold != NULL);
/* /*
* for every radiotap entry that is present * for every radiotap entry that is present
...@@ -1098,9 +1097,8 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, ...@@ -1098,9 +1097,8 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
} }
if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT; info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
if ((*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) && if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
!hw_frag) info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
tx->flags |= IEEE80211_TX_FRAGMENTED;
break; break;
case IEEE80211_RADIOTAP_TX_FLAGS: case IEEE80211_RADIOTAP_TX_FLAGS:
...@@ -1206,13 +1204,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, ...@@ -1206,13 +1204,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
tx->local = local; tx->local = local;
tx->sdata = sdata; tx->sdata = sdata;
tx->channel = local->hw.conf.channel; tx->channel = local->hw.conf.channel;
/*
* Set this flag (used below to indicate "automatic fragmentation"),
* it will be cleared/left by radiotap as desired.
* Only valid when fragmentation is done by the stack.
*/
if (!local->ops->set_frag_threshold)
tx->flags |= IEEE80211_TX_FRAGMENTED;
/* process and remove the injection radiotap header */ /* process and remove the injection radiotap header */
if (unlikely(info->flags & IEEE80211_TX_INTFL_HAS_RADIOTAP)) { if (unlikely(info->flags & IEEE80211_TX_INTFL_HAS_RADIOTAP)) {
...@@ -1281,13 +1272,11 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, ...@@ -1281,13 +1272,11 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
*/ */
} }
if (tx->flags & IEEE80211_TX_FRAGMENTED) { if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
if ((tx->flags & IEEE80211_TX_UNICAST) && if (!(tx->flags & IEEE80211_TX_UNICAST) ||
skb->len + FCS_LEN > local->hw.wiphy->frag_threshold && skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
!(info->flags & IEEE80211_TX_CTL_AMPDU)) info->flags & IEEE80211_TX_CTL_AMPDU)
tx->flags |= IEEE80211_TX_FRAGMENTED; info->flags |= IEEE80211_TX_CTL_DONTFRAG;
else
tx->flags &= ~IEEE80211_TX_FRAGMENTED;
} }
if (!tx->sta) if (!tx->sta)
......
...@@ -53,7 +53,8 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) ...@@ -53,7 +53,8 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
} }
if (info->control.hw_key && if (info->control.hw_key &&
!(tx->flags & IEEE80211_TX_FRAGMENTED) && (info->flags & IEEE80211_TX_CTL_DONTFRAG ||
tx->local->ops->set_frag_threshold) &&
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
/* hwaccel - with no need for SW-generated MMIC */ /* hwaccel - with no need for SW-generated MMIC */
return TX_CONTINUE; return TX_CONTINUE;
......
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