aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtl8187_dev.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-24 13:38:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:32 -0500
commit8318d78a44d49ac1edf2bdec7299de3617c4232e (patch)
treed434634418edd7399737801615d247be06616fdd /drivers/net/wireless/rtl8187_dev.c
parent10b6b80145cc93887dd8aab99bfffa375e9add31 (diff)
cfg80211 API for channels/bitrates, mac80211 and driver conversion
This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out. All drivers (except ath5k) are updated to the new API, in many cases I expect that optimisations can be done. Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling. Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty... However, the basic rate handling will need to be moved to the BSS conf stuff. I do expect there to be bugs in this, especially wrt. transmit power handling where I'm basically clueless about how it should work. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtl8187_dev.c')
-rw-r--r--drivers/net/wireless/rtl8187_dev.c82
1 files changed, 56 insertions, 26 deletions
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index f44505994a0e..6ef67990692d 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -45,6 +45,38 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
45 45
46MODULE_DEVICE_TABLE(usb, rtl8187_table); 46MODULE_DEVICE_TABLE(usb, rtl8187_table);
47 47
48static const struct ieee80211_rate rtl818x_rates[] = {
49 { .bitrate = 10, .hw_value = 0, },
50 { .bitrate = 20, .hw_value = 1, },
51 { .bitrate = 55, .hw_value = 2, },
52 { .bitrate = 110, .hw_value = 3, },
53 { .bitrate = 60, .hw_value = 4, },
54 { .bitrate = 90, .hw_value = 5, },
55 { .bitrate = 120, .hw_value = 6, },
56 { .bitrate = 180, .hw_value = 7, },
57 { .bitrate = 240, .hw_value = 8, },
58 { .bitrate = 360, .hw_value = 9, },
59 { .bitrate = 480, .hw_value = 10, },
60 { .bitrate = 540, .hw_value = 11, },
61};
62
63static const struct ieee80211_channel rtl818x_channels[] = {
64 { .center_freq = 2412 },
65 { .center_freq = 2417 },
66 { .center_freq = 2422 },
67 { .center_freq = 2427 },
68 { .center_freq = 2432 },
69 { .center_freq = 2437 },
70 { .center_freq = 2442 },
71 { .center_freq = 2447 },
72 { .center_freq = 2452 },
73 { .center_freq = 2457 },
74 { .center_freq = 2462 },
75 { .center_freq = 2467 },
76 { .center_freq = 2472 },
77 { .center_freq = 2484 },
78};
79
48static void rtl8187_iowrite_async_cb(struct urb *urb) 80static void rtl8187_iowrite_async_cb(struct urb *urb)
49{ 81{
50 kfree(urb->context); 82 kfree(urb->context);
@@ -146,8 +178,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
146 178
147 flags = skb->len; 179 flags = skb->len;
148 flags |= RTL8187_TX_FLAG_NO_ENCRYPT; 180 flags |= RTL8187_TX_FLAG_NO_ENCRYPT;
149 flags |= control->rts_cts_rate << 19; 181 flags |= control->rts_cts_rate->hw_value << 19;
150 flags |= control->tx_rate << 24; 182 flags |= control->tx_rate->hw_value << 24;
151 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data)) 183 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data))
152 flags |= RTL8187_TX_FLAG_MORE_FRAG; 184 flags |= RTL8187_TX_FLAG_MORE_FRAG;
153 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 185 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
@@ -225,10 +257,9 @@ static void rtl8187_rx_cb(struct urb *urb)
225 rx_status.antenna = (hdr->signal >> 7) & 1; 257 rx_status.antenna = (hdr->signal >> 7) & 1;
226 rx_status.signal = 64 - min(hdr->noise, (u8)64); 258 rx_status.signal = 64 - min(hdr->noise, (u8)64);
227 rx_status.ssi = signal; 259 rx_status.ssi = signal;
228 rx_status.rate = rate; 260 rx_status.rate_idx = rate;
229 rx_status.freq = dev->conf.freq; 261 rx_status.freq = dev->conf.channel->center_freq;
230 rx_status.channel = dev->conf.channel; 262 rx_status.band = dev->conf.channel->band;
231 rx_status.phymode = dev->conf.phymode;
232 rx_status.mactime = le64_to_cpu(hdr->mac_time); 263 rx_status.mactime = le64_to_cpu(hdr->mac_time);
233 rx_status.flag |= RX_FLAG_TSFT; 264 rx_status.flag |= RX_FLAG_TSFT;
234 if (flags & (1 << 13)) 265 if (flags & (1 << 13))
@@ -682,19 +713,22 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
682 usb_get_dev(udev); 713 usb_get_dev(udev);
683 714
684 skb_queue_head_init(&priv->rx_queue); 715 skb_queue_head_init(&priv->rx_queue);
716
717 BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
718 BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates));
719
685 memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels)); 720 memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
686 memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates)); 721 memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
687 priv->map = (struct rtl818x_csr *)0xFF00; 722 priv->map = (struct rtl818x_csr *)0xFF00;
688 priv->modes[0].mode = MODE_IEEE80211G; 723
689 priv->modes[0].num_rates = ARRAY_SIZE(rtl818x_rates); 724 priv->band.band = IEEE80211_BAND_2GHZ;
690 priv->modes[0].rates = priv->rates; 725 priv->band.channels = priv->channels;
691 priv->modes[0].num_channels = ARRAY_SIZE(rtl818x_channels); 726 priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
692 priv->modes[0].channels = priv->channels; 727 priv->band.bitrates = priv->rates;
693 priv->modes[1].mode = MODE_IEEE80211B; 728 priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
694 priv->modes[1].num_rates = 4; 729 dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
695 priv->modes[1].rates = priv->rates; 730
696 priv->modes[1].num_channels = ARRAY_SIZE(rtl818x_channels); 731
697 priv->modes[1].channels = priv->channels;
698 priv->mode = IEEE80211_IF_TYPE_MNTR; 732 priv->mode = IEEE80211_IF_TYPE_MNTR;
699 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 733 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
700 IEEE80211_HW_RX_INCLUDES_FCS; 734 IEEE80211_HW_RX_INCLUDES_FCS;
@@ -703,10 +737,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
703 dev->max_rssi = 65; 737 dev->max_rssi = 65;
704 dev->max_signal = 64; 738 dev->max_signal = 64;
705 739
706 for (i = 0; i < 2; i++)
707 if ((err = ieee80211_register_hwmode(dev, &priv->modes[i])))
708 goto err_free_dev;
709
710 eeprom.data = dev; 740 eeprom.data = dev;
711 eeprom.register_read = rtl8187_eeprom_register_read; 741 eeprom.register_read = rtl8187_eeprom_register_read;
712 eeprom.register_write = rtl8187_eeprom_register_write; 742 eeprom.register_write = rtl8187_eeprom_register_write;
@@ -730,20 +760,20 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
730 for (i = 0; i < 3; i++) { 760 for (i = 0; i < 3; i++) {
731 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_1 + i, 761 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_1 + i,
732 &txpwr); 762 &txpwr);
733 (*channel++).val = txpwr & 0xFF; 763 (*channel++).hw_value = txpwr & 0xFF;
734 (*channel++).val = txpwr >> 8; 764 (*channel++).hw_value = txpwr >> 8;
735 } 765 }
736 for (i = 0; i < 2; i++) { 766 for (i = 0; i < 2; i++) {
737 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_4 + i, 767 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_4 + i,
738 &txpwr); 768 &txpwr);
739 (*channel++).val = txpwr & 0xFF; 769 (*channel++).hw_value = txpwr & 0xFF;
740 (*channel++).val = txpwr >> 8; 770 (*channel++).hw_value = txpwr >> 8;
741 } 771 }
742 for (i = 0; i < 2; i++) { 772 for (i = 0; i < 2; i++) {
743 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6 + i, 773 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6 + i,
744 &txpwr); 774 &txpwr);
745 (*channel++).val = txpwr & 0xFF; 775 (*channel++).hw_value = txpwr & 0xFF;
746 (*channel++).val = txpwr >> 8; 776 (*channel++).hw_value = txpwr >> 8;
747 } 777 }
748 778
749 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE, 779 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE,