add git checkout support
[openwrt/openwrt.git] / package / mac80211 / src / mac80211 / wme.c
index 9ff35e863285f758af6ca63e4df52980f0937d4e..5b8a157975a35dd452bc6e03e17f5dafcae09788 100644 (file)
 #include "ieee80211_i.h"
 #include "wme.h"
 
-static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
-{
-       return (fc & 0x8C) == 0x88;
-}
-
-
-ieee80211_txrx_result
-ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
-{
-       u8 *data = rx->skb->data;
-       int tid;
-       unsigned int is_agg_frame = 0;
-
-       /* does the frame have a qos control field? */
-       if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
-               u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
-
-               /* frame has qos control */
-               rx->u.rx.qos_control = le16_to_cpu(*((__le16*)qc));
-               tid = rx->u.rx.qos_control & QOS_CONTROL_TID_MASK;
-               if (rx->u.rx.qos_control &
-                   IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
-                       is_agg_frame = 1;
-       } else {
-               if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
-                       /* Separate TID for management frames */
-                       tid = NUM_RX_DATA_QUEUES - 1;
-               } else {
-                       /* no qos control present */
-                       tid = 0; /* 802.1d - Best Effort */
-               }
-               rx->u.rx.qos_control = 0;
-       }
-#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
-       I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
-       if (rx->sta) {
-               I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
-       }
-#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
-
-       rx->u.rx.queue = tid;
-       rx->u.rx.is_agg_frame = is_agg_frame;
-       /* Set skb->priority to 1d tag if highest order bit of TID is not set.
-        * For now, set skb->priority to 0 for other cases. */
-       rx->skb->priority = (tid > 7) ? 0 : tid;
-
-       return TXRX_CONTINUE;
-}
-
-
-ieee80211_txrx_result
-ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
-{
-       u16 fc = rx->fc;
-       u8 *data = rx->skb->data;
-       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
-
-       if (!WLAN_FC_IS_QOS_DATA(fc))
-               return TXRX_CONTINUE;
-
-       /* remove the qos control field, update frame type and meta-data */
-       memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
-       hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
-       /* change frame type to non QOS */
-       rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA;
-       hdr->frame_control = cpu_to_le16(fc);
-
-       return TXRX_CONTINUE;
-}
-
-
-#ifdef CONFIG_NET_SCHED
 /* maximum number of hardware queues we support. */
 #define TC_80211_MAX_QUEUES 8
 
@@ -166,13 +94,9 @@ static inline int wme_downgrade_ac(struct sk_buff *skb)
 static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
 {
        struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(qd->dev);
-       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-       struct ieee80211_tx_packet_data *pkt_data =
-               (struct ieee80211_tx_packet_data *) skb->cb;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        unsigned short fc = le16_to_cpu(hdr->frame_control);
-       int qos, tsid, dir;
+       int qos;
        const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
 
        /* see if frame is data or non data frame */
@@ -182,12 +106,8 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
                return IEEE80211_TX_QUEUE_DATA0;
        }
 
-       if (unlikely(pkt_data->mgmt_iface)) {
-               /* Data frames from hostapd (mainly, EAPOL) use AC_VO
-               * and they will include QoS control fields if
-               * the target STA is using WME. */
-               skb->priority = 7;
-               return ieee802_1d_to_ac[skb->priority];
+       if (0 /* injected */) {
+               /* use AC from radiotap */
        }
 
        /* is this a QoS frame? */
@@ -201,34 +121,9 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
        /* use the data classifier to determine what 802.1d tag the
         * data frame has */
        skb->priority = classify_1d(skb, qd);
-       tsid = 8 + skb->priority;
-
-       /* FIXME: only uplink needs to be checked for Tx */
-       dir = STA_TS_UPLINK;
-
-       if ((sdata->type == IEEE80211_IF_TYPE_STA) &&
-           (local->wmm_acm & BIT(skb->priority))) {
-               switch (ifsta->ts_data[tsid][dir].status) {
-               case TS_STATUS_ACTIVE:
-                       /* if TS Management is enabled, update used_time */
-                       ifsta->ts_data[tsid][dir].used_time_usec +=
-                               ifsta->MPDUExchangeTime;
-                       break;
-               case TS_STATUS_THROTTLING:
-                       /* if admitted time is used up, refuse to send more */
-                       if (net_ratelimit())
-                               printk(KERN_DEBUG "QoS packet throttling\n");
-                       break;
-               default:
-                       break;
-               }
-       }
 
        /* in case we are a client verify acm is not set for this ac */
-       while ((local->wmm_acm & BIT(skb->priority)) &&
-              !((sdata->type == IEEE80211_IF_TYPE_STA) &&
-                (ifsta->ts_data[skb->priority + EDCA_TSID_MIN][dir].status
-                       == TS_STATUS_ACTIVE))) {
+       while (unlikely(local->wmm_acm & BIT(skb->priority))) {
                if (wme_downgrade_ac(skb)) {
                        /* No AC with lower priority has acm=0, drop packet. */
                        return -1;
@@ -251,7 +146,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
        struct Qdisc *qdisc;
        int err, queue;
 
-       if (pkt_data->requeue) {
+       if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
                skb_queue_tail(&q->requeued[pkt_data->queue], skb);
                qd->q.qlen++;
                return 0;
@@ -458,7 +353,7 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct rtattr *opt)
                skb_queue_head_init(&q->requeued[i]);
                q->queues[i] = qdisc_create_dflt(qd->dev, &pfifo_qdisc_ops,
                                                 qd->handle);
-               if (q->queues[i] == 0) {
+               if (!q->queues[i]) {
                        q->queues[i] = &noop_qdisc;
                        printk(KERN_ERR "%s child qdisc %i creation failed", dev->name, i);
                }
@@ -709,4 +604,3 @@ void ieee80211_wme_unregister(void)
 {
        unregister_qdisc(&wme_qdisc_ops);
 }
-#endif /* CONFIG_NET_SCHED */