]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/b43legacy/pio.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / b43legacy / pio.c
index e4f4c5c39e334ebf4c37c0e903b66ec989f71b82..a86c7647fa2d62caec9027d316f3ddd648f156a6 100644 (file)
@@ -181,7 +181,7 @@ union txhdr_union {
        struct b43legacy_txhdr_fw3 txhdr_fw3;
 };
 
-static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
+static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
                                  struct sk_buff *skb,
                                  struct b43legacy_pio_txpacket *packet,
                                  size_t txhdr_size)
@@ -189,14 +189,17 @@ static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
        union txhdr_union txhdr_data;
        u8 *txhdr = NULL;
        unsigned int octets;
+       int err;
 
        txhdr = (u8 *)(&txhdr_data.txhdr_fw3);
 
        B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0);
-       b43legacy_generate_txhdr(queue->dev,
+       err = b43legacy_generate_txhdr(queue->dev,
                                 txhdr, skb->data, skb->len,
-                                &packet->txstat.control,
+                                IEEE80211_SKB_CB(skb),
                                 generate_cookie(queue, packet));
+       if (err)
+               return err;
 
        tx_start(queue);
        octets = skb->len + txhdr_size;
@@ -204,6 +207,8 @@ static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
                octets--;
        tx_data(queue, txhdr, (u8 *)skb->data, octets);
        tx_complete(queue, skb);
+
+       return 0;
 }
 
 static void free_txpacket(struct b43legacy_pio_txpacket *packet,
@@ -226,6 +231,7 @@ static int pio_tx_packet(struct b43legacy_pio_txpacket *packet)
        struct b43legacy_pioqueue *queue = packet->queue;
        struct sk_buff *skb = packet->skb;
        u16 octets;
+       int err;
 
        octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3);
        if (queue->tx_devq_size < octets) {
@@ -247,8 +253,14 @@ static int pio_tx_packet(struct b43legacy_pio_txpacket *packet)
        if (queue->tx_devq_used + octets > queue->tx_devq_size)
                return -EBUSY;
        /* Now poke the device. */
-       pio_tx_write_fragment(queue, skb, packet,
+       err = pio_tx_write_fragment(queue, skb, packet,
                              sizeof(struct b43legacy_txhdr_fw3));
+       if (unlikely(err == -ENOKEY)) {
+               /* Drop this packet, as we don't have the encryption key
+                * anymore and must not transmit it unencrypted. */
+               free_txpacket(packet, 1);
+               return 0;
+       }
 
        /* Account for the packet size.
         * (We must not overflow the device TX queue)
@@ -451,8 +463,7 @@ err_destroy0:
 }
 
 int b43legacy_pio_tx(struct b43legacy_wldev *dev,
-                    struct sk_buff *skb,
-                    struct ieee80211_tx_control *ctl)
+                    struct sk_buff *skb)
 {
        struct b43legacy_pioqueue *queue = dev->pio.queue1;
        struct b43legacy_pio_txpacket *packet;
@@ -464,9 +475,6 @@ int b43legacy_pio_tx(struct b43legacy_wldev *dev,
                            list);
        packet->skb = skb;
 
-       memset(&packet->txstat, 0, sizeof(packet->txstat));
-       memcpy(&packet->txstat.control, ctl, sizeof(*ctl));
-
        list_move_tail(&packet->list, &queue->txqueue);
        queue->nr_txfree--;
        queue->nr_tx_packets++;
@@ -482,19 +490,25 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
 {
        struct b43legacy_pioqueue *queue;
        struct b43legacy_pio_txpacket *packet;
+       struct ieee80211_tx_info *info;
 
        queue = parse_cookie(dev, status->cookie, &packet);
        B43legacy_WARN_ON(!queue);
 
+       if (!packet->skb)
+               return;
+
        queue->tx_devq_packets--;
        queue->tx_devq_used -= (packet->skb->len +
                                sizeof(struct b43legacy_txhdr_fw3));
 
+       info = IEEE80211_SKB_CB(packet->skb);
+       memset(&info->status, 0, sizeof(info->status));
+
        if (status->acked)
-               packet->txstat.flags |= IEEE80211_TX_STATUS_ACK;
-       packet->txstat.retry_count = status->frame_count - 1;
-       ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb,
-                                   &(packet->txstat));
+               info->flags |= IEEE80211_TX_STAT_ACK;
+       info->status.retry_count = status->frame_count - 1;
+       ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb);
        packet->skb = NULL;
 
        free_txpacket(packet, 1);
@@ -510,13 +524,11 @@ void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
 {
        struct b43legacy_pio *pio = &dev->pio;
        struct b43legacy_pioqueue *queue;
-       struct ieee80211_tx_queue_stats_data *data;
 
        queue = pio->queue1;
-       data = &(stats->data[0]);
-       data->len = B43legacy_PIO_MAXTXPACKETS - queue->nr_txfree;
-       data->limit = B43legacy_PIO_MAXTXPACKETS;
-       data->count = queue->nr_tx_packets;
+       stats[0].len = B43legacy_PIO_MAXTXPACKETS - queue->nr_txfree;
+       stats[0].limit = B43legacy_PIO_MAXTXPACKETS;
+       stats[0].count = queue->nr_tx_packets;
 }
 
 static void pio_rx_error(struct b43legacy_pioqueue *queue,