Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem

Conflicts:
drivers/net/wireless/b43legacy/dma.c

+1181 -2116
+3 -2
drivers/net/wireless/ath/ath5k/trace.h
··· 3 3 4 4 #include <linux/tracepoint.h> 5 5 6 - #ifndef CONFIG_ATH5K_TRACER 6 + 7 + #if !defined(CONFIG_ATH5K_TRACER) || defined(__CHECKER__) 7 8 #undef TRACE_EVENT 8 9 #define TRACE_EVENT(name, proto, ...) \ 9 10 static inline void trace_ ## name(proto) {} ··· 94 93 95 94 #endif /* __TRACE_ATH5K_H */ 96 95 97 - #ifdef CONFIG_ATH5K_TRACER 96 + #if defined(CONFIG_ATH5K_TRACER) && !defined(__CHECKER__) 98 97 99 98 #undef TRACE_INCLUDE_PATH 100 99 #define TRACE_INCLUDE_PATH ../../drivers/net/wireless/ath/ath5k
+4 -21
drivers/net/wireless/ath/ath6kl/Kconfig
··· 1 1 config ATH6KL 2 - tristate "Atheros mobile chipsets support" 3 - 4 - config ATH6KL_SDIO 5 - tristate "Atheros ath6kl SDIO support" 6 - depends on ATH6KL 2 + tristate "Atheros ath6kl support" 7 3 depends on MMC 8 4 depends on CFG80211 9 5 ---help--- 10 6 This module adds support for wireless adapters based on 11 - Atheros AR6003 and AR6004 chipsets running over SDIO. If you 12 - choose to build it as a module, it will be called ath6kl_sdio. 13 - Please note that AR6002 and AR6001 are not supported by this 14 - driver. 15 - 16 - config ATH6KL_USB 17 - tristate "Atheros ath6kl USB support" 18 - depends on ATH6KL 19 - depends on USB 20 - depends on CFG80211 21 - depends on EXPERIMENTAL 22 - ---help--- 23 - This module adds support for wireless adapters based on 24 - Atheros AR6004 chipset running over USB. This is still under 25 - implementation and it isn't functional. If you choose to 26 - build it as a module, it will be called ath6kl_usb. 7 + Atheros AR6003 chipset running over SDIO. If you choose to 8 + build it as a module, it will be called ath6kl. Pls note 9 + that AR6002 and AR6001 are not supported by this driver. 27 10 28 11 config ATH6KL_DEBUG 29 12 bool "Atheros ath6kl debugging"
+12 -25
drivers/net/wireless/ath/ath6kl/Makefile
··· 21 21 # Author(s): ="Atheros" 22 22 #------------------------------------------------------------------------------ 23 23 24 - obj-$(CONFIG_ATH6KL_SDIO) := ath6kl_sdio.o 25 - ath6kl_sdio-y += debug.o 26 - ath6kl_sdio-y += hif.o 27 - ath6kl_sdio-y += htc.o 28 - ath6kl_sdio-y += bmi.o 29 - ath6kl_sdio-y += cfg80211.o 30 - ath6kl_sdio-y += init.o 31 - ath6kl_sdio-y += main.o 32 - ath6kl_sdio-y += txrx.o 33 - ath6kl_sdio-y += wmi.o 34 - ath6kl_sdio-y += sdio.o 35 - ath6kl_sdio-$(CONFIG_NL80211_TESTMODE) += testmode.o 36 - 37 - obj-$(CONFIG_ATH6KL_USB) += ath6kl_usb.o 38 - ath6kl_usb-y += debug.o 39 - ath6kl_usb-y += hif.o 40 - ath6kl_usb-y += htc.o 41 - ath6kl_usb-y += bmi.o 42 - ath6kl_usb-y += cfg80211.o 43 - ath6kl_usb-y += init.o 44 - ath6kl_usb-y += main.o 45 - ath6kl_usb-y += txrx.o 46 - ath6kl_usb-y += wmi.o 47 - ath6kl_usb-y += usb.o 48 - ath6kl_usb-$(CONFIG_NL80211_TESTMODE) += testmode.o 24 + obj-$(CONFIG_ATH6KL) := ath6kl.o 25 + ath6kl-y += debug.o 26 + ath6kl-y += hif.o 27 + ath6kl-y += htc.o 28 + ath6kl-y += bmi.o 29 + ath6kl-y += cfg80211.o 30 + ath6kl-y += init.o 31 + ath6kl-y += main.o 32 + ath6kl-y += txrx.o 33 + ath6kl-y += wmi.o 34 + ath6kl-y += sdio.o 35 + ath6kl-$(CONFIG_NL80211_TESTMODE) += testmode.o 49 36 50 37 ccflags-y += -D__CHECK_ENDIAN__
+2 -8
drivers/net/wireless/ath/ath6kl/bmi.c
··· 57 57 return ret; 58 58 } 59 59 60 - if (ar->hif_type == ATH6KL_HIF_TYPE_USB) { 61 - ret = ath6kl_hif_bmi_read(ar, (u8 *)targ_info, 62 - sizeof(*targ_info)); 63 - } else { 64 - ret = ath6kl_hif_bmi_read(ar, (u8 *)&targ_info->version, 65 - sizeof(targ_info->version)); 66 - } 67 - 60 + ret = ath6kl_hif_bmi_read(ar, (u8 *)&targ_info->version, 61 + sizeof(targ_info->version)); 68 62 if (ret) { 69 63 ath6kl_err("Unable to recv target info: %d\n", ret); 70 64 return ret;
-1
drivers/net/wireless/ath/ath6kl/debug.h
··· 41 41 ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */ 42 42 ATH6KL_DBG_WMI_DUMP = BIT(19), 43 43 ATH6KL_DBG_SUSPEND = BIT(20), 44 - ATH6KL_DBG_USB = BIT(21), 45 44 ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */ 46 45 }; 47 46
-5
drivers/net/wireless/ath/ath6kl/hif.c
··· 689 689 ath6kl_dbg(ATH6KL_DBG_HIF, "hif block size %d mbox addr 0x%x\n", 690 690 dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr); 691 691 692 - /* usb doesn't support enabling interrupts */ 693 - /* FIXME: remove check once USB support is implemented */ 694 - if (dev->ar->hif_type == ATH6KL_HIF_TYPE_USB) 695 - return 0; 696 - 697 692 status = ath6kl_hif_disable_intrs(dev); 698 693 699 694 fail_setup:
+1 -9
drivers/net/wireless/ath/ath6kl/htc.c
··· 2543 2543 struct htc_service_connect_resp resp; 2544 2544 int status; 2545 2545 2546 - /* FIXME: remove once USB support is implemented */ 2547 - if (target->dev->ar->hif_type == ATH6KL_HIF_TYPE_USB) { 2548 - ath6kl_err("HTC doesn't support USB yet. Patience!\n"); 2549 - return -EOPNOTSUPP; 2550 - } 2551 - 2552 2546 /* we should be getting 1 control message that the target is ready */ 2553 2547 packet = htc_wait_for_ctrl_msg(target); 2554 2548 ··· 2772 2778 { 2773 2779 struct htc_packet *packet, *tmp_packet; 2774 2780 2775 - /* FIXME: remove check once USB support is implemented */ 2776 - if (target->dev->ar->hif_type != ATH6KL_HIF_TYPE_USB) 2777 - ath6kl_hif_cleanup_scatter(target->dev->ar); 2781 + ath6kl_hif_cleanup_scatter(target->dev->ar); 2778 2782 2779 2783 list_for_each_entry_safe(packet, tmp_packet, 2780 2784 &target->free_ctrl_txbuf, list) {
+1 -1
drivers/net/wireless/ath/ath6kl/sdio.c
··· 1332 1332 MODULE_DEVICE_TABLE(sdio, ath6kl_sdio_devices); 1333 1333 1334 1334 static struct sdio_driver ath6kl_sdio_driver = { 1335 - .name = "ath6kl_sdio", 1335 + .name = "ath6kl", 1336 1336 .id_table = ath6kl_sdio_devices, 1337 1337 .probe = ath6kl_sdio_probe, 1338 1338 .remove = ath6kl_sdio_remove,
-431
drivers/net/wireless/ath/ath6kl/usb.c
··· 1 - /* 2 - * Copyright (c) 2007-2011 Atheros Communications Inc. 3 - * 4 - * Permission to use, copy, modify, and/or distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 - #include <linux/module.h> 18 - #include <linux/usb.h> 19 - 20 - #include "debug.h" 21 - #include "core.h" 22 - 23 - /* usb device object */ 24 - struct ath6kl_usb { 25 - struct usb_device *udev; 26 - struct usb_interface *interface; 27 - u8 *diag_cmd_buffer; 28 - u8 *diag_resp_buffer; 29 - struct ath6kl *ar; 30 - }; 31 - 32 - /* diagnostic command defnitions */ 33 - #define ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD 1 34 - #define ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP 2 35 - #define ATH6KL_USB_CONTROL_REQ_DIAG_CMD 3 36 - #define ATH6KL_USB_CONTROL_REQ_DIAG_RESP 4 37 - 38 - #define ATH6KL_USB_CTRL_DIAG_CC_READ 0 39 - #define ATH6KL_USB_CTRL_DIAG_CC_WRITE 1 40 - 41 - struct ath6kl_usb_ctrl_diag_cmd_write { 42 - __le32 cmd; 43 - __le32 address; 44 - __le32 value; 45 - __le32 _pad[1]; 46 - } __packed; 47 - 48 - struct ath6kl_usb_ctrl_diag_cmd_read { 49 - __le32 cmd; 50 - __le32 address; 51 - } __packed; 52 - 53 - struct ath6kl_usb_ctrl_diag_resp_read { 54 - __le32 value; 55 - } __packed; 56 - 57 - #define ATH6KL_USB_MAX_DIAG_CMD (sizeof(struct ath6kl_usb_ctrl_diag_cmd_write)) 58 - #define ATH6KL_USB_MAX_DIAG_RESP (sizeof(struct ath6kl_usb_ctrl_diag_resp_read)) 59 - 60 - static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb) 61 - { 62 - usb_set_intfdata(ar_usb->interface, NULL); 63 - 64 - kfree(ar_usb->diag_cmd_buffer); 65 - kfree(ar_usb->diag_resp_buffer); 66 - 67 - kfree(ar_usb); 68 - } 69 - 70 - static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface) 71 - { 72 - struct ath6kl_usb *ar_usb = NULL; 73 - struct usb_device *dev = interface_to_usbdev(interface); 74 - int status = 0; 75 - 76 - ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL); 77 - if (ar_usb == NULL) 78 - goto fail_ath6kl_usb_create; 79 - 80 - memset(ar_usb, 0, sizeof(struct ath6kl_usb)); 81 - usb_set_intfdata(interface, ar_usb); 82 - ar_usb->udev = dev; 83 - ar_usb->interface = interface; 84 - 85 - ar_usb->diag_cmd_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_CMD, GFP_KERNEL); 86 - if (ar_usb->diag_cmd_buffer == NULL) { 87 - status = -ENOMEM; 88 - goto fail_ath6kl_usb_create; 89 - } 90 - 91 - ar_usb->diag_resp_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_RESP, 92 - GFP_KERNEL); 93 - if (ar_usb->diag_resp_buffer == NULL) { 94 - status = -ENOMEM; 95 - goto fail_ath6kl_usb_create; 96 - } 97 - 98 - fail_ath6kl_usb_create: 99 - if (status != 0) { 100 - ath6kl_usb_destroy(ar_usb); 101 - ar_usb = NULL; 102 - } 103 - return ar_usb; 104 - } 105 - 106 - static void ath6kl_usb_device_detached(struct usb_interface *interface) 107 - { 108 - struct ath6kl_usb *ar_usb; 109 - 110 - ar_usb = usb_get_intfdata(interface); 111 - if (ar_usb == NULL) 112 - return; 113 - 114 - ath6kl_stop_txrx(ar_usb->ar); 115 - 116 - ath6kl_core_cleanup(ar_usb->ar); 117 - 118 - ath6kl_usb_destroy(ar_usb); 119 - } 120 - 121 - static int ath6kl_usb_submit_ctrl_out(struct ath6kl_usb *ar_usb, 122 - u8 req, u16 value, u16 index, void *data, 123 - u32 size) 124 - { 125 - u8 *buf = NULL; 126 - int ret; 127 - 128 - if (size > 0) { 129 - buf = kmalloc(size, GFP_KERNEL); 130 - if (buf == NULL) 131 - return -ENOMEM; 132 - 133 - memcpy(buf, data, size); 134 - } 135 - 136 - /* note: if successful returns number of bytes transfered */ 137 - ret = usb_control_msg(ar_usb->udev, 138 - usb_sndctrlpipe(ar_usb->udev, 0), 139 - req, 140 - USB_DIR_OUT | USB_TYPE_VENDOR | 141 - USB_RECIP_DEVICE, value, index, buf, 142 - size, 1000); 143 - 144 - if (ret < 0) { 145 - ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n", 146 - __func__, ret); 147 - } 148 - 149 - kfree(buf); 150 - 151 - return 0; 152 - } 153 - 154 - static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb, 155 - u8 req, u16 value, u16 index, void *data, 156 - u32 size) 157 - { 158 - u8 *buf = NULL; 159 - int ret; 160 - 161 - if (size > 0) { 162 - buf = kmalloc(size, GFP_KERNEL); 163 - if (buf == NULL) 164 - return -ENOMEM; 165 - } 166 - 167 - /* note: if successful returns number of bytes transfered */ 168 - ret = usb_control_msg(ar_usb->udev, 169 - usb_rcvctrlpipe(ar_usb->udev, 0), 170 - req, 171 - USB_DIR_IN | USB_TYPE_VENDOR | 172 - USB_RECIP_DEVICE, value, index, buf, 173 - size, 2 * HZ); 174 - 175 - if (ret < 0) { 176 - ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n", 177 - __func__, ret); 178 - } 179 - 180 - memcpy((u8 *) data, buf, size); 181 - 182 - kfree(buf); 183 - 184 - return 0; 185 - } 186 - 187 - static int ath6kl_usb_ctrl_msg_exchange(struct ath6kl_usb *ar_usb, 188 - u8 req_val, u8 *req_buf, u32 req_len, 189 - u8 resp_val, u8 *resp_buf, u32 *resp_len) 190 - { 191 - int ret; 192 - 193 - /* send command */ 194 - ret = ath6kl_usb_submit_ctrl_out(ar_usb, req_val, 0, 0, 195 - req_buf, req_len); 196 - 197 - if (ret != 0) 198 - return ret; 199 - 200 - if (resp_buf == NULL) { 201 - /* no expected response */ 202 - return ret; 203 - } 204 - 205 - /* get response */ 206 - ret = ath6kl_usb_submit_ctrl_in(ar_usb, resp_val, 0, 0, 207 - resp_buf, *resp_len); 208 - 209 - return ret; 210 - } 211 - 212 - static int ath6kl_usb_diag_read32(struct ath6kl *ar, u32 address, u32 *data) 213 - { 214 - struct ath6kl_usb *ar_usb = ar->hif_priv; 215 - struct ath6kl_usb_ctrl_diag_resp_read *resp; 216 - struct ath6kl_usb_ctrl_diag_cmd_read *cmd; 217 - u32 resp_len; 218 - int ret; 219 - 220 - cmd = (struct ath6kl_usb_ctrl_diag_cmd_read *) ar_usb->diag_cmd_buffer; 221 - 222 - memset(cmd, 0, sizeof(*cmd)); 223 - cmd->cmd = ATH6KL_USB_CTRL_DIAG_CC_READ; 224 - cmd->address = cpu_to_le32(address); 225 - resp_len = sizeof(*resp); 226 - 227 - ret = ath6kl_usb_ctrl_msg_exchange(ar_usb, 228 - ATH6KL_USB_CONTROL_REQ_DIAG_CMD, 229 - (u8 *) cmd, 230 - sizeof(struct ath6kl_usb_ctrl_diag_cmd_write), 231 - ATH6KL_USB_CONTROL_REQ_DIAG_RESP, 232 - ar_usb->diag_resp_buffer, &resp_len); 233 - 234 - if (ret) 235 - return ret; 236 - 237 - resp = (struct ath6kl_usb_ctrl_diag_resp_read *) 238 - ar_usb->diag_resp_buffer; 239 - 240 - *data = le32_to_cpu(resp->value); 241 - 242 - return ret; 243 - } 244 - 245 - static int ath6kl_usb_diag_write32(struct ath6kl *ar, u32 address, __le32 data) 246 - { 247 - struct ath6kl_usb *ar_usb = ar->hif_priv; 248 - struct ath6kl_usb_ctrl_diag_cmd_write *cmd; 249 - 250 - cmd = (struct ath6kl_usb_ctrl_diag_cmd_write *) ar_usb->diag_cmd_buffer; 251 - 252 - memset(cmd, 0, sizeof(struct ath6kl_usb_ctrl_diag_cmd_write)); 253 - cmd->cmd = cpu_to_le32(ATH6KL_USB_CTRL_DIAG_CC_WRITE); 254 - cmd->address = cpu_to_le32(address); 255 - cmd->value = data; 256 - 257 - return ath6kl_usb_ctrl_msg_exchange(ar_usb, 258 - ATH6KL_USB_CONTROL_REQ_DIAG_CMD, 259 - (u8 *) cmd, 260 - sizeof(*cmd), 261 - 0, NULL, NULL); 262 - 263 - } 264 - 265 - static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len) 266 - { 267 - struct ath6kl_usb *ar_usb = ar->hif_priv; 268 - int ret; 269 - 270 - /* get response */ 271 - ret = ath6kl_usb_submit_ctrl_in(ar_usb, 272 - ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP, 273 - 0, 0, buf, len); 274 - if (ret != 0) { 275 - ath6kl_err("Unable to read the bmi data from the device: %d\n", 276 - ret); 277 - return ret; 278 - } 279 - 280 - return 0; 281 - } 282 - 283 - static int ath6kl_usb_bmi_write(struct ath6kl *ar, u8 *buf, u32 len) 284 - { 285 - struct ath6kl_usb *ar_usb = ar->hif_priv; 286 - int ret; 287 - 288 - /* send command */ 289 - ret = ath6kl_usb_submit_ctrl_out(ar_usb, 290 - ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD, 291 - 0, 0, buf, len); 292 - if (ret != 0) { 293 - ath6kl_err("unable to send the bmi data to the device: %d\n", 294 - ret); 295 - return ret; 296 - } 297 - 298 - return 0; 299 - } 300 - 301 - static int ath6kl_usb_power_on(struct ath6kl *ar) 302 - { 303 - return 0; 304 - } 305 - 306 - static int ath6kl_usb_power_off(struct ath6kl *ar) 307 - { 308 - return 0; 309 - } 310 - 311 - static const struct ath6kl_hif_ops ath6kl_usb_ops = { 312 - .diag_read32 = ath6kl_usb_diag_read32, 313 - .diag_write32 = ath6kl_usb_diag_write32, 314 - .bmi_read = ath6kl_usb_bmi_read, 315 - .bmi_write = ath6kl_usb_bmi_write, 316 - .power_on = ath6kl_usb_power_on, 317 - .power_off = ath6kl_usb_power_off, 318 - }; 319 - 320 - /* ath6kl usb driver registered functions */ 321 - static int ath6kl_usb_probe(struct usb_interface *interface, 322 - const struct usb_device_id *id) 323 - { 324 - struct usb_device *dev = interface_to_usbdev(interface); 325 - struct ath6kl *ar; 326 - struct ath6kl_usb *ar_usb = NULL; 327 - int vendor_id, product_id; 328 - int ret = 0; 329 - 330 - usb_get_dev(dev); 331 - 332 - vendor_id = le16_to_cpu(dev->descriptor.idVendor); 333 - product_id = le16_to_cpu(dev->descriptor.idProduct); 334 - 335 - ath6kl_dbg(ATH6KL_DBG_USB, "vendor_id = %04x\n", vendor_id); 336 - ath6kl_dbg(ATH6KL_DBG_USB, "product_id = %04x\n", product_id); 337 - 338 - if (interface->cur_altsetting) 339 - ath6kl_dbg(ATH6KL_DBG_USB, "USB Interface %d\n", 340 - interface->cur_altsetting->desc.bInterfaceNumber); 341 - 342 - 343 - if (dev->speed == USB_SPEED_HIGH) 344 - ath6kl_dbg(ATH6KL_DBG_USB, "USB 2.0 Host\n"); 345 - else 346 - ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host\n"); 347 - 348 - ar_usb = ath6kl_usb_create(interface); 349 - 350 - if (ar_usb == NULL) { 351 - ret = -ENOMEM; 352 - goto err_usb_put; 353 - } 354 - 355 - ar = ath6kl_core_alloc(&ar_usb->udev->dev); 356 - if (ar == NULL) { 357 - ath6kl_err("Failed to alloc ath6kl core\n"); 358 - ret = -ENOMEM; 359 - goto err_usb_destroy; 360 - } 361 - 362 - ar->hif_priv = ar_usb; 363 - ar->hif_type = ATH6KL_HIF_TYPE_USB; 364 - ar->hif_ops = &ath6kl_usb_ops; 365 - ar->mbox_info.block_size = 16; 366 - ar->bmi.max_data_size = 252; 367 - 368 - ar_usb->ar = ar; 369 - 370 - ret = ath6kl_core_init(ar); 371 - if (ret) { 372 - ath6kl_err("Failed to init ath6kl core: %d\n", ret); 373 - goto err_core_free; 374 - } 375 - 376 - return ret; 377 - 378 - err_core_free: 379 - ath6kl_core_free(ar); 380 - err_usb_destroy: 381 - ath6kl_usb_destroy(ar_usb); 382 - err_usb_put: 383 - usb_put_dev(dev); 384 - 385 - return ret; 386 - } 387 - 388 - static void ath6kl_usb_remove(struct usb_interface *interface) 389 - { 390 - usb_put_dev(interface_to_usbdev(interface)); 391 - ath6kl_usb_device_detached(interface); 392 - } 393 - 394 - /* table of devices that work with this driver */ 395 - static struct usb_device_id ath6kl_usb_ids[] = { 396 - {USB_DEVICE(0x0cf3, 0x9374)}, 397 - { /* Terminating entry */ }, 398 - }; 399 - 400 - MODULE_DEVICE_TABLE(usb, ath6kl_usb_ids); 401 - 402 - static struct usb_driver ath6kl_usb_driver = { 403 - .name = "ath6kl_usb", 404 - .probe = ath6kl_usb_probe, 405 - .disconnect = ath6kl_usb_remove, 406 - .id_table = ath6kl_usb_ids, 407 - }; 408 - 409 - static int ath6kl_usb_init(void) 410 - { 411 - usb_register(&ath6kl_usb_driver); 412 - return 0; 413 - } 414 - 415 - static void ath6kl_usb_exit(void) 416 - { 417 - usb_deregister(&ath6kl_usb_driver); 418 - } 419 - 420 - module_init(ath6kl_usb_init); 421 - module_exit(ath6kl_usb_exit); 422 - 423 - MODULE_AUTHOR("Atheros Communications, Inc."); 424 - MODULE_DESCRIPTION("Driver support for Atheros AR600x USB devices"); 425 - MODULE_LICENSE("Dual BSD/GPL"); 426 - MODULE_FIRMWARE(AR6004_HW_1_0_FIRMWARE_FILE); 427 - MODULE_FIRMWARE(AR6004_HW_1_0_BOARD_DATA_FILE); 428 - MODULE_FIRMWARE(AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE); 429 - MODULE_FIRMWARE(AR6004_HW_1_1_FIRMWARE_FILE); 430 - MODULE_FIRMWARE(AR6004_HW_1_1_BOARD_DATA_FILE); 431 - MODULE_FIRMWARE(AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE);
+2 -2
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 3538 3538 static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is_2ghz) 3539 3539 { 3540 3540 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 3541 - __le32 val; 3541 + __le16 val; 3542 3542 3543 3543 if (is_2ghz) 3544 3544 val = eep->modalHeader2G.switchcomspdt; 3545 3545 else 3546 3546 val = eep->modalHeader5G.switchcomspdt; 3547 - return le32_to_cpu(val); 3547 + return le16_to_cpu(val); 3548 3548 } 3549 3549 3550 3550
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_mac.c
··· 583 583 584 584 void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start, 585 585 u32 ts_paddr_start, 586 - u8 size) 586 + u16 size) 587 587 { 588 588 589 589 ah->ts_paddr_start = ts_paddr_start;
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_mac.h
··· 118 118 void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah); 119 119 void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start, 120 120 u32 ts_paddr_start, 121 - u8 size); 121 + u16 size); 122 122 #endif
+1
drivers/net/wireless/ath/ath9k/ar9003_rtt.c
··· 16 16 17 17 #include "hw.h" 18 18 #include "ar9003_phy.h" 19 + #include "ar9003_rtt.h" 19 20 20 21 #define RTT_RESTORE_TIMEOUT 1000 21 22 #define RTT_ACCESS_TIMEOUT 100
+1 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 97 97 #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU) 98 98 #define bf_isaggr(bf) (bf->bf_state.bf_type & BUF_AGGR) 99 99 100 - #define ATH_TXSTATUS_RING_SIZE 64 100 + #define ATH_TXSTATUS_RING_SIZE 512 101 101 102 102 #define DS2PHYS(_dd, _ds) \ 103 103 ((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc))
+5 -2
drivers/net/wireless/ath/ath9k/beacon.c
··· 356 356 struct ath_buf *bf = NULL; 357 357 struct ieee80211_vif *vif; 358 358 struct ath_tx_status ts; 359 + bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); 359 360 int slot; 360 361 u32 bfaddr, bc = 0; 361 362 ··· 457 456 if (bfaddr != 0) { 458 457 /* NB: cabq traffic should already be queued and primed */ 459 458 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bfaddr); 460 - ath9k_hw_txstart(ah, sc->beacon.beaconq); 459 + 460 + if (!edma) 461 + ath9k_hw_txstart(ah, sc->beacon.beaconq); 461 462 462 463 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */ 463 - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { 464 + if (edma) { 464 465 spin_lock_bh(&sc->sc_pcu_lock); 465 466 ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts); 466 467 spin_unlock_bh(&sc->sc_pcu_lock);
+1 -1
drivers/net/wireless/ath/ath9k/hw.h
··· 1016 1016 u32 ts_paddr_start; 1017 1017 u32 ts_paddr_end; 1018 1018 u16 ts_tail; 1019 - u8 ts_size; 1019 + u16 ts_size; 1020 1020 1021 1021 u32 bb_watchdog_last_status; 1022 1022 u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */
+1 -1
drivers/net/wireless/ath/ath9k/mci.c
··· 20 20 #include "ath9k.h" 21 21 #include "mci.h" 22 22 23 - u8 ath_mci_duty_cycle[] = { 0, 50, 60, 70, 80, 85, 90, 95, 98 }; 23 + static const u8 ath_mci_duty_cycle[] = { 0, 50, 60, 70, 80, 85, 90, 95, 98 }; 24 24 25 25 static struct ath_mci_profile_info* 26 26 ath_mci_find_profile(struct ath_mci_profile *mci,
+3
drivers/net/wireless/ath/ath9k/xmit.c
··· 105 105 /*********************/ 106 106 107 107 static void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) 108 + __acquires(&txq->axq_lock) 108 109 { 109 110 spin_lock_bh(&txq->axq_lock); 110 111 } 111 112 112 113 static void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq) 114 + __releases(&txq->axq_lock) 113 115 { 114 116 spin_unlock_bh(&txq->axq_lock); 115 117 } 116 118 117 119 static void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) 120 + __releases(&txq->axq_lock) 118 121 { 119 122 struct sk_buff_head q; 120 123 struct sk_buff *skb;
+60 -37
drivers/net/wireless/ath/carl9170/fw.c
··· 146 146 return false; 147 147 } 148 148 149 - static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) 149 + static int carl9170_fw_checksum(struct ar9170 *ar, const __u8 *data, 150 + size_t len) 150 151 { 151 152 const struct carl9170fw_otus_desc *otus_desc; 152 - const struct carl9170fw_chk_desc *chk_desc; 153 153 const struct carl9170fw_last_desc *last_desc; 154 - const struct carl9170fw_txsq_desc *txsq_desc; 155 - u16 if_comb_types; 154 + const struct carl9170fw_chk_desc *chk_desc; 155 + unsigned long fin, diff; 156 + unsigned int dsc_len; 157 + u32 crc32; 156 158 157 159 last_desc = carl9170_fw_find_desc(ar, LAST_MAGIC, 158 160 sizeof(*last_desc), CARL9170FW_LAST_DESC_CUR_VER); ··· 172 170 chk_desc = carl9170_fw_find_desc(ar, CHK_MAGIC, 173 171 sizeof(*chk_desc), CARL9170FW_CHK_DESC_CUR_VER); 174 172 175 - if (chk_desc) { 176 - unsigned long fin, diff; 177 - unsigned int dsc_len; 178 - u32 crc32; 173 + if (!chk_desc) { 174 + dev_warn(&ar->udev->dev, "Unprotected firmware image.\n"); 175 + return 0; 176 + } 179 177 180 - dsc_len = min_t(unsigned int, len, 178 + dsc_len = min_t(unsigned int, len, 181 179 (unsigned long)chk_desc - (unsigned long)otus_desc); 182 180 183 - fin = (unsigned long) last_desc + sizeof(*last_desc); 184 - diff = fin - (unsigned long) otus_desc; 181 + fin = (unsigned long) last_desc + sizeof(*last_desc); 182 + diff = fin - (unsigned long) otus_desc; 185 183 186 - if (diff < len) 187 - len -= diff; 184 + if (diff < len) 185 + len -= diff; 188 186 189 - if (len < 256) 190 - return -EIO; 187 + if (len < 256) 188 + return -EIO; 191 189 192 - crc32 = crc32_le(~0, data, len); 193 - if (cpu_to_le32(crc32) != chk_desc->fw_crc32) { 194 - dev_err(&ar->udev->dev, "fw checksum test failed.\n"); 195 - return -ENOEXEC; 196 - } 190 + crc32 = crc32_le(~0, data, len); 191 + if (cpu_to_le32(crc32) != chk_desc->fw_crc32) { 192 + dev_err(&ar->udev->dev, "fw checksum test failed.\n"); 193 + return -ENOEXEC; 194 + } 197 195 198 - crc32 = crc32_le(crc32, (void *)otus_desc, dsc_len); 199 - if (cpu_to_le32(crc32) != chk_desc->hdr_crc32) { 200 - dev_err(&ar->udev->dev, "descriptor check failed.\n"); 196 + crc32 = crc32_le(crc32, (void *)otus_desc, dsc_len); 197 + if (cpu_to_le32(crc32) != chk_desc->hdr_crc32) { 198 + dev_err(&ar->udev->dev, "descriptor check failed.\n"); 199 + return -EINVAL; 200 + } 201 + return 0; 202 + } 203 + 204 + static int carl9170_fw_tx_sequence(struct ar9170 *ar) 205 + { 206 + const struct carl9170fw_txsq_desc *txsq_desc; 207 + 208 + txsq_desc = carl9170_fw_find_desc(ar, TXSQ_MAGIC, sizeof(*txsq_desc), 209 + CARL9170FW_TXSQ_DESC_CUR_VER); 210 + if (txsq_desc) { 211 + ar->fw.tx_seq_table = le32_to_cpu(txsq_desc->seq_table_addr); 212 + if (!valid_cpu_addr(ar->fw.tx_seq_table)) 201 213 return -EINVAL; 202 - } 203 214 } else { 204 - dev_warn(&ar->udev->dev, "Unprotected firmware image.\n"); 215 + ar->fw.tx_seq_table = 0; 216 + } 217 + 218 + return 0; 219 + } 220 + 221 + static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) 222 + { 223 + const struct carl9170fw_otus_desc *otus_desc; 224 + int err; 225 + u16 if_comb_types; 226 + 227 + err = carl9170_fw_checksum(ar, data, len); 228 + if (err) 229 + return err; 230 + 231 + otus_desc = carl9170_fw_find_desc(ar, OTUS_MAGIC, 232 + sizeof(*otus_desc), CARL9170FW_OTUS_DESC_CUR_VER); 233 + if (!otus_desc) { 234 + return -ENODATA; 205 235 } 206 236 207 237 #define SUPP(feat) \ ··· 355 321 356 322 ar->hw->wiphy->interface_modes |= if_comb_types; 357 323 358 - txsq_desc = carl9170_fw_find_desc(ar, TXSQ_MAGIC, 359 - sizeof(*txsq_desc), CARL9170FW_TXSQ_DESC_CUR_VER); 360 - 361 - if (txsq_desc) { 362 - ar->fw.tx_seq_table = le32_to_cpu(txsq_desc->seq_table_addr); 363 - if (!valid_cpu_addr(ar->fw.tx_seq_table)) 364 - return -EINVAL; 365 - } else { 366 - ar->fw.tx_seq_table = 0; 367 - } 368 - 369 324 #undef SUPPORTED 370 - return 0; 325 + return carl9170_fw_tx_sequence(ar); 371 326 } 372 327 373 328 static struct carl9170fw_desc_head *
+11
drivers/net/wireless/b43/b43.h
··· 191 191 #define B43_BFH_BUCKBOOST 0x0020 /* has buck/booster */ 192 192 #define B43_BFH_FEM_BT 0x0040 /* has FEM and switch to share antenna 193 193 * with bluetooth */ 194 + #define B43_BFH_NOCBUCK 0x0080 195 + #define B43_BFH_PALDO 0x0200 196 + #define B43_BFH_EXTLNA_5GHZ 0x1000 /* has an external LNA (5GHz mode) */ 194 197 195 198 /* SPROM boardflags2_lo values */ 196 199 #define B43_BFL2_RXBB_INT_REG_DIS 0x0001 /* external RX BB regulator present */ ··· 207 204 #define B43_BFL2_SKWRKFEM_BRD 0x0100 /* 4321mcm93 uses Skyworks FEM */ 208 205 #define B43_BFL2_SPUR_WAR 0x0200 /* has a workaround for clock-harmonic spurs */ 209 206 #define B43_BFL2_GPLL_WAR 0x0400 /* altenative G-band PLL settings implemented */ 207 + #define B43_BFL2_SINGLEANT_CCK 0x1000 208 + #define B43_BFL2_2G_SPUR_WAR 0x2000 209 + 210 + /* SPROM boardflags2_hi values */ 211 + #define B43_BFH2_GPLL_WAR2 0x0001 212 + #define B43_BFH2_IPALVLSHIFT_3P3 0x0002 213 + #define B43_BFH2_INTERNDET_TXIQCAL 0x0004 214 + #define B43_BFH2_XTALBUFOUTEN 0x0008 210 215 211 216 /* GPIO register offset, in both ChipCommon and PCI core. */ 212 217 #define B43_GPIO_CONTROL 0x6c
+241 -114
drivers/net/wireless/b43/phy_n.c
··· 167 167 b43_phy_mask(dev, val_addr, 168 168 ~(rf_ctrl->val_mask)); 169 169 } else { 170 - if (core == 0 || ((1 << core) & i) != 0) { 170 + if (core == 0 || ((1 << i) & core)) { 171 171 b43_phy_set(dev, en_addr, field); 172 172 b43_phy_maskset(dev, val_addr, 173 173 ~(rf_ctrl->val_mask), ··· 200 200 addr = B43_PHY_N((i == 0) ? 201 201 rf_ctrl->addr0 : rf_ctrl->addr1); 202 202 203 - if ((core & (1 << i)) != 0) 203 + if ((1 << i) & core) 204 204 b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask), 205 205 (value << rf_ctrl->shift)); 206 206 ··· 956 956 b43_phy_write(dev, B43_NPHY_SAMP_CMD, 1); 957 957 } 958 958 for (i = 0; i < 100; i++) { 959 - if (b43_phy_read(dev, B43_NPHY_RFSEQST) & 1) { 959 + if (!(b43_phy_read(dev, B43_NPHY_RFSEQST) & 1)) { 960 960 i = 0; 961 961 break; 962 962 } ··· 1511 1511 /* Prepare values */ 1512 1512 ghz5 = b43_phy_read(dev, B43_NPHY_BANDCTL) 1513 1513 & B43_NPHY_BANDCTL_5GHZ; 1514 - ext_lna = sprom->boardflags_lo & B43_BFL_EXTLNA; 1514 + ext_lna = ghz5 ? sprom->boardflags_hi & B43_BFH_EXTLNA_5GHZ : 1515 + sprom->boardflags_lo & B43_BFL_EXTLNA; 1515 1516 e = b43_nphy_get_gain_ctl_workaround_ent(dev, ghz5, ext_lna); 1516 1517 if (ghz5 && dev->phy.rev >= 5) 1517 1518 rssi_gain = 0x90; ··· 1563 1562 b43_phy_write(dev, 0x2A7, e->init_gain); 1564 1563 b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x106), 2, 1565 1564 e->rfseq_init); 1566 - b43_phy_write(dev, B43_NPHY_C1_INITGAIN, e->init_gain); 1567 1565 1568 1566 /* TODO: check defines. Do not match variables names */ 1569 1567 b43_phy_write(dev, B43_NPHY_C1_CLIP1_MEDGAIN, e->cliphi_gain); ··· 1929 1929 } 1930 1930 1931 1931 /************************************************** 1932 + * Tx/Rx common 1933 + **************************************************/ 1934 + 1935 + /* 1936 + * Transmits a known value for LO calibration 1937 + * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone 1938 + */ 1939 + static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val, 1940 + bool iqmode, bool dac_test) 1941 + { 1942 + u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test); 1943 + if (samp == 0) 1944 + return -1; 1945 + b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test); 1946 + return 0; 1947 + } 1948 + 1949 + /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */ 1950 + static void b43_nphy_update_txrx_chain(struct b43_wldev *dev) 1951 + { 1952 + struct b43_phy_n *nphy = dev->phy.n; 1953 + 1954 + bool override = false; 1955 + u16 chain = 0x33; 1956 + 1957 + if (nphy->txrx_chain == 0) { 1958 + chain = 0x11; 1959 + override = true; 1960 + } else if (nphy->txrx_chain == 1) { 1961 + chain = 0x22; 1962 + override = true; 1963 + } 1964 + 1965 + b43_phy_maskset(dev, B43_NPHY_RFSEQCA, 1966 + ~(B43_NPHY_RFSEQCA_TXEN | B43_NPHY_RFSEQCA_RXEN), 1967 + chain); 1968 + 1969 + if (override) 1970 + b43_phy_set(dev, B43_NPHY_RFSEQMODE, 1971 + B43_NPHY_RFSEQMODE_CAOVER); 1972 + else 1973 + b43_phy_mask(dev, B43_NPHY_RFSEQMODE, 1974 + ~B43_NPHY_RFSEQMODE_CAOVER); 1975 + } 1976 + 1977 + /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */ 1978 + static void b43_nphy_stop_playback(struct b43_wldev *dev) 1979 + { 1980 + struct b43_phy_n *nphy = dev->phy.n; 1981 + u16 tmp; 1982 + 1983 + if (nphy->hang_avoid) 1984 + b43_nphy_stay_in_carrier_search(dev, 1); 1985 + 1986 + tmp = b43_phy_read(dev, B43_NPHY_SAMP_STAT); 1987 + if (tmp & 0x1) 1988 + b43_phy_set(dev, B43_NPHY_SAMP_CMD, B43_NPHY_SAMP_CMD_STOP); 1989 + else if (tmp & 0x2) 1990 + b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF); 1991 + 1992 + b43_phy_mask(dev, B43_NPHY_SAMP_CMD, ~0x0004); 1993 + 1994 + if (nphy->bb_mult_save & 0x80000000) { 1995 + tmp = nphy->bb_mult_save & 0xFFFF; 1996 + b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); 1997 + nphy->bb_mult_save = 0; 1998 + } 1999 + 2000 + if (nphy->hang_avoid) 2001 + b43_nphy_stay_in_carrier_search(dev, 0); 2002 + } 2003 + 2004 + /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */ 2005 + static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core, 2006 + struct nphy_txgains target, 2007 + struct nphy_iqcal_params *params) 2008 + { 2009 + int i, j, indx; 2010 + u16 gain; 2011 + 2012 + if (dev->phy.rev >= 3) { 2013 + params->txgm = target.txgm[core]; 2014 + params->pga = target.pga[core]; 2015 + params->pad = target.pad[core]; 2016 + params->ipa = target.ipa[core]; 2017 + params->cal_gain = (params->txgm << 12) | (params->pga << 8) | 2018 + (params->pad << 4) | (params->ipa); 2019 + for (j = 0; j < 5; j++) 2020 + params->ncorr[j] = 0x79; 2021 + } else { 2022 + gain = (target.pad[core]) | (target.pga[core] << 4) | 2023 + (target.txgm[core] << 8); 2024 + 2025 + indx = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 2026 + 1 : 0; 2027 + for (i = 0; i < 9; i++) 2028 + if (tbl_iqcal_gainparams[indx][i][0] == gain) 2029 + break; 2030 + i = min(i, 8); 2031 + 2032 + params->txgm = tbl_iqcal_gainparams[indx][i][1]; 2033 + params->pga = tbl_iqcal_gainparams[indx][i][2]; 2034 + params->pad = tbl_iqcal_gainparams[indx][i][3]; 2035 + params->cal_gain = (params->txgm << 7) | (params->pga << 4) | 2036 + (params->pad << 2); 2037 + for (j = 0; j < 4; j++) 2038 + params->ncorr[j] = tbl_iqcal_gainparams[indx][i][4 + j]; 2039 + } 2040 + } 2041 + 2042 + /************************************************** 1932 2043 * Tx and Rx 1933 2044 **************************************************/ 1934 2045 ··· 2218 2107 } 2219 2108 } 2220 2109 if (dev->phy.rev < 7 && 2221 - (txpi[0] < 40 || txpi[0] > 100 || txpi[1] < 40 || txpi[1] > 10)) 2110 + (txpi[0] < 40 || txpi[0] > 100 || txpi[1] < 40 || txpi[1] > 100)) 2222 2111 txpi[0] = txpi[1] = 91; 2223 2112 2224 2113 /* ··· 2295 2184 2296 2185 if (nphy->hang_avoid) 2297 2186 b43_nphy_stay_in_carrier_search(dev, 0); 2187 + } 2188 + 2189 + static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev) 2190 + { 2191 + struct b43_phy *phy = &dev->phy; 2192 + 2193 + u8 core; 2194 + u16 r; /* routing */ 2195 + 2196 + if (phy->rev >= 7) { 2197 + for (core = 0; core < 2; core++) { 2198 + r = core ? 0x190 : 0x170; 2199 + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 2200 + b43_radio_write(dev, r + 0x5, 0x5); 2201 + b43_radio_write(dev, r + 0x9, 0xE); 2202 + if (phy->rev != 5) 2203 + b43_radio_write(dev, r + 0xA, 0); 2204 + if (phy->rev != 7) 2205 + b43_radio_write(dev, r + 0xB, 1); 2206 + else 2207 + b43_radio_write(dev, r + 0xB, 0x31); 2208 + } else { 2209 + b43_radio_write(dev, r + 0x5, 0x9); 2210 + b43_radio_write(dev, r + 0x9, 0xC); 2211 + b43_radio_write(dev, r + 0xB, 0x0); 2212 + if (phy->rev != 5) 2213 + b43_radio_write(dev, r + 0xA, 1); 2214 + else 2215 + b43_radio_write(dev, r + 0xA, 0x31); 2216 + } 2217 + b43_radio_write(dev, r + 0x6, 0); 2218 + b43_radio_write(dev, r + 0x7, 0); 2219 + b43_radio_write(dev, r + 0x8, 3); 2220 + b43_radio_write(dev, r + 0xC, 0); 2221 + } 2222 + } else { 2223 + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) 2224 + b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x128); 2225 + else 2226 + b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x80); 2227 + b43_radio_write(dev, B2056_SYN_RESERVED_ADDR30, 0); 2228 + b43_radio_write(dev, B2056_SYN_GPIO_MASTER1, 0x29); 2229 + 2230 + for (core = 0; core < 2; core++) { 2231 + r = core ? B2056_TX1 : B2056_TX0; 2232 + 2233 + b43_radio_write(dev, r | B2056_TX_IQCAL_VCM_HG, 0); 2234 + b43_radio_write(dev, r | B2056_TX_IQCAL_IDAC, 0); 2235 + b43_radio_write(dev, r | B2056_TX_TSSI_VCM, 3); 2236 + b43_radio_write(dev, r | B2056_TX_TX_AMP_DET, 0); 2237 + b43_radio_write(dev, r | B2056_TX_TSSI_MISC1, 8); 2238 + b43_radio_write(dev, r | B2056_TX_TSSI_MISC2, 0); 2239 + b43_radio_write(dev, r | B2056_TX_TSSI_MISC3, 0); 2240 + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 2241 + b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER, 2242 + 0x5); 2243 + if (phy->rev != 5) 2244 + b43_radio_write(dev, r | B2056_TX_TSSIA, 2245 + 0x00); 2246 + if (phy->rev >= 5) 2247 + b43_radio_write(dev, r | B2056_TX_TSSIG, 2248 + 0x31); 2249 + else 2250 + b43_radio_write(dev, r | B2056_TX_TSSIG, 2251 + 0x11); 2252 + b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX, 2253 + 0xE); 2254 + } else { 2255 + b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER, 2256 + 0x9); 2257 + b43_radio_write(dev, r | B2056_TX_TSSIA, 0x31); 2258 + b43_radio_write(dev, r | B2056_TX_TSSIG, 0x0); 2259 + b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX, 2260 + 0xC); 2261 + } 2262 + } 2263 + } 2264 + } 2265 + 2266 + /* 2267 + * Stop radio and transmit known signal. Then check received signal strength to 2268 + * get TSSI (Transmit Signal Strength Indicator). 2269 + * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi 2270 + */ 2271 + static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev) 2272 + { 2273 + struct b43_phy *phy = &dev->phy; 2274 + struct b43_phy_n *nphy = dev->phy.n; 2275 + 2276 + u32 tmp; 2277 + s32 rssi[4] = { }; 2278 + 2279 + /* TODO: check if we can transmit */ 2280 + 2281 + if (b43_nphy_ipa(dev)) 2282 + b43_nphy_ipa_internal_tssi_setup(dev); 2283 + 2284 + if (phy->rev >= 7) 2285 + ; /* TODO: Override Rev7 with 0x2000, 0, 3, 0, 0 as arguments */ 2286 + else if (phy->rev >= 3) 2287 + b43_nphy_rf_control_override(dev, 0x2000, 0, 3, false); 2288 + 2289 + b43_nphy_stop_playback(dev); 2290 + b43_nphy_tx_tone(dev, 0xFA0, 0, false, false); 2291 + udelay(20); 2292 + tmp = b43_nphy_poll_rssi(dev, 4, rssi, 1); 2293 + b43_nphy_stop_playback(dev); 2294 + b43_nphy_rssi_select(dev, 0, 0); 2295 + 2296 + if (phy->rev >= 7) 2297 + ; /* TODO: Override Rev7 with 0x2000, 0, 3, 1, 0 as arguments */ 2298 + else if (phy->rev >= 3) 2299 + b43_nphy_rf_control_override(dev, 0x2000, 0, 3, true); 2300 + 2301 + if (phy->rev >= 3) { 2302 + nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 24) & 0xFF; 2303 + nphy->pwr_ctl_info[1].idle_tssi_5g = (tmp >> 8) & 0xFF; 2304 + } else { 2305 + nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 16) & 0xFF; 2306 + nphy->pwr_ctl_info[1].idle_tssi_5g = tmp & 0xFF; 2307 + } 2308 + nphy->pwr_ctl_info[0].idle_tssi_2g = (tmp >> 24) & 0xFF; 2309 + nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF; 2298 2310 } 2299 2311 2300 2312 static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev) ··· 2522 2288 b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S2, 2523 2289 (((((tmp << 3) | tmp) << 3) | tmp) << 3) | tmp); 2524 2290 } 2525 - } 2526 - 2527 - /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */ 2528 - static void b43_nphy_update_txrx_chain(struct b43_wldev *dev) 2529 - { 2530 - struct b43_phy_n *nphy = dev->phy.n; 2531 - 2532 - bool override = false; 2533 - u16 chain = 0x33; 2534 - 2535 - if (nphy->txrx_chain == 0) { 2536 - chain = 0x11; 2537 - override = true; 2538 - } else if (nphy->txrx_chain == 1) { 2539 - chain = 0x22; 2540 - override = true; 2541 - } 2542 - 2543 - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, 2544 - ~(B43_NPHY_RFSEQCA_TXEN | B43_NPHY_RFSEQCA_RXEN), 2545 - chain); 2546 - 2547 - if (override) 2548 - b43_phy_set(dev, B43_NPHY_RFSEQMODE, 2549 - B43_NPHY_RFSEQMODE_CAOVER); 2550 - else 2551 - b43_phy_mask(dev, B43_NPHY_RFSEQMODE, 2552 - ~B43_NPHY_RFSEQMODE_CAOVER); 2553 2291 } 2554 2292 2555 2293 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */ ··· 2775 2569 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW3, array[3]); 2776 2570 } 2777 2571 2778 - /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */ 2779 - static void b43_nphy_stop_playback(struct b43_wldev *dev) 2780 - { 2781 - struct b43_phy_n *nphy = dev->phy.n; 2782 - u16 tmp; 2783 - 2784 - if (nphy->hang_avoid) 2785 - b43_nphy_stay_in_carrier_search(dev, 1); 2786 - 2787 - tmp = b43_phy_read(dev, B43_NPHY_SAMP_STAT); 2788 - if (tmp & 0x1) 2789 - b43_phy_set(dev, B43_NPHY_SAMP_CMD, B43_NPHY_SAMP_CMD_STOP); 2790 - else if (tmp & 0x2) 2791 - b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF); 2792 - 2793 - b43_phy_mask(dev, B43_NPHY_SAMP_CMD, ~0x0004); 2794 - 2795 - if (nphy->bb_mult_save & 0x80000000) { 2796 - tmp = nphy->bb_mult_save & 0xFFFF; 2797 - b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); 2798 - nphy->bb_mult_save = 0; 2799 - } 2800 - 2801 - if (nphy->hang_avoid) 2802 - b43_nphy_stay_in_carrier_search(dev, 0); 2803 - } 2804 - 2805 2572 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */ 2806 2573 static void b43_nphy_spur_workaround(struct b43_wldev *dev) 2807 2574 { ··· 2832 2653 2833 2654 if (nphy->hang_avoid) 2834 2655 b43_nphy_stay_in_carrier_search(dev, 0); 2835 - } 2836 - 2837 - /* 2838 - * Transmits a known value for LO calibration 2839 - * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone 2840 - */ 2841 - static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val, 2842 - bool iqmode, bool dac_test) 2843 - { 2844 - u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test); 2845 - if (samp == 0) 2846 - return -1; 2847 - b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test); 2848 - return 0; 2849 2656 } 2850 2657 2851 2658 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ ··· 3034 2869 b43_radio_mask(dev, B2055_C1_TX_BB_MXGM, ~0x20); 3035 2870 b43_radio_mask(dev, B2055_C2_TX_BB_MXGM, ~0x20); 3036 2871 } 3037 - } 3038 - } 3039 - 3040 - /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */ 3041 - static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core, 3042 - struct nphy_txgains target, 3043 - struct nphy_iqcal_params *params) 3044 - { 3045 - int i, j, indx; 3046 - u16 gain; 3047 - 3048 - if (dev->phy.rev >= 3) { 3049 - params->txgm = target.txgm[core]; 3050 - params->pga = target.pga[core]; 3051 - params->pad = target.pad[core]; 3052 - params->ipa = target.ipa[core]; 3053 - params->cal_gain = (params->txgm << 12) | (params->pga << 8) | 3054 - (params->pad << 4) | (params->ipa); 3055 - for (j = 0; j < 5; j++) 3056 - params->ncorr[j] = 0x79; 3057 - } else { 3058 - gain = (target.pad[core]) | (target.pga[core] << 4) | 3059 - (target.txgm[core] << 8); 3060 - 3061 - indx = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 3062 - 1 : 0; 3063 - for (i = 0; i < 9; i++) 3064 - if (tbl_iqcal_gainparams[indx][i][0] == gain) 3065 - break; 3066 - i = min(i, 8); 3067 - 3068 - params->txgm = tbl_iqcal_gainparams[indx][i][1]; 3069 - params->pga = tbl_iqcal_gainparams[indx][i][2]; 3070 - params->pad = tbl_iqcal_gainparams[indx][i][3]; 3071 - params->cal_gain = (params->txgm << 7) | (params->pga << 4) | 3072 - (params->pad << 2); 3073 - for (j = 0; j < 4; j++) 3074 - params->ncorr[j] = tbl_iqcal_gainparams[indx][i][4 + j]; 3075 2872 } 3076 2873 } 3077 2874 ··· 4109 3982 tx_pwr_state = nphy->txpwrctrl; 4110 3983 b43_nphy_tx_power_ctrl(dev, false); 4111 3984 b43_nphy_tx_power_fix(dev); 4112 - /* TODO N PHY TX Power Control Idle TSSI */ 3985 + b43_nphy_tx_power_ctl_idle_tssi(dev); 4113 3986 /* TODO N PHY TX Power Control Setup */ 4114 3987 b43_nphy_tx_gain_table_upload(dev); 4115 3988
+6
drivers/net/wireless/b43/phy_n.h
··· 765 765 u16 locomp; 766 766 }; 767 767 768 + struct b43_phy_n_pwr_ctl_info { 769 + u8 idle_tssi_2g; 770 + u8 idle_tssi_5g; 771 + }; 772 + 768 773 struct b43_phy_n { 769 774 u8 antsel_type; 770 775 u8 cal_orig_pwr_idx[2]; ··· 803 798 u16 txiqlocal_bestc[11]; 804 799 bool txiqlocal_coeffsvalid; 805 800 struct b43_phy_n_txpwrindex txpwrindex[2]; 801 + struct b43_phy_n_pwr_ctl_info pwr_ctl_info[2]; 806 802 struct b43_chanspec txiqlocal_chanspec; 807 803 808 804 u8 txrx_chain;
+90 -16
drivers/net/wireless/b43/tables_nphy.c
··· 2752 2752 { 0x00C0, 6, 0xE7, 0xF9, 0xEC, 0xFB } /* field == 0x4000 (fls 15) */ 2753 2753 }; 2754 2754 2755 - struct nphy_gain_ctl_workaround_entry nphy_gain_ctl_workaround[2][3] = { 2755 + struct nphy_gain_ctl_workaround_entry nphy_gain_ctl_wa_phy6_radio11_ghz2 = { 2756 + { 10, 14, 19, 27 }, 2757 + { -5, 6, 10, 15 }, 2758 + { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, 2759 + { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, 2760 + 0x427E, 2761 + { 0x413F, 0x413F, 0x413F, 0x413F }, 2762 + 0x007E, 0x0066, 0x1074, 2763 + 0x18, 0x18, 0x18, 2764 + 0x01D0, 0x5, 2765 + }; 2766 + struct nphy_gain_ctl_workaround_entry nphy_gain_ctl_workaround[2][4] = { 2756 2767 { /* 2GHz */ 2757 2768 { /* PHY rev 3 */ 2758 2769 { 7, 11, 16, 23 }, ··· 2787 2776 0x18, 0x18, 0x18, 2788 2777 0x01A1, 0x5, 2789 2778 }, 2790 - { /* PHY rev 5+ */ 2779 + { /* PHY rev 5 */ 2791 2780 { 9, 13, 18, 26 }, 2792 2781 { -3, 7, 11, 16 }, 2793 2782 { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, 2794 2783 { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, 2795 2784 0x427E, /* invalid for external LNA! */ 2796 2785 { 0x413F, 0x413F, 0x413F, 0x413F }, /* invalid for external LNA! */ 2797 - 0x1076, 0x0066, 0x106A, 2798 - 0xC, 0xC, 0xC, 2786 + 0x1076, 0x0066, 0x0000, /* low is invalid (the last one) */ 2787 + 0x18, 0x18, 0x18, 2788 + 0x01D0, 0x9, 2789 + }, 2790 + { /* PHY rev 6+ */ 2791 + { 8, 13, 18, 25 }, 2792 + { -5, 6, 10, 14 }, 2793 + { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, 2794 + { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, 2795 + 0x527E, /* invalid for external LNA! */ 2796 + { 0x513F, 0x513F, 0x513F, 0x513F }, /* invalid for external LNA! */ 2797 + 0x1076, 0x0066, 0x0000, /* low is invalid (the last one) */ 2798 + 0x18, 0x18, 0x18, 2799 2799 0x01D0, 0x5, 2800 2800 }, 2801 2801 }, ··· 2833 2811 0x24, 0x24, 0x24, 2834 2812 0x0107, 25, 2835 2813 }, 2836 - { /* PHY rev 5+ */ 2814 + { /* PHY rev 5 */ 2837 2815 { 6, 10, 16, 21 }, 2838 2816 { -7, 0, 4, 8 }, 2839 2817 { 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD }, ··· 2843 2821 0x029E, 0x2084, 0x2086, 2844 2822 0x24, 0x24, 0x24, 2845 2823 0x00A9, 25, 2824 + }, 2825 + { /* PHY rev 6+ */ 2826 + { 6, 10, 16, 21 }, 2827 + { -7, 0, 4, 8 }, 2828 + { 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD }, 2829 + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, 2830 + 0x729E, 2831 + { 0x714F, 0x714F, 0x714F, 0x714F }, 2832 + 0x029E, 0x2084, 0x2086, 2833 + 0x24, 0x24, 0x24, /* low is invalid for radio rev 11! */ 2834 + 0x00F0, 25, 2846 2835 }, 2847 2836 }, 2848 2837 }; ··· 3131 3098 { 3132 3099 struct nphy_gain_ctl_workaround_entry *e; 3133 3100 u8 phy_idx; 3101 + u8 tr_iso = ghz5 ? dev->dev->bus_sprom->fem.ghz5.tr_iso : 3102 + dev->dev->bus_sprom->fem.ghz2.tr_iso; 3103 + 3104 + if (!ghz5 && dev->phy.rev >= 6 && dev->phy.radio_rev == 11) 3105 + return &nphy_gain_ctl_wa_phy6_radio11_ghz2; 3134 3106 3135 3107 B43_WARN_ON(dev->phy.rev < 3); 3136 - if (dev->phy.rev >= 5) 3108 + if (dev->phy.rev >= 6) 3109 + phy_idx = 3; 3110 + else if (dev->phy.rev == 5) 3137 3111 phy_idx = 2; 3138 3112 else if (dev->phy.rev == 4) 3139 3113 phy_idx = 1; 3140 3114 else 3141 3115 phy_idx = 0; 3142 - 3143 3116 e = &nphy_gain_ctl_workaround[ghz5][phy_idx]; 3144 3117 3145 - /* Only one entry differs for external LNA, so instead making whole 3146 - * table 2 times bigger, hack is here 3147 - */ 3148 - if (!ghz5 && dev->phy.rev >= 5 && ext_lna) { 3149 - e->rfseq_init[0] &= 0x0FFF; 3150 - e->rfseq_init[1] &= 0x0FFF; 3151 - e->rfseq_init[2] &= 0x0FFF; 3152 - e->rfseq_init[3] &= 0x0FFF; 3153 - e->init_gain &= 0x0FFF; 3118 + /* Some workarounds to the workarounds... */ 3119 + if (ghz5 && dev->phy.rev >= 6) { 3120 + if (dev->phy.radio_rev == 11 && 3121 + !b43_channel_type_is_40mhz(dev->phy.channel_type)) 3122 + e->cliplo_gain = 0x2d; 3123 + } else if (!ghz5 && dev->phy.rev >= 5) { 3124 + if (ext_lna) { 3125 + e->rfseq_init[0] &= ~0x4000; 3126 + e->rfseq_init[1] &= ~0x4000; 3127 + e->rfseq_init[2] &= ~0x4000; 3128 + e->rfseq_init[3] &= ~0x4000; 3129 + e->init_gain &= ~0x4000; 3130 + } 3131 + switch (tr_iso) { 3132 + case 0: 3133 + e->cliplo_gain = 0x0062; 3134 + case 1: 3135 + e->cliplo_gain = 0x0064; 3136 + case 2: 3137 + e->cliplo_gain = 0x006a; 3138 + case 3: 3139 + e->cliplo_gain = 0x106a; 3140 + case 4: 3141 + e->cliplo_gain = 0x106c; 3142 + case 5: 3143 + e->cliplo_gain = 0x1074; 3144 + case 6: 3145 + e->cliplo_gain = 0x107c; 3146 + case 7: 3147 + e->cliplo_gain = 0x207c; 3148 + default: 3149 + e->cliplo_gain = 0x106a; 3150 + } 3151 + } else if (ghz5 && dev->phy.rev == 4 && ext_lna) { 3152 + e->rfseq_init[0] &= ~0x4000; 3153 + e->rfseq_init[1] &= ~0x4000; 3154 + e->rfseq_init[2] &= ~0x4000; 3155 + e->rfseq_init[3] &= ~0x4000; 3156 + e->init_gain &= ~0x4000; 3157 + e->rfseq_init[0] |= 0x1000; 3158 + e->rfseq_init[1] |= 0x1000; 3159 + e->rfseq_init[2] |= 0x1000; 3160 + e->rfseq_init[3] |= 0x1000; 3161 + e->init_gain |= 0x1000; 3154 3162 } 3155 3163 3156 3164 return e;
+20
drivers/net/wireless/b43legacy/b43legacy.h
··· 560 560 u8 algorithm; 561 561 }; 562 562 563 + #define B43legacy_QOS_QUEUE_NUM 4 564 + 563 565 struct b43legacy_wldev; 566 + 567 + /* QOS parameters for a queue. */ 568 + struct b43legacy_qos_params { 569 + /* The QOS parameters */ 570 + struct ieee80211_tx_queue_params p; 571 + }; 564 572 565 573 /* Data structure for the WLAN parts (802.11 cores) of the b43legacy chip. */ 566 574 struct b43legacy_wl { ··· 619 611 bool beacon1_uploaded; 620 612 bool beacon_templates_virgin; /* Never wrote the templates? */ 621 613 struct work_struct beacon_update_trigger; 614 + /* The current QOS parameters for the 4 queues. */ 615 + struct b43legacy_qos_params qos_params[B43legacy_QOS_QUEUE_NUM]; 616 + 617 + /* Packet transmit work */ 618 + struct work_struct tx_work; 619 + 620 + /* Queue of packets to be transmitted. */ 621 + struct sk_buff_head tx_queue[B43legacy_QOS_QUEUE_NUM]; 622 + 623 + /* Flag that implement the queues stopping. */ 624 + bool tx_queue_stopped[B43legacy_QOS_QUEUE_NUM]; 625 + 622 626 }; 623 627 624 628 /* Pointers to the firmware data and meta information about it. */
+37 -30
drivers/net/wireless/b43legacy/dma.c
··· 727 727 } else 728 728 B43legacy_WARN_ON(1); 729 729 } 730 - spin_lock_init(&ring->lock); 731 730 #ifdef CONFIG_B43LEGACY_DEBUG 732 731 ring->last_injected_overflow = jiffies; 733 732 #endif ··· 1143 1144 { 1144 1145 struct b43legacy_dmaring *ring; 1145 1146 int err = 0; 1146 - unsigned long flags; 1147 1147 1148 1148 ring = priority_to_txring(dev, skb_get_queue_mapping(skb)); 1149 - spin_lock_irqsave(&ring->lock, flags); 1150 1149 B43legacy_WARN_ON(!ring->tx); 1151 1150 1152 1151 if (unlikely(ring->stopped)) { ··· 1154 1157 * For now, just refuse the transmit. */ 1155 1158 if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) 1156 1159 b43legacyerr(dev->wl, "Packet after queue stopped\n"); 1157 - err = -ENOSPC; 1158 - goto out_unlock; 1160 + return -ENOSPC; 1159 1161 } 1160 1162 1161 1163 if (unlikely(WARN_ON(free_slots(ring) < SLOTS_PER_PACKET))) { 1162 1164 /* If we get here, we have a real error with the queue 1163 1165 * full, but queues not stopped. */ 1164 1166 b43legacyerr(dev->wl, "DMA queue overflow\n"); 1165 - err = -ENOSPC; 1166 - goto out_unlock; 1167 + return -ENOSPC; 1167 1168 } 1168 1169 1169 1170 /* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing ··· 1171 1176 /* Drop this packet, as we don't have the encryption key 1172 1177 * anymore and must not transmit it unencrypted. */ 1173 1178 dev_kfree_skb_any(skb); 1174 - err = 0; 1175 - goto out_unlock; 1179 + return 0; 1176 1180 } 1177 1181 if (unlikely(err)) { 1178 1182 b43legacyerr(dev->wl, "DMA tx mapping failure\n"); 1179 - goto out_unlock; 1183 + return err; 1180 1184 } 1181 1185 if ((free_slots(ring) < SLOTS_PER_PACKET) || 1182 1186 should_inject_overflow(ring)) { 1183 1187 /* This TX ring is full. */ 1184 - ieee80211_stop_queue(dev->wl->hw, txring_to_priority(ring)); 1188 + unsigned int skb_mapping = skb_get_queue_mapping(skb); 1189 + ieee80211_stop_queue(dev->wl->hw, skb_mapping); 1190 + dev->wl->tx_queue_stopped[skb_mapping] = 1; 1185 1191 ring->stopped = true; 1186 1192 if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) 1187 1193 b43legacydbg(dev->wl, "Stopped TX ring %d\n", 1188 1194 ring->index); 1189 1195 } 1190 - out_unlock: 1191 - spin_unlock_irqrestore(&ring->lock, flags); 1192 - 1193 1196 return err; 1194 1197 } 1195 1198 ··· 1198 1205 struct b43legacy_dmadesc_meta *meta; 1199 1206 int retry_limit; 1200 1207 int slot; 1208 + int firstused; 1201 1209 1202 1210 ring = parse_cookie(dev, status->cookie, &slot); 1203 1211 if (unlikely(!ring)) 1204 1212 return; 1205 - B43legacy_WARN_ON(!irqs_disabled()); 1206 - spin_lock(&ring->lock); 1207 - 1208 1213 B43legacy_WARN_ON(!ring->tx); 1214 + 1215 + /* Sanity check: TX packets are processed in-order on one ring. 1216 + * Check if the slot deduced from the cookie really is the first 1217 + * used slot. */ 1218 + firstused = ring->current_slot - ring->used_slots + 1; 1219 + if (firstused < 0) 1220 + firstused = ring->nr_slots + firstused; 1221 + if (unlikely(slot != firstused)) { 1222 + /* This possibly is a firmware bug and will result in 1223 + * malfunction, memory leaks and/or stall of DMA functionality. 1224 + */ 1225 + b43legacydbg(dev->wl, "Out of order TX status report on DMA " 1226 + "ring %d. Expected %d, but got %d\n", 1227 + ring->index, firstused, slot); 1228 + return; 1229 + } 1230 + 1209 1231 while (1) { 1210 1232 B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); 1211 1233 op32_idx2desc(ring, slot, &meta); ··· 1293 1285 dev->stats.last_tx = jiffies; 1294 1286 if (ring->stopped) { 1295 1287 B43legacy_WARN_ON(free_slots(ring) < SLOTS_PER_PACKET); 1296 - ieee80211_wake_queue(dev->wl->hw, txring_to_priority(ring)); 1297 1288 ring->stopped = false; 1298 - if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) 1299 - b43legacydbg(dev->wl, "Woke up TX ring %d\n", 1300 - ring->index); 1301 1289 } 1302 1290 1303 - spin_unlock(&ring->lock); 1291 + if (dev->wl->tx_queue_stopped[ring->queue_prio]) { 1292 + dev->wl->tx_queue_stopped[ring->queue_prio] = 0; 1293 + } else { 1294 + /* If the driver queue is running wake the corresponding 1295 + * mac80211 queue. */ 1296 + ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); 1297 + if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) 1298 + b43legacydbg(dev->wl, "Woke up TX ring %d\n", 1299 + ring->index); 1300 + } 1301 + /* Add work to the queue. */ 1302 + ieee80211_queue_work(dev->wl->hw, &dev->wl->tx_work); 1304 1303 } 1305 1304 1306 1305 static void dma_rx(struct b43legacy_dmaring *ring, ··· 1430 1415 1431 1416 static void b43legacy_dma_tx_suspend_ring(struct b43legacy_dmaring *ring) 1432 1417 { 1433 - unsigned long flags; 1434 - 1435 - spin_lock_irqsave(&ring->lock, flags); 1436 1418 B43legacy_WARN_ON(!ring->tx); 1437 1419 op32_tx_suspend(ring); 1438 - spin_unlock_irqrestore(&ring->lock, flags); 1439 1420 } 1440 1421 1441 1422 static void b43legacy_dma_tx_resume_ring(struct b43legacy_dmaring *ring) 1442 1423 { 1443 - unsigned long flags; 1444 - 1445 - spin_lock_irqsave(&ring->lock, flags); 1446 1424 B43legacy_WARN_ON(!ring->tx); 1447 1425 op32_tx_resume(ring); 1448 - spin_unlock_irqrestore(&ring->lock, flags); 1449 1426 } 1450 1427 1451 1428 void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev)
+3 -2
drivers/net/wireless/b43legacy/dma.h
··· 150 150 enum b43legacy_dmatype type; 151 151 /* Boolean. Is this ring stopped at ieee80211 level? */ 152 152 bool stopped; 153 - /* Lock, only used for TX. */ 154 - spinlock_t lock; 153 + /* The QOS priority assigned to this ring. Only used for TX rings. 154 + * This is the mac80211 "queue" value. */ 155 + u8 queue_prio; 155 156 struct b43legacy_wldev *dev; 156 157 #ifdef CONFIG_B43LEGACY_DEBUG 157 158 /* Maximum number of used slots. */
+67 -19
drivers/net/wireless/b43legacy/main.c
··· 2440 2440 return err; 2441 2441 } 2442 2442 2443 + static void b43legacy_tx_work(struct work_struct *work) 2444 + { 2445 + struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl, 2446 + tx_work); 2447 + struct b43legacy_wldev *dev; 2448 + struct sk_buff *skb; 2449 + int queue_num; 2450 + int err = 0; 2451 + 2452 + mutex_lock(&wl->mutex); 2453 + dev = wl->current_dev; 2454 + if (unlikely(!dev || b43legacy_status(dev) < B43legacy_STAT_STARTED)) { 2455 + mutex_unlock(&wl->mutex); 2456 + return; 2457 + } 2458 + 2459 + for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { 2460 + while (skb_queue_len(&wl->tx_queue[queue_num])) { 2461 + skb = skb_dequeue(&wl->tx_queue[queue_num]); 2462 + if (b43legacy_using_pio(dev)) 2463 + err = b43legacy_pio_tx(dev, skb); 2464 + else 2465 + err = b43legacy_dma_tx(dev, skb); 2466 + if (err == -ENOSPC) { 2467 + wl->tx_queue_stopped[queue_num] = 1; 2468 + ieee80211_stop_queue(wl->hw, queue_num); 2469 + skb_queue_head(&wl->tx_queue[queue_num], skb); 2470 + break; 2471 + } 2472 + if (unlikely(err)) 2473 + dev_kfree_skb(skb); /* Drop it */ 2474 + err = 0; 2475 + } 2476 + 2477 + if (!err) 2478 + wl->tx_queue_stopped[queue_num] = 0; 2479 + } 2480 + 2481 + mutex_unlock(&wl->mutex); 2482 + } 2483 + 2443 2484 static void b43legacy_op_tx(struct ieee80211_hw *hw, 2444 2485 struct sk_buff *skb) 2445 2486 { 2446 2487 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 2447 - struct b43legacy_wldev *dev = wl->current_dev; 2448 - int err = -ENODEV; 2449 - unsigned long flags; 2450 2488 2451 - if (unlikely(!dev)) 2452 - goto out; 2453 - if (unlikely(b43legacy_status(dev) < B43legacy_STAT_STARTED)) 2454 - goto out; 2455 - /* DMA-TX is done without a global lock. */ 2456 - if (b43legacy_using_pio(dev)) { 2457 - spin_lock_irqsave(&wl->irq_lock, flags); 2458 - err = b43legacy_pio_tx(dev, skb); 2459 - spin_unlock_irqrestore(&wl->irq_lock, flags); 2460 - } else 2461 - err = b43legacy_dma_tx(dev, skb); 2462 - out: 2463 - if (unlikely(err)) { 2464 - /* Drop the packet. */ 2489 + if (unlikely(skb->len < 2 + 2 + 6)) { 2490 + /* Too short, this can't be a valid frame. */ 2465 2491 dev_kfree_skb_any(skb); 2492 + return; 2466 2493 } 2494 + B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags); 2495 + 2496 + skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); 2497 + if (!wl->tx_queue_stopped[skb->queue_mapping]) 2498 + ieee80211_queue_work(wl->hw, &wl->tx_work); 2499 + else 2500 + ieee80211_stop_queue(wl->hw, skb->queue_mapping); 2467 2501 } 2468 2502 2469 2503 static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, ··· 2913 2879 { 2914 2880 struct b43legacy_wl *wl = dev->wl; 2915 2881 unsigned long flags; 2882 + int queue_num; 2916 2883 2917 2884 if (b43legacy_status(dev) < B43legacy_STAT_STARTED) 2918 2885 return; ··· 2933 2898 /* Must unlock as it would otherwise deadlock. No races here. 2934 2899 * Cancel the possibly running self-rearming periodic work. */ 2935 2900 cancel_delayed_work_sync(&dev->periodic_work); 2901 + cancel_work_sync(&wl->tx_work); 2936 2902 mutex_lock(&wl->mutex); 2937 2903 2938 - ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */ 2904 + /* Drain all TX queues. */ 2905 + for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { 2906 + while (skb_queue_len(&wl->tx_queue[queue_num])) 2907 + dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num])); 2908 + } 2939 2909 2940 - b43legacy_mac_suspend(dev); 2910 + b43legacy_mac_suspend(dev); 2941 2911 free_irq(dev->dev->irq, dev); 2942 2912 b43legacydbg(wl, "Wireless interface stopped\n"); 2943 2913 } ··· 3788 3748 struct ieee80211_hw *hw; 3789 3749 struct b43legacy_wl *wl; 3790 3750 int err = -ENOMEM; 3751 + int queue_num; 3791 3752 3792 3753 b43legacy_sprom_fixup(dev->bus); 3793 3754 ··· 3823 3782 mutex_init(&wl->mutex); 3824 3783 INIT_LIST_HEAD(&wl->devlist); 3825 3784 INIT_WORK(&wl->beacon_update_trigger, b43legacy_beacon_update_trigger_work); 3785 + INIT_WORK(&wl->tx_work, b43legacy_tx_work); 3786 + 3787 + /* Initialize queues and flags. */ 3788 + for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { 3789 + skb_queue_head_init(&wl->tx_queue[queue_num]); 3790 + wl->tx_queue_stopped[queue_num] = 0; 3791 + } 3826 3792 3827 3793 ssb_set_devtypedata(dev, wl); 3828 3794 b43legacyinfo(wl, "Broadcom %04X WLAN found (core revision %u)\n",
-4
drivers/net/wireless/ipw2x00/libipw.h
··· 805 805 /* WEP and other encryption related settings at the device level */ 806 806 int open_wep; /* Set to 1 to allow unencrypted frames */ 807 807 808 - int reset_on_keychange; /* Set to 1 if the HW needs to be reset on 809 - * WEP key changes */ 810 - 811 808 /* If the host performs {en,de}cryption, then set to 1 */ 812 809 int host_encrypt; 813 810 int host_encrypt_msdu; ··· 857 860 struct libipw_security * sec); 858 861 netdev_tx_t (*hard_start_xmit) (struct libipw_txb * txb, 859 862 struct net_device * dev, int pri); 860 - int (*reset_port) (struct net_device * dev); 861 863 int (*is_queue_full) (struct net_device * dev, int pri); 862 864 863 865 int (*handle_management) (struct net_device * dev,
-25
drivers/net/wireless/ipw2x00/libipw_wx.c
··· 474 474 if (ieee->set_security) 475 475 ieee->set_security(dev, &sec); 476 476 477 - /* Do not reset port if card is in Managed mode since resetting will 478 - * generate new IEEE 802.11 authentication which may end up in looping 479 - * with IEEE 802.1X. If your hardware requires a reset after WEP 480 - * configuration (for example... Prism2), implement the reset_port in 481 - * the callbacks structures used to initialize the 802.11 stack. */ 482 - if (ieee->reset_on_keychange && 483 - ieee->iw_mode != IW_MODE_INFRA && 484 - ieee->reset_port && ieee->reset_port(dev)) { 485 - printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); 486 - return -EINVAL; 487 - } 488 477 return 0; 489 478 } 490 479 ··· 676 687 done: 677 688 if (ieee->set_security) 678 689 ieee->set_security(ieee->dev, &sec); 679 - 680 - /* 681 - * Do not reset port if card is in Managed mode since resetting will 682 - * generate new IEEE 802.11 authentication which may end up in looping 683 - * with IEEE 802.1X. If your hardware requires a reset after WEP 684 - * configuration (for example... Prism2), implement the reset_port in 685 - * the callbacks structures used to initialize the 802.11 stack. 686 - */ 687 - if (ieee->reset_on_keychange && 688 - ieee->iw_mode != IW_MODE_INFRA && 689 - ieee->reset_port && ieee->reset_port(dev)) { 690 - LIBIPW_DEBUG_WX("%s: reset_port failed\n", dev->name); 691 - return -EINVAL; 692 - } 693 690 694 691 return ret; 695 692 }
+5 -6
drivers/net/wireless/iwlegacy/3945-mac.c
··· 570 570 /* TODO need this for burst mode later on */ 571 571 il3945_build_tx_cmd_basic(il, out_cmd, info, hdr, sta_id); 572 572 573 - /* set is_hcca to 0; it probably will never be implemented */ 574 - il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id, 0); 573 + il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id); 575 574 576 575 /* Total # bytes to be transmitted */ 577 576 len = (u16) skb->len; ··· 2623 2624 } 2624 2625 2625 2626 /* 2626 - * If active scaning is requested but a certain channel 2627 - * is marked passive, we can do active scanning if we 2628 - * detect transmissions. 2627 + * If active scaning is requested but a certain channel is marked 2628 + * passive, we can do active scanning if we detect transmissions. For 2629 + * passive only scanning disable switching to active on any channel. 2629 2630 */ 2630 2631 scan->good_CRC_th = 2631 - is_active ? IL_GOOD_CRC_TH_DEFAULT : IL_GOOD_CRC_TH_DISABLED; 2632 + is_active ? IL_GOOD_CRC_TH_DEFAULT : IL_GOOD_CRC_TH_NEVER; 2632 2633 2633 2634 len = 2634 2635 il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data,
+11 -20
drivers/net/wireless/iwlegacy/3945-rs.c
··· 86 86 {-92, RATE_1M_IDX} 87 87 }; 88 88 89 - #define RATE_MAX_WINDOW 62 89 + #define RATE_MAX_WINDOW 62 90 90 #define RATE_FLUSH (3*HZ) 91 - #define RATE_WIN_FLUSH (HZ/2) 92 - #define IL39_RATE_HIGH_TH 11520 93 - #define IL_SUCCESS_UP_TH 8960 94 - #define IL_SUCCESS_DOWN_TH 10880 95 - #define RATE_MIN_FAILURE_TH 6 96 - #define RATE_MIN_SUCCESS_TH 8 97 - #define RATE_DECREASE_TH 1920 98 - #define RATE_RETRY_TH 15 91 + #define RATE_WIN_FLUSH (HZ/2) 92 + #define IL39_RATE_HIGH_TH 11520 93 + #define IL_SUCCESS_UP_TH 8960 94 + #define IL_SUCCESS_DOWN_TH 10880 95 + #define RATE_MIN_FAILURE_TH 6 96 + #define RATE_MIN_SUCCESS_TH 8 97 + #define RATE_DECREASE_TH 1920 98 + #define RATE_RETRY_TH 15 99 99 100 100 static u8 101 101 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) ··· 112 112 tpt_table = il3945_tpt_table_g; 113 113 table_size = ARRAY_SIZE(il3945_tpt_table_g); 114 114 break; 115 - 116 115 case IEEE80211_BAND_5GHZ: 117 116 tpt_table = il3945_tpt_table_a; 118 117 table_size = ARRAY_SIZE(il3945_tpt_table_a); 119 118 break; 120 - 121 119 default: 122 120 BUG(); 123 121 break; ··· 124 126 while (idx < table_size && rssi < tpt_table[idx].min_rssi) 125 127 idx++; 126 128 127 - idx = min(idx, (table_size - 1)); 129 + idx = min(idx, table_size - 1); 128 130 129 131 return tpt_table[idx].idx; 130 132 } ··· 326 328 win->stamp = jiffies; 327 329 328 330 spin_unlock_irqrestore(&rs_sta->lock, flags); 329 - 330 331 } 331 332 332 333 /* ··· 383 386 /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ 384 387 if (sband->band == IEEE80211_BAND_5GHZ) { 385 388 rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; 386 - il->_3945.sta_supp_rates = 387 - il->_3945.sta_supp_rates << IL_FIRST_OFDM_RATE; 389 + il->_3945.sta_supp_rates <<= IL_FIRST_OFDM_RATE; 388 390 } 389 391 390 392 out: ··· 402 406 static void 403 407 il3945_rs_free(void *il) 404 408 { 405 - return; 406 409 } 407 410 408 411 static void * ··· 786 791 787 792 switch (scale_action) { 788 793 case -1: 789 - 790 794 /* Decrese rate */ 791 795 if (low != RATE_INVALID) 792 796 idx = low; 793 797 break; 794 - 795 798 case 1: 796 799 /* Increase rate */ 797 800 if (high != RATE_INVALID) 798 801 idx = high; 799 802 800 803 break; 801 - 802 804 case 0: 803 805 default: 804 806 /* No change */ ··· 950 958 } else 951 959 rs_sta->expected_tpt = il3945_expected_tpt_g; 952 960 break; 953 - 954 961 case IEEE80211_BAND_5GHZ: 955 962 rs_sta->expected_tpt = il3945_expected_tpt_a; 956 963 break;
+6 -14
drivers/net/wireless/iwlegacy/3945.c
··· 680 680 void 681 681 il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, 682 682 struct ieee80211_tx_info *info, 683 - struct ieee80211_hdr *hdr, int sta_id, int tx_id) 683 + struct ieee80211_hdr *hdr, int sta_id) 684 684 { 685 685 u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value; 686 - u16 rate_idx = min(hw_value & 0xffff, RATE_COUNT_3945); 686 + u16 rate_idx = min(hw_value & 0xffff, RATE_COUNT_3945 - 1); 687 687 u16 rate_mask; 688 688 int rate; 689 - u8 rts_retry_limit; 689 + const u8 rts_retry_limit = 7; 690 690 u8 data_retry_limit; 691 691 __le32 tx_flags; 692 692 __le16 fc = hdr->frame_control; ··· 705 705 else 706 706 data_retry_limit = IL_DEFAULT_TX_RETRY; 707 707 tx_cmd->data_retry_limit = data_retry_limit; 708 - 709 - if (tx_id >= IL39_CMD_QUEUE_NUM) 710 - rts_retry_limit = 3; 711 - else 712 - rts_retry_limit = 7; 713 - 714 - if (data_retry_limit < rts_retry_limit) 715 - rts_retry_limit = data_retry_limit; 716 - tx_cmd->rts_retry_limit = rts_retry_limit; 708 + /* Set retry limit on RTS packets */ 709 + tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit); 717 710 718 711 tx_cmd->rate = rate; 719 712 tx_cmd->tx_flags = tx_flags; ··· 2324 2331 for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) { 2325 2332 idx = il3945_rates[i].table_rs_idx; 2326 2333 2327 - table[idx].rate_n_flags = 2328 - il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); 2334 + table[idx].rate_n_flags = cpu_to_le16(il3945_rates[i].plcp); 2329 2335 table[idx].try_cnt = il->retry_rate; 2330 2336 prev_idx = il3945_get_prev_ieee_rate(i); 2331 2337 table[idx].next_rate_idx = il3945_rates[prev_idx].table_rs_idx;
+1 -20
drivers/net/wireless/iwlegacy/3945.h
··· 239 239 u8 rate); 240 240 void il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, 241 241 struct ieee80211_tx_info *info, 242 - struct ieee80211_hdr *hdr, int sta_id, 243 - int tx_id); 242 + struct ieee80211_hdr *hdr, int sta_id); 244 243 extern int il3945_hw_reg_send_txpower(struct il_priv *il); 245 244 extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); 246 245 extern void il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb); ··· 474 475 struct il3945_shared { 475 476 __le32 tx_base_ptr[8]; 476 477 } __packed; 477 - 478 - static inline u8 479 - il3945_hw_get_rate(__le16 rate_n_flags) 480 - { 481 - return le16_to_cpu(rate_n_flags) & 0xFF; 482 - } 483 - 484 - static inline u16 485 - il3945_hw_get_rate_n_flags(__le16 rate_n_flags) 486 - { 487 - return le16_to_cpu(rate_n_flags); 488 - } 489 - 490 - static inline __le16 491 - il3945_hw_set_rate_n_flags(u8 rate, u16 flags) 492 - { 493 - return cpu_to_le16((u16) rate | flags); 494 - } 495 478 496 479 /************************************/ 497 480 /* iwl3945 Flow Handler Definitions */
+25 -46
drivers/net/wireless/iwlegacy/4965-mac.c
··· 819 819 return added; 820 820 } 821 821 822 - static inline u32 823 - il4965_ant_idx_to_flags(u8 ant_idx) 822 + static void 823 + il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid) 824 824 { 825 - return BIT(ant_idx) << RATE_MCS_ANT_POS; 825 + int i; 826 + u8 ind = *ant; 827 + 828 + for (i = 0; i < RATE_ANT_NUM - 1; i++) { 829 + ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; 830 + if (valid & BIT(ind)) { 831 + *ant = ind; 832 + return; 833 + } 834 + } 826 835 } 827 836 828 837 int ··· 969 960 if (il->cfg->scan_rx_antennas[band]) 970 961 rx_ant = il->cfg->scan_rx_antennas[band]; 971 962 972 - il->scan_tx_ant[band] = 973 - il4965_toggle_tx_ant(il, il->scan_tx_ant[band], scan_tx_antennas); 974 - rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]); 975 - scan->tx_cmd.rate_n_flags = 976 - il4965_hw_set_rate_n_flags(rate, rate_flags); 963 + il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas); 964 + rate_flags |= BIT(il->scan_tx_ant[band]) << RATE_MCS_ANT_POS; 965 + scan->tx_cmd.rate_n_flags = cpu_to_le32(rate | rate_flags); 977 966 978 967 /* In power save mode use one chain, otherwise use all chains */ 979 968 if (test_bit(S_POWER_PMI, &il->status)) { ··· 1176 1169 1177 1170 WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || 1178 1171 active_rx_cnt < idle_rx_cnt); 1179 - } 1180 - 1181 - u8 1182 - il4965_toggle_tx_ant(struct il_priv *il, u8 ant, u8 valid) 1183 - { 1184 - int i; 1185 - u8 ind = ant; 1186 - 1187 - for (i = 0; i < RATE_ANT_NUM - 1; i++) { 1188 - ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; 1189 - if (valid & BIT(ind)) 1190 - return ind; 1191 - } 1192 - return ant; 1193 1172 } 1194 1173 1195 1174 static const char * ··· 1523 1530 tx_cmd->next_frame_len = 0; 1524 1531 } 1525 1532 1526 - #define RTS_DFAULT_RETRY_LIMIT 60 1527 - 1528 1533 static void 1529 1534 il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, 1530 1535 struct ieee80211_tx_info *info, __le16 fc) 1531 1536 { 1537 + const u8 rts_retry_limit = 60; 1532 1538 u32 rate_flags; 1533 1539 int rate_idx; 1534 - u8 rts_retry_limit; 1535 1540 u8 data_retry_limit; 1536 1541 u8 rate_plcp; 1537 1542 ··· 1539 1548 else 1540 1549 data_retry_limit = IL4965_DEFAULT_TX_RETRY; 1541 1550 tx_cmd->data_retry_limit = data_retry_limit; 1542 - 1543 1551 /* Set retry limit on RTS packets */ 1544 - rts_retry_limit = RTS_DFAULT_RETRY_LIMIT; 1545 - if (data_retry_limit < rts_retry_limit) 1546 - rts_retry_limit = data_retry_limit; 1547 - tx_cmd->rts_retry_limit = rts_retry_limit; 1552 + tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit); 1548 1553 1549 1554 /* DATA packets will use the uCode station table for rate/antenna 1550 1555 * selection */ ··· 1575 1588 rate_flags |= RATE_MCS_CCK_MSK; 1576 1589 1577 1590 /* Set up antennas */ 1578 - il->mgmt_tx_ant = 1579 - il4965_toggle_tx_ant(il, il->mgmt_tx_ant, 1580 - il->hw_params.valid_tx_ant); 1581 - 1582 - rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); 1591 + il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); 1592 + rate_flags |= BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS; 1583 1593 1584 1594 /* Set the rate in the TX cmd */ 1585 - tx_cmd->rate_n_flags = 1586 - il4965_hw_set_rate_n_flags(rate_plcp, rate_flags); 1595 + tx_cmd->rate_n_flags = cpu_to_le32(rate_plcp | rate_flags); 1587 1596 } 1588 1597 1589 1598 static void ··· 2739 2756 rate_flags |= 2740 2757 il4965_first_antenna(il->hw_params. 2741 2758 valid_tx_ant) << RATE_MCS_ANT_POS; 2742 - rate_n_flags = il4965_hw_set_rate_n_flags(il_rates[r].plcp, rate_flags); 2759 + rate_n_flags = cpu_to_le32(il_rates[r].plcp | rate_flags); 2743 2760 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 2744 2761 link_cmd->rs_table[i].rate_n_flags = rate_n_flags; 2745 2762 ··· 3523 3540 3524 3541 /* Set up packet rate and flags */ 3525 3542 rate = il_get_lowest_plcp(il, il->beacon_ctx); 3526 - il->mgmt_tx_ant = 3527 - il4965_toggle_tx_ant(il, il->mgmt_tx_ant, 3528 - il->hw_params.valid_tx_ant); 3529 - rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); 3543 + il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); 3544 + rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS; 3530 3545 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) 3531 3546 rate_flags |= RATE_MCS_CCK_MSK; 3532 - tx_beacon_cmd->tx.rate_n_flags = 3533 - il4965_hw_set_rate_n_flags(rate, rate_flags); 3547 + tx_beacon_cmd->tx.rate_n_flags = cpu_to_le32(rate | rate_flags); 3534 3548 3535 3549 return sizeof(*tx_beacon_cmd) + frame_size; 3536 3550 } ··· 3780 3800 #ifdef CONFIG_IWLEGACY_DEBUG 3781 3801 u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 3782 3802 3783 - D_RX("beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", 3803 + D_RX("beacon status %x retries %d iss %d tsf:0x%.8x%.8x rate %d\n", 3784 3804 le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, 3785 3805 beacon->beacon_notify_hdr.failure_frame, 3786 3806 le32_to_cpu(beacon->ibss_mgr_status), 3787 3807 le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); 3788 3808 #endif 3789 - 3790 3809 il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); 3791 3810 } 3792 3811
-19
drivers/net/wireless/iwlegacy/4965.c
··· 2114 2114 spin_unlock_irqrestore(&il->sta_lock, flags); 2115 2115 } 2116 2116 2117 - static void 2118 - il4965_hdl_beacon(struct il_priv *il, struct il_rx_buf *rxb) 2119 - { 2120 - struct il_rx_pkt *pkt = rxb_addr(rxb); 2121 - struct il4965_beacon_notif *beacon = (void *)pkt->u.raw; 2122 - u8 rate __maybe_unused = 2123 - il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 2124 - 2125 - D_RX("beacon status %#x, retries:%d ibssmgr:%d " 2126 - "tsf:0x%.8x%.8x rate:%d\n", 2127 - le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, 2128 - beacon->beacon_notify_hdr.failure_frame, 2129 - le32_to_cpu(beacon->ibss_mgr_status), 2130 - le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); 2131 - 2132 - il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); 2133 - } 2134 - 2135 2117 /* Set up 4965-specific Rx frame reply handlers */ 2136 2118 static void 2137 2119 il4965_handler_setup(struct il_priv *il) ··· 2122 2140 il->handlers[N_RX] = il4965_hdl_rx; 2123 2141 /* Tx response */ 2124 2142 il->handlers[C_TX] = il4965_hdl_tx; 2125 - il->handlers[N_BEACON] = il4965_hdl_beacon; 2126 2143 } 2127 2144 2128 2145 static struct il_hcmd_ops il4965_hcmd = {
-8
drivers/net/wireless/iwlegacy/4965.h
··· 107 107 void il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq, 108 108 int tx_fifo_id, int scd_retry); 109 109 110 - u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid); 111 - 112 110 /* rx */ 113 111 void il4965_hdl_missed_beacon(struct il_priv *il, struct il_rx_buf *rxb); 114 112 bool il4965_good_plcp_health(struct il_priv *il, struct il_rx_pkt *pkt); ··· 165 167 il4965_hw_get_rate(__le32 rate_n_flags) 166 168 { 167 169 return le32_to_cpu(rate_n_flags) & 0xFF; 168 - } 169 - 170 - static inline __le32 171 - il4965_hw_set_rate_n_flags(u8 rate, u32 flags) 172 - { 173 - return cpu_to_le32(flags | (u32) rate); 174 170 } 175 171 176 172 /* eeprom */
+161
drivers/net/wireless/iwlegacy/common.c
··· 42 42 43 43 #include "common.h" 44 44 45 + int 46 + _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout) 47 + { 48 + const int interval = 10; /* microseconds */ 49 + int t = 0; 50 + 51 + do { 52 + if ((_il_rd(il, addr) & mask) == (bits & mask)) 53 + return t; 54 + udelay(interval); 55 + t += interval; 56 + } while (t < timeout); 57 + 58 + return -ETIMEDOUT; 59 + } 60 + EXPORT_SYMBOL(_il_poll_bit); 61 + 62 + void 63 + il_set_bit(struct il_priv *p, u32 r, u32 m) 64 + { 65 + unsigned long reg_flags; 66 + 67 + spin_lock_irqsave(&p->reg_lock, reg_flags); 68 + _il_set_bit(p, r, m); 69 + spin_unlock_irqrestore(&p->reg_lock, reg_flags); 70 + } 71 + EXPORT_SYMBOL(il_set_bit); 72 + 73 + void 74 + il_clear_bit(struct il_priv *p, u32 r, u32 m) 75 + { 76 + unsigned long reg_flags; 77 + 78 + spin_lock_irqsave(&p->reg_lock, reg_flags); 79 + _il_clear_bit(p, r, m); 80 + spin_unlock_irqrestore(&p->reg_lock, reg_flags); 81 + } 82 + EXPORT_SYMBOL(il_clear_bit); 83 + 84 + int 85 + _il_grab_nic_access(struct il_priv *il) 86 + { 87 + int ret; 88 + u32 val; 89 + 90 + /* this bit wakes up the NIC */ 91 + _il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 92 + 93 + /* 94 + * These bits say the device is running, and should keep running for 95 + * at least a short while (at least as long as MAC_ACCESS_REQ stays 1), 96 + * but they do not indicate that embedded SRAM is restored yet; 97 + * 3945 and 4965 have volatile SRAM, and must save/restore contents 98 + * to/from host DRAM when sleeping/waking for power-saving. 99 + * Each direction takes approximately 1/4 millisecond; with this 100 + * overhead, it's a good idea to grab and hold MAC_ACCESS_REQUEST if a 101 + * series of register accesses are expected (e.g. reading Event Log), 102 + * to keep device from sleeping. 103 + * 104 + * CSR_UCODE_DRV_GP1 register bit MAC_SLEEP == 0 indicates that 105 + * SRAM is okay/restored. We don't check that here because this call 106 + * is just for hardware register access; but GP1 MAC_SLEEP check is a 107 + * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). 108 + * 109 + */ 110 + ret = 111 + _il_poll_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, 112 + (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 113 + CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); 114 + if (ret < 0) { 115 + val = _il_rd(il, CSR_GP_CNTRL); 116 + IL_ERR("MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); 117 + _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); 118 + return -EIO; 119 + } 120 + 121 + return 0; 122 + } 123 + EXPORT_SYMBOL_GPL(_il_grab_nic_access); 124 + 125 + int 126 + il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout) 127 + { 128 + const int interval = 10; /* microseconds */ 129 + int t = 0; 130 + 131 + do { 132 + if ((il_rd(il, addr) & mask) == mask) 133 + return t; 134 + udelay(interval); 135 + t += interval; 136 + } while (t < timeout); 137 + 138 + return -ETIMEDOUT; 139 + } 140 + EXPORT_SYMBOL(il_poll_bit); 141 + 142 + u32 143 + il_rd_prph(struct il_priv *il, u32 reg) 144 + { 145 + unsigned long reg_flags; 146 + u32 val; 147 + 148 + spin_lock_irqsave(&il->reg_lock, reg_flags); 149 + _il_grab_nic_access(il); 150 + val = _il_rd_prph(il, reg); 151 + _il_release_nic_access(il); 152 + spin_unlock_irqrestore(&il->reg_lock, reg_flags); 153 + return val; 154 + } 155 + EXPORT_SYMBOL(il_rd_prph); 156 + 157 + void 158 + il_wr_prph(struct il_priv *il, u32 addr, u32 val) 159 + { 160 + unsigned long reg_flags; 161 + 162 + spin_lock_irqsave(&il->reg_lock, reg_flags); 163 + if (!_il_grab_nic_access(il)) { 164 + _il_wr_prph(il, addr, val); 165 + _il_release_nic_access(il); 166 + } 167 + spin_unlock_irqrestore(&il->reg_lock, reg_flags); 168 + } 169 + EXPORT_SYMBOL(il_wr_prph); 170 + 171 + u32 172 + il_read_targ_mem(struct il_priv *il, u32 addr) 173 + { 174 + unsigned long reg_flags; 175 + u32 value; 176 + 177 + spin_lock_irqsave(&il->reg_lock, reg_flags); 178 + _il_grab_nic_access(il); 179 + 180 + _il_wr(il, HBUS_TARG_MEM_RADDR, addr); 181 + rmb(); 182 + value = _il_rd(il, HBUS_TARG_MEM_RDAT); 183 + 184 + _il_release_nic_access(il); 185 + spin_unlock_irqrestore(&il->reg_lock, reg_flags); 186 + return value; 187 + } 188 + EXPORT_SYMBOL(il_read_targ_mem); 189 + 190 + void 191 + il_write_targ_mem(struct il_priv *il, u32 addr, u32 val) 192 + { 193 + unsigned long reg_flags; 194 + 195 + spin_lock_irqsave(&il->reg_lock, reg_flags); 196 + if (!_il_grab_nic_access(il)) { 197 + _il_wr(il, HBUS_TARG_MEM_WADDR, addr); 198 + wmb(); 199 + _il_wr(il, HBUS_TARG_MEM_WDAT, val); 200 + _il_release_nic_access(il); 201 + } 202 + spin_unlock_irqrestore(&il->reg_lock, reg_flags); 203 + } 204 + EXPORT_SYMBOL(il_write_targ_mem); 205 + 45 206 const char * 46 207 il_get_cmd_string(u8 cmd) 47 208 {
+14 -192
drivers/net/wireless/iwlegacy/common.h
··· 31 31 #include <linux/kernel.h> 32 32 #include <linux/leds.h> 33 33 #include <linux/wait.h> 34 + #include <linux/io.h> 34 35 #include <net/mac80211.h> 35 36 #include <net/ieee80211_radiotap.h> 36 37 ··· 2164 2163 2165 2164 irqreturn_t il_isr(int irq, void *data); 2166 2165 2167 - #include <linux/io.h> 2166 + extern void il_set_bit(struct il_priv *p, u32 r, u32 m); 2167 + extern void il_clear_bit(struct il_priv *p, u32 r, u32 m); 2168 + extern int _il_grab_nic_access(struct il_priv *il); 2169 + extern int _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout); 2170 + extern int il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout); 2171 + extern u32 il_rd_prph(struct il_priv *il, u32 reg); 2172 + extern void il_wr_prph(struct il_priv *il, u32 addr, u32 val); 2173 + extern u32 il_read_targ_mem(struct il_priv *il, u32 addr); 2174 + extern void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val); 2168 2175 2169 2176 static inline void 2170 2177 _il_write8(struct il_priv *il, u32 ofs, u8 val) ··· 2193 2184 return ioread32(il->hw_base + ofs); 2194 2185 } 2195 2186 2196 - #define IL_POLL_INTERVAL 10 /* microseconds */ 2197 - static inline int 2198 - _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout) 2199 - { 2200 - int t = 0; 2201 - 2202 - do { 2203 - if ((_il_rd(il, addr) & mask) == (bits & mask)) 2204 - return t; 2205 - udelay(IL_POLL_INTERVAL); 2206 - t += IL_POLL_INTERVAL; 2207 - } while (t < timeout); 2208 - 2209 - return -ETIMEDOUT; 2210 - } 2211 - 2212 - static inline void 2213 - _il_set_bit(struct il_priv *il, u32 reg, u32 mask) 2214 - { 2215 - _il_wr(il, reg, _il_rd(il, reg) | mask); 2216 - } 2217 - 2218 - static inline void 2219 - il_set_bit(struct il_priv *p, u32 r, u32 m) 2220 - { 2221 - unsigned long reg_flags; 2222 - 2223 - spin_lock_irqsave(&p->reg_lock, reg_flags); 2224 - _il_set_bit(p, r, m); 2225 - spin_unlock_irqrestore(&p->reg_lock, reg_flags); 2226 - } 2227 - 2228 2187 static inline void 2229 2188 _il_clear_bit(struct il_priv *il, u32 reg, u32 mask) 2230 2189 { ··· 2200 2223 } 2201 2224 2202 2225 static inline void 2203 - il_clear_bit(struct il_priv *p, u32 r, u32 m) 2226 + _il_set_bit(struct il_priv *il, u32 reg, u32 mask) 2204 2227 { 2205 - unsigned long reg_flags; 2206 - 2207 - spin_lock_irqsave(&p->reg_lock, reg_flags); 2208 - _il_clear_bit(p, r, m); 2209 - spin_unlock_irqrestore(&p->reg_lock, reg_flags); 2210 - } 2211 - 2212 - static inline int 2213 - _il_grab_nic_access(struct il_priv *il) 2214 - { 2215 - int ret; 2216 - u32 val; 2217 - 2218 - /* this bit wakes up the NIC */ 2219 - _il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 2220 - 2221 - /* 2222 - * These bits say the device is running, and should keep running for 2223 - * at least a short while (at least as long as MAC_ACCESS_REQ stays 1), 2224 - * but they do not indicate that embedded SRAM is restored yet; 2225 - * 3945 and 4965 have volatile SRAM, and must save/restore contents 2226 - * to/from host DRAM when sleeping/waking for power-saving. 2227 - * Each direction takes approximately 1/4 millisecond; with this 2228 - * overhead, it's a good idea to grab and hold MAC_ACCESS_REQUEST if a 2229 - * series of register accesses are expected (e.g. reading Event Log), 2230 - * to keep device from sleeping. 2231 - * 2232 - * CSR_UCODE_DRV_GP1 register bit MAC_SLEEP == 0 indicates that 2233 - * SRAM is okay/restored. We don't check that here because this call 2234 - * is just for hardware register access; but GP1 MAC_SLEEP check is a 2235 - * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). 2236 - * 2237 - */ 2238 - ret = 2239 - _il_poll_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, 2240 - (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 2241 - CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); 2242 - if (ret < 0) { 2243 - val = _il_rd(il, CSR_GP_CNTRL); 2244 - IL_ERR("MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); 2245 - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); 2246 - return -EIO; 2247 - } 2248 - 2249 - return 0; 2228 + _il_wr(il, reg, _il_rd(il, reg) | mask); 2250 2229 } 2251 2230 2252 2231 static inline void ··· 2223 2290 _il_release_nic_access(il); 2224 2291 spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2225 2292 return value; 2226 - 2227 2293 } 2228 2294 2229 2295 static inline void ··· 2238 2306 spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2239 2307 } 2240 2308 2241 - static inline void 2242 - il_write_reg_buf(struct il_priv *il, u32 reg, u32 len, u32 * values) 2243 - { 2244 - u32 count = sizeof(u32); 2245 - 2246 - if (il != NULL && values != NULL) { 2247 - for (; 0 < len; len -= count, reg += count, values++) 2248 - il_wr(il, reg, *values); 2249 - } 2250 - } 2251 - 2252 - static inline int 2253 - il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout) 2254 - { 2255 - int t = 0; 2256 - 2257 - do { 2258 - if ((il_rd(il, addr) & mask) == mask) 2259 - return t; 2260 - udelay(IL_POLL_INTERVAL); 2261 - t += IL_POLL_INTERVAL; 2262 - } while (t < timeout); 2263 - 2264 - return -ETIMEDOUT; 2265 - } 2266 - 2267 2309 static inline u32 2268 2310 _il_rd_prph(struct il_priv *il, u32 reg) 2269 2311 { 2270 2312 _il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 2271 2313 rmb(); 2272 2314 return _il_rd(il, HBUS_TARG_PRPH_RDAT); 2273 - } 2274 - 2275 - static inline u32 2276 - il_rd_prph(struct il_priv *il, u32 reg) 2277 - { 2278 - unsigned long reg_flags; 2279 - u32 val; 2280 - 2281 - spin_lock_irqsave(&il->reg_lock, reg_flags); 2282 - _il_grab_nic_access(il); 2283 - val = _il_rd_prph(il, reg); 2284 - _il_release_nic_access(il); 2285 - spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2286 - return val; 2287 2315 } 2288 2316 2289 2317 static inline void ··· 2255 2363 } 2256 2364 2257 2365 static inline void 2258 - il_wr_prph(struct il_priv *il, u32 addr, u32 val) 2259 - { 2260 - unsigned long reg_flags; 2261 - 2262 - spin_lock_irqsave(&il->reg_lock, reg_flags); 2263 - if (!_il_grab_nic_access(il)) { 2264 - _il_wr_prph(il, addr, val); 2265 - _il_release_nic_access(il); 2266 - } 2267 - spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2268 - } 2269 - 2270 - #define _il_set_bits_prph(il, reg, mask) \ 2271 - _il_wr_prph(il, reg, (_il_rd_prph(il, reg) | mask)) 2272 - 2273 - static inline void 2274 2366 il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask) 2275 2367 { 2276 2368 unsigned long reg_flags; 2277 2369 2278 2370 spin_lock_irqsave(&il->reg_lock, reg_flags); 2279 2371 _il_grab_nic_access(il); 2280 - _il_set_bits_prph(il, reg, mask); 2372 + _il_wr_prph(il, reg, (_il_rd_prph(il, reg) | mask)); 2281 2373 _il_release_nic_access(il); 2282 2374 spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2283 2375 } 2284 - 2285 - #define _il_set_bits_mask_prph(il, reg, bits, mask) \ 2286 - _il_wr_prph(il, reg, \ 2287 - ((_il_rd_prph(il, reg) & mask) | bits)) 2288 2376 2289 2377 static inline void 2290 2378 il_set_bits_mask_prph(struct il_priv *il, u32 reg, u32 bits, u32 mask) ··· 2273 2401 2274 2402 spin_lock_irqsave(&il->reg_lock, reg_flags); 2275 2403 _il_grab_nic_access(il); 2276 - _il_set_bits_mask_prph(il, reg, bits, mask); 2404 + _il_wr_prph(il, reg, ((_il_rd_prph(il, reg) & mask) | bits)); 2277 2405 _il_release_nic_access(il); 2278 2406 spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2279 2407 } ··· 2289 2417 val = _il_rd_prph(il, reg); 2290 2418 _il_wr_prph(il, reg, (val & ~mask)); 2291 2419 _il_release_nic_access(il); 2292 - spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2293 - } 2294 - 2295 - static inline u32 2296 - il_read_targ_mem(struct il_priv *il, u32 addr) 2297 - { 2298 - unsigned long reg_flags; 2299 - u32 value; 2300 - 2301 - spin_lock_irqsave(&il->reg_lock, reg_flags); 2302 - _il_grab_nic_access(il); 2303 - 2304 - _il_wr(il, HBUS_TARG_MEM_RADDR, addr); 2305 - rmb(); 2306 - value = _il_rd(il, HBUS_TARG_MEM_RDAT); 2307 - 2308 - _il_release_nic_access(il); 2309 - spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2310 - return value; 2311 - } 2312 - 2313 - static inline void 2314 - il_write_targ_mem(struct il_priv *il, u32 addr, u32 val) 2315 - { 2316 - unsigned long reg_flags; 2317 - 2318 - spin_lock_irqsave(&il->reg_lock, reg_flags); 2319 - if (!_il_grab_nic_access(il)) { 2320 - _il_wr(il, HBUS_TARG_MEM_WADDR, addr); 2321 - wmb(); 2322 - _il_wr(il, HBUS_TARG_MEM_WDAT, val); 2323 - _il_release_nic_access(il); 2324 - } 2325 - spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2326 - } 2327 - 2328 - static inline void 2329 - il_write_targ_mem_buf(struct il_priv *il, u32 addr, u32 len, u32 * values) 2330 - { 2331 - unsigned long reg_flags; 2332 - 2333 - spin_lock_irqsave(&il->reg_lock, reg_flags); 2334 - if (!_il_grab_nic_access(il)) { 2335 - _il_wr(il, HBUS_TARG_MEM_WADDR, addr); 2336 - wmb(); 2337 - for (; 0 < len; len -= sizeof(u32), values++) 2338 - _il_wr(il, HBUS_TARG_MEM_WDAT, *values); 2339 - 2340 - _il_release_nic_access(il); 2341 - } 2342 2420 spin_unlock_irqrestore(&il->reg_lock, reg_flags); 2343 2421 } 2344 2422
-817
drivers/net/wireless/iwlegacy/iwl-sta.c
··· 1 - /****************************************************************************** 2 - * 3 - * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 4 - * 5 - * Portions of this file are derived from the ipw3945 project, as well 6 - * as portions of the ieee80211 subsystem header files. 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of version 2 of the GNU General Public License as 10 - * published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, but WITHOUT 13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 - * more details. 16 - * 17 - * You should have received a copy of the GNU General Public License along with 18 - * this program; if not, write to the Free Software Foundation, Inc., 19 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 20 - * 21 - * The full GNU General Public License is included in this distribution in the 22 - * file called LICENSE. 23 - * 24 - * Contact Information: 25 - * Intel Linux Wireless <ilw@linux.intel.com> 26 - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 27 - * 28 - *****************************************************************************/ 29 - 30 - #include <net/mac80211.h> 31 - #include <linux/etherdevice.h> 32 - #include <linux/sched.h> 33 - #include <linux/lockdep.h> 34 - #include <linux/export.h> 35 - 36 - #include "iwl-dev.h" 37 - #include "iwl-core.h" 38 - #include "iwl-sta.h" 39 - 40 - /* il->sta_lock must be held */ 41 - static void il_sta_ucode_activate(struct il_priv *il, u8 sta_id) 42 - { 43 - 44 - if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) 45 - IL_ERR( 46 - "ACTIVATE a non DRIVER active station id %u addr %pM\n", 47 - sta_id, il->stations[sta_id].sta.sta.addr); 48 - 49 - if (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) { 50 - D_ASSOC( 51 - "STA id %u addr %pM already present" 52 - " in uCode (according to driver)\n", 53 - sta_id, il->stations[sta_id].sta.sta.addr); 54 - } else { 55 - il->stations[sta_id].used |= IL_STA_UCODE_ACTIVE; 56 - D_ASSOC("Added STA id %u addr %pM to uCode\n", 57 - sta_id, il->stations[sta_id].sta.sta.addr); 58 - } 59 - } 60 - 61 - static int il_process_add_sta_resp(struct il_priv *il, 62 - struct il_addsta_cmd *addsta, 63 - struct il_rx_pkt *pkt, 64 - bool sync) 65 - { 66 - u8 sta_id = addsta->sta.sta_id; 67 - unsigned long flags; 68 - int ret = -EIO; 69 - 70 - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { 71 - IL_ERR("Bad return from C_ADD_STA (0x%08X)\n", 72 - pkt->hdr.flags); 73 - return ret; 74 - } 75 - 76 - D_INFO("Processing response for adding station %u\n", 77 - sta_id); 78 - 79 - spin_lock_irqsave(&il->sta_lock, flags); 80 - 81 - switch (pkt->u.add_sta.status) { 82 - case ADD_STA_SUCCESS_MSK: 83 - D_INFO("C_ADD_STA PASSED\n"); 84 - il_sta_ucode_activate(il, sta_id); 85 - ret = 0; 86 - break; 87 - case ADD_STA_NO_ROOM_IN_TBL: 88 - IL_ERR("Adding station %d failed, no room in table.\n", 89 - sta_id); 90 - break; 91 - case ADD_STA_NO_BLOCK_ACK_RESOURCE: 92 - IL_ERR( 93 - "Adding station %d failed, no block ack resource.\n", 94 - sta_id); 95 - break; 96 - case ADD_STA_MODIFY_NON_EXIST_STA: 97 - IL_ERR("Attempting to modify non-existing station %d\n", 98 - sta_id); 99 - break; 100 - default: 101 - D_ASSOC("Received C_ADD_STA:(0x%08X)\n", 102 - pkt->u.add_sta.status); 103 - break; 104 - } 105 - 106 - D_INFO("%s station id %u addr %pM\n", 107 - il->stations[sta_id].sta.mode == 108 - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 109 - sta_id, il->stations[sta_id].sta.sta.addr); 110 - 111 - /* 112 - * XXX: The MAC address in the command buffer is often changed from 113 - * the original sent to the device. That is, the MAC address 114 - * written to the command buffer often is not the same MAC address 115 - * read from the command buffer when the command returns. This 116 - * issue has not yet been resolved and this debugging is left to 117 - * observe the problem. 118 - */ 119 - D_INFO("%s station according to cmd buffer %pM\n", 120 - il->stations[sta_id].sta.mode == 121 - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 122 - addsta->sta.addr); 123 - spin_unlock_irqrestore(&il->sta_lock, flags); 124 - 125 - return ret; 126 - } 127 - 128 - static void il_add_sta_callback(struct il_priv *il, 129 - struct il_device_cmd *cmd, 130 - struct il_rx_pkt *pkt) 131 - { 132 - struct il_addsta_cmd *addsta = 133 - (struct il_addsta_cmd *)cmd->cmd.payload; 134 - 135 - il_process_add_sta_resp(il, addsta, pkt, false); 136 - 137 - } 138 - 139 - int il_send_add_sta(struct il_priv *il, 140 - struct il_addsta_cmd *sta, u8 flags) 141 - { 142 - struct il_rx_pkt *pkt = NULL; 143 - int ret = 0; 144 - u8 data[sizeof(*sta)]; 145 - struct il_host_cmd cmd = { 146 - .id = C_ADD_STA, 147 - .flags = flags, 148 - .data = data, 149 - }; 150 - u8 sta_id __maybe_unused = sta->sta.sta_id; 151 - 152 - D_INFO("Adding sta %u (%pM) %ssynchronously\n", 153 - sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); 154 - 155 - if (flags & CMD_ASYNC) 156 - cmd.callback = il_add_sta_callback; 157 - else { 158 - cmd.flags |= CMD_WANT_SKB; 159 - might_sleep(); 160 - } 161 - 162 - cmd.len = il->cfg->ops->utils->build_addsta_hcmd(sta, data); 163 - ret = il_send_cmd(il, &cmd); 164 - 165 - if (ret || (flags & CMD_ASYNC)) 166 - return ret; 167 - 168 - if (ret == 0) { 169 - pkt = (struct il_rx_pkt *)cmd.reply_page; 170 - ret = il_process_add_sta_resp(il, sta, pkt, true); 171 - } 172 - il_free_pages(il, cmd.reply_page); 173 - 174 - return ret; 175 - } 176 - EXPORT_SYMBOL(il_send_add_sta); 177 - 178 - static void il_set_ht_add_station(struct il_priv *il, u8 idx, 179 - struct ieee80211_sta *sta, 180 - struct il_rxon_context *ctx) 181 - { 182 - struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; 183 - __le32 sta_flags; 184 - u8 mimo_ps_mode; 185 - 186 - if (!sta || !sta_ht_inf->ht_supported) 187 - goto done; 188 - 189 - mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; 190 - D_ASSOC("spatial multiplexing power save mode: %s\n", 191 - (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ? 192 - "static" : 193 - (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ? 194 - "dynamic" : "disabled"); 195 - 196 - sta_flags = il->stations[idx].sta.station_flags; 197 - 198 - sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); 199 - 200 - switch (mimo_ps_mode) { 201 - case WLAN_HT_CAP_SM_PS_STATIC: 202 - sta_flags |= STA_FLG_MIMO_DIS_MSK; 203 - break; 204 - case WLAN_HT_CAP_SM_PS_DYNAMIC: 205 - sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; 206 - break; 207 - case WLAN_HT_CAP_SM_PS_DISABLED: 208 - break; 209 - default: 210 - IL_WARN("Invalid MIMO PS mode %d\n", mimo_ps_mode); 211 - break; 212 - } 213 - 214 - sta_flags |= cpu_to_le32( 215 - (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); 216 - 217 - sta_flags |= cpu_to_le32( 218 - (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); 219 - 220 - if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 221 - sta_flags |= STA_FLG_HT40_EN_MSK; 222 - else 223 - sta_flags &= ~STA_FLG_HT40_EN_MSK; 224 - 225 - il->stations[idx].sta.station_flags = sta_flags; 226 - done: 227 - return; 228 - } 229 - 230 - /** 231 - * il_prep_station - Prepare station information for addition 232 - * 233 - * should be called with sta_lock held 234 - */ 235 - u8 il_prep_station(struct il_priv *il, struct il_rxon_context *ctx, 236 - const u8 *addr, bool is_ap, struct ieee80211_sta *sta) 237 - { 238 - struct il_station_entry *station; 239 - int i; 240 - u8 sta_id = IL_INVALID_STATION; 241 - u16 rate; 242 - 243 - if (is_ap) 244 - sta_id = ctx->ap_sta_id; 245 - else if (is_broadcast_ether_addr(addr)) 246 - sta_id = ctx->bcast_sta_id; 247 - else 248 - for (i = IL_STA_ID; i < il->hw_params.max_stations; i++) { 249 - if (!compare_ether_addr(il->stations[i].sta.sta.addr, 250 - addr)) { 251 - sta_id = i; 252 - break; 253 - } 254 - 255 - if (!il->stations[i].used && 256 - sta_id == IL_INVALID_STATION) 257 - sta_id = i; 258 - } 259 - 260 - /* 261 - * These two conditions have the same outcome, but keep them 262 - * separate 263 - */ 264 - if (unlikely(sta_id == IL_INVALID_STATION)) 265 - return sta_id; 266 - 267 - /* 268 - * uCode is not able to deal with multiple requests to add a 269 - * station. Keep track if one is in progress so that we do not send 270 - * another. 271 - */ 272 - if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { 273 - D_INFO( 274 - "STA %d already in process of being added.\n", 275 - sta_id); 276 - return sta_id; 277 - } 278 - 279 - if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && 280 - (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) && 281 - !compare_ether_addr(il->stations[sta_id].sta.sta.addr, addr)) { 282 - D_ASSOC( 283 - "STA %d (%pM) already added, not adding again.\n", 284 - sta_id, addr); 285 - return sta_id; 286 - } 287 - 288 - station = &il->stations[sta_id]; 289 - station->used = IL_STA_DRIVER_ACTIVE; 290 - D_ASSOC("Add STA to driver ID %d: %pM\n", 291 - sta_id, addr); 292 - il->num_stations++; 293 - 294 - /* Set up the C_ADD_STA command to send to device */ 295 - memset(&station->sta, 0, sizeof(struct il_addsta_cmd)); 296 - memcpy(station->sta.sta.addr, addr, ETH_ALEN); 297 - station->sta.mode = 0; 298 - station->sta.sta.sta_id = sta_id; 299 - station->sta.station_flags = ctx->station_flags; 300 - station->ctxid = ctx->ctxid; 301 - 302 - if (sta) { 303 - struct il_station_priv_common *sta_priv; 304 - 305 - sta_priv = (void *)sta->drv_priv; 306 - sta_priv->ctx = ctx; 307 - } 308 - 309 - /* 310 - * OK to call unconditionally, since local stations (IBSS BSSID 311 - * STA and broadcast STA) pass in a NULL sta, and mac80211 312 - * doesn't allow HT IBSS. 313 - */ 314 - il_set_ht_add_station(il, sta_id, sta, ctx); 315 - 316 - /* 3945 only */ 317 - rate = (il->band == IEEE80211_BAND_5GHZ) ? 318 - RATE_6M_PLCP : RATE_1M_PLCP; 319 - /* Turn on both antennas for the station... */ 320 - station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); 321 - 322 - return sta_id; 323 - 324 - } 325 - EXPORT_SYMBOL_GPL(il_prep_station); 326 - 327 - #define STA_WAIT_TIMEOUT (HZ/2) 328 - 329 - /** 330 - * il_add_station_common - 331 - */ 332 - int 333 - il_add_station_common(struct il_priv *il, 334 - struct il_rxon_context *ctx, 335 - const u8 *addr, bool is_ap, 336 - struct ieee80211_sta *sta, u8 *sta_id_r) 337 - { 338 - unsigned long flags_spin; 339 - int ret = 0; 340 - u8 sta_id; 341 - struct il_addsta_cmd sta_cmd; 342 - 343 - *sta_id_r = 0; 344 - spin_lock_irqsave(&il->sta_lock, flags_spin); 345 - sta_id = il_prep_station(il, ctx, addr, is_ap, sta); 346 - if (sta_id == IL_INVALID_STATION) { 347 - IL_ERR("Unable to prepare station %pM for addition\n", 348 - addr); 349 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 350 - return -EINVAL; 351 - } 352 - 353 - /* 354 - * uCode is not able to deal with multiple requests to add a 355 - * station. Keep track if one is in progress so that we do not send 356 - * another. 357 - */ 358 - if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { 359 - D_INFO( 360 - "STA %d already in process of being added.\n", 361 - sta_id); 362 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 363 - return -EEXIST; 364 - } 365 - 366 - if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && 367 - (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { 368 - D_ASSOC( 369 - "STA %d (%pM) already added, not adding again.\n", 370 - sta_id, addr); 371 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 372 - return -EEXIST; 373 - } 374 - 375 - il->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS; 376 - memcpy(&sta_cmd, &il->stations[sta_id].sta, 377 - sizeof(struct il_addsta_cmd)); 378 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 379 - 380 - /* Add station to device's station table */ 381 - ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); 382 - if (ret) { 383 - spin_lock_irqsave(&il->sta_lock, flags_spin); 384 - IL_ERR("Adding station %pM failed.\n", 385 - il->stations[sta_id].sta.sta.addr); 386 - il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; 387 - il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; 388 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 389 - } 390 - *sta_id_r = sta_id; 391 - return ret; 392 - } 393 - EXPORT_SYMBOL(il_add_station_common); 394 - 395 - /** 396 - * il_sta_ucode_deactivate - deactivate ucode status for a station 397 - * 398 - * il->sta_lock must be held 399 - */ 400 - static void il_sta_ucode_deactivate(struct il_priv *il, u8 sta_id) 401 - { 402 - /* Ucode must be active and driver must be non active */ 403 - if ((il->stations[sta_id].used & 404 - (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) != 405 - IL_STA_UCODE_ACTIVE) 406 - IL_ERR("removed non active STA %u\n", sta_id); 407 - 408 - il->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE; 409 - 410 - memset(&il->stations[sta_id], 0, sizeof(struct il_station_entry)); 411 - D_ASSOC("Removed STA %u\n", sta_id); 412 - } 413 - 414 - static int il_send_remove_station(struct il_priv *il, 415 - const u8 *addr, int sta_id, 416 - bool temporary) 417 - { 418 - struct il_rx_pkt *pkt; 419 - int ret; 420 - 421 - unsigned long flags_spin; 422 - struct il_rem_sta_cmd rm_sta_cmd; 423 - 424 - struct il_host_cmd cmd = { 425 - .id = C_REM_STA, 426 - .len = sizeof(struct il_rem_sta_cmd), 427 - .flags = CMD_SYNC, 428 - .data = &rm_sta_cmd, 429 - }; 430 - 431 - memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd)); 432 - rm_sta_cmd.num_sta = 1; 433 - memcpy(&rm_sta_cmd.addr, addr, ETH_ALEN); 434 - 435 - cmd.flags |= CMD_WANT_SKB; 436 - 437 - ret = il_send_cmd(il, &cmd); 438 - 439 - if (ret) 440 - return ret; 441 - 442 - pkt = (struct il_rx_pkt *)cmd.reply_page; 443 - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { 444 - IL_ERR("Bad return from C_REM_STA (0x%08X)\n", 445 - pkt->hdr.flags); 446 - ret = -EIO; 447 - } 448 - 449 - if (!ret) { 450 - switch (pkt->u.rem_sta.status) { 451 - case REM_STA_SUCCESS_MSK: 452 - if (!temporary) { 453 - spin_lock_irqsave(&il->sta_lock, flags_spin); 454 - il_sta_ucode_deactivate(il, sta_id); 455 - spin_unlock_irqrestore(&il->sta_lock, 456 - flags_spin); 457 - } 458 - D_ASSOC("C_REM_STA PASSED\n"); 459 - break; 460 - default: 461 - ret = -EIO; 462 - IL_ERR("C_REM_STA failed\n"); 463 - break; 464 - } 465 - } 466 - il_free_pages(il, cmd.reply_page); 467 - 468 - return ret; 469 - } 470 - 471 - /** 472 - * il_remove_station - Remove driver's knowledge of station. 473 - */ 474 - int il_remove_station(struct il_priv *il, const u8 sta_id, 475 - const u8 *addr) 476 - { 477 - unsigned long flags; 478 - 479 - if (!il_is_ready(il)) { 480 - D_INFO( 481 - "Unable to remove station %pM, device not ready.\n", 482 - addr); 483 - /* 484 - * It is typical for stations to be removed when we are 485 - * going down. Return success since device will be down 486 - * soon anyway 487 - */ 488 - return 0; 489 - } 490 - 491 - D_ASSOC("Removing STA from driver:%d %pM\n", 492 - sta_id, addr); 493 - 494 - if (WARN_ON(sta_id == IL_INVALID_STATION)) 495 - return -EINVAL; 496 - 497 - spin_lock_irqsave(&il->sta_lock, flags); 498 - 499 - if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) { 500 - D_INFO("Removing %pM but non DRIVER active\n", 501 - addr); 502 - goto out_err; 503 - } 504 - 505 - if (!(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { 506 - D_INFO("Removing %pM but non UCODE active\n", 507 - addr); 508 - goto out_err; 509 - } 510 - 511 - if (il->stations[sta_id].used & IL_STA_LOCAL) { 512 - kfree(il->stations[sta_id].lq); 513 - il->stations[sta_id].lq = NULL; 514 - } 515 - 516 - il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; 517 - 518 - il->num_stations--; 519 - 520 - BUG_ON(il->num_stations < 0); 521 - 522 - spin_unlock_irqrestore(&il->sta_lock, flags); 523 - 524 - return il_send_remove_station(il, addr, sta_id, false); 525 - out_err: 526 - spin_unlock_irqrestore(&il->sta_lock, flags); 527 - return -EINVAL; 528 - } 529 - EXPORT_SYMBOL_GPL(il_remove_station); 530 - 531 - /** 532 - * il_clear_ucode_stations - clear ucode station table bits 533 - * 534 - * This function clears all the bits in the driver indicating 535 - * which stations are active in the ucode. Call when something 536 - * other than explicit station management would cause this in 537 - * the ucode, e.g. unassociated RXON. 538 - */ 539 - void il_clear_ucode_stations(struct il_priv *il, 540 - struct il_rxon_context *ctx) 541 - { 542 - int i; 543 - unsigned long flags_spin; 544 - bool cleared = false; 545 - 546 - D_INFO("Clearing ucode stations in driver\n"); 547 - 548 - spin_lock_irqsave(&il->sta_lock, flags_spin); 549 - for (i = 0; i < il->hw_params.max_stations; i++) { 550 - if (ctx && ctx->ctxid != il->stations[i].ctxid) 551 - continue; 552 - 553 - if (il->stations[i].used & IL_STA_UCODE_ACTIVE) { 554 - D_INFO( 555 - "Clearing ucode active for station %d\n", i); 556 - il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; 557 - cleared = true; 558 - } 559 - } 560 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 561 - 562 - if (!cleared) 563 - D_INFO( 564 - "No active stations found to be cleared\n"); 565 - } 566 - EXPORT_SYMBOL(il_clear_ucode_stations); 567 - 568 - /** 569 - * il_restore_stations() - Restore driver known stations to device 570 - * 571 - * All stations considered active by driver, but not present in ucode, is 572 - * restored. 573 - * 574 - * Function sleeps. 575 - */ 576 - void 577 - il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx) 578 - { 579 - struct il_addsta_cmd sta_cmd; 580 - struct il_link_quality_cmd lq; 581 - unsigned long flags_spin; 582 - int i; 583 - bool found = false; 584 - int ret; 585 - bool send_lq; 586 - 587 - if (!il_is_ready(il)) { 588 - D_INFO( 589 - "Not ready yet, not restoring any stations.\n"); 590 - return; 591 - } 592 - 593 - D_ASSOC("Restoring all known stations ... start.\n"); 594 - spin_lock_irqsave(&il->sta_lock, flags_spin); 595 - for (i = 0; i < il->hw_params.max_stations; i++) { 596 - if (ctx->ctxid != il->stations[i].ctxid) 597 - continue; 598 - if ((il->stations[i].used & IL_STA_DRIVER_ACTIVE) && 599 - !(il->stations[i].used & IL_STA_UCODE_ACTIVE)) { 600 - D_ASSOC("Restoring sta %pM\n", 601 - il->stations[i].sta.sta.addr); 602 - il->stations[i].sta.mode = 0; 603 - il->stations[i].used |= IL_STA_UCODE_INPROGRESS; 604 - found = true; 605 - } 606 - } 607 - 608 - for (i = 0; i < il->hw_params.max_stations; i++) { 609 - if ((il->stations[i].used & IL_STA_UCODE_INPROGRESS)) { 610 - memcpy(&sta_cmd, &il->stations[i].sta, 611 - sizeof(struct il_addsta_cmd)); 612 - send_lq = false; 613 - if (il->stations[i].lq) { 614 - memcpy(&lq, il->stations[i].lq, 615 - sizeof(struct il_link_quality_cmd)); 616 - send_lq = true; 617 - } 618 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 619 - ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); 620 - if (ret) { 621 - spin_lock_irqsave(&il->sta_lock, flags_spin); 622 - IL_ERR("Adding station %pM failed.\n", 623 - il->stations[i].sta.sta.addr); 624 - il->stations[i].used &= 625 - ~IL_STA_DRIVER_ACTIVE; 626 - il->stations[i].used &= 627 - ~IL_STA_UCODE_INPROGRESS; 628 - spin_unlock_irqrestore(&il->sta_lock, 629 - flags_spin); 630 - } 631 - /* 632 - * Rate scaling has already been initialized, send 633 - * current LQ command 634 - */ 635 - if (send_lq) 636 - il_send_lq_cmd(il, ctx, &lq, 637 - CMD_SYNC, true); 638 - spin_lock_irqsave(&il->sta_lock, flags_spin); 639 - il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; 640 - } 641 - } 642 - 643 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 644 - if (!found) 645 - D_INFO("Restoring all known stations" 646 - " .... no stations to be restored.\n"); 647 - else 648 - D_INFO("Restoring all known stations" 649 - " .... complete.\n"); 650 - } 651 - EXPORT_SYMBOL(il_restore_stations); 652 - 653 - int il_get_free_ucode_key_idx(struct il_priv *il) 654 - { 655 - int i; 656 - 657 - for (i = 0; i < il->sta_key_max_num; i++) 658 - if (!test_and_set_bit(i, &il->ucode_key_table)) 659 - return i; 660 - 661 - return WEP_INVALID_OFFSET; 662 - } 663 - EXPORT_SYMBOL(il_get_free_ucode_key_idx); 664 - 665 - void il_dealloc_bcast_stations(struct il_priv *il) 666 - { 667 - unsigned long flags; 668 - int i; 669 - 670 - spin_lock_irqsave(&il->sta_lock, flags); 671 - for (i = 0; i < il->hw_params.max_stations; i++) { 672 - if (!(il->stations[i].used & IL_STA_BCAST)) 673 - continue; 674 - 675 - il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; 676 - il->num_stations--; 677 - BUG_ON(il->num_stations < 0); 678 - kfree(il->stations[i].lq); 679 - il->stations[i].lq = NULL; 680 - } 681 - spin_unlock_irqrestore(&il->sta_lock, flags); 682 - } 683 - EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations); 684 - 685 - #ifdef CONFIG_IWLEGACY_DEBUG 686 - static void il_dump_lq_cmd(struct il_priv *il, 687 - struct il_link_quality_cmd *lq) 688 - { 689 - int i; 690 - D_RATE("lq station id 0x%x\n", lq->sta_id); 691 - D_RATE("lq ant 0x%X 0x%X\n", 692 - lq->general_params.single_stream_ant_msk, 693 - lq->general_params.dual_stream_ant_msk); 694 - 695 - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 696 - D_RATE("lq idx %d 0x%X\n", 697 - i, lq->rs_table[i].rate_n_flags); 698 - } 699 - #else 700 - static inline void il_dump_lq_cmd(struct il_priv *il, 701 - struct il_link_quality_cmd *lq) 702 - { 703 - } 704 - #endif 705 - 706 - /** 707 - * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity 708 - * 709 - * It sometimes happens when a HT rate has been in use and we 710 - * loose connectivity with AP then mac80211 will first tell us that the 711 - * current channel is not HT anymore before removing the station. In such a 712 - * scenario the RXON flags will be updated to indicate we are not 713 - * communicating HT anymore, but the LQ command may still contain HT rates. 714 - * Test for this to prevent driver from sending LQ command between the time 715 - * RXON flags are updated and when LQ command is updated. 716 - */ 717 - static bool il_is_lq_table_valid(struct il_priv *il, 718 - struct il_rxon_context *ctx, 719 - struct il_link_quality_cmd *lq) 720 - { 721 - int i; 722 - 723 - if (ctx->ht.enabled) 724 - return true; 725 - 726 - D_INFO("Channel %u is not an HT channel\n", 727 - ctx->active.channel); 728 - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { 729 - if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & 730 - RATE_MCS_HT_MSK) { 731 - D_INFO( 732 - "idx %d of LQ expects HT channel\n", 733 - i); 734 - return false; 735 - } 736 - } 737 - return true; 738 - } 739 - 740 - /** 741 - * il_send_lq_cmd() - Send link quality command 742 - * @init: This command is sent as part of station initialization right 743 - * after station has been added. 744 - * 745 - * The link quality command is sent as the last step of station creation. 746 - * This is the special case in which init is set and we call a callback in 747 - * this case to clear the state indicating that station creation is in 748 - * progress. 749 - */ 750 - int il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx, 751 - struct il_link_quality_cmd *lq, u8 flags, bool init) 752 - { 753 - int ret = 0; 754 - unsigned long flags_spin; 755 - 756 - struct il_host_cmd cmd = { 757 - .id = C_TX_LINK_QUALITY_CMD, 758 - .len = sizeof(struct il_link_quality_cmd), 759 - .flags = flags, 760 - .data = lq, 761 - }; 762 - 763 - if (WARN_ON(lq->sta_id == IL_INVALID_STATION)) 764 - return -EINVAL; 765 - 766 - 767 - spin_lock_irqsave(&il->sta_lock, flags_spin); 768 - if (!(il->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) { 769 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 770 - return -EINVAL; 771 - } 772 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 773 - 774 - il_dump_lq_cmd(il, lq); 775 - BUG_ON(init && (cmd.flags & CMD_ASYNC)); 776 - 777 - if (il_is_lq_table_valid(il, ctx, lq)) 778 - ret = il_send_cmd(il, &cmd); 779 - else 780 - ret = -EINVAL; 781 - 782 - if (cmd.flags & CMD_ASYNC) 783 - return ret; 784 - 785 - if (init) { 786 - D_INFO("init LQ command complete," 787 - " clearing sta addition status for sta %d\n", 788 - lq->sta_id); 789 - spin_lock_irqsave(&il->sta_lock, flags_spin); 790 - il->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS; 791 - spin_unlock_irqrestore(&il->sta_lock, flags_spin); 792 - } 793 - return ret; 794 - } 795 - EXPORT_SYMBOL(il_send_lq_cmd); 796 - 797 - int il_mac_sta_remove(struct ieee80211_hw *hw, 798 - struct ieee80211_vif *vif, 799 - struct ieee80211_sta *sta) 800 - { 801 - struct il_priv *il = hw->priv; 802 - struct il_station_priv_common *sta_common = (void *)sta->drv_priv; 803 - int ret; 804 - 805 - D_INFO("received request to remove station %pM\n", 806 - sta->addr); 807 - mutex_lock(&il->mutex); 808 - D_INFO("proceeding to remove station %pM\n", 809 - sta->addr); 810 - ret = il_remove_station(il, sta_common->sta_id, sta->addr); 811 - if (ret) 812 - IL_ERR("Error removing station %pM\n", 813 - sta->addr); 814 - mutex_unlock(&il->mutex); 815 - return ret; 816 - } 817 - EXPORT_SYMBOL(il_mac_sta_remove);
+4 -6
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
··· 88 88 return -EINVAL; 89 89 90 90 /* Allocate the circular buffer of Read Buffer Descriptors (RBDs) */ 91 - rxq->bd = dma_alloc_coherent(dev, sizeof(__le32) * RX_QUEUE_SIZE, 92 - &rxq->bd_dma, GFP_KERNEL); 91 + rxq->bd = dma_zalloc_coherent(dev, sizeof(__le32) * RX_QUEUE_SIZE, 92 + &rxq->bd_dma, GFP_KERNEL); 93 93 if (!rxq->bd) 94 94 goto err_bd; 95 - memset(rxq->bd, 0, sizeof(__le32) * RX_QUEUE_SIZE); 96 95 97 96 /*Allocate the driver's pointer to receive buffer status */ 98 - rxq->rb_stts = dma_alloc_coherent(dev, sizeof(*rxq->rb_stts), 99 - &rxq->rb_stts_dma, GFP_KERNEL); 97 + rxq->rb_stts = dma_zalloc_coherent(dev, sizeof(*rxq->rb_stts), 98 + &rxq->rb_stts_dma, GFP_KERNEL); 100 99 if (!rxq->rb_stts) 101 100 goto err_rb_stts; 102 - memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); 103 101 104 102 return 0; 105 103
+130 -8
drivers/net/wireless/mwl8k.c
··· 28 28 29 29 #define MWL8K_DESC "Marvell TOPDOG(R) 802.11 Wireless Network Driver" 30 30 #define MWL8K_NAME KBUILD_MODNAME 31 - #define MWL8K_VERSION "0.12" 31 + #define MWL8K_VERSION "0.13" 32 32 33 33 /* Module parameters */ 34 34 static bool ap_mode_default; ··· 198 198 /* firmware access */ 199 199 struct mutex fw_mutex; 200 200 struct task_struct *fw_mutex_owner; 201 + struct task_struct *hw_restart_owner; 201 202 int fw_mutex_depth; 202 203 struct completion *hostcmd_wait; 203 204 ··· 262 261 * the firmware image is swapped. 263 262 */ 264 263 struct ieee80211_tx_queue_params wmm_params[MWL8K_TX_WMM_QUEUES]; 264 + 265 + /* To perform the task of reloading the firmware */ 266 + struct work_struct fw_reload; 267 + bool hw_restart_in_progress; 265 268 266 269 /* async firmware loading state */ 267 270 unsigned fw_state; ··· 1503 1498 1504 1499 might_sleep(); 1505 1500 1501 + /* Since fw restart is in progress, allow only the firmware 1502 + * commands from the restart code and block the other 1503 + * commands since they are going to fail in any case since 1504 + * the firmware has crashed 1505 + */ 1506 + if (priv->hw_restart_in_progress) { 1507 + if (priv->hw_restart_owner == current) 1508 + return 0; 1509 + else 1510 + return -EBUSY; 1511 + } 1512 + 1506 1513 /* 1507 1514 * The TX queues are stopped at this point, so this test 1508 1515 * doesn't need to take ->tx_lock. ··· 1558 1541 wiphy_err(hw->wiphy, "tx rings stuck for %d ms\n", 1559 1542 MWL8K_TX_WAIT_TIMEOUT_MS); 1560 1543 mwl8k_dump_tx_rings(hw); 1544 + priv->hw_restart_in_progress = true; 1545 + ieee80211_queue_work(hw, &priv->fw_reload); 1561 1546 1562 1547 rc = -ETIMEDOUT; 1563 1548 } ··· 2077 2058 2078 2059 rc = mwl8k_tx_wait_empty(hw); 2079 2060 if (rc) { 2080 - ieee80211_wake_queues(hw); 2061 + if (!priv->hw_restart_in_progress) 2062 + ieee80211_wake_queues(hw); 2063 + 2081 2064 mutex_unlock(&priv->fw_mutex); 2082 2065 2083 2066 return rc; ··· 2098 2077 struct mwl8k_priv *priv = hw->priv; 2099 2078 2100 2079 if (!--priv->fw_mutex_depth) { 2101 - ieee80211_wake_queues(hw); 2080 + if (!priv->hw_restart_in_progress) 2081 + ieee80211_wake_queues(hw); 2082 + 2102 2083 priv->fw_mutex_owner = NULL; 2103 2084 mutex_unlock(&priv->fw_mutex); 2104 2085 } ··· 4421 4398 struct mwl8k_priv *priv = hw->priv; 4422 4399 int i; 4423 4400 4424 - mwl8k_cmd_radio_disable(hw); 4401 + if (!priv->hw_restart_in_progress) 4402 + mwl8k_cmd_radio_disable(hw); 4425 4403 4426 4404 ieee80211_stop_queues(hw); 4427 4405 ··· 4523 4499 return 0; 4524 4500 } 4525 4501 4502 + static void mwl8k_remove_vif(struct mwl8k_priv *priv, struct mwl8k_vif *vif) 4503 + { 4504 + /* Has ieee80211_restart_hw re-added the removed interfaces? */ 4505 + if (!priv->macids_used) 4506 + return; 4507 + 4508 + priv->macids_used &= ~(1 << vif->macid); 4509 + list_del(&vif->list); 4510 + } 4511 + 4526 4512 static void mwl8k_remove_interface(struct ieee80211_hw *hw, 4527 4513 struct ieee80211_vif *vif) 4528 4514 { ··· 4544 4510 4545 4511 mwl8k_cmd_set_mac_addr(hw, vif, "\x00\x00\x00\x00\x00\x00"); 4546 4512 4547 - priv->macids_used &= ~(1 << mwl8k_vif->macid); 4548 - list_del(&mwl8k_vif->list); 4513 + mwl8k_remove_vif(priv, mwl8k_vif); 4514 + } 4515 + 4516 + static void mwl8k_hw_restart_work(struct work_struct *work) 4517 + { 4518 + struct mwl8k_priv *priv = 4519 + container_of(work, struct mwl8k_priv, fw_reload); 4520 + struct ieee80211_hw *hw = priv->hw; 4521 + struct mwl8k_device_info *di; 4522 + int rc; 4523 + 4524 + /* If some command is waiting for a response, clear it */ 4525 + if (priv->hostcmd_wait != NULL) { 4526 + complete(priv->hostcmd_wait); 4527 + priv->hostcmd_wait = NULL; 4528 + } 4529 + 4530 + priv->hw_restart_owner = current; 4531 + di = priv->device_info; 4532 + mwl8k_fw_lock(hw); 4533 + 4534 + if (priv->ap_fw) 4535 + rc = mwl8k_reload_firmware(hw, di->fw_image_ap); 4536 + else 4537 + rc = mwl8k_reload_firmware(hw, di->fw_image_sta); 4538 + 4539 + if (rc) 4540 + goto fail; 4541 + 4542 + priv->hw_restart_owner = NULL; 4543 + priv->hw_restart_in_progress = false; 4544 + 4545 + /* 4546 + * This unlock will wake up the queues and 4547 + * also opens the command path for other 4548 + * commands 4549 + */ 4550 + mwl8k_fw_unlock(hw); 4551 + 4552 + ieee80211_restart_hw(hw); 4553 + 4554 + wiphy_err(hw->wiphy, "Firmware restarted successfully\n"); 4555 + 4556 + return; 4557 + fail: 4558 + mwl8k_fw_unlock(hw); 4559 + 4560 + wiphy_err(hw->wiphy, "Firmware restart failed\n"); 4549 4561 } 4550 4562 4551 4563 static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) ··· 5104 5024 for (i = 0; i < MAX_AMPDU_ATTEMPTS; i++) { 5105 5025 rc = mwl8k_check_ba(hw, stream); 5106 5026 5107 - if (!rc) 5027 + /* If HW restart is in progress mwl8k_post_cmd will 5028 + * return -EBUSY. Avoid retrying mwl8k_check_ba in 5029 + * such cases 5030 + */ 5031 + if (!rc || rc == -EBUSY) 5108 5032 break; 5109 5033 /* 5110 5034 * HW queues take time to be flushed, give them ··· 5347 5263 mwl8k_release_firmware(priv); 5348 5264 } 5349 5265 5266 + #define MAX_RESTART_ATTEMPTS 1 5350 5267 static int mwl8k_init_firmware(struct ieee80211_hw *hw, char *fw_image, 5351 5268 bool nowait) 5352 5269 { 5353 5270 struct mwl8k_priv *priv = hw->priv; 5354 5271 int rc; 5272 + int count = MAX_RESTART_ATTEMPTS; 5355 5273 5274 + retry: 5356 5275 /* Reset firmware and hardware */ 5357 5276 mwl8k_hw_reset(priv); 5358 5277 ··· 5376 5289 5377 5290 /* Reclaim memory once firmware is successfully loaded */ 5378 5291 mwl8k_release_firmware(priv); 5292 + 5293 + if (rc && count) { 5294 + /* FW did not start successfully; 5295 + * lets try one more time 5296 + */ 5297 + count--; 5298 + wiphy_err(hw->wiphy, "Trying to reload the firmware again\n"); 5299 + msleep(20); 5300 + goto retry; 5301 + } 5379 5302 5380 5303 return rc; 5381 5304 } ··· 5462 5365 goto err_free_queues; 5463 5366 } 5464 5367 5465 - memset(priv->ampdu, 0, sizeof(priv->ampdu)); 5368 + /* 5369 + * When hw restart is requested, 5370 + * mac80211 will take care of clearing 5371 + * the ampdu streams, so do not clear 5372 + * the ampdu state here 5373 + */ 5374 + if (!priv->hw_restart_in_progress) 5375 + memset(priv->ampdu, 0, sizeof(priv->ampdu)); 5466 5376 5467 5377 /* 5468 5378 * Temporarily enable interrupts. Initial firmware host ··· 5543 5439 { 5544 5440 int i, rc = 0; 5545 5441 struct mwl8k_priv *priv = hw->priv; 5442 + struct mwl8k_vif *vif, *tmp_vif; 5546 5443 5547 5444 mwl8k_stop(hw); 5548 5445 mwl8k_rxq_deinit(hw, 0); 5446 + 5447 + /* 5448 + * All the existing interfaces are re-added by the ieee80211_reconfig; 5449 + * which means driver should remove existing interfaces before calling 5450 + * ieee80211_restart_hw 5451 + */ 5452 + if (priv->hw_restart_in_progress) 5453 + list_for_each_entry_safe(vif, tmp_vif, &priv->vif_list, list) 5454 + mwl8k_remove_vif(priv, vif); 5549 5455 5550 5456 for (i = 0; i < mwl8k_tx_queues(priv); i++) 5551 5457 mwl8k_txq_deinit(hw, i); ··· 5567 5453 rc = mwl8k_probe_hw(hw); 5568 5454 if (rc) 5569 5455 goto fail; 5456 + 5457 + if (priv->hw_restart_in_progress) 5458 + return rc; 5570 5459 5571 5460 rc = mwl8k_start(hw); 5572 5461 if (rc) ··· 5641 5524 INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker); 5642 5525 /* Handle watchdog ba events */ 5643 5526 INIT_WORK(&priv->watchdog_ba_handle, mwl8k_watchdog_ba_events); 5527 + /* To reload the firmware if it crashes */ 5528 + INIT_WORK(&priv->fw_reload, mwl8k_hw_restart_work); 5644 5529 5645 5530 /* TX reclaim and RX tasklets. */ 5646 5531 tasklet_init(&priv->poll_tx_task, mwl8k_tx_poll, (unsigned long)hw); ··· 5786 5667 rc = mwl8k_init_firmware(hw, priv->fw_pref, true); 5787 5668 if (rc) 5788 5669 goto err_stop_firmware; 5670 + 5671 + priv->hw_restart_in_progress = false; 5672 + 5789 5673 return rc; 5790 5674 5791 5675 err_stop_firmware:
+2 -2
drivers/net/wireless/rt2x00/rt2800.h
··· 50 50 * RF2853 2.4G/5G 3T3R 51 51 * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) 52 52 * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) 53 - * RF3853 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) 53 + * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) 54 54 * RF5370 2.4G 1T1R 55 55 * RF5390 2.4G 1T1R 56 56 */ ··· 66 66 #define RF2853 0x000a 67 67 #define RF3320 0x000b 68 68 #define RF3322 0x000c 69 - #define RF3853 0x000d 69 + #define RF3053 0x000d 70 70 #define RF5370 0x5370 71 71 #define RF5390 0x5390 72 72
+29 -18
drivers/net/wireless/rt2x00/rt2800lib.c
··· 1944 1944 info->default_power2 = TXPOWER_A_TO_DEV(info->default_power2); 1945 1945 } 1946 1946 1947 - if (rt2x00_rf(rt2x00dev, RF2020) || 1948 - rt2x00_rf(rt2x00dev, RF3020) || 1949 - rt2x00_rf(rt2x00dev, RF3021) || 1950 - rt2x00_rf(rt2x00dev, RF3022) || 1951 - rt2x00_rf(rt2x00dev, RF3320)) 1947 + switch (rt2x00dev->chip.rf) { 1948 + case RF2020: 1949 + case RF3020: 1950 + case RF3021: 1951 + case RF3022: 1952 + case RF3320: 1952 1953 rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); 1953 - else if (rt2x00_rf(rt2x00dev, RF3052)) 1954 + break; 1955 + case RF3052: 1954 1956 rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); 1955 - else if (rt2x00_rf(rt2x00dev, RF5370) || 1956 - rt2x00_rf(rt2x00dev, RF5390)) 1957 + break; 1958 + case RF5370: 1959 + case RF5390: 1957 1960 rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info); 1958 - else 1961 + break; 1962 + default: 1959 1963 rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); 1964 + } 1960 1965 1961 1966 /* 1962 1967 * Change BBP settings ··· 3937 3932 rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), 3938 3933 value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); 3939 3934 3940 - if (!rt2x00_rt(rt2x00dev, RT2860) && 3941 - !rt2x00_rt(rt2x00dev, RT2872) && 3942 - !rt2x00_rt(rt2x00dev, RT2883) && 3943 - !rt2x00_rt(rt2x00dev, RT3070) && 3944 - !rt2x00_rt(rt2x00dev, RT3071) && 3945 - !rt2x00_rt(rt2x00dev, RT3090) && 3946 - !rt2x00_rt(rt2x00dev, RT3390) && 3947 - !rt2x00_rt(rt2x00dev, RT3572) && 3948 - !rt2x00_rt(rt2x00dev, RT5390)) { 3935 + switch (rt2x00dev->chip.rt) { 3936 + case RT2860: 3937 + case RT2872: 3938 + case RT2883: 3939 + case RT3070: 3940 + case RT3071: 3941 + case RT3090: 3942 + case RT3390: 3943 + case RT3572: 3944 + case RT5390: 3945 + break; 3946 + default: 3949 3947 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 3950 3948 return -ENODEV; 3951 3949 } ··· 4561 4553 survey->channel_time_busy = busy / 1000; 4562 4554 survey->channel_time_ext_busy = busy_ext / 1000; 4563 4555 } 4556 + 4557 + if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) 4558 + survey->filled |= SURVEY_INFO_IN_USE; 4564 4559 4565 4560 return 0; 4566 4561
+25 -44
drivers/net/wireless/rt2x00/rt2800usb.c
··· 400 400 /* 401 401 * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is 402 402 * TXWI + 802.11 header + L2 pad + payload + pad, 403 - * so need to decrease size of TXINFO and USB end pad. 403 + * so need to decrease size of TXINFO. 404 404 */ 405 405 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, 406 - entry->skb->len - TXINFO_DESC_SIZE - 4); 406 + roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE); 407 407 rt2x00_set_field32(&word, TXINFO_W0_WIV, 408 408 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); 409 409 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); ··· 421 421 skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; 422 422 } 423 423 424 - static void rt2800usb_write_tx_data(struct queue_entry *entry, 425 - struct txentry_desc *txdesc) 426 - { 427 - unsigned int len; 428 - int err; 429 - 430 - rt2800_write_tx_data(entry, txdesc); 431 - 432 - /* 433 - * pad(1~3 bytes) is added after each 802.11 payload. 434 - * USB end pad(4 bytes) is added at each USB bulk out packet end. 435 - * TX frame format is : 436 - * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | 437 - * |<------------- tx_pkt_len ------------->| 438 - */ 439 - len = roundup(entry->skb->len, 4) + 4; 440 - err = skb_padto(entry->skb, len); 441 - if (unlikely(err)) { 442 - WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n"); 443 - return; 444 - } 445 - 446 - entry->skb->len = len; 447 - } 448 - 449 424 /* 450 425 * TX data initialization 451 426 */ 452 427 static int rt2800usb_get_tx_data_len(struct queue_entry *entry) 453 428 { 454 - return entry->skb->len; 429 + /* 430 + * pad(1~3 bytes) is needed after each 802.11 payload. 431 + * USB end pad(4 bytes) is needed at each USB bulk out packet end. 432 + * TX frame format is : 433 + * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | 434 + * |<------------- tx_pkt_len ------------->| 435 + */ 436 + 437 + return roundup(entry->skb->len, 4) + 4; 455 438 } 456 439 457 440 /* ··· 790 807 .flush_queue = rt2x00usb_flush_queue, 791 808 .tx_dma_done = rt2800usb_tx_dma_done, 792 809 .write_tx_desc = rt2800usb_write_tx_desc, 793 - .write_tx_data = rt2800usb_write_tx_data, 810 + .write_tx_data = rt2800_write_tx_data, 794 811 .write_beacon = rt2800_write_beacon, 795 812 .clear_beacon = rt2800_clear_beacon, 796 813 .get_tx_data_len = rt2800usb_get_tx_data_len, ··· 897 914 { USB_DEVICE(0x050d, 0x8053) }, 898 915 { USB_DEVICE(0x050d, 0x805c) }, 899 916 { USB_DEVICE(0x050d, 0x815c) }, 917 + { USB_DEVICE(0x050d, 0x825a) }, 900 918 { USB_DEVICE(0x050d, 0x825b) }, 901 919 { USB_DEVICE(0x050d, 0x935a) }, 902 920 { USB_DEVICE(0x050d, 0x935b) }, 903 921 /* Buffalo */ 904 922 { USB_DEVICE(0x0411, 0x00e8) }, 905 923 { USB_DEVICE(0x0411, 0x0158) }, 924 + { USB_DEVICE(0x0411, 0x015d) }, 906 925 { USB_DEVICE(0x0411, 0x016f) }, 907 926 { USB_DEVICE(0x0411, 0x01a2) }, 908 927 /* Corega */ ··· 919 934 { USB_DEVICE(0x07d1, 0x3c0e) }, 920 935 { USB_DEVICE(0x07d1, 0x3c0f) }, 921 936 { USB_DEVICE(0x07d1, 0x3c11) }, 937 + { USB_DEVICE(0x07d1, 0x3c13) }, 938 + { USB_DEVICE(0x07d1, 0x3c15) }, 922 939 { USB_DEVICE(0x07d1, 0x3c16) }, 923 940 /* Draytek */ 924 941 { USB_DEVICE(0x07fa, 0x7712) }, ··· 930 943 { USB_DEVICE(0x7392, 0x7711) }, 931 944 { USB_DEVICE(0x7392, 0x7717) }, 932 945 { USB_DEVICE(0x7392, 0x7718) }, 946 + { USB_DEVICE(0x7392, 0x7722) }, 933 947 /* Encore */ 934 948 { USB_DEVICE(0x203d, 0x1480) }, 935 949 { USB_DEVICE(0x203d, 0x14a9) }, ··· 964 976 { USB_DEVICE(0x13b1, 0x0031) }, 965 977 { USB_DEVICE(0x1737, 0x0070) }, 966 978 { USB_DEVICE(0x1737, 0x0071) }, 979 + { USB_DEVICE(0x1737, 0x0077) }, 980 + { USB_DEVICE(0x1737, 0x0078) }, 967 981 /* Logitec */ 968 982 { USB_DEVICE(0x0789, 0x0162) }, 969 983 { USB_DEVICE(0x0789, 0x0163) }, ··· 989 999 { USB_DEVICE(0x0db0, 0x871b) }, 990 1000 { USB_DEVICE(0x0db0, 0x871c) }, 991 1001 { USB_DEVICE(0x0db0, 0x899a) }, 1002 + /* Ovislink */ 1003 + { USB_DEVICE(0x1b75, 0x3071) }, 1004 + { USB_DEVICE(0x1b75, 0x3072) }, 992 1005 /* Para */ 993 1006 { USB_DEVICE(0x20b8, 0x8888) }, 994 1007 /* Pegatron */ 1008 + { USB_DEVICE(0x1d4d, 0x0002) }, 995 1009 { USB_DEVICE(0x1d4d, 0x000c) }, 996 1010 { USB_DEVICE(0x1d4d, 0x000e) }, 997 1011 { USB_DEVICE(0x1d4d, 0x0011) }, ··· 1048 1054 /* Sparklan */ 1049 1055 { USB_DEVICE(0x15a9, 0x0006) }, 1050 1056 /* Sweex */ 1057 + { USB_DEVICE(0x177f, 0x0153) }, 1051 1058 { USB_DEVICE(0x177f, 0x0302) }, 1059 + { USB_DEVICE(0x177f, 0x0313) }, 1052 1060 /* U-Media */ 1053 1061 { USB_DEVICE(0x157e, 0x300e) }, 1054 1062 { USB_DEVICE(0x157e, 0x3013) }, ··· 1134 1138 { USB_DEVICE(0x13d3, 0x3322) }, 1135 1139 /* Belkin */ 1136 1140 { USB_DEVICE(0x050d, 0x1003) }, 1137 - { USB_DEVICE(0x050d, 0x825a) }, 1138 1141 /* Buffalo */ 1139 1142 { USB_DEVICE(0x0411, 0x012e) }, 1140 1143 { USB_DEVICE(0x0411, 0x0148) }, 1141 1144 { USB_DEVICE(0x0411, 0x0150) }, 1142 - { USB_DEVICE(0x0411, 0x015d) }, 1143 1145 /* Corega */ 1144 1146 { USB_DEVICE(0x07aa, 0x0041) }, 1145 1147 { USB_DEVICE(0x07aa, 0x0042) }, 1146 1148 { USB_DEVICE(0x18c5, 0x0008) }, 1147 1149 /* D-Link */ 1148 1150 { USB_DEVICE(0x07d1, 0x3c0b) }, 1149 - { USB_DEVICE(0x07d1, 0x3c13) }, 1150 - { USB_DEVICE(0x07d1, 0x3c15) }, 1151 1151 { USB_DEVICE(0x07d1, 0x3c17) }, 1152 1152 { USB_DEVICE(0x2001, 0x3c17) }, 1153 1153 /* Edimax */ 1154 1154 { USB_DEVICE(0x7392, 0x4085) }, 1155 - { USB_DEVICE(0x7392, 0x7722) }, 1156 1155 /* Encore */ 1157 1156 { USB_DEVICE(0x203d, 0x14a1) }, 1158 1157 /* Fujitsu Stylistic 550 */ ··· 1163 1172 /* LevelOne */ 1164 1173 { USB_DEVICE(0x1740, 0x0605) }, 1165 1174 { USB_DEVICE(0x1740, 0x0615) }, 1166 - /* Linksys */ 1167 - { USB_DEVICE(0x1737, 0x0077) }, 1168 - { USB_DEVICE(0x1737, 0x0078) }, 1169 1175 /* Logitec */ 1170 1176 { USB_DEVICE(0x0789, 0x0168) }, 1171 1177 { USB_DEVICE(0x0789, 0x0169) }, 1172 1178 /* Motorola */ 1173 1179 { USB_DEVICE(0x100d, 0x9032) }, 1174 - /* Ovislink */ 1175 - { USB_DEVICE(0x1b75, 0x3071) }, 1176 - { USB_DEVICE(0x1b75, 0x3072) }, 1177 1180 /* Pegatron */ 1178 1181 { USB_DEVICE(0x05a6, 0x0101) }, 1179 - { USB_DEVICE(0x1d4d, 0x0002) }, 1180 1182 { USB_DEVICE(0x1d4d, 0x0010) }, 1181 1183 /* Planex */ 1182 1184 { USB_DEVICE(0x2019, 0x5201) }, ··· 1188 1204 { USB_DEVICE(0x083a, 0xc522) }, 1189 1205 { USB_DEVICE(0x083a, 0xd522) }, 1190 1206 { USB_DEVICE(0x083a, 0xf511) }, 1191 - /* Sweex */ 1192 - { USB_DEVICE(0x177f, 0x0153) }, 1193 - { USB_DEVICE(0x177f, 0x0313) }, 1194 1207 /* Zyxel */ 1195 1208 { USB_DEVICE(0x0586, 0x341a) }, 1196 1209 #endif
+2 -2
drivers/net/wireless/rt2x00/rt2x00.h
··· 189 189 #define RT3090 0x3090 /* 2.4GHz PCIe */ 190 190 #define RT3390 0x3390 191 191 #define RT3572 0x3572 192 - #define RT3593 0x3593 /* PCIe */ 192 + #define RT3593 0x3593 193 193 #define RT3883 0x3883 /* WSOC */ 194 - #define RT5390 0x5390 /* 2.4GHz */ 194 + #define RT5390 0x5390 /* 2.4GHz */ 195 195 196 196 u16 rf; 197 197 u16 rev;
+13 -3
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 298 298 return false; 299 299 300 300 /* 301 - * USB devices cannot blindly pass the skb->len as the 302 - * length of the data to usb_fill_bulk_urb. Pass the skb 303 - * to the driver to determine what the length should be. 301 + * USB devices require certain padding at the end of each frame 302 + * and urb. Those paddings are not included in skbs. Pass entry 303 + * to the driver to determine what the overall length should be. 304 304 */ 305 305 length = rt2x00dev->ops->lib->get_tx_data_len(entry); 306 + 307 + status = skb_padto(entry->skb, length); 308 + if (unlikely(status)) { 309 + /* TODO: report something more appropriate than IO_FAILED. */ 310 + WARNING(rt2x00dev, "TX SKB padding error, out of memory\n"); 311 + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 312 + rt2x00lib_dmadone(entry); 313 + 314 + return false; 315 + } 306 316 307 317 usb_fill_bulk_urb(entry_priv->urb, usb_dev, 308 318 usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
+2
include/linux/nfc.h
··· 88 88 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID 89 89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 90 90 * target is not NFC-Forum compliant) 91 + * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes 91 92 * @NFC_ATTR_COMM_MODE: Passive or active mode 92 93 * @NFC_ATTR_RF_MODE: Initiator or target 93 94 */ ··· 100 99 NFC_ATTR_TARGET_INDEX, 101 100 NFC_ATTR_TARGET_SENS_RES, 102 101 NFC_ATTR_TARGET_SEL_RES, 102 + NFC_ATTR_TARGET_NFCID1, 103 103 NFC_ATTR_COMM_MODE, 104 104 NFC_ATTR_RF_MODE, 105 105 /* private: internal use only */
+21 -28
include/net/nfc/nci.h
··· 54 54 #define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 55 55 #define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 56 56 /* NFCEE Interface Specific Status Codes */ 57 - #define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0 58 - #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1 59 - #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc2 60 - #define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc3 61 - #define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc4 57 + #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc0 58 + #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc1 59 + #define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc2 60 + #define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc3 62 61 63 62 /* NCI RF Technology and Mode */ 64 63 #define NCI_NFC_A_PASSIVE_POLL_MODE 0x00 ··· 65 66 #define NCI_NFC_F_PASSIVE_POLL_MODE 0x02 66 67 #define NCI_NFC_A_ACTIVE_POLL_MODE 0x03 67 68 #define NCI_NFC_F_ACTIVE_POLL_MODE 0x05 69 + #define NCI_NFC_15693_PASSIVE_POLL_MODE 0x06 68 70 #define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80 69 71 #define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81 70 72 #define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82 71 73 #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 72 74 #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 75 + #define NCI_NFC_15693_PASSIVE_LISTEN_MODE 0x86 73 76 74 77 /* NCI RF Technologies */ 75 78 #define NCI_NFC_RF_TECHNOLOGY_A 0x00 ··· 84 83 #define NCI_NFC_BIT_RATE_212 0x01 85 84 #define NCI_NFC_BIT_RATE_424 0x02 86 85 #define NCI_NFC_BIT_RATE_848 0x03 87 - #define NCI_NFC_BIT_RATE_1696 0x04 88 - #define NCI_NFC_BIT_RATE_3392 0x05 89 - #define NCI_NFC_BIT_RATE_6784 0x06 86 + #define NCI_NFC_BIT_RATE_1695 0x04 87 + #define NCI_NFC_BIT_RATE_3390 0x05 88 + #define NCI_NFC_BIT_RATE_6780 0x06 90 89 91 90 /* NCI RF Protocols */ 92 91 #define NCI_RF_PROTOCOL_UNKNOWN 0x00 ··· 115 114 /* NCI RF_DISCOVER_MAP_CMD modes */ 116 115 #define NCI_DISC_MAP_MODE_POLL 0x01 117 116 #define NCI_DISC_MAP_MODE_LISTEN 0x02 118 - #define NCI_DISC_MAP_MODE_BOTH 0x03 119 - 120 - /* NCI Discovery Types */ 121 - #define NCI_DISCOVERY_TYPE_POLL_A_PASSIVE 0x00 122 - #define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE 0x01 123 - #define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02 124 - #define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03 125 - #define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05 126 - #define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09 127 - #define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80 128 - #define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81 129 - #define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE 0x82 130 - #define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83 131 - #define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85 132 117 133 118 /* NCI Deactivation Type */ 134 119 #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 ··· 187 200 struct disc_map_config { 188 201 __u8 rf_protocol; 189 202 __u8 mode; 190 - __u8 rf_interface_type; 203 + __u8 rf_interface; 191 204 } __packed; 192 205 193 206 struct nci_rf_disc_map_cmd { ··· 198 211 199 212 #define NCI_OP_RF_DISCOVER_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 200 213 struct disc_config { 201 - __u8 type; 214 + __u8 rf_tech_and_mode; 202 215 __u8 frequency; 203 216 } __packed; 204 217 ··· 236 249 __le16 max_routing_table_size; 237 250 __u8 max_ctrl_pkt_payload_len; 238 251 __le16 max_size_for_large_params; 239 - __u8 max_data_pkt_payload_size; 240 - __u8 initial_num_credits; 241 252 __u8 manufact_id; 242 253 __le32 manufact_specific_info; 243 254 } __packed; ··· 249 264 /* --------------------------- */ 250 265 /* ---- NCI Notifications ---- */ 251 266 /* --------------------------- */ 252 - #define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x07) 267 + #define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x06) 253 268 struct conn_credit_entry { 254 269 __u8 conn_id; 255 270 __u8 credits; ··· 258 273 struct nci_core_conn_credit_ntf { 259 274 __u8 num_entries; 260 275 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 276 + } __packed; 277 + 278 + #define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279 + struct nci_core_intf_error_ntf { 280 + __u8 status; 281 + __u8 conn_id; 261 282 } __packed; 262 283 263 284 #define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) ··· 282 291 283 292 struct nci_rf_intf_activated_ntf { 284 293 __u8 rf_discovery_id; 285 - __u8 rf_interface_type; 294 + __u8 rf_interface; 286 295 __u8 rf_protocol; 287 296 __u8 activation_rf_tech_and_mode; 297 + __u8 max_data_pkt_payload_size; 298 + __u8 initial_num_credits; 288 299 __u8 rf_tech_specific_params_len; 289 300 290 301 union {
+4 -2
include/net/nfc/nci_core.h
··· 111 111 __u16 max_routing_table_size; 112 112 __u8 max_ctrl_pkt_payload_len; 113 113 __u16 max_size_for_large_params; 114 - __u8 max_data_pkt_payload_size; 115 - __u8 initial_num_credits; 116 114 __u8 manufact_id; 117 115 __u32 manufact_specific_info; 116 + 117 + /* received during NCI_OP_RF_INTF_ACTIVATED_NTF */ 118 + __u8 max_data_pkt_payload_size; 119 + __u8 initial_num_credits; 118 120 119 121 /* stored during nci_data_exchange */ 120 122 data_exchange_cb_t data_exchange_cb;
+3
include/net/nfc/nfc.h
··· 65 65 66 66 #define NFC_TARGET_IDX_ANY -1 67 67 #define NFC_MAX_GT_LEN 48 68 + #define NFC_MAX_NFCID1_LEN 10 68 69 69 70 struct nfc_target { 70 71 u32 idx; 71 72 u32 supported_protocols; 72 73 u16 sens_res; 73 74 u8 sel_res; 75 + u8 nfcid1_len; 76 + u8 nfcid1[NFC_MAX_NFCID1_LEN]; 74 77 }; 75 78 76 79 struct nfc_genl_data {
-2
net/mac80211/ieee80211_i.h
··· 1221 1221 void ieee80211_sched_scan_stopped_work(struct work_struct *work); 1222 1222 1223 1223 /* off-channel helpers */ 1224 - void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local, 1225 - bool tell_ap); 1226 1224 void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, 1227 1225 bool offchannel_ps_enable); 1228 1226 void ieee80211_offchannel_return(struct ieee80211_local *local,
+2
net/mac80211/mlme.c
··· 1385 1385 struct sta_info *sta; 1386 1386 1387 1387 if (ifmgd->associated) { 1388 + rcu_read_lock(); 1388 1389 sta = sta_info_get(sdata, ifmgd->bssid); 1389 1390 if (sta) 1390 1391 sta->beacon_loss_count++; 1392 + rcu_read_unlock(); 1391 1393 } 1392 1394 1393 1395 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
+3 -18
net/mac80211/offchannel.c
··· 138 138 mutex_unlock(&local->iflist_mtx); 139 139 } 140 140 141 - void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local, 142 - bool tell_ap) 143 - { 144 - struct ieee80211_sub_if_data *sdata; 145 - 146 - mutex_lock(&local->iflist_mtx); 147 - list_for_each_entry(sdata, &local->interfaces, list) { 148 - if (!ieee80211_sdata_running(sdata)) 149 - continue; 150 - 151 - if (sdata->vif.type == NL80211_IFTYPE_STATION && 152 - sdata->u.mgd.associated) 153 - ieee80211_offchannel_ps_enable(sdata, tell_ap); 154 - } 155 - mutex_unlock(&local->iflist_mtx); 156 - } 157 - 158 141 void ieee80211_offchannel_return(struct ieee80211_local *local, 159 142 bool offchannel_ps_disable) 160 143 { ··· 145 162 146 163 mutex_lock(&local->iflist_mtx); 147 164 list_for_each_entry(sdata, &local->interfaces, list) { 165 + if (sdata->vif.type != NL80211_IFTYPE_MONITOR) 166 + clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); 167 + 148 168 if (!ieee80211_sdata_running(sdata)) 149 169 continue; 150 170 ··· 159 173 } 160 174 161 175 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { 162 - clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); 163 176 /* 164 177 * This may wake up queues even though the driver 165 178 * currently has them stopped. This is not very
-20
net/mac80211/rx.c
··· 1576 1576 return RX_CONTINUE; 1577 1577 } 1578 1578 1579 - static ieee80211_rx_result debug_noinline 1580 - ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) 1581 - { 1582 - u8 *data = rx->skb->data; 1583 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)data; 1584 - 1585 - if (!ieee80211_is_data_qos(hdr->frame_control)) 1586 - return RX_CONTINUE; 1587 - 1588 - /* remove the qos control field, update frame type and meta-data */ 1589 - memmove(data + IEEE80211_QOS_CTL_LEN, data, 1590 - ieee80211_hdrlen(hdr->frame_control) - IEEE80211_QOS_CTL_LEN); 1591 - hdr = (struct ieee80211_hdr *)skb_pull(rx->skb, IEEE80211_QOS_CTL_LEN); 1592 - /* change frame type to non QOS */ 1593 - hdr->frame_control &= ~cpu_to_le16(IEEE80211_STYPE_QOS_DATA); 1594 - 1595 - return RX_CONTINUE; 1596 - } 1597 - 1598 1579 static int 1599 1580 ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) 1600 1581 { ··· 2699 2718 if (ieee80211_vif_is_mesh(&rx->sdata->vif)) 2700 2719 CALL_RXH(ieee80211_rx_h_mesh_fwding); 2701 2720 #endif 2702 - CALL_RXH(ieee80211_rx_h_remove_qos_control) 2703 2721 CALL_RXH(ieee80211_rx_h_amsdu) 2704 2722 CALL_RXH(ieee80211_rx_h_data) 2705 2723 CALL_RXH(ieee80211_rx_h_ctrl);
+1 -1
net/mac80211/scan.c
··· 625 625 local->leave_oper_channel_time = jiffies; 626 626 627 627 /* advance to the next channel to be scanned */ 628 - local->next_scan_state = SCAN_DECISION; 628 + local->next_scan_state = SCAN_SET_CHANNEL; 629 629 } 630 630 631 631 void ieee80211_scan_work(struct work_struct *work)
+4 -1
net/mac80211/sta_info.c
··· 945 945 struct sta_info *sta, *tmp; 946 946 947 947 mutex_lock(&local->sta_mtx); 948 - list_for_each_entry_safe(sta, tmp, &local->sta_list, list) 948 + 949 + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { 949 950 if (sdata != sta->sdata) 950 951 continue; 951 952 ··· 957 956 #endif 958 957 WARN_ON(__sta_info_destroy(sta)); 959 958 } 959 + } 960 + 960 961 mutex_unlock(&local->sta_mtx); 961 962 } 962 963
+9 -10
net/mac80211/util.c
··· 1142 1142 */ 1143 1143 } 1144 1144 #endif 1145 - 1146 - /* setup fragmentation threshold */ 1147 - drv_set_frag_threshold(local, hw->wiphy->frag_threshold); 1148 - 1149 - /* setup RTS threshold */ 1150 - drv_set_rts_threshold(local, hw->wiphy->rts_threshold); 1151 - 1152 - /* reset coverage class */ 1153 - drv_set_coverage_class(local, hw->wiphy->coverage_class); 1154 - 1155 1145 /* everything else happens only if HW was up & running */ 1156 1146 if (!local->open_count) 1157 1147 goto wake_up; ··· 1159 1169 "prior to suspend or a hardware issue.\n"); 1160 1170 return res; 1161 1171 } 1172 + 1173 + /* setup fragmentation threshold */ 1174 + drv_set_frag_threshold(local, hw->wiphy->frag_threshold); 1175 + 1176 + /* setup RTS threshold */ 1177 + drv_set_rts_threshold(local, hw->wiphy->rts_threshold); 1178 + 1179 + /* reset coverage class */ 1180 + drv_set_coverage_class(local, hw->wiphy->coverage_class); 1162 1181 1163 1182 ieee80211_led_radio(local, true); 1164 1183 ieee80211_mod_tpt_led_trig(local,
+12 -10
net/nfc/nci/core.c
··· 154 154 if (ndev->supported_rf_interfaces[i] == 155 155 NCI_RF_INTERFACE_ISO_DEP) { 156 156 cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; 157 - cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; 158 - cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; 157 + cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | 158 + NCI_DISC_MAP_MODE_LISTEN; 159 + cfg[*num].rf_interface = NCI_RF_INTERFACE_ISO_DEP; 159 160 (*num)++; 160 161 } else if (ndev->supported_rf_interfaces[i] == 161 162 NCI_RF_INTERFACE_NFC_DEP) { 162 163 cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; 163 - cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; 164 - cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; 164 + cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | 165 + NCI_DISC_MAP_MODE_LISTEN; 166 + cfg[*num].rf_interface = NCI_RF_INTERFACE_NFC_DEP; 165 167 (*num)++; 166 168 } 167 169 ··· 188 186 || protocols & NFC_PROTO_MIFARE_MASK 189 187 || protocols & NFC_PROTO_ISO14443_MASK 190 188 || protocols & NFC_PROTO_NFC_DEP_MASK)) { 191 - cmd.disc_configs[cmd.num_disc_configs].type = 192 - NCI_DISCOVERY_TYPE_POLL_A_PASSIVE; 189 + cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = 190 + NCI_NFC_A_PASSIVE_POLL_MODE; 193 191 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; 194 192 cmd.num_disc_configs++; 195 193 } 196 194 197 195 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && 198 196 (protocols & NFC_PROTO_ISO14443_MASK)) { 199 - cmd.disc_configs[cmd.num_disc_configs].type = 200 - NCI_DISCOVERY_TYPE_POLL_B_PASSIVE; 197 + cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = 198 + NCI_NFC_B_PASSIVE_POLL_MODE; 201 199 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; 202 200 cmd.num_disc_configs++; 203 201 } ··· 205 203 if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && 206 204 (protocols & NFC_PROTO_FELICA_MASK 207 205 || protocols & NFC_PROTO_NFC_DEP_MASK)) { 208 - cmd.disc_configs[cmd.num_disc_configs].type = 209 - NCI_DISCOVERY_TYPE_POLL_F_PASSIVE; 206 + cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = 207 + NCI_NFC_F_PASSIVE_POLL_MODE; 210 208 cmd.disc_configs[cmd.num_disc_configs].frequency = 1; 211 209 cmd.num_disc_configs++; 212 210 }
-3
net/nfc/nci/lib.c
··· 77 77 case NCI_STATUS_NFCEE_TIMEOUT_ERROR: 78 78 return -ETIMEDOUT; 79 79 80 - case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED: 81 - return -EDQUOT; 82 - 83 80 case NCI_STATUS_FAILED: 84 81 default: 85 82 return -ENOSYS;
+42 -8
net/nfc/nci/ntf.c
··· 52 52 53 53 /* update the credits */ 54 54 for (i = 0; i < ntf->num_entries; i++) { 55 + ntf->conn_entries[i].conn_id = 56 + nci_conn_id(&ntf->conn_entries[i].conn_id); 57 + 55 58 pr_debug("entry[%d]: conn_id %d, credits %d\n", 56 59 i, ntf->conn_entries[i].conn_id, 57 60 ntf->conn_entries[i].credits); ··· 69 66 /* trigger the next tx */ 70 67 if (!skb_queue_empty(&ndev->tx_q)) 71 68 queue_work(ndev->tx_wq, &ndev->tx_work); 69 + } 70 + 71 + static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev, 72 + struct sk_buff *skb) 73 + { 74 + struct nci_core_intf_error_ntf *ntf = (void *) skb->data; 75 + 76 + ntf->conn_id = nci_conn_id(&ntf->conn_id); 77 + 78 + pr_debug("status 0x%x, conn_id %d\n", ntf->status, ntf->conn_id); 79 + 80 + /* complete the data exchange transaction, if exists */ 81 + if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) 82 + nci_data_exchange_complete(ndev, NULL, -EIO); 72 83 } 73 84 74 85 static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, ··· 154 137 155 138 nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res; 156 139 nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; 140 + nfc_tgt.nfcid1_len = ntf->rf_tech_specific_params.nfca_poll.nfcid1_len; 141 + if (nfc_tgt.nfcid1_len > 0) { 142 + memcpy(nfc_tgt.nfcid1, 143 + ntf->rf_tech_specific_params.nfca_poll.nfcid1, 144 + nfc_tgt.nfcid1_len); 145 + } 157 146 158 147 if (!(nfc_tgt.supported_protocols & ndev->poll_prots)) { 159 148 pr_debug("the target found does not have the desired protocol\n"); ··· 170 147 nfc_tgt.supported_protocols); 171 148 172 149 ndev->target_available_prots = nfc_tgt.supported_protocols; 150 + ndev->max_data_pkt_payload_size = ntf->max_data_pkt_payload_size; 151 + ndev->initial_num_credits = ntf->initial_num_credits; 152 + 153 + /* set the available credits to initial value */ 154 + atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 173 155 174 156 nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); 175 157 } ··· 190 162 set_bit(NCI_POLL_ACTIVE, &ndev->flags); 191 163 192 164 ntf.rf_discovery_id = *data++; 193 - ntf.rf_interface_type = *data++; 165 + ntf.rf_interface = *data++; 194 166 ntf.rf_protocol = *data++; 195 167 ntf.activation_rf_tech_and_mode = *data++; 168 + ntf.max_data_pkt_payload_size = *data++; 169 + ntf.initial_num_credits = *data++; 196 170 ntf.rf_tech_specific_params_len = *data++; 197 171 198 172 pr_debug("rf_discovery_id %d\n", ntf.rf_discovery_id); 199 - pr_debug("rf_interface_type 0x%x\n", ntf.rf_interface_type); 173 + pr_debug("rf_interface 0x%x\n", ntf.rf_interface); 200 174 pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); 201 175 pr_debug("activation_rf_tech_and_mode 0x%x\n", 202 176 ntf.activation_rf_tech_and_mode); 177 + pr_debug("max_data_pkt_payload_size 0x%x\n", 178 + ntf.max_data_pkt_payload_size); 179 + pr_debug("initial_num_credits 0x%x\n", ntf.initial_num_credits); 203 180 pr_debug("rf_tech_specific_params_len %d\n", 204 181 ntf.rf_tech_specific_params_len); 205 182 ··· 237 204 ntf.activation_params_len); 238 205 239 206 if (ntf.activation_params_len > 0) { 240 - switch (ntf.rf_interface_type) { 207 + switch (ntf.rf_interface) { 241 208 case NCI_RF_INTERFACE_ISO_DEP: 242 209 err = nci_extract_activation_params_iso_dep(ndev, 243 210 &ntf, data); ··· 248 215 break; 249 216 250 217 default: 251 - pr_err("unsupported rf_interface_type 0x%x\n", 252 - ntf.rf_interface_type); 218 + pr_err("unsupported rf_interface 0x%x\n", 219 + ntf.rf_interface); 253 220 return; 254 221 } 255 222 } ··· 277 244 ndev->rx_data_reassembly = 0; 278 245 } 279 246 280 - /* set the available credits to initial value */ 281 - atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 282 - 283 247 /* complete the data exchange transaction, if exists */ 284 248 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) 285 249 nci_data_exchange_complete(ndev, NULL, -EIO); ··· 298 268 switch (ntf_opcode) { 299 269 case NCI_OP_CORE_CONN_CREDITS_NTF: 300 270 nci_core_conn_credits_ntf_packet(ndev, skb); 271 + break; 272 + 273 + case NCI_OP_CORE_INTF_ERROR_NTF: 274 + nci_core_conn_intf_error_ntf_packet(ndev, skb); 301 275 break; 302 276 303 277 case NCI_OP_RF_INTF_ACTIVATED_NTF:
-10
net/nfc/nci/rsp.c
··· 86 86 rsp_2->max_ctrl_pkt_payload_len; 87 87 ndev->max_size_for_large_params = 88 88 __le16_to_cpu(rsp_2->max_size_for_large_params); 89 - ndev->max_data_pkt_payload_size = 90 - rsp_2->max_data_pkt_payload_size; 91 - ndev->initial_num_credits = 92 - rsp_2->initial_num_credits; 93 89 ndev->manufact_id = 94 90 rsp_2->manufact_id; 95 91 ndev->manufact_specific_info = 96 92 __le32_to_cpu(rsp_2->manufact_specific_info); 97 - 98 - atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 99 93 100 94 pr_debug("nfcc_features 0x%x\n", 101 95 ndev->nfcc_features); ··· 111 117 ndev->max_ctrl_pkt_payload_len); 112 118 pr_debug("max_size_for_large_params %d\n", 113 119 ndev->max_size_for_large_params); 114 - pr_debug("max_data_pkt_payload_size %d\n", 115 - ndev->max_data_pkt_payload_size); 116 - pr_debug("initial_num_credits %d\n", 117 - ndev->initial_num_credits); 118 120 pr_debug("manufact_id 0x%x\n", 119 121 ndev->manufact_id); 120 122 pr_debug("manufact_specific_info 0x%x\n",
+3
net/nfc/netlink.c
··· 67 67 target->supported_protocols); 68 68 NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res); 69 69 NLA_PUT_U8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res); 70 + if (target->nfcid1_len > 0) 71 + NLA_PUT(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, 72 + target->nfcid1); 70 73 71 74 return genlmsg_end(msg, hdr); 72 75
+1 -1
net/rfkill/rfkill-gpio.c
··· 105 105 ret = pdata->gpio_runtime_setup(pdev); 106 106 if (ret) { 107 107 pr_warn("%s: can't set up gpio\n", __func__); 108 - return ret; 108 + goto fail_alloc; 109 109 } 110 110 } 111 111
+10 -3
net/wireless/genregdb.awk
··· 7 7 # 8 8 # Copyright 2009 John W. Linville <linville@tuxdriver.com> 9 9 # 10 - # This program is free software; you can redistribute it and/or modify 11 - # it under the terms of the GNU General Public License version 2 as 12 - # published by the Free Software Foundation. 10 + # Permission to use, copy, modify, and/or distribute this software for any 11 + # purpose with or without fee is hereby granted, provided that the above 12 + # copyright notice and this permission notice appear in all copies. 13 13 # 14 + # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15 + # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16 + # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17 + # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18 + # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 + # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 21 15 22 BEGIN { 16 23 active = 0
+26 -14
net/wireless/reg.c
··· 2 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 3 * Copyright 2005-2006, Devicescape Software, Inc. 4 4 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 5 - * Copyright 2008 Luis R. Rodriguez <lrodriguz@atheros.com> 5 + * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> 6 6 * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 7 + * Permission to use, copy, modify, and/or distribute this software for any 8 + * purpose with or without fee is hereby granted, provided that the above 9 + * copyright notice and this permission notice appear in all copies. 10 + * 11 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 10 18 */ 19 + 11 20 12 21 /** 13 22 * DOC: Wireless regulatory infrastructure ··· 1489 1480 } 1490 1481 1491 1482 /* This processes *all* regulatory hints */ 1492 - static void reg_process_hint(struct regulatory_request *reg_request) 1483 + static void reg_process_hint(struct regulatory_request *reg_request, 1484 + enum nl80211_reg_initiator reg_initiator) 1493 1485 { 1494 1486 int r = 0; 1495 1487 struct wiphy *wiphy = NULL; 1496 - enum nl80211_reg_initiator initiator = reg_request->initiator; 1497 1488 1498 1489 BUG_ON(!reg_request->alpha2); 1499 1490 1500 1491 if (wiphy_idx_valid(reg_request->wiphy_idx)) 1501 1492 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); 1502 1493 1503 - if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && 1494 + if (reg_initiator == NL80211_REGDOM_SET_BY_DRIVER && 1504 1495 !wiphy) { 1505 1496 kfree(reg_request); 1506 1497 return; ··· 1510 1501 /* This is required so that the orig_* parameters are saved */ 1511 1502 if (r == -EALREADY && wiphy && 1512 1503 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { 1513 - wiphy_update_regulatory(wiphy, initiator); 1504 + wiphy_update_regulatory(wiphy, reg_initiator); 1514 1505 return; 1515 1506 } 1516 1507 ··· 1519 1510 * source of bogus requests. 1520 1511 */ 1521 1512 if (r != -EALREADY && 1522 - reg_request->initiator == NL80211_REGDOM_SET_BY_USER) 1513 + reg_initiator == NL80211_REGDOM_SET_BY_USER) 1523 1514 schedule_delayed_work(&reg_timeout, msecs_to_jiffies(3142)); 1524 1515 } 1525 1516 ··· 1556 1547 1557 1548 spin_unlock(&reg_requests_lock); 1558 1549 1559 - reg_process_hint(reg_request); 1550 + reg_process_hint(reg_request, reg_request->initiator); 1560 1551 1561 1552 out: 1562 1553 mutex_unlock(&reg_mutex); ··· 1839 1830 static void restore_regulatory_settings(bool reset_user) 1840 1831 { 1841 1832 char alpha2[2]; 1833 + char world_alpha2[2]; 1842 1834 struct reg_beacon *reg_beacon, *btmp; 1843 1835 struct regulatory_request *reg_request, *tmp; 1844 1836 LIST_HEAD(tmp_reg_req_list); ··· 1891 1881 1892 1882 /* First restore to the basic regulatory settings */ 1893 1883 cfg80211_regdomain = cfg80211_world_regdom; 1884 + world_alpha2[0] = cfg80211_regdomain->alpha2[0]; 1885 + world_alpha2[1] = cfg80211_regdomain->alpha2[1]; 1894 1886 1895 1887 list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 1896 1888 if (rdev->wiphy.flags & WIPHY_FLAG_CUSTOM_REGULATORY) ··· 1902 1890 mutex_unlock(&reg_mutex); 1903 1891 mutex_unlock(&cfg80211_mutex); 1904 1892 1905 - regulatory_hint_core(cfg80211_regdomain->alpha2); 1893 + regulatory_hint_core(world_alpha2); 1906 1894 1907 1895 /* 1908 1896 * This restores the ieee80211_regdom module parameter ··· 1999 1987 const struct ieee80211_freq_range *freq_range = NULL; 2000 1988 const struct ieee80211_power_rule *power_rule = NULL; 2001 1989 2002 - pr_info(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)\n"); 1990 + pr_info(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)\n"); 2003 1991 2004 1992 for (i = 0; i < rd->n_reg_rules; i++) { 2005 1993 reg_rule = &rd->reg_rules[i]; ··· 2011 1999 * in certain regions 2012 2000 */ 2013 2001 if (power_rule->max_antenna_gain) 2014 - pr_info(" (%d KHz - %d KHz @ %d KHz), (%d mBi, %d mBm)\n", 2002 + pr_info(" (%d KHz - %d KHz @ %d KHz), (%d mBi, %d mBm)\n", 2015 2003 freq_range->start_freq_khz, 2016 2004 freq_range->end_freq_khz, 2017 2005 freq_range->max_bandwidth_khz, 2018 2006 power_rule->max_antenna_gain, 2019 2007 power_rule->max_eirp); 2020 2008 else 2021 - pr_info(" (%d KHz - %d KHz @ %d KHz), (N/A, %d mBm)\n", 2009 + pr_info(" (%d KHz - %d KHz @ %d KHz), (N/A, %d mBm)\n", 2022 2010 freq_range->start_freq_khz, 2023 2011 freq_range->end_freq_khz, 2024 2012 freq_range->max_bandwidth_khz,
+15
net/wireless/reg.h
··· 1 1 #ifndef __NET_WIRELESS_REG_H 2 2 #define __NET_WIRELESS_REG_H 3 + /* 4 + * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> 5 + * 6 + * Permission to use, copy, modify, and/or distribute this software for any 7 + * purpose with or without fee is hereby granted, provided that the above 8 + * copyright notice and this permission notice appear in all copies. 9 + * 10 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 + */ 3 18 4 19 extern const struct ieee80211_regdomain *cfg80211_regdomain; 5 20
+16
net/wireless/regdb.h
··· 1 1 #ifndef __REGDB_H__ 2 2 #define __REGDB_H__ 3 3 4 + /* 5 + * Copyright 2009 John W. Linville <linville@tuxdriver.com> 6 + * 7 + * Permission to use, copy, modify, and/or distribute this software for any 8 + * purpose with or without fee is hereby granted, provided that the above 9 + * copyright notice and this permission notice appear in all copies. 10 + * 11 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 + */ 19 + 4 20 extern const struct ieee80211_regdomain *reg_regdb[]; 5 21 extern int reg_regdb_size; 6 22
+5 -1
net/wireless/util.c
··· 9 9 #include <linux/slab.h> 10 10 #include <net/cfg80211.h> 11 11 #include <net/ip.h> 12 + #include <net/dsfield.h> 12 13 #include "core.h" 13 14 14 15 struct ieee80211_rate * ··· 651 650 652 651 switch (skb->protocol) { 653 652 case htons(ETH_P_IP): 654 - dscp = ip_hdr(skb)->tos & 0xfc; 653 + dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc; 654 + break; 655 + case htons(ETH_P_IPV6): 656 + dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc; 655 657 break; 656 658 default: 657 659 return 0;