aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_conf.h26
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c85
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_rx.c76
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_rx.h2
4 files changed, 114 insertions, 75 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h
index 7fcfe06b1412..f63dd5ed998e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_conf.h
+++ b/drivers/net/wireless/wl12xx/wl1271_conf.h
@@ -66,6 +66,32 @@ enum {
66}; 66};
67 67
68enum { 68enum {
69 CONF_HW_RXTX_RATE_MCS7 = 0,
70 CONF_HW_RXTX_RATE_MCS6,
71 CONF_HW_RXTX_RATE_MCS5,
72 CONF_HW_RXTX_RATE_MCS4,
73 CONF_HW_RXTX_RATE_MCS3,
74 CONF_HW_RXTX_RATE_MCS2,
75 CONF_HW_RXTX_RATE_MCS1,
76 CONF_HW_RXTX_RATE_MCS0,
77 CONF_HW_RXTX_RATE_54,
78 CONF_HW_RXTX_RATE_48,
79 CONF_HW_RXTX_RATE_36,
80 CONF_HW_RXTX_RATE_24,
81 CONF_HW_RXTX_RATE_22,
82 CONF_HW_RXTX_RATE_18,
83 CONF_HW_RXTX_RATE_12,
84 CONF_HW_RXTX_RATE_11,
85 CONF_HW_RXTX_RATE_9,
86 CONF_HW_RXTX_RATE_6,
87 CONF_HW_RXTX_RATE_5_5,
88 CONF_HW_RXTX_RATE_2,
89 CONF_HW_RXTX_RATE_1,
90 CONF_HW_RXTX_RATE_MAX,
91 CONF_HW_RXTX_RATE_UNSUPPORTED = 0xff
92};
93
94enum {
69 CONF_SG_DISABLE = 0, 95 CONF_SG_DISABLE = 0,
70 CONF_SG_PROTECTIVE, 96 CONF_SG_PROTECTIVE,
71 CONF_SG_OPPORTUNISTIC 97 CONF_SG_OPPORTUNISTIC
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 3daba6c0c77f..49779e588e30 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1816,6 +1816,36 @@ static struct ieee80211_channel wl1271_channels[] = {
1816 { .hw_value = 13, .center_freq = 2472, .max_power = 25 }, 1816 { .hw_value = 13, .center_freq = 2472, .max_power = 25 },
1817}; 1817};
1818 1818
1819/* mapping to indexes for wl1271_rates */
1820const static u8 wl1271_rate_to_idx_2ghz[] = {
1821 /* MCS rates are used only with 11n */
1822 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */
1823 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */
1824 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */
1825 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */
1826 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */
1827 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */
1828 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */
1829 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */
1830
1831 11, /* CONF_HW_RXTX_RATE_54 */
1832 10, /* CONF_HW_RXTX_RATE_48 */
1833 9, /* CONF_HW_RXTX_RATE_36 */
1834 8, /* CONF_HW_RXTX_RATE_24 */
1835
1836 /* TI-specific rate */
1837 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22 */
1838
1839 7, /* CONF_HW_RXTX_RATE_18 */
1840 6, /* CONF_HW_RXTX_RATE_12 */
1841 3, /* CONF_HW_RXTX_RATE_11 */
1842 5, /* CONF_HW_RXTX_RATE_9 */
1843 4, /* CONF_HW_RXTX_RATE_6 */
1844 2, /* CONF_HW_RXTX_RATE_5_5 */
1845 1, /* CONF_HW_RXTX_RATE_2 */
1846 0 /* CONF_HW_RXTX_RATE_1 */
1847};
1848
1819/* can't be const, mac80211 writes to this */ 1849/* can't be const, mac80211 writes to this */
1820static struct ieee80211_supported_band wl1271_band_2ghz = { 1850static struct ieee80211_supported_band wl1271_band_2ghz = {
1821 .channels = wl1271_channels, 1851 .channels = wl1271_channels,
@@ -1898,6 +1928,35 @@ static struct ieee80211_channel wl1271_channels_5ghz[] = {
1898 { .hw_value = 165, .center_freq = 5825}, 1928 { .hw_value = 165, .center_freq = 5825},
1899}; 1929};
1900 1930
1931/* mapping to indexes for wl1271_rates_5ghz */
1932const static u8 wl1271_rate_to_idx_5ghz[] = {
1933 /* MCS rates are used only with 11n */
1934 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */
1935 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */
1936 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */
1937 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */
1938 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */
1939 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */
1940 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */
1941 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */
1942
1943 7, /* CONF_HW_RXTX_RATE_54 */
1944 6, /* CONF_HW_RXTX_RATE_48 */
1945 5, /* CONF_HW_RXTX_RATE_36 */
1946 4, /* CONF_HW_RXTX_RATE_24 */
1947
1948 /* TI-specific rate */
1949 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22 */
1950
1951 3, /* CONF_HW_RXTX_RATE_18 */
1952 2, /* CONF_HW_RXTX_RATE_12 */
1953 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_11 */
1954 1, /* CONF_HW_RXTX_RATE_9 */
1955 0, /* CONF_HW_RXTX_RATE_6 */
1956 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_5_5 */
1957 CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_2 */
1958 CONF_HW_RXTX_RATE_UNSUPPORTED /* CONF_HW_RXTX_RATE_1 */
1959};
1901 1960
1902static struct ieee80211_supported_band wl1271_band_5ghz = { 1961static struct ieee80211_supported_band wl1271_band_5ghz = {
1903 .channels = wl1271_channels_5ghz, 1962 .channels = wl1271_channels_5ghz,
@@ -1906,6 +1965,11 @@ static struct ieee80211_supported_band wl1271_band_5ghz = {
1906 .n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz), 1965 .n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz),
1907}; 1966};
1908 1967
1968const static u8 *wl1271_band_rate_to_idx[] = {
1969 [IEEE80211_BAND_2GHZ] = wl1271_rate_to_idx_2ghz,
1970 [IEEE80211_BAND_5GHZ] = wl1271_rate_to_idx_5ghz
1971};
1972
1909static const struct ieee80211_ops wl1271_ops = { 1973static const struct ieee80211_ops wl1271_ops = {
1910 .start = wl1271_op_start, 1974 .start = wl1271_op_start,
1911 .stop = wl1271_op_stop, 1975 .stop = wl1271_op_stop,
@@ -1923,6 +1987,27 @@ static const struct ieee80211_ops wl1271_ops = {
1923 CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 1987 CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
1924}; 1988};
1925 1989
1990
1991u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate)
1992{
1993 u8 idx;
1994
1995 BUG_ON(wl->band >= sizeof(wl1271_band_rate_to_idx)/sizeof(u8 *));
1996
1997 if (unlikely(rate >= CONF_HW_RXTX_RATE_MAX)) {
1998 wl1271_error("Illegal RX rate from HW: %d", rate);
1999 return 0;
2000 }
2001
2002 idx = wl1271_band_rate_to_idx[wl->band][rate];
2003 if (unlikely(idx == CONF_HW_RXTX_RATE_UNSUPPORTED)) {
2004 wl1271_error("Unsupported RX rate from HW: %d", rate);
2005 return 0;
2006 }
2007
2008 return idx;
2009}
2010
1926static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, 2011static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev,
1927 struct device_attribute *attr, 2012 struct device_attribute *attr,
1928 char *buf) 2013 char *buf)
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index b824c6cc2cc5..a1a7953e475a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -41,66 +41,6 @@ static u32 wl1271_rx_get_buf_size(struct wl1271_fw_status *status,
41 RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV; 41 RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV;
42} 42}
43 43
44/* The values of this table must match the wl1271_rates[] array */
45static u8 wl1271_rx_rate_to_idx[] = {
46 /* MCS rates are used only with 11n */
47 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */
48 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */
49 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */
50 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */
51 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */
52 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */
53 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */
54 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */
55
56 11, /* WL1271_RATE_54 */
57 10, /* WL1271_RATE_48 */
58 9, /* WL1271_RATE_36 */
59 8, /* WL1271_RATE_24 */
60
61 /* TI-specific rate */
62 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22 */
63
64 7, /* WL1271_RATE_18 */
65 6, /* WL1271_RATE_12 */
66 3, /* WL1271_RATE_11 */
67 5, /* WL1271_RATE_9 */
68 4, /* WL1271_RATE_6 */
69 2, /* WL1271_RATE_5_5 */
70 1, /* WL1271_RATE_2 */
71 0 /* WL1271_RATE_1 */
72};
73
74/* The values of this table must match the wl1271_rates[] array */
75static u8 wl1271_5_ghz_rx_rate_to_idx[] = {
76 /* MCS rates are used only with 11n */
77 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */
78 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */
79 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */
80 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */
81 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */
82 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */
83 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */
84 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */
85
86 7, /* WL1271_RATE_54 */
87 6, /* WL1271_RATE_48 */
88 5, /* WL1271_RATE_36 */
89 4, /* WL1271_RATE_24 */
90
91 /* TI-specific rate */
92 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22 */
93
94 3, /* WL1271_RATE_18 */
95 2, /* WL1271_RATE_12 */
96 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_11 */
97 1, /* WL1271_RATE_9 */
98 0, /* WL1271_RATE_6 */
99 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_5_5 */
100 WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_2 */
101 WL1271_RX_RATE_UNSUPPORTED /* WL1271_RATE_1 */
102};
103
104static void wl1271_rx_status(struct wl1271 *wl, 44static void wl1271_rx_status(struct wl1271 *wl,
105 struct wl1271_rx_descriptor *desc, 45 struct wl1271_rx_descriptor *desc,
106 struct ieee80211_rx_status *status, 46 struct ieee80211_rx_status *status,
@@ -108,20 +48,8 @@ static void wl1271_rx_status(struct wl1271 *wl,
108{ 48{
109 memset(status, 0, sizeof(struct ieee80211_rx_status)); 49 memset(status, 0, sizeof(struct ieee80211_rx_status));
110 50
111 if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == 51 status->band = wl->band;
112 WL1271_RX_DESC_BAND_BG) { 52 status->rate_idx = wl1271_rate_to_idx(wl, desc->rate);
113 status->band = IEEE80211_BAND_2GHZ;
114 status->rate_idx = wl1271_rx_rate_to_idx[desc->rate];
115 } else if ((desc->flags & WL1271_RX_DESC_BAND_MASK) ==
116 WL1271_RX_DESC_BAND_A) {
117 status->band = IEEE80211_BAND_5GHZ;
118 status->rate_idx = wl1271_5_ghz_rx_rate_to_idx[desc->rate];
119 } else
120 wl1271_warning("unsupported band 0x%x",
121 desc->flags & WL1271_RX_DESC_BAND_MASK);
122
123 if (unlikely(status->rate_idx == WL1271_RX_RATE_UNSUPPORTED))
124 wl1271_warning("unsupported rate");
125 53
126 /* 54 /*
127 * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the 55 * FIXME: Add mactime handling. For IBSS (ad-hoc) we need to get the
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.h b/drivers/net/wireless/wl12xx/wl1271_rx.h
index 1ae6d1783ed4..b89be4758e78 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.h
@@ -43,7 +43,6 @@
43#define RX_MAX_PACKET_ID 3 43#define RX_MAX_PACKET_ID 3
44 44
45#define NUM_RX_PKT_DESC_MOD_MASK 7 45#define NUM_RX_PKT_DESC_MOD_MASK 7
46#define WL1271_RX_RATE_UNSUPPORTED 0xFF
47 46
48#define RX_DESC_VALID_FCS 0x0001 47#define RX_DESC_VALID_FCS 0x0001
49#define RX_DESC_MATCH_RXADDR1 0x0002 48#define RX_DESC_MATCH_RXADDR1 0x0002
@@ -117,5 +116,6 @@ struct wl1271_rx_descriptor {
117} __attribute__ ((packed)); 116} __attribute__ ((packed));
118 117
119void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status); 118void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status);
119u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate);
120 120
121#endif 121#endif