mlx4_en renamed en_params.c to en_ethtool.c
[safe/jmp/linux-2.6] / drivers / net / wireless / adm8211.c
index 7af5d88..2b9e379 100644 (file)
@@ -324,7 +324,7 @@ static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
        for (dirty_tx = priv->dirty_tx; priv->cur_tx - dirty_tx; dirty_tx++) {
                unsigned int entry = dirty_tx % priv->tx_ring_size;
                u32 status = le32_to_cpu(priv->tx_ring[entry].status);
-               struct ieee80211_tx_status tx_status;
+               struct ieee80211_tx_info *txi;
                struct adm8211_tx_ring_info *info;
                struct sk_buff *skb;
 
@@ -334,24 +334,22 @@ static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
 
                info = &priv->tx_buffers[entry];
                skb = info->skb;
+               txi = IEEE80211_SKB_CB(skb);
 
                /* TODO: check TDES0_STATUS_TUF and TDES0_STATUS_TRO */
 
                pci_unmap_single(priv->pdev, info->mapping,
                                 info->skb->len, PCI_DMA_TODEVICE);
 
-               memset(&tx_status, 0, sizeof(tx_status));
+               ieee80211_tx_info_clear_status(txi);
+
                skb_pull(skb, sizeof(struct adm8211_tx_hdr));
                memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen);
-               memcpy(&tx_status.control, &info->tx_control,
-                      sizeof(tx_status.control));
-               if (!(tx_status.control.flags & IEEE80211_TXCTL_NO_ACK)) {
-                       if (status & TDES0_STATUS_ES)
-                               tx_status.excessive_retries = 1;
-                       else
-                               tx_status.flags |= IEEE80211_TX_STATUS_ACK;
-               }
-               ieee80211_tx_status_irqsafe(dev, skb, &tx_status);
+               if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) &&
+                   !(status & TDES0_STATUS_ES))
+                       txi->flags |= IEEE80211_TX_STAT_ACK;
+
+               ieee80211_tx_status_irqsafe(dev, skb);
 
                info->skb = NULL;
        }
@@ -766,11 +764,11 @@ static void adm8211_update_mode(struct ieee80211_hw *dev)
 
        priv->soft_rx_crc = 0;
        switch (priv->mode) {
-       case IEEE80211_IF_TYPE_STA:
+       case NL80211_IFTYPE_STATION:
                priv->nar &= ~(ADM8211_NAR_PR | ADM8211_NAR_EA);
                priv->nar |= ADM8211_NAR_ST | ADM8211_NAR_SR;
                break;
-       case IEEE80211_IF_TYPE_IBSS:
+       case NL80211_IFTYPE_ADHOC:
                priv->nar &= ~ADM8211_NAR_PR;
                priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR;
 
@@ -778,7 +776,7 @@ static void adm8211_update_mode(struct ieee80211_hw *dev)
                if (priv->pdev->revision >= ADM8211_REV_BA)
                        priv->soft_rx_crc = 1;
                break;
-       case IEEE80211_IF_TYPE_MNTR:
+       case NL80211_IFTYPE_MONITOR:
                priv->nar &= ~(ADM8211_NAR_EA | ADM8211_NAR_ST);
                priv->nar |= ADM8211_NAR_PR | ADM8211_NAR_SR;
                break;
@@ -1299,25 +1297,10 @@ static void adm8211_set_bssid(struct ieee80211_hw *dev, const u8 *bssid)
        ADM8211_CSR_WRITE(ABDA1, reg);
 }
 
-static int adm8211_set_ssid(struct ieee80211_hw *dev, u8 *ssid, size_t ssid_len)
-{
-       struct adm8211_priv *priv = dev->priv;
-       u8 buf[36];
-
-       if (ssid_len > 32)
-               return -EINVAL;
-
-       memset(buf, 0, sizeof(buf));
-       buf[0] = ssid_len;
-       memcpy(buf + 1, ssid, ssid_len);
-       adm8211_write_sram_bytes(dev, ADM8211_SRAM_SSID, buf, 33);
-       /* TODO: configure beacon for adhoc? */
-       return 0;
-}
-
-static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
+static int adm8211_config(struct ieee80211_hw *dev, u32 changed)
 {
        struct adm8211_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
        int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
 
        if (channel != priv->channel) {
@@ -1328,25 +1311,20 @@ static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
        return 0;
 }
 
-static int adm8211_config_interface(struct ieee80211_hw *dev,
-                                   struct ieee80211_vif *vif,
-                                   struct ieee80211_if_conf *conf)
+static void adm8211_bss_info_changed(struct ieee80211_hw *dev,
+                                    struct ieee80211_vif *vif,
+                                    struct ieee80211_bss_conf *conf,
+                                    u32 changes)
 {
        struct adm8211_priv *priv = dev->priv;
 
+       if (!(changes & BSS_CHANGED_BSSID))
+               return;
+
        if (memcmp(conf->bssid, priv->bssid, ETH_ALEN)) {
                adm8211_set_bssid(dev, conf->bssid);
                memcpy(priv->bssid, conf->bssid, ETH_ALEN);
        }
-
-       if (conf->ssid_len != priv->ssid_len ||
-           memcmp(conf->ssid, priv->ssid, conf->ssid_len)) {
-               adm8211_set_ssid(dev, conf->ssid, conf->ssid_len);
-               priv->ssid_len = conf->ssid_len;
-               memcpy(priv->ssid, conf->ssid, conf->ssid_len);
-       }
-
-       return 0;
 }
 
 static void adm8211_configure_filter(struct ieee80211_hw *dev,
@@ -1411,11 +1389,11 @@ static int adm8211_add_interface(struct ieee80211_hw *dev,
                                 struct ieee80211_if_init_conf *conf)
 {
        struct adm8211_priv *priv = dev->priv;
-       if (priv->mode != IEEE80211_IF_TYPE_MNTR)
+       if (priv->mode != NL80211_IFTYPE_MONITOR)
                return -EOPNOTSUPP;
 
        switch (conf->type) {
-       case IEEE80211_IF_TYPE_STA:
+       case NL80211_IFTYPE_STATION:
                priv->mode = conf->type;
                break;
        default:
@@ -1438,7 +1416,7 @@ static void adm8211_remove_interface(struct ieee80211_hw *dev,
                                     struct ieee80211_if_init_conf *conf)
 {
        struct adm8211_priv *priv = dev->priv;
-       priv->mode = IEEE80211_IF_TYPE_MNTR;
+       priv->mode = NL80211_IFTYPE_MONITOR;
 }
 
 static int adm8211_init_rings(struct ieee80211_hw *dev)
@@ -1557,7 +1535,7 @@ static int adm8211_start(struct ieee80211_hw *dev)
        ADM8211_CSR_WRITE(IER, ADM8211_IER_NIE | ADM8211_IER_AIE |
                               ADM8211_IER_RCIE | ADM8211_IER_TCIE |
                               ADM8211_IER_TDUIE | ADM8211_IER_GPTIE);
-       priv->mode = IEEE80211_IF_TYPE_MNTR;
+       priv->mode = NL80211_IFTYPE_MONITOR;
        adm8211_update_mode(dev);
        ADM8211_CSR_WRITE(RDR, 0);
 
@@ -1572,7 +1550,7 @@ static void adm8211_stop(struct ieee80211_hw *dev)
 {
        struct adm8211_priv *priv = dev->priv;
 
-       priv->mode = IEEE80211_IF_TYPE_INVALID;
+       priv->mode = NL80211_IFTYPE_UNSPECIFIED;
        priv->nar = 0;
        ADM8211_CSR_WRITE(NAR, 0);
        ADM8211_CSR_WRITE(IER, 0);
@@ -1638,7 +1616,6 @@ static void adm8211_calc_durations(int *dur, int *plcp, size_t payload_len, int
 /* Transmit skb w/adm8211_tx_hdr (802.11 header created by hardware) */
 static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
                           u16 plcp_signal,
-                          struct ieee80211_tx_control *control,
                           size_t hdrlen)
 {
        struct adm8211_priv *priv = dev->priv;
@@ -1664,7 +1641,6 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
 
        priv->tx_buffers[entry].skb = skb;
        priv->tx_buffers[entry].mapping = mapping;
-       memcpy(&priv->tx_buffers[entry].tx_control, control, sizeof(*control));
        priv->tx_buffers[entry].hdrlen = hdrlen;
        priv->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
 
@@ -1685,22 +1661,22 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
 }
 
 /* Put adm8211_tx_hdr on skb and transmit */
-static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
-                     struct ieee80211_tx_control *control)
+static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
        struct adm8211_tx_hdr *txhdr;
-       u16 fc;
        size_t payload_len, hdrlen;
        int plcp, dur, len, plcp_signal, short_preamble;
        struct ieee80211_hdr *hdr;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info);
+       u8 rc_flags;
 
-       short_preamble = !!(control->tx_rate->flags &
-                                       IEEE80211_TXCTL_SHORT_PREAMBLE);
-       plcp_signal = control->tx_rate->bitrate;
+       rc_flags = info->control.rates[0].flags;
+       short_preamble = !!(rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE);
+       plcp_signal = txrate->bitrate;
 
        hdr = (struct ieee80211_hdr *)skb->data;
-       fc = le16_to_cpu(hdr->frame_control) & ~IEEE80211_FCTL_PROTECTED;
-       hdrlen = ieee80211_get_hdrlen(fc);
+       hdrlen = ieee80211_hdrlen(hdr->frame_control);
        memcpy(skb->cb, skb->data, hdrlen);
        hdr = (struct ieee80211_hdr *)skb->cb;
        skb_pull(skb, hdrlen);
@@ -1714,8 +1690,6 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
        txhdr->frame_control = hdr->frame_control;
 
        len = hdrlen + payload_len + FCS_LEN;
-       if (fc & IEEE80211_FCTL_PROTECTED)
-               len += 8;
 
        txhdr->frag = cpu_to_le16(0x0FFF);
        adm8211_calc_durations(&dur, &plcp, payload_len,
@@ -1730,15 +1704,12 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
        if (short_preamble)
                txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE);
 
-       if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
+       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS)
                txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS);
 
-       if (fc & IEEE80211_FCTL_PROTECTED)
-               txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE);
-
-       txhdr->retry_limit = control->retry_limit;
+       txhdr->retry_limit = info->control.rates[0].count;
 
-       adm8211_tx_raw(dev, skb, plcp_signal, control, hdrlen);
+       adm8211_tx_raw(dev, skb, plcp_signal, hdrlen);
 
        return NETDEV_TX_OK;
 }
@@ -1784,7 +1755,7 @@ static const struct ieee80211_ops adm8211_ops = {
        .add_interface          = adm8211_add_interface,
        .remove_interface       = adm8211_remove_interface,
        .config                 = adm8211_config,
-       .config_interface       = adm8211_config_interface,
+       .bss_info_changed       = adm8211_bss_info_changed,
        .configure_filter       = adm8211_configure_filter,
        .get_stats              = adm8211_get_stats,
        .get_tx_stats           = adm8211_get_tx_stats,
@@ -1801,7 +1772,6 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
        int err;
        u32 reg;
        u8 perm_addr[ETH_ALEN];
-       DECLARE_MAC_BUF(mac);
 
        err = pci_enable_device(pdev);
        if (err) {
@@ -1836,8 +1806,8 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
                return err; /* someone else grabbed it? don't disable it */
        }
 
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
-           pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
+           pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR "%s (adm8211): No suitable DMA available\n",
                       pci_name(pdev));
                goto err_free_reg;
@@ -1894,6 +1864,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
        dev->extra_tx_headroom = sizeof(struct adm8211_tx_hdr);
        /* dev->flags = IEEE80211_HW_RX_INCLUDES_FCS in promisc mode */
        dev->flags = IEEE80211_HW_SIGNAL_UNSPEC;
+       dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
 
        dev->channel_change_time = 1000;
        dev->max_signal = 100;    /* FIXME: find better value */
@@ -1905,7 +1876,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
        priv->tx_power = 0x40;
        priv->lpf_cutoff = 0xFF;
        priv->lnags_threshold = 0xFF;
-       priv->mode = IEEE80211_IF_TYPE_INVALID;
+       priv->mode = NL80211_IFTYPE_UNSPECIFIED;
 
        /* Power-on issue. EEPROM won't read correctly without */
        if (pdev->revision >= ADM8211_REV_BA) {
@@ -1934,8 +1905,8 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
                goto err_free_desc;
        }
 
-       printk(KERN_INFO "%s: hwaddr %s, Rev 0x%02x\n",
-              wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr),
+       printk(KERN_INFO "%s: hwaddr %pM, Rev 0x%02x\n",
+              wiphy_name(dev->wiphy), dev->wiphy->perm_addr,
               pdev->revision);
 
        return 0;
@@ -1995,7 +1966,7 @@ static int adm8211_suspend(struct pci_dev *pdev, pm_message_t state)
        struct ieee80211_hw *dev = pci_get_drvdata(pdev);
        struct adm8211_priv *priv = dev->priv;
 
-       if (priv->mode != IEEE80211_IF_TYPE_INVALID) {
+       if (priv->mode != NL80211_IFTYPE_UNSPECIFIED) {
                ieee80211_stop_queues(dev);
                adm8211_stop(dev);
        }
@@ -2013,9 +1984,9 @@ static int adm8211_resume(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
-       if (priv->mode != IEEE80211_IF_TYPE_INVALID) {
+       if (priv->mode != NL80211_IFTYPE_UNSPECIFIED) {
                adm8211_start(dev);
-               ieee80211_start_queues(dev);
+               ieee80211_wake_queues(dev);
        }
 
        return 0;