}
 #endif
 
+static int ieee80211_set_qos_map(struct wiphy *wiphy,
+                                struct net_device *dev,
+                                struct cfg80211_qos_map *qos_map)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct mac80211_qos_map *new_qos_map, *old_qos_map;
+
+       if (qos_map) {
+               new_qos_map = kzalloc(sizeof(*new_qos_map), GFP_KERNEL);
+               if (!new_qos_map)
+                       return -ENOMEM;
+               memcpy(&new_qos_map->qos_map, qos_map, sizeof(*qos_map));
+       } else {
+               /* A NULL qos_map was passed to disable QoS mapping */
+               new_qos_map = NULL;
+       }
+
+       old_qos_map = rtnl_dereference(sdata->qos_map);
+       rcu_assign_pointer(sdata->qos_map, new_qos_map);
+       if (old_qos_map)
+               kfree_rcu(old_qos_map, rcu_head);
+
+       return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
        .get_channel = ieee80211_cfg_get_channel,
        .start_radar_detection = ieee80211_start_radar_detection,
        .channel_switch = ieee80211_channel_switch,
+       .set_qos_map = ieee80211_set_qos_map,
 };
 
        struct ieee80211_chanctx_conf conf;
 };
 
+struct mac80211_qos_map {
+       struct cfg80211_qos_map qos_map;
+       struct rcu_head rcu_head;
+};
+
 struct ieee80211_sub_if_data {
        struct list_head list;
 
        int encrypt_headroom;
 
        struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
+       struct mac80211_qos_map __rcu *qos_map;
 
        struct work_struct csa_finalize_work;
        int csa_counter_offset_beacon;
 
        struct sta_info *sta = NULL;
        const u8 *ra = NULL;
        bool qos = false;
+       struct mac80211_qos_map *qos_map;
 
        if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) {
                skb->priority = 0; /* required for correct WPA/11i MIC */
 
        /* use the data classifier to determine what 802.1d tag the
         * data frame has */
-       skb->priority = cfg80211_classify8021d(skb, NULL);
+       rcu_read_lock();
+       qos_map = rcu_dereference(sdata->qos_map);
+       skb->priority = cfg80211_classify8021d(skb, qos_map ?
+                                              &qos_map->qos_map : NULL);
+       rcu_read_unlock();
 
        return ieee80211_downgrade_queue(sdata, skb);
 }