]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mac80211: add an option for drivers to check if packets can be aggregated
authorSara Sharon <sara.sharon@intel.com>
Wed, 5 Sep 2018 05:06:11 +0000 (08:06 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 5 Sep 2018 08:11:50 +0000 (10:11 +0200)
Some hardwares have limitations on the packets' type in AMSDU.
Add an optional driver callback to determine if two skbs can
be used in the same AMSDU or not.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/driver-ops.h
net/mac80211/tx.c

index 28da9e27ea700c3548dc2c38ac0db12c92bfa448..c4fadbafbf2148cab67b57f44cfc90056fc59208 100644 (file)
@@ -3594,6 +3594,10 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  *     ieee80211_nan_func_terminated() with
  *     NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ * @can_aggregate_in_amsdu: Called in order to determine if HW supports
+ *     aggregating two specific frames in the same A-MSDU. The relation
+ *     between the skbs should be symmetric and transitive. Note that while
+ *     skb is always a real frame, head may or may not be an A-MSDU.
  */
 struct ieee80211_ops {
        void (*tx)(struct ieee80211_hw *hw,
@@ -3876,6 +3880,9 @@ struct ieee80211_ops {
        void (*del_nan_func)(struct ieee80211_hw *hw,
                            struct ieee80211_vif *vif,
                            u8 instance_id);
+       bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
+                                      struct sk_buff *head,
+                                      struct sk_buff *skb);
 };
 
 /**
index 8f6998091d26fc7ae07506b8014e60badcc11e00..e42c641b6190762c53c7c178f057d1de7b9d90df 100644 (file)
@@ -1173,6 +1173,16 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local,
        local->ops->wake_tx_queue(&local->hw, &txq->txq);
 }
 
+static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
+                                            struct sk_buff *head,
+                                            struct sk_buff *skb)
+{
+       if (!local->ops->can_aggregate_in_amsdu)
+               return true;
+
+       return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
+}
+
 static inline int drv_start_nan(struct ieee80211_local *local,
                                struct ieee80211_sub_if_data *sdata,
                                struct cfg80211_nan_conf *conf)
index 42f44c33a133c4acc0fe200663ca6f96e176ee9b..c42bfa1dcd2c77944b9e75981b74b27830ddbebb 100644 (file)
@@ -3261,6 +3261,9 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
        if (max_frags && nfrags > max_frags)
                goto out;
 
+       if (!drv_can_aggregate_in_amsdu(local, head, skb))
+               goto out;
+
        if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
                goto out;