]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/wireless/p54/p54common.c
p54: Fix for TX sequence number problem
[net-next-2.6.git] / drivers / net / wireless / p54 / p54common.c
index ffaf7a6b681021af9a572bf729ba8739852b91b9..2d2d33612aef48a6bea84c0021a627d0e8526f06 100644 (file)
@@ -553,6 +553,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        struct ieee80211_tx_queue_stats *current_queue;
        struct p54_common *priv = dev->priv;
        struct p54_control_hdr *hdr;
+       struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
        struct p54_tx_control_allocdata *txhdr;
        size_t padding, len;
        u8 rate;
@@ -605,6 +606,19 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        if (padding)
                txhdr->align[0] = padding;
 
+       /* FIXME: The sequence that follows is needed for this driver to
+        * work with mac80211 since "mac80211: fix TX sequence numbers".
+        * As with the temporary code in rt2x00, changes will be needed
+        * to get proper sequence numbers on beacons. In addition, this
+        * patch places the sequence number in the hardware state, which
+        * limits us to a single virtual state.
+        */
+       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+                       priv->seqno += 0x10;
+               ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+               ieee80211hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
+       }
        /* modifies skb->cb and with it info, so must be last! */
        p54_assign_address(dev, skb, hdr, skb->len);
 
@@ -886,9 +900,12 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 {
        int ret;
+       struct p54_common *priv = dev->priv;
 
+       mutex_lock(&priv->conf_mutex);
        ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq));
        p54_set_vdcf(dev);
+       mutex_unlock(&priv->conf_mutex);
        return ret;
 }
 
@@ -898,10 +915,12 @@ static int p54_config_interface(struct ieee80211_hw *dev,
 {
        struct p54_common *priv = dev->priv;
 
+       mutex_lock(&priv->conf_mutex);
        p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642);
        p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0);
        p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0);
        memcpy(priv->bssid, conf->bssid, ETH_ALEN);
+       mutex_unlock(&priv->conf_mutex);
        return 0;
 }
 
@@ -1009,6 +1028,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
        }
 
        p54_init_vdcf(dev);
+       mutex_init(&priv->conf_mutex);
 
        return dev;
 }