]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac80211: add control port protocol TX control flag
authorJohannes Berg <johannes.berg@intel.com>
Tue, 2 Jul 2013 16:09:12 +0000 (18:09 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 12 Aug 2013 12:09:29 +0000 (14:09 +0200)
A lot of drivers check the frame protocol for ETH_P_PAE,
for various reasons (like making those more reliable).
Add a new flags bitmap to the TX control info and a new
flag indicating the control port protocol is in use to
let all drivers also apply such logic to other control
port protocols, should they be configured.

Also use the new flag in the iwlwifi drivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Documentation/DocBook/80211.tmpl
drivers/net/wireless/iwlwifi/dvm/tx.c
drivers/net/wireless/iwlwifi/iwl-devtrace.h
drivers/net/wireless/iwlwifi/mvm/tx.c
include/net/mac80211.h
net/mac80211/rc80211_minstrel_ht.c
net/mac80211/tx.c

index 49267ea975684391c1f1e7144fb0c88700557d66..f403ec3c5c9a4a17cf6c534f2da8590144faf766 100644 (file)
           <title>functions/definitions</title>
 !Finclude/net/mac80211.h ieee80211_rx_status
 !Finclude/net/mac80211.h mac80211_rx_flags
+!Finclude/net/mac80211.h mac80211_tx_info_flags
 !Finclude/net/mac80211.h mac80211_tx_control_flags
 !Finclude/net/mac80211.h mac80211_rate_control_flags
 !Finclude/net/mac80211.h ieee80211_tx_rate
index 5ee983faa679d21d09ba1700821172d84501ea4d..f364583b15351cee3af88b05f24c726c8b27ac5d 100644 (file)
@@ -87,7 +87,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
                 priv->lib->bt_params->advanced_bt_coexist &&
                 (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) ||
                 ieee80211_is_reassoc_req(fc) ||
-                skb->protocol == cpu_to_be16(ETH_P_PAE)))
+                info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
                tx_flags |= TX_CMD_FLG_IGNORE_BT;
 
 
index 4491c1c72cc7d6e00ade51930342b16233172690..684c416d34936c5ecdb6451f2d3707babae6b180 100644 (file)
 static inline bool iwl_trace_data(struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr = (void *)skb->data;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 
-       if (ieee80211_is_data(hdr->frame_control))
-               return skb->protocol != cpu_to_be16(ETH_P_PAE);
-       return false;
+       if (!ieee80211_is_data(hdr->frame_control))
+               return false;
+       return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO);
 }
 
 static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans,
index f0e96a927407d3ae1473481f5e7d3eeb894a5a2b..d62a6d3053ff90ebc64c764049bb64531343ea4f 100644 (file)
@@ -91,11 +91,10 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
                tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;
 
        /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */
-       if (info->band == IEEE80211_BAND_2GHZ        &&
-           (skb->protocol == cpu_to_be16(ETH_P_PAE)  ||
-            is_multicast_ether_addr(hdr->addr1)      ||
-            ieee80211_is_back_req(fc)                ||
-            ieee80211_is_mgmt(fc)))
+       if (info->band == IEEE80211_BAND_2GHZ &&
+           (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO ||
+            is_multicast_ether_addr(hdr->addr1) ||
+            ieee80211_is_back_req(fc) || ieee80211_is_mgmt(fc)))
                tx_flags |= TX_CMD_FLG_BT_DIS;
 
        if (ieee80211_has_morefrags(fc))
index 9cda3728c2cbfc78d77efc765ff298718469108e..b70c00111323113351f1e27903d4e1535db6005c 100644 (file)
@@ -375,7 +375,7 @@ struct ieee80211_bss_conf {
 };
 
 /**
- * enum mac80211_tx_control_flags - flags to describe transmission information/status
+ * enum mac80211_tx_info_flags - flags to describe transmission information/status
  *
  * These flags are used with the @flags member of &ieee80211_tx_info.
  *
@@ -471,7 +471,7 @@ struct ieee80211_bss_conf {
  * Note: If you have to add new flags to the enumeration, then don't
  *      forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
  */
-enum mac80211_tx_control_flags {
+enum mac80211_tx_info_flags {
        IEEE80211_TX_CTL_REQ_TX_STATUS          = BIT(0),
        IEEE80211_TX_CTL_ASSIGN_SEQ             = BIT(1),
        IEEE80211_TX_CTL_NO_ACK                 = BIT(2),
@@ -507,6 +507,18 @@ enum mac80211_tx_control_flags {
 
 #define IEEE80211_TX_CTL_STBC_SHIFT            23
 
+/**
+ * enum mac80211_tx_control_flags - flags to describe transmit control
+ *
+ * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
+ *     protocol frame (e.g. EAP)
+ *
+ * These flags are used in tx_info->control.flags.
+ */
+enum mac80211_tx_control_flags {
+       IEEE80211_TX_CTRL_PORT_CTRL_PROTO       = BIT(0),
+};
+
 /*
  * This definition is used as a mask to clear all temporary flags, which are
  * set by the tx handlers for each transmission attempt by the mac80211 stack.
@@ -680,7 +692,8 @@ struct ieee80211_tx_info {
                        /* NB: vif can be NULL for injected frames */
                        struct ieee80211_vif *vif;
                        struct ieee80211_key_conf *hw_key;
-                       /* 8 bytes free */
+                       u32 flags;
+                       /* 4 bytes free */
                } control;
                struct {
                        struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
index 7475a7a337974adb228f720f3aac397ca685f618..9eff3824f2d12adcf4d5fc0461f72b3e0cce88cd 100644 (file)
@@ -439,12 +439,13 @@ minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        u16 tid;
 
        if (unlikely(!ieee80211_is_data_qos(hdr->frame_control)))
                return;
 
-       if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)))
+       if (unlikely(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
                return;
 
        tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
@@ -776,7 +777,7 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
 
        /* Don't use EAPOL frames for sampling on non-mrr hw */
        if (mp->hw->max_rates == 1 &&
-           txrc->skb->protocol == cpu_to_be16(ETH_P_PAE))
+           (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
                sample_idx = -1;
        else
                sample_idx = minstrel_get_sample_rate(mp, mi);
index 0e42322aa6b157e13d7ea8ee57d3ad6f03e08ac4..098ae854ad3c31cb4984236d801bc468ab3763fa 100644 (file)
@@ -539,9 +539,11 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
 
-       if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol &&
-                    tx->sdata->control_port_no_encrypt))
-               info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
+       if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol)) {
+               if (tx->sdata->control_port_no_encrypt)
+                       info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
+               info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+       }
 
        return TX_CONTINUE;
 }