mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-13 08:39:52 +00:00
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
This commit is contained in:
commit
87bc0728d4
@ -57,7 +57,7 @@ struct ath3k_version {
|
||||
unsigned char reserved[0x07];
|
||||
};
|
||||
|
||||
static struct usb_device_id ath3k_table[] = {
|
||||
static const struct usb_device_id ath3k_table[] = {
|
||||
/* Atheros AR3011 */
|
||||
{ USB_DEVICE(0x0CF3, 0x3000) },
|
||||
|
||||
@ -112,7 +112,7 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
|
||||
#define BTUSB_ATH3012 0x80
|
||||
/* This table is to load patch and sysconfig files
|
||||
* for AR3012 */
|
||||
static struct usb_device_id ath3k_blist_tbl[] = {
|
||||
static const struct usb_device_id ath3k_blist_tbl[] = {
|
||||
|
||||
/* Atheros AR3012 with sflash firmware*/
|
||||
{ USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
static struct usb_driver bfusb_driver;
|
||||
|
||||
static struct usb_device_id bfusb_table[] = {
|
||||
static const struct usb_device_id bfusb_table[] = {
|
||||
/* AVM BlueFRITZ! USB */
|
||||
{ USB_DEVICE(0x057c, 0x2200) },
|
||||
|
||||
@ -318,7 +318,6 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
skb->dev = (void *) data->hdev;
|
||||
bt_cb(skb)->pkt_type = pkt_type;
|
||||
|
||||
data->reassembly = skb;
|
||||
@ -333,7 +332,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
|
||||
memcpy(skb_put(data->reassembly, len), buf, len);
|
||||
|
||||
if (hdr & 0x08) {
|
||||
hci_recv_frame(data->reassembly);
|
||||
hci_recv_frame(data->hdev, data->reassembly);
|
||||
data->reassembly = NULL;
|
||||
}
|
||||
|
||||
@ -465,26 +464,18 @@ static int bfusb_close(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bfusb_send_frame(struct sk_buff *skb)
|
||||
static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev = (struct hci_dev *) skb->dev;
|
||||
struct bfusb_data *data;
|
||||
struct bfusb_data *data = hci_get_drvdata(hdev);
|
||||
struct sk_buff *nskb;
|
||||
unsigned char buf[3];
|
||||
int sent = 0, size, count;
|
||||
|
||||
BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len);
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
data = hci_get_drvdata(hdev);
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
hdev->stat.cmd_tx++;
|
||||
@ -544,11 +535,6 @@ static int bfusb_send_frame(struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
static int bfusb_load_firmware(struct bfusb_data *data,
|
||||
const unsigned char *firmware, int count)
|
||||
{
|
||||
@ -699,11 +685,10 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
|
||||
hci_set_drvdata(hdev, data);
|
||||
SET_HCIDEV_DEV(hdev, &intf->dev);
|
||||
|
||||
hdev->open = bfusb_open;
|
||||
hdev->close = bfusb_close;
|
||||
hdev->flush = bfusb_flush;
|
||||
hdev->send = bfusb_send_frame;
|
||||
hdev->ioctl = bfusb_ioctl;
|
||||
hdev->open = bfusb_open;
|
||||
hdev->close = bfusb_close;
|
||||
hdev->flush = bfusb_flush;
|
||||
hdev->send = bfusb_send_frame;
|
||||
|
||||
if (hci_register_dev(hdev) < 0) {
|
||||
BT_ERR("Can't register HCI device");
|
||||
|
@ -399,7 +399,6 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
|
||||
|
||||
if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
|
||||
|
||||
info->rx_skb->dev = (void *) info->hdev;
|
||||
bt_cb(info->rx_skb)->pkt_type = buf[i];
|
||||
|
||||
switch (bt_cb(info->rx_skb)->pkt_type) {
|
||||
@ -477,7 +476,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
|
||||
break;
|
||||
|
||||
case RECV_WAIT_DATA:
|
||||
hci_recv_frame(info->rx_skb);
|
||||
hci_recv_frame(info->hdev, info->rx_skb);
|
||||
info->rx_skb = NULL;
|
||||
break;
|
||||
|
||||
@ -659,17 +658,9 @@ static int bluecard_hci_close(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
|
||||
static int bluecard_hci_send_frame(struct sk_buff *skb)
|
||||
static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
bluecard_info_t *info;
|
||||
struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
info = hci_get_drvdata(hdev);
|
||||
bluecard_info_t *info = hci_get_drvdata(hdev);
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
@ -693,12 +684,6 @@ static int bluecard_hci_send_frame(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
|
||||
static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ======================== Card services HCI interaction ======================== */
|
||||
|
||||
@ -734,11 +719,10 @@ static int bluecard_open(bluecard_info_t *info)
|
||||
hci_set_drvdata(hdev, info);
|
||||
SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
|
||||
|
||||
hdev->open = bluecard_hci_open;
|
||||
hdev->close = bluecard_hci_close;
|
||||
hdev->flush = bluecard_hci_flush;
|
||||
hdev->send = bluecard_hci_send_frame;
|
||||
hdev->ioctl = bluecard_hci_ioctl;
|
||||
hdev->open = bluecard_hci_open;
|
||||
hdev->close = bluecard_hci_close;
|
||||
hdev->flush = bluecard_hci_flush;
|
||||
hdev->send = bluecard_hci_send_frame;
|
||||
|
||||
id = inb(iobase + 0x30);
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#define VERSION "0.10"
|
||||
|
||||
static struct usb_device_id bpa10x_table[] = {
|
||||
static const struct usb_device_id bpa10x_table[] = {
|
||||
/* Tektronix BPA 100/105 (Digianswer) */
|
||||
{ USB_DEVICE(0x08fd, 0x0002) },
|
||||
|
||||
@ -129,8 +129,6 @@ static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
skb->dev = (void *) hdev;
|
||||
|
||||
data->rx_skb[queue] = skb;
|
||||
|
||||
scb = (void *) skb->cb;
|
||||
@ -155,7 +153,7 @@ static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
|
||||
data->rx_skb[queue] = NULL;
|
||||
|
||||
bt_cb(skb)->pkt_type = scb->type;
|
||||
hci_recv_frame(skb);
|
||||
hci_recv_frame(hdev, skb);
|
||||
}
|
||||
|
||||
count -= len; buf += len;
|
||||
@ -352,9 +350,8 @@ static int bpa10x_flush(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bpa10x_send_frame(struct sk_buff *skb)
|
||||
static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev = (struct hci_dev *) skb->dev;
|
||||
struct bpa10x_data *data = hci_get_drvdata(hdev);
|
||||
struct usb_ctrlrequest *dr;
|
||||
struct urb *urb;
|
||||
@ -366,6 +363,8 @@ static int bpa10x_send_frame(struct sk_buff *skb)
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
skb->dev = (void *) hdev;
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb)
|
||||
return -ENOMEM;
|
||||
|
@ -247,7 +247,6 @@ static void bt3c_receive(bt3c_info_t *info)
|
||||
|
||||
if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
|
||||
|
||||
info->rx_skb->dev = (void *) info->hdev;
|
||||
bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L);
|
||||
inb(iobase + DATA_H);
|
||||
//printk("bt3c: PACKET_TYPE=%02x\n", bt_cb(info->rx_skb)->pkt_type);
|
||||
@ -318,7 +317,7 @@ static void bt3c_receive(bt3c_info_t *info)
|
||||
break;
|
||||
|
||||
case RECV_WAIT_DATA:
|
||||
hci_recv_frame(info->rx_skb);
|
||||
hci_recv_frame(info->hdev, info->rx_skb);
|
||||
info->rx_skb = NULL;
|
||||
break;
|
||||
|
||||
@ -416,19 +415,11 @@ static int bt3c_hci_close(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
|
||||
static int bt3c_hci_send_frame(struct sk_buff *skb)
|
||||
static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
bt3c_info_t *info;
|
||||
struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
|
||||
bt3c_info_t *info = hci_get_drvdata(hdev);
|
||||
unsigned long flags;
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
info = hci_get_drvdata(hdev);
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
hdev->stat.cmd_tx++;
|
||||
@ -455,12 +446,6 @@ static int bt3c_hci_send_frame(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
|
||||
static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ======================== Card services HCI interaction ======================== */
|
||||
|
||||
@ -577,11 +562,10 @@ static int bt3c_open(bt3c_info_t *info)
|
||||
hci_set_drvdata(hdev, info);
|
||||
SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
|
||||
|
||||
hdev->open = bt3c_hci_open;
|
||||
hdev->close = bt3c_hci_close;
|
||||
hdev->flush = bt3c_hci_flush;
|
||||
hdev->send = bt3c_hci_send_frame;
|
||||
hdev->ioctl = bt3c_hci_ioctl;
|
||||
hdev->open = bt3c_hci_open;
|
||||
hdev->close = bt3c_hci_close;
|
||||
hdev->flush = bt3c_hci_flush;
|
||||
hdev->send = bt3c_hci_send_frame;
|
||||
|
||||
/* Load firmware */
|
||||
err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev);
|
||||
|
@ -187,7 +187,6 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 cmd_no,
|
||||
|
||||
bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
|
||||
|
||||
skb->dev = (void *) priv->btmrvl_dev.hcidev;
|
||||
skb_queue_head(&priv->adapter->tx_queue, skb);
|
||||
|
||||
priv->btmrvl_dev.sendcmdflag = true;
|
||||
@ -356,26 +355,12 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv)
|
||||
priv->adapter = NULL;
|
||||
}
|
||||
|
||||
static int btmrvl_ioctl(struct hci_dev *hdev,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
static int btmrvl_send_frame(struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev = (struct hci_dev *) skb->dev;
|
||||
struct btmrvl_private *priv = NULL;
|
||||
struct btmrvl_private *priv = hci_get_drvdata(hdev);
|
||||
|
||||
BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
priv = hci_get_drvdata(hdev);
|
||||
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags)) {
|
||||
BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags);
|
||||
print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET,
|
||||
@ -650,12 +635,11 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
|
||||
priv->btmrvl_dev.hcidev = hdev;
|
||||
hci_set_drvdata(hdev, priv);
|
||||
|
||||
hdev->bus = HCI_SDIO;
|
||||
hdev->open = btmrvl_open;
|
||||
hdev->bus = HCI_SDIO;
|
||||
hdev->open = btmrvl_open;
|
||||
hdev->close = btmrvl_close;
|
||||
hdev->flush = btmrvl_flush;
|
||||
hdev->send = btmrvl_send_frame;
|
||||
hdev->ioctl = btmrvl_ioctl;
|
||||
hdev->send = btmrvl_send_frame;
|
||||
hdev->setup = btmrvl_setup;
|
||||
|
||||
hdev->dev_type = priv->btmrvl_dev.dev_type;
|
||||
|
@ -600,15 +600,14 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
|
||||
case HCI_SCODATA_PKT:
|
||||
case HCI_EVENT_PKT:
|
||||
bt_cb(skb)->pkt_type = type;
|
||||
skb->dev = (void *)hdev;
|
||||
skb_put(skb, buf_len);
|
||||
skb_pull(skb, SDIO_HEADER_LEN);
|
||||
|
||||
if (type == HCI_EVENT_PKT) {
|
||||
if (btmrvl_check_evtpkt(priv, skb))
|
||||
hci_recv_frame(skb);
|
||||
hci_recv_frame(hdev, skb);
|
||||
} else {
|
||||
hci_recv_frame(skb);
|
||||
hci_recv_frame(hdev, skb);
|
||||
}
|
||||
|
||||
hdev->stat.byte_rx += buf_len;
|
||||
@ -616,12 +615,11 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
|
||||
|
||||
case MRVL_VENDOR_PKT:
|
||||
bt_cb(skb)->pkt_type = HCI_VENDOR_PKT;
|
||||
skb->dev = (void *)hdev;
|
||||
skb_put(skb, buf_len);
|
||||
skb_pull(skb, SDIO_HEADER_LEN);
|
||||
|
||||
if (btmrvl_process_event(priv, skb))
|
||||
hci_recv_frame(skb);
|
||||
hci_recv_frame(hdev, skb);
|
||||
|
||||
hdev->stat.byte_rx += buf_len;
|
||||
break;
|
||||
|
@ -157,10 +157,9 @@ static int btsdio_rx_packet(struct btsdio_data *data)
|
||||
|
||||
data->hdev->stat.byte_rx += len;
|
||||
|
||||
skb->dev = (void *) data->hdev;
|
||||
bt_cb(skb)->pkt_type = hdr[3];
|
||||
|
||||
err = hci_recv_frame(skb);
|
||||
err = hci_recv_frame(data->hdev, skb);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@ -255,9 +254,8 @@ static int btsdio_flush(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btsdio_send_frame(struct sk_buff *skb)
|
||||
static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev = (struct hci_dev *) skb->dev;
|
||||
struct btsdio_data *data = hci_get_drvdata(hdev);
|
||||
|
||||
BT_DBG("%s", hdev->name);
|
||||
|
@ -198,7 +198,6 @@ static void btuart_receive(btuart_info_t *info)
|
||||
|
||||
if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
|
||||
|
||||
info->rx_skb->dev = (void *) info->hdev;
|
||||
bt_cb(info->rx_skb)->pkt_type = inb(iobase + UART_RX);
|
||||
|
||||
switch (bt_cb(info->rx_skb)->pkt_type) {
|
||||
@ -265,7 +264,7 @@ static void btuart_receive(btuart_info_t *info)
|
||||
break;
|
||||
|
||||
case RECV_WAIT_DATA:
|
||||
hci_recv_frame(info->rx_skb);
|
||||
hci_recv_frame(info->hdev, info->rx_skb);
|
||||
info->rx_skb = NULL;
|
||||
break;
|
||||
|
||||
@ -424,17 +423,9 @@ static int btuart_hci_close(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
|
||||
static int btuart_hci_send_frame(struct sk_buff *skb)
|
||||
static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
btuart_info_t *info;
|
||||
struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
info = hci_get_drvdata(hdev);
|
||||
btuart_info_t *info = hci_get_drvdata(hdev);
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
@ -458,12 +449,6 @@ static int btuart_hci_send_frame(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
|
||||
static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ======================== Card services HCI interaction ======================== */
|
||||
|
||||
@ -495,11 +480,10 @@ static int btuart_open(btuart_info_t *info)
|
||||
hci_set_drvdata(hdev, info);
|
||||
SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
|
||||
|
||||
hdev->open = btuart_hci_open;
|
||||
hdev->close = btuart_hci_close;
|
||||
hdev->flush = btuart_hci_flush;
|
||||
hdev->send = btuart_hci_send_frame;
|
||||
hdev->ioctl = btuart_hci_ioctl;
|
||||
hdev->open = btuart_hci_open;
|
||||
hdev->close = btuart_hci_close;
|
||||
hdev->flush = btuart_hci_flush;
|
||||
hdev->send = btuart_hci_send_frame;
|
||||
|
||||
spin_lock_irqsave(&(info->lock), flags);
|
||||
|
||||
|
@ -50,7 +50,7 @@ static struct usb_driver btusb_driver;
|
||||
#define BTUSB_ATH3012 0x80
|
||||
#define BTUSB_INTEL 0x100
|
||||
|
||||
static struct usb_device_id btusb_table[] = {
|
||||
static const struct usb_device_id btusb_table[] = {
|
||||
/* Generic Bluetooth USB device */
|
||||
{ USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
|
||||
|
||||
@ -121,7 +121,7 @@ static struct usb_device_id btusb_table[] = {
|
||||
|
||||
MODULE_DEVICE_TABLE(usb, btusb_table);
|
||||
|
||||
static struct usb_device_id blacklist_table[] = {
|
||||
static const struct usb_device_id blacklist_table[] = {
|
||||
/* CSR BlueCore devices */
|
||||
{ USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR },
|
||||
|
||||
@ -716,9 +716,8 @@ static int btusb_flush(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btusb_send_frame(struct sk_buff *skb)
|
||||
static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev = (struct hci_dev *) skb->dev;
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
struct usb_ctrlrequest *dr;
|
||||
struct urb *urb;
|
||||
@ -730,6 +729,8 @@ static int btusb_send_frame(struct sk_buff *skb)
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
skb->dev = (void *) hdev;
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
@ -774,7 +775,7 @@ static int btusb_send_frame(struct sk_buff *skb)
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)
|
||||
if (!data->isoc_tx_ep || hci_conn_num(hdev, SCO_LINK) < 1)
|
||||
return -ENODEV;
|
||||
|
||||
urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
|
||||
@ -833,8 +834,8 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
|
||||
|
||||
BT_DBG("%s evt %d", hdev->name, evt);
|
||||
|
||||
if (hdev->conn_hash.sco_num != data->sco_num) {
|
||||
data->sco_num = hdev->conn_hash.sco_num;
|
||||
if (hci_conn_num(hdev, SCO_LINK) != data->sco_num) {
|
||||
data->sco_num = hci_conn_num(hdev, SCO_LINK);
|
||||
schedule_work(&data->work);
|
||||
}
|
||||
}
|
||||
@ -889,7 +890,7 @@ static void btusb_work(struct work_struct *work)
|
||||
int new_alts;
|
||||
int err;
|
||||
|
||||
if (hdev->conn_hash.sco_num > 0) {
|
||||
if (data->sco_num > 0) {
|
||||
if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
|
||||
err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
|
||||
if (err < 0) {
|
||||
@ -903,9 +904,9 @@ static void btusb_work(struct work_struct *work)
|
||||
|
||||
if (hdev->voice_setting & 0x0020) {
|
||||
static const int alts[3] = { 2, 4, 5 };
|
||||
new_alts = alts[hdev->conn_hash.sco_num - 1];
|
||||
new_alts = alts[data->sco_num - 1];
|
||||
} else {
|
||||
new_alts = hdev->conn_hash.sco_num;
|
||||
new_alts = data->sco_num;
|
||||
}
|
||||
|
||||
if (data->isoc_altsetting != new_alts) {
|
||||
|
@ -108,10 +108,8 @@ static long st_receive(void *priv_data, struct sk_buff *skb)
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
skb->dev = (void *) lhst->hdev;
|
||||
|
||||
/* Forward skb to HCI core layer */
|
||||
err = hci_recv_frame(skb);
|
||||
err = hci_recv_frame(lhst->hdev, skb);
|
||||
if (err < 0) {
|
||||
BT_ERR("Unable to push skb to HCI core(%d)", err);
|
||||
return err;
|
||||
@ -253,14 +251,11 @@ static int ti_st_close(struct hci_dev *hdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ti_st_send_frame(struct sk_buff *skb)
|
||||
static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev *hdev;
|
||||
struct ti_st *hst;
|
||||
long len;
|
||||
|
||||
hdev = (struct hci_dev *)skb->dev;
|
||||
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
|
@ -256,9 +256,8 @@ static void dtl1_receive(dtl1_info_t *info)
|
||||
case 0x83:
|
||||
case 0x84:
|
||||
/* send frame to the HCI layer */
|
||||
info->rx_skb->dev = (void *) info->hdev;
|
||||
bt_cb(info->rx_skb)->pkt_type &= 0x0f;
|
||||
hci_recv_frame(info->rx_skb);
|
||||
hci_recv_frame(info->hdev, info->rx_skb);
|
||||
break;
|
||||
default:
|
||||
/* unknown packet */
|
||||
@ -383,20 +382,12 @@ static int dtl1_hci_close(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
|
||||
static int dtl1_hci_send_frame(struct sk_buff *skb)
|
||||
static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
dtl1_info_t *info;
|
||||
struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
|
||||
dtl1_info_t *info = hci_get_drvdata(hdev);
|
||||
struct sk_buff *s;
|
||||
nsh_t nsh;
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
info = hci_get_drvdata(hdev);
|
||||
|
||||
switch (bt_cb(skb)->pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
hdev->stat.cmd_tx++;
|
||||
@ -438,12 +429,6 @@ static int dtl1_hci_send_frame(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
|
||||
static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ======================== Card services HCI interaction ======================== */
|
||||
|
||||
@ -477,11 +462,10 @@ static int dtl1_open(dtl1_info_t *info)
|
||||
hci_set_drvdata(hdev, info);
|
||||
SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
|
||||
|
||||
hdev->open = dtl1_hci_open;
|
||||
hdev->close = dtl1_hci_close;
|
||||
hdev->flush = dtl1_hci_flush;
|
||||
hdev->send = dtl1_hci_send_frame;
|
||||
hdev->ioctl = dtl1_hci_ioctl;
|
||||
hdev->open = dtl1_hci_open;
|
||||
hdev->close = dtl1_hci_close;
|
||||
hdev->flush = dtl1_hci_flush;
|
||||
hdev->send = dtl1_hci_send_frame;
|
||||
|
||||
spin_lock_irqsave(&(info->lock), flags);
|
||||
|
||||
|
@ -522,7 +522,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
|
||||
memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE);
|
||||
bt_cb(bcsp->rx_skb)->pkt_type = HCI_EVENT_PKT;
|
||||
|
||||
hci_recv_frame(bcsp->rx_skb);
|
||||
hci_recv_frame(hu->hdev, bcsp->rx_skb);
|
||||
} else {
|
||||
BT_ERR ("Packet for unknown channel (%u %s)",
|
||||
bcsp->rx_skb->data[1] & 0x0f,
|
||||
@ -536,7 +536,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
|
||||
/* Pull out BCSP hdr */
|
||||
skb_pull(bcsp->rx_skb, 4);
|
||||
|
||||
hci_recv_frame(bcsp->rx_skb);
|
||||
hci_recv_frame(hu->hdev, bcsp->rx_skb);
|
||||
}
|
||||
|
||||
bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
|
||||
@ -655,7 +655,6 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)
|
||||
bcsp->rx_count = 0;
|
||||
return 0;
|
||||
}
|
||||
bcsp->rx_skb->dev = (void *) hu->hdev;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -124,30 +124,6 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int h4_check_data_len(struct h4_struct *h4, int len)
|
||||
{
|
||||
int room = skb_tailroom(h4->rx_skb);
|
||||
|
||||
BT_DBG("len %d room %d", len, room);
|
||||
|
||||
if (!len) {
|
||||
hci_recv_frame(h4->rx_skb);
|
||||
} else if (len > room) {
|
||||
BT_ERR("Data length is too large");
|
||||
kfree_skb(h4->rx_skb);
|
||||
} else {
|
||||
h4->rx_state = H4_W4_DATA;
|
||||
h4->rx_count = len;
|
||||
return len;
|
||||
}
|
||||
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_skb = NULL;
|
||||
h4->rx_count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Recv data */
|
||||
static int h4_recv(struct hci_uart *hu, void *data, int count)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)
|
||||
/* Remove Three-wire header */
|
||||
skb_pull(h5->rx_skb, 4);
|
||||
|
||||
hci_recv_frame(h5->rx_skb);
|
||||
hci_recv_frame(hu->hdev, h5->rx_skb);
|
||||
h5->rx_skb = NULL;
|
||||
|
||||
break;
|
||||
|
@ -234,21 +234,13 @@ static int hci_uart_close(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
/* Send frames from HCI layer */
|
||||
static int hci_uart_send_frame(struct sk_buff *skb)
|
||||
static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev* hdev = (struct hci_dev *) skb->dev;
|
||||
struct hci_uart *hu;
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
hu = hci_get_drvdata(hdev);
|
||||
|
||||
BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len);
|
||||
|
||||
hu->proto->enqueue(hu, skb);
|
||||
|
@ -110,7 +110,6 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu)
|
||||
/* prepare packet */
|
||||
hcill_packet = (struct hcill_cmd *) skb_put(skb, 1);
|
||||
hcill_packet->cmd = cmd;
|
||||
skb->dev = (void *) hu->hdev;
|
||||
|
||||
/* send packet */
|
||||
skb_queue_tail(&ll->txq, skb);
|
||||
@ -346,14 +345,14 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ll_check_data_len(struct ll_struct *ll, int len)
|
||||
static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll, int len)
|
||||
{
|
||||
int room = skb_tailroom(ll->rx_skb);
|
||||
|
||||
BT_DBG("len %d room %d", len, room);
|
||||
|
||||
if (!len) {
|
||||
hci_recv_frame(ll->rx_skb);
|
||||
hci_recv_frame(hdev, ll->rx_skb);
|
||||
} else if (len > room) {
|
||||
BT_ERR("Data length is too large");
|
||||
kfree_skb(ll->rx_skb);
|
||||
@ -395,7 +394,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
|
||||
switch (ll->rx_state) {
|
||||
case HCILL_W4_DATA:
|
||||
BT_DBG("Complete data");
|
||||
hci_recv_frame(ll->rx_skb);
|
||||
hci_recv_frame(hu->hdev, ll->rx_skb);
|
||||
|
||||
ll->rx_state = HCILL_W4_PACKET_TYPE;
|
||||
ll->rx_skb = NULL;
|
||||
@ -406,7 +405,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
|
||||
|
||||
BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);
|
||||
|
||||
ll_check_data_len(ll, eh->plen);
|
||||
ll_check_data_len(hu->hdev, ll, eh->plen);
|
||||
continue;
|
||||
|
||||
case HCILL_W4_ACL_HDR:
|
||||
@ -415,7 +414,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
|
||||
|
||||
BT_DBG("ACL header: dlen %d", dlen);
|
||||
|
||||
ll_check_data_len(ll, dlen);
|
||||
ll_check_data_len(hu->hdev, ll, dlen);
|
||||
continue;
|
||||
|
||||
case HCILL_W4_SCO_HDR:
|
||||
@ -423,7 +422,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
|
||||
|
||||
BT_DBG("SCO header: dlen %d", sh->dlen);
|
||||
|
||||
ll_check_data_len(ll, sh->dlen);
|
||||
ll_check_data_len(hu->hdev, ll, sh->dlen);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -494,7 +493,6 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ll->rx_skb->dev = (void *) hu->hdev;
|
||||
bt_cb(ll->rx_skb)->pkt_type = type;
|
||||
}
|
||||
|
||||
|
@ -81,21 +81,13 @@ static int vhci_flush(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vhci_send_frame(struct sk_buff *skb)
|
||||
static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_dev* hdev = (struct hci_dev *) skb->dev;
|
||||
struct vhci_data *data;
|
||||
|
||||
if (!hdev) {
|
||||
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
|
||||
return -ENODEV;
|
||||
}
|
||||
struct vhci_data *data = hci_get_drvdata(hdev);
|
||||
|
||||
if (!test_bit(HCI_RUNNING, &hdev->flags))
|
||||
return -EBUSY;
|
||||
|
||||
data = hci_get_drvdata(hdev);
|
||||
|
||||
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
|
||||
skb_queue_tail(&data->readq, skb);
|
||||
|
||||
@ -179,10 +171,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
skb->dev = (void *) data->hdev;
|
||||
bt_cb(skb)->pkt_type = pkt_type;
|
||||
|
||||
ret = hci_recv_frame(skb);
|
||||
ret = hci_recv_frame(data->hdev, skb);
|
||||
break;
|
||||
|
||||
case HCI_VENDOR_PKT:
|
||||
|
@ -25,6 +25,23 @@ config ATH_DEBUG
|
||||
Say Y, if you want to debug atheros wireless drivers.
|
||||
Right now only ath9k makes use of this.
|
||||
|
||||
config ATH_REG_DYNAMIC_USER_REG_HINTS
|
||||
bool "Atheros dynamic user regulatory hints"
|
||||
depends on CFG80211_CERTIFICATION_ONUS
|
||||
default n
|
||||
---help---
|
||||
Say N. This should only be enabled in countries where
|
||||
this feature is explicitly allowed and only on cards that
|
||||
specifically have been tested for this.
|
||||
|
||||
config ATH_REG_DYNAMIC_USER_CERT_TESTING
|
||||
bool "Atheros dynamic user regulatory testing"
|
||||
depends on ATH_REG_DYNAMIC_USER_REG_HINTS && CFG80211_CERTIFICATION_ONUS
|
||||
default n
|
||||
---help---
|
||||
Say N. This should only be enabled on systems
|
||||
undergoing certification testing.
|
||||
|
||||
source "drivers/net/wireless/ath/ath5k/Kconfig"
|
||||
source "drivers/net/wireless/ath/ath9k/Kconfig"
|
||||
source "drivers/net/wireless/ath/carl9170/Kconfig"
|
||||
|
@ -12,7 +12,9 @@ obj-$(CONFIG_ATH_COMMON) += ath.o
|
||||
ath-objs := main.o \
|
||||
regd.o \
|
||||
hw.o \
|
||||
key.o
|
||||
key.o \
|
||||
dfs_pattern_detector.o \
|
||||
dfs_pri_detector.o
|
||||
|
||||
ath-$(CONFIG_ATH_DEBUG) += debug.o
|
||||
ccflags-y += -D__CHECK_ENDIAN__
|
||||
|
@ -283,7 +283,7 @@ static int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
|
||||
|
||||
if (unlikely(CE_RING_DELTA(nentries_mask,
|
||||
write_index, sw_index - 1) <= 0)) {
|
||||
ret = -EIO;
|
||||
ret = -ENOSR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -338,38 +338,19 @@ int ath10k_ce_send(struct ath10k_ce_pipe *ce_state,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ath10k_ce_sendlist_send(struct ath10k_ce_pipe *ce_state,
|
||||
void *per_transfer_context,
|
||||
unsigned int transfer_id,
|
||||
u32 paddr, unsigned int nbytes,
|
||||
u32 flags)
|
||||
int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe)
|
||||
{
|
||||
struct ath10k_ce_ring *src_ring = ce_state->src_ring;
|
||||
struct ath10k *ar = ce_state->ar;
|
||||
struct ath10k *ar = pipe->ar;
|
||||
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
||||
unsigned int nentries_mask = src_ring->nentries_mask;
|
||||
unsigned int sw_index;
|
||||
unsigned int write_index;
|
||||
int delta, ret = -ENOMEM;
|
||||
int delta;
|
||||
|
||||
spin_lock_bh(&ar_pci->ce_lock);
|
||||
|
||||
sw_index = src_ring->sw_index;
|
||||
write_index = src_ring->write_index;
|
||||
|
||||
delta = CE_RING_DELTA(nentries_mask, write_index, sw_index - 1);
|
||||
|
||||
if (delta >= 1) {
|
||||
ret = ath10k_ce_send_nolock(ce_state, per_transfer_context,
|
||||
paddr, nbytes,
|
||||
transfer_id, flags);
|
||||
if (ret)
|
||||
ath10k_warn("CE send failed: %d\n", ret);
|
||||
}
|
||||
|
||||
delta = CE_RING_DELTA(pipe->src_ring->nentries_mask,
|
||||
pipe->src_ring->write_index,
|
||||
pipe->src_ring->sw_index - 1);
|
||||
spin_unlock_bh(&ar_pci->ce_lock);
|
||||
|
||||
return ret;
|
||||
return delta;
|
||||
}
|
||||
|
||||
int ath10k_ce_recv_buf_enqueue(struct ath10k_ce_pipe *ce_state,
|
||||
|
@ -156,21 +156,7 @@ void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state,
|
||||
void (*send_cb)(struct ath10k_ce_pipe *),
|
||||
int disable_interrupts);
|
||||
|
||||
/*
|
||||
* Queue a "sendlist" of buffers to be sent using gather to a single
|
||||
* anonymous destination buffer
|
||||
* ce - which copy engine to use
|
||||
* sendlist - list of simple buffers to send using gather
|
||||
* transfer_id - arbitrary ID; reflected to destination
|
||||
* Returns 0 on success; otherwise an error status.
|
||||
*
|
||||
* Implemenation note: Pushes multiple buffers with Gather to Source ring.
|
||||
*/
|
||||
int ath10k_ce_sendlist_send(struct ath10k_ce_pipe *ce_state,
|
||||
void *per_transfer_context,
|
||||
unsigned int transfer_id,
|
||||
u32 paddr, unsigned int nbytes,
|
||||
u32 flags);
|
||||
int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe);
|
||||
|
||||
/*==================Recv=======================*/
|
||||
|
||||
|
@ -59,27 +59,6 @@ static void ath10k_send_suspend_complete(struct ath10k *ar)
|
||||
wake_up(&ar->event_queue);
|
||||
}
|
||||
|
||||
static int ath10k_check_fw_version(struct ath10k *ar)
|
||||
{
|
||||
char version[32];
|
||||
|
||||
if (ar->fw_version_major >= SUPPORTED_FW_MAJOR &&
|
||||
ar->fw_version_minor >= SUPPORTED_FW_MINOR &&
|
||||
ar->fw_version_release >= SUPPORTED_FW_RELEASE &&
|
||||
ar->fw_version_build >= SUPPORTED_FW_BUILD)
|
||||
return 0;
|
||||
|
||||
snprintf(version, sizeof(version), "%u.%u.%u.%u",
|
||||
SUPPORTED_FW_MAJOR, SUPPORTED_FW_MINOR,
|
||||
SUPPORTED_FW_RELEASE, SUPPORTED_FW_BUILD);
|
||||
|
||||
ath10k_warn("WARNING: Firmware version %s is not officially supported.\n",
|
||||
ar->hw->wiphy->fw_version);
|
||||
ath10k_warn("Please upgrade to version %s (or newer)\n", version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ath10k_init_connect_htc(struct ath10k *ar)
|
||||
{
|
||||
int status;
|
||||
@ -189,8 +168,7 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
|
||||
return fw;
|
||||
}
|
||||
|
||||
static int ath10k_push_board_ext_data(struct ath10k *ar,
|
||||
const struct firmware *fw)
|
||||
static int ath10k_push_board_ext_data(struct ath10k *ar)
|
||||
{
|
||||
u32 board_data_size = QCA988X_BOARD_DATA_SZ;
|
||||
u32 board_ext_data_size = QCA988X_BOARD_EXT_DATA_SZ;
|
||||
@ -210,14 +188,14 @@ static int ath10k_push_board_ext_data(struct ath10k *ar,
|
||||
if (board_ext_data_addr == 0)
|
||||
return 0;
|
||||
|
||||
if (fw->size != (board_data_size + board_ext_data_size)) {
|
||||
if (ar->board_len != (board_data_size + board_ext_data_size)) {
|
||||
ath10k_err("invalid board (ext) data sizes %zu != %d+%d\n",
|
||||
fw->size, board_data_size, board_ext_data_size);
|
||||
ar->board_len, board_data_size, board_ext_data_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = ath10k_bmi_write_memory(ar, board_ext_data_addr,
|
||||
fw->data + board_data_size,
|
||||
ar->board_data + board_data_size,
|
||||
board_ext_data_size);
|
||||
if (ret) {
|
||||
ath10k_err("could not write board ext data (%d)\n", ret);
|
||||
@ -236,12 +214,11 @@ static int ath10k_push_board_ext_data(struct ath10k *ar,
|
||||
|
||||
static int ath10k_download_board_data(struct ath10k *ar)
|
||||
{
|
||||
const struct firmware *fw = ar->board_data;
|
||||
u32 board_data_size = QCA988X_BOARD_DATA_SZ;
|
||||
u32 address;
|
||||
int ret;
|
||||
|
||||
ret = ath10k_push_board_ext_data(ar, fw);
|
||||
ret = ath10k_push_board_ext_data(ar);
|
||||
if (ret) {
|
||||
ath10k_err("could not push board ext data (%d)\n", ret);
|
||||
goto exit;
|
||||
@ -253,8 +230,9 @@ static int ath10k_download_board_data(struct ath10k *ar)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = ath10k_bmi_write_memory(ar, address, fw->data,
|
||||
min_t(u32, board_data_size, fw->size));
|
||||
ret = ath10k_bmi_write_memory(ar, address, ar->board_data,
|
||||
min_t(u32, board_data_size,
|
||||
ar->board_len));
|
||||
if (ret) {
|
||||
ath10k_err("could not write board data (%d)\n", ret);
|
||||
goto exit;
|
||||
@ -272,17 +250,16 @@ exit:
|
||||
|
||||
static int ath10k_download_and_run_otp(struct ath10k *ar)
|
||||
{
|
||||
const struct firmware *fw = ar->otp;
|
||||
u32 address = ar->hw_params.patch_load_addr;
|
||||
u32 exec_param;
|
||||
int ret;
|
||||
|
||||
/* OTP is optional */
|
||||
|
||||
if (!ar->otp)
|
||||
if (!ar->otp_data || !ar->otp_len)
|
||||
return 0;
|
||||
|
||||
ret = ath10k_bmi_fast_download(ar, address, fw->data, fw->size);
|
||||
ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
|
||||
if (ret) {
|
||||
ath10k_err("could not write otp (%d)\n", ret);
|
||||
goto exit;
|
||||
@ -301,13 +278,13 @@ exit:
|
||||
|
||||
static int ath10k_download_fw(struct ath10k *ar)
|
||||
{
|
||||
const struct firmware *fw = ar->firmware;
|
||||
u32 address;
|
||||
int ret;
|
||||
|
||||
address = ar->hw_params.patch_load_addr;
|
||||
|
||||
ret = ath10k_bmi_fast_download(ar, address, fw->data, fw->size);
|
||||
ret = ath10k_bmi_fast_download(ar, address, ar->firmware_data,
|
||||
ar->firmware_len);
|
||||
if (ret) {
|
||||
ath10k_err("could not write fw (%d)\n", ret);
|
||||
goto exit;
|
||||
@ -319,8 +296,8 @@ exit:
|
||||
|
||||
static void ath10k_core_free_firmware_files(struct ath10k *ar)
|
||||
{
|
||||
if (ar->board_data && !IS_ERR(ar->board_data))
|
||||
release_firmware(ar->board_data);
|
||||
if (ar->board && !IS_ERR(ar->board))
|
||||
release_firmware(ar->board);
|
||||
|
||||
if (ar->otp && !IS_ERR(ar->otp))
|
||||
release_firmware(ar->otp);
|
||||
@ -328,12 +305,20 @@ static void ath10k_core_free_firmware_files(struct ath10k *ar)
|
||||
if (ar->firmware && !IS_ERR(ar->firmware))
|
||||
release_firmware(ar->firmware);
|
||||
|
||||
ar->board = NULL;
|
||||
ar->board_data = NULL;
|
||||
ar->board_len = 0;
|
||||
|
||||
ar->otp = NULL;
|
||||
ar->otp_data = NULL;
|
||||
ar->otp_len = 0;
|
||||
|
||||
ar->firmware = NULL;
|
||||
ar->firmware_data = NULL;
|
||||
ar->firmware_len = 0;
|
||||
}
|
||||
|
||||
static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
|
||||
static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@ -347,15 +332,18 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ar->board_data = ath10k_fetch_fw_file(ar,
|
||||
ar->hw_params.fw.dir,
|
||||
ar->hw_params.fw.board);
|
||||
if (IS_ERR(ar->board_data)) {
|
||||
ret = PTR_ERR(ar->board_data);
|
||||
ar->board = ath10k_fetch_fw_file(ar,
|
||||
ar->hw_params.fw.dir,
|
||||
ar->hw_params.fw.board);
|
||||
if (IS_ERR(ar->board)) {
|
||||
ret = PTR_ERR(ar->board);
|
||||
ath10k_err("could not fetch board data (%d)\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ar->board_data = ar->board->data;
|
||||
ar->board_len = ar->board->size;
|
||||
|
||||
ar->firmware = ath10k_fetch_fw_file(ar,
|
||||
ar->hw_params.fw.dir,
|
||||
ar->hw_params.fw.fw);
|
||||
@ -365,6 +353,9 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ar->firmware_data = ar->firmware->data;
|
||||
ar->firmware_len = ar->firmware->size;
|
||||
|
||||
/* OTP may be undefined. If so, don't fetch it at all */
|
||||
if (ar->hw_params.fw.otp == NULL)
|
||||
return 0;
|
||||
@ -378,6 +369,9 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ar->otp_data = ar->otp->data;
|
||||
ar->otp_len = ar->otp->size;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
@ -385,6 +379,191 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
|
||||
{
|
||||
size_t magic_len, len, ie_len;
|
||||
int ie_id, i, index, bit, ret;
|
||||
struct ath10k_fw_ie *hdr;
|
||||
const u8 *data;
|
||||
__le32 *timestamp;
|
||||
|
||||
/* first fetch the firmware file (firmware-*.bin) */
|
||||
ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name);
|
||||
if (IS_ERR(ar->firmware)) {
|
||||
ath10k_err("Could not fetch firmware file '%s': %ld\n",
|
||||
name, PTR_ERR(ar->firmware));
|
||||
return PTR_ERR(ar->firmware);
|
||||
}
|
||||
|
||||
data = ar->firmware->data;
|
||||
len = ar->firmware->size;
|
||||
|
||||
/* magic also includes the null byte, check that as well */
|
||||
magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
|
||||
|
||||
if (len < magic_len) {
|
||||
ath10k_err("firmware image too small to contain magic: %zu\n",
|
||||
len);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
|
||||
ath10k_err("Invalid firmware magic\n");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* jump over the padding */
|
||||
magic_len = ALIGN(magic_len, 4);
|
||||
|
||||
len -= magic_len;
|
||||
data += magic_len;
|
||||
|
||||
/* loop elements */
|
||||
while (len > sizeof(struct ath10k_fw_ie)) {
|
||||
hdr = (struct ath10k_fw_ie *)data;
|
||||
|
||||
ie_id = le32_to_cpu(hdr->id);
|
||||
ie_len = le32_to_cpu(hdr->len);
|
||||
|
||||
len -= sizeof(*hdr);
|
||||
data += sizeof(*hdr);
|
||||
|
||||
if (len < ie_len) {
|
||||
ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
|
||||
ie_id, len, ie_len);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
switch (ie_id) {
|
||||
case ATH10K_FW_IE_FW_VERSION:
|
||||
if (ie_len > sizeof(ar->hw->wiphy->fw_version) - 1)
|
||||
break;
|
||||
|
||||
memcpy(ar->hw->wiphy->fw_version, data, ie_len);
|
||||
ar->hw->wiphy->fw_version[ie_len] = '\0';
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_BOOT,
|
||||
"found fw version %s\n",
|
||||
ar->hw->wiphy->fw_version);
|
||||
break;
|
||||
case ATH10K_FW_IE_TIMESTAMP:
|
||||
if (ie_len != sizeof(u32))
|
||||
break;
|
||||
|
||||
timestamp = (__le32 *)data;
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_BOOT, "found fw timestamp %d\n",
|
||||
le32_to_cpup(timestamp));
|
||||
break;
|
||||
case ATH10K_FW_IE_FEATURES:
|
||||
ath10k_dbg(ATH10K_DBG_BOOT,
|
||||
"found firmware features ie (%zd B)\n",
|
||||
ie_len);
|
||||
|
||||
for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) {
|
||||
index = i / 8;
|
||||
bit = i % 8;
|
||||
|
||||
if (index == ie_len)
|
||||
break;
|
||||
|
||||
if (data[index] & (1 << bit))
|
||||
__set_bit(i, ar->fw_features);
|
||||
}
|
||||
|
||||
ath10k_dbg_dump(ATH10K_DBG_BOOT, "features", "",
|
||||
ar->fw_features,
|
||||
sizeof(ar->fw_features));
|
||||
break;
|
||||
case ATH10K_FW_IE_FW_IMAGE:
|
||||
ath10k_dbg(ATH10K_DBG_BOOT,
|
||||
"found fw image ie (%zd B)\n",
|
||||
ie_len);
|
||||
|
||||
ar->firmware_data = data;
|
||||
ar->firmware_len = ie_len;
|
||||
|
||||
break;
|
||||
case ATH10K_FW_IE_OTP_IMAGE:
|
||||
ath10k_dbg(ATH10K_DBG_BOOT,
|
||||
"found otp image ie (%zd B)\n",
|
||||
ie_len);
|
||||
|
||||
ar->otp_data = data;
|
||||
ar->otp_len = ie_len;
|
||||
|
||||
break;
|
||||
default:
|
||||
ath10k_warn("Unknown FW IE: %u\n",
|
||||
le32_to_cpu(hdr->id));
|
||||
break;
|
||||
}
|
||||
|
||||
/* jump over the padding */
|
||||
ie_len = ALIGN(ie_len, 4);
|
||||
|
||||
len -= ie_len;
|
||||
data += ie_len;
|
||||
}
|
||||
|
||||
if (!ar->firmware_data || !ar->firmware_len) {
|
||||
ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from %s, skipping\n",
|
||||
name);
|
||||
ret = -ENOMEDIUM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* now fetch the board file */
|
||||
if (ar->hw_params.fw.board == NULL) {
|
||||
ath10k_err("board data file not defined");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ar->board = ath10k_fetch_fw_file(ar,
|
||||
ar->hw_params.fw.dir,
|
||||
ar->hw_params.fw.board);
|
||||
if (IS_ERR(ar->board)) {
|
||||
ret = PTR_ERR(ar->board);
|
||||
ath10k_err("could not fetch board data (%d)\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ar->board_data = ar->board->data;
|
||||
ar->board_len = ar->board->size;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
ath10k_core_free_firmware_files(ar);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE);
|
||||
if (ret == 0) {
|
||||
ar->fw_api = 2;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ath10k_core_fetch_firmware_api_1(ar);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ar->fw_api = 1;
|
||||
|
||||
out:
|
||||
ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ath10k_init_download_firmware(struct ath10k *ar)
|
||||
{
|
||||
int ret;
|
||||
@ -541,6 +720,9 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
|
||||
INIT_WORK(&ar->offchan_tx_work, ath10k_offchan_tx_work);
|
||||
skb_queue_head_init(&ar->offchan_tx_queue);
|
||||
|
||||
INIT_WORK(&ar->wmi_mgmt_tx_work, ath10k_mgmt_over_wmi_tx_work);
|
||||
skb_queue_head_init(&ar->wmi_mgmt_tx_queue);
|
||||
|
||||
init_waitqueue_head(&ar->event_queue);
|
||||
|
||||
INIT_WORK(&ar->restart_work, ath10k_core_restart);
|
||||
@ -555,6 +737,8 @@ EXPORT_SYMBOL(ath10k_core_create);
|
||||
|
||||
void ath10k_core_destroy(struct ath10k *ar)
|
||||
{
|
||||
ath10k_debug_destroy(ar);
|
||||
|
||||
flush_workqueue(ar->workqueue);
|
||||
destroy_workqueue(ar->workqueue);
|
||||
|
||||
@ -566,6 +750,8 @@ int ath10k_core_start(struct ath10k *ar)
|
||||
{
|
||||
int status;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
ath10k_bmi_start(ar);
|
||||
|
||||
if (ath10k_init_configure_target(ar)) {
|
||||
@ -616,10 +802,6 @@ int ath10k_core_start(struct ath10k *ar)
|
||||
|
||||
ath10k_info("firmware %s booted\n", ar->hw->wiphy->fw_version);
|
||||
|
||||
status = ath10k_check_fw_version(ar);
|
||||
if (status)
|
||||
goto err_disconnect_htc;
|
||||
|
||||
status = ath10k_wmi_cmd_init(ar);
|
||||
if (status) {
|
||||
ath10k_err("could not send WMI init command (%d)\n", status);
|
||||
@ -642,6 +824,7 @@ int ath10k_core_start(struct ath10k *ar)
|
||||
goto err_disconnect_htc;
|
||||
|
||||
ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
|
||||
INIT_LIST_HEAD(&ar->arvifs);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -658,6 +841,8 @@ EXPORT_SYMBOL(ath10k_core_start);
|
||||
|
||||
void ath10k_core_stop(struct ath10k *ar)
|
||||
{
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
ath10k_debug_stop(ar);
|
||||
ath10k_htc_stop(&ar->htc);
|
||||
ath10k_htt_detach(&ar->htt);
|
||||
@ -705,15 +890,21 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
|
||||
return ret;
|
||||
}
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
|
||||
ret = ath10k_core_start(ar);
|
||||
if (ret) {
|
||||
ath10k_err("could not init core (%d)\n", ret);
|
||||
ath10k_core_free_firmware_files(ar);
|
||||
ath10k_hif_power_down(ar);
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ath10k_core_stop(ar);
|
||||
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
|
||||
ath10k_hif_power_down(ar);
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,15 +43,17 @@
|
||||
/* Antenna noise floor */
|
||||
#define ATH10K_DEFAULT_NOISE_FLOOR -95
|
||||
|
||||
#define ATH10K_MAX_NUM_MGMT_PENDING 16
|
||||
|
||||
struct ath10k;
|
||||
|
||||
struct ath10k_skb_cb {
|
||||
dma_addr_t paddr;
|
||||
bool is_mapped;
|
||||
bool is_aborted;
|
||||
u8 vdev_id;
|
||||
|
||||
struct {
|
||||
u8 vdev_id;
|
||||
u8 tid;
|
||||
bool is_offchan;
|
||||
|
||||
@ -102,11 +104,26 @@ struct ath10k_bmi {
|
||||
bool done_sent;
|
||||
};
|
||||
|
||||
#define ATH10K_MAX_MEM_REQS 16
|
||||
|
||||
struct ath10k_mem_chunk {
|
||||
void *vaddr;
|
||||
dma_addr_t paddr;
|
||||
u32 len;
|
||||
u32 req_id;
|
||||
};
|
||||
|
||||
struct ath10k_wmi {
|
||||
enum ath10k_htc_ep_id eid;
|
||||
struct completion service_ready;
|
||||
struct completion unified_ready;
|
||||
wait_queue_head_t tx_credits_wq;
|
||||
struct wmi_cmd_map *cmd;
|
||||
struct wmi_vdev_param_map *vdev_param;
|
||||
struct wmi_pdev_param_map *pdev_param;
|
||||
|
||||
u32 num_mem_chunks;
|
||||
struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS];
|
||||
};
|
||||
|
||||
struct ath10k_peer_stat {
|
||||
@ -188,6 +205,8 @@ struct ath10k_peer {
|
||||
#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
|
||||
|
||||
struct ath10k_vif {
|
||||
struct list_head list;
|
||||
|
||||
u32 vdev_id;
|
||||
enum wmi_vdev_type vdev_type;
|
||||
enum wmi_vdev_subtype vdev_subtype;
|
||||
@ -198,8 +217,10 @@ struct ath10k_vif {
|
||||
struct ath10k *ar;
|
||||
struct ieee80211_vif *vif;
|
||||
|
||||
struct work_struct wep_key_work;
|
||||
struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
|
||||
u8 def_wep_key_index;
|
||||
u8 def_wep_key_idx;
|
||||
u8 def_wep_key_newidx;
|
||||
|
||||
u16 tx_seq_no;
|
||||
|
||||
@ -268,6 +289,12 @@ enum ath10k_fw_features {
|
||||
/* wmi_mgmt_rx_hdr contains extra RSSI information */
|
||||
ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0,
|
||||
|
||||
/* firmware from 10X branch */
|
||||
ATH10K_FW_FEATURE_WMI_10X = 1,
|
||||
|
||||
/* firmware support tx frame management over WMI, otherwise it's HTT */
|
||||
ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2,
|
||||
|
||||
/* keep last */
|
||||
ATH10K_FW_FEATURE_COUNT,
|
||||
};
|
||||
@ -324,9 +351,19 @@ struct ath10k {
|
||||
} fw;
|
||||
} hw_params;
|
||||
|
||||
const struct firmware *board_data;
|
||||
const struct firmware *board;
|
||||
const void *board_data;
|
||||
size_t board_len;
|
||||
|
||||
const struct firmware *otp;
|
||||
const void *otp_data;
|
||||
size_t otp_len;
|
||||
|
||||
const struct firmware *firmware;
|
||||
const void *firmware_data;
|
||||
size_t firmware_len;
|
||||
|
||||
int fw_api;
|
||||
|
||||
struct {
|
||||
struct completion started;
|
||||
@ -369,6 +406,7 @@ struct ath10k {
|
||||
/* protects shared structure data */
|
||||
spinlock_t data_lock;
|
||||
|
||||
struct list_head arvifs;
|
||||
struct list_head peers;
|
||||
wait_queue_head_t peer_mapping_wq;
|
||||
|
||||
@ -377,6 +415,9 @@ struct ath10k {
|
||||
struct completion offchan_tx_completed;
|
||||
struct sk_buff *offchan_tx_skb;
|
||||
|
||||
struct work_struct wmi_mgmt_tx_work;
|
||||
struct sk_buff_head wmi_mgmt_tx_queue;
|
||||
|
||||
enum ath10k_state state;
|
||||
|
||||
struct work_struct restart_work;
|
||||
|
@ -618,6 +618,8 @@ int ath10k_debug_start(struct ath10k *ar)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
ret = ath10k_debug_htt_stats_req(ar);
|
||||
if (ret)
|
||||
/* continue normally anyway, this isn't serious */
|
||||
@ -628,7 +630,13 @@ int ath10k_debug_start(struct ath10k *ar)
|
||||
|
||||
void ath10k_debug_stop(struct ath10k *ar)
|
||||
{
|
||||
cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
/* Must not use _sync to avoid deadlock, we do that in
|
||||
* ath10k_debug_destroy(). The check for htt_stats_mask is to avoid
|
||||
* warning from del_timer(). */
|
||||
if (ar->debug.htt_stats_mask != 0)
|
||||
cancel_delayed_work(&ar->debug.htt_stats_dwork);
|
||||
}
|
||||
|
||||
int ath10k_debug_create(struct ath10k *ar)
|
||||
@ -662,6 +670,11 @@ int ath10k_debug_create(struct ath10k *ar)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ath10k_debug_destroy(struct ath10k *ar)
|
||||
{
|
||||
cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ATH10K_DEBUGFS */
|
||||
|
||||
#ifdef CONFIG_ATH10K_DEBUG
|
||||
|
@ -46,6 +46,7 @@ __printf(1, 2) int ath10k_warn(const char *fmt, ...);
|
||||
int ath10k_debug_start(struct ath10k *ar);
|
||||
void ath10k_debug_stop(struct ath10k *ar);
|
||||
int ath10k_debug_create(struct ath10k *ar);
|
||||
void ath10k_debug_destroy(struct ath10k *ar);
|
||||
void ath10k_debug_read_service_map(struct ath10k *ar,
|
||||
void *service_map,
|
||||
size_t map_size);
|
||||
@ -67,6 +68,10 @@ static inline int ath10k_debug_create(struct ath10k *ar)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void ath10k_debug_destroy(struct ath10k *ar)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void ath10k_debug_read_service_map(struct ath10k *ar,
|
||||
void *service_map,
|
||||
size_t map_size)
|
||||
|
@ -308,7 +308,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
|
||||
struct sk_buff *txdesc = NULL;
|
||||
struct htt_cmd *cmd;
|
||||
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
|
||||
u8 vdev_id = skb_cb->htt.vdev_id;
|
||||
u8 vdev_id = skb_cb->vdev_id;
|
||||
int len = 0;
|
||||
int msdu_id = -1;
|
||||
int res;
|
||||
@ -384,7 +384,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
|
||||
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
|
||||
struct sk_buff *txdesc = NULL;
|
||||
bool use_frags;
|
||||
u8 vdev_id = ATH10K_SKB_CB(msdu)->htt.vdev_id;
|
||||
u8 vdev_id = ATH10K_SKB_CB(msdu)->vdev_id;
|
||||
u8 tid;
|
||||
int prefetch_len, desc_len;
|
||||
int msdu_id = -1;
|
||||
|
@ -20,12 +20,6 @@
|
||||
|
||||
#include "targaddrs.h"
|
||||
|
||||
/* Supported FW version */
|
||||
#define SUPPORTED_FW_MAJOR 1
|
||||
#define SUPPORTED_FW_MINOR 0
|
||||
#define SUPPORTED_FW_RELEASE 0
|
||||
#define SUPPORTED_FW_BUILD 636
|
||||
|
||||
/* QCA988X 1.0 definitions (unsupported) */
|
||||
#define QCA988X_HW_1_0_CHIP_ID_REV 0x0
|
||||
|
||||
@ -38,6 +32,25 @@
|
||||
#define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin"
|
||||
#define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234
|
||||
|
||||
#define ATH10K_FW_API2_FILE "firmware-2.bin"
|
||||
|
||||
/* includes also the null byte */
|
||||
#define ATH10K_FIRMWARE_MAGIC "QCA-ATH10K"
|
||||
|
||||
struct ath10k_fw_ie {
|
||||
__le32 id;
|
||||
__le32 len;
|
||||
u8 data[0];
|
||||
};
|
||||
|
||||
enum ath10k_fw_ie_type {
|
||||
ATH10K_FW_IE_FW_VERSION = 0,
|
||||
ATH10K_FW_IE_TIMESTAMP = 1,
|
||||
ATH10K_FW_IE_FEATURES = 2,
|
||||
ATH10K_FW_IE_FW_IMAGE = 3,
|
||||
ATH10K_FW_IE_OTP_IMAGE = 4,
|
||||
};
|
||||
|
||||
/* Known pecularities:
|
||||
* - current FW doesn't support raw rx mode (last tested v599)
|
||||
* - current FW dumps upon raw tx mode (last tested v599)
|
||||
@ -59,6 +72,7 @@ enum ath10k_mcast2ucast_mode {
|
||||
ATH10K_MCAST2UCAST_ENABLED = 1,
|
||||
};
|
||||
|
||||
/* Target specific defines for MAIN firmware */
|
||||
#define TARGET_NUM_VDEVS 8
|
||||
#define TARGET_NUM_PEER_AST 2
|
||||
#define TARGET_NUM_WDS_ENTRIES 32
|
||||
@ -93,6 +107,36 @@ enum ath10k_mcast2ucast_mode {
|
||||
#define TARGET_NUM_MSDU_DESC (1024 + 400)
|
||||
#define TARGET_MAX_FRAG_ENTRIES 0
|
||||
|
||||
/* Target specific defines for 10.X firmware */
|
||||
#define TARGET_10X_NUM_VDEVS 16
|
||||
#define TARGET_10X_NUM_PEER_AST 2
|
||||
#define TARGET_10X_NUM_WDS_ENTRIES 32
|
||||
#define TARGET_10X_DMA_BURST_SIZE 0
|
||||
#define TARGET_10X_MAC_AGGR_DELIM 0
|
||||
#define TARGET_10X_AST_SKID_LIMIT 16
|
||||
#define TARGET_10X_NUM_PEERS (128 + (TARGET_10X_NUM_VDEVS))
|
||||
#define TARGET_10X_NUM_OFFLOAD_PEERS 0
|
||||
#define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS 0
|
||||
#define TARGET_10X_NUM_PEER_KEYS 2
|
||||
#define TARGET_10X_NUM_TIDS 256
|
||||
#define TARGET_10X_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
|
||||
#define TARGET_10X_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
|
||||
#define TARGET_10X_RX_TIMEOUT_LO_PRI 100
|
||||
#define TARGET_10X_RX_TIMEOUT_HI_PRI 40
|
||||
#define TARGET_10X_RX_DECAP_MODE ATH10K_HW_TXRX_NATIVE_WIFI
|
||||
#define TARGET_10X_SCAN_MAX_PENDING_REQS 4
|
||||
#define TARGET_10X_BMISS_OFFLOAD_MAX_VDEV 2
|
||||
#define TARGET_10X_ROAM_OFFLOAD_MAX_VDEV 2
|
||||
#define TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES 8
|
||||
#define TARGET_10X_GTK_OFFLOAD_MAX_VDEV 3
|
||||
#define TARGET_10X_NUM_MCAST_GROUPS 0
|
||||
#define TARGET_10X_NUM_MCAST_TABLE_ELEMS 0
|
||||
#define TARGET_10X_MCAST2UCAST_MODE ATH10K_MCAST2UCAST_DISABLED
|
||||
#define TARGET_10X_TX_DBG_LOG_SIZE 1024
|
||||
#define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
|
||||
#define TARGET_10X_VOW_CONFIG 0
|
||||
#define TARGET_10X_NUM_MSDU_DESC (1024 + 400)
|
||||
#define TARGET_10X_MAX_FRAG_ENTRIES 0
|
||||
|
||||
/* Number of Copy Engines supported */
|
||||
#define CE_COUNT 8
|
||||
|
@ -334,25 +334,29 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
|
||||
|
||||
static int ath10k_mac_set_rts(struct ath10k_vif *arvif, u32 value)
|
||||
{
|
||||
struct ath10k *ar = arvif->ar;
|
||||
u32 vdev_param;
|
||||
|
||||
if (value != 0xFFFFFFFF)
|
||||
value = min_t(u32, arvif->ar->hw->wiphy->rts_threshold,
|
||||
ATH10K_RTS_MAX);
|
||||
|
||||
return ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_RTS_THRESHOLD,
|
||||
value);
|
||||
vdev_param = ar->wmi.vdev_param->rts_threshold;
|
||||
return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value);
|
||||
}
|
||||
|
||||
static int ath10k_mac_set_frag(struct ath10k_vif *arvif, u32 value)
|
||||
{
|
||||
struct ath10k *ar = arvif->ar;
|
||||
u32 vdev_param;
|
||||
|
||||
if (value != 0xFFFFFFFF)
|
||||
value = clamp_t(u32, arvif->ar->hw->wiphy->frag_threshold,
|
||||
ATH10K_FRAGMT_THRESHOLD_MIN,
|
||||
ATH10K_FRAGMT_THRESHOLD_MAX);
|
||||
|
||||
return ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
|
||||
value);
|
||||
vdev_param = ar->wmi.vdev_param->fragmentation_threshold;
|
||||
return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value);
|
||||
}
|
||||
|
||||
static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
|
||||
@ -562,12 +566,9 @@ static int ath10k_monitor_stop(struct ath10k *ar)
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
/* For some reasons, ath10k_wmi_vdev_down() here couse
|
||||
* often ath10k_wmi_vdev_stop() to fail. Next we could
|
||||
* not run monitor vdev and driver reload
|
||||
* required. Don't see such problems we skip
|
||||
* ath10k_wmi_vdev_down() here.
|
||||
*/
|
||||
ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id);
|
||||
if (ret)
|
||||
ath10k_warn("Monitor vdev down failed: %d\n", ret);
|
||||
|
||||
ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id);
|
||||
if (ret)
|
||||
@ -677,6 +678,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
|
||||
struct ieee80211_bss_conf *info,
|
||||
const u8 self_peer[ETH_ALEN])
|
||||
{
|
||||
u32 vdev_param;
|
||||
int ret = 0;
|
||||
|
||||
lockdep_assert_held(&arvif->ar->conf_mutex);
|
||||
@ -710,8 +712,8 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_ATIM_WINDOW,
|
||||
vdev_param = arvif->ar->wmi.vdev_param->atim_window;
|
||||
ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param,
|
||||
ATH10K_DEFAULT_ATIM);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set IBSS ATIM for VDEV:%d ret:%d\n",
|
||||
@ -721,35 +723,30 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
|
||||
/*
|
||||
* Review this when mac80211 gains per-interface powersave support.
|
||||
*/
|
||||
static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif)
|
||||
{
|
||||
struct ath10k_generic_iter *ar_iter = data;
|
||||
struct ieee80211_conf *conf = &ar_iter->ar->hw->conf;
|
||||
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
|
||||
struct ath10k *ar = arvif->ar;
|
||||
struct ieee80211_conf *conf = &ar->hw->conf;
|
||||
enum wmi_sta_powersave_param param;
|
||||
enum wmi_sta_ps_mode psmode;
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&arvif->ar->conf_mutex);
|
||||
|
||||
if (vif->type != NL80211_IFTYPE_STATION)
|
||||
return;
|
||||
if (arvif->vif->type != NL80211_IFTYPE_STATION)
|
||||
return 0;
|
||||
|
||||
if (conf->flags & IEEE80211_CONF_PS) {
|
||||
psmode = WMI_STA_PS_MODE_ENABLED;
|
||||
param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
|
||||
|
||||
ret = ath10k_wmi_set_sta_ps_param(ar_iter->ar,
|
||||
arvif->vdev_id,
|
||||
param,
|
||||
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
|
||||
conf->dynamic_ps_timeout);
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set inactivity time for VDEV: %d\n",
|
||||
arvif->vdev_id);
|
||||
return;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ar_iter->ret = ret;
|
||||
} else {
|
||||
psmode = WMI_STA_PS_MODE_DISABLED;
|
||||
}
|
||||
@ -757,11 +754,14 @@ static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d psmode %s\n",
|
||||
arvif->vdev_id, psmode ? "enable" : "disable");
|
||||
|
||||
ar_iter->ret = ath10k_wmi_set_psmode(ar_iter->ar, arvif->vdev_id,
|
||||
psmode);
|
||||
if (ar_iter->ret)
|
||||
ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode);
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set PS Mode: %d for VDEV: %d\n",
|
||||
psmode, arvif->vdev_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************/
|
||||
@ -1031,14 +1031,27 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
|
||||
struct wmi_peer_assoc_complete_arg *arg)
|
||||
{
|
||||
const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
|
||||
u8 ampdu_factor;
|
||||
|
||||
if (!vht_cap->vht_supported)
|
||||
return;
|
||||
|
||||
arg->peer_flags |= WMI_PEER_VHT;
|
||||
|
||||
arg->peer_vht_caps = vht_cap->cap;
|
||||
|
||||
|
||||
ampdu_factor = (vht_cap->cap &
|
||||
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
|
||||
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
|
||||
|
||||
/* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to
|
||||
* zero in VHT IE. Using it would result in degraded throughput.
|
||||
* arg->peer_max_mpdu at this point contains HT max_mpdu so keep
|
||||
* it if VHT max_mpdu is smaller. */
|
||||
arg->peer_max_mpdu = max(arg->peer_max_mpdu,
|
||||
(1U << (IEEE80211_HT_MAX_AMPDU_FACTOR +
|
||||
ampdu_factor)) - 1);
|
||||
|
||||
if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
|
||||
arg->peer_flags |= WMI_PEER_80MHZ;
|
||||
|
||||
@ -1124,26 +1137,25 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
|
||||
WARN_ON(phymode == MODE_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ath10k_peer_assoc(struct ath10k *ar,
|
||||
struct ath10k_vif *arvif,
|
||||
struct ieee80211_sta *sta,
|
||||
struct ieee80211_bss_conf *bss_conf)
|
||||
static int ath10k_peer_assoc_prepare(struct ath10k *ar,
|
||||
struct ath10k_vif *arvif,
|
||||
struct ieee80211_sta *sta,
|
||||
struct ieee80211_bss_conf *bss_conf,
|
||||
struct wmi_peer_assoc_complete_arg *arg)
|
||||
{
|
||||
struct wmi_peer_assoc_complete_arg arg;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
memset(&arg, 0, sizeof(struct wmi_peer_assoc_complete_arg));
|
||||
memset(arg, 0, sizeof(*arg));
|
||||
|
||||
ath10k_peer_assoc_h_basic(ar, arvif, sta, bss_conf, &arg);
|
||||
ath10k_peer_assoc_h_crypto(ar, arvif, &arg);
|
||||
ath10k_peer_assoc_h_rates(ar, sta, &arg);
|
||||
ath10k_peer_assoc_h_ht(ar, sta, &arg);
|
||||
ath10k_peer_assoc_h_vht(ar, sta, &arg);
|
||||
ath10k_peer_assoc_h_qos(ar, arvif, sta, bss_conf, &arg);
|
||||
ath10k_peer_assoc_h_phymode(ar, arvif, sta, &arg);
|
||||
ath10k_peer_assoc_h_basic(ar, arvif, sta, bss_conf, arg);
|
||||
ath10k_peer_assoc_h_crypto(ar, arvif, arg);
|
||||
ath10k_peer_assoc_h_rates(ar, sta, arg);
|
||||
ath10k_peer_assoc_h_ht(ar, sta, arg);
|
||||
ath10k_peer_assoc_h_vht(ar, sta, arg);
|
||||
ath10k_peer_assoc_h_qos(ar, arvif, sta, bss_conf, arg);
|
||||
ath10k_peer_assoc_h_phymode(ar, arvif, sta, arg);
|
||||
|
||||
return ath10k_wmi_peer_assoc(ar, &arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* can be called only in mac80211 callbacks due to `key_count` usage */
|
||||
@ -1153,6 +1165,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
|
||||
{
|
||||
struct ath10k *ar = hw->priv;
|
||||
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
|
||||
struct wmi_peer_assoc_complete_arg peer_arg;
|
||||
struct ieee80211_sta *ap_sta;
|
||||
int ret;
|
||||
|
||||
@ -1168,15 +1181,24 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ath10k_peer_assoc(ar, arvif, ap_sta, bss_conf);
|
||||
ret = ath10k_peer_assoc_prepare(ar, arvif, ap_sta,
|
||||
bss_conf, &peer_arg);
|
||||
if (ret) {
|
||||
ath10k_warn("Peer assoc failed for %pM\n", bss_conf->bssid);
|
||||
ath10k_warn("Peer assoc prepare failed for %pM\n: %d",
|
||||
bss_conf->bssid, ret);
|
||||
rcu_read_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
ret = ath10k_wmi_peer_assoc(ar, &peer_arg);
|
||||
if (ret) {
|
||||
ath10k_warn("Peer assoc failed for %pM\n: %d",
|
||||
bss_conf->bssid, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC,
|
||||
"mac vdev %d up (associated) bssid %pM aid %d\n",
|
||||
arvif->vdev_id, bss_conf->bssid, bss_conf->aid);
|
||||
@ -1224,19 +1246,28 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
|
||||
/* FIXME: why don't we print error if wmi call fails? */
|
||||
ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
|
||||
|
||||
arvif->def_wep_key_index = 0;
|
||||
arvif->def_wep_key_idx = 0;
|
||||
}
|
||||
|
||||
static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct wmi_peer_assoc_complete_arg peer_arg;
|
||||
int ret = 0;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
ret = ath10k_peer_assoc(ar, arvif, sta, NULL);
|
||||
ret = ath10k_peer_assoc_prepare(ar, arvif, sta, NULL, &peer_arg);
|
||||
if (ret) {
|
||||
ath10k_warn("WMI peer assoc failed for %pM\n", sta->addr);
|
||||
ath10k_warn("WMI peer assoc prepare failed for %pM\n",
|
||||
sta->addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ath10k_wmi_peer_assoc(ar, &peer_arg);
|
||||
if (ret) {
|
||||
ath10k_warn("Peer assoc failed for STA %pM\n: %d",
|
||||
sta->addr, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1405,6 +1436,33 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
|
||||
/* TX handlers */
|
||||
/***************/
|
||||
|
||||
static u8 ath10k_tx_h_get_tid(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
if (ieee80211_is_mgmt(hdr->frame_control))
|
||||
return HTT_DATA_TX_EXT_TID_MGMT;
|
||||
|
||||
if (!ieee80211_is_data_qos(hdr->frame_control))
|
||||
return HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
|
||||
|
||||
if (!is_unicast_ether_addr(ieee80211_get_DA(hdr)))
|
||||
return HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
|
||||
|
||||
return ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
}
|
||||
|
||||
static u8 ath10k_tx_h_get_vdev_id(struct ath10k *ar,
|
||||
struct ieee80211_tx_info *info)
|
||||
{
|
||||
if (info->control.vif)
|
||||
return ath10k_vif_to_arvif(info->control.vif)->vdev_id;
|
||||
|
||||
if (ar->monitor_enabled)
|
||||
return ar->monitor_vdev_id;
|
||||
|
||||
ath10k_warn("could not resolve vdev id\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Frames sent to the FW have to be in "Native Wifi" format.
|
||||
* Strip the QoS field from the 802.11 header.
|
||||
@ -1425,6 +1483,30 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw,
|
||||
skb_pull(skb, IEEE80211_QOS_CTL_LEN);
|
||||
}
|
||||
|
||||
static void ath10k_tx_wep_key_work(struct work_struct *work)
|
||||
{
|
||||
struct ath10k_vif *arvif = container_of(work, struct ath10k_vif,
|
||||
wep_key_work);
|
||||
int ret, keyidx = arvif->def_wep_key_newidx;
|
||||
|
||||
if (arvif->def_wep_key_idx == keyidx)
|
||||
return;
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
|
||||
arvif->vdev_id, keyidx);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(arvif->ar,
|
||||
arvif->vdev_id,
|
||||
arvif->ar->wmi.vdev_param->def_keyid,
|
||||
keyidx);
|
||||
if (ret) {
|
||||
ath10k_warn("could not update wep keyidx (%d)\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
arvif->def_wep_key_idx = keyidx;
|
||||
}
|
||||
|
||||
static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
@ -1433,7 +1515,6 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
|
||||
struct ath10k *ar = arvif->ar;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct ieee80211_key_conf *key = info->control.hw_key;
|
||||
int ret;
|
||||
|
||||
if (!ieee80211_has_protected(hdr->frame_control))
|
||||
return;
|
||||
@ -1445,21 +1526,14 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
|
||||
key->cipher != WLAN_CIPHER_SUITE_WEP104)
|
||||
return;
|
||||
|
||||
if (key->keyidx == arvif->def_wep_key_index)
|
||||
if (key->keyidx == arvif->def_wep_key_idx)
|
||||
return;
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
|
||||
arvif->vdev_id, key->keyidx);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_DEF_KEYID,
|
||||
key->keyidx);
|
||||
if (ret) {
|
||||
ath10k_warn("could not update wep keyidx (%d)\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
arvif->def_wep_key_index = key->keyidx;
|
||||
/* FIXME: Most likely a few frames will be TXed with an old key. Simply
|
||||
* queueing frames until key index is updated is not an option because
|
||||
* sk_buff may need more processing to be done, e.g. offchannel */
|
||||
arvif->def_wep_key_newidx = key->keyidx;
|
||||
ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
|
||||
}
|
||||
|
||||
static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
|
||||
@ -1489,7 +1563,7 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
|
||||
static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (ar->htt.target_version_major >= 3) {
|
||||
/* Since HTT 3.0 there is no separate mgmt tx command */
|
||||
@ -1497,16 +1571,32 @@ static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (ieee80211_is_mgmt(hdr->frame_control))
|
||||
ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
|
||||
else if (ieee80211_is_nullfunc(hdr->frame_control))
|
||||
if (ieee80211_is_mgmt(hdr->frame_control)) {
|
||||
if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
|
||||
ar->fw_features)) {
|
||||
if (skb_queue_len(&ar->wmi_mgmt_tx_queue) >=
|
||||
ATH10K_MAX_NUM_MGMT_PENDING) {
|
||||
ath10k_warn("wmi mgmt_tx queue limit reached\n");
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
skb_queue_tail(&ar->wmi_mgmt_tx_queue, skb);
|
||||
ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work);
|
||||
} else {
|
||||
ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
|
||||
}
|
||||
} else if (!test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
|
||||
ar->fw_features) &&
|
||||
ieee80211_is_nullfunc(hdr->frame_control)) {
|
||||
/* FW does not report tx status properly for NullFunc frames
|
||||
* unless they are sent through mgmt tx path. mac80211 sends
|
||||
* those frames when it detects link/beacon loss and depends on
|
||||
* the tx status to be correct. */
|
||||
* those frames when it detects link/beacon loss and depends
|
||||
* on the tx status to be correct. */
|
||||
ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
|
||||
else
|
||||
} else {
|
||||
ret = ath10k_htt_tx(&ar->htt, skb);
|
||||
}
|
||||
|
||||
exit:
|
||||
if (ret) {
|
||||
@ -1557,7 +1647,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
|
||||
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
peer_addr = ieee80211_get_DA(hdr);
|
||||
vdev_id = ATH10K_SKB_CB(skb)->htt.vdev_id;
|
||||
vdev_id = ATH10K_SKB_CB(skb)->vdev_id;
|
||||
|
||||
spin_lock_bh(&ar->data_lock);
|
||||
peer = ath10k_peer_find(ar, vdev_id, peer_addr);
|
||||
@ -1599,6 +1689,36 @@ void ath10k_offchan_tx_work(struct work_struct *work)
|
||||
}
|
||||
}
|
||||
|
||||
void ath10k_mgmt_over_wmi_tx_purge(struct ath10k *ar)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
for (;;) {
|
||||
skb = skb_dequeue(&ar->wmi_mgmt_tx_queue);
|
||||
if (!skb)
|
||||
break;
|
||||
|
||||
ieee80211_free_txskb(ar->hw, skb);
|
||||
}
|
||||
}
|
||||
|
||||
void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
|
||||
{
|
||||
struct ath10k *ar = container_of(work, struct ath10k, wmi_mgmt_tx_work);
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
|
||||
for (;;) {
|
||||
skb = skb_dequeue(&ar->wmi_mgmt_tx_queue);
|
||||
if (!skb)
|
||||
break;
|
||||
|
||||
ret = ath10k_wmi_mgmt_tx(ar, skb);
|
||||
if (ret)
|
||||
ath10k_warn("wmi mgmt_tx failed (%d)\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
/************/
|
||||
/* Scanning */
|
||||
/************/
|
||||
@ -1722,16 +1842,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct ath10k *ar = hw->priv;
|
||||
struct ath10k_vif *arvif = NULL;
|
||||
u32 vdev_id = 0;
|
||||
u8 tid;
|
||||
|
||||
if (info->control.vif) {
|
||||
arvif = ath10k_vif_to_arvif(info->control.vif);
|
||||
vdev_id = arvif->vdev_id;
|
||||
} else if (ar->monitor_enabled) {
|
||||
vdev_id = ar->monitor_vdev_id;
|
||||
}
|
||||
u8 tid, vdev_id;
|
||||
|
||||
/* We should disable CCK RATE due to P2P */
|
||||
if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)
|
||||
@ -1739,14 +1850,8 @@ static void ath10k_tx(struct ieee80211_hw *hw,
|
||||
|
||||
/* we must calculate tid before we apply qos workaround
|
||||
* as we'd lose the qos control field */
|
||||
tid = HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
|
||||
if (ieee80211_is_mgmt(hdr->frame_control)) {
|
||||
tid = HTT_DATA_TX_EXT_TID_MGMT;
|
||||
} else if (ieee80211_is_data_qos(hdr->frame_control) &&
|
||||
is_unicast_ether_addr(ieee80211_get_DA(hdr))) {
|
||||
u8 *qc = ieee80211_get_qos_ctl(hdr);
|
||||
tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
}
|
||||
tid = ath10k_tx_h_get_tid(hdr);
|
||||
vdev_id = ath10k_tx_h_get_vdev_id(ar, info);
|
||||
|
||||
/* it makes no sense to process injected frames like that */
|
||||
if (info->control.vif &&
|
||||
@ -1757,14 +1862,14 @@ static void ath10k_tx(struct ieee80211_hw *hw,
|
||||
ath10k_tx_h_seq_no(skb);
|
||||
}
|
||||
|
||||
ATH10K_SKB_CB(skb)->vdev_id = vdev_id;
|
||||
ATH10K_SKB_CB(skb)->htt.is_offchan = false;
|
||||
ATH10K_SKB_CB(skb)->htt.vdev_id = vdev_id;
|
||||
ATH10K_SKB_CB(skb)->htt.tid = tid;
|
||||
|
||||
if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
|
||||
spin_lock_bh(&ar->data_lock);
|
||||
ATH10K_SKB_CB(skb)->htt.is_offchan = true;
|
||||
ATH10K_SKB_CB(skb)->htt.vdev_id = ar->scan.vdev_id;
|
||||
ATH10K_SKB_CB(skb)->vdev_id = ar->scan.vdev_id;
|
||||
spin_unlock_bh(&ar->data_lock);
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "queued offchannel skb %p\n", skb);
|
||||
@ -1786,6 +1891,7 @@ void ath10k_halt(struct ath10k *ar)
|
||||
|
||||
del_timer_sync(&ar->scan.timeout);
|
||||
ath10k_offchan_tx_purge(ar);
|
||||
ath10k_mgmt_over_wmi_tx_purge(ar);
|
||||
ath10k_peer_cleanup_all(ar);
|
||||
ath10k_core_stop(ar);
|
||||
ath10k_hif_power_down(ar);
|
||||
@ -1832,12 +1938,12 @@ static int ath10k_start(struct ieee80211_hw *hw)
|
||||
else if (ar->state == ATH10K_STATE_RESTARTING)
|
||||
ar->state = ATH10K_STATE_RESTARTED;
|
||||
|
||||
ret = ath10k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_PMF_QOS, 1);
|
||||
ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pmf_qos, 1);
|
||||
if (ret)
|
||||
ath10k_warn("could not enable WMI_PDEV_PARAM_PMF_QOS (%d)\n",
|
||||
ret);
|
||||
|
||||
ret = ath10k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_DYNAMIC_BW, 0);
|
||||
ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->dynamic_bw, 0);
|
||||
if (ret)
|
||||
ath10k_warn("could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n",
|
||||
ret);
|
||||
@ -1862,32 +1968,29 @@ static void ath10k_stop(struct ieee80211_hw *hw)
|
||||
ar->state = ATH10K_STATE_OFF;
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
|
||||
ath10k_mgmt_over_wmi_tx_purge(ar);
|
||||
|
||||
cancel_work_sync(&ar->offchan_tx_work);
|
||||
cancel_work_sync(&ar->wmi_mgmt_tx_work);
|
||||
cancel_work_sync(&ar->restart_work);
|
||||
}
|
||||
|
||||
static void ath10k_config_ps(struct ath10k *ar)
|
||||
static int ath10k_config_ps(struct ath10k *ar)
|
||||
{
|
||||
struct ath10k_generic_iter ar_iter;
|
||||
struct ath10k_vif *arvif;
|
||||
int ret = 0;
|
||||
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
/* During HW reconfiguration mac80211 reports all interfaces that were
|
||||
* running until reconfiguration was started. Since FW doesn't have any
|
||||
* vdevs at this point we must not iterate over this interface list.
|
||||
* This setting will be updated upon add_interface(). */
|
||||
if (ar->state == ATH10K_STATE_RESTARTED)
|
||||
return;
|
||||
list_for_each_entry(arvif, &ar->arvifs, list) {
|
||||
ret = ath10k_mac_vif_setup_ps(arvif);
|
||||
if (ret) {
|
||||
ath10k_warn("could not setup powersave (%d)\n", ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
|
||||
ar_iter.ar = ar;
|
||||
|
||||
ieee80211_iterate_active_interfaces_atomic(
|
||||
ar->hw, IEEE80211_IFACE_ITER_NORMAL,
|
||||
ath10k_ps_iter, &ar_iter);
|
||||
|
||||
if (ar_iter.ret)
|
||||
ath10k_warn("failed to set ps config (%d)\n", ar_iter.ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
|
||||
@ -1936,6 +2039,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
|
||||
int ret = 0;
|
||||
u32 value;
|
||||
int bit;
|
||||
u32 vdev_param;
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
|
||||
@ -1944,21 +2048,22 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
|
||||
arvif->ar = ar;
|
||||
arvif->vif = vif;
|
||||
|
||||
INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
|
||||
|
||||
if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
|
||||
ath10k_warn("Only one monitor interface allowed\n");
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
goto err;
|
||||
}
|
||||
|
||||
bit = ffs(ar->free_vdev_map);
|
||||
if (bit == 0) {
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
goto err;
|
||||
}
|
||||
|
||||
arvif->vdev_id = bit - 1;
|
||||
arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
|
||||
ar->free_vdev_map &= ~(1 << arvif->vdev_id);
|
||||
|
||||
if (ar->p2p)
|
||||
arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
|
||||
@ -1994,25 +2099,34 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
|
||||
arvif->vdev_subtype, vif->addr);
|
||||
if (ret) {
|
||||
ath10k_warn("WMI vdev create failed: ret %d\n", ret);
|
||||
goto exit;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, 0, WMI_VDEV_PARAM_DEF_KEYID,
|
||||
arvif->def_wep_key_index);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set default keyid: %d\n", ret);
|
||||
ar->free_vdev_map &= ~BIT(arvif->vdev_id);
|
||||
list_add(&arvif->list, &ar->arvifs);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_TX_ENCAP_TYPE,
|
||||
vdev_param = ar->wmi.vdev_param->def_keyid;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
|
||||
arvif->def_wep_key_idx);
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set default keyid: %d\n", ret);
|
||||
goto err_vdev_delete;
|
||||
}
|
||||
|
||||
vdev_param = ar->wmi.vdev_param->tx_encap_type;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
ATH10K_HW_TXRX_NATIVE_WIFI);
|
||||
if (ret)
|
||||
/* 10.X firmware does not support this VDEV parameter. Do not warn */
|
||||
if (ret && ret != -EOPNOTSUPP) {
|
||||
ath10k_warn("Failed to set TX encap: %d\n", ret);
|
||||
goto err_vdev_delete;
|
||||
}
|
||||
|
||||
if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
|
||||
ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to create peer for AP: %d\n", ret);
|
||||
goto exit;
|
||||
goto err_vdev_delete;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2021,39 +2135,62 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
|
||||
value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
|
||||
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
|
||||
param, value);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set RX wake policy: %d\n", ret);
|
||||
goto err_peer_delete;
|
||||
}
|
||||
|
||||
param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD;
|
||||
value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS;
|
||||
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
|
||||
param, value);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set TX wake thresh: %d\n", ret);
|
||||
goto err_peer_delete;
|
||||
}
|
||||
|
||||
param = WMI_STA_PS_PARAM_PSPOLL_COUNT;
|
||||
value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX;
|
||||
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
|
||||
param, value);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ath10k_warn("Failed to set PSPOLL count: %d\n", ret);
|
||||
goto err_peer_delete;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ath10k_warn("failed to set rts threshold for vdev %d (%d)\n",
|
||||
arvif->vdev_id, ret);
|
||||
goto err_peer_delete;
|
||||
}
|
||||
|
||||
ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ath10k_warn("failed to set frag threshold for vdev %d (%d)\n",
|
||||
arvif->vdev_id, ret);
|
||||
goto err_peer_delete;
|
||||
}
|
||||
|
||||
if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
|
||||
ar->monitor_present = true;
|
||||
|
||||
exit:
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
return 0;
|
||||
|
||||
err_peer_delete:
|
||||
if (arvif->vdev_type == WMI_VDEV_TYPE_AP)
|
||||
ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
|
||||
|
||||
err_vdev_delete:
|
||||
ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
|
||||
ar->free_vdev_map &= ~BIT(arvif->vdev_id);
|
||||
list_del(&arvif->list);
|
||||
|
||||
err:
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2066,6 +2203,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
|
||||
cancel_work_sync(&arvif->wep_key_work);
|
||||
|
||||
spin_lock_bh(&ar->data_lock);
|
||||
if (arvif->beacon) {
|
||||
dev_kfree_skb_any(arvif->beacon);
|
||||
@ -2074,6 +2213,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
|
||||
spin_unlock_bh(&ar->data_lock);
|
||||
|
||||
ar->free_vdev_map |= 1 << (arvif->vdev_id);
|
||||
list_del(&arvif->list);
|
||||
|
||||
if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
|
||||
ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);
|
||||
@ -2154,6 +2294,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ath10k *ar = hw->priv;
|
||||
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
|
||||
int ret = 0;
|
||||
u32 vdev_param, pdev_param;
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
|
||||
@ -2162,8 +2303,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_INT) {
|
||||
arvif->beacon_interval = info->beacon_int;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_BEACON_INTERVAL,
|
||||
vdev_param = ar->wmi.vdev_param->beacon_interval;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
arvif->beacon_interval);
|
||||
ath10k_dbg(ATH10K_DBG_MAC,
|
||||
"mac vdev %d beacon_interval %d\n",
|
||||
@ -2179,8 +2320,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
"vdev %d set beacon tx mode to staggered\n",
|
||||
arvif->vdev_id);
|
||||
|
||||
ret = ath10k_wmi_pdev_set_param(ar,
|
||||
WMI_PDEV_PARAM_BEACON_TX_MODE,
|
||||
pdev_param = ar->wmi.pdev_param->beacon_tx_mode;
|
||||
ret = ath10k_wmi_pdev_set_param(ar, pdev_param,
|
||||
WMI_BEACON_STAGGERED_MODE);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set beacon mode for VDEV: %d\n",
|
||||
@ -2194,8 +2335,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
"mac vdev %d dtim_period %d\n",
|
||||
arvif->vdev_id, arvif->dtim_period);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_DTIM_PERIOD,
|
||||
vdev_param = ar->wmi.vdev_param->dtim_period;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
arvif->dtim_period);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set dtim period for VDEV: %d\n",
|
||||
@ -2262,8 +2403,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d cts_prot %d\n",
|
||||
arvif->vdev_id, cts_prot);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_ENABLE_RTSCTS,
|
||||
vdev_param = ar->wmi.vdev_param->enable_rtscts;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
cts_prot);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set CTS prot for VDEV: %d\n",
|
||||
@ -2281,8 +2422,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d slot_time %d\n",
|
||||
arvif->vdev_id, slottime);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_SLOT_TIME,
|
||||
vdev_param = ar->wmi.vdev_param->slot_time;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
slottime);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set erp slot for VDEV: %d\n",
|
||||
@ -2300,8 +2441,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
"mac vdev %d preamble %dn",
|
||||
arvif->vdev_id, preamble);
|
||||
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
|
||||
WMI_VDEV_PARAM_PREAMBLE,
|
||||
vdev_param = ar->wmi.vdev_param->preamble;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
preamble);
|
||||
if (ret)
|
||||
ath10k_warn("Failed to set preamble for VDEV: %d\n",
|
||||
@ -2751,86 +2892,51 @@ static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw)
|
||||
* Both RTS and Fragmentation threshold are interface-specific
|
||||
* in ath10k, but device-specific in mac80211.
|
||||
*/
|
||||
static void ath10k_set_rts_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct ath10k_generic_iter *ar_iter = data;
|
||||
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
|
||||
u32 rts = ar_iter->ar->hw->wiphy->rts_threshold;
|
||||
|
||||
lockdep_assert_held(&arvif->ar->conf_mutex);
|
||||
|
||||
/* During HW reconfiguration mac80211 reports all interfaces that were
|
||||
* running until reconfiguration was started. Since FW doesn't have any
|
||||
* vdevs at this point we must not iterate over this interface list.
|
||||
* This setting will be updated upon add_interface(). */
|
||||
if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
|
||||
return;
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts_threshold %d\n",
|
||||
arvif->vdev_id, rts);
|
||||
|
||||
ar_iter->ret = ath10k_mac_set_rts(arvif, rts);
|
||||
if (ar_iter->ret)
|
||||
ath10k_warn("Failed to set RTS threshold for VDEV: %d\n",
|
||||
arvif->vdev_id);
|
||||
}
|
||||
|
||||
static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
|
||||
{
|
||||
struct ath10k_generic_iter ar_iter;
|
||||
struct ath10k *ar = hw->priv;
|
||||
|
||||
memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
|
||||
ar_iter.ar = ar;
|
||||
struct ath10k_vif *arvif;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
ieee80211_iterate_active_interfaces_atomic(
|
||||
hw, IEEE80211_IFACE_ITER_NORMAL,
|
||||
ath10k_set_rts_iter, &ar_iter);
|
||||
list_for_each_entry(arvif, &ar->arvifs, list) {
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
|
||||
arvif->vdev_id, value);
|
||||
|
||||
ret = ath10k_mac_set_rts(arvif, value);
|
||||
if (ret) {
|
||||
ath10k_warn("could not set rts threshold for vdev %d (%d)\n",
|
||||
arvif->vdev_id, ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
|
||||
return ar_iter.ret;
|
||||
}
|
||||
|
||||
static void ath10k_set_frag_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct ath10k_generic_iter *ar_iter = data;
|
||||
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
|
||||
u32 frag = ar_iter->ar->hw->wiphy->frag_threshold;
|
||||
|
||||
lockdep_assert_held(&arvif->ar->conf_mutex);
|
||||
|
||||
/* During HW reconfiguration mac80211 reports all interfaces that were
|
||||
* running until reconfiguration was started. Since FW doesn't have any
|
||||
* vdevs at this point we must not iterate over this interface list.
|
||||
* This setting will be updated upon add_interface(). */
|
||||
if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
|
||||
return;
|
||||
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation_threshold %d\n",
|
||||
arvif->vdev_id, frag);
|
||||
|
||||
ar_iter->ret = ath10k_mac_set_frag(arvif, frag);
|
||||
if (ar_iter->ret)
|
||||
ath10k_warn("Failed to set frag threshold for VDEV: %d\n",
|
||||
arvif->vdev_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
|
||||
{
|
||||
struct ath10k_generic_iter ar_iter;
|
||||
struct ath10k *ar = hw->priv;
|
||||
|
||||
memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
|
||||
ar_iter.ar = ar;
|
||||
struct ath10k_vif *arvif;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
ieee80211_iterate_active_interfaces_atomic(
|
||||
hw, IEEE80211_IFACE_ITER_NORMAL,
|
||||
ath10k_set_frag_iter, &ar_iter);
|
||||
list_for_each_entry(arvif, &ar->arvifs, list) {
|
||||
ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",
|
||||
arvif->vdev_id, value);
|
||||
|
||||
ret = ath10k_mac_set_rts(arvif, value);
|
||||
if (ret) {
|
||||
ath10k_warn("could not set fragmentation threshold for vdev %d (%d)\n",
|
||||
arvif->vdev_id, ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
|
||||
return ar_iter.ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
|
||||
|
@ -34,6 +34,8 @@ struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);
|
||||
void ath10k_reset_scan(unsigned long ptr);
|
||||
void ath10k_offchan_tx_purge(struct ath10k *ar);
|
||||
void ath10k_offchan_tx_work(struct work_struct *work);
|
||||
void ath10k_mgmt_over_wmi_tx_purge(struct ath10k *ar);
|
||||
void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work);
|
||||
void ath10k_halt(struct ath10k *ar);
|
||||
|
||||
static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
|
||||
|
@ -720,18 +720,8 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
|
||||
"ath10k tx: data: ",
|
||||
nbuf->data, nbuf->len);
|
||||
|
||||
/* Make sure we have resources to handle this request */
|
||||
spin_lock_bh(&pipe_info->pipe_lock);
|
||||
if (!pipe_info->num_sends_allowed) {
|
||||
ath10k_warn("Pipe: %d is full\n", pipe_id);
|
||||
spin_unlock_bh(&pipe_info->pipe_lock);
|
||||
return -ENOSR;
|
||||
}
|
||||
pipe_info->num_sends_allowed--;
|
||||
spin_unlock_bh(&pipe_info->pipe_lock);
|
||||
|
||||
ret = ath10k_ce_sendlist_send(ce_hdl, nbuf, transfer_id,
|
||||
skb_cb->paddr, len, flags);
|
||||
ret = ath10k_ce_send(ce_hdl, nbuf, skb_cb->paddr, len, transfer_id,
|
||||
flags);
|
||||
if (ret)
|
||||
ath10k_warn("CE send failed: %p\n", nbuf);
|
||||
|
||||
@ -741,14 +731,7 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
|
||||
static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
|
||||
{
|
||||
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
||||
struct ath10k_pci_pipe *pipe_info = &(ar_pci->pipe_info[pipe]);
|
||||
int ret;
|
||||
|
||||
spin_lock_bh(&pipe_info->pipe_lock);
|
||||
ret = pipe_info->num_sends_allowed;
|
||||
spin_unlock_bh(&pipe_info->pipe_lock);
|
||||
|
||||
return ret;
|
||||
return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl);
|
||||
}
|
||||
|
||||
static void ath10k_pci_hif_dump_area(struct ath10k *ar)
|
||||
@ -863,7 +846,6 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
|
||||
ath10k_pci_ce_send_done,
|
||||
disable_interrupts);
|
||||
completions += attr->src_nentries;
|
||||
pipe_info->num_sends_allowed = attr->src_nentries - 1;
|
||||
}
|
||||
|
||||
if (attr->dest_nentries) {
|
||||
@ -1033,7 +1015,6 @@ static void ath10k_pci_process_ce(struct ath10k *ar)
|
||||
*/
|
||||
spin_lock_bh(&compl->pipe_info->pipe_lock);
|
||||
list_add_tail(&compl->list, &compl->pipe_info->compl_free);
|
||||
compl->pipe_info->num_sends_allowed += send_done;
|
||||
spin_unlock_bh(&compl->pipe_info->pipe_lock);
|
||||
}
|
||||
|
||||
|
@ -178,9 +178,6 @@ struct ath10k_pci_pipe {
|
||||
/* List of free CE completion slots */
|
||||
struct list_head compl_free;
|
||||
|
||||
/* Limit the number of outstanding send requests. */
|
||||
int num_sends_allowed;
|
||||
|
||||
struct ath10k_pci *ar_pci;
|
||||
struct tasklet_struct intr;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1663,15 +1663,15 @@ ath5k_tx_frame_completed(struct ath5k_hw *ah, struct sk_buff *skb,
|
||||
ah->stats.tx_bytes_count += skb->len;
|
||||
info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
size = min_t(int, sizeof(info->status.rates), sizeof(bf->rates));
|
||||
memcpy(info->status.rates, bf->rates, size);
|
||||
|
||||
tries[0] = info->status.rates[0].count;
|
||||
tries[1] = info->status.rates[1].count;
|
||||
tries[2] = info->status.rates[2].count;
|
||||
|
||||
ieee80211_tx_info_clear_status(info);
|
||||
|
||||
size = min_t(int, sizeof(info->status.rates), sizeof(bf->rates));
|
||||
memcpy(info->status.rates, bf->rates, size);
|
||||
|
||||
for (i = 0; i < ts->ts_final_idx; i++) {
|
||||
struct ieee80211_tx_rate *r =
|
||||
&info->status.rates[i];
|
||||
|
@ -60,7 +60,7 @@
|
||||
/* disable credit flow control on a specific service */
|
||||
#define HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL (1 << 3)
|
||||
#define HTC_CONN_FLGS_SET_RECV_ALLOC_SHIFT 8
|
||||
#define HTC_CONN_FLGS_SET_RECV_ALLOC_MASK 0xFF00
|
||||
#define HTC_CONN_FLGS_SET_RECV_ALLOC_MASK 0xFF00U
|
||||
|
||||
/* connect response status codes */
|
||||
#define HTC_SERVICE_SUCCESS 0
|
||||
|
@ -84,6 +84,26 @@ config ATH9K_DFS_CERTIFIED
|
||||
developed. At this point enabling this option won't do anything
|
||||
except increase code size.
|
||||
|
||||
config ATH9K_TX99
|
||||
bool "Atheros ath9k TX99 testing support"
|
||||
depends on CFG80211_CERTIFICATION_ONUS
|
||||
default n
|
||||
---help---
|
||||
Say N. This should only be enabled on systems undergoing
|
||||
certification testing and evaluation in a controlled environment.
|
||||
Enabling this will only enable TX99 support, all other modes of
|
||||
operation will be disabled.
|
||||
|
||||
TX99 support enables Specific Absorption Rate (SAR) testing.
|
||||
SAR is the unit of measurement for the amount of radio frequency(RF)
|
||||
absorbed by the body when using a wireless device. The RF exposure
|
||||
limits used are expressed in the terms of SAR, which is a measure
|
||||
of the electric and magnetic field strength and power density for
|
||||
transmitters operating at frequencies from 300 kHz to 100 GHz.
|
||||
Regulatory bodies around the world require that wireless device
|
||||
be evaluated to meet the RF exposure limits set forth in the
|
||||
governmental SAR regulations.
|
||||
|
||||
config ATH9K_LEGACY_RATE_CONTROL
|
||||
bool "Atheros ath9k rate control"
|
||||
depends on ATH9K
|
||||
|
@ -14,9 +14,7 @@ ath9k-$(CONFIG_ATH9K_AHB) += ahb.o
|
||||
ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o
|
||||
ath9k-$(CONFIG_ATH9K_DFS_DEBUGFS) += dfs_debug.o
|
||||
ath9k-$(CONFIG_ATH9K_DFS_CERTIFIED) += \
|
||||
dfs.o \
|
||||
dfs_pattern_detector.o \
|
||||
dfs_pri_detector.o
|
||||
dfs.o
|
||||
ath9k-$(CONFIG_PM_SLEEP) += wow.o
|
||||
|
||||
obj-$(CONFIG_ATH9K) += ath9k.o
|
||||
|
@ -680,6 +680,26 @@ static void ar9002_hw_spectral_scan_wait(struct ath_hw *ah)
|
||||
}
|
||||
}
|
||||
|
||||
static void ar9002_hw_tx99_start(struct ath_hw *ah, u32 qnum)
|
||||
{
|
||||
REG_SET_BIT(ah, 0x9864, 0x7f000);
|
||||
REG_SET_BIT(ah, 0x9924, 0x7f00fe);
|
||||
REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
|
||||
REG_WRITE(ah, AR_CR, AR_CR_RXD);
|
||||
REG_WRITE(ah, AR_DLCL_IFS(qnum), 0);
|
||||
REG_WRITE(ah, AR_D_GBL_IFS_SIFS, 20);
|
||||
REG_WRITE(ah, AR_D_GBL_IFS_EIFS, 20);
|
||||
REG_WRITE(ah, AR_D_FPCTL, 0x10|qnum);
|
||||
REG_WRITE(ah, AR_TIME_OUT, 0x00000400);
|
||||
REG_WRITE(ah, AR_DRETRY_LIMIT(qnum), 0xffffffff);
|
||||
REG_SET_BIT(ah, AR_QMISC(qnum), AR_Q_MISC_DCU_EARLY_TERM_REQ);
|
||||
}
|
||||
|
||||
static void ar9002_hw_tx99_stop(struct ath_hw *ah)
|
||||
{
|
||||
REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
|
||||
}
|
||||
|
||||
void ar9002_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
|
||||
@ -701,6 +721,8 @@ void ar9002_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
||||
ops->set_bt_ant_diversity = ar9002_hw_set_bt_ant_diversity;
|
||||
#endif
|
||||
ops->tx99_start = ar9002_hw_tx99_start;
|
||||
ops->tx99_stop = ar9002_hw_tx99_stop;
|
||||
|
||||
ar9002_hw_set_nf_limits(ah);
|
||||
}
|
||||
|
@ -1617,6 +1617,98 @@ static void ar9003_hw_spectral_scan_wait(struct ath_hw *ah)
|
||||
}
|
||||
}
|
||||
|
||||
static void ar9003_hw_tx99_start(struct ath_hw *ah, u32 qnum)
|
||||
{
|
||||
REG_SET_BIT(ah, AR_PHY_TEST, PHY_AGC_CLR);
|
||||
REG_SET_BIT(ah, 0x9864, 0x7f000);
|
||||
REG_SET_BIT(ah, 0x9924, 0x7f00fe);
|
||||
REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
|
||||
REG_WRITE(ah, AR_CR, AR_CR_RXD);
|
||||
REG_WRITE(ah, AR_DLCL_IFS(qnum), 0);
|
||||
REG_WRITE(ah, AR_D_GBL_IFS_SIFS, 20); /* 50 OK */
|
||||
REG_WRITE(ah, AR_D_GBL_IFS_EIFS, 20);
|
||||
REG_WRITE(ah, AR_TIME_OUT, 0x00000400);
|
||||
REG_WRITE(ah, AR_DRETRY_LIMIT(qnum), 0xffffffff);
|
||||
REG_SET_BIT(ah, AR_QMISC(qnum), AR_Q_MISC_DCU_EARLY_TERM_REQ);
|
||||
}
|
||||
|
||||
static void ar9003_hw_tx99_stop(struct ath_hw *ah)
|
||||
{
|
||||
REG_CLR_BIT(ah, AR_PHY_TEST, PHY_AGC_CLR);
|
||||
REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
|
||||
}
|
||||
|
||||
static void ar9003_hw_tx99_set_txpower(struct ath_hw *ah, u8 txpower)
|
||||
{
|
||||
static s16 p_pwr_array[ar9300RateSize] = { 0 };
|
||||
unsigned int i;
|
||||
|
||||
if (txpower <= MAX_RATE_POWER) {
|
||||
for (i = 0; i < ar9300RateSize; i++)
|
||||
p_pwr_array[i] = txpower;
|
||||
} else {
|
||||
for (i = 0; i < ar9300RateSize; i++)
|
||||
p_pwr_array[i] = MAX_RATE_POWER;
|
||||
}
|
||||
|
||||
REG_WRITE(ah, 0xa458, 0);
|
||||
|
||||
REG_WRITE(ah, 0xa3c0,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_6_24], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_6_24], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_6_24], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_6_24], 0));
|
||||
REG_WRITE(ah, 0xa3c4,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_54], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_48], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_36], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_6_24], 0));
|
||||
REG_WRITE(ah, 0xa3c8,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_1L_5L], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_1L_5L], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_1L_5L], 0));
|
||||
REG_WRITE(ah, 0xa3cc,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_11S], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_11L], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_5S], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_LEGACY_1L_5L], 0));
|
||||
REG_WRITE(ah, 0xa3d0,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_5], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_4], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_1_3_9_11_17_19], 8)|
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_0_8_16], 0));
|
||||
REG_WRITE(ah, 0xa3d4,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_13], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_12], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_7], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_6], 0));
|
||||
REG_WRITE(ah, 0xa3e4,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_21], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_20], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_15], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_14], 0));
|
||||
REG_WRITE(ah, 0xa3e8,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_23], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_22], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_23], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT20_22], 0));
|
||||
REG_WRITE(ah, 0xa3d8,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_5], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_4], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_1_3_9_11_17_19], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_0_8_16], 0));
|
||||
REG_WRITE(ah, 0xa3dc,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_13], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_12], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_7], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_6], 0));
|
||||
REG_WRITE(ah, 0xa3ec,
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_21], 24) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_20], 16) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_15], 8) |
|
||||
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_14], 0));
|
||||
}
|
||||
|
||||
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
|
||||
@ -1656,6 +1748,9 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
||||
ops->set_bt_ant_diversity = ar9003_hw_set_bt_ant_diversity;
|
||||
#endif
|
||||
ops->tx99_start = ar9003_hw_tx99_start;
|
||||
ops->tx99_stop = ar9003_hw_tx99_stop;
|
||||
ops->tx99_set_txpower = ar9003_hw_tx99_set_txpower;
|
||||
|
||||
ar9003_hw_set_nf_limits(ah);
|
||||
ar9003_hw_set_radar_conf(ah);
|
||||
|
@ -778,6 +778,11 @@ struct ath_softc {
|
||||
enum spectral_mode spectral_mode;
|
||||
struct ath_spec_scan spec_config;
|
||||
|
||||
struct ieee80211_vif *tx99_vif;
|
||||
struct sk_buff *tx99_skb;
|
||||
bool tx99_state;
|
||||
s16 tx99_power;
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
atomic_t wow_got_bmiss_intr;
|
||||
atomic_t wow_sleep_proc_intr; /* in the middle of WoW sleep ? */
|
||||
@ -886,6 +891,7 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
|
||||
*/
|
||||
enum ath_fft_sample_type {
|
||||
ATH_FFT_SAMPLE_HT20 = 1,
|
||||
ATH_FFT_SAMPLE_HT20_40,
|
||||
};
|
||||
|
||||
struct fft_sample_tlv {
|
||||
@ -912,6 +918,39 @@ struct fft_sample_ht20 {
|
||||
u8 data[SPECTRAL_HT20_NUM_BINS];
|
||||
} __packed;
|
||||
|
||||
struct fft_sample_ht20_40 {
|
||||
struct fft_sample_tlv tlv;
|
||||
|
||||
u8 channel_type;
|
||||
__be16 freq;
|
||||
|
||||
s8 lower_rssi;
|
||||
s8 upper_rssi;
|
||||
|
||||
__be64 tsf;
|
||||
|
||||
s8 lower_noise;
|
||||
s8 upper_noise;
|
||||
|
||||
__be16 lower_max_magnitude;
|
||||
__be16 upper_max_magnitude;
|
||||
|
||||
u8 lower_max_index;
|
||||
u8 upper_max_index;
|
||||
|
||||
u8 lower_bitmap_weight;
|
||||
u8 upper_bitmap_weight;
|
||||
|
||||
u8 max_exp;
|
||||
|
||||
u8 data[SPECTRAL_HT20_40_NUM_BINS];
|
||||
} __packed;
|
||||
|
||||
int ath9k_tx99_init(struct ath_softc *sc);
|
||||
void ath9k_tx99_deinit(struct ath_softc *sc);
|
||||
int ath9k_tx99_send(struct ath_softc *sc, struct sk_buff *skb,
|
||||
struct ath_tx_control *txctl);
|
||||
|
||||
void ath9k_tasklet(unsigned long data);
|
||||
int ath_cabq_update(struct ath_softc *);
|
||||
|
||||
|
@ -63,13 +63,13 @@ static s16 ath9k_hw_get_default_nf(struct ath_hw *ah,
|
||||
return ath9k_hw_get_nf_limits(ah, chan)->nominal;
|
||||
}
|
||||
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan,
|
||||
s16 nf)
|
||||
{
|
||||
s8 noise = ATH_DEFAULT_NOISE_FLOOR;
|
||||
|
||||
if (chan && chan->noisefloor) {
|
||||
s8 delta = chan->noisefloor -
|
||||
ATH9K_NF_CAL_NOISE_THRESH -
|
||||
if (nf) {
|
||||
s8 delta = nf - ATH9K_NF_CAL_NOISE_THRESH -
|
||||
ath9k_hw_get_default_nf(ah, chan);
|
||||
if (delta > 0)
|
||||
noise += delta;
|
||||
@ -392,7 +392,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
clear_bit(NFCAL_PENDING, &caldata->cal_flags);
|
||||
ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
|
||||
chan->noisefloor = h[0].privNF;
|
||||
ah->noise = ath9k_hw_getchan_noise(ah, chan);
|
||||
ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor);
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(ath9k_hw_getnf);
|
||||
|
@ -116,7 +116,8 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
|
||||
void ath9k_hw_bstuck_nfcal(struct ath_hw *ah);
|
||||
void ath9k_hw_reset_calibration(struct ath_hw *ah,
|
||||
struct ath9k_cal_list *currCal);
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan,
|
||||
s16 nf);
|
||||
|
||||
|
||||
#endif /* CALIB_H */
|
||||
|
@ -1050,6 +1050,9 @@ static ssize_t write_file_spec_scan_ctl(struct file *file,
|
||||
char buf[32];
|
||||
ssize_t len;
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
@ -1775,6 +1778,111 @@ void ath9k_deinit_debug(struct ath_softc *sc)
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t read_file_tx99(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath_softc *sc = file->private_data;
|
||||
char buf[3];
|
||||
unsigned int len;
|
||||
|
||||
len = sprintf(buf, "%d\n", sc->tx99_state);
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath_softc *sc = file->private_data;
|
||||
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
||||
char buf[32];
|
||||
bool start;
|
||||
ssize_t len;
|
||||
int r;
|
||||
|
||||
if (sc->nvifs > 1)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
if (strtobool(buf, &start))
|
||||
return -EINVAL;
|
||||
|
||||
if (start == sc->tx99_state) {
|
||||
if (!start)
|
||||
return count;
|
||||
ath_dbg(common, XMIT, "Resetting TX99\n");
|
||||
ath9k_tx99_deinit(sc);
|
||||
}
|
||||
|
||||
if (!start) {
|
||||
ath9k_tx99_deinit(sc);
|
||||
return count;
|
||||
}
|
||||
|
||||
r = ath9k_tx99_init(sc);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_tx99 = {
|
||||
.read = read_file_tx99,
|
||||
.write = write_file_tx99,
|
||||
.open = simple_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t read_file_tx99_power(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath_softc *sc = file->private_data;
|
||||
char buf[32];
|
||||
unsigned int len;
|
||||
|
||||
len = sprintf(buf, "%d (%d dBm)\n",
|
||||
sc->tx99_power,
|
||||
sc->tx99_power / 2);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t write_file_tx99_power(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath_softc *sc = file->private_data;
|
||||
int r;
|
||||
u8 tx_power;
|
||||
|
||||
r = kstrtou8_from_user(user_buf, count, 0, &tx_power);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (tx_power > MAX_RATE_POWER)
|
||||
return -EINVAL;
|
||||
|
||||
sc->tx99_power = tx_power;
|
||||
|
||||
ath9k_ps_wakeup(sc);
|
||||
ath9k_hw_tx99_set_txpower(sc->sc_ah, sc->tx99_power);
|
||||
ath9k_ps_restore(sc);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_tx99_power = {
|
||||
.read = read_file_tx99_power,
|
||||
.write = write_file_tx99_power,
|
||||
.open = simple_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
int ath9k_init_debug(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
@ -1866,5 +1974,15 @@ int ath9k_init_debug(struct ath_hw *ah)
|
||||
debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc,
|
||||
&fops_btcoex);
|
||||
#endif
|
||||
if (config_enabled(CONFIG_ATH9K_TX99) &&
|
||||
AR_SREV_9300_20_OR_LATER(ah)) {
|
||||
debugfs_create_file("tx99", S_IRUSR | S_IWUSR,
|
||||
sc->debug.debugfs_phy, sc,
|
||||
&fops_tx99);
|
||||
debugfs_create_file("tx99_power", S_IRUSR | S_IWUSR,
|
||||
sc->debug.debugfs_phy, sc,
|
||||
&fops_tx99_power);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#ifndef ATH9K_DFS_H
|
||||
#define ATH9K_DFS_H
|
||||
#include "dfs_pattern_detector.h"
|
||||
#include "../dfs_pattern_detector.h"
|
||||
|
||||
#if defined(CONFIG_ATH9K_DFS_CERTIFIED)
|
||||
/**
|
||||
|
@ -20,16 +20,16 @@
|
||||
|
||||
#include "ath9k.h"
|
||||
#include "dfs_debug.h"
|
||||
#include "../dfs_pattern_detector.h"
|
||||
|
||||
|
||||
struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 };
|
||||
static struct ath_dfs_pool_stats dfs_pool_stats = { 0 };
|
||||
|
||||
#define ATH9K_DFS_STAT(s, p) \
|
||||
len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
|
||||
sc->debug.stats.dfs_stats.p);
|
||||
#define ATH9K_DFS_POOL_STAT(s, p) \
|
||||
len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
|
||||
global_dfs_pool_stats.p);
|
||||
dfs_pool_stats.p);
|
||||
|
||||
static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
@ -44,6 +44,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
|
||||
if (buf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (sc->dfs_detector)
|
||||
dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector);
|
||||
|
||||
len += scnprintf(buf + len, size - len, "DFS support for "
|
||||
"macVersion = 0x%x, macRev = 0x%x: %s\n",
|
||||
hw_ver->macVersion, hw_ver->macRev,
|
||||
|
@ -51,25 +51,11 @@ struct ath_dfs_stats {
|
||||
u32 radar_detected;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ath_dfs_pool_stats - DFS Statistics for global pools
|
||||
*/
|
||||
struct ath_dfs_pool_stats {
|
||||
u32 pool_reference;
|
||||
u32 pulse_allocated;
|
||||
u32 pulse_alloc_error;
|
||||
u32 pulse_used;
|
||||
u32 pseq_allocated;
|
||||
u32 pseq_alloc_error;
|
||||
u32 pseq_used;
|
||||
};
|
||||
#if defined(CONFIG_ATH9K_DFS_DEBUGFS)
|
||||
|
||||
#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
|
||||
void ath9k_dfs_init_debug(struct ath_softc *sc);
|
||||
|
||||
#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
|
||||
#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
|
||||
extern struct ath_dfs_pool_stats global_dfs_pool_stats;
|
||||
|
||||
#else
|
||||
@ -77,8 +63,6 @@ extern struct ath_dfs_pool_stats global_dfs_pool_stats;
|
||||
#define DFS_STAT_INC(sc, c) do { } while (0)
|
||||
static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
|
||||
|
||||
#define DFS_POOL_STAT_INC(c) do { } while (0)
|
||||
#define DFS_POOL_STAT_DEC(c) do { } while (0)
|
||||
#endif /* CONFIG_ATH9K_DFS_DEBUGFS */
|
||||
|
||||
#endif /* ATH9K_DFS_DEBUG_H */
|
||||
|
@ -78,6 +78,22 @@ static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_tx99_start(struct ath_hw *ah, u32 qnum)
|
||||
{
|
||||
ath9k_hw_ops(ah)->tx99_start(ah, qnum);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_tx99_stop(struct ath_hw *ah)
|
||||
{
|
||||
ath9k_hw_ops(ah)->tx99_stop(ah);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_tx99_set_txpower(struct ath_hw *ah, u8 power)
|
||||
{
|
||||
if (ath9k_hw_ops(ah)->tx99_set_txpower)
|
||||
ath9k_hw_ops(ah)->tx99_set_txpower(ah, power);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
||||
|
||||
static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
|
||||
|
@ -1885,7 +1885,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
|
||||
} else if (caldata) {
|
||||
clear_bit(PAPRD_PACKET_SENT, &caldata->cal_flags);
|
||||
}
|
||||
ah->noise = ath9k_hw_getchan_noise(ah, chan);
|
||||
ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor);
|
||||
|
||||
if (fastcc) {
|
||||
r = ath9k_hw_do_fastcc(ah, chan);
|
||||
|
@ -703,6 +703,10 @@ struct ath_hw_ops {
|
||||
void (*spectral_scan_trigger)(struct ath_hw *ah);
|
||||
void (*spectral_scan_wait)(struct ath_hw *ah);
|
||||
|
||||
void (*tx99_start)(struct ath_hw *ah, u32 qnum);
|
||||
void (*tx99_stop)(struct ath_hw *ah);
|
||||
void (*tx99_set_txpower)(struct ath_hw *ah, u8 power);
|
||||
|
||||
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
|
||||
void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable);
|
||||
#endif
|
||||
|
@ -680,7 +680,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
|
||||
sc->sc_ah = ah;
|
||||
pCap = &ah->caps;
|
||||
|
||||
sc->dfs_detector = dfs_pattern_detector_init(ah, NL80211_DFS_UNSET);
|
||||
common = ath9k_hw_common(ah);
|
||||
sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET);
|
||||
sc->tx99_power = MAX_RATE_POWER + 1;
|
||||
|
||||
if (!pdata) {
|
||||
ah->ah_flags |= AH_USE_EEPROM;
|
||||
@ -694,7 +696,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
|
||||
ah->external_reset = pdata->external_reset;
|
||||
}
|
||||
|
||||
common = ath9k_hw_common(ah);
|
||||
common->ops = &ah->reg_ops;
|
||||
common->bus_ops = bus_ops;
|
||||
common->ah = ah;
|
||||
@ -785,6 +786,7 @@ err_queues:
|
||||
ath9k_hw_deinit(ah);
|
||||
err_hw:
|
||||
ath9k_eeprom_release(sc);
|
||||
dev_kfree_skb_any(sc->tx99_skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -842,7 +844,6 @@ static const struct ieee80211_iface_limit if_limits[] = {
|
||||
BIT(NL80211_IFTYPE_P2P_GO) },
|
||||
};
|
||||
|
||||
|
||||
static const struct ieee80211_iface_limit if_dfs_limits[] = {
|
||||
{ .max = 1, .types = BIT(NL80211_IFTYPE_AP) },
|
||||
};
|
||||
@ -903,17 +904,18 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
|
||||
|
||||
hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR;
|
||||
|
||||
hw->wiphy->interface_modes =
|
||||
BIT(NL80211_IFTYPE_P2P_GO) |
|
||||
BIT(NL80211_IFTYPE_P2P_CLIENT) |
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
BIT(NL80211_IFTYPE_WDS) |
|
||||
BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_ADHOC) |
|
||||
BIT(NL80211_IFTYPE_MESH_POINT);
|
||||
|
||||
hw->wiphy->iface_combinations = if_comb;
|
||||
hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
|
||||
if (!config_enabled(CONFIG_ATH9K_TX99)) {
|
||||
hw->wiphy->interface_modes =
|
||||
BIT(NL80211_IFTYPE_P2P_GO) |
|
||||
BIT(NL80211_IFTYPE_P2P_CLIENT) |
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
BIT(NL80211_IFTYPE_WDS) |
|
||||
BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_ADHOC) |
|
||||
BIT(NL80211_IFTYPE_MESH_POINT);
|
||||
hw->wiphy->iface_combinations = if_comb;
|
||||
hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
|
||||
}
|
||||
|
||||
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
|
||||
|
||||
|
@ -28,6 +28,13 @@ void ath_tx_complete_poll_work(struct work_struct *work)
|
||||
int i;
|
||||
bool needreset = false;
|
||||
|
||||
|
||||
if (sc->tx99_state) {
|
||||
ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
|
||||
"skip tx hung detection on tx99\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
|
||||
txq = sc->tx.txq_map[i];
|
||||
|
||||
@ -70,7 +77,7 @@ void ath_hw_check(struct work_struct *work)
|
||||
ath9k_ps_wakeup(sc);
|
||||
is_alive = ath9k_hw_check_alive(sc->sc_ah);
|
||||
|
||||
if (is_alive && !AR_SREV_9300(sc->sc_ah))
|
||||
if ((is_alive && !AR_SREV_9300(sc->sc_ah)) || sc->tx99_state)
|
||||
goto out;
|
||||
else if (!is_alive && AR_SREV_9300(sc->sc_ah)) {
|
||||
ath_dbg(common, RESET,
|
||||
@ -141,6 +148,9 @@ void ath_hw_pll_work(struct work_struct *work)
|
||||
if (!test_bit(SC_OP_BEACONS, &sc->sc_flags))
|
||||
return;
|
||||
|
||||
if (sc->tx99_state)
|
||||
return;
|
||||
|
||||
ath9k_ps_wakeup(sc);
|
||||
pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah);
|
||||
ath9k_ps_restore(sc);
|
||||
@ -518,7 +528,8 @@ void ath_update_survey_nf(struct ath_softc *sc, int channel)
|
||||
|
||||
if (chan->noisefloor) {
|
||||
survey->filled |= SURVEY_INFO_NOISE_DBM;
|
||||
survey->noise = ath9k_hw_getchan_noise(ah, chan);
|
||||
survey->noise = ath9k_hw_getchan_noise(ah, chan,
|
||||
chan->noisefloor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1046,6 +1046,14 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
|
||||
|
||||
mutex_lock(&sc->mutex);
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99)) {
|
||||
if (sc->nvifs >= 1) {
|
||||
mutex_unlock(&sc->mutex);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
sc->tx99_vif = vif;
|
||||
}
|
||||
|
||||
ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
|
||||
sc->nvifs++;
|
||||
|
||||
@ -1074,9 +1082,15 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
|
||||
struct ath_softc *sc = hw->priv;
|
||||
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
||||
|
||||
ath_dbg(common, CONFIG, "Change Interface\n");
|
||||
mutex_lock(&sc->mutex);
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99)) {
|
||||
mutex_unlock(&sc->mutex);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
ath_dbg(common, CONFIG, "Change Interface\n");
|
||||
|
||||
if (ath9k_uses_beacons(vif->type))
|
||||
ath9k_beacon_remove_slot(sc, vif);
|
||||
|
||||
@ -1106,6 +1120,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
|
||||
mutex_lock(&sc->mutex);
|
||||
|
||||
sc->nvifs--;
|
||||
sc->tx99_vif = NULL;
|
||||
|
||||
if (ath9k_uses_beacons(vif->type))
|
||||
ath9k_beacon_remove_slot(sc, vif);
|
||||
@ -1127,6 +1142,9 @@ static void ath9k_enable_ps(struct ath_softc *sc)
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return;
|
||||
|
||||
sc->ps_enabled = true;
|
||||
if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
|
||||
if ((ah->imask & ATH9K_INT_TIM_TIMER) == 0) {
|
||||
@ -1143,6 +1161,9 @@ static void ath9k_disable_ps(struct ath_softc *sc)
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return;
|
||||
|
||||
sc->ps_enabled = false;
|
||||
ath9k_hw_setpower(ah, ATH9K_PM_AWAKE);
|
||||
if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
|
||||
@ -1166,6 +1187,9 @@ void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
u32 rxfilter;
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return;
|
||||
|
||||
if (!ath9k_hw_ops(ah)->spectral_scan_trigger) {
|
||||
ath_err(common, "spectrum analyzer not implemented on this hardware\n");
|
||||
return;
|
||||
@ -1745,6 +1769,9 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
|
||||
unsigned long flags;
|
||||
int pos;
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
spin_lock_irqsave(&common->cc_lock, flags);
|
||||
if (idx == 0)
|
||||
ath_update_survey_stats(sc);
|
||||
@ -1777,6 +1804,9 @@ static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
|
||||
struct ath_softc *sc = hw->priv;
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return;
|
||||
|
||||
mutex_lock(&sc->mutex);
|
||||
ah->coverage_class = coverage_class;
|
||||
|
||||
@ -2343,6 +2373,134 @@ static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
|
||||
sc->csa_vif = vif;
|
||||
}
|
||||
|
||||
static void ath9k_tx99_stop(struct ath_softc *sc)
|
||||
{
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
|
||||
ath_drain_all_txq(sc);
|
||||
ath_startrecv(sc);
|
||||
|
||||
ath9k_hw_set_interrupts(ah);
|
||||
ath9k_hw_enable_interrupts(ah);
|
||||
|
||||
ieee80211_wake_queues(sc->hw);
|
||||
|
||||
kfree_skb(sc->tx99_skb);
|
||||
sc->tx99_skb = NULL;
|
||||
sc->tx99_state = false;
|
||||
|
||||
ath9k_hw_tx99_stop(sc->sc_ah);
|
||||
ath_dbg(common, XMIT, "TX99 stopped\n");
|
||||
}
|
||||
|
||||
static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
|
||||
{
|
||||
static u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
|
||||
0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
|
||||
0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
|
||||
0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
|
||||
0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
|
||||
0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
|
||||
0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
|
||||
0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
|
||||
u32 len = 1200;
|
||||
struct ieee80211_hw *hw = sc->hw;
|
||||
struct ieee80211_hdr *hdr;
|
||||
struct ieee80211_tx_info *tx_info;
|
||||
struct sk_buff *skb;
|
||||
|
||||
skb = alloc_skb(len, GFP_KERNEL);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
|
||||
skb_put(skb, len);
|
||||
|
||||
memset(skb->data, 0, len);
|
||||
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA);
|
||||
hdr->duration_id = 0;
|
||||
|
||||
memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN);
|
||||
memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
|
||||
memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
|
||||
|
||||
hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
|
||||
|
||||
tx_info = IEEE80211_SKB_CB(skb);
|
||||
memset(tx_info, 0, sizeof(*tx_info));
|
||||
tx_info->band = hw->conf.chandef.chan->band;
|
||||
tx_info->flags = IEEE80211_TX_CTL_NO_ACK;
|
||||
tx_info->control.vif = sc->tx99_vif;
|
||||
|
||||
memcpy(skb->data + sizeof(*hdr), PN9Data, sizeof(PN9Data));
|
||||
|
||||
return skb;
|
||||
}
|
||||
|
||||
void ath9k_tx99_deinit(struct ath_softc *sc)
|
||||
{
|
||||
ath_reset(sc);
|
||||
|
||||
ath9k_ps_wakeup(sc);
|
||||
ath9k_tx99_stop(sc);
|
||||
ath9k_ps_restore(sc);
|
||||
}
|
||||
|
||||
int ath9k_tx99_init(struct ath_softc *sc)
|
||||
{
|
||||
struct ieee80211_hw *hw = sc->hw;
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
struct ath_tx_control txctl;
|
||||
int r;
|
||||
|
||||
if (sc->sc_flags & SC_OP_INVALID) {
|
||||
ath_err(common,
|
||||
"driver is in invalid state unable to use TX99");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sc->tx99_skb = ath9k_build_tx99_skb(sc);
|
||||
if (!sc->tx99_skb)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(&txctl, 0, sizeof(txctl));
|
||||
txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
|
||||
|
||||
ath_reset(sc);
|
||||
|
||||
ath9k_ps_wakeup(sc);
|
||||
|
||||
ath9k_hw_disable_interrupts(ah);
|
||||
atomic_set(&ah->intr_ref_cnt, -1);
|
||||
ath_drain_all_txq(sc);
|
||||
ath_stoprecv(sc);
|
||||
|
||||
sc->tx99_state = true;
|
||||
|
||||
ieee80211_stop_queues(hw);
|
||||
|
||||
if (sc->tx99_power == MAX_RATE_POWER + 1)
|
||||
sc->tx99_power = MAX_RATE_POWER;
|
||||
|
||||
ath9k_hw_tx99_set_txpower(ah, sc->tx99_power);
|
||||
r = ath9k_tx99_send(sc, sc->tx99_skb, &txctl);
|
||||
if (r) {
|
||||
ath_dbg(common, XMIT, "Failed to xmit TX99 skb\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
ath_dbg(common, XMIT, "TX99 xmit started using %d ( %ddBm)\n",
|
||||
sc->tx99_power,
|
||||
sc->tx99_power / 2);
|
||||
|
||||
/* We leave the harware awake as it will be chugging on */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ieee80211_ops ath9k_ops = {
|
||||
.tx = ath9k_tx,
|
||||
.start = ath9k_start,
|
||||
|
@ -375,6 +375,9 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
|
||||
{
|
||||
u32 rfilt;
|
||||
|
||||
if (config_enabled(CONFIG_ATH9K_TX99))
|
||||
return 0;
|
||||
|
||||
rfilt = ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
|
||||
| ATH9K_RX_FILTER_MCAST;
|
||||
|
||||
@ -972,14 +975,15 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
|
||||
{
|
||||
#ifdef CONFIG_ATH9K_DEBUGFS
|
||||
struct ath_hw *ah = sc->sc_ah;
|
||||
u8 bins[SPECTRAL_HT20_NUM_BINS];
|
||||
u8 *vdata = (u8 *)hdr;
|
||||
struct fft_sample_ht20 fft_sample;
|
||||
u8 num_bins, *bins, *vdata = (u8 *)hdr;
|
||||
struct fft_sample_ht20 fft_sample_20;
|
||||
struct fft_sample_ht20_40 fft_sample_40;
|
||||
struct fft_sample_tlv *tlv;
|
||||
struct ath_radar_info *radar_info;
|
||||
struct ath_ht20_mag_info *mag_info;
|
||||
int len = rs->rs_datalen;
|
||||
int dc_pos;
|
||||
u16 length, max_magnitude;
|
||||
u16 fft_len, length, freq = ah->curchan->chan->center_freq;
|
||||
enum nl80211_channel_type chan_type;
|
||||
|
||||
/* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer
|
||||
* via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT
|
||||
@ -997,45 +1001,44 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
|
||||
if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK))
|
||||
return 0;
|
||||
|
||||
/* Variation in the data length is possible and will be fixed later.
|
||||
* Note that we only support HT20 for now.
|
||||
*
|
||||
* TODO: add HT20_40 support as well.
|
||||
*/
|
||||
if ((len > SPECTRAL_HT20_TOTAL_DATA_LEN + 2) ||
|
||||
(len < SPECTRAL_HT20_TOTAL_DATA_LEN - 1))
|
||||
chan_type = cfg80211_get_chandef_type(&sc->hw->conf.chandef);
|
||||
if ((chan_type == NL80211_CHAN_HT40MINUS) ||
|
||||
(chan_type == NL80211_CHAN_HT40PLUS)) {
|
||||
fft_len = SPECTRAL_HT20_40_TOTAL_DATA_LEN;
|
||||
num_bins = SPECTRAL_HT20_40_NUM_BINS;
|
||||
bins = (u8 *)fft_sample_40.data;
|
||||
} else {
|
||||
fft_len = SPECTRAL_HT20_TOTAL_DATA_LEN;
|
||||
num_bins = SPECTRAL_HT20_NUM_BINS;
|
||||
bins = (u8 *)fft_sample_20.data;
|
||||
}
|
||||
|
||||
/* Variation in the data length is possible and will be fixed later */
|
||||
if ((len > fft_len + 2) || (len < fft_len - 1))
|
||||
return 1;
|
||||
|
||||
fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20;
|
||||
length = sizeof(fft_sample) - sizeof(fft_sample.tlv);
|
||||
fft_sample.tlv.length = __cpu_to_be16(length);
|
||||
|
||||
fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq);
|
||||
fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
|
||||
fft_sample.noise = ah->noise;
|
||||
|
||||
switch (len - SPECTRAL_HT20_TOTAL_DATA_LEN) {
|
||||
switch (len - fft_len) {
|
||||
case 0:
|
||||
/* length correct, nothing to do. */
|
||||
memcpy(bins, vdata, SPECTRAL_HT20_NUM_BINS);
|
||||
memcpy(bins, vdata, num_bins);
|
||||
break;
|
||||
case -1:
|
||||
/* first byte missing, duplicate it. */
|
||||
memcpy(&bins[1], vdata, SPECTRAL_HT20_NUM_BINS - 1);
|
||||
memcpy(&bins[1], vdata, num_bins - 1);
|
||||
bins[0] = vdata[0];
|
||||
break;
|
||||
case 2:
|
||||
/* MAC added 2 extra bytes at bin 30 and 32, remove them. */
|
||||
memcpy(bins, vdata, 30);
|
||||
bins[30] = vdata[31];
|
||||
memcpy(&bins[31], &vdata[33], SPECTRAL_HT20_NUM_BINS - 31);
|
||||
memcpy(&bins[31], &vdata[33], num_bins - 31);
|
||||
break;
|
||||
case 1:
|
||||
/* MAC added 2 extra bytes AND first byte is missing. */
|
||||
bins[0] = vdata[0];
|
||||
memcpy(&bins[0], vdata, 30);
|
||||
memcpy(&bins[1], vdata, 30);
|
||||
bins[31] = vdata[31];
|
||||
memcpy(&bins[32], &vdata[33], SPECTRAL_HT20_NUM_BINS - 32);
|
||||
memcpy(&bins[32], &vdata[33], num_bins - 32);
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
@ -1044,23 +1047,93 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
|
||||
/* DC value (value in the middle) is the blind spot of the spectral
|
||||
* sample and invalid, interpolate it.
|
||||
*/
|
||||
dc_pos = SPECTRAL_HT20_NUM_BINS / 2;
|
||||
dc_pos = num_bins / 2;
|
||||
bins[dc_pos] = (bins[dc_pos + 1] + bins[dc_pos - 1]) / 2;
|
||||
|
||||
/* mag data is at the end of the frame, in front of radar_info */
|
||||
mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;
|
||||
if ((chan_type == NL80211_CHAN_HT40MINUS) ||
|
||||
(chan_type == NL80211_CHAN_HT40PLUS)) {
|
||||
s8 lower_rssi, upper_rssi;
|
||||
s16 ext_nf;
|
||||
u8 lower_max_index, upper_max_index;
|
||||
u8 lower_bitmap_w, upper_bitmap_w;
|
||||
u16 lower_mag, upper_mag;
|
||||
struct ath9k_hw_cal_data *caldata = ah->caldata;
|
||||
struct ath_ht20_40_mag_info *mag_info;
|
||||
|
||||
/* copy raw bins without scaling them */
|
||||
memcpy(fft_sample.data, bins, SPECTRAL_HT20_NUM_BINS);
|
||||
fft_sample.max_exp = mag_info->max_exp & 0xf;
|
||||
if (caldata)
|
||||
ext_nf = ath9k_hw_getchan_noise(ah, ah->curchan,
|
||||
caldata->nfCalHist[3].privNF);
|
||||
else
|
||||
ext_nf = ATH_DEFAULT_NOISE_FLOOR;
|
||||
|
||||
max_magnitude = spectral_max_magnitude(mag_info->all_bins);
|
||||
fft_sample.max_magnitude = __cpu_to_be16(max_magnitude);
|
||||
fft_sample.max_index = spectral_max_index(mag_info->all_bins);
|
||||
fft_sample.bitmap_weight = spectral_bitmap_weight(mag_info->all_bins);
|
||||
fft_sample.tsf = __cpu_to_be64(tsf);
|
||||
length = sizeof(fft_sample_40) - sizeof(struct fft_sample_tlv);
|
||||
fft_sample_40.tlv.type = ATH_FFT_SAMPLE_HT20_40;
|
||||
fft_sample_40.tlv.length = __cpu_to_be16(length);
|
||||
fft_sample_40.freq = __cpu_to_be16(freq);
|
||||
fft_sample_40.channel_type = chan_type;
|
||||
|
||||
ath_debug_send_fft_sample(sc, &fft_sample.tlv);
|
||||
if (chan_type == NL80211_CHAN_HT40PLUS) {
|
||||
lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
|
||||
upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
|
||||
|
||||
fft_sample_40.lower_noise = ah->noise;
|
||||
fft_sample_40.upper_noise = ext_nf;
|
||||
} else {
|
||||
lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
|
||||
upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
|
||||
|
||||
fft_sample_40.lower_noise = ext_nf;
|
||||
fft_sample_40.upper_noise = ah->noise;
|
||||
}
|
||||
fft_sample_40.lower_rssi = lower_rssi;
|
||||
fft_sample_40.upper_rssi = upper_rssi;
|
||||
|
||||
mag_info = ((struct ath_ht20_40_mag_info *)radar_info) - 1;
|
||||
lower_mag = spectral_max_magnitude(mag_info->lower_bins);
|
||||
upper_mag = spectral_max_magnitude(mag_info->upper_bins);
|
||||
fft_sample_40.lower_max_magnitude = __cpu_to_be16(lower_mag);
|
||||
fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);
|
||||
lower_max_index = spectral_max_index(mag_info->lower_bins);
|
||||
upper_max_index = spectral_max_index(mag_info->upper_bins);
|
||||
fft_sample_40.lower_max_index = lower_max_index;
|
||||
fft_sample_40.upper_max_index = upper_max_index;
|
||||
lower_bitmap_w = spectral_bitmap_weight(mag_info->lower_bins);
|
||||
upper_bitmap_w = spectral_bitmap_weight(mag_info->upper_bins);
|
||||
fft_sample_40.lower_bitmap_weight = lower_bitmap_w;
|
||||
fft_sample_40.upper_bitmap_weight = upper_bitmap_w;
|
||||
fft_sample_40.max_exp = mag_info->max_exp & 0xf;
|
||||
|
||||
fft_sample_40.tsf = __cpu_to_be64(tsf);
|
||||
|
||||
tlv = (struct fft_sample_tlv *)&fft_sample_40;
|
||||
} else {
|
||||
u8 max_index, bitmap_w;
|
||||
u16 magnitude;
|
||||
struct ath_ht20_mag_info *mag_info;
|
||||
|
||||
length = sizeof(fft_sample_20) - sizeof(struct fft_sample_tlv);
|
||||
fft_sample_20.tlv.type = ATH_FFT_SAMPLE_HT20;
|
||||
fft_sample_20.tlv.length = __cpu_to_be16(length);
|
||||
fft_sample_20.freq = __cpu_to_be16(freq);
|
||||
|
||||
fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
|
||||
fft_sample_20.noise = ah->noise;
|
||||
|
||||
mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;
|
||||
magnitude = spectral_max_magnitude(mag_info->all_bins);
|
||||
fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);
|
||||
max_index = spectral_max_index(mag_info->all_bins);
|
||||
fft_sample_20.max_index = max_index;
|
||||
bitmap_w = spectral_bitmap_weight(mag_info->all_bins);
|
||||
fft_sample_20.bitmap_weight = bitmap_w;
|
||||
fft_sample_20.max_exp = mag_info->max_exp & 0xf;
|
||||
|
||||
fft_sample_20.tsf = __cpu_to_be64(tsf);
|
||||
|
||||
tlv = (struct fft_sample_tlv *)&fft_sample_20;
|
||||
}
|
||||
|
||||
ath_debug_send_fft_sample(sc, tlv);
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
|
@ -1241,12 +1241,13 @@ static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
|
||||
if (bf->bf_next)
|
||||
info.link = bf->bf_next->bf_daddr;
|
||||
else
|
||||
info.link = 0;
|
||||
info.link = (sc->tx99_state) ? bf->bf_daddr : 0;
|
||||
|
||||
if (!bf_first) {
|
||||
bf_first = bf;
|
||||
|
||||
info.flags = ATH9K_TXDESC_INTREQ;
|
||||
if (!sc->tx99_state)
|
||||
info.flags = ATH9K_TXDESC_INTREQ;
|
||||
if ((tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) ||
|
||||
txq == sc->tx.uapsdq)
|
||||
info.flags |= ATH9K_TXDESC_CLRDMASK;
|
||||
@ -1941,7 +1942,7 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
|
||||
txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
|
||||
}
|
||||
|
||||
if (!edma) {
|
||||
if (!edma || sc->tx99_state) {
|
||||
TX_STAT_INC(txq->axq_qnum, txstart);
|
||||
ath9k_hw_txstart(ah, txq->axq_qnum);
|
||||
}
|
||||
@ -2020,6 +2021,9 @@ static void setup_frame_info(struct ieee80211_hw *hw,
|
||||
fi->keyix = ATH9K_TXKEYIX_INVALID;
|
||||
fi->keytype = keytype;
|
||||
fi->framelen = framelen;
|
||||
|
||||
if (!rate)
|
||||
return;
|
||||
fi->rtscts_rate = rate->hw_value;
|
||||
if (short_preamble)
|
||||
fi->rtscts_rate |= rate->hw_value_short;
|
||||
@ -2371,6 +2375,8 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
|
||||
|
||||
dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
|
||||
bf->bf_buf_addr = 0;
|
||||
if (sc->tx99_state)
|
||||
goto skip_tx_complete;
|
||||
|
||||
if (bf->bf_state.bfs_paprd) {
|
||||
if (time_after(jiffies,
|
||||
@ -2383,6 +2389,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
|
||||
ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
|
||||
ath_tx_complete(sc, skb, tx_flags, txq);
|
||||
}
|
||||
skip_tx_complete:
|
||||
/* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
|
||||
* accidentally reference it later.
|
||||
*/
|
||||
@ -2741,3 +2748,46 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
|
||||
ath_txq_unlock(sc, txq);
|
||||
}
|
||||
}
|
||||
|
||||
int ath9k_tx99_send(struct ath_softc *sc, struct sk_buff *skb,
|
||||
struct ath_tx_control *txctl)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct ath_frame_info *fi = get_frame_info(skb);
|
||||
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
||||
struct ath_buf *bf;
|
||||
int padpos, padsize;
|
||||
|
||||
padpos = ieee80211_hdrlen(hdr->frame_control);
|
||||
padsize = padpos & 3;
|
||||
|
||||
if (padsize && skb->len > padpos) {
|
||||
if (skb_headroom(skb) < padsize) {
|
||||
ath_dbg(common, XMIT,
|
||||
"tx99 padding failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
skb_push(skb, padsize);
|
||||
memmove(skb->data, skb->data + padsize, padpos);
|
||||
}
|
||||
|
||||
fi->keyix = ATH9K_TXKEYIX_INVALID;
|
||||
fi->framelen = skb->len + FCS_LEN;
|
||||
fi->keytype = ATH9K_KEY_TYPE_CLEAR;
|
||||
|
||||
bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb);
|
||||
if (!bf) {
|
||||
ath_dbg(common, XMIT, "tx99 buffer setup failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ath_set_rates(sc->tx99_vif, NULL, bf);
|
||||
|
||||
ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
|
||||
ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
|
||||
|
||||
ath_tx_send_normal(sc, txctl->txq, NULL, skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "dfs_pattern_detector.h"
|
||||
#include "dfs_pri_detector.h"
|
||||
#include "ath9k.h"
|
||||
#include "ath.h"
|
||||
|
||||
/*
|
||||
* tolerated deviation of radar time stamp in usecs on both sides
|
||||
@ -143,7 +143,6 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq)
|
||||
{
|
||||
u32 sz, i;
|
||||
struct channel_detector *cd;
|
||||
struct ath_common *common = ath9k_hw_common(dpd->ah);
|
||||
|
||||
cd = kmalloc(sizeof(*cd), GFP_ATOMIC);
|
||||
if (cd == NULL)
|
||||
@ -167,7 +166,7 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq)
|
||||
return cd;
|
||||
|
||||
fail:
|
||||
ath_dbg(common, DFS,
|
||||
ath_dbg(dpd->common, DFS,
|
||||
"failed to allocate channel_detector for freq=%d\n", freq);
|
||||
channel_detector_exit(dpd, cd);
|
||||
return NULL;
|
||||
@ -242,7 +241,7 @@ dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event)
|
||||
struct pri_detector *pd = cd->detectors[i];
|
||||
struct pri_sequence *ps = pd->add_pulse(pd, event);
|
||||
if (ps != NULL) {
|
||||
ath_dbg(ath9k_hw_common(dpd->ah), DFS,
|
||||
ath_dbg(dpd->common, DFS,
|
||||
"DFS: radar found on freq=%d: id=%d, pri=%d, "
|
||||
"count=%d, count_false=%d\n",
|
||||
event->freq, pd->rs->type_id,
|
||||
@ -254,6 +253,12 @@ dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
static struct ath_dfs_pool_stats
|
||||
dpd_get_stats(struct dfs_pattern_detector *dpd)
|
||||
{
|
||||
return global_dfs_pool_stats;
|
||||
}
|
||||
|
||||
static bool dpd_set_domain(struct dfs_pattern_detector *dpd,
|
||||
enum nl80211_dfs_regions region)
|
||||
{
|
||||
@ -284,14 +289,18 @@ static struct dfs_pattern_detector default_dpd = {
|
||||
.exit = dpd_exit,
|
||||
.set_dfs_domain = dpd_set_domain,
|
||||
.add_pulse = dpd_add_pulse,
|
||||
.get_stats = dpd_get_stats,
|
||||
.region = NL80211_DFS_UNSET,
|
||||
};
|
||||
|
||||
struct dfs_pattern_detector *
|
||||
dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region)
|
||||
dfs_pattern_detector_init(struct ath_common *common,
|
||||
enum nl80211_dfs_regions region)
|
||||
{
|
||||
struct dfs_pattern_detector *dpd;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
|
||||
if (!config_enabled(CONFIG_CFG80211_CERTIFICATION_ONUS))
|
||||
return NULL;
|
||||
|
||||
dpd = kmalloc(sizeof(*dpd), GFP_KERNEL);
|
||||
if (dpd == NULL)
|
||||
@ -300,7 +309,7 @@ dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region)
|
||||
*dpd = default_dpd;
|
||||
INIT_LIST_HEAD(&dpd->channel_detectors);
|
||||
|
||||
dpd->ah = ah;
|
||||
dpd->common = common;
|
||||
if (dpd->set_dfs_domain(dpd, region))
|
||||
return dpd;
|
||||
|
@ -21,6 +21,19 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/nl80211.h>
|
||||
|
||||
/**
|
||||
* struct ath_dfs_pool_stats - DFS Statistics for global pools
|
||||
*/
|
||||
struct ath_dfs_pool_stats {
|
||||
u32 pool_reference;
|
||||
u32 pulse_allocated;
|
||||
u32 pulse_alloc_error;
|
||||
u32 pulse_used;
|
||||
u32 pseq_allocated;
|
||||
u32 pseq_alloc_error;
|
||||
u32 pseq_used;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pulse_event - describing pulses reported by PHY
|
||||
* @ts: pulse time stamp in us
|
||||
@ -77,11 +90,12 @@ struct dfs_pattern_detector {
|
||||
bool (*add_pulse)(struct dfs_pattern_detector *dpd,
|
||||
struct pulse_event *pe);
|
||||
|
||||
struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd);
|
||||
enum nl80211_dfs_regions region;
|
||||
u8 num_radar_types;
|
||||
u64 last_pulse_ts;
|
||||
/* needed for ath_dbg() */
|
||||
struct ath_hw *ah;
|
||||
struct ath_common *common;
|
||||
|
||||
const struct radar_detector_specs *radar_spec;
|
||||
struct list_head channel_detectors;
|
||||
@ -92,15 +106,7 @@ struct dfs_pattern_detector {
|
||||
* @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation
|
||||
* @return instance pointer on success, NULL otherwise
|
||||
*/
|
||||
#if defined(CONFIG_ATH9K_DFS_CERTIFIED)
|
||||
extern struct dfs_pattern_detector *
|
||||
dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region);
|
||||
#else
|
||||
static inline struct dfs_pattern_detector *
|
||||
dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_ATH9K_DFS_CERTIFIED */
|
||||
|
||||
dfs_pattern_detector_init(struct ath_common *common,
|
||||
enum nl80211_dfs_regions region);
|
||||
#endif /* DFS_PATTERN_DETECTOR_H */
|
@ -17,10 +17,14 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include "ath9k.h"
|
||||
#include "ath.h"
|
||||
#include "dfs_pattern_detector.h"
|
||||
#include "dfs_pri_detector.h"
|
||||
#include "dfs_debug.h"
|
||||
|
||||
struct ath_dfs_pool_stats global_dfs_pool_stats = {};
|
||||
|
||||
#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
|
||||
#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
|
||||
|
||||
/**
|
||||
* struct pulse_elem - elements in pulse queue
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
extern struct ath_dfs_pool_stats global_dfs_pool_stats;
|
||||
|
||||
/**
|
||||
* struct pri_sequence - sequence of pulses matching one PRI
|
||||
* @head: list_head
|
@ -356,14 +356,131 @@ static u16 ath_regd_find_country_by_name(char *alpha2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int __ath_reg_dyn_country(struct wiphy *wiphy,
|
||||
struct ath_regulatory *reg,
|
||||
struct regulatory_request *request)
|
||||
{
|
||||
u16 country_code;
|
||||
|
||||
if (!ath_is_world_regd(reg))
|
||||
return -EINVAL;
|
||||
|
||||
country_code = ath_regd_find_country_by_name(request->alpha2);
|
||||
if (country_code == (u16) -1)
|
||||
return -EINVAL;
|
||||
|
||||
reg->current_rd = COUNTRY_ERD_FLAG;
|
||||
reg->current_rd |= country_code;
|
||||
|
||||
__ath_regd_init(reg);
|
||||
|
||||
ath_reg_apply_world_flags(wiphy, request->initiator, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ath_reg_dyn_country(struct wiphy *wiphy,
|
||||
struct ath_regulatory *reg,
|
||||
struct regulatory_request *request)
|
||||
{
|
||||
if (__ath_reg_dyn_country(wiphy, reg, request))
|
||||
return;
|
||||
|
||||
printk(KERN_DEBUG "ath: regdomain 0x%0x "
|
||||
"dynamically updated by %s\n",
|
||||
reg->current_rd,
|
||||
reg_initiator_name(request->initiator));
|
||||
}
|
||||
|
||||
static bool dynamic_country_user_possible(struct ath_regulatory *reg)
|
||||
{
|
||||
if (config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
|
||||
return true;
|
||||
|
||||
switch (reg->country_code) {
|
||||
case CTRY_UNITED_STATES:
|
||||
case CTRY_JAPAN1:
|
||||
case CTRY_JAPAN2:
|
||||
case CTRY_JAPAN3:
|
||||
case CTRY_JAPAN4:
|
||||
case CTRY_JAPAN5:
|
||||
case CTRY_JAPAN6:
|
||||
case CTRY_JAPAN7:
|
||||
case CTRY_JAPAN8:
|
||||
case CTRY_JAPAN9:
|
||||
case CTRY_JAPAN10:
|
||||
case CTRY_JAPAN11:
|
||||
case CTRY_JAPAN12:
|
||||
case CTRY_JAPAN13:
|
||||
case CTRY_JAPAN14:
|
||||
case CTRY_JAPAN15:
|
||||
case CTRY_JAPAN16:
|
||||
case CTRY_JAPAN17:
|
||||
case CTRY_JAPAN18:
|
||||
case CTRY_JAPAN19:
|
||||
case CTRY_JAPAN20:
|
||||
case CTRY_JAPAN21:
|
||||
case CTRY_JAPAN22:
|
||||
case CTRY_JAPAN23:
|
||||
case CTRY_JAPAN24:
|
||||
case CTRY_JAPAN25:
|
||||
case CTRY_JAPAN26:
|
||||
case CTRY_JAPAN27:
|
||||
case CTRY_JAPAN28:
|
||||
case CTRY_JAPAN29:
|
||||
case CTRY_JAPAN30:
|
||||
case CTRY_JAPAN31:
|
||||
case CTRY_JAPAN32:
|
||||
case CTRY_JAPAN33:
|
||||
case CTRY_JAPAN34:
|
||||
case CTRY_JAPAN35:
|
||||
case CTRY_JAPAN36:
|
||||
case CTRY_JAPAN37:
|
||||
case CTRY_JAPAN38:
|
||||
case CTRY_JAPAN39:
|
||||
case CTRY_JAPAN40:
|
||||
case CTRY_JAPAN41:
|
||||
case CTRY_JAPAN42:
|
||||
case CTRY_JAPAN43:
|
||||
case CTRY_JAPAN44:
|
||||
case CTRY_JAPAN45:
|
||||
case CTRY_JAPAN46:
|
||||
case CTRY_JAPAN47:
|
||||
case CTRY_JAPAN48:
|
||||
case CTRY_JAPAN49:
|
||||
case CTRY_JAPAN50:
|
||||
case CTRY_JAPAN51:
|
||||
case CTRY_JAPAN52:
|
||||
case CTRY_JAPAN53:
|
||||
case CTRY_JAPAN54:
|
||||
case CTRY_JAPAN55:
|
||||
case CTRY_JAPAN56:
|
||||
case CTRY_JAPAN57:
|
||||
case CTRY_JAPAN58:
|
||||
case CTRY_JAPAN59:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ath_reg_dyn_country_user(struct wiphy *wiphy,
|
||||
struct ath_regulatory *reg,
|
||||
struct regulatory_request *request)
|
||||
{
|
||||
if (!config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS))
|
||||
return;
|
||||
if (!dynamic_country_user_possible(reg))
|
||||
return;
|
||||
ath_reg_dyn_country(wiphy, reg, request);
|
||||
}
|
||||
|
||||
void ath_reg_notifier_apply(struct wiphy *wiphy,
|
||||
struct regulatory_request *request,
|
||||
struct ath_regulatory *reg)
|
||||
{
|
||||
struct ath_common *common = container_of(reg, struct ath_common,
|
||||
regulatory);
|
||||
u16 country_code;
|
||||
|
||||
/* We always apply this */
|
||||
ath_reg_apply_radar_flags(wiphy);
|
||||
|
||||
@ -388,25 +505,12 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
|
||||
sizeof(struct ath_regulatory));
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_DRIVER:
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_USER:
|
||||
ath_reg_dyn_country_user(wiphy, reg, request);
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
|
||||
if (!ath_is_world_regd(reg))
|
||||
break;
|
||||
|
||||
country_code = ath_regd_find_country_by_name(request->alpha2);
|
||||
if (country_code == (u16) -1)
|
||||
break;
|
||||
|
||||
reg->current_rd = COUNTRY_ERD_FLAG;
|
||||
reg->current_rd |= country_code;
|
||||
|
||||
printk(KERN_DEBUG "ath: regdomain 0x%0x updated by CountryIE\n",
|
||||
reg->current_rd);
|
||||
__ath_regd_init(reg);
|
||||
|
||||
ath_reg_apply_world_flags(wiphy, request->initiator, reg);
|
||||
|
||||
ath_reg_dyn_country(wiphy, reg, request);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3212,7 +3212,7 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
|
||||
if (subtype == IEEE80211_STYPE_REASSOC_RESP &&
|
||||
status != WLAN_STATUS_ASSOC_DENIED_RATES &&
|
||||
status != WLAN_STATUS_CAPS_UNSUPPORTED &&
|
||||
priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {
|
||||
priv->ReAssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {
|
||||
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
|
||||
priv->ReAssociationRequestRetryCnt++;
|
||||
send_association_request(priv, 1);
|
||||
|
@ -164,7 +164,8 @@ static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field,
|
||||
}
|
||||
en_addr = en_addrs[override][i];
|
||||
|
||||
val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1;
|
||||
if (e)
|
||||
val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1;
|
||||
|
||||
if (off) {
|
||||
b43_phy_mask(dev, en_addr, ~en_mask);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <linux/mmc/sdio.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/platform_data/brcmfmac-sdio.h>
|
||||
|
||||
#include <defs.h>
|
||||
@ -239,7 +238,9 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||
func_num = SDIO_FUNC_1;
|
||||
reg_size = 4;
|
||||
|
||||
brcmf_sdio_addrprep(sdiodev, reg_size, &addr);
|
||||
ret = brcmf_sdio_addrprep(sdiodev, reg_size, &addr);
|
||||
if (ret)
|
||||
goto done;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -255,6 +256,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||
func_num, addr, data, 4);
|
||||
} while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
|
||||
|
||||
done:
|
||||
if (ret != 0)
|
||||
brcmf_err("failed with %d\n", ret);
|
||||
|
||||
@ -315,8 +317,36 @@ void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||
*ret = retval;
|
||||
}
|
||||
|
||||
static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
bool write, u32 addr, struct sk_buff *pkt)
|
||||
{
|
||||
unsigned int req_sz;
|
||||
|
||||
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
|
||||
if (brcmf_pm_resume_error(sdiodev))
|
||||
return -EIO;
|
||||
|
||||
/* Single skb use the standard mmc interface */
|
||||
req_sz = pkt->len + 3;
|
||||
req_sz &= (uint)~3;
|
||||
|
||||
if (write)
|
||||
return sdio_memcpy_toio(sdiodev->func[fn], addr,
|
||||
((u8 *)(pkt->data)),
|
||||
req_sz);
|
||||
else if (fn == 1)
|
||||
return sdio_memcpy_fromio(sdiodev->func[fn],
|
||||
((u8 *)(pkt->data)),
|
||||
addr, req_sz);
|
||||
else
|
||||
/* function 2 read is FIFO operation */
|
||||
return sdio_readsb(sdiodev->func[fn],
|
||||
((u8 *)(pkt->data)), addr,
|
||||
req_sz);
|
||||
}
|
||||
|
||||
/**
|
||||
* brcmf_sdio_buffrw - SDIO interface function for block data access
|
||||
* brcmf_sdio_sglist_rw - SDIO interface function for block data access
|
||||
* @sdiodev: brcmfmac sdio device
|
||||
* @fn: SDIO function number
|
||||
* @write: direction flag
|
||||
@ -327,12 +357,13 @@ void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||
* stack for block data access. It assumes that the skb passed down by the
|
||||
* caller has already been padded and aligned.
|
||||
*/
|
||||
static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
bool write, u32 addr, struct sk_buff_head *pktlist)
|
||||
static int brcmf_sdio_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
bool write, u32 addr,
|
||||
struct sk_buff_head *pktlist)
|
||||
{
|
||||
unsigned int req_sz, func_blk_sz, sg_cnt, sg_data_sz, pkt_offset;
|
||||
unsigned int max_blks, max_req_sz, orig_offset, dst_offset;
|
||||
unsigned short max_seg_sz, seg_sz;
|
||||
unsigned int max_req_sz, orig_offset, dst_offset;
|
||||
unsigned short max_seg_cnt, seg_sz;
|
||||
unsigned char *pkt_data, *orig_data, *dst_data;
|
||||
struct sk_buff *pkt_next = NULL, *local_pkt_next;
|
||||
struct sk_buff_head local_list, *target_list;
|
||||
@ -341,7 +372,6 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
struct mmc_data mmc_dat;
|
||||
struct sg_table st;
|
||||
struct scatterlist *sgl;
|
||||
struct mmc_host *host;
|
||||
int ret = 0;
|
||||
|
||||
if (!pktlist->qlen)
|
||||
@ -351,27 +381,6 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
if (brcmf_pm_resume_error(sdiodev))
|
||||
return -EIO;
|
||||
|
||||
/* Single skb use the standard mmc interface */
|
||||
if (pktlist->qlen == 1) {
|
||||
pkt_next = pktlist->next;
|
||||
req_sz = pkt_next->len + 3;
|
||||
req_sz &= (uint)~3;
|
||||
|
||||
if (write)
|
||||
return sdio_memcpy_toio(sdiodev->func[fn], addr,
|
||||
((u8 *)(pkt_next->data)),
|
||||
req_sz);
|
||||
else if (fn == 1)
|
||||
return sdio_memcpy_fromio(sdiodev->func[fn],
|
||||
((u8 *)(pkt_next->data)),
|
||||
addr, req_sz);
|
||||
else
|
||||
/* function 2 read is FIFO operation */
|
||||
return sdio_readsb(sdiodev->func[fn],
|
||||
((u8 *)(pkt_next->data)), addr,
|
||||
req_sz);
|
||||
}
|
||||
|
||||
target_list = pktlist;
|
||||
/* for host with broken sg support, prepare a page aligned list */
|
||||
__skb_queue_head_init(&local_list);
|
||||
@ -398,38 +407,46 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
target_list = &local_list;
|
||||
}
|
||||
|
||||
host = sdiodev->func[fn]->card->host;
|
||||
func_blk_sz = sdiodev->func[fn]->cur_blksize;
|
||||
/* Blocks per command is limited by host count, host transfer
|
||||
* size and the maximum for IO_RW_EXTENDED of 511 blocks.
|
||||
*/
|
||||
max_blks = min_t(unsigned int, host->max_blk_count, 511u);
|
||||
max_req_sz = min_t(unsigned int, host->max_req_size,
|
||||
max_blks * func_blk_sz);
|
||||
max_seg_sz = min_t(unsigned short, host->max_segs, SG_MAX_SINGLE_ALLOC);
|
||||
max_seg_sz = min_t(unsigned short, max_seg_sz, target_list->qlen);
|
||||
max_req_sz = sdiodev->max_request_size;
|
||||
max_seg_cnt = min_t(unsigned short, sdiodev->max_segment_count,
|
||||
target_list->qlen);
|
||||
seg_sz = target_list->qlen;
|
||||
pkt_offset = 0;
|
||||
pkt_next = target_list->next;
|
||||
|
||||
if (sg_alloc_table(&st, max_seg_sz, GFP_KERNEL)) {
|
||||
if (sg_alloc_table(&st, max_seg_cnt, GFP_KERNEL)) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset(&mmc_req, 0, sizeof(struct mmc_request));
|
||||
memset(&mmc_cmd, 0, sizeof(struct mmc_command));
|
||||
memset(&mmc_dat, 0, sizeof(struct mmc_data));
|
||||
|
||||
mmc_dat.sg = st.sgl;
|
||||
mmc_dat.blksz = func_blk_sz;
|
||||
mmc_dat.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ;
|
||||
mmc_cmd.opcode = SD_IO_RW_EXTENDED;
|
||||
mmc_cmd.arg = write ? 1<<31 : 0; /* write flag */
|
||||
mmc_cmd.arg |= (fn & 0x7) << 28; /* SDIO func num */
|
||||
mmc_cmd.arg |= 1<<27; /* block mode */
|
||||
/* for function 1 the addr will be incremented */
|
||||
mmc_cmd.arg |= (fn == 1) ? 1<<26 : 0;
|
||||
mmc_cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
|
||||
mmc_req.cmd = &mmc_cmd;
|
||||
mmc_req.data = &mmc_dat;
|
||||
|
||||
while (seg_sz) {
|
||||
req_sz = 0;
|
||||
sg_cnt = 0;
|
||||
memset(&mmc_req, 0, sizeof(struct mmc_request));
|
||||
memset(&mmc_cmd, 0, sizeof(struct mmc_command));
|
||||
memset(&mmc_dat, 0, sizeof(struct mmc_data));
|
||||
sgl = st.sgl;
|
||||
/* prep sg table */
|
||||
while (pkt_next != (struct sk_buff *)target_list) {
|
||||
pkt_data = pkt_next->data + pkt_offset;
|
||||
sg_data_sz = pkt_next->len - pkt_offset;
|
||||
if (sg_data_sz > host->max_seg_size)
|
||||
sg_data_sz = host->max_seg_size;
|
||||
if (sg_data_sz > sdiodev->max_segment_size)
|
||||
sg_data_sz = sdiodev->max_segment_size;
|
||||
if (sg_data_sz > max_req_sz - req_sz)
|
||||
sg_data_sz = max_req_sz - req_sz;
|
||||
|
||||
@ -444,7 +461,7 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
pkt_next = pkt_next->next;
|
||||
}
|
||||
|
||||
if (req_sz >= max_req_sz || sg_cnt >= max_seg_sz)
|
||||
if (req_sz >= max_req_sz || sg_cnt >= max_seg_cnt)
|
||||
break;
|
||||
}
|
||||
seg_sz -= sg_cnt;
|
||||
@ -455,27 +472,17 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||
ret = -ENOTBLK;
|
||||
goto exit;
|
||||
}
|
||||
mmc_dat.sg = st.sgl;
|
||||
|
||||
mmc_dat.sg_len = sg_cnt;
|
||||
mmc_dat.blksz = func_blk_sz;
|
||||
mmc_dat.blocks = req_sz / func_blk_sz;
|
||||
mmc_dat.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ;
|
||||
mmc_cmd.opcode = SD_IO_RW_EXTENDED;
|
||||
mmc_cmd.arg = write ? 1<<31 : 0; /* write flag */
|
||||
mmc_cmd.arg |= (fn & 0x7) << 28; /* SDIO func num */
|
||||
mmc_cmd.arg |= 1<<27; /* block mode */
|
||||
/* incrementing addr for function 1 */
|
||||
mmc_cmd.arg |= (fn == 1) ? 1<<26 : 0;
|
||||
mmc_cmd.arg |= (addr & 0x1FFFF) << 9; /* address */
|
||||
mmc_cmd.arg |= mmc_dat.blocks & 0x1FF; /* block count */
|
||||
mmc_cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;
|
||||
mmc_req.cmd = &mmc_cmd;
|
||||
mmc_req.data = &mmc_dat;
|
||||
/* incrementing addr for function 1 */
|
||||
if (fn == 1)
|
||||
addr += req_sz;
|
||||
|
||||
mmc_set_data_timeout(&mmc_dat, sdiodev->func[fn]->card);
|
||||
mmc_wait_for_req(host, &mmc_req);
|
||||
mmc_wait_for_req(sdiodev->func[fn]->card->host, &mmc_req);
|
||||
|
||||
ret = mmc_cmd.error ? mmc_cmd.error : mmc_dat.error;
|
||||
if (ret != 0) {
|
||||
@ -546,7 +553,6 @@ brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
{
|
||||
uint width;
|
||||
int err = 0;
|
||||
struct sk_buff_head pkt_list;
|
||||
|
||||
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n",
|
||||
fn, addr, pkt->len);
|
||||
@ -556,19 +562,17 @@ brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
skb_queue_head_init(&pkt_list);
|
||||
skb_queue_tail(&pkt_list, pkt);
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, &pkt_list);
|
||||
skb_dequeue_tail(&pkt_list);
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, pkt);
|
||||
|
||||
done:
|
||||
return err;
|
||||
}
|
||||
|
||||
int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
uint flags, struct sk_buff_head *pktq)
|
||||
uint flags, struct sk_buff_head *pktq, uint totlen)
|
||||
{
|
||||
uint incr_fix;
|
||||
struct sk_buff *glom_skb;
|
||||
struct sk_buff *skb;
|
||||
uint width;
|
||||
int err = 0;
|
||||
|
||||
@ -580,8 +584,22 @@ int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC;
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, pktq);
|
||||
if (pktq->qlen == 1)
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, pktq->next);
|
||||
else if (!sdiodev->sg_support) {
|
||||
glom_skb = brcmu_pkt_buf_get_skb(totlen);
|
||||
if (!glom_skb)
|
||||
return -ENOMEM;
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, glom_skb);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
skb_queue_walk(pktq, skb) {
|
||||
memcpy(skb->data, glom_skb->data, skb->len);
|
||||
skb_pull(glom_skb, skb->len);
|
||||
}
|
||||
} else
|
||||
err = brcmf_sdio_sglist_rw(sdiodev, fn, false, addr, pktq);
|
||||
|
||||
done:
|
||||
return err;
|
||||
@ -592,7 +610,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
uint flags, u8 *buf, uint nbytes)
|
||||
{
|
||||
struct sk_buff *mypkt;
|
||||
struct sk_buff_head pktq;
|
||||
uint width;
|
||||
int err;
|
||||
|
||||
mypkt = brcmu_pkt_buf_get_skb(nbytes);
|
||||
@ -603,10 +621,12 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
}
|
||||
|
||||
memcpy(mypkt->data, buf, nbytes);
|
||||
__skb_queue_head_init(&pktq);
|
||||
__skb_queue_tail(&pktq, mypkt);
|
||||
err = brcmf_sdcard_send_pkt(sdiodev, addr, fn, flags, &pktq);
|
||||
__skb_dequeue_tail(&pktq);
|
||||
|
||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
||||
|
||||
if (!err)
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, mypkt);
|
||||
|
||||
brcmu_pkt_buf_free_skb(mypkt);
|
||||
return err;
|
||||
@ -617,16 +637,26 @@ int
|
||||
brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
uint flags, struct sk_buff_head *pktq)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
uint width;
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n",
|
||||
fn, addr, pktq->qlen);
|
||||
|
||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||
brcmf_sdio_addrprep(sdiodev, width, &addr);
|
||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, pktq);
|
||||
if (pktq->qlen == 1 || !sdiodev->sg_support)
|
||||
skb_queue_walk(pktq, skb) {
|
||||
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, skb);
|
||||
if (err)
|
||||
break;
|
||||
}
|
||||
else
|
||||
err = brcmf_sdio_sglist_rw(sdiodev, fn, true, addr, pktq);
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -639,7 +669,6 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||
struct sk_buff *pkt;
|
||||
u32 sdaddr;
|
||||
uint dsize;
|
||||
struct sk_buff_head pkt_list;
|
||||
|
||||
dsize = min_t(uint, SBSDIO_SB_OFT_ADDR_LIMIT, size);
|
||||
pkt = dev_alloc_skb(dsize);
|
||||
@ -648,7 +677,6 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||
return -EIO;
|
||||
}
|
||||
pkt->priority = 0;
|
||||
skb_queue_head_init(&pkt_list);
|
||||
|
||||
/* Determine initial transfer parameters */
|
||||
sdaddr = address & SBSDIO_SB_OFT_ADDR_MASK;
|
||||
@ -676,10 +704,8 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||
skb_put(pkt, dsize);
|
||||
if (write)
|
||||
memcpy(pkt->data, data, dsize);
|
||||
skb_queue_tail(&pkt_list, pkt);
|
||||
bcmerror = brcmf_sdio_buffrw(sdiodev, SDIO_FUNC_1, write,
|
||||
sdaddr, &pkt_list);
|
||||
skb_dequeue_tail(&pkt_list);
|
||||
sdaddr, pkt);
|
||||
if (bcmerror) {
|
||||
brcmf_err("membytes transfer failed\n");
|
||||
break;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/mmc/card.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/sched.h> /* request_irq() */
|
||||
@ -315,6 +316,8 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
|
||||
int err;
|
||||
struct brcmf_sdio_dev *sdiodev;
|
||||
struct brcmf_bus *bus_if;
|
||||
struct mmc_host *host;
|
||||
uint max_blocks;
|
||||
|
||||
brcmf_dbg(SDIO, "Enter\n");
|
||||
brcmf_dbg(SDIO, "Class=%x\n", func->class);
|
||||
@ -361,6 +364,20 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
|
||||
brcmf_err("F2 error, probe failed %d...\n", err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* determine host related variables after brcmf_sdio_probe()
|
||||
* as func->cur_blksize is properly set and F2 init has been
|
||||
* completed successfully.
|
||||
*/
|
||||
host = func->card->host;
|
||||
sdiodev->sg_support = host->max_segs > 1;
|
||||
max_blocks = min_t(uint, host->max_blk_count, 511u);
|
||||
sdiodev->max_request_size = min_t(uint, host->max_req_size,
|
||||
max_blocks * func->cur_blksize);
|
||||
sdiodev->max_segment_count = min_t(uint, host->max_segs,
|
||||
SG_MAX_SINGLE_ALLOC);
|
||||
sdiodev->max_segment_size = host->max_seg_size;
|
||||
brcmf_dbg(SDIO, "F2 init completed...\n");
|
||||
return 0;
|
||||
|
||||
|
@ -1147,6 +1147,8 @@ static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
|
||||
u8 rx_seq, fc, tx_seq_max;
|
||||
u32 swheader;
|
||||
|
||||
trace_brcmf_sdpcm_hdr(false, header);
|
||||
|
||||
/* hw header */
|
||||
len = get_unaligned_le16(header);
|
||||
checksum = get_unaligned_le16(header + sizeof(u16));
|
||||
@ -1269,6 +1271,7 @@ static void brcmf_sdio_hdpack(struct brcmf_sdio *bus, u8 *header,
|
||||
SDPCM_DOFFSET_MASK;
|
||||
*(((__le32 *)header) + 1) = cpu_to_le32(sw_header);
|
||||
*(((__le32 *)header) + 2) = 0;
|
||||
trace_brcmf_sdpcm_hdr(true, header);
|
||||
}
|
||||
|
||||
static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
|
||||
@ -1389,7 +1392,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
|
||||
sdio_claim_host(bus->sdiodev->func[1]);
|
||||
errcode = brcmf_sdcard_recv_chain(bus->sdiodev,
|
||||
bus->sdiodev->sbwad,
|
||||
SDIO_FUNC_2, F2SYNC, &bus->glom);
|
||||
SDIO_FUNC_2, F2SYNC, &bus->glom, dlen);
|
||||
sdio_release_host(bus->sdiodev->func[1]);
|
||||
bus->sdcnt.f2rxdata++;
|
||||
|
||||
@ -1877,6 +1880,56 @@ brcmf_sdbrcm_wait_event_wakeup(struct brcmf_sdio *bus)
|
||||
/* bit mask of data length chopped from the previous packet */
|
||||
#define ALIGN_SKB_CHOP_LEN_MASK 0x7fff
|
||||
|
||||
static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio_dev *sdiodev,
|
||||
struct sk_buff_head *pktq,
|
||||
struct sk_buff *pkt, uint chan)
|
||||
{
|
||||
struct sk_buff *pkt_pad;
|
||||
u16 tail_pad, tail_chop, sg_align;
|
||||
unsigned int blksize;
|
||||
u8 *dat_buf;
|
||||
int ntail;
|
||||
|
||||
blksize = sdiodev->func[SDIO_FUNC_2]->cur_blksize;
|
||||
sg_align = 4;
|
||||
if (sdiodev->pdata && sdiodev->pdata->sd_sgentry_align > 4)
|
||||
sg_align = sdiodev->pdata->sd_sgentry_align;
|
||||
/* sg entry alignment should be a divisor of block size */
|
||||
WARN_ON(blksize % sg_align);
|
||||
|
||||
/* Check tail padding */
|
||||
pkt_pad = NULL;
|
||||
tail_chop = pkt->len % sg_align;
|
||||
tail_pad = sg_align - tail_chop;
|
||||
tail_pad += blksize - (pkt->len + tail_pad) % blksize;
|
||||
if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) {
|
||||
pkt_pad = brcmu_pkt_buf_get_skb(tail_pad + tail_chop);
|
||||
if (pkt_pad == NULL)
|
||||
return -ENOMEM;
|
||||
memcpy(pkt_pad->data,
|
||||
pkt->data + pkt->len - tail_chop,
|
||||
tail_chop);
|
||||
*(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop;
|
||||
skb_trim(pkt, pkt->len - tail_chop);
|
||||
__skb_queue_after(pktq, pkt, pkt_pad);
|
||||
} else {
|
||||
ntail = pkt->data_len + tail_pad -
|
||||
(pkt->end - pkt->tail);
|
||||
if (skb_cloned(pkt) || ntail > 0)
|
||||
if (pskb_expand_head(pkt, 0, ntail, GFP_ATOMIC))
|
||||
return -ENOMEM;
|
||||
if (skb_linearize(pkt))
|
||||
return -ENOMEM;
|
||||
dat_buf = (u8 *)(pkt->data);
|
||||
__skb_put(pkt, tail_pad);
|
||||
}
|
||||
|
||||
if (pkt_pad)
|
||||
return pkt->len + tail_chop;
|
||||
else
|
||||
return pkt->len - tail_pad;
|
||||
}
|
||||
|
||||
/**
|
||||
* brcmf_sdio_txpkt_prep - packet preparation for transmit
|
||||
* @bus: brcmf_sdio structure pointer
|
||||
@ -1893,24 +1946,16 @@ static int
|
||||
brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
|
||||
uint chan)
|
||||
{
|
||||
u16 head_pad, tail_pad, tail_chop, head_align, sg_align;
|
||||
int ntail;
|
||||
struct sk_buff *pkt_next, *pkt_new;
|
||||
u16 head_pad, head_align;
|
||||
struct sk_buff *pkt_next;
|
||||
u8 *dat_buf;
|
||||
unsigned blksize = bus->sdiodev->func[SDIO_FUNC_2]->cur_blksize;
|
||||
int err;
|
||||
struct brcmf_sdio_hdrinfo hd_info = {0};
|
||||
|
||||
/* SDIO ADMA requires at least 32 bit alignment */
|
||||
head_align = 4;
|
||||
sg_align = 4;
|
||||
if (bus->sdiodev->pdata) {
|
||||
head_align = bus->sdiodev->pdata->sd_head_align > 4 ?
|
||||
bus->sdiodev->pdata->sd_head_align : 4;
|
||||
sg_align = bus->sdiodev->pdata->sd_sgentry_align > 4 ?
|
||||
bus->sdiodev->pdata->sd_sgentry_align : 4;
|
||||
}
|
||||
/* sg entry alignment should be a divisor of block size */
|
||||
WARN_ON(blksize % sg_align);
|
||||
if (bus->sdiodev->pdata && bus->sdiodev->pdata->sd_head_align > 4)
|
||||
head_align = bus->sdiodev->pdata->sd_head_align;
|
||||
|
||||
pkt_next = pktq->next;
|
||||
dat_buf = (u8 *)(pkt_next->data);
|
||||
@ -1929,40 +1974,20 @@ brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
|
||||
memset(dat_buf, 0, head_pad + bus->tx_hdrlen);
|
||||
}
|
||||
|
||||
/* Check tail padding */
|
||||
pkt_new = NULL;
|
||||
tail_chop = pkt_next->len % sg_align;
|
||||
tail_pad = sg_align - tail_chop;
|
||||
tail_pad += blksize - (pkt_next->len + tail_pad) % blksize;
|
||||
if (skb_tailroom(pkt_next) < tail_pad && pkt_next->len > blksize) {
|
||||
pkt_new = brcmu_pkt_buf_get_skb(tail_pad + tail_chop);
|
||||
if (pkt_new == NULL)
|
||||
return -ENOMEM;
|
||||
memcpy(pkt_new->data,
|
||||
pkt_next->data + pkt_next->len - tail_chop,
|
||||
tail_chop);
|
||||
*(u32 *)(pkt_new->cb) = ALIGN_SKB_FLAG + tail_chop;
|
||||
skb_trim(pkt_next, pkt_next->len - tail_chop);
|
||||
__skb_queue_after(pktq, pkt_next, pkt_new);
|
||||
if (bus->sdiodev->sg_support && pktq->qlen > 1) {
|
||||
err = brcmf_sdio_txpkt_prep_sg(bus->sdiodev, pktq,
|
||||
pkt_next, chan);
|
||||
if (err < 0)
|
||||
return err;
|
||||
hd_info.len = (u16)err;
|
||||
} else {
|
||||
ntail = pkt_next->data_len + tail_pad -
|
||||
(pkt_next->end - pkt_next->tail);
|
||||
if (skb_cloned(pkt_next) || ntail > 0)
|
||||
if (pskb_expand_head(pkt_next, 0, ntail, GFP_ATOMIC))
|
||||
return -ENOMEM;
|
||||
if (skb_linearize(pkt_next))
|
||||
return -ENOMEM;
|
||||
dat_buf = (u8 *)(pkt_next->data);
|
||||
__skb_put(pkt_next, tail_pad);
|
||||
hd_info.len = pkt_next->len;
|
||||
}
|
||||
|
||||
/* Now prep the header */
|
||||
if (pkt_new)
|
||||
hd_info.len = pkt_next->len + tail_chop;
|
||||
else
|
||||
hd_info.len = pkt_next->len - tail_pad;
|
||||
hd_info.channel = chan;
|
||||
hd_info.dat_offset = head_pad + bus->tx_hdrlen;
|
||||
|
||||
/* Now fill the header */
|
||||
brcmf_sdio_hdpack(bus, dat_buf, &hd_info);
|
||||
|
||||
if (BRCMF_BYTES_ON() &&
|
||||
|
@ -178,6 +178,10 @@ struct brcmf_sdio_dev {
|
||||
bool irq_en; /* irq enable flags */
|
||||
spinlock_t irq_en_lock;
|
||||
bool irq_wake; /* irq wake enable flags */
|
||||
bool sg_support;
|
||||
uint max_request_size;
|
||||
ushort max_segment_count;
|
||||
uint max_segment_size;
|
||||
};
|
||||
|
||||
/* Register/deregister interrupt handler. */
|
||||
@ -216,7 +220,7 @@ int brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
int brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
uint flags, u8 *buf, uint nbytes);
|
||||
int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||
uint flags, struct sk_buff_head *pktq);
|
||||
uint flags, struct sk_buff_head *pktq, uint totlen);
|
||||
|
||||
/* Flags bits */
|
||||
|
||||
|
@ -78,13 +78,15 @@ TRACE_EVENT(brcmf_hexdump,
|
||||
TP_ARGS(data, len),
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned long, len)
|
||||
__field(unsigned long, addr)
|
||||
__dynamic_array(u8, hdata, len)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->len = len;
|
||||
__entry->addr = (unsigned long)data;
|
||||
memcpy(__get_dynamic_array(hdata), data, len);
|
||||
),
|
||||
TP_printk("hexdump [length=%lu]", __entry->len)
|
||||
TP_printk("hexdump [addr=%lx, length=%lu]", __entry->addr, __entry->len)
|
||||
);
|
||||
|
||||
TRACE_EVENT(brcmf_bdchdr,
|
||||
@ -108,6 +110,23 @@ TRACE_EVENT(brcmf_bdchdr,
|
||||
TP_printk("bdc: prio=%d siglen=%d", __entry->prio, __entry->siglen)
|
||||
);
|
||||
|
||||
TRACE_EVENT(brcmf_sdpcm_hdr,
|
||||
TP_PROTO(bool tx, void *data),
|
||||
TP_ARGS(tx, data),
|
||||
TP_STRUCT__entry(
|
||||
__field(u8, tx)
|
||||
__field(u16, len)
|
||||
__array(u8, hdr, 12)
|
||||
),
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->hdr, data, 12);
|
||||
__entry->len = __entry->hdr[0] | (__entry->hdr[1] << 8);
|
||||
__entry->tx = tx ? 1 : 0;
|
||||
),
|
||||
TP_printk("sdpcm: %s len %u, seq %d", __entry->tx ? "TX" : "RX",
|
||||
__entry->len, __entry->hdr[4])
|
||||
);
|
||||
|
||||
#ifdef CONFIG_BRCM_TRACING
|
||||
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
|
@ -433,27 +433,19 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
|
||||
/* Copy MAC header from skb into command buffer */
|
||||
memcpy(tx_cmd->hdr, hdr, hdr_len);
|
||||
|
||||
txq_id = info->hw_queue;
|
||||
|
||||
if (is_agg)
|
||||
txq_id = priv->tid_data[sta_id][tid].agg.txq_id;
|
||||
else if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
|
||||
/*
|
||||
* Send this frame after DTIM -- there's a special queue
|
||||
* reserved for this for contexts that support AP mode.
|
||||
*/
|
||||
txq_id = ctx->mcast_queue;
|
||||
|
||||
/*
|
||||
* The microcode will clear the more data
|
||||
* bit in the last frame it transmits.
|
||||
*/
|
||||
hdr->frame_control |=
|
||||
cpu_to_le16(IEEE80211_FCTL_MOREDATA);
|
||||
} else if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
|
||||
txq_id = IWL_AUX_QUEUE;
|
||||
else
|
||||
txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)];
|
||||
}
|
||||
|
||||
WARN_ON_ONCE(!is_agg && txq_id != info->hw_queue);
|
||||
WARN_ON_ONCE(is_agg &&
|
||||
priv->queue_to_mac80211[txq_id] != info->hw_queue);
|
||||
|
||||
|
@ -83,6 +83,8 @@
|
||||
#define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */
|
||||
#define IWL3160_NVM_VERSION 0x709
|
||||
#define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */
|
||||
#define IWL7265_NVM_VERSION 0x0a1d
|
||||
#define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
|
||||
|
||||
#define IWL7260_FW_PRE "iwlwifi-7260-"
|
||||
#define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode"
|
||||
@ -90,6 +92,9 @@
|
||||
#define IWL3160_FW_PRE "iwlwifi-3160-"
|
||||
#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
|
||||
|
||||
#define IWL7265_FW_PRE "iwlwifi-7265-"
|
||||
#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
|
||||
|
||||
static const struct iwl_base_params iwl7000_base_params = {
|
||||
.eeprom_size = OTP_LOW_IMAGE_SIZE,
|
||||
.num_of_queues = IWLAGN_NUM_QUEUES,
|
||||
@ -182,5 +187,14 @@ const struct iwl_cfg iwl3160_n_cfg = {
|
||||
.nvm_calib_ver = IWL3160_TX_POWER_VERSION,
|
||||
};
|
||||
|
||||
const struct iwl_cfg iwl7265_2ac_cfg = {
|
||||
.name = "Intel(R) Dual Band Wireless AC 7265",
|
||||
.fw_name_pre = IWL7265_FW_PRE,
|
||||
IWL_DEVICE_7000,
|
||||
.ht_params = &iwl7000_ht_params,
|
||||
.nvm_ver = IWL7265_NVM_VERSION,
|
||||
.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
|
||||
};
|
||||
|
||||
MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
|
||||
MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
|
||||
|
@ -293,6 +293,7 @@ extern const struct iwl_cfg iwl7260_n_cfg;
|
||||
extern const struct iwl_cfg iwl3160_2ac_cfg;
|
||||
extern const struct iwl_cfg iwl3160_2n_cfg;
|
||||
extern const struct iwl_cfg iwl3160_n_cfg;
|
||||
extern const struct iwl_cfg iwl7265_2ac_cfg;
|
||||
#endif /* CONFIG_IWLMVM */
|
||||
|
||||
#endif /* __IWL_CONFIG_H__ */
|
||||
|
@ -394,6 +394,38 @@
|
||||
#define CSR_DRAM_INT_TBL_ENABLE (1 << 31)
|
||||
#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27)
|
||||
|
||||
/* SECURE boot registers */
|
||||
#define CSR_SECURE_BOOT_CONFIG_ADDR (0x100)
|
||||
enum secure_boot_config_reg {
|
||||
CSR_SECURE_BOOT_CONFIG_INSPECTOR_BURNED_IN_OTP = 0x00000001,
|
||||
CSR_SECURE_BOOT_CONFIG_INSPECTOR_NOT_REQ = 0x00000002,
|
||||
};
|
||||
|
||||
#define CSR_SECURE_BOOT_CPU1_STATUS_ADDR (0x100)
|
||||
#define CSR_SECURE_BOOT_CPU2_STATUS_ADDR (0x100)
|
||||
enum secure_boot_status_reg {
|
||||
CSR_SECURE_BOOT_CPU_STATUS_VERF_STATUS = 0x00000003,
|
||||
CSR_SECURE_BOOT_CPU_STATUS_VERF_COMPLETED = 0x00000002,
|
||||
CSR_SECURE_BOOT_CPU_STATUS_VERF_SUCCESS = 0x00000004,
|
||||
CSR_SECURE_BOOT_CPU_STATUS_VERF_FAIL = 0x00000008,
|
||||
CSR_SECURE_BOOT_CPU_STATUS_SIGN_VERF_FAIL = 0x00000010,
|
||||
};
|
||||
|
||||
#define CSR_UCODE_LOAD_STATUS_ADDR (0x100)
|
||||
enum secure_load_status_reg {
|
||||
CSR_CPU_STATUS_LOADING_STARTED = 0x00000001,
|
||||
CSR_CPU_STATUS_LOADING_COMPLETED = 0x00000002,
|
||||
CSR_CPU_STATUS_NUM_OF_LAST_COMPLETED = 0x000000F8,
|
||||
CSR_CPU_STATUS_NUM_OF_LAST_LOADED_BLOCK = 0x0000FF00,
|
||||
};
|
||||
|
||||
#define CSR_SECURE_INSPECTOR_CODE_ADDR (0x100)
|
||||
#define CSR_SECURE_INSPECTOR_DATA_ADDR (0x100)
|
||||
|
||||
#define CSR_SECURE_TIME_OUT (100)
|
||||
|
||||
#define FH_TCSR_0_REG0 (0x1D00)
|
||||
|
||||
/*
|
||||
* HBUS (Host-side Bus)
|
||||
*
|
||||
|
@ -483,6 +483,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
|
||||
const u8 *tlv_data;
|
||||
char buildstr[25];
|
||||
u32 build;
|
||||
int num_of_cpus;
|
||||
|
||||
if (len < sizeof(*ucode)) {
|
||||
IWL_ERR(drv, "uCode has invalid length: %zd\n", len);
|
||||
@ -692,6 +693,42 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
|
||||
goto invalid_tlv_len;
|
||||
drv->fw.phy_config = le32_to_cpup((__le32 *)tlv_data);
|
||||
break;
|
||||
case IWL_UCODE_TLV_SECURE_SEC_RT:
|
||||
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
|
||||
tlv_len);
|
||||
drv->fw.mvm_fw = true;
|
||||
drv->fw.img[IWL_UCODE_REGULAR].is_secure = true;
|
||||
break;
|
||||
case IWL_UCODE_TLV_SECURE_SEC_INIT:
|
||||
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
|
||||
tlv_len);
|
||||
drv->fw.mvm_fw = true;
|
||||
drv->fw.img[IWL_UCODE_INIT].is_secure = true;
|
||||
break;
|
||||
case IWL_UCODE_TLV_SECURE_SEC_WOWLAN:
|
||||
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
|
||||
tlv_len);
|
||||
drv->fw.mvm_fw = true;
|
||||
drv->fw.img[IWL_UCODE_WOWLAN].is_secure = true;
|
||||
break;
|
||||
case IWL_UCODE_TLV_NUM_OF_CPU:
|
||||
if (tlv_len != sizeof(u32))
|
||||
goto invalid_tlv_len;
|
||||
num_of_cpus =
|
||||
le32_to_cpup((__le32 *)tlv_data);
|
||||
|
||||
if (num_of_cpus == 2) {
|
||||
drv->fw.img[IWL_UCODE_REGULAR].is_dual_cpus =
|
||||
true;
|
||||
drv->fw.img[IWL_UCODE_INIT].is_dual_cpus =
|
||||
true;
|
||||
drv->fw.img[IWL_UCODE_WOWLAN].is_dual_cpus =
|
||||
true;
|
||||
} else if ((num_of_cpus > 2) || (num_of_cpus < 1)) {
|
||||
IWL_ERR(drv, "Driver support upto 2 CPUs\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type);
|
||||
break;
|
||||
|
@ -121,6 +121,10 @@ enum iwl_ucode_tlv_type {
|
||||
IWL_UCODE_TLV_SEC_WOWLAN = 21,
|
||||
IWL_UCODE_TLV_DEF_CALIB = 22,
|
||||
IWL_UCODE_TLV_PHY_SKU = 23,
|
||||
IWL_UCODE_TLV_SECURE_SEC_RT = 24,
|
||||
IWL_UCODE_TLV_SECURE_SEC_INIT = 25,
|
||||
IWL_UCODE_TLV_SECURE_SEC_WOWLAN = 26,
|
||||
IWL_UCODE_TLV_NUM_OF_CPU = 27,
|
||||
};
|
||||
|
||||
struct iwl_ucode_tlv {
|
||||
|
@ -75,11 +75,23 @@
|
||||
* @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P.
|
||||
* @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS
|
||||
* @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD
|
||||
* @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan
|
||||
* offload profile config command.
|
||||
* @IWL_UCODE_TLV_FLAGS_RX_ENERGY_API: supports rx signal strength api
|
||||
* @IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2: using the new time event API.
|
||||
* @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
|
||||
* (rather than two) IPv6 addresses
|
||||
* @IWL_UCODE_TLV_FLAGS_BF_UPDATED: new beacon filtering API
|
||||
* @IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element
|
||||
* from the probe request template.
|
||||
* @IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API: modified D3 API to allow keeping
|
||||
* connection when going back to D0
|
||||
* @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version)
|
||||
* @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
|
||||
* @IWL_UCODE_TLV_FLAGS_SCHED_SCAN: this uCode image supports scheduled scan.
|
||||
* @IWL_UCODE_TLV_FLAGS_STA_KEY_CMD: new ADD_STA and ADD_STA_KEY command API
|
||||
* @IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD: support device wide power command
|
||||
* containing CAM (Continuous Active Mode) indication.
|
||||
*/
|
||||
enum iwl_ucode_tlv_flag {
|
||||
IWL_UCODE_TLV_FLAGS_PAN = BIT(0),
|
||||
@ -87,11 +99,20 @@ enum iwl_ucode_tlv_flag {
|
||||
IWL_UCODE_TLV_FLAGS_MFP = BIT(2),
|
||||
IWL_UCODE_TLV_FLAGS_P2P = BIT(3),
|
||||
IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4),
|
||||
IWL_UCODE_TLV_FLAGS_NEWBT_COEX = BIT(5),
|
||||
IWL_UCODE_TLV_FLAGS_UAPSD = BIT(6),
|
||||
IWL_UCODE_TLV_FLAGS_SHORT_BL = BIT(7),
|
||||
IWL_UCODE_TLV_FLAGS_RX_ENERGY_API = BIT(8),
|
||||
IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 = BIT(9),
|
||||
IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = BIT(10),
|
||||
IWL_UCODE_TLV_FLAGS_BF_UPDATED = BIT(11),
|
||||
IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID = BIT(12),
|
||||
IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API = BIT(14),
|
||||
IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL = BIT(15),
|
||||
IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE = BIT(16),
|
||||
IWL_UCODE_TLV_FLAGS_SCHED_SCAN = BIT(17),
|
||||
IWL_UCODE_TLV_FLAGS_STA_KEY_CMD = BIT(19),
|
||||
IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD = BIT(20),
|
||||
};
|
||||
|
||||
/* The default calibrate table size if not specified by firmware file */
|
||||
@ -133,7 +154,8 @@ enum iwl_ucode_sec {
|
||||
* For 16.0 uCode and above, there is no differentiation between sections,
|
||||
* just an offset to the HW address.
|
||||
*/
|
||||
#define IWL_UCODE_SECTION_MAX 4
|
||||
#define IWL_UCODE_SECTION_MAX 6
|
||||
#define IWL_UCODE_FIRST_SECTION_OF_SECOND_CPU (IWL_UCODE_SECTION_MAX/2)
|
||||
|
||||
struct iwl_ucode_capabilities {
|
||||
u32 max_probe_length;
|
||||
@ -150,6 +172,8 @@ struct fw_desc {
|
||||
|
||||
struct fw_img {
|
||||
struct fw_desc sec[IWL_UCODE_SECTION_MAX];
|
||||
bool is_secure;
|
||||
bool is_dual_cpus;
|
||||
};
|
||||
|
||||
/* uCode version contains 4 values: Major/Minor/API/Serial */
|
||||
|
@ -97,6 +97,8 @@
|
||||
|
||||
#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)
|
||||
|
||||
#define APMG_RTC_INT_STT_RFKILL (0x10000000)
|
||||
|
||||
/* Device system time */
|
||||
#define DEVICE_SYSTEM_TIME_REG 0xA0206C
|
||||
|
||||
|
@ -601,7 +601,7 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (trans->state != IWL_TRANS_FW_ALIVE) {
|
||||
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
return -EIO;
|
||||
}
|
||||
@ -640,8 +640,8 @@ static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
|
||||
static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
|
||||
struct iwl_device_cmd *dev_cmd, int queue)
|
||||
{
|
||||
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
|
||||
"%s bad state = %d", __func__, trans->state);
|
||||
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
|
||||
return trans->ops->tx(trans, skb, dev_cmd, queue);
|
||||
}
|
||||
@ -649,16 +649,16 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
|
||||
static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
|
||||
int ssn, struct sk_buff_head *skbs)
|
||||
{
|
||||
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
|
||||
"%s bad state = %d", __func__, trans->state);
|
||||
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
|
||||
trans->ops->reclaim(trans, queue, ssn, skbs);
|
||||
}
|
||||
|
||||
static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue)
|
||||
{
|
||||
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
|
||||
"%s bad state = %d", __func__, trans->state);
|
||||
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
|
||||
trans->ops->txq_disable(trans, queue);
|
||||
}
|
||||
@ -669,8 +669,8 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
|
||||
{
|
||||
might_sleep();
|
||||
|
||||
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
|
||||
"%s bad state = %d", __func__, trans->state);
|
||||
if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
|
||||
trans->ops->txq_enable(trans, queue, fifo, sta_id, tid,
|
||||
frame_limit, ssn);
|
||||
@ -685,8 +685,8 @@ static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
|
||||
|
||||
static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
|
||||
{
|
||||
WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
|
||||
"%s bad state = %d", __func__, trans->state);
|
||||
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
|
||||
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
|
||||
|
||||
return trans->ops->wait_tx_queue_empty(trans);
|
||||
}
|
||||
|
@ -98,126 +98,258 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = {
|
||||
|
||||
#undef EVENT_PRIO_ANT
|
||||
|
||||
/* BT Antenna Coupling Threshold (dB) */
|
||||
#define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
|
||||
#define IWL_BT_LOAD_FORCE_SISO_THRESHOLD (3)
|
||||
|
||||
#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62)
|
||||
#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65)
|
||||
#define BT_REDUCED_TX_POWER_BIT BIT(7)
|
||||
|
||||
static inline bool is_loose_coex(void)
|
||||
{
|
||||
return iwlwifi_mod_params.ant_coupling >
|
||||
IWL_BT_ANTENNA_COUPLING_THRESHOLD;
|
||||
}
|
||||
#define BT_ANTENNA_COUPLING_THRESHOLD (30)
|
||||
|
||||
int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm)
|
||||
{
|
||||
if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX))
|
||||
return 0;
|
||||
|
||||
return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, CMD_SYNC,
|
||||
sizeof(struct iwl_bt_coex_prio_tbl_cmd),
|
||||
&iwl_bt_prio_tbl);
|
||||
}
|
||||
|
||||
static int iwl_send_bt_env(struct iwl_mvm *mvm, u8 action, u8 type)
|
||||
{
|
||||
struct iwl_bt_coex_prot_env_cmd env_cmd;
|
||||
int ret;
|
||||
const u32 iwl_bt_ack_kill_msk[BT_KILL_MSK_MAX] = {
|
||||
[BT_KILL_MSK_DEFAULT] = 0xffff0000,
|
||||
[BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff,
|
||||
[BT_KILL_MSK_REDUCED_TXPOW] = 0,
|
||||
};
|
||||
|
||||
const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX] = {
|
||||
[BT_KILL_MSK_DEFAULT] = 0xffff0000,
|
||||
[BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff,
|
||||
[BT_KILL_MSK_REDUCED_TXPOW] = 0,
|
||||
};
|
||||
|
||||
static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = {
|
||||
cpu_to_le32(0xf0f0f0f0),
|
||||
cpu_to_le32(0xc0c0c0c0),
|
||||
cpu_to_le32(0xfcfcfcfc),
|
||||
cpu_to_le32(0xff00ff00),
|
||||
};
|
||||
|
||||
static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = {
|
||||
{
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
},
|
||||
{
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
},
|
||||
{
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
},
|
||||
};
|
||||
|
||||
static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = {
|
||||
{
|
||||
/* Tight */
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaeaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xcc00ff28),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xcc00aaaa),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
},
|
||||
{
|
||||
/* Loose */
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xcc00ff28),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xcc00aaaa),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
},
|
||||
{
|
||||
/* Tx Tx disabled */
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xcc00ff28),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xcc00aaaa),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xC0004000),
|
||||
cpu_to_le32(0xC0004000),
|
||||
cpu_to_le32(0xF0005000),
|
||||
cpu_to_le32(0xF0005000),
|
||||
},
|
||||
};
|
||||
|
||||
/* 20MHz / 40MHz below / 40Mhz above*/
|
||||
static const __le64 iwl_ci_mask[][3] = {
|
||||
/* dummy entry for channel 0 */
|
||||
{cpu_to_le64(0), cpu_to_le64(0), cpu_to_le64(0)},
|
||||
{
|
||||
cpu_to_le64(0x0000001FFFULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
cpu_to_le64(0x00007FFFFFULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x000000FFFFULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
cpu_to_le64(0x0003FFFFFFULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x000003FFFCULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
cpu_to_le64(0x000FFFFFFCULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x00001FFFE0ULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
cpu_to_le64(0x007FFFFFE0ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x00007FFF80ULL),
|
||||
cpu_to_le64(0x00007FFFFFULL),
|
||||
cpu_to_le64(0x01FFFFFF80ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x0003FFFC00ULL),
|
||||
cpu_to_le64(0x0003FFFFFFULL),
|
||||
cpu_to_le64(0x0FFFFFFC00ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x000FFFF000ULL),
|
||||
cpu_to_le64(0x000FFFFFFCULL),
|
||||
cpu_to_le64(0x3FFFFFF000ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x007FFF8000ULL),
|
||||
cpu_to_le64(0x007FFFFFE0ULL),
|
||||
cpu_to_le64(0xFFFFFF8000ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x01FFFE0000ULL),
|
||||
cpu_to_le64(0x01FFFFFF80ULL),
|
||||
cpu_to_le64(0xFFFFFE0000ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x0FFFF00000ULL),
|
||||
cpu_to_le64(0x0FFFFFFC00ULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0x3FFFC00000ULL),
|
||||
cpu_to_le64(0x3FFFFFF000ULL),
|
||||
cpu_to_le64(0x0)
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0xFFFE000000ULL),
|
||||
cpu_to_le64(0xFFFFFF8000ULL),
|
||||
cpu_to_le64(0x0)
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0xFFF8000000ULL),
|
||||
cpu_to_le64(0xFFFFFE0000ULL),
|
||||
cpu_to_le64(0x0)
|
||||
},
|
||||
{
|
||||
cpu_to_le64(0xFE00000000ULL),
|
||||
cpu_to_le64(0x0ULL),
|
||||
cpu_to_le64(0x0)
|
||||
},
|
||||
};
|
||||
|
||||
static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
|
||||
cpu_to_le32(0x22002200),
|
||||
cpu_to_le32(0x33113311),
|
||||
};
|
||||
|
||||
static enum iwl_bt_coex_lut_type
|
||||
iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)
|
||||
{
|
||||
struct ieee80211_chanctx_conf *chanctx_conf;
|
||||
enum iwl_bt_coex_lut_type ret;
|
||||
u16 phy_ctx_id;
|
||||
|
||||
/*
|
||||
* Checking that we hold mvm->mutex is a good idea, but the rate
|
||||
* control can't acquire the mutex since it runs in Tx path.
|
||||
* So this is racy in that case, but in the worst case, the AMPDU
|
||||
* size limit will be wrong for a short time which is not a big
|
||||
* issue.
|
||||
*/
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
chanctx_conf = rcu_dereference(vif->chanctx_conf);
|
||||
|
||||
if (!chanctx_conf ||
|
||||
chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) {
|
||||
rcu_read_unlock();
|
||||
return BT_COEX_LOOSE_LUT;
|
||||
}
|
||||
|
||||
ret = BT_COEX_TX_DIS_LUT;
|
||||
|
||||
if (mvm->cfg->bt_shared_single_ant) {
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
phy_ctx_id = *((u16 *)chanctx_conf->drv_priv);
|
||||
|
||||
if (mvm->last_bt_ci_cmd.primary_ch_phy_id == phy_ctx_id)
|
||||
ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut);
|
||||
else if (mvm->last_bt_ci_cmd.secondary_ch_phy_id == phy_ctx_id)
|
||||
ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut);
|
||||
/* else - default = TX TX disallowed */
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
env_cmd.action = action;
|
||||
env_cmd.type = type;
|
||||
ret = iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PROT_ENV, CMD_SYNC,
|
||||
sizeof(env_cmd), &env_cmd);
|
||||
if (ret)
|
||||
IWL_ERR(mvm, "failed to send BT env command\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
enum iwl_bt_kill_msk {
|
||||
BT_KILL_MSK_DEFAULT,
|
||||
BT_KILL_MSK_SCO_HID_A2DP,
|
||||
BT_KILL_MSK_REDUCED_TXPOW,
|
||||
BT_KILL_MSK_MAX,
|
||||
};
|
||||
|
||||
static const u32 iwl_bt_ack_kill_msk[BT_KILL_MSK_MAX] = {
|
||||
[BT_KILL_MSK_DEFAULT] = 0xffff0000,
|
||||
[BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff,
|
||||
[BT_KILL_MSK_REDUCED_TXPOW] = 0,
|
||||
};
|
||||
|
||||
static const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX] = {
|
||||
[BT_KILL_MSK_DEFAULT] = 0xffff0000,
|
||||
[BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff,
|
||||
[BT_KILL_MSK_REDUCED_TXPOW] = 0,
|
||||
};
|
||||
|
||||
#define IWL_BT_DEFAULT_BOOST (0xf0f0f0f0)
|
||||
|
||||
/* Tight Coex */
|
||||
static const __le32 iwl_tight_lookup[BT_COEX_LUT_SIZE] = {
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaeaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xcc00ff28),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xcc00aaaa),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xc0004000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
};
|
||||
|
||||
/* Loose Coex */
|
||||
static const __le32 iwl_loose_lookup[BT_COEX_LUT_SIZE] = {
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xcc00ff28),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0xcc00aaaa),
|
||||
cpu_to_le32(0x0000aaaa),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
cpu_to_le32(0xf0005000),
|
||||
};
|
||||
|
||||
/* Full concurrency */
|
||||
static const __le32 iwl_concurrent_lookup[BT_COEX_LUT_SIZE] = {
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0xaaaaaaaa),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
};
|
||||
|
||||
/* single shared antenna */
|
||||
static const __le32 iwl_single_shared_ant_lookup[BT_COEX_LUT_SIZE] = {
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x40000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0x44000000),
|
||||
cpu_to_le32(0x00000000),
|
||||
cpu_to_le32(0xC0004000),
|
||||
cpu_to_le32(0xF0005000),
|
||||
cpu_to_le32(0xC0004000),
|
||||
cpu_to_le32(0xF0005000),
|
||||
};
|
||||
|
||||
int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
|
||||
{
|
||||
struct iwl_bt_coex_cmd *bt_cmd;
|
||||
@ -228,17 +360,10 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
|
||||
.flags = CMD_SYNC,
|
||||
};
|
||||
int ret;
|
||||
u32 flags;
|
||||
|
||||
/* go to CALIB state in internal BT-Coex state machine */
|
||||
ret = iwl_send_bt_env(mvm, BT_COEX_ENV_OPEN,
|
||||
BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = iwl_send_bt_env(mvm, BT_COEX_ENV_CLOSE,
|
||||
BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX))
|
||||
return 0;
|
||||
|
||||
bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL);
|
||||
if (!bt_cmd)
|
||||
@ -246,40 +371,52 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
|
||||
cmd.data[0] = bt_cmd;
|
||||
|
||||
bt_cmd->max_kill = 5;
|
||||
bt_cmd->bt3_time_t7_value = 1;
|
||||
bt_cmd->bt3_prio_sample_time = 2;
|
||||
bt_cmd->bt3_timer_t2_value = 0xc;
|
||||
bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD,
|
||||
bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling,
|
||||
bt_cmd->bt4_tx_tx_delta_freq_thr = 15,
|
||||
bt_cmd->bt4_tx_rx_max_freq0 = 15,
|
||||
|
||||
bt_cmd->flags = iwlwifi_mod_params.bt_coex_active ?
|
||||
flags = iwlwifi_mod_params.bt_coex_active ?
|
||||
BT_COEX_NW : BT_COEX_DISABLE;
|
||||
bt_cmd->flags |= BT_CH_PRIMARY_EN | BT_SYNC_2_BT_DISABLE;
|
||||
flags |= BT_CH_PRIMARY_EN | BT_CH_SECONDARY_EN | BT_SYNC_2_BT_DISABLE;
|
||||
bt_cmd->flags = cpu_to_le32(flags);
|
||||
|
||||
bt_cmd->valid_bit_msk = cpu_to_le16(BT_VALID_ENABLE |
|
||||
bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_ENABLE |
|
||||
BT_VALID_BT_PRIO_BOOST |
|
||||
BT_VALID_MAX_KILL |
|
||||
BT_VALID_3W_TMRS |
|
||||
BT_VALID_KILL_ACK |
|
||||
BT_VALID_KILL_CTS |
|
||||
BT_VALID_REDUCED_TX_POWER |
|
||||
BT_VALID_LUT);
|
||||
BT_VALID_LUT |
|
||||
BT_VALID_WIFI_RX_SW_PRIO_BOOST |
|
||||
BT_VALID_WIFI_TX_SW_PRIO_BOOST |
|
||||
BT_VALID_MULTI_PRIO_LUT |
|
||||
BT_VALID_CORUN_LUT_20 |
|
||||
BT_VALID_CORUN_LUT_40 |
|
||||
BT_VALID_ANT_ISOLATION |
|
||||
BT_VALID_ANT_ISOLATION_THRS |
|
||||
BT_VALID_TXTX_DELTA_FREQ_THRS |
|
||||
BT_VALID_TXRX_MAX_FREQ_0);
|
||||
|
||||
if (mvm->cfg->bt_shared_single_ant)
|
||||
memcpy(&bt_cmd->decision_lut, iwl_single_shared_ant_lookup,
|
||||
sizeof(iwl_single_shared_ant_lookup));
|
||||
else if (is_loose_coex())
|
||||
memcpy(&bt_cmd->decision_lut, iwl_loose_lookup,
|
||||
sizeof(iwl_tight_lookup));
|
||||
memcpy(&bt_cmd->decision_lut, iwl_single_shared_ant,
|
||||
sizeof(iwl_single_shared_ant));
|
||||
else
|
||||
memcpy(&bt_cmd->decision_lut, iwl_tight_lookup,
|
||||
sizeof(iwl_tight_lookup));
|
||||
memcpy(&bt_cmd->decision_lut, iwl_combined_lookup,
|
||||
sizeof(iwl_combined_lookup));
|
||||
|
||||
bt_cmd->bt_prio_boost = cpu_to_le32(IWL_BT_DEFAULT_BOOST);
|
||||
memcpy(&bt_cmd->bt_prio_boost, iwl_bt_prio_boost,
|
||||
sizeof(iwl_bt_prio_boost));
|
||||
memcpy(&bt_cmd->bt4_multiprio_lut, iwl_bt_mprio_lut,
|
||||
sizeof(iwl_bt_mprio_lut));
|
||||
bt_cmd->kill_ack_msk =
|
||||
cpu_to_le32(iwl_bt_ack_kill_msk[BT_KILL_MSK_DEFAULT]);
|
||||
bt_cmd->kill_cts_msk =
|
||||
cpu_to_le32(iwl_bt_cts_kill_msk[BT_KILL_MSK_DEFAULT]);
|
||||
|
||||
memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif));
|
||||
memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd));
|
||||
|
||||
ret = iwl_mvm_send_cmd(mvm, &cmd);
|
||||
|
||||
@ -334,13 +471,17 @@ static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm,
|
||||
if (!bt_cmd)
|
||||
return -ENOMEM;
|
||||
cmd.data[0] = bt_cmd;
|
||||
bt_cmd->flags = cpu_to_le32(BT_COEX_NW);
|
||||
|
||||
bt_cmd->kill_ack_msk = cpu_to_le32(iwl_bt_ack_kill_msk[bt_kill_msk]);
|
||||
bt_cmd->kill_cts_msk = cpu_to_le32(iwl_bt_cts_kill_msk[bt_kill_msk]);
|
||||
bt_cmd->valid_bit_msk =
|
||||
cpu_to_le16(BT_VALID_KILL_ACK | BT_VALID_KILL_CTS);
|
||||
bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_ENABLE |
|
||||
BT_VALID_KILL_ACK |
|
||||
BT_VALID_KILL_CTS);
|
||||
|
||||
IWL_DEBUG_COEX(mvm, "bt_kill_msk = %d\n", bt_kill_msk);
|
||||
IWL_DEBUG_COEX(mvm, "ACK Kill msk = 0x%08x, CTS Kill msk = 0x%08x\n",
|
||||
iwl_bt_ack_kill_msk[bt_kill_msk],
|
||||
iwl_bt_cts_kill_msk[bt_kill_msk]);
|
||||
|
||||
ret = iwl_mvm_send_cmd(mvm, &cmd);
|
||||
|
||||
@ -380,8 +521,10 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
|
||||
if (!bt_cmd)
|
||||
return -ENOMEM;
|
||||
cmd.data[0] = bt_cmd;
|
||||
bt_cmd->flags = cpu_to_le32(BT_COEX_NW);
|
||||
|
||||
bt_cmd->valid_bit_msk = cpu_to_le16(BT_VALID_REDUCED_TX_POWER),
|
||||
bt_cmd->valid_bit_msk =
|
||||
cpu_to_le32(BT_VALID_ENABLE | BT_VALID_REDUCED_TX_POWER);
|
||||
bt_cmd->bt_reduced_tx_power = sta_id;
|
||||
|
||||
if (enable)
|
||||
@ -403,8 +546,25 @@ struct iwl_bt_iterator_data {
|
||||
struct iwl_mvm *mvm;
|
||||
u32 num_bss_ifaces;
|
||||
bool reduced_tx_power;
|
||||
struct ieee80211_chanctx_conf *primary;
|
||||
struct ieee80211_chanctx_conf *secondary;
|
||||
};
|
||||
|
||||
static inline
|
||||
void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
bool enable, int rssi)
|
||||
{
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
|
||||
mvmvif->bf_data.last_bt_coex_event = rssi;
|
||||
mvmvif->bf_data.bt_coex_max_thold =
|
||||
enable ? BT_ENABLE_REDUCED_TXPOWER_THRESHOLD : 0;
|
||||
mvmvif->bf_data.bt_coex_min_thold =
|
||||
enable ? BT_DISABLE_REDUCED_TXPOWER_THRESHOLD : 0;
|
||||
}
|
||||
|
||||
/* must be called under rcu_read_lock */
|
||||
static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
@ -413,65 +573,94 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
|
||||
struct iwl_mvm *mvm = data->mvm;
|
||||
struct ieee80211_chanctx_conf *chanctx_conf;
|
||||
enum ieee80211_smps_mode smps_mode;
|
||||
enum ieee80211_band band;
|
||||
int ave_rssi;
|
||||
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
if (vif->type != NL80211_IFTYPE_STATION)
|
||||
return;
|
||||
|
||||
rcu_read_lock();
|
||||
chanctx_conf = rcu_dereference(vif->chanctx_conf);
|
||||
if (chanctx_conf && chanctx_conf->def.chan)
|
||||
band = chanctx_conf->def.chan->band;
|
||||
else
|
||||
band = -1;
|
||||
rcu_read_unlock();
|
||||
if (vif->type != NL80211_IFTYPE_STATION &&
|
||||
vif->type != NL80211_IFTYPE_AP)
|
||||
return;
|
||||
|
||||
smps_mode = IEEE80211_SMPS_AUTOMATIC;
|
||||
|
||||
/* non associated BSSes aren't to be considered */
|
||||
if (!vif->bss_conf.assoc)
|
||||
return;
|
||||
chanctx_conf = rcu_dereference(vif->chanctx_conf);
|
||||
|
||||
if (band != IEEE80211_BAND_2GHZ) {
|
||||
iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
|
||||
smps_mode);
|
||||
/* If channel context is invalid or not on 2.4GHz .. */
|
||||
if ((!chanctx_conf ||
|
||||
chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ)) {
|
||||
/* ... and it is an associated STATION, relax constraints */
|
||||
if (vif->type == NL80211_IFTYPE_STATION && vif->bss_conf.assoc)
|
||||
iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
|
||||
smps_mode);
|
||||
iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->notif->bt_status)
|
||||
/* SoftAP / GO will always be primary */
|
||||
if (vif->type == NL80211_IFTYPE_AP) {
|
||||
if (!mvmvif->ap_ibss_active)
|
||||
return;
|
||||
|
||||
/* the Ack / Cts kill mask must be default if AP / GO */
|
||||
data->reduced_tx_power = false;
|
||||
|
||||
if (chanctx_conf == data->primary)
|
||||
return;
|
||||
|
||||
/* downgrade the current primary no matter what its type is */
|
||||
data->secondary = data->primary;
|
||||
data->primary = chanctx_conf;
|
||||
return;
|
||||
}
|
||||
|
||||
data->num_bss_ifaces++;
|
||||
|
||||
/* we are now a STA / P2P Client, and take associated ones only */
|
||||
if (!vif->bss_conf.assoc)
|
||||
return;
|
||||
|
||||
/* STA / P2P Client, try to be primary if first vif */
|
||||
if (!data->primary || data->primary == chanctx_conf)
|
||||
data->primary = chanctx_conf;
|
||||
else if (!data->secondary)
|
||||
/* if secondary is not NULL, it might be a GO */
|
||||
data->secondary = chanctx_conf;
|
||||
|
||||
if (le32_to_cpu(data->notif->bt_activity_grading) >= BT_HIGH_TRAFFIC)
|
||||
smps_mode = IEEE80211_SMPS_STATIC;
|
||||
else if (le32_to_cpu(data->notif->bt_activity_grading) >=
|
||||
BT_LOW_TRAFFIC)
|
||||
smps_mode = IEEE80211_SMPS_DYNAMIC;
|
||||
|
||||
if (data->notif->bt_traffic_load >= IWL_BT_LOAD_FORCE_SISO_THRESHOLD)
|
||||
smps_mode = IEEE80211_SMPS_STATIC;
|
||||
|
||||
IWL_DEBUG_COEX(data->mvm,
|
||||
"mac %d: bt_status %d traffic_load %d smps_req %d\n",
|
||||
"mac %d: bt_status %d bt_activity_grading %d smps_req %d\n",
|
||||
mvmvif->id, data->notif->bt_status,
|
||||
data->notif->bt_traffic_load, smps_mode);
|
||||
data->notif->bt_activity_grading, smps_mode);
|
||||
|
||||
iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, smps_mode);
|
||||
|
||||
/* don't reduce the Tx power if in loose scheme */
|
||||
if (is_loose_coex())
|
||||
if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT ||
|
||||
mvm->cfg->bt_shared_single_ant) {
|
||||
data->reduced_tx_power = false;
|
||||
iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
data->num_bss_ifaces++;
|
||||
|
||||
/* reduced Txpower only if there are open BT connections, so ...*/
|
||||
if (!BT_MBOX_MSG(data->notif, 3, OPEN_CON_2)) {
|
||||
/* reduced Txpower only if BT is on, so ...*/
|
||||
if (!data->notif->bt_status) {
|
||||
/* ... cancel reduced Tx power ... */
|
||||
if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false))
|
||||
IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
|
||||
data->reduced_tx_power = false;
|
||||
|
||||
/* ... and there is no need to get reports on RSSI any more. */
|
||||
ieee80211_disable_rssi_reports(vif);
|
||||
iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ave_rssi = ieee80211_ave_rssi(vif);
|
||||
/* try to get the avg rssi from fw */
|
||||
ave_rssi = mvmvif->bf_data.ave_beacon_signal;
|
||||
|
||||
/* if the RSSI isn't valid, fake it is very low */
|
||||
if (!ave_rssi)
|
||||
@ -499,8 +688,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
|
||||
}
|
||||
|
||||
/* Begin to monitor the RSSI: it may influence the reduced Tx power */
|
||||
ieee80211_enable_rssi_reports(vif, BT_DISABLE_REDUCED_TXPOWER_THRESHOLD,
|
||||
BT_ENABLE_REDUCED_TXPOWER_THRESHOLD);
|
||||
iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi);
|
||||
}
|
||||
|
||||
static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
|
||||
@ -510,11 +698,72 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
|
||||
.notif = &mvm->last_bt_notif,
|
||||
.reduced_tx_power = true,
|
||||
};
|
||||
struct iwl_bt_coex_ci_cmd cmd = {};
|
||||
u8 ci_bw_idx;
|
||||
|
||||
rcu_read_lock();
|
||||
ieee80211_iterate_active_interfaces_atomic(
|
||||
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
|
||||
iwl_mvm_bt_notif_iterator, &data);
|
||||
|
||||
if (data.primary) {
|
||||
struct ieee80211_chanctx_conf *chan = data.primary;
|
||||
if (WARN_ON(!chan->def.chan)) {
|
||||
rcu_read_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (chan->def.width < NL80211_CHAN_WIDTH_40) {
|
||||
ci_bw_idx = 0;
|
||||
cmd.co_run_bw_primary = 0;
|
||||
} else {
|
||||
cmd.co_run_bw_primary = 1;
|
||||
if (chan->def.center_freq1 >
|
||||
chan->def.chan->center_freq)
|
||||
ci_bw_idx = 2;
|
||||
else
|
||||
ci_bw_idx = 1;
|
||||
}
|
||||
|
||||
cmd.bt_primary_ci =
|
||||
iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
|
||||
cmd.primary_ch_phy_id = *((u16 *)data.primary->drv_priv);
|
||||
}
|
||||
|
||||
if (data.secondary) {
|
||||
struct ieee80211_chanctx_conf *chan = data.secondary;
|
||||
if (WARN_ON(!data.secondary->def.chan)) {
|
||||
rcu_read_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (chan->def.width < NL80211_CHAN_WIDTH_40) {
|
||||
ci_bw_idx = 0;
|
||||
cmd.co_run_bw_secondary = 0;
|
||||
} else {
|
||||
cmd.co_run_bw_secondary = 1;
|
||||
if (chan->def.center_freq1 >
|
||||
chan->def.chan->center_freq)
|
||||
ci_bw_idx = 2;
|
||||
else
|
||||
ci_bw_idx = 1;
|
||||
}
|
||||
|
||||
cmd.bt_secondary_ci =
|
||||
iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
|
||||
cmd.secondary_ch_phy_id = *((u16 *)data.primary->drv_priv);
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
/* Don't spam the fw with the same command over and over */
|
||||
if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) {
|
||||
if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, CMD_SYNC,
|
||||
sizeof(cmd), &cmd))
|
||||
IWL_ERR(mvm, "Failed to send BT_CI cmd");
|
||||
memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
/*
|
||||
* If there are no BSS / P2P client interfaces, reduced Tx Power is
|
||||
* irrelevant since it is based on the RSSI coming from the beacon.
|
||||
@ -536,12 +785,18 @@ int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
|
||||
|
||||
|
||||
IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n");
|
||||
IWL_DEBUG_COEX(mvm, "\tBT %salive\n", notif->bt_status ? "" : "not ");
|
||||
IWL_DEBUG_COEX(mvm, "\tBT status: %s\n",
|
||||
notif->bt_status ? "ON" : "OFF");
|
||||
IWL_DEBUG_COEX(mvm, "\tBT open conn %d\n", notif->bt_open_conn);
|
||||
IWL_DEBUG_COEX(mvm, "\tBT traffic load %d\n", notif->bt_traffic_load);
|
||||
IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance);
|
||||
IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n",
|
||||
le32_to_cpu(notif->primary_ch_lut));
|
||||
IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n",
|
||||
le32_to_cpu(notif->secondary_ch_lut));
|
||||
IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n",
|
||||
le32_to_cpu(notif->bt_activity_grading));
|
||||
IWL_DEBUG_COEX(mvm, "\tBT agg traffic load %d\n",
|
||||
notif->bt_agg_traffic_load);
|
||||
IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance);
|
||||
|
||||
/* remember this notification for future use: rssi fluctuations */
|
||||
memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif));
|
||||
@ -565,6 +820,18 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac,
|
||||
struct ieee80211_sta *sta;
|
||||
struct iwl_mvm_sta *mvmsta;
|
||||
|
||||
struct ieee80211_chanctx_conf *chanctx_conf;
|
||||
|
||||
rcu_read_lock();
|
||||
chanctx_conf = rcu_dereference(vif->chanctx_conf);
|
||||
/* If channel context is invalid or not on 2.4GHz - don't count it */
|
||||
if (!chanctx_conf ||
|
||||
chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) {
|
||||
rcu_read_unlock();
|
||||
return;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
if (vif->type != NL80211_IFTYPE_STATION ||
|
||||
mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)
|
||||
return;
|
||||
@ -594,15 +861,15 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
};
|
||||
int ret;
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
|
||||
/* Rssi update while not associated ?! */
|
||||
if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT))
|
||||
goto out_unlock;
|
||||
return;
|
||||
|
||||
/* No open connection - reports should be disabled */
|
||||
if (!BT_MBOX_MSG(&mvm->last_bt_notif, 3, OPEN_CON_2))
|
||||
goto out_unlock;
|
||||
/* No BT - reports should be disabled */
|
||||
if (!mvm->last_bt_notif.bt_status)
|
||||
return;
|
||||
|
||||
IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid,
|
||||
rssi_event == RSSI_EVENT_HIGH ? "HIGH" : "LOW");
|
||||
@ -611,7 +878,8 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
* Check if rssi is good enough for reduced Tx power, but not in loose
|
||||
* scheme.
|
||||
*/
|
||||
if (rssi_event == RSSI_EVENT_LOW || is_loose_coex())
|
||||
if (rssi_event == RSSI_EVENT_LOW || mvm->cfg->bt_shared_single_ant ||
|
||||
iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT)
|
||||
ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
|
||||
false);
|
||||
else
|
||||
@ -633,12 +901,52 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
|
||||
if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, data.reduced_tx_power))
|
||||
IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n");
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&mvm->mutex);
|
||||
}
|
||||
|
||||
void iwl_mvm_bt_coex_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
|
||||
#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000)
|
||||
#define LINK_QUAL_AGG_TIME_LIMIT_BT_ACT (1200)
|
||||
|
||||
u16 iwl_mvm_bt_coex_agg_time_limit(struct iwl_mvm *mvm,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
|
||||
enum iwl_bt_coex_lut_type lut_type;
|
||||
|
||||
if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
|
||||
BT_LOW_TRAFFIC)
|
||||
return LINK_QUAL_AGG_TIME_LIMIT_DEF;
|
||||
|
||||
lut_type = iwl_get_coex_type(mvm, mvmsta->vif);
|
||||
|
||||
if (lut_type == BT_COEX_LOOSE_LUT)
|
||||
return LINK_QUAL_AGG_TIME_LIMIT_DEF;
|
||||
|
||||
/* tight coex, high bt traffic, reduce AGG time limit */
|
||||
return LINK_QUAL_AGG_TIME_LIMIT_BT_ACT;
|
||||
}
|
||||
|
||||
bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
|
||||
|
||||
if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
|
||||
BT_HIGH_TRAFFIC)
|
||||
return true;
|
||||
|
||||
/*
|
||||
* In Tight, BT can't Rx while we Tx, so use both antennas since BT is
|
||||
* already killed.
|
||||
* In Loose, BT can Rx while we Tx, so forbid MIMO to let BT Rx while we
|
||||
* Tx.
|
||||
*/
|
||||
return iwl_get_coex_type(mvm, mvmsta->vif) == BT_COEX_TIGHT_LUT;
|
||||
}
|
||||
|
||||
void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
|
||||
{
|
||||
if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX))
|
||||
return;
|
||||
|
||||
iwl_mvm_bt_coex_notif_handle(mvm);
|
||||
}
|
||||
|
@ -70,7 +70,9 @@
|
||||
#define IWL_MVM_UAPSD_RX_DATA_TIMEOUT (50 * USEC_PER_MSEC)
|
||||
#define IWL_MVM_UAPSD_TX_DATA_TIMEOUT (50 * USEC_PER_MSEC)
|
||||
#define IWL_MVM_PS_HEAVY_TX_THLD_PACKETS 20
|
||||
#define IWL_MVM_PS_HEAVY_RX_THLD_PACKETS 20
|
||||
#define IWL_MVM_PS_HEAVY_RX_THLD_PACKETS 8
|
||||
#define IWL_MVM_PS_SNOOZE_HEAVY_TX_THLD_PACKETS 30
|
||||
#define IWL_MVM_PS_SNOOZE_HEAVY_RX_THLD_PACKETS 20
|
||||
#define IWL_MVM_PS_HEAVY_TX_THLD_PERCENT 50
|
||||
#define IWL_MVM_PS_HEAVY_RX_THLD_PERCENT 50
|
||||
#define IWL_MVM_PS_SNOOZE_INTERVAL 25
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include <net/cfg80211.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <net/tcp.h>
|
||||
#include <net/addrconf.h>
|
||||
#include "iwl-modparams.h"
|
||||
#include "fw-api.h"
|
||||
#include "mvm.h"
|
||||
@ -381,14 +382,74 @@ static int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
|
||||
union {
|
||||
struct iwl_proto_offload_cmd_v1 v1;
|
||||
struct iwl_proto_offload_cmd_v2 v2;
|
||||
struct iwl_proto_offload_cmd_v3_small v3s;
|
||||
struct iwl_proto_offload_cmd_v3_large v3l;
|
||||
} cmd = {};
|
||||
struct iwl_host_cmd hcmd = {
|
||||
.id = PROT_OFFLOAD_CONFIG_CMD,
|
||||
.flags = CMD_SYNC,
|
||||
.data[0] = &cmd,
|
||||
.dataflags[0] = IWL_HCMD_DFL_DUP,
|
||||
};
|
||||
struct iwl_proto_offload_cmd_common *common;
|
||||
u32 enabled = 0, size;
|
||||
u32 capa_flags = mvm->fw->ucode_capa.flags;
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
int i;
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS) {
|
||||
if (capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL ||
|
||||
capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE) {
|
||||
struct iwl_ns_config *nsc;
|
||||
struct iwl_targ_addr *addrs;
|
||||
int n_nsc, n_addrs;
|
||||
int c;
|
||||
|
||||
if (capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL) {
|
||||
nsc = cmd.v3s.ns_config;
|
||||
n_nsc = IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S;
|
||||
addrs = cmd.v3s.targ_addrs;
|
||||
n_addrs = IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S;
|
||||
} else {
|
||||
nsc = cmd.v3l.ns_config;
|
||||
n_nsc = IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L;
|
||||
addrs = cmd.v3l.targ_addrs;
|
||||
n_addrs = IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L;
|
||||
}
|
||||
|
||||
if (mvmvif->num_target_ipv6_addrs)
|
||||
enabled |= IWL_D3_PROTO_OFFLOAD_NS;
|
||||
|
||||
/*
|
||||
* For each address we have (and that will fit) fill a target
|
||||
* address struct and combine for NS offload structs with the
|
||||
* solicited node addresses.
|
||||
*/
|
||||
for (i = 0, c = 0;
|
||||
i < mvmvif->num_target_ipv6_addrs &&
|
||||
i < n_addrs && c < n_nsc; i++) {
|
||||
struct in6_addr solicited_addr;
|
||||
int j;
|
||||
|
||||
addrconf_addr_solict_mult(&mvmvif->target_ipv6_addrs[i],
|
||||
&solicited_addr);
|
||||
for (j = 0; j < c; j++)
|
||||
if (ipv6_addr_cmp(&nsc[j].dest_ipv6_addr,
|
||||
&solicited_addr) == 0)
|
||||
break;
|
||||
if (j == c)
|
||||
c++;
|
||||
addrs[i].addr = mvmvif->target_ipv6_addrs[i];
|
||||
addrs[i].config_num = cpu_to_le32(j);
|
||||
nsc[j].dest_ipv6_addr = solicited_addr;
|
||||
memcpy(nsc[j].target_mac_addr, vif->addr, ETH_ALEN);
|
||||
}
|
||||
|
||||
if (capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL)
|
||||
cmd.v3s.num_valid_ipv6_addrs = cpu_to_le32(i);
|
||||
else
|
||||
cmd.v3l.num_valid_ipv6_addrs = cpu_to_le32(i);
|
||||
} else if (capa_flags & IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS) {
|
||||
if (mvmvif->num_target_ipv6_addrs) {
|
||||
enabled |= IWL_D3_PROTO_OFFLOAD_NS;
|
||||
memcpy(cmd.v2.ndp_mac_addr, vif->addr, ETH_ALEN);
|
||||
@ -419,7 +480,13 @@ static int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS) {
|
||||
if (capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL) {
|
||||
common = &cmd.v3s.common;
|
||||
size = sizeof(cmd.v3s);
|
||||
} else if (capa_flags & IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE) {
|
||||
common = &cmd.v3l.common;
|
||||
size = sizeof(cmd.v3l);
|
||||
} else if (capa_flags & IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS) {
|
||||
common = &cmd.v2.common;
|
||||
size = sizeof(cmd.v2);
|
||||
} else {
|
||||
@ -438,8 +505,8 @@ static int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
|
||||
|
||||
common->enabled = cpu_to_le32(enabled);
|
||||
|
||||
return iwl_mvm_send_cmd_pdu(mvm, PROT_OFFLOAD_CONFIG_CMD, CMD_SYNC,
|
||||
size, &cmd);
|
||||
hcmd.len[0] = size;
|
||||
return iwl_mvm_send_cmd(mvm, &hcmd);
|
||||
}
|
||||
|
||||
enum iwl_mvm_tcp_packet_type {
|
||||
@ -793,6 +860,74 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
struct iwl_nonqos_seq_query_cmd query_cmd = {
|
||||
.get_set_flag = cpu_to_le32(IWL_NONQOS_SEQ_GET),
|
||||
.mac_id_n_color =
|
||||
cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
|
||||
mvmvif->color)),
|
||||
};
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = NON_QOS_TX_COUNTER_CMD,
|
||||
.flags = CMD_SYNC | CMD_WANT_SKB,
|
||||
};
|
||||
int err;
|
||||
u32 size;
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) {
|
||||
cmd.data[0] = &query_cmd;
|
||||
cmd.len[0] = sizeof(query_cmd);
|
||||
}
|
||||
|
||||
err = iwl_mvm_send_cmd(mvm, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
size = le32_to_cpu(cmd.resp_pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
|
||||
size -= sizeof(cmd.resp_pkt->hdr);
|
||||
if (size < sizeof(__le16)) {
|
||||
err = -EINVAL;
|
||||
} else {
|
||||
err = le16_to_cpup((__le16 *)cmd.resp_pkt->data);
|
||||
/* new API returns next, not last-used seqno */
|
||||
if (mvm->fw->ucode_capa.flags &
|
||||
IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API)
|
||||
err -= 0x10;
|
||||
}
|
||||
|
||||
iwl_free_resp(&cmd);
|
||||
return err;
|
||||
}
|
||||
|
||||
void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
struct iwl_nonqos_seq_query_cmd query_cmd = {
|
||||
.get_set_flag = cpu_to_le32(IWL_NONQOS_SEQ_SET),
|
||||
.mac_id_n_color =
|
||||
cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
|
||||
mvmvif->color)),
|
||||
.value = cpu_to_le16(mvmvif->seqno),
|
||||
};
|
||||
|
||||
/* return if called during restart, not resume from D3 */
|
||||
if (!mvmvif->seqno_valid)
|
||||
return;
|
||||
|
||||
mvmvif->seqno_valid = false;
|
||||
|
||||
if (!(mvm->fw->ucode_capa.flags &
|
||||
IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API))
|
||||
return;
|
||||
|
||||
if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, CMD_SYNC,
|
||||
sizeof(query_cmd), &query_cmd))
|
||||
IWL_ERR(mvm, "failed to set non-QoS seqno\n");
|
||||
}
|
||||
|
||||
static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
struct cfg80211_wowlan *wowlan,
|
||||
bool test)
|
||||
@ -829,7 +964,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
};
|
||||
int ret, i;
|
||||
int len __maybe_unused;
|
||||
u16 seq;
|
||||
u8 old_aux_sta_id, old_ap_sta_id = IWL_MVM_STATION_COUNT;
|
||||
|
||||
if (!wowlan) {
|
||||
@ -872,26 +1006,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
|
||||
mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv;
|
||||
|
||||
/*
|
||||
* The D3 firmware still hardcodes the AP station ID for the
|
||||
* BSS we're associated with as 0. Store the real STA ID here
|
||||
* and assign 0. When we leave this function, we'll restore
|
||||
* the original value for the resume code.
|
||||
*/
|
||||
old_ap_sta_id = mvm_ap_sta->sta_id;
|
||||
mvm_ap_sta->sta_id = 0;
|
||||
mvmvif->ap_sta_id = 0;
|
||||
|
||||
/* TODO: wowlan_config_cmd.wowlan_ba_teardown_tids */
|
||||
|
||||
wowlan_config_cmd.is_11n_connection = ap_sta->ht_cap.ht_supported;
|
||||
|
||||
/*
|
||||
* We know the last used seqno, and the uCode expects to know that
|
||||
* one, it will increment before TX.
|
||||
*/
|
||||
seq = mvm_ap_sta->last_seq_ctl & IEEE80211_SCTL_SEQ;
|
||||
wowlan_config_cmd.non_qos_seq = cpu_to_le16(seq);
|
||||
/* Query the last used seqno and set it */
|
||||
ret = iwl_mvm_get_last_nonqos_seq(mvm, vif);
|
||||
if (ret < 0)
|
||||
goto out_noreset;
|
||||
wowlan_config_cmd.non_qos_seq = cpu_to_le16(ret);
|
||||
|
||||
/*
|
||||
* For QoS counters, we store the one to use next, so subtract 0x10
|
||||
@ -899,7 +1022,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
* increment after using the value (i.e. store the next value to use).
|
||||
*/
|
||||
for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
|
||||
seq = mvm_ap_sta->tid_data[i].seq_number;
|
||||
u16 seq = mvm_ap_sta->tid_data[i].seq_number;
|
||||
seq -= 0x10;
|
||||
wowlan_config_cmd.qos_seq[i] = cpu_to_le16(seq);
|
||||
}
|
||||
@ -944,6 +1067,16 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
|
||||
iwl_trans_stop_device(mvm->trans);
|
||||
|
||||
/*
|
||||
* The D3 firmware still hardcodes the AP station ID for the
|
||||
* BSS we're associated with as 0. Store the real STA ID here
|
||||
* and assign 0. When we leave this function, we'll restore
|
||||
* the original value for the resume code.
|
||||
*/
|
||||
old_ap_sta_id = mvm_ap_sta->sta_id;
|
||||
mvm_ap_sta->sta_id = 0;
|
||||
mvmvif->ap_sta_id = 0;
|
||||
|
||||
/*
|
||||
* Set the HW restart bit -- this is mostly true as we're
|
||||
* going to load new firmware and reprogram that, though
|
||||
@ -1059,6 +1192,10 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = iwl_mvm_power_update_device_mode(mvm);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = iwl_mvm_power_update_mode(mvm, vif);
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -1109,16 +1246,26 @@ int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
|
||||
return __iwl_mvm_suspend(hw, wowlan, false);
|
||||
}
|
||||
|
||||
/* converted data from the different status responses */
|
||||
struct iwl_wowlan_status_data {
|
||||
u16 pattern_number;
|
||||
u16 qos_seq_ctr[8];
|
||||
u32 wakeup_reasons;
|
||||
u32 wake_packet_length;
|
||||
u32 wake_packet_bufsize;
|
||||
const u8 *wake_packet;
|
||||
};
|
||||
|
||||
static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct iwl_wowlan_status *status)
|
||||
struct iwl_wowlan_status_data *status)
|
||||
{
|
||||
struct sk_buff *pkt = NULL;
|
||||
struct cfg80211_wowlan_wakeup wakeup = {
|
||||
.pattern_idx = -1,
|
||||
};
|
||||
struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup;
|
||||
u32 reasons = le32_to_cpu(status->wakeup_reasons);
|
||||
u32 reasons = status->wakeup_reasons;
|
||||
|
||||
if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) {
|
||||
wakeup_report = NULL;
|
||||
@ -1130,7 +1277,7 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
|
||||
if (reasons & IWL_WOWLAN_WAKEUP_BY_PATTERN)
|
||||
wakeup.pattern_idx =
|
||||
le16_to_cpu(status->pattern_number);
|
||||
status->pattern_number;
|
||||
|
||||
if (reasons & (IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON |
|
||||
IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH))
|
||||
@ -1158,8 +1305,8 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
wakeup.tcp_match = true;
|
||||
|
||||
if (status->wake_packet_bufsize) {
|
||||
int pktsize = le32_to_cpu(status->wake_packet_bufsize);
|
||||
int pktlen = le32_to_cpu(status->wake_packet_length);
|
||||
int pktsize = status->wake_packet_bufsize;
|
||||
int pktlen = status->wake_packet_length;
|
||||
const u8 *pktdata = status->wake_packet;
|
||||
struct ieee80211_hdr *hdr = (void *)pktdata;
|
||||
int truncated = pktlen - pktsize;
|
||||
@ -1239,8 +1386,229 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
kfree_skb(pkt);
|
||||
}
|
||||
|
||||
static void iwl_mvm_aes_sc_to_seq(struct aes_sc *sc,
|
||||
struct ieee80211_key_seq *seq)
|
||||
{
|
||||
u64 pn;
|
||||
|
||||
pn = le64_to_cpu(sc->pn);
|
||||
seq->ccmp.pn[0] = pn >> 40;
|
||||
seq->ccmp.pn[1] = pn >> 32;
|
||||
seq->ccmp.pn[2] = pn >> 24;
|
||||
seq->ccmp.pn[3] = pn >> 16;
|
||||
seq->ccmp.pn[4] = pn >> 8;
|
||||
seq->ccmp.pn[5] = pn;
|
||||
}
|
||||
|
||||
static void iwl_mvm_tkip_sc_to_seq(struct tkip_sc *sc,
|
||||
struct ieee80211_key_seq *seq)
|
||||
{
|
||||
seq->tkip.iv32 = le32_to_cpu(sc->iv32);
|
||||
seq->tkip.iv16 = le16_to_cpu(sc->iv16);
|
||||
}
|
||||
|
||||
static void iwl_mvm_set_aes_rx_seq(struct aes_sc *scs,
|
||||
struct ieee80211_key_conf *key)
|
||||
{
|
||||
int tid;
|
||||
|
||||
BUILD_BUG_ON(IWL_NUM_RSC != IEEE80211_NUM_TIDS);
|
||||
|
||||
for (tid = 0; tid < IWL_NUM_RSC; tid++) {
|
||||
struct ieee80211_key_seq seq = {};
|
||||
|
||||
iwl_mvm_aes_sc_to_seq(&scs[tid], &seq);
|
||||
ieee80211_set_key_rx_seq(key, tid, &seq);
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_mvm_set_tkip_rx_seq(struct tkip_sc *scs,
|
||||
struct ieee80211_key_conf *key)
|
||||
{
|
||||
int tid;
|
||||
|
||||
BUILD_BUG_ON(IWL_NUM_RSC != IEEE80211_NUM_TIDS);
|
||||
|
||||
for (tid = 0; tid < IWL_NUM_RSC; tid++) {
|
||||
struct ieee80211_key_seq seq = {};
|
||||
|
||||
iwl_mvm_tkip_sc_to_seq(&scs[tid], &seq);
|
||||
ieee80211_set_key_rx_seq(key, tid, &seq);
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key,
|
||||
struct iwl_wowlan_status_v6 *status)
|
||||
{
|
||||
union iwl_all_tsc_rsc *rsc = &status->gtk.rsc.all_tsc_rsc;
|
||||
|
||||
switch (key->cipher) {
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
iwl_mvm_set_aes_rx_seq(rsc->aes.multicast_rsc, key);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
iwl_mvm_set_tkip_rx_seq(rsc->tkip.multicast_rsc, key);
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
}
|
||||
}
|
||||
|
||||
struct iwl_mvm_d3_gtk_iter_data {
|
||||
struct iwl_wowlan_status_v6 *status;
|
||||
void *last_gtk;
|
||||
u32 cipher;
|
||||
bool find_phase, unhandled_cipher;
|
||||
int num_keys;
|
||||
};
|
||||
|
||||
static void iwl_mvm_d3_update_gtks(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta,
|
||||
struct ieee80211_key_conf *key,
|
||||
void *_data)
|
||||
{
|
||||
struct iwl_mvm_d3_gtk_iter_data *data = _data;
|
||||
|
||||
if (data->unhandled_cipher)
|
||||
return;
|
||||
|
||||
switch (key->cipher) {
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
/* ignore WEP completely, nothing to do */
|
||||
return;
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
/* we support these */
|
||||
break;
|
||||
default:
|
||||
/* everything else (even CMAC for MFP) - disconnect from AP */
|
||||
data->unhandled_cipher = true;
|
||||
return;
|
||||
}
|
||||
|
||||
data->num_keys++;
|
||||
|
||||
/*
|
||||
* pairwise key - update sequence counters only;
|
||||
* note that this assumes no TDLS sessions are active
|
||||
*/
|
||||
if (sta) {
|
||||
struct ieee80211_key_seq seq = {};
|
||||
union iwl_all_tsc_rsc *sc = &data->status->gtk.rsc.all_tsc_rsc;
|
||||
|
||||
if (data->find_phase)
|
||||
return;
|
||||
|
||||
switch (key->cipher) {
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
iwl_mvm_aes_sc_to_seq(&sc->aes.tsc, &seq);
|
||||
iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq);
|
||||
iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key);
|
||||
break;
|
||||
}
|
||||
ieee80211_set_key_tx_seq(key, &seq);
|
||||
|
||||
/* that's it for this key */
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->find_phase) {
|
||||
data->last_gtk = key;
|
||||
data->cipher = key->cipher;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->status->num_of_gtk_rekeys)
|
||||
ieee80211_remove_key(key);
|
||||
else if (data->last_gtk == key)
|
||||
iwl_mvm_set_key_rx_seq(key, data->status);
|
||||
}
|
||||
|
||||
static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct iwl_wowlan_status_v6 *status)
|
||||
{
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
struct iwl_mvm_d3_gtk_iter_data gtkdata = {
|
||||
.status = status,
|
||||
};
|
||||
|
||||
if (!status || !vif->bss_conf.bssid)
|
||||
return false;
|
||||
|
||||
/* find last GTK that we used initially, if any */
|
||||
gtkdata.find_phase = true;
|
||||
ieee80211_iter_keys(mvm->hw, vif,
|
||||
iwl_mvm_d3_update_gtks, >kdata);
|
||||
/* not trying to keep connections with MFP/unhandled ciphers */
|
||||
if (gtkdata.unhandled_cipher)
|
||||
return false;
|
||||
if (!gtkdata.num_keys)
|
||||
return true;
|
||||
if (!gtkdata.last_gtk)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* invalidate all other GTKs that might still exist and update
|
||||
* the one that we used
|
||||
*/
|
||||
gtkdata.find_phase = false;
|
||||
ieee80211_iter_keys(mvm->hw, vif,
|
||||
iwl_mvm_d3_update_gtks, >kdata);
|
||||
|
||||
if (status->num_of_gtk_rekeys) {
|
||||
struct ieee80211_key_conf *key;
|
||||
struct {
|
||||
struct ieee80211_key_conf conf;
|
||||
u8 key[32];
|
||||
} conf = {
|
||||
.conf.cipher = gtkdata.cipher,
|
||||
.conf.keyidx = status->gtk.key_index,
|
||||
};
|
||||
|
||||
switch (gtkdata.cipher) {
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
conf.conf.keylen = WLAN_KEY_LEN_CCMP;
|
||||
memcpy(conf.conf.key, status->gtk.decrypt_key,
|
||||
WLAN_KEY_LEN_CCMP);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
conf.conf.keylen = WLAN_KEY_LEN_TKIP;
|
||||
memcpy(conf.conf.key, status->gtk.decrypt_key, 16);
|
||||
/* leave TX MIC key zeroed, we don't use it anyway */
|
||||
memcpy(conf.conf.key +
|
||||
NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY,
|
||||
status->gtk.tkip_mic_key, 8);
|
||||
break;
|
||||
}
|
||||
|
||||
key = ieee80211_gtk_rekey_add(vif, &conf.conf);
|
||||
if (IS_ERR(key))
|
||||
return false;
|
||||
iwl_mvm_set_key_rx_seq(key, status);
|
||||
}
|
||||
|
||||
if (status->num_of_gtk_rekeys) {
|
||||
__be64 replay_ctr =
|
||||
cpu_to_be64(le64_to_cpu(status->replay_ctr));
|
||||
ieee80211_gtk_rekey_notify(vif, vif->bss_conf.bssid,
|
||||
(void *)&replay_ctr, GFP_KERNEL);
|
||||
}
|
||||
|
||||
mvmvif->seqno_valid = true;
|
||||
/* +0x10 because the set API expects next-to-use, not last-used */
|
||||
mvmvif->seqno = le16_to_cpu(status->non_qos_seq_ctr) + 0x10;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* releases the MVM mutex */
|
||||
static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
u32 base = mvm->error_event_table;
|
||||
@ -1253,8 +1621,12 @@ static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
.id = WOWLAN_GET_STATUSES,
|
||||
.flags = CMD_SYNC | CMD_WANT_SKB,
|
||||
};
|
||||
struct iwl_wowlan_status *status;
|
||||
int ret, len;
|
||||
struct iwl_wowlan_status_data status;
|
||||
struct iwl_wowlan_status_v6 *status_v6;
|
||||
int ret, len, status_size, i;
|
||||
bool keep;
|
||||
struct ieee80211_sta *ap_sta;
|
||||
struct iwl_mvm_sta *mvm_ap_sta;
|
||||
|
||||
iwl_trans_read_mem_bytes(mvm->trans, base,
|
||||
&err_info, sizeof(err_info));
|
||||
@ -1287,32 +1659,83 @@ static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
|
||||
if (!cmd.resp_pkt)
|
||||
goto out_unlock;
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API)
|
||||
status_size = sizeof(struct iwl_wowlan_status_v6);
|
||||
else
|
||||
status_size = sizeof(struct iwl_wowlan_status_v4);
|
||||
|
||||
len = le32_to_cpu(cmd.resp_pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
|
||||
if (len - sizeof(struct iwl_cmd_header) < sizeof(*status)) {
|
||||
if (len - sizeof(struct iwl_cmd_header) < status_size) {
|
||||
IWL_ERR(mvm, "Invalid WoWLAN status response!\n");
|
||||
goto out_free_resp;
|
||||
}
|
||||
|
||||
status = (void *)cmd.resp_pkt->data;
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) {
|
||||
status_v6 = (void *)cmd.resp_pkt->data;
|
||||
|
||||
status.pattern_number = le16_to_cpu(status_v6->pattern_number);
|
||||
for (i = 0; i < 8; i++)
|
||||
status.qos_seq_ctr[i] =
|
||||
le16_to_cpu(status_v6->qos_seq_ctr[i]);
|
||||
status.wakeup_reasons = le32_to_cpu(status_v6->wakeup_reasons);
|
||||
status.wake_packet_length =
|
||||
le32_to_cpu(status_v6->wake_packet_length);
|
||||
status.wake_packet_bufsize =
|
||||
le32_to_cpu(status_v6->wake_packet_bufsize);
|
||||
status.wake_packet = status_v6->wake_packet;
|
||||
} else {
|
||||
struct iwl_wowlan_status_v4 *status_v4;
|
||||
status_v6 = NULL;
|
||||
status_v4 = (void *)cmd.resp_pkt->data;
|
||||
|
||||
status.pattern_number = le16_to_cpu(status_v4->pattern_number);
|
||||
for (i = 0; i < 8; i++)
|
||||
status.qos_seq_ctr[i] =
|
||||
le16_to_cpu(status_v4->qos_seq_ctr[i]);
|
||||
status.wakeup_reasons = le32_to_cpu(status_v4->wakeup_reasons);
|
||||
status.wake_packet_length =
|
||||
le32_to_cpu(status_v4->wake_packet_length);
|
||||
status.wake_packet_bufsize =
|
||||
le32_to_cpu(status_v4->wake_packet_bufsize);
|
||||
status.wake_packet = status_v4->wake_packet;
|
||||
}
|
||||
|
||||
if (len - sizeof(struct iwl_cmd_header) !=
|
||||
sizeof(*status) +
|
||||
ALIGN(le32_to_cpu(status->wake_packet_bufsize), 4)) {
|
||||
status_size + ALIGN(status.wake_packet_bufsize, 4)) {
|
||||
IWL_ERR(mvm, "Invalid WoWLAN status response!\n");
|
||||
goto out_free_resp;
|
||||
}
|
||||
|
||||
/* still at hard-coded place 0 for D3 image */
|
||||
ap_sta = rcu_dereference_protected(
|
||||
mvm->fw_id_to_mac_id[0],
|
||||
lockdep_is_held(&mvm->mutex));
|
||||
if (IS_ERR_OR_NULL(ap_sta))
|
||||
goto out_free_resp;
|
||||
|
||||
mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv;
|
||||
for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
|
||||
u16 seq = status.qos_seq_ctr[i];
|
||||
/* firmware stores last-used value, we store next value */
|
||||
seq += 0x10;
|
||||
mvm_ap_sta->tid_data[i].seq_number = seq;
|
||||
}
|
||||
|
||||
/* now we have all the data we need, unlock to avoid mac80211 issues */
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
iwl_mvm_report_wakeup_reasons(mvm, vif, status);
|
||||
iwl_mvm_report_wakeup_reasons(mvm, vif, &status);
|
||||
|
||||
keep = iwl_mvm_setup_connection_keep(mvm, vif, status_v6);
|
||||
|
||||
iwl_free_resp(&cmd);
|
||||
return;
|
||||
return keep;
|
||||
|
||||
out_free_resp:
|
||||
iwl_free_resp(&cmd);
|
||||
out_unlock:
|
||||
mutex_unlock(&mvm->mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm)
|
||||
@ -1335,6 +1758,17 @@ static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
/* skip the one we keep connection on */
|
||||
if (data == vif)
|
||||
return;
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_STATION)
|
||||
ieee80211_resume_disconnect(vif);
|
||||
}
|
||||
|
||||
static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
|
||||
{
|
||||
struct iwl_d3_iter_data resume_iter_data = {
|
||||
@ -1343,6 +1777,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
|
||||
struct ieee80211_vif *vif = NULL;
|
||||
int ret;
|
||||
enum iwl_d3_status d3_status;
|
||||
bool keep = false;
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
|
||||
@ -1368,7 +1803,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
|
||||
/* query SRAM first in case we want event logging */
|
||||
iwl_mvm_read_d3_sram(mvm);
|
||||
|
||||
iwl_mvm_query_wakeup_reasons(mvm, vif);
|
||||
keep = iwl_mvm_query_wakeup_reasons(mvm, vif);
|
||||
/* has unlocked the mutex, so skip that */
|
||||
goto out;
|
||||
|
||||
@ -1376,8 +1811,10 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
out:
|
||||
if (!test && vif)
|
||||
ieee80211_resume_disconnect(vif);
|
||||
if (!test)
|
||||
ieee80211_iterate_active_interfaces_rtnl(mvm->hw,
|
||||
IEEE80211_IFACE_ITER_NORMAL,
|
||||
iwl_mvm_d3_disconnect_iter, keep ? vif : NULL);
|
||||
|
||||
/* return 1 to reconfigure the device */
|
||||
set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
|
||||
|
@ -246,58 +246,56 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_power_down_allow_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
static ssize_t iwl_dbgfs_disable_power_off_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
char buf[8] = {};
|
||||
int allow;
|
||||
char buf[64];
|
||||
int bufsz = sizeof(buf);
|
||||
int pos = 0;
|
||||
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off_d0=%d\n",
|
||||
mvm->disable_power_off);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off_d3=%d\n",
|
||||
mvm->disable_power_off_d3);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_disable_power_off_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
char buf[64] = {};
|
||||
int ret;
|
||||
int val;
|
||||
|
||||
if (!mvm->ucode_loaded)
|
||||
return -EIO;
|
||||
|
||||
if (copy_from_user(buf, user_buf, sizeof(buf)))
|
||||
count = min_t(size_t, count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, count))
|
||||
return -EFAULT;
|
||||
|
||||
if (sscanf(buf, "%d", &allow) != 1)
|
||||
if (!strncmp("disable_power_off_d0=", buf, 21)) {
|
||||
if (sscanf(buf + 21, "%d", &val) != 1)
|
||||
return -EINVAL;
|
||||
mvm->disable_power_off = val;
|
||||
} else if (!strncmp("disable_power_off_d3=", buf, 21)) {
|
||||
if (sscanf(buf + 21, "%d", &val) != 1)
|
||||
return -EINVAL;
|
||||
mvm->disable_power_off_d3 = val;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
IWL_DEBUG_POWER(mvm, "%s device power down\n",
|
||||
allow ? "allow" : "prevent");
|
||||
mutex_lock(&mvm->mutex);
|
||||
ret = iwl_mvm_power_update_device_mode(mvm);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
/*
|
||||
* TODO: Send REPLY_DEBUG_CMD (0xf0) when FW support it
|
||||
*/
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_power_down_d3_allow_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
char buf[8] = {};
|
||||
int allow;
|
||||
|
||||
if (copy_from_user(buf, user_buf, sizeof(buf)))
|
||||
return -EFAULT;
|
||||
|
||||
if (sscanf(buf, "%d", &allow) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
IWL_DEBUG_POWER(mvm, "%s device power down in d3\n",
|
||||
allow ? "allow" : "prevent");
|
||||
|
||||
/*
|
||||
* TODO: When WoWLAN FW alive notification happens, driver will send
|
||||
* REPLY_DEBUG_CMD setting power_down_allow flag according to
|
||||
* mvm->prevent_power_down_d3
|
||||
*/
|
||||
mvm->prevent_power_down_d3 = !allow;
|
||||
|
||||
return count;
|
||||
return ret ?: count;
|
||||
}
|
||||
|
||||
static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm,
|
||||
@ -371,7 +369,8 @@ static ssize_t iwl_dbgfs_pm_params_write(struct file *file,
|
||||
int val;
|
||||
int ret;
|
||||
|
||||
if (copy_from_user(buf, user_buf, sizeof(buf)))
|
||||
count = min_t(size_t, count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, count))
|
||||
return -EFAULT;
|
||||
|
||||
if (!strncmp("keep_alive=", buf, 11)) {
|
||||
@ -394,7 +393,9 @@ static ssize_t iwl_dbgfs_pm_params_write(struct file *file,
|
||||
if (sscanf(buf + 16, "%d", &val) != 1)
|
||||
return -EINVAL;
|
||||
param = MVM_DEBUGFS_PM_TX_DATA_TIMEOUT;
|
||||
} else if (!strncmp("disable_power_off=", buf, 18)) {
|
||||
} else if (!strncmp("disable_power_off=", buf, 18) &&
|
||||
!(mvm->fw->ucode_capa.flags &
|
||||
IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) {
|
||||
if (sscanf(buf + 18, "%d", &val) != 1)
|
||||
return -EINVAL;
|
||||
param = MVM_DEBUGFS_PM_DISABLE_POWER_OFF;
|
||||
@ -581,15 +582,21 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
|
||||
BT_MBOX_PRINT(3, UPDATE_REQUEST, true);
|
||||
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_status = %d\n",
|
||||
notif->bt_status);
|
||||
notif->bt_status);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_open_conn = %d\n",
|
||||
notif->bt_open_conn);
|
||||
notif->bt_open_conn);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_traffic_load = %d\n",
|
||||
notif->bt_traffic_load);
|
||||
notif->bt_traffic_load);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_agg_traffic_load = %d\n",
|
||||
notif->bt_agg_traffic_load);
|
||||
notif->bt_agg_traffic_load);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n",
|
||||
notif->bt_ci_compliance);
|
||||
notif->bt_ci_compliance);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n",
|
||||
le32_to_cpu(notif->primary_ch_lut));
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n",
|
||||
le32_to_cpu(notif->secondary_ch_lut));
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "bt_activity_grading = %d\n",
|
||||
le32_to_cpu(notif->bt_activity_grading));
|
||||
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
@ -600,6 +607,38 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
|
||||
}
|
||||
#undef BT_MBOX_PRINT
|
||||
|
||||
static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd;
|
||||
char buf[256];
|
||||
int bufsz = sizeof(buf);
|
||||
int pos = 0;
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "Channel inhibition CMD\n");
|
||||
pos += scnprintf(buf+pos, bufsz-pos,
|
||||
"\tPrimary Channel Bitmap 0x%016llx Fat: %d\n",
|
||||
le64_to_cpu(cmd->bt_primary_ci),
|
||||
!!cmd->co_run_bw_primary);
|
||||
pos += scnprintf(buf+pos, bufsz-pos,
|
||||
"\tSecondary Channel Bitmap 0x%016llx Fat: %d\n",
|
||||
le64_to_cpu(cmd->bt_secondary_ci),
|
||||
!!cmd->co_run_bw_secondary);
|
||||
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
|
||||
iwl_bt_ack_kill_msk[mvm->bt_kill_msk]);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill Mask 0x%08x\n",
|
||||
iwl_bt_cts_kill_msk[mvm->bt_kill_msk]);
|
||||
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
#define PRINT_STATS_LE32(_str, _val) \
|
||||
pos += scnprintf(buf + pos, bufsz - pos, \
|
||||
fmt_table, _str, \
|
||||
@ -615,9 +654,11 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file,
|
||||
int pos = 0;
|
||||
char *buf;
|
||||
int ret;
|
||||
int bufsz = sizeof(struct mvm_statistics_rx_phy) * 20 +
|
||||
sizeof(struct mvm_statistics_rx_non_phy) * 10 +
|
||||
sizeof(struct mvm_statistics_rx_ht_phy) * 10 + 200;
|
||||
/* 43 is the size of each data line, 33 is the size of each header */
|
||||
size_t bufsz =
|
||||
((sizeof(struct mvm_statistics_rx) / sizeof(__le32)) * 43) +
|
||||
(4 * 33) + 1;
|
||||
|
||||
struct mvm_statistics_rx_phy *ofdm;
|
||||
struct mvm_statistics_rx_phy *cck;
|
||||
struct mvm_statistics_rx_non_phy *general;
|
||||
@ -712,6 +753,7 @@ static ssize_t iwl_dbgfs_fw_rx_stats_read(struct file *file,
|
||||
PRINT_STATS_LE32("beacon_energy_b", general->beacon_energy_b);
|
||||
PRINT_STATS_LE32("beacon_energy_c", general->beacon_energy_c);
|
||||
PRINT_STATS_LE32("num_bt_kills", general->num_bt_kills);
|
||||
PRINT_STATS_LE32("mac_id", general->mac_id);
|
||||
PRINT_STATS_LE32("directed_data_mpdu", general->directed_data_mpdu);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
|
||||
@ -757,6 +799,59 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
iwl_dbgfs_scan_ant_rxchain_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
int pos = 0;
|
||||
char buf[32];
|
||||
const size_t bufsz = sizeof(buf);
|
||||
|
||||
/* print which antennas were set for the scan command by the user */
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Antennas for scan: ");
|
||||
if (mvm->scan_rx_ant & ANT_A)
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "A");
|
||||
if (mvm->scan_rx_ant & ANT_B)
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "B");
|
||||
if (mvm->scan_rx_ant & ANT_C)
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "C");
|
||||
pos += scnprintf(buf + pos, bufsz - pos, " (%hhx)\n", mvm->scan_rx_ant);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
iwl_dbgfs_scan_ant_rxchain_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_mvm *mvm = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
u8 scan_rx_ant;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
buf_size = min(count, sizeof(buf) - 1);
|
||||
|
||||
/* get the argument from the user and check if it is valid */
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
if (sscanf(buf, "%hhx", &scan_rx_ant) != 1)
|
||||
return -EINVAL;
|
||||
if (scan_rx_ant > ANT_ABC)
|
||||
return -EINVAL;
|
||||
if (scan_rx_ant & ~iwl_fw_valid_rx_ant(mvm->fw))
|
||||
return -EINVAL;
|
||||
|
||||
/* change the rx antennas for scan command */
|
||||
mvm->scan_rx_ant = scan_rx_ant;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif,
|
||||
enum iwl_dbgfs_bf_mask param, int value)
|
||||
{
|
||||
@ -968,7 +1063,8 @@ static ssize_t iwl_dbgfs_d3_sram_write(struct file *file,
|
||||
char buf[8] = {};
|
||||
int store;
|
||||
|
||||
if (copy_from_user(buf, user_buf, sizeof(buf)))
|
||||
count = min_t(size_t, count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, count))
|
||||
return -EFAULT;
|
||||
|
||||
if (sscanf(buf, "%d", &store) != 1)
|
||||
@ -1063,10 +1159,12 @@ MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain);
|
||||
MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram);
|
||||
MVM_DEBUGFS_READ_FILE_OPS(stations);
|
||||
MVM_DEBUGFS_READ_FILE_OPS(bt_notif);
|
||||
MVM_DEBUGFS_WRITE_FILE_OPS(power_down_allow);
|
||||
MVM_DEBUGFS_WRITE_FILE_OPS(power_down_d3_allow);
|
||||
MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
|
||||
MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off);
|
||||
MVM_DEBUGFS_READ_FILE_OPS(fw_rx_stats);
|
||||
MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart);
|
||||
MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain);
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram);
|
||||
#endif
|
||||
@ -1087,10 +1185,14 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
|
||||
MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, S_IWUSR | S_IRUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(power_down_allow, mvm->debugfs_dir, S_IWUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(power_down_d3_allow, mvm->debugfs_dir, S_IWUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(bt_cmd, dbgfs_dir, S_IRUSR);
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)
|
||||
MVM_DEBUGFS_ADD_FILE(disable_power_off, mvm->debugfs_dir,
|
||||
S_IRUSR | S_IWUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, S_IRUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir,
|
||||
S_IWUSR | S_IRUSR);
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
MVM_DEBUGFS_ADD_FILE(d3_sram, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
|
||||
MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, S_IRUSR);
|
||||
|
@ -82,6 +82,8 @@
|
||||
* @BT_USE_DEFAULTS:
|
||||
* @BT_SYNC_2_BT_DISABLE:
|
||||
* @BT_COEX_CORUNNING_TBL_EN:
|
||||
*
|
||||
* The COEX_MODE must be set for each command. Even if it is not changed.
|
||||
*/
|
||||
enum iwl_bt_coex_flags {
|
||||
BT_CH_PRIMARY_EN = BIT(0),
|
||||
@ -95,14 +97,16 @@ enum iwl_bt_coex_flags {
|
||||
BT_COEX_NW = 0x3 << BT_COEX_MODE_POS,
|
||||
BT_USE_DEFAULTS = BIT(6),
|
||||
BT_SYNC_2_BT_DISABLE = BIT(7),
|
||||
/*
|
||||
* For future use - when the flags will be enlarged
|
||||
* BT_COEX_CORUNNING_TBL_EN = BIT(8),
|
||||
*/
|
||||
BT_COEX_CORUNNING_TBL_EN = BIT(8),
|
||||
BT_COEX_MPLUT_TBL_EN = BIT(9),
|
||||
/* Bit 10 is reserved */
|
||||
BT_COEX_WF_PRIO_BOOST_CHECK_EN = BIT(11),
|
||||
};
|
||||
|
||||
/*
|
||||
* indicates what has changed in the BT_COEX command.
|
||||
* BT_VALID_ENABLE must be set for each command. Commands without this bit will
|
||||
* discarded by the firmware
|
||||
*/
|
||||
enum iwl_bt_coex_valid_bit_msk {
|
||||
BT_VALID_ENABLE = BIT(0),
|
||||
@ -121,11 +125,8 @@ enum iwl_bt_coex_valid_bit_msk {
|
||||
BT_VALID_CORUN_LUT_40 = BIT(13),
|
||||
BT_VALID_ANT_ISOLATION = BIT(14),
|
||||
BT_VALID_ANT_ISOLATION_THRS = BIT(15),
|
||||
/*
|
||||
* For future use - when the valid flags will be enlarged
|
||||
* BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16),
|
||||
* BT_VALID_TXRX_MAX_FREQ_0 = BIT(17),
|
||||
*/
|
||||
BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16),
|
||||
BT_VALID_TXRX_MAX_FREQ_0 = BIT(17),
|
||||
};
|
||||
|
||||
/**
|
||||
@ -142,48 +143,88 @@ enum iwl_bt_reduced_tx_power {
|
||||
BT_REDUCED_TX_POWER_DATA = BIT(1),
|
||||
};
|
||||
|
||||
enum iwl_bt_coex_lut_type {
|
||||
BT_COEX_TIGHT_LUT = 0,
|
||||
BT_COEX_LOOSE_LUT,
|
||||
BT_COEX_TX_DIS_LUT,
|
||||
|
||||
BT_COEX_MAX_LUT,
|
||||
};
|
||||
|
||||
#define BT_COEX_LUT_SIZE (12)
|
||||
#define BT_COEX_CORUN_LUT_SIZE (32)
|
||||
#define BT_COEX_MULTI_PRIO_LUT_SIZE (2)
|
||||
#define BT_COEX_BOOST_SIZE (4)
|
||||
#define BT_REDUCED_TX_POWER_BIT BIT(7)
|
||||
|
||||
/**
|
||||
* struct iwl_bt_coex_cmd - bt coex configuration command
|
||||
* @flags:&enum iwl_bt_coex_flags
|
||||
* @lead_time:
|
||||
* @max_kill:
|
||||
* @bt3_time_t7_value:
|
||||
* @kill_ack_msk:
|
||||
* @kill_cts_msk:
|
||||
* @bt3_prio_sample_time:
|
||||
* @bt3_timer_t2_value:
|
||||
* @bt4_reaction_time:
|
||||
* @decision_lut[12]:
|
||||
* @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power
|
||||
* @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk
|
||||
* @bt_prio_boost: values for PTA boost register
|
||||
* @bt4_antenna_isolation:
|
||||
* @bt4_antenna_isolation_thr:
|
||||
* @bt4_tx_tx_delta_freq_thr:
|
||||
* @bt4_tx_rx_max_freq0:
|
||||
* @bt_prio_boost:
|
||||
* @wifi_tx_prio_boost: SW boost of wifi tx priority
|
||||
* @wifi_rx_prio_boost: SW boost of wifi rx priority
|
||||
* @kill_ack_msk:
|
||||
* @kill_cts_msk:
|
||||
* @decision_lut:
|
||||
* @bt4_multiprio_lut:
|
||||
* @bt4_corun_lut20:
|
||||
* @bt4_corun_lut40:
|
||||
* @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk
|
||||
*
|
||||
* The structure is used for the BT_COEX command.
|
||||
*/
|
||||
struct iwl_bt_coex_cmd {
|
||||
u8 flags;
|
||||
u8 lead_time;
|
||||
__le32 flags;
|
||||
u8 max_kill;
|
||||
u8 bt3_time_t7_value;
|
||||
u8 bt_reduced_tx_power;
|
||||
u8 reserved[2];
|
||||
|
||||
u8 bt4_antenna_isolation;
|
||||
u8 bt4_antenna_isolation_thr;
|
||||
u8 bt4_tx_tx_delta_freq_thr;
|
||||
u8 bt4_tx_rx_max_freq0;
|
||||
|
||||
__le32 bt_prio_boost[BT_COEX_BOOST_SIZE];
|
||||
__le32 wifi_tx_prio_boost;
|
||||
__le32 wifi_rx_prio_boost;
|
||||
__le32 kill_ack_msk;
|
||||
__le32 kill_cts_msk;
|
||||
u8 bt3_prio_sample_time;
|
||||
u8 bt3_timer_t2_value;
|
||||
__le16 bt4_reaction_time;
|
||||
__le32 decision_lut[BT_COEX_LUT_SIZE];
|
||||
u8 bt_reduced_tx_power;
|
||||
u8 reserved;
|
||||
__le16 valid_bit_msk;
|
||||
__le32 bt_prio_boost;
|
||||
u8 reserved2;
|
||||
u8 wifi_tx_prio_boost;
|
||||
__le16 wifi_rx_prio_boost;
|
||||
|
||||
__le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE];
|
||||
__le32 bt4_multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE];
|
||||
__le32 bt4_corun_lut20[BT_COEX_CORUN_LUT_SIZE];
|
||||
__le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE];
|
||||
|
||||
__le32 valid_bit_msk;
|
||||
} __packed; /* BT_COEX_CMD_API_S_VER_3 */
|
||||
|
||||
/**
|
||||
* struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
|
||||
* @bt_primary_ci:
|
||||
* @bt_secondary_ci:
|
||||
* @co_run_bw_primary:
|
||||
* @co_run_bw_secondary:
|
||||
* @primary_ch_phy_id:
|
||||
* @secondary_ch_phy_id:
|
||||
*
|
||||
* Used for BT_COEX_CI command
|
||||
*/
|
||||
struct iwl_bt_coex_ci_cmd {
|
||||
__le64 bt_primary_ci;
|
||||
__le64 bt_secondary_ci;
|
||||
|
||||
u8 co_run_bw_primary;
|
||||
u8 co_run_bw_secondary;
|
||||
u8 primary_ch_phy_id;
|
||||
u8 secondary_ch_phy_id;
|
||||
} __packed; /* BT_CI_MSG_API_S_VER_1 */
|
||||
|
||||
#define BT_MBOX(n_dw, _msg, _pos, _nbits) \
|
||||
BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
|
||||
BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
|
||||
@ -244,23 +285,39 @@ enum iwl_bt_mxbox_dw3 {
|
||||
((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
|
||||
>> BT_MBOX##_num##_##_field##_POS)
|
||||
|
||||
enum iwl_bt_activity_grading {
|
||||
BT_OFF = 0,
|
||||
BT_ON_NO_CONNECTION = 1,
|
||||
BT_LOW_TRAFFIC = 2,
|
||||
BT_HIGH_TRAFFIC = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct iwl_bt_coex_profile_notif - notification about BT coex
|
||||
* @mbox_msg: message from BT to WiFi
|
||||
* @:bt_status: 0 - off, 1 - on
|
||||
* @:bt_open_conn: number of BT connections open
|
||||
* @:bt_traffic_load: load of BT traffic
|
||||
* @:bt_agg_traffic_load: aggregated load of BT traffic
|
||||
* @:bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
|
||||
* @msg_idx: the index of the message
|
||||
* @bt_status: 0 - off, 1 - on
|
||||
* @bt_open_conn: number of BT connections open
|
||||
* @bt_traffic_load: load of BT traffic
|
||||
* @bt_agg_traffic_load: aggregated load of BT traffic
|
||||
* @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
|
||||
* @primary_ch_lut: LUT used for primary channel
|
||||
* @secondary_ch_lut: LUT used for secondary channel
|
||||
* @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
|
||||
*/
|
||||
struct iwl_bt_coex_profile_notif {
|
||||
__le32 mbox_msg[4];
|
||||
__le32 msg_idx;
|
||||
u8 bt_status;
|
||||
u8 bt_open_conn;
|
||||
u8 bt_traffic_load;
|
||||
u8 bt_agg_traffic_load;
|
||||
u8 bt_ci_compliance;
|
||||
u8 reserved[3];
|
||||
|
||||
__le32 primary_ch_lut;
|
||||
__le32 secondary_ch_lut;
|
||||
__le32 bt_activity_grading;
|
||||
} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_2 */
|
||||
|
||||
enum iwl_bt_coex_prio_table_event {
|
||||
@ -300,20 +357,4 @@ struct iwl_bt_coex_prio_tbl_cmd {
|
||||
u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX];
|
||||
} __packed;
|
||||
|
||||
enum iwl_bt_coex_env_action {
|
||||
BT_COEX_ENV_CLOSE = 0,
|
||||
BT_COEX_ENV_OPEN = 1,
|
||||
}; /* BT_COEX_PROT_ENV_ACTION_API_E_VER_1 */
|
||||
|
||||
/**
|
||||
* struct iwl_bt_coex_prot_env_cmd - BT Protection Envelope
|
||||
* @action: enum %iwl_bt_coex_env_action
|
||||
* @type: enum %iwl_bt_coex_prio_table_event
|
||||
*/
|
||||
struct iwl_bt_coex_prot_env_cmd {
|
||||
u8 action; /* 0 = closed, 1 = open */
|
||||
u8 type; /* 0 .. 15 */
|
||||
u8 reserved[2];
|
||||
} __packed;
|
||||
|
||||
#endif /* __fw_api_bt_coex_h__ */
|
||||
|
@ -100,7 +100,12 @@ enum iwl_proto_offloads {
|
||||
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1 2
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2 6
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX 6
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L 12
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S 4
|
||||
#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX 12
|
||||
|
||||
#define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L 4
|
||||
#define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S 2
|
||||
|
||||
/**
|
||||
* struct iwl_proto_offload_cmd_common - ARP/NS offload common part
|
||||
@ -155,6 +160,43 @@ struct iwl_proto_offload_cmd_v2 {
|
||||
u8 reserved2[3];
|
||||
} __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
|
||||
|
||||
struct iwl_ns_config {
|
||||
struct in6_addr source_ipv6_addr;
|
||||
struct in6_addr dest_ipv6_addr;
|
||||
u8 target_mac_addr[ETH_ALEN];
|
||||
__le16 reserved;
|
||||
} __packed; /* NS_OFFLOAD_CONFIG */
|
||||
|
||||
struct iwl_targ_addr {
|
||||
struct in6_addr addr;
|
||||
__le32 config_num;
|
||||
} __packed; /* TARGET_IPV6_ADDRESS */
|
||||
|
||||
/**
|
||||
* struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
|
||||
* @common: common/IPv4 configuration
|
||||
* @target_ipv6_addr: target IPv6 addresses
|
||||
* @ns_config: NS offload configurations
|
||||
*/
|
||||
struct iwl_proto_offload_cmd_v3_small {
|
||||
struct iwl_proto_offload_cmd_common common;
|
||||
__le32 num_valid_ipv6_addrs;
|
||||
struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
|
||||
struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
|
||||
} __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
|
||||
|
||||
/**
|
||||
* struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
|
||||
* @common: common/IPv4 configuration
|
||||
* @target_ipv6_addr: target IPv6 addresses
|
||||
* @ns_config: NS offload configurations
|
||||
*/
|
||||
struct iwl_proto_offload_cmd_v3_large {
|
||||
struct iwl_proto_offload_cmd_common common;
|
||||
__le32 num_valid_ipv6_addrs;
|
||||
struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
|
||||
struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
|
||||
} __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
|
||||
|
||||
/*
|
||||
* WOWLAN_PATTERNS
|
||||
@ -293,7 +335,7 @@ enum iwl_wowlan_wakeup_reason {
|
||||
IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12),
|
||||
}; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
|
||||
|
||||
struct iwl_wowlan_status {
|
||||
struct iwl_wowlan_status_v4 {
|
||||
__le64 replay_ctr;
|
||||
__le16 pattern_number;
|
||||
__le16 non_qos_seq_ctr;
|
||||
@ -308,6 +350,29 @@ struct iwl_wowlan_status {
|
||||
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
|
||||
} __packed; /* WOWLAN_STATUSES_API_S_VER_4 */
|
||||
|
||||
struct iwl_wowlan_gtk_status {
|
||||
u8 key_index;
|
||||
u8 reserved[3];
|
||||
u8 decrypt_key[16];
|
||||
u8 tkip_mic_key[8];
|
||||
struct iwl_wowlan_rsc_tsc_params_cmd rsc;
|
||||
} __packed;
|
||||
|
||||
struct iwl_wowlan_status_v6 {
|
||||
struct iwl_wowlan_gtk_status gtk;
|
||||
__le64 replay_ctr;
|
||||
__le16 pattern_number;
|
||||
__le16 non_qos_seq_ctr;
|
||||
__le16 qos_seq_ctr[8];
|
||||
__le32 wakeup_reasons;
|
||||
__le32 num_of_gtk_rekeys;
|
||||
__le32 transmitted_ndps;
|
||||
__le32 received_beacons;
|
||||
__le32 wake_packet_length;
|
||||
__le32 wake_packet_bufsize;
|
||||
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
|
||||
} __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
|
||||
|
||||
#define IWL_WOWLAN_TCP_MAX_PACKET_LEN 64
|
||||
#define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN 128
|
||||
#define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS 2048
|
||||
|
@ -170,12 +170,14 @@ struct iwl_mac_data_ap {
|
||||
* @beacon_tsf: beacon transmit time in TSF
|
||||
* @bi: beacon interval in TU
|
||||
* @bi_reciprocal: 2^32 / bi
|
||||
* @beacon_template: beacon template ID
|
||||
*/
|
||||
struct iwl_mac_data_ibss {
|
||||
__le32 beacon_time;
|
||||
__le64 beacon_tsf;
|
||||
__le32 bi;
|
||||
__le32 bi_reciprocal;
|
||||
__le32 beacon_template;
|
||||
} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
|
||||
|
||||
/**
|
||||
@ -372,4 +374,13 @@ static inline u32 iwl_mvm_reciprocal(u32 v)
|
||||
return 0xFFFFFFFF / v;
|
||||
}
|
||||
|
||||
#define IWL_NONQOS_SEQ_GET 0x1
|
||||
#define IWL_NONQOS_SEQ_SET 0x2
|
||||
struct iwl_nonqos_seq_query_cmd {
|
||||
__le32 get_set_flag;
|
||||
__le32 mac_id_n_color;
|
||||
__le16 value;
|
||||
__le16 reserved;
|
||||
} __packed; /* NON_QOS_TX_COUNTER_GET_SET_API_S_VER_1 */
|
||||
|
||||
#endif /* __fw_api_mac_h__ */
|
||||
|
@ -131,6 +131,33 @@ struct iwl_powertable_cmd {
|
||||
__le32 lprx_rssi_threshold;
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
* enum iwl_device_power_flags - masks for device power command flags
|
||||
* @DEVIC_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
|
||||
* receiver and transmitter. '0' - does not allow. This flag should be
|
||||
* always set to '1' unless one need to disable actual power down for debug
|
||||
* purposes.
|
||||
* @DEVICE_POWER_FLAGS_CAM_MSK: '1' CAM (Continuous Active Mode) is set, meaning
|
||||
* that power management is disabled. '0' Power management is enabled, one
|
||||
* of power schemes is applied.
|
||||
*/
|
||||
enum iwl_device_power_flags {
|
||||
DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
|
||||
DEVICE_POWER_FLAGS_CAM_MSK = BIT(13),
|
||||
};
|
||||
|
||||
/**
|
||||
* struct iwl_device_power_cmd - device wide power command.
|
||||
* DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
|
||||
*
|
||||
* @flags: Power table command flags from DEVICE_POWER_FLAGS_*
|
||||
*/
|
||||
struct iwl_device_power_cmd {
|
||||
/* PM_POWER_TABLE_CMD_API_S_VER_6 */
|
||||
__le16 flags;
|
||||
__le16 reserved;
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
* struct iwl_mac_power_cmd - New power command containing uAPSD support
|
||||
* MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
|
||||
@ -290,7 +317,7 @@ struct iwl_beacon_filter_cmd {
|
||||
#define IWL_BF_ESCAPE_TIMER_MIN 0
|
||||
|
||||
#define IWL_BA_ESCAPE_TIMER_DEFAULT 6
|
||||
#define IWL_BA_ESCAPE_TIMER_D3 6
|
||||
#define IWL_BA_ESCAPE_TIMER_D3 9
|
||||
#define IWL_BA_ESCAPE_TIMER_MAX 1024
|
||||
#define IWL_BA_ESCAPE_TIMER_MIN 0
|
||||
|
||||
|
@ -68,6 +68,7 @@
|
||||
/*
|
||||
* These serve as indexes into
|
||||
* struct iwl_rate_info fw_rate_idx_to_plcp[IWL_RATE_COUNT];
|
||||
* TODO: avoid overlap between legacy and HT rates
|
||||
*/
|
||||
enum {
|
||||
IWL_RATE_1M_INDEX = 0,
|
||||
@ -78,18 +79,31 @@ enum {
|
||||
IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX,
|
||||
IWL_RATE_6M_INDEX,
|
||||
IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
|
||||
IWL_RATE_MCS_0_INDEX = IWL_RATE_6M_INDEX,
|
||||
IWL_FIRST_HT_RATE = IWL_RATE_MCS_0_INDEX,
|
||||
IWL_FIRST_VHT_RATE = IWL_RATE_MCS_0_INDEX,
|
||||
IWL_RATE_9M_INDEX,
|
||||
IWL_RATE_12M_INDEX,
|
||||
IWL_RATE_MCS_1_INDEX = IWL_RATE_12M_INDEX,
|
||||
IWL_RATE_18M_INDEX,
|
||||
IWL_RATE_MCS_2_INDEX = IWL_RATE_18M_INDEX,
|
||||
IWL_RATE_24M_INDEX,
|
||||
IWL_RATE_MCS_3_INDEX = IWL_RATE_24M_INDEX,
|
||||
IWL_RATE_36M_INDEX,
|
||||
IWL_RATE_MCS_4_INDEX = IWL_RATE_36M_INDEX,
|
||||
IWL_RATE_48M_INDEX,
|
||||
IWL_RATE_MCS_5_INDEX = IWL_RATE_48M_INDEX,
|
||||
IWL_RATE_54M_INDEX,
|
||||
IWL_RATE_MCS_6_INDEX = IWL_RATE_54M_INDEX,
|
||||
IWL_LAST_NON_HT_RATE = IWL_RATE_54M_INDEX,
|
||||
IWL_RATE_60M_INDEX,
|
||||
IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX,
|
||||
IWL_RATE_MCS_7_INDEX = IWL_RATE_60M_INDEX,
|
||||
IWL_LAST_HT_RATE = IWL_RATE_MCS_7_INDEX,
|
||||
IWL_RATE_MCS_8_INDEX,
|
||||
IWL_RATE_MCS_9_INDEX,
|
||||
IWL_LAST_VHT_RATE = IWL_RATE_MCS_9_INDEX,
|
||||
IWL_RATE_COUNT_LEGACY = IWL_LAST_NON_HT_RATE + 1,
|
||||
IWL_RATE_COUNT,
|
||||
IWL_RATE_COUNT = IWL_LAST_VHT_RATE + 1,
|
||||
};
|
||||
|
||||
#define IWL_RATE_BIT_MSK(r) BIT(IWL_RATE_##r##M_INDEX)
|
||||
@ -108,6 +122,7 @@ enum {
|
||||
IWL_RATE_2M_PLCP = 20,
|
||||
IWL_RATE_5M_PLCP = 55,
|
||||
IWL_RATE_11M_PLCP = 110,
|
||||
IWL_RATE_INVM_PLCP = -1,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -164,6 +179,8 @@ enum {
|
||||
* which is the duplicate 20 MHz MCS (bit 5 set, all others zero.)
|
||||
*/
|
||||
#define RATE_HT_MCS_RATE_CODE_MSK 0x7
|
||||
#define RATE_HT_MCS_NSS_POS 3
|
||||
#define RATE_HT_MCS_NSS_MSK (3 << RATE_HT_MCS_NSS_POS)
|
||||
|
||||
/* Bit 10: (1) Use Green Field preamble */
|
||||
#define RATE_HT_MCS_GF_POS 10
|
||||
|
@ -356,6 +356,7 @@ struct iwl_scan_complete_notif {
|
||||
/* scan offload */
|
||||
#define IWL_MAX_SCAN_CHANNELS 40
|
||||
#define IWL_SCAN_MAX_BLACKLIST_LEN 64
|
||||
#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
|
||||
#define IWL_SCAN_MAX_PROFILES 11
|
||||
#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
|
||||
|
||||
@ -368,6 +369,12 @@ struct iwl_scan_complete_notif {
|
||||
#define IWL_FULL_SCAN_MULTIPLIER 5
|
||||
#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
|
||||
|
||||
enum scan_framework_client {
|
||||
SCAN_CLIENT_SCHED_SCAN = BIT(0),
|
||||
SCAN_CLIENT_NETDETECT = BIT(1),
|
||||
SCAN_CLIENT_ASSET_TRACKING = BIT(2),
|
||||
};
|
||||
|
||||
/**
|
||||
* struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
|
||||
* @scan_flags: see enum iwl_scan_flags
|
||||
@ -449,11 +456,12 @@ struct iwl_scan_offload_cfg {
|
||||
* iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
|
||||
* @ssid: MAC address to filter out
|
||||
* @reported_rssi: AP rssi reported to the host
|
||||
* @client_bitmap: clients ignore this entry - enum scan_framework_client
|
||||
*/
|
||||
struct iwl_scan_offload_blacklist {
|
||||
u8 ssid[ETH_ALEN];
|
||||
u8 reported_rssi;
|
||||
u8 reserved;
|
||||
u8 client_bitmap;
|
||||
} __packed;
|
||||
|
||||
enum iwl_scan_offload_network_type {
|
||||
@ -475,6 +483,7 @@ enum iwl_scan_offload_band_selection {
|
||||
* @aut_alg: authentication olgorithm to match - bitmap
|
||||
* @network_type: enum iwl_scan_offload_network_type
|
||||
* @band_selection: enum iwl_scan_offload_band_selection
|
||||
* @client_bitmap: clients waiting for match - enum scan_framework_client
|
||||
*/
|
||||
struct iwl_scan_offload_profile {
|
||||
u8 ssid_index;
|
||||
@ -482,7 +491,8 @@ struct iwl_scan_offload_profile {
|
||||
u8 auth_alg;
|
||||
u8 network_type;
|
||||
u8 band_selection;
|
||||
u8 reserved[3];
|
||||
u8 client_bitmap;
|
||||
u8 reserved[2];
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
@ -491,13 +501,18 @@ struct iwl_scan_offload_profile {
|
||||
* @profiles: profiles to search for match
|
||||
* @blacklist_len: length of blacklist
|
||||
* @num_profiles: num of profiles in the list
|
||||
* @match_notify: clients waiting for match found notification
|
||||
* @pass_match: clients waiting for the results
|
||||
* @active_clients: active clients bitmap - enum scan_framework_client
|
||||
*/
|
||||
struct iwl_scan_offload_profile_cfg {
|
||||
struct iwl_scan_offload_blacklist blacklist[IWL_SCAN_MAX_BLACKLIST_LEN];
|
||||
struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
|
||||
u8 blacklist_len;
|
||||
u8 num_profiles;
|
||||
u8 reserved[2];
|
||||
u8 match_notify;
|
||||
u8 pass_match;
|
||||
u8 active_clients;
|
||||
u8 reserved[3];
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
@ -560,4 +575,15 @@ struct iwl_scan_offload_complete {
|
||||
u8 reserved;
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
* iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
|
||||
* @ssid_bitmap: SSIDs indexes found in this iteration
|
||||
* @client_bitmap: clients that are active and wait for this notification
|
||||
*/
|
||||
struct iwl_sched_scan_results {
|
||||
__le16 ssid_bitmap;
|
||||
u8 client_bitmap;
|
||||
u8 reserved;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -247,7 +247,7 @@ struct iwl_mvm_keyinfo {
|
||||
} __packed;
|
||||
|
||||
/**
|
||||
* struct iwl_mvm_add_sta_cmd - Add / modify a station in the fw's station table
|
||||
* struct iwl_mvm_add_sta_cmd_v5 - Add/modify a station in the fw's sta table.
|
||||
* ( REPLY_ADD_STA = 0x18 )
|
||||
* @add_modify: 1: modify existing, 0: add new station
|
||||
* @unicast_tx_key_id: unicast tx key id. Relevant only when unicast key sent
|
||||
@ -286,7 +286,7 @@ struct iwl_mvm_keyinfo {
|
||||
* ADD_STA sets up the table entry for one station, either creating a new
|
||||
* entry, or modifying a pre-existing one.
|
||||
*/
|
||||
struct iwl_mvm_add_sta_cmd {
|
||||
struct iwl_mvm_add_sta_cmd_v5 {
|
||||
u8 add_modify;
|
||||
u8 unicast_tx_key_id;
|
||||
u8 multicast_tx_key_id;
|
||||
@ -312,6 +312,57 @@ struct iwl_mvm_add_sta_cmd {
|
||||
__le32 tfd_queue_msk;
|
||||
} __packed; /* ADD_STA_CMD_API_S_VER_5 */
|
||||
|
||||
/**
|
||||
* struct iwl_mvm_add_sta_cmd_v6 - Add / modify a station
|
||||
* VER_6 of this command is quite similar to VER_5 except
|
||||
* exclusion of all fields related to the security key installation.
|
||||
*/
|
||||
struct iwl_mvm_add_sta_cmd_v6 {
|
||||
u8 add_modify;
|
||||
u8 reserved1;
|
||||
__le16 tid_disable_tx;
|
||||
__le32 mac_id_n_color;
|
||||
u8 addr[ETH_ALEN]; /* _STA_ID_MODIFY_INFO_API_S_VER_1 */
|
||||
__le16 reserved2;
|
||||
u8 sta_id;
|
||||
u8 modify_mask;
|
||||
__le16 reserved3;
|
||||
__le32 station_flags;
|
||||
__le32 station_flags_msk;
|
||||
u8 add_immediate_ba_tid;
|
||||
u8 remove_immediate_ba_tid;
|
||||
__le16 add_immediate_ba_ssn;
|
||||
__le16 sleep_tx_count;
|
||||
__le16 sleep_state_flags;
|
||||
__le16 assoc_id;
|
||||
__le16 beamform_flags;
|
||||
__le32 tfd_queue_msk;
|
||||
} __packed; /* ADD_STA_CMD_API_S_VER_6 */
|
||||
|
||||
/**
|
||||
* struct iwl_mvm_add_sta_key_cmd - add/modify sta key
|
||||
* ( REPLY_ADD_STA_KEY = 0x17 )
|
||||
* @sta_id: index of station in uCode's station table
|
||||
* @key_offset: key offset in key storage
|
||||
* @key_flags: type %iwl_sta_key_flag
|
||||
* @key: key material data
|
||||
* @key2: key material data
|
||||
* @rx_secur_seq_cnt: RX security sequence counter for the key
|
||||
* @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
|
||||
* @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
|
||||
*/
|
||||
struct iwl_mvm_add_sta_key_cmd {
|
||||
u8 sta_id;
|
||||
u8 key_offset;
|
||||
__le16 key_flags;
|
||||
u8 key[16];
|
||||
u8 key2[16];
|
||||
u8 rx_secur_seq_cnt[16];
|
||||
u8 tkip_rx_tsc_byte2;
|
||||
u8 reserved;
|
||||
__le16 tkip_rx_ttak[5];
|
||||
} __packed; /* ADD_MODIFY_STA_KEY_API_S_VER_1 */
|
||||
|
||||
/**
|
||||
* enum iwl_mvm_add_sta_rsp_status - status in the response to ADD_STA command
|
||||
* @ADD_STA_SUCCESS: operation was executed successfully
|
||||
|
@ -72,17 +72,17 @@
|
||||
#include "fw-api-d3.h"
|
||||
#include "fw-api-bt-coex.h"
|
||||
|
||||
/* queue and FIFO numbers by usage */
|
||||
/* maximal number of Tx queues in any platform */
|
||||
#define IWL_MVM_MAX_QUEUES 20
|
||||
|
||||
/* Tx queue numbers */
|
||||
enum {
|
||||
IWL_MVM_OFFCHANNEL_QUEUE = 8,
|
||||
IWL_MVM_CMD_QUEUE = 9,
|
||||
IWL_MVM_AUX_QUEUE = 15,
|
||||
IWL_MVM_FIRST_AGG_QUEUE = 16,
|
||||
IWL_MVM_NUM_QUEUES = 20,
|
||||
IWL_MVM_LAST_AGG_QUEUE = IWL_MVM_NUM_QUEUES - 1,
|
||||
IWL_MVM_CMD_FIFO = 7
|
||||
};
|
||||
|
||||
#define IWL_MVM_CMD_FIFO 7
|
||||
|
||||
#define IWL_MVM_STATION_COUNT 16
|
||||
|
||||
/* commands */
|
||||
@ -97,6 +97,7 @@ enum {
|
||||
DBG_CFG = 0x9,
|
||||
|
||||
/* station table */
|
||||
ADD_STA_KEY = 0x17,
|
||||
ADD_STA = 0x18,
|
||||
REMOVE_STA = 0x19,
|
||||
|
||||
@ -114,6 +115,7 @@ enum {
|
||||
TIME_EVENT_NOTIFICATION = 0x2a,
|
||||
BINDING_CONTEXT_CMD = 0x2b,
|
||||
TIME_QUOTA_CMD = 0x2c,
|
||||
NON_QOS_TX_COUNTER_CMD = 0x2d,
|
||||
|
||||
LQ_CMD = 0x4e,
|
||||
|
||||
@ -130,6 +132,7 @@ enum {
|
||||
SCAN_OFFLOAD_COMPLETE = 0x6D,
|
||||
SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
|
||||
SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
|
||||
MATCH_FOUND_NOTIFICATION = 0xd9,
|
||||
|
||||
/* Phy */
|
||||
PHY_CONFIGURATION_CMD = 0x6a,
|
||||
@ -178,6 +181,7 @@ enum {
|
||||
BT_COEX_PRIO_TABLE = 0xcc,
|
||||
BT_COEX_PROT_ENV = 0xcd,
|
||||
BT_PROFILE_NOTIFICATION = 0xce,
|
||||
BT_COEX_CI = 0x5d,
|
||||
|
||||
REPLY_BEACON_FILTERING_CMD = 0xd2,
|
||||
|
||||
|
@ -199,7 +199,7 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
|
||||
*/
|
||||
|
||||
for (i = 0; i < IWL_MAX_HW_QUEUES; i++) {
|
||||
if (i < IWL_MVM_FIRST_AGG_QUEUE && i != IWL_MVM_CMD_QUEUE)
|
||||
if (i < mvm->first_agg_queue && i != IWL_MVM_CMD_QUEUE)
|
||||
mvm->queue_to_mac80211[i] = i;
|
||||
else
|
||||
mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
|
||||
@ -243,7 +243,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
|
||||
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
|
||||
if (mvm->init_ucode_run)
|
||||
if (mvm->init_ucode_complete)
|
||||
return 0;
|
||||
|
||||
iwl_init_notification_wait(&mvm->notif_wait,
|
||||
@ -264,6 +264,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
/* Read the NVM only at driver load time, no need to do this twice */
|
||||
if (read_nvm) {
|
||||
/* Read nvm */
|
||||
ret = iwl_nvm_init(mvm);
|
||||
@ -273,6 +274,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
|
||||
}
|
||||
}
|
||||
|
||||
/* In case we read the NVM from external file, load it to the NIC */
|
||||
if (iwlwifi_mod_params.nvm_file)
|
||||
iwl_mvm_load_nvm_to_nic(mvm);
|
||||
|
||||
ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
|
||||
WARN_ON(ret);
|
||||
|
||||
@ -310,7 +315,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
|
||||
ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
|
||||
MVM_UCODE_CALIB_TIMEOUT);
|
||||
if (!ret)
|
||||
mvm->init_ucode_run = true;
|
||||
mvm->init_ucode_complete = true;
|
||||
goto out;
|
||||
|
||||
error:
|
||||
@ -353,8 +358,12 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* If we were in RFKILL during module loading, load init ucode now */
|
||||
if (!mvm->init_ucode_run) {
|
||||
/*
|
||||
* If we haven't completed the run of the init ucode during
|
||||
* module loading, load init ucode now
|
||||
* (for example, if we were in RFKILL)
|
||||
*/
|
||||
if (!mvm->init_ucode_complete) {
|
||||
ret = iwl_run_init_mvm_ucode(mvm, false);
|
||||
if (ret && !iwlmvm_mod_params.init_dbg) {
|
||||
IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
|
||||
@ -424,6 +433,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = iwl_mvm_power_update_device_mode(mvm);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
|
||||
return 0;
|
||||
error:
|
||||
|
@ -80,7 +80,7 @@ struct iwl_mvm_mac_iface_iterator_data {
|
||||
struct ieee80211_vif *vif;
|
||||
unsigned long available_mac_ids[BITS_TO_LONGS(NUM_MAC_INDEX_DRIVER)];
|
||||
unsigned long available_tsf_ids[BITS_TO_LONGS(NUM_TSF_IDS)];
|
||||
unsigned long used_hw_queues[BITS_TO_LONGS(IWL_MVM_FIRST_AGG_QUEUE)];
|
||||
unsigned long used_hw_queues[BITS_TO_LONGS(IWL_MVM_MAX_QUEUES)];
|
||||
enum iwl_tsf_id preferred_tsf;
|
||||
bool found_vif;
|
||||
};
|
||||
@ -218,7 +218,7 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm,
|
||||
.preferred_tsf = NUM_TSF_IDS,
|
||||
.used_hw_queues = {
|
||||
BIT(IWL_MVM_OFFCHANNEL_QUEUE) |
|
||||
BIT(IWL_MVM_AUX_QUEUE) |
|
||||
BIT(mvm->aux_queue) |
|
||||
BIT(IWL_MVM_CMD_QUEUE)
|
||||
},
|
||||
.found_vif = false,
|
||||
@ -242,9 +242,17 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm,
|
||||
* that we should share it with another interface.
|
||||
*/
|
||||
|
||||
/* Currently, MAC ID 0 should be used only for the managed vif */
|
||||
if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
|
||||
/* Currently, MAC ID 0 should be used only for the managed/IBSS vif */
|
||||
switch (vif->type) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
break;
|
||||
case NL80211_IFTYPE_STATION:
|
||||
if (!vif->p2p)
|
||||
break;
|
||||
/* fall through */
|
||||
default:
|
||||
__clear_bit(0, data.available_mac_ids);
|
||||
}
|
||||
|
||||
ieee80211_iterate_active_interfaces_atomic(
|
||||
mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
|
||||
@ -302,9 +310,9 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm,
|
||||
/* Find available queues, and allocate them to the ACs */
|
||||
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
|
||||
u8 queue = find_first_zero_bit(data.used_hw_queues,
|
||||
IWL_MVM_FIRST_AGG_QUEUE);
|
||||
mvm->first_agg_queue);
|
||||
|
||||
if (queue >= IWL_MVM_FIRST_AGG_QUEUE) {
|
||||
if (queue >= mvm->first_agg_queue) {
|
||||
IWL_ERR(mvm, "Failed to allocate queue\n");
|
||||
ret = -EIO;
|
||||
goto exit_fail;
|
||||
@ -317,9 +325,9 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm,
|
||||
/* Allocate the CAB queue for softAP and GO interfaces */
|
||||
if (vif->type == NL80211_IFTYPE_AP) {
|
||||
u8 queue = find_first_zero_bit(data.used_hw_queues,
|
||||
IWL_MVM_FIRST_AGG_QUEUE);
|
||||
mvm->first_agg_queue);
|
||||
|
||||
if (queue >= IWL_MVM_FIRST_AGG_QUEUE) {
|
||||
if (queue >= mvm->first_agg_queue) {
|
||||
IWL_ERR(mvm, "Failed to allocate cab queue\n");
|
||||
ret = -EIO;
|
||||
goto exit_fail;
|
||||
@ -559,8 +567,12 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
|
||||
cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
|
||||
|
||||
/* Don't use cts to self as the fw doesn't support it currently. */
|
||||
if (vif->bss_conf.use_cts_prot)
|
||||
if (vif->bss_conf.use_cts_prot) {
|
||||
cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT);
|
||||
if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
|
||||
cmd->protection_flags |=
|
||||
cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN);
|
||||
}
|
||||
|
||||
/*
|
||||
* I think that we should enable these 2 flags regardless the HT PROT
|
||||
@ -712,6 +724,31 @@ static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,
|
||||
return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
|
||||
}
|
||||
|
||||
static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
u32 action)
|
||||
{
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
struct iwl_mac_ctx_cmd cmd = {};
|
||||
|
||||
WARN_ON(vif->type != NL80211_IFTYPE_ADHOC);
|
||||
|
||||
iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
|
||||
|
||||
cmd.filter_flags = cpu_to_le32(MAC_FILTER_IN_BEACON |
|
||||
MAC_FILTER_IN_PROBE_REQUEST);
|
||||
|
||||
/* cmd.ibss.beacon_time/cmd.ibss.beacon_tsf are curently ignored */
|
||||
cmd.ibss.bi = cpu_to_le32(vif->bss_conf.beacon_int);
|
||||
cmd.ibss.bi_reciprocal =
|
||||
cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int));
|
||||
|
||||
/* TODO: Assumes that the beacon id == mac context id */
|
||||
cmd.ibss.beacon_template = cpu_to_le32(mvmvif->id);
|
||||
|
||||
return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
|
||||
}
|
||||
|
||||
struct iwl_mvm_go_iterator_data {
|
||||
bool go_active;
|
||||
};
|
||||
@ -721,7 +758,8 @@ static void iwl_mvm_go_iterator(void *_data, u8 *mac, struct ieee80211_vif *vif)
|
||||
struct iwl_mvm_go_iterator_data *data = _data;
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_AP && vif->p2p && mvmvif->ap_active)
|
||||
if (vif->type == NL80211_IFTYPE_AP && vif->p2p &&
|
||||
mvmvif->ap_ibss_active)
|
||||
data->go_active = true;
|
||||
}
|
||||
|
||||
@ -833,9 +871,10 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
|
||||
cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate));
|
||||
|
||||
/* Set up TX beacon command fields */
|
||||
iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd,
|
||||
beacon->data,
|
||||
beacon_skb_len);
|
||||
if (vif->type == NL80211_IFTYPE_AP)
|
||||
iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd,
|
||||
beacon->data,
|
||||
beacon_skb_len);
|
||||
|
||||
/* Submit command */
|
||||
cmd.len[0] = sizeof(beacon_cmd);
|
||||
@ -848,14 +887,15 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
|
||||
return iwl_mvm_send_cmd(mvm, &cmd);
|
||||
}
|
||||
|
||||
/* The beacon template for the AP/GO context has changed and needs update */
|
||||
/* The beacon template for the AP/GO/IBSS has changed and needs update */
|
||||
int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
struct sk_buff *beacon;
|
||||
int ret;
|
||||
|
||||
WARN_ON(vif->type != NL80211_IFTYPE_AP);
|
||||
WARN_ON(vif->type != NL80211_IFTYPE_AP &&
|
||||
vif->type != NL80211_IFTYPE_ADHOC);
|
||||
|
||||
beacon = ieee80211_beacon_get(mvm->hw, vif);
|
||||
if (!beacon)
|
||||
@ -1018,6 +1058,8 @@ static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action);
|
||||
case NL80211_IFTYPE_P2P_DEVICE:
|
||||
return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action);
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
return iwl_mvm_mac_ctxt_cmd_ibss(mvm, vif, action);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1038,6 +1080,9 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* will only do anything at resume from D3 time */
|
||||
iwl_mvm_set_last_nonqos_seq(mvm, vif);
|
||||
|
||||
mvmvif->uploaded = true;
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,6 +77,7 @@
|
||||
#include "iwl-eeprom-parse.h"
|
||||
#include "fw-api-scan.h"
|
||||
#include "iwl-phy-db.h"
|
||||
#include "testmode.h"
|
||||
|
||||
static const struct ieee80211_iface_limit iwl_mvm_limits[] = {
|
||||
{
|
||||
@ -138,6 +139,14 @@ static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm *mvm)
|
||||
}
|
||||
}
|
||||
|
||||
static int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm)
|
||||
{
|
||||
/* we create the 802.11 header and SSID element */
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID)
|
||||
return mvm->fw->ucode_capa.max_probe_length - 24 - 2;
|
||||
return mvm->fw->ucode_capa.max_probe_length - 24 - 34;
|
||||
}
|
||||
|
||||
int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
|
||||
{
|
||||
struct ieee80211_hw *hw = mvm->hw;
|
||||
@ -158,7 +167,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
|
||||
IEEE80211_HW_SUPPORTS_STATIC_SMPS |
|
||||
IEEE80211_HW_SUPPORTS_UAPSD;
|
||||
|
||||
hw->queues = IWL_MVM_FIRST_AGG_QUEUE;
|
||||
hw->queues = mvm->first_agg_queue;
|
||||
hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
|
||||
hw->rate_control_algorithm = "iwl-mvm-rs";
|
||||
|
||||
@ -181,6 +190,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
|
||||
BIT(NL80211_IFTYPE_P2P_GO) |
|
||||
BIT(NL80211_IFTYPE_P2P_DEVICE);
|
||||
|
||||
/* IBSS has bugs in older versions */
|
||||
if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
|
||||
hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
|
||||
|
||||
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
|
||||
WIPHY_FLAG_DISABLE_BEACON_HINTS |
|
||||
WIPHY_FLAG_IBSS_RSN;
|
||||
@ -212,9 +225,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
|
||||
|
||||
iwl_mvm_reset_phy_ctxts(mvm);
|
||||
|
||||
/* we create the 802.11 header and a max-length SSID element */
|
||||
hw->wiphy->max_scan_ie_len =
|
||||
mvm->fw->ucode_capa.max_probe_length - 24 - 34;
|
||||
hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm);
|
||||
|
||||
hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
|
||||
|
||||
if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
|
||||
@ -231,6 +243,15 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
|
||||
else
|
||||
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SCHED_SCAN) {
|
||||
hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
|
||||
hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX;
|
||||
hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES;
|
||||
/* we create the 802.11 header and zero length SSID IE. */
|
||||
hw->wiphy->max_sched_scan_ie_len =
|
||||
SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2;
|
||||
}
|
||||
|
||||
hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
|
||||
NL80211_FEATURE_P2P_GO_OPPPS;
|
||||
|
||||
@ -548,7 +569,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
|
||||
* In short: there's not much we can do at this point, other than
|
||||
* allocating resources :)
|
||||
*/
|
||||
if (vif->type == NL80211_IFTYPE_AP) {
|
||||
if (vif->type == NL80211_IFTYPE_AP ||
|
||||
vif->type == NL80211_IFTYPE_ADHOC) {
|
||||
u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
|
||||
ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta,
|
||||
qmask);
|
||||
@ -698,7 +720,14 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
|
||||
* For AP/GO interface, the tear down of the resources allocated to the
|
||||
* interface is be handled as part of the stop_ap flow.
|
||||
*/
|
||||
if (vif->type == NL80211_IFTYPE_AP) {
|
||||
if (vif->type == NL80211_IFTYPE_AP ||
|
||||
vif->type == NL80211_IFTYPE_ADHOC) {
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
if (vif == mvm->noa_vif) {
|
||||
mvm->noa_vif = NULL;
|
||||
mvm->noa_duration = 0;
|
||||
}
|
||||
#endif
|
||||
iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta);
|
||||
goto out_release;
|
||||
}
|
||||
@ -796,6 +825,27 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
|
||||
return;
|
||||
}
|
||||
iwl_mvm_configure_mcast_filter(mvm, vif);
|
||||
|
||||
if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART,
|
||||
&mvm->status)) {
|
||||
/*
|
||||
* If we're restarting then the firmware will
|
||||
* obviously have lost synchronisation with
|
||||
* the AP. It will attempt to synchronise by
|
||||
* itself, but we can make it more reliable by
|
||||
* scheduling a session protection time event.
|
||||
*
|
||||
* The firmware needs to receive a beacon to
|
||||
* catch up with synchronisation, use 110% of
|
||||
* the beacon interval.
|
||||
*
|
||||
* Set a large maximum delay to allow for more
|
||||
* than a single interface.
|
||||
*/
|
||||
u32 dur = (11 * vif->bss_conf.beacon_int) / 10;
|
||||
iwl_mvm_protect_session(mvm, vif, dur, dur,
|
||||
5 * dur);
|
||||
}
|
||||
} else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
|
||||
/* remove AP station now that the MAC is unassoc */
|
||||
ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
|
||||
@ -819,7 +869,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
|
||||
if (ret)
|
||||
IWL_ERR(mvm, "failed to update power mode\n");
|
||||
}
|
||||
iwl_mvm_bt_coex_vif_assoc(mvm, vif);
|
||||
iwl_mvm_bt_coex_vif_change(mvm);
|
||||
} else if (changes & BSS_CHANGED_BEACON_INFO) {
|
||||
/*
|
||||
* We received a beacon _after_ association so
|
||||
@ -848,7 +898,8 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
|
||||
}
|
||||
}
|
||||
|
||||
static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
@ -871,7 +922,7 @@ static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
if (ret)
|
||||
goto out_remove;
|
||||
|
||||
mvmvif->ap_active = true;
|
||||
mvmvif->ap_ibss_active = true;
|
||||
|
||||
/* Send the bcast station. At this stage the TBTT and DTIM time events
|
||||
* are added and applied to the scheduler */
|
||||
@ -883,10 +934,12 @@ static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
if (ret)
|
||||
goto out_rm_bcast;
|
||||
|
||||
/* Need to update the P2P Device MAC */
|
||||
/* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
|
||||
if (vif->p2p && mvm->p2p_device_vif)
|
||||
iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
|
||||
|
||||
iwl_mvm_bt_coex_vif_change(mvm);
|
||||
|
||||
mutex_unlock(&mvm->mutex);
|
||||
return 0;
|
||||
|
||||
@ -901,7 +954,8 @@ out_unlock:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
@ -910,9 +964,11 @@ static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
|
||||
mvmvif->ap_active = false;
|
||||
mvmvif->ap_ibss_active = false;
|
||||
|
||||
/* Need to update the P2P Device MAC */
|
||||
iwl_mvm_bt_coex_vif_change(mvm);
|
||||
|
||||
/* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
|
||||
if (vif->p2p && mvm->p2p_device_vif)
|
||||
iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
|
||||
|
||||
@ -924,10 +980,11 @@ static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
mutex_unlock(&mvm->mutex);
|
||||
}
|
||||
|
||||
static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *bss_conf,
|
||||
u32 changes)
|
||||
static void
|
||||
iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *bss_conf,
|
||||
u32 changes)
|
||||
{
|
||||
/* Need to send a new beacon template to the FW */
|
||||
if (changes & BSS_CHANGED_BEACON) {
|
||||
@ -950,7 +1007,8 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
|
||||
iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
|
||||
break;
|
||||
case NL80211_IFTYPE_AP:
|
||||
iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes);
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
iwl_mvm_bss_info_changed_ap_ibss(mvm, vif, bss_conf, changes);
|
||||
break;
|
||||
default:
|
||||
/* shouldn't happen */
|
||||
@ -1163,7 +1221,54 @@ static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
/* Try really hard to protect the session and hear a beacon */
|
||||
iwl_mvm_protect_session(mvm, vif, duration, min_duration);
|
||||
iwl_mvm_protect_session(mvm, vif, duration, min_duration, 500);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
}
|
||||
|
||||
static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
struct ieee80211_sched_scan_ies *ies)
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
|
||||
if (mvm->scan_status != IWL_MVM_SCAN_NONE) {
|
||||
IWL_DEBUG_SCAN(mvm,
|
||||
"SCHED SCAN request during internal scan - abort\n");
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
mvm->scan_status = IWL_MVM_SCAN_SCHED;
|
||||
|
||||
ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = iwl_mvm_sched_scan_start(mvm, req);
|
||||
if (!ret)
|
||||
goto out;
|
||||
err:
|
||||
mvm->scan_status = IWL_MVM_SCAN_NONE;
|
||||
out:
|
||||
mutex_unlock(&mvm->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
iwl_mvm_sched_scan_stop(mvm);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
}
|
||||
|
||||
@ -1207,8 +1312,13 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
|
||||
|
||||
switch (cmd) {
|
||||
case SET_KEY:
|
||||
if (vif->type == NL80211_IFTYPE_AP && !sta) {
|
||||
/* GTK on AP interface is a TX-only key, return 0 */
|
||||
if ((vif->type == NL80211_IFTYPE_ADHOC ||
|
||||
vif->type == NL80211_IFTYPE_AP) && !sta) {
|
||||
/*
|
||||
* GTK on AP interface is a TX-only key, return 0;
|
||||
* on IBSS they're per-station and because we're lazy
|
||||
* we don't support them for RX, so do the same.
|
||||
*/
|
||||
ret = 0;
|
||||
key->hw_key_idx = STA_KEY_IDX_INVALID;
|
||||
break;
|
||||
@ -1252,6 +1362,9 @@ static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
|
||||
if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID)
|
||||
return;
|
||||
|
||||
iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key);
|
||||
}
|
||||
|
||||
@ -1445,6 +1558,7 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
|
||||
iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
|
||||
ctx->rx_chains_static,
|
||||
ctx->rx_chains_dynamic);
|
||||
iwl_mvm_bt_coex_vif_change(mvm);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
}
|
||||
|
||||
@ -1464,14 +1578,14 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
|
||||
|
||||
switch (vif->type) {
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
/*
|
||||
* The AP binding flow is handled as part of the start_ap flow
|
||||
* (in bss_info_changed).
|
||||
* (in bss_info_changed), similarly for IBSS.
|
||||
*/
|
||||
ret = 0;
|
||||
goto out_unlock;
|
||||
case NL80211_IFTYPE_STATION:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
break;
|
||||
default:
|
||||
@ -1517,10 +1631,10 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
|
||||
|
||||
iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data);
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_AP)
|
||||
goto out_unlock;
|
||||
|
||||
switch (vif->type) {
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
goto out_unlock;
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
mvmvif->monitor_active = false;
|
||||
iwl_mvm_update_quotas(mvm, NULL);
|
||||
@ -1550,14 +1664,72 @@ static int iwl_mvm_set_tim(struct ieee80211_hw *hw,
|
||||
return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif);
|
||||
}
|
||||
|
||||
static void iwl_mvm_mac_rssi_callback(struct ieee80211_hw *hw,
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
static const struct nla_policy iwl_mvm_tm_policy[IWL_MVM_TM_ATTR_MAX + 1] = {
|
||||
[IWL_MVM_TM_ATTR_CMD] = { .type = NLA_U32 },
|
||||
[IWL_MVM_TM_ATTR_NOA_DURATION] = { .type = NLA_U32 },
|
||||
[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE] = { .type = NLA_U32 },
|
||||
};
|
||||
|
||||
static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
enum ieee80211_rssi_event rssi_event)
|
||||
void *data, int len)
|
||||
{
|
||||
struct nlattr *tb[IWL_MVM_TM_ATTR_MAX + 1];
|
||||
int err;
|
||||
u32 noa_duration;
|
||||
|
||||
err = nla_parse(tb, IWL_MVM_TM_ATTR_MAX, data, len, iwl_mvm_tm_policy);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!tb[IWL_MVM_TM_ATTR_CMD])
|
||||
return -EINVAL;
|
||||
|
||||
switch (nla_get_u32(tb[IWL_MVM_TM_ATTR_CMD])) {
|
||||
case IWL_MVM_TM_CMD_SET_NOA:
|
||||
if (!vif || vif->type != NL80211_IFTYPE_AP || !vif->p2p ||
|
||||
!vif->bss_conf.enable_beacon ||
|
||||
!tb[IWL_MVM_TM_ATTR_NOA_DURATION])
|
||||
return -EINVAL;
|
||||
|
||||
noa_duration = nla_get_u32(tb[IWL_MVM_TM_ATTR_NOA_DURATION]);
|
||||
if (noa_duration >= vif->bss_conf.beacon_int)
|
||||
return -EINVAL;
|
||||
|
||||
mvm->noa_duration = noa_duration;
|
||||
mvm->noa_vif = vif;
|
||||
|
||||
return iwl_mvm_update_quotas(mvm, NULL);
|
||||
case IWL_MVM_TM_CMD_SET_BEACON_FILTER:
|
||||
/* must be associated client vif - ignore authorized */
|
||||
if (!vif || vif->type != NL80211_IFTYPE_STATION ||
|
||||
!vif->bss_conf.assoc || !vif->bss_conf.dtim_period ||
|
||||
!tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])
|
||||
return -EINVAL;
|
||||
|
||||
if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE]))
|
||||
return iwl_mvm_enable_beacon_filter(mvm, vif);
|
||||
return iwl_mvm_disable_beacon_filter(mvm, vif);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
void *data, int len)
|
||||
{
|
||||
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
|
||||
int err;
|
||||
|
||||
iwl_mvm_bt_rssi_event(mvm, vif, rssi_event);
|
||||
mutex_lock(&mvm->mutex);
|
||||
err = __iwl_mvm_mac_testmode_cmd(mvm, vif, data, len);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ieee80211_ops iwl_mvm_hw_ops = {
|
||||
.tx = iwl_mvm_mac_tx,
|
||||
@ -1578,23 +1750,27 @@ struct ieee80211_ops iwl_mvm_hw_ops = {
|
||||
.set_rts_threshold = iwl_mvm_mac_set_rts_threshold,
|
||||
.conf_tx = iwl_mvm_mac_conf_tx,
|
||||
.mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx,
|
||||
.sched_scan_start = iwl_mvm_mac_sched_scan_start,
|
||||
.sched_scan_stop = iwl_mvm_mac_sched_scan_stop,
|
||||
.set_key = iwl_mvm_mac_set_key,
|
||||
.update_tkip_key = iwl_mvm_mac_update_tkip_key,
|
||||
.remain_on_channel = iwl_mvm_roc,
|
||||
.cancel_remain_on_channel = iwl_mvm_cancel_roc,
|
||||
.rssi_callback = iwl_mvm_mac_rssi_callback,
|
||||
|
||||
.add_chanctx = iwl_mvm_add_chanctx,
|
||||
.remove_chanctx = iwl_mvm_remove_chanctx,
|
||||
.change_chanctx = iwl_mvm_change_chanctx,
|
||||
.assign_vif_chanctx = iwl_mvm_assign_vif_chanctx,
|
||||
.unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx,
|
||||
|
||||
.start_ap = iwl_mvm_start_ap,
|
||||
.stop_ap = iwl_mvm_stop_ap,
|
||||
.start_ap = iwl_mvm_start_ap_ibss,
|
||||
.stop_ap = iwl_mvm_stop_ap_ibss,
|
||||
.join_ibss = iwl_mvm_start_ap_ibss,
|
||||
.leave_ibss = iwl_mvm_stop_ap_ibss,
|
||||
|
||||
.set_tim = iwl_mvm_set_tim,
|
||||
|
||||
CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd)
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
/* look at d3.c */
|
||||
.suspend = iwl_mvm_suspend,
|
||||
|
@ -162,6 +162,7 @@ enum iwl_power_scheme {
|
||||
struct iwl_mvm_power_ops {
|
||||
int (*power_update_mode)(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif);
|
||||
int (*power_update_device_mode)(struct iwl_mvm *mvm);
|
||||
int (*power_disable)(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
int (*power_dbgfs_read)(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
@ -241,12 +242,18 @@ enum iwl_mvm_smps_type_request {
|
||||
* @last_beacon_signal: last beacon rssi signal in dbm
|
||||
* @ave_beacon_signal: average beacon signal
|
||||
* @last_cqm_event: rssi of the last cqm event
|
||||
* @bt_coex_min_thold: minimum threshold for BT coex
|
||||
* @bt_coex_max_thold: maximum threshold for BT coex
|
||||
* @last_bt_coex_event: rssi of the last BT coex event
|
||||
*/
|
||||
struct iwl_mvm_vif_bf_data {
|
||||
bool bf_enabled;
|
||||
bool ba_enabled;
|
||||
s8 ave_beacon_signal;
|
||||
s8 last_cqm_event;
|
||||
s8 bt_coex_min_thold;
|
||||
s8 bt_coex_max_thold;
|
||||
s8 last_bt_coex_event;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -255,8 +262,8 @@ struct iwl_mvm_vif_bf_data {
|
||||
* @color: to solve races upon MAC addition and removal
|
||||
* @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA
|
||||
* @uploaded: indicates the MAC context has been added to the device
|
||||
* @ap_active: indicates that ap context is configured, and that the interface
|
||||
* should get quota etc.
|
||||
* @ap_ibss_active: indicates that AP/IBSS is configured and that the interface
|
||||
* should get quota etc.
|
||||
* @monitor_active: indicates that monitor context is configured, and that the
|
||||
* interface should get quota etc.
|
||||
* @queue_params: QoS params for this MAC
|
||||
@ -272,7 +279,7 @@ struct iwl_mvm_vif {
|
||||
u8 ap_sta_id;
|
||||
|
||||
bool uploaded;
|
||||
bool ap_active;
|
||||
bool ap_ibss_active;
|
||||
bool monitor_active;
|
||||
struct iwl_mvm_vif_bf_data bf_data;
|
||||
|
||||
@ -306,6 +313,9 @@ struct iwl_mvm_vif {
|
||||
|
||||
int tx_key_idx;
|
||||
|
||||
bool seqno_valid;
|
||||
u16 seqno;
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
/* IPv6 addresses for WoWLAN */
|
||||
struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX];
|
||||
@ -333,6 +343,7 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
|
||||
enum iwl_scan_status {
|
||||
IWL_MVM_SCAN_NONE,
|
||||
IWL_MVM_SCAN_OS,
|
||||
IWL_MVM_SCAN_SCHED,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -434,7 +445,7 @@ struct iwl_mvm {
|
||||
|
||||
enum iwl_ucode_type cur_ucode;
|
||||
bool ucode_loaded;
|
||||
bool init_ucode_run;
|
||||
bool init_ucode_complete;
|
||||
u32 error_event_table;
|
||||
u32 log_event_table;
|
||||
|
||||
@ -470,6 +481,9 @@ struct iwl_mvm {
|
||||
enum iwl_scan_status scan_status;
|
||||
struct iwl_scan_cmd *scan_cmd;
|
||||
|
||||
/* rx chain antennas set through debugfs for the scan command */
|
||||
u8 scan_rx_ant;
|
||||
|
||||
/* Internal station */
|
||||
struct iwl_mvm_int_sta aux_sta;
|
||||
|
||||
@ -479,7 +493,8 @@ struct iwl_mvm {
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
struct dentry *debugfs_dir;
|
||||
u32 dbgfs_sram_offset, dbgfs_sram_len;
|
||||
bool prevent_power_down_d3;
|
||||
bool disable_power_off;
|
||||
bool disable_power_off_d3;
|
||||
#endif
|
||||
|
||||
struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];
|
||||
@ -523,12 +538,23 @@ struct iwl_mvm {
|
||||
/* BT-Coex */
|
||||
u8 bt_kill_msk;
|
||||
struct iwl_bt_coex_profile_notif last_bt_notif;
|
||||
struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
|
||||
|
||||
/* Thermal Throttling and CTkill */
|
||||
struct iwl_mvm_tt_mgmt thermal_throttle;
|
||||
s32 temperature; /* Celsius */
|
||||
|
||||
const struct iwl_mvm_power_ops *pm_ops;
|
||||
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
u32 noa_duration;
|
||||
struct ieee80211_vif *noa_vif;
|
||||
#endif
|
||||
|
||||
/* Tx queues */
|
||||
u8 aux_queue;
|
||||
u8 first_agg_queue;
|
||||
u8 last_agg_queue;
|
||||
};
|
||||
|
||||
/* Extract MVM priv from op_mode and _hw */
|
||||
@ -570,6 +596,9 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
|
||||
/* Utils */
|
||||
int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
|
||||
enum ieee80211_band band);
|
||||
void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
|
||||
enum ieee80211_band band,
|
||||
struct ieee80211_tx_rate *r);
|
||||
u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
|
||||
void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
|
||||
void iwl_mvm_dump_sram(struct iwl_mvm *mvm);
|
||||
@ -608,6 +637,7 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm,
|
||||
|
||||
/* NVM */
|
||||
int iwl_nvm_init(struct iwl_mvm *mvm);
|
||||
int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);
|
||||
|
||||
int iwl_mvm_up(struct iwl_mvm *mvm);
|
||||
int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);
|
||||
@ -682,6 +712,23 @@ int iwl_mvm_rx_scan_complete(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
|
||||
struct iwl_device_cmd *cmd);
|
||||
void iwl_mvm_cancel_scan(struct iwl_mvm *mvm);
|
||||
|
||||
/* Scheduled scan */
|
||||
int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm,
|
||||
struct iwl_rx_cmd_buffer *rxb,
|
||||
struct iwl_device_cmd *cmd);
|
||||
int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
struct ieee80211_sched_scan_ies *ies);
|
||||
int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
|
||||
struct cfg80211_sched_scan_request *req);
|
||||
int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
|
||||
struct cfg80211_sched_scan_request *req);
|
||||
void iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm);
|
||||
int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm,
|
||||
struct iwl_rx_cmd_buffer *rxb,
|
||||
struct iwl_device_cmd *cmd);
|
||||
|
||||
/* MVM debugfs */
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir);
|
||||
@ -720,6 +767,13 @@ static inline int iwl_mvm_power_disable(struct iwl_mvm *mvm,
|
||||
return mvm->pm_ops->power_disable(mvm, vif);
|
||||
}
|
||||
|
||||
static inline int iwl_mvm_power_update_device_mode(struct iwl_mvm *mvm)
|
||||
{
|
||||
if (mvm->pm_ops->power_update_device_mode)
|
||||
return mvm->pm_ops->power_update_device_mode(mvm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
static inline int iwl_mvm_power_dbgfs_read(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
@ -745,6 +799,15 @@ void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw,
|
||||
void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif, int idx);
|
||||
extern const struct file_operations iwl_dbgfs_d3_test_ops;
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif);
|
||||
#else
|
||||
static inline void
|
||||
iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* BT Coex */
|
||||
int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm);
|
||||
@ -754,7 +817,20 @@ int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
|
||||
struct iwl_device_cmd *cmd);
|
||||
void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
enum ieee80211_rssi_event rssi_event);
|
||||
void iwl_mvm_bt_coex_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
|
||||
void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);
|
||||
u16 iwl_mvm_bt_coex_agg_time_limit(struct iwl_mvm *mvm,
|
||||
struct ieee80211_sta *sta);
|
||||
bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
|
||||
struct ieee80211_sta *sta);
|
||||
|
||||
enum iwl_bt_kill_msk {
|
||||
BT_KILL_MSK_DEFAULT,
|
||||
BT_KILL_MSK_SCO_HID_A2DP,
|
||||
BT_KILL_MSK_REDUCED_TXPOW,
|
||||
BT_KILL_MSK_MAX,
|
||||
};
|
||||
extern const u32 iwl_bt_ack_kill_msk[BT_KILL_MSK_MAX];
|
||||
extern const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX];
|
||||
|
||||
/* beacon filtering */
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
|
@ -77,7 +77,7 @@ static const int nvm_to_read[] = {
|
||||
|
||||
/* Default NVM size to read */
|
||||
#define IWL_NVM_DEFAULT_CHUNK_SIZE (2*1024)
|
||||
#define IWL_MAX_NVM_SECTION_SIZE 6000
|
||||
#define IWL_MAX_NVM_SECTION_SIZE 7000
|
||||
|
||||
#define NVM_WRITE_OPCODE 1
|
||||
#define NVM_READ_OPCODE 0
|
||||
@ -259,6 +259,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
|
||||
#define MAX_NVM_FILE_LEN 16384
|
||||
|
||||
/*
|
||||
* Reads external NVM from a file into mvm->nvm_sections
|
||||
*
|
||||
* HOW TO CREATE THE NVM FILE FORMAT:
|
||||
* ------------------------------
|
||||
* 1. create hex file, format:
|
||||
@ -277,20 +279,23 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
|
||||
*
|
||||
* 4. save as "iNVM_xxx.bin" under /lib/firmware
|
||||
*/
|
||||
static int iwl_mvm_load_external_nvm(struct iwl_mvm *mvm)
|
||||
static int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm)
|
||||
{
|
||||
int ret, section_id, section_size;
|
||||
int ret, section_size;
|
||||
u16 section_id;
|
||||
const struct firmware *fw_entry;
|
||||
const struct {
|
||||
__le16 word1;
|
||||
__le16 word2;
|
||||
u8 data[];
|
||||
} *file_sec;
|
||||
const u8 *eof;
|
||||
const u8 *eof, *temp;
|
||||
|
||||
#define NVM_WORD1_LEN(x) (8 * (x & 0x03FF))
|
||||
#define NVM_WORD2_ID(x) (x >> 12)
|
||||
|
||||
IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from external NVM\n");
|
||||
|
||||
/*
|
||||
* Obtain NVM image via request_firmware. Since we already used
|
||||
* request_firmware_nowait() for the firmware binary load and only
|
||||
@ -362,12 +367,18 @@ static int iwl_mvm_load_external_nvm(struct iwl_mvm *mvm)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = iwl_nvm_write_section(mvm, section_id, file_sec->data,
|
||||
section_size);
|
||||
if (ret < 0) {
|
||||
IWL_ERR(mvm, "iwl_mvm_send_cmd failed: %d\n", ret);
|
||||
temp = kmemdup(file_sec->data, section_size, GFP_KERNEL);
|
||||
if (!temp) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
if (WARN_ON(section_id >= NVM_NUM_OF_SECTIONS)) {
|
||||
IWL_ERR(mvm, "Invalid NVM section ID\n");
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
mvm->nvm_sections[section_id].data = temp;
|
||||
mvm->nvm_sections[section_id].length = section_size;
|
||||
|
||||
/* advance to the next section */
|
||||
file_sec = (void *)(file_sec->data + section_size);
|
||||
@ -377,6 +388,28 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Loads the NVM data stored in mvm->nvm_sections into the NIC */
|
||||
int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm)
|
||||
{
|
||||
int i, ret;
|
||||
u16 section_id;
|
||||
struct iwl_nvm_section *sections = mvm->nvm_sections;
|
||||
|
||||
IWL_DEBUG_EEPROM(mvm->trans->dev, "'Write to NVM\n");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) {
|
||||
section_id = nvm_to_read[i];
|
||||
ret = iwl_nvm_write_section(mvm, section_id,
|
||||
sections[section_id].data,
|
||||
sections[section_id].length);
|
||||
if (ret < 0) {
|
||||
IWL_ERR(mvm, "iwl_mvm_send_cmd failed: %d\n", ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int iwl_nvm_init(struct iwl_mvm *mvm)
|
||||
{
|
||||
int ret, i, section;
|
||||
@ -385,36 +418,36 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
|
||||
/* load external NVM if configured */
|
||||
if (iwlwifi_mod_params.nvm_file) {
|
||||
/* move to External NVM flow */
|
||||
ret = iwl_mvm_load_external_nvm(mvm);
|
||||
ret = iwl_mvm_read_external_nvm(mvm);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
/* Read From FW NVM */
|
||||
IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n");
|
||||
|
||||
/* Read From FW NVM */
|
||||
IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n");
|
||||
|
||||
/* TODO: find correct NVM max size for a section */
|
||||
nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size,
|
||||
GFP_KERNEL);
|
||||
if (!nvm_buffer)
|
||||
return -ENOMEM;
|
||||
for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) {
|
||||
section = nvm_to_read[i];
|
||||
/* we override the constness for initial read */
|
||||
ret = iwl_nvm_read_section(mvm, section, nvm_buffer);
|
||||
if (ret < 0)
|
||||
break;
|
||||
temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
|
||||
if (!temp) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
/* TODO: find correct NVM max size for a section */
|
||||
nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size,
|
||||
GFP_KERNEL);
|
||||
if (!nvm_buffer)
|
||||
return -ENOMEM;
|
||||
for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) {
|
||||
section = nvm_to_read[i];
|
||||
/* we override the constness for initial read */
|
||||
ret = iwl_nvm_read_section(mvm, section, nvm_buffer);
|
||||
if (ret < 0)
|
||||
break;
|
||||
temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
|
||||
if (!temp) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
mvm->nvm_sections[section].data = temp;
|
||||
mvm->nvm_sections[section].length = ret;
|
||||
}
|
||||
mvm->nvm_sections[section].data = temp;
|
||||
mvm->nvm_sections[section].length = ret;
|
||||
kfree(nvm_buffer);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
kfree(nvm_buffer);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mvm->nvm_data = iwl_parse_nvm_sections(mvm);
|
||||
if (!mvm->nvm_data)
|
||||
|
@ -224,6 +224,10 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
|
||||
|
||||
RX_HANDLER(SCAN_REQUEST_CMD, iwl_mvm_rx_scan_response, false),
|
||||
RX_HANDLER(SCAN_COMPLETE_NOTIFICATION, iwl_mvm_rx_scan_complete, false),
|
||||
RX_HANDLER(SCAN_OFFLOAD_COMPLETE,
|
||||
iwl_mvm_rx_scan_offload_complete_notif, false),
|
||||
RX_HANDLER(MATCH_FOUND_NOTIFICATION, iwl_mvm_rx_sched_scan_results,
|
||||
false),
|
||||
|
||||
RX_HANDLER(RADIO_VERSION_NOTIFICATION, iwl_mvm_rx_radio_ver, false),
|
||||
RX_HANDLER(CARD_STATE_NOTIFICATION, iwl_mvm_rx_card_state_notif, false),
|
||||
@ -249,6 +253,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
|
||||
CMD(TIME_EVENT_NOTIFICATION),
|
||||
CMD(BINDING_CONTEXT_CMD),
|
||||
CMD(TIME_QUOTA_CMD),
|
||||
CMD(NON_QOS_TX_COUNTER_CMD),
|
||||
CMD(RADIO_VERSION_NOTIFICATION),
|
||||
CMD(SCAN_REQUEST_CMD),
|
||||
CMD(SCAN_ABORT_CMD),
|
||||
@ -260,10 +265,12 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
|
||||
CMD(CALIB_RES_NOTIF_PHY_DB),
|
||||
CMD(SET_CALIB_DEFAULT_CMD),
|
||||
CMD(CALIBRATION_COMPLETE_NOTIFICATION),
|
||||
CMD(ADD_STA_KEY),
|
||||
CMD(ADD_STA),
|
||||
CMD(REMOVE_STA),
|
||||
CMD(LQ_CMD),
|
||||
CMD(SCAN_OFFLOAD_CONFIG_CMD),
|
||||
CMD(MATCH_FOUND_NOTIFICATION),
|
||||
CMD(SCAN_OFFLOAD_REQUEST_CMD),
|
||||
CMD(SCAN_OFFLOAD_ABORT_CMD),
|
||||
CMD(SCAN_OFFLOAD_COMPLETE),
|
||||
@ -303,6 +310,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
|
||||
CMD(REPLY_BEACON_FILTERING_CMD),
|
||||
CMD(REPLY_THERMAL_MNG_BACKOFF),
|
||||
CMD(MAC_PM_POWER_TABLE),
|
||||
CMD(BT_COEX_CI),
|
||||
};
|
||||
#undef CMD
|
||||
|
||||
@ -344,6 +352,14 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
|
||||
mvm->restart_fw = iwlwifi_mod_params.restart_fw ? -1 : 0;
|
||||
|
||||
mvm->aux_queue = 15;
|
||||
mvm->first_agg_queue = 16;
|
||||
mvm->last_agg_queue = mvm->cfg->base_params->num_of_queues - 1;
|
||||
if (mvm->cfg->base_params->num_of_queues == 16) {
|
||||
mvm->aux_queue = 11;
|
||||
mvm->first_agg_queue = 12;
|
||||
}
|
||||
|
||||
mutex_init(&mvm->mutex);
|
||||
spin_lock_init(&mvm->async_handlers_lock);
|
||||
INIT_LIST_HEAD(&mvm->time_event_list);
|
||||
@ -401,24 +417,32 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
IWL_INFO(mvm, "Detected %s, REV=0x%X\n",
|
||||
mvm->cfg->name, mvm->trans->hw_rev);
|
||||
|
||||
err = iwl_trans_start_hw(mvm->trans);
|
||||
if (err)
|
||||
goto out_free;
|
||||
|
||||
iwl_mvm_tt_initialize(mvm);
|
||||
|
||||
mutex_lock(&mvm->mutex);
|
||||
err = iwl_run_init_mvm_ucode(mvm, true);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
/* returns 0 if successful, 1 if success but in rfkill */
|
||||
if (err < 0 && !iwlmvm_mod_params.init_dbg) {
|
||||
IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", err);
|
||||
goto out_free;
|
||||
}
|
||||
/*
|
||||
* If the NVM exists in an external file,
|
||||
* there is no need to unnecessarily power up the NIC at driver load
|
||||
*/
|
||||
if (iwlwifi_mod_params.nvm_file) {
|
||||
iwl_nvm_init(mvm);
|
||||
} else {
|
||||
err = iwl_trans_start_hw(mvm->trans);
|
||||
if (err)
|
||||
goto out_free;
|
||||
|
||||
/* Stop the hw after the ALIVE and NVM has been read */
|
||||
if (!iwlmvm_mod_params.init_dbg)
|
||||
iwl_trans_stop_hw(mvm->trans, false);
|
||||
mutex_lock(&mvm->mutex);
|
||||
err = iwl_run_init_mvm_ucode(mvm, true);
|
||||
mutex_unlock(&mvm->mutex);
|
||||
/* returns 0 if successful, 1 if success but in rfkill */
|
||||
if (err < 0 && !iwlmvm_mod_params.init_dbg) {
|
||||
IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", err);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* Stop the hw after the ALIVE and NVM has been read */
|
||||
if (!iwlmvm_mod_params.init_dbg)
|
||||
iwl_trans_stop_hw(mvm->trans, false);
|
||||
}
|
||||
|
||||
scan_size = sizeof(struct iwl_scan_cmd) +
|
||||
mvm->fw->ucode_capa.max_probe_length +
|
||||
@ -449,7 +473,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
||||
out_free:
|
||||
iwl_phy_db_free(mvm->phy_db);
|
||||
kfree(mvm->scan_cmd);
|
||||
iwl_trans_stop_hw(trans, true);
|
||||
if (!iwlwifi_mod_params.nvm_file)
|
||||
iwl_trans_stop_hw(trans, true);
|
||||
ieee80211_free_hw(mvm->hw);
|
||||
return NULL;
|
||||
}
|
||||
@ -715,6 +740,9 @@ static void iwl_mvm_nic_restart(struct iwl_mvm *mvm)
|
||||
case IWL_MVM_SCAN_OS:
|
||||
ieee80211_scan_completed(mvm->hw, true);
|
||||
break;
|
||||
case IWL_MVM_SCAN_SCHED:
|
||||
ieee80211_sched_scan_stopped(mvm->hw);
|
||||
break;
|
||||
}
|
||||
|
||||
if (mvm->restart_fw > 0)
|
||||
|
@ -300,11 +300,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
|
||||
}
|
||||
|
||||
if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) {
|
||||
cmd->rx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT);
|
||||
cmd->tx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT);
|
||||
|
||||
if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) |
|
||||
BIT(IEEE80211_AC_VI) |
|
||||
BIT(IEEE80211_AC_BE) |
|
||||
@ -319,10 +314,31 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
|
||||
}
|
||||
|
||||
cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP;
|
||||
cmd->heavy_tx_thld_packets =
|
||||
IWL_MVM_PS_HEAVY_TX_THLD_PACKETS;
|
||||
cmd->heavy_rx_thld_packets =
|
||||
IWL_MVM_PS_HEAVY_RX_THLD_PACKETS;
|
||||
|
||||
if (mvm->cur_ucode == IWL_UCODE_WOWLAN || cmd->flags &
|
||||
cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
|
||||
cmd->rx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT);
|
||||
cmd->tx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT);
|
||||
} else {
|
||||
cmd->rx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT);
|
||||
cmd->tx_data_timeout_uapsd =
|
||||
cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT);
|
||||
}
|
||||
|
||||
if (cmd->flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
|
||||
cmd->heavy_tx_thld_packets =
|
||||
IWL_MVM_PS_SNOOZE_HEAVY_TX_THLD_PACKETS;
|
||||
cmd->heavy_rx_thld_packets =
|
||||
IWL_MVM_PS_SNOOZE_HEAVY_RX_THLD_PACKETS;
|
||||
} else {
|
||||
cmd->heavy_tx_thld_packets =
|
||||
IWL_MVM_PS_HEAVY_TX_THLD_PACKETS;
|
||||
cmd->heavy_rx_thld_packets =
|
||||
IWL_MVM_PS_HEAVY_RX_THLD_PACKETS;
|
||||
}
|
||||
cmd->heavy_tx_thld_percentage =
|
||||
IWL_MVM_PS_HEAVY_TX_THLD_PERCENT;
|
||||
cmd->heavy_rx_thld_percentage =
|
||||
@ -430,6 +446,32 @@ static int iwl_mvm_power_mac_disable(struct iwl_mvm *mvm,
|
||||
sizeof(cmd), &cmd);
|
||||
}
|
||||
|
||||
static int iwl_mvm_power_update_device(struct iwl_mvm *mvm)
|
||||
{
|
||||
struct iwl_device_power_cmd cmd = {
|
||||
.flags = cpu_to_le16(DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK),
|
||||
};
|
||||
|
||||
if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD))
|
||||
return 0;
|
||||
|
||||
if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM)
|
||||
cmd.flags |= cpu_to_le16(DEVICE_POWER_FLAGS_CAM_MSK);
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
if ((mvm->cur_ucode == IWL_UCODE_WOWLAN) ? mvm->disable_power_off_d3 :
|
||||
mvm->disable_power_off)
|
||||
cmd.flags &=
|
||||
cpu_to_le16(~DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK);
|
||||
#endif
|
||||
IWL_DEBUG_POWER(mvm,
|
||||
"Sending device power command with flags = 0x%X\n",
|
||||
cmd.flags);
|
||||
|
||||
return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, sizeof(cmd),
|
||||
&cmd);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif, char *buf,
|
||||
@ -440,10 +482,11 @@ static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm,
|
||||
|
||||
iwl_mvm_power_build_cmd(mvm, vif, &cmd);
|
||||
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n",
|
||||
(cmd.flags &
|
||||
cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ?
|
||||
0 : 1);
|
||||
if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD))
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n",
|
||||
(cmd.flags &
|
||||
cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ?
|
||||
0 : 1);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n",
|
||||
iwlmvm_mod_params.power_scheme);
|
||||
pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n",
|
||||
@ -609,6 +652,7 @@ int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm,
|
||||
|
||||
const struct iwl_mvm_power_ops pm_mac_ops = {
|
||||
.power_update_mode = iwl_mvm_power_mac_update_mode,
|
||||
.power_update_device_mode = iwl_mvm_power_update_device,
|
||||
.power_disable = iwl_mvm_power_mac_disable,
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
.power_dbgfs_read = iwl_mvm_power_mac_dbgfs_read,
|
||||
|
@ -110,7 +110,8 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
|
||||
data->n_interfaces[id]++;
|
||||
break;
|
||||
case NL80211_IFTYPE_AP:
|
||||
if (mvmvif->ap_active)
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
if (mvmvif->ap_ibss_active)
|
||||
data->n_interfaces[id]++;
|
||||
break;
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
@ -119,16 +120,45 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
|
||||
break;
|
||||
case NL80211_IFTYPE_P2P_DEVICE:
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
if (vif->bss_conf.ibss_joined)
|
||||
data->n_interfaces[id]++;
|
||||
break;
|
||||
default:
|
||||
WARN_ON_ONCE(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
|
||||
struct iwl_time_quota_cmd *cmd)
|
||||
{
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
struct iwl_mvm_vif *mvmvif;
|
||||
int i, phy_id = -1, beacon_int = 0;
|
||||
|
||||
if (!mvm->noa_duration || !mvm->noa_vif)
|
||||
return;
|
||||
|
||||
mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif);
|
||||
if (!mvmvif->ap_ibss_active)
|
||||
return;
|
||||
|
||||
phy_id = mvmvif->phy_ctxt->id;
|
||||
beacon_int = mvm->noa_vif->bss_conf.beacon_int;
|
||||
|
||||
for (i = 0; i < MAX_BINDINGS; i++) {
|
||||
u32 id_n_c = le32_to_cpu(cmd->quotas[i].id_and_color);
|
||||
u32 id = (id_n_c & FW_CTXT_ID_MSK) >> FW_CTXT_ID_POS;
|
||||
u32 quota = le32_to_cpu(cmd->quotas[i].quota);
|
||||
|
||||
if (id != phy_id)
|
||||
continue;
|
||||
|
||||
quota *= (beacon_int - mvm->noa_duration);
|
||||
quota /= beacon_int;
|
||||
|
||||
cmd->quotas[i].quota = cpu_to_le32(quota);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
|
||||
{
|
||||
struct iwl_time_quota_cmd cmd = {};
|
||||
@ -196,6 +226,8 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
|
||||
/* Give the remainder of the session to the first binding */
|
||||
le32_add_cpu(&cmd.quotas[0].quota, quota_rem);
|
||||
|
||||
iwl_mvm_adjust_quota_for_noa(mvm, &cmd);
|
||||
|
||||
ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC,
|
||||
sizeof(cmd), &cmd);
|
||||
if (ret)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,9 +35,11 @@
|
||||
#include "iwl-trans.h"
|
||||
|
||||
struct iwl_rs_rate_info {
|
||||
u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
|
||||
u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
|
||||
u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */
|
||||
u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
|
||||
u8 plcp_ht_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
|
||||
u8 plcp_ht_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */
|
||||
u8 plcp_vht_siso;
|
||||
u8 plcp_vht_mimo2;
|
||||
u8 prev_rs; /* previous rate used in rs algo */
|
||||
u8 next_rs; /* next rate used in rs algo */
|
||||
};
|
||||
@ -83,35 +85,52 @@ enum {
|
||||
#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX)
|
||||
|
||||
|
||||
/* uCode API values for OFDM high-throughput (HT) bit rates */
|
||||
/* uCode API values for HT/VHT bit rates */
|
||||
enum {
|
||||
IWL_RATE_SISO_6M_PLCP = 0,
|
||||
IWL_RATE_SISO_12M_PLCP = 1,
|
||||
IWL_RATE_SISO_18M_PLCP = 2,
|
||||
IWL_RATE_SISO_24M_PLCP = 3,
|
||||
IWL_RATE_SISO_36M_PLCP = 4,
|
||||
IWL_RATE_SISO_48M_PLCP = 5,
|
||||
IWL_RATE_SISO_54M_PLCP = 6,
|
||||
IWL_RATE_SISO_60M_PLCP = 7,
|
||||
IWL_RATE_MIMO2_6M_PLCP = 0x8,
|
||||
IWL_RATE_MIMO2_12M_PLCP = 0x9,
|
||||
IWL_RATE_MIMO2_18M_PLCP = 0xa,
|
||||
IWL_RATE_MIMO2_24M_PLCP = 0xb,
|
||||
IWL_RATE_MIMO2_36M_PLCP = 0xc,
|
||||
IWL_RATE_MIMO2_48M_PLCP = 0xd,
|
||||
IWL_RATE_MIMO2_54M_PLCP = 0xe,
|
||||
IWL_RATE_MIMO2_60M_PLCP = 0xf,
|
||||
IWL_RATE_MIMO3_6M_PLCP = 0x10,
|
||||
IWL_RATE_MIMO3_12M_PLCP = 0x11,
|
||||
IWL_RATE_MIMO3_18M_PLCP = 0x12,
|
||||
IWL_RATE_MIMO3_24M_PLCP = 0x13,
|
||||
IWL_RATE_MIMO3_36M_PLCP = 0x14,
|
||||
IWL_RATE_MIMO3_48M_PLCP = 0x15,
|
||||
IWL_RATE_MIMO3_54M_PLCP = 0x16,
|
||||
IWL_RATE_MIMO3_60M_PLCP = 0x17,
|
||||
IWL_RATE_SISO_INVM_PLCP,
|
||||
IWL_RATE_MIMO2_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP,
|
||||
IWL_RATE_MIMO3_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP,
|
||||
IWL_RATE_HT_SISO_MCS_0_PLCP = 0,
|
||||
IWL_RATE_HT_SISO_MCS_1_PLCP = 1,
|
||||
IWL_RATE_HT_SISO_MCS_2_PLCP = 2,
|
||||
IWL_RATE_HT_SISO_MCS_3_PLCP = 3,
|
||||
IWL_RATE_HT_SISO_MCS_4_PLCP = 4,
|
||||
IWL_RATE_HT_SISO_MCS_5_PLCP = 5,
|
||||
IWL_RATE_HT_SISO_MCS_6_PLCP = 6,
|
||||
IWL_RATE_HT_SISO_MCS_7_PLCP = 7,
|
||||
IWL_RATE_HT_MIMO2_MCS_0_PLCP = 0x8,
|
||||
IWL_RATE_HT_MIMO2_MCS_1_PLCP = 0x9,
|
||||
IWL_RATE_HT_MIMO2_MCS_2_PLCP = 0xA,
|
||||
IWL_RATE_HT_MIMO2_MCS_3_PLCP = 0xB,
|
||||
IWL_RATE_HT_MIMO2_MCS_4_PLCP = 0xC,
|
||||
IWL_RATE_HT_MIMO2_MCS_5_PLCP = 0xD,
|
||||
IWL_RATE_HT_MIMO2_MCS_6_PLCP = 0xE,
|
||||
IWL_RATE_HT_MIMO2_MCS_7_PLCP = 0xF,
|
||||
IWL_RATE_VHT_SISO_MCS_0_PLCP = 0,
|
||||
IWL_RATE_VHT_SISO_MCS_1_PLCP = 1,
|
||||
IWL_RATE_VHT_SISO_MCS_2_PLCP = 2,
|
||||
IWL_RATE_VHT_SISO_MCS_3_PLCP = 3,
|
||||
IWL_RATE_VHT_SISO_MCS_4_PLCP = 4,
|
||||
IWL_RATE_VHT_SISO_MCS_5_PLCP = 5,
|
||||
IWL_RATE_VHT_SISO_MCS_6_PLCP = 6,
|
||||
IWL_RATE_VHT_SISO_MCS_7_PLCP = 7,
|
||||
IWL_RATE_VHT_SISO_MCS_8_PLCP = 8,
|
||||
IWL_RATE_VHT_SISO_MCS_9_PLCP = 9,
|
||||
IWL_RATE_VHT_MIMO2_MCS_0_PLCP = 0x10,
|
||||
IWL_RATE_VHT_MIMO2_MCS_1_PLCP = 0x11,
|
||||
IWL_RATE_VHT_MIMO2_MCS_2_PLCP = 0x12,
|
||||
IWL_RATE_VHT_MIMO2_MCS_3_PLCP = 0x13,
|
||||
IWL_RATE_VHT_MIMO2_MCS_4_PLCP = 0x14,
|
||||
IWL_RATE_VHT_MIMO2_MCS_5_PLCP = 0x15,
|
||||
IWL_RATE_VHT_MIMO2_MCS_6_PLCP = 0x16,
|
||||
IWL_RATE_VHT_MIMO2_MCS_7_PLCP = 0x17,
|
||||
IWL_RATE_VHT_MIMO2_MCS_8_PLCP = 0x18,
|
||||
IWL_RATE_VHT_MIMO2_MCS_9_PLCP = 0x19,
|
||||
IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_HT_MIMO2_MCS_INV_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_VHT_SISO_MCS_INV_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_VHT_MIMO2_MCS_INV_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_HT_SISO_MCS_8_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_HT_SISO_MCS_9_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_HT_MIMO2_MCS_8_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
IWL_RATE_HT_MIMO2_MCS_9_PLCP = IWL_RATE_HT_SISO_MCS_INV_PLCP,
|
||||
};
|
||||
|
||||
#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1)
|
||||
@ -139,25 +158,33 @@ enum {
|
||||
#define IWL_RATE_DECREASE_TH 1920 /* 15% */
|
||||
|
||||
/* possible actions when in legacy mode */
|
||||
#define IWL_LEGACY_SWITCH_ANTENNA1 0
|
||||
#define IWL_LEGACY_SWITCH_ANTENNA2 1
|
||||
#define IWL_LEGACY_SWITCH_SISO 2
|
||||
#define IWL_LEGACY_SWITCH_MIMO2 3
|
||||
enum {
|
||||
IWL_LEGACY_SWITCH_ANTENNA,
|
||||
IWL_LEGACY_SWITCH_SISO,
|
||||
IWL_LEGACY_SWITCH_MIMO2,
|
||||
IWL_LEGACY_FIRST_ACTION = IWL_LEGACY_SWITCH_ANTENNA,
|
||||
IWL_LEGACY_LAST_ACTION = IWL_LEGACY_SWITCH_MIMO2,
|
||||
};
|
||||
|
||||
/* possible actions when in siso mode */
|
||||
#define IWL_SISO_SWITCH_ANTENNA1 0
|
||||
#define IWL_SISO_SWITCH_ANTENNA2 1
|
||||
#define IWL_SISO_SWITCH_MIMO2 2
|
||||
#define IWL_SISO_SWITCH_GI 3
|
||||
enum {
|
||||
IWL_SISO_SWITCH_ANTENNA,
|
||||
IWL_SISO_SWITCH_MIMO2,
|
||||
IWL_SISO_SWITCH_GI,
|
||||
IWL_SISO_FIRST_ACTION = IWL_SISO_SWITCH_ANTENNA,
|
||||
IWL_SISO_LAST_ACTION = IWL_SISO_SWITCH_GI,
|
||||
};
|
||||
|
||||
/* possible actions when in mimo mode */
|
||||
#define IWL_MIMO2_SWITCH_ANTENNA1 0
|
||||
#define IWL_MIMO2_SWITCH_ANTENNA2 1
|
||||
#define IWL_MIMO2_SWITCH_SISO_A 2
|
||||
#define IWL_MIMO2_SWITCH_SISO_B 3
|
||||
#define IWL_MIMO2_SWITCH_GI 4
|
||||
enum {
|
||||
IWL_MIMO2_SWITCH_SISO_A,
|
||||
IWL_MIMO2_SWITCH_SISO_B,
|
||||
IWL_MIMO2_SWITCH_GI,
|
||||
IWL_MIMO2_FIRST_ACTION = IWL_MIMO2_SWITCH_SISO_A,
|
||||
IWL_MIMO2_LAST_ACTION = IWL_MIMO2_SWITCH_GI,
|
||||
};
|
||||
|
||||
#define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_GI
|
||||
#define IWL_MAX_SEARCH IWL_MIMO2_LAST_ACTION
|
||||
|
||||
#define IWL_ACTION_LIMIT 3 /* # possible actions */
|
||||
|
||||
@ -188,20 +215,31 @@ enum {
|
||||
|
||||
enum iwl_table_type {
|
||||
LQ_NONE,
|
||||
LQ_G, /* legacy types */
|
||||
LQ_A,
|
||||
LQ_SISO, /* high-throughput types */
|
||||
LQ_MIMO2,
|
||||
LQ_LEGACY_G, /* legacy types */
|
||||
LQ_LEGACY_A,
|
||||
LQ_HT_SISO, /* HT types */
|
||||
LQ_HT_MIMO2,
|
||||
LQ_VHT_SISO, /* VHT types */
|
||||
LQ_VHT_MIMO2,
|
||||
LQ_MAX,
|
||||
};
|
||||
|
||||
#define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A))
|
||||
#define is_siso(tbl) ((tbl) == LQ_SISO)
|
||||
#define is_mimo2(tbl) ((tbl) == LQ_MIMO2)
|
||||
#define is_mimo(tbl) is_mimo2(tbl)
|
||||
#define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl))
|
||||
#define is_a_band(tbl) ((tbl) == LQ_A)
|
||||
#define is_g_and(tbl) ((tbl) == LQ_G)
|
||||
#define is_legacy(tbl) (((tbl) == LQ_LEGACY_G) || ((tbl) == LQ_LEGACY_A))
|
||||
#define is_ht_siso(tbl) ((tbl) == LQ_HT_SISO)
|
||||
#define is_ht_mimo2(tbl) ((tbl) == LQ_HT_MIMO2)
|
||||
#define is_vht_siso(tbl) ((tbl) == LQ_VHT_SISO)
|
||||
#define is_vht_mimo2(tbl) ((tbl) == LQ_VHT_MIMO2)
|
||||
#define is_siso(tbl) (is_ht_siso(tbl) || is_vht_siso(tbl))
|
||||
#define is_mimo2(tbl) (is_ht_mimo2(tbl) || is_vht_mimo2(tbl))
|
||||
#define is_mimo(tbl) (is_mimo2(tbl))
|
||||
#define is_ht(tbl) (is_ht_siso(tbl) || is_ht_mimo2(tbl))
|
||||
#define is_vht(tbl) (is_vht_siso(tbl) || is_vht_mimo2(tbl))
|
||||
#define is_a_band(tbl) ((tbl) == LQ_LEGACY_A)
|
||||
#define is_g_band(tbl) ((tbl) == LQ_LEGACY_G)
|
||||
|
||||
#define is_ht20(tbl) (tbl->bw == RATE_MCS_CHAN_WIDTH_20)
|
||||
#define is_ht40(tbl) (tbl->bw == RATE_MCS_CHAN_WIDTH_40)
|
||||
#define is_ht80(tbl) (tbl->bw == RATE_MCS_CHAN_WIDTH_80)
|
||||
|
||||
#define IWL_MAX_MCS_DISPLAY_SIZE 12
|
||||
|
||||
@ -232,7 +270,7 @@ struct iwl_scale_tbl_info {
|
||||
enum iwl_table_type lq_type;
|
||||
u8 ant_type;
|
||||
u8 is_SGI; /* 1 = short guard interval */
|
||||
u8 is_ht40; /* 1 = 40 MHz channel width */
|
||||
u32 bw; /* channel bandwidth; RATE_MCS_CHAN_WIDTH_XX */
|
||||
u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */
|
||||
u8 max_search; /* maximun number of tables we can search */
|
||||
s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */
|
||||
@ -262,7 +300,7 @@ struct iwl_lq_sta {
|
||||
u64 flush_timer; /* time staying in mode before new search */
|
||||
|
||||
u8 action_counter; /* # mode-switch actions tried */
|
||||
u8 is_green;
|
||||
bool is_vht;
|
||||
enum ieee80211_band band;
|
||||
|
||||
/* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
|
||||
|
@ -422,6 +422,27 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac,
|
||||
|
||||
mvmvif->bf_data.ave_beacon_signal = sig;
|
||||
|
||||
/* BT Coex */
|
||||
if (mvmvif->bf_data.bt_coex_min_thold !=
|
||||
mvmvif->bf_data.bt_coex_max_thold) {
|
||||
last_event = mvmvif->bf_data.last_bt_coex_event;
|
||||
if (sig > mvmvif->bf_data.bt_coex_max_thold &&
|
||||
(last_event <= mvmvif->bf_data.bt_coex_min_thold ||
|
||||
last_event == 0)) {
|
||||
mvmvif->bf_data.last_bt_coex_event = sig;
|
||||
IWL_DEBUG_RX(mvm, "cqm_iterator bt coex high %d\n",
|
||||
sig);
|
||||
iwl_mvm_bt_rssi_event(mvm, vif, RSSI_EVENT_HIGH);
|
||||
} else if (sig < mvmvif->bf_data.bt_coex_min_thold &&
|
||||
(last_event >= mvmvif->bf_data.bt_coex_max_thold ||
|
||||
last_event == 0)) {
|
||||
mvmvif->bf_data.last_bt_coex_event = sig;
|
||||
IWL_DEBUG_RX(mvm, "cqm_iterator bt coex low %d\n",
|
||||
sig);
|
||||
iwl_mvm_bt_rssi_event(mvm, vif, RSSI_EVENT_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI))
|
||||
return;
|
||||
|
||||
|
@ -74,8 +74,12 @@
|
||||
static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm)
|
||||
{
|
||||
u16 rx_chain;
|
||||
u8 rx_ant = iwl_fw_valid_rx_ant(mvm->fw);
|
||||
u8 rx_ant;
|
||||
|
||||
if (mvm->scan_rx_ant != ANT_NONE)
|
||||
rx_ant = mvm->scan_rx_ant;
|
||||
else
|
||||
rx_ant = iwl_fw_valid_rx_ant(mvm->fw);
|
||||
rx_chain = rx_ant << PHY_RX_CHAIN_VALID_POS;
|
||||
rx_chain |= rx_ant << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS;
|
||||
rx_chain |= rx_ant << PHY_RX_CHAIN_FORCE_SEL_POS;
|
||||
@ -93,10 +97,10 @@ static inline __le32 iwl_mvm_scan_max_out_time(struct ieee80211_vif *vif)
|
||||
|
||||
static inline __le32 iwl_mvm_scan_suspend_time(struct ieee80211_vif *vif)
|
||||
{
|
||||
if (vif->bss_conf.assoc)
|
||||
return cpu_to_le32(vif->bss_conf.beacon_int);
|
||||
else
|
||||
if (!vif->bss_conf.assoc)
|
||||
return 0;
|
||||
|
||||
return cpu_to_le32(ieee80211_tu_to_usec(vif->bss_conf.beacon_int));
|
||||
}
|
||||
|
||||
static inline __le32
|
||||
@ -133,11 +137,12 @@ iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band,
|
||||
* request.
|
||||
*/
|
||||
static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd,
|
||||
struct cfg80211_scan_request *req)
|
||||
struct cfg80211_scan_request *req,
|
||||
int first)
|
||||
{
|
||||
int fw_idx, req_idx;
|
||||
|
||||
for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0;
|
||||
for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx >= first;
|
||||
req_idx--, fw_idx++) {
|
||||
cmd->direct_scan[fw_idx].id = WLAN_EID_SSID;
|
||||
cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len;
|
||||
@ -153,9 +158,9 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd,
|
||||
* just to notify that this scan is active and not passive.
|
||||
* In order to notify the FW of the number of SSIDs we wish to scan (including
|
||||
* the zero-length one), we need to set the corresponding bits in chan->type,
|
||||
* one for each SSID, and set the active bit (first). The first SSID is already
|
||||
* included in the probe template, so we need to set only req->n_ssids - 1 bits
|
||||
* in addition to the first bit.
|
||||
* one for each SSID, and set the active bit (first). If the first SSID is
|
||||
* already included in the probe template, so we need to set only
|
||||
* req->n_ssids - 1 bits in addition to the first bit.
|
||||
*/
|
||||
static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids)
|
||||
{
|
||||
@ -170,7 +175,8 @@ static u16 iwl_mvm_get_passive_dwell(enum ieee80211_band band)
|
||||
}
|
||||
|
||||
static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd,
|
||||
struct cfg80211_scan_request *req)
|
||||
struct cfg80211_scan_request *req,
|
||||
bool basic_ssid)
|
||||
{
|
||||
u16 passive_dwell = iwl_mvm_get_passive_dwell(req->channels[0]->band);
|
||||
u16 active_dwell = iwl_mvm_get_active_dwell(req->channels[0]->band,
|
||||
@ -178,10 +184,14 @@ static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd,
|
||||
struct iwl_scan_channel *chan = (struct iwl_scan_channel *)
|
||||
(cmd->data + le16_to_cpu(cmd->tx_cmd.len));
|
||||
int i;
|
||||
int type = BIT(req->n_ssids) - 1;
|
||||
|
||||
if (!basic_ssid)
|
||||
type |= BIT(req->n_ssids);
|
||||
|
||||
for (i = 0; i < cmd->channel_count; i++) {
|
||||
chan->channel = cpu_to_le16(req->channels[i]->hw_value);
|
||||
chan->type = cpu_to_le32(BIT(req->n_ssids) - 1);
|
||||
chan->type = cpu_to_le32(type);
|
||||
if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN)
|
||||
chan->type &= cpu_to_le32(~SCAN_CHANNEL_TYPE_ACTIVE);
|
||||
chan->active_dwell = cpu_to_le16(active_dwell);
|
||||
@ -268,6 +278,8 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
|
||||
u32 status;
|
||||
int ssid_len = 0;
|
||||
u8 *ssid = NULL;
|
||||
bool basic_ssid = !(mvm->fw->ucode_capa.flags &
|
||||
IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID);
|
||||
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
BUG_ON(mvm->scan_cmd == NULL);
|
||||
@ -302,14 +314,16 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
|
||||
if (req->n_ssids > 0) {
|
||||
cmd->passive2active = cpu_to_le16(1);
|
||||
cmd->scan_flags |= SCAN_FLAGS_PASSIVE2ACTIVE;
|
||||
ssid = req->ssids[0].ssid;
|
||||
ssid_len = req->ssids[0].ssid_len;
|
||||
if (basic_ssid) {
|
||||
ssid = req->ssids[0].ssid;
|
||||
ssid_len = req->ssids[0].ssid_len;
|
||||
}
|
||||
} else {
|
||||
cmd->passive2active = 0;
|
||||
cmd->scan_flags &= ~SCAN_FLAGS_PASSIVE2ACTIVE;
|
||||
}
|
||||
|
||||
iwl_mvm_scan_fill_ssids(cmd, req);
|
||||
iwl_mvm_scan_fill_ssids(cmd, req, basic_ssid ? 1 : 0);
|
||||
|
||||
cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL);
|
||||
cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id;
|
||||
@ -326,7 +340,7 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
|
||||
req->ie, req->ie_len,
|
||||
mvm->fw->ucode_capa.max_probe_length));
|
||||
|
||||
iwl_mvm_scan_fill_channels(cmd, req);
|
||||
iwl_mvm_scan_fill_channels(cmd, req, basic_ssid);
|
||||
|
||||
cmd->len = cpu_to_le16(sizeof(struct iwl_scan_cmd) +
|
||||
le16_to_cpu(cmd->tx_cmd.len) +
|
||||
@ -377,6 +391,21 @@ int iwl_mvm_rx_scan_complete(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm,
|
||||
struct iwl_rx_cmd_buffer *rxb,
|
||||
struct iwl_device_cmd *cmd)
|
||||
{
|
||||
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
||||
struct iwl_sched_scan_results *notif = (void *)pkt->data;
|
||||
|
||||
if (notif->client_bitmap & SCAN_CLIENT_SCHED_SCAN) {
|
||||
IWL_DEBUG_SCAN(mvm, "Scheduled scan results\n");
|
||||
ieee80211_sched_scan_results(mvm->hw);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool iwl_mvm_scan_abort_notif(struct iwl_notif_wait_data *notif_wait,
|
||||
struct iwl_rx_packet *pkt, void *data)
|
||||
{
|
||||
@ -447,3 +476,406 @@ void iwl_mvm_cancel_scan(struct iwl_mvm *mvm)
|
||||
out_remove_notif:
|
||||
iwl_remove_notification(&mvm->notif_wait, &wait_scan_abort);
|
||||
}
|
||||
|
||||
int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm,
|
||||
struct iwl_rx_cmd_buffer *rxb,
|
||||
struct iwl_device_cmd *cmd)
|
||||
{
|
||||
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
||||
struct iwl_scan_offload_complete *scan_notif = (void *)pkt->data;
|
||||
|
||||
IWL_DEBUG_SCAN(mvm, "Scheduled scan completed, status %s\n",
|
||||
scan_notif->status == IWL_SCAN_OFFLOAD_COMPLETED ?
|
||||
"completed" : "aborted");
|
||||
|
||||
mvm->scan_status = IWL_MVM_SCAN_NONE;
|
||||
ieee80211_sched_scan_stopped(mvm->hw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void iwl_scan_offload_build_tx_cmd(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sched_scan_ies *ies,
|
||||
enum ieee80211_band band,
|
||||
struct iwl_tx_cmd *cmd,
|
||||
u8 *data)
|
||||
{
|
||||
u16 cmd_len;
|
||||
|
||||
cmd->tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL);
|
||||
cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
|
||||
cmd->sta_id = mvm->aux_sta.sta_id;
|
||||
|
||||
cmd->rate_n_flags = iwl_mvm_scan_rate_n_flags(mvm, band, false);
|
||||
|
||||
cmd_len = iwl_mvm_fill_probe_req((struct ieee80211_mgmt *)data,
|
||||
vif->addr,
|
||||
1, NULL, 0,
|
||||
ies->ie[band], ies->len[band],
|
||||
SCAN_OFFLOAD_PROBE_REQ_SIZE);
|
||||
cmd->len = cpu_to_le16(cmd_len);
|
||||
}
|
||||
|
||||
static void iwl_build_scan_cmd(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
struct iwl_scan_offload_cmd *scan)
|
||||
{
|
||||
scan->channel_count =
|
||||
mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels +
|
||||
mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels;
|
||||
scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME);
|
||||
scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH);
|
||||
scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT;
|
||||
scan->rx_chain = iwl_mvm_scan_rx_chain(mvm);
|
||||
scan->max_out_time = cpu_to_le32(200 * 1024);
|
||||
scan->suspend_time = iwl_mvm_scan_suspend_time(vif);
|
||||
scan->filter_flags |= cpu_to_le32(MAC_FILTER_ACCEPT_GRP |
|
||||
MAC_FILTER_IN_BEACON);
|
||||
scan->scan_type = cpu_to_le32(SCAN_TYPE_BACKGROUND);
|
||||
scan->rep_count = cpu_to_le32(1);
|
||||
}
|
||||
|
||||
static int iwl_ssid_exist(u8 *ssid, u8 ssid_len, struct iwl_ssid_ie *ssid_list)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < PROBE_OPTION_MAX; i++) {
|
||||
if (!ssid_list[i].len)
|
||||
break;
|
||||
if (ssid_list[i].len == ssid_len &&
|
||||
!memcmp(ssid_list->ssid, ssid, ssid_len))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void iwl_scan_offload_build_ssid(struct cfg80211_sched_scan_request *req,
|
||||
struct iwl_scan_offload_cmd *scan,
|
||||
u32 *ssid_bitmap)
|
||||
{
|
||||
int i, j;
|
||||
int index;
|
||||
|
||||
/*
|
||||
* copy SSIDs from match list.
|
||||
* iwl_config_sched_scan_profiles() uses the order of these ssids to
|
||||
* config match list.
|
||||
*/
|
||||
for (i = 0; i < req->n_match_sets && i < PROBE_OPTION_MAX; i++) {
|
||||
scan->direct_scan[i].id = WLAN_EID_SSID;
|
||||
scan->direct_scan[i].len = req->match_sets[i].ssid.ssid_len;
|
||||
memcpy(scan->direct_scan[i].ssid, req->match_sets[i].ssid.ssid,
|
||||
scan->direct_scan[i].len);
|
||||
}
|
||||
|
||||
/* add SSIDs from scan SSID list */
|
||||
*ssid_bitmap = 0;
|
||||
for (j = 0; j < req->n_ssids && i < PROBE_OPTION_MAX; j++) {
|
||||
index = iwl_ssid_exist(req->ssids[j].ssid,
|
||||
req->ssids[j].ssid_len,
|
||||
scan->direct_scan);
|
||||
if (index < 0) {
|
||||
if (!req->ssids[j].ssid_len)
|
||||
continue;
|
||||
scan->direct_scan[i].id = WLAN_EID_SSID;
|
||||
scan->direct_scan[i].len = req->ssids[j].ssid_len;
|
||||
memcpy(scan->direct_scan[i].ssid, req->ssids[j].ssid,
|
||||
scan->direct_scan[i].len);
|
||||
*ssid_bitmap |= BIT(i + 1);
|
||||
i++;
|
||||
} else {
|
||||
*ssid_bitmap |= BIT(index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_build_channel_cfg(struct iwl_mvm *mvm,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
struct iwl_scan_channel_cfg *channels,
|
||||
enum ieee80211_band band,
|
||||
int *head, int *tail,
|
||||
u32 ssid_bitmap)
|
||||
{
|
||||
struct ieee80211_supported_band *s_band;
|
||||
int n_probes = req->n_ssids;
|
||||
int n_channels = req->n_channels;
|
||||
u8 active_dwell, passive_dwell;
|
||||
int i, j, index = 0;
|
||||
bool partial;
|
||||
|
||||
/*
|
||||
* We have to configure all supported channels, even if we don't want to
|
||||
* scan on them, but we have to send channels in the order that we want
|
||||
* to scan. So add requested channels to head of the list and others to
|
||||
* the end.
|
||||
*/
|
||||
active_dwell = iwl_mvm_get_active_dwell(band, n_probes);
|
||||
passive_dwell = iwl_mvm_get_passive_dwell(band);
|
||||
s_band = &mvm->nvm_data->bands[band];
|
||||
|
||||
for (i = 0; i < s_band->n_channels && *head <= *tail; i++) {
|
||||
partial = false;
|
||||
for (j = 0; j < n_channels; j++)
|
||||
if (s_band->channels[i].center_freq ==
|
||||
req->channels[j]->center_freq) {
|
||||
index = *head;
|
||||
(*head)++;
|
||||
/*
|
||||
* Channels that came with the request will be
|
||||
* in partial scan .
|
||||
*/
|
||||
partial = true;
|
||||
break;
|
||||
}
|
||||
if (!partial) {
|
||||
index = *tail;
|
||||
(*tail)--;
|
||||
}
|
||||
channels->channel_number[index] =
|
||||
cpu_to_le16(ieee80211_frequency_to_channel(
|
||||
s_band->channels[i].center_freq));
|
||||
channels->dwell_time[index][0] = active_dwell;
|
||||
channels->dwell_time[index][1] = passive_dwell;
|
||||
|
||||
channels->iter_count[index] = cpu_to_le16(1);
|
||||
channels->iter_interval[index] = 0;
|
||||
|
||||
if (!(s_band->channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN))
|
||||
channels->type[index] |=
|
||||
cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE);
|
||||
|
||||
channels->type[index] |=
|
||||
cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL);
|
||||
if (partial)
|
||||
channels->type[index] |=
|
||||
cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL);
|
||||
|
||||
if (s_band->channels[i].flags & IEEE80211_CHAN_NO_HT40)
|
||||
channels->type[index] |=
|
||||
cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW);
|
||||
|
||||
/* scan for all SSIDs from req->ssids */
|
||||
channels->type[index] |= cpu_to_le32(ssid_bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_sched_scan_request *req,
|
||||
struct ieee80211_sched_scan_ies *ies)
|
||||
{
|
||||
int supported_bands = 0;
|
||||
int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels;
|
||||
int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels;
|
||||
int head = 0;
|
||||
int tail = band_2ghz + band_5ghz;
|
||||
u32 ssid_bitmap;
|
||||
int cmd_len;
|
||||
int ret;
|
||||
|
||||
struct iwl_scan_offload_cfg *scan_cfg;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = SCAN_OFFLOAD_CONFIG_CMD,
|
||||
.flags = CMD_SYNC,
|
||||
};
|
||||
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
|
||||
if (band_2ghz)
|
||||
supported_bands++;
|
||||
if (band_5ghz)
|
||||
supported_bands++;
|
||||
|
||||
cmd_len = sizeof(struct iwl_scan_offload_cfg) +
|
||||
supported_bands * SCAN_OFFLOAD_PROBE_REQ_SIZE;
|
||||
|
||||
scan_cfg = kzalloc(cmd_len, GFP_KERNEL);
|
||||
if (!scan_cfg)
|
||||
return -ENOMEM;
|
||||
|
||||
iwl_build_scan_cmd(mvm, vif, req, &scan_cfg->scan_cmd);
|
||||
scan_cfg->scan_cmd.len = cpu_to_le16(cmd_len);
|
||||
|
||||
iwl_scan_offload_build_ssid(req, &scan_cfg->scan_cmd, &ssid_bitmap);
|
||||
/* build tx frames for supported bands */
|
||||
if (band_2ghz) {
|
||||
iwl_scan_offload_build_tx_cmd(mvm, vif, ies,
|
||||
IEEE80211_BAND_2GHZ,
|
||||
&scan_cfg->scan_cmd.tx_cmd[0],
|
||||
scan_cfg->data);
|
||||
iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg,
|
||||
IEEE80211_BAND_2GHZ, &head, &tail,
|
||||
ssid_bitmap);
|
||||
}
|
||||
if (band_5ghz) {
|
||||
iwl_scan_offload_build_tx_cmd(mvm, vif, ies,
|
||||
IEEE80211_BAND_5GHZ,
|
||||
&scan_cfg->scan_cmd.tx_cmd[1],
|
||||
scan_cfg->data +
|
||||
SCAN_OFFLOAD_PROBE_REQ_SIZE);
|
||||
iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg,
|
||||
IEEE80211_BAND_5GHZ, &head, &tail,
|
||||
ssid_bitmap);
|
||||
}
|
||||
|
||||
cmd.data[0] = scan_cfg;
|
||||
cmd.len[0] = cmd_len;
|
||||
cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
|
||||
|
||||
IWL_DEBUG_SCAN(mvm, "Sending scheduled scan config\n");
|
||||
|
||||
ret = iwl_mvm_send_cmd(mvm, &cmd);
|
||||
kfree(scan_cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
|
||||
struct cfg80211_sched_scan_request *req)
|
||||
{
|
||||
struct iwl_scan_offload_profile *profile;
|
||||
struct iwl_scan_offload_profile_cfg *profile_cfg;
|
||||
struct iwl_scan_offload_blacklist *blacklist;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD,
|
||||
.flags = CMD_SYNC,
|
||||
.len[1] = sizeof(*profile_cfg),
|
||||
.dataflags[0] = IWL_HCMD_DFL_NOCOPY,
|
||||
.dataflags[1] = IWL_HCMD_DFL_NOCOPY,
|
||||
};
|
||||
int blacklist_len;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON(req->n_match_sets > IWL_SCAN_MAX_PROFILES))
|
||||
return -EIO;
|
||||
|
||||
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SHORT_BL)
|
||||
blacklist_len = IWL_SCAN_SHORT_BLACKLIST_LEN;
|
||||
else
|
||||
blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN;
|
||||
|
||||
blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL);
|
||||
if (!blacklist)
|
||||
return -ENOMEM;
|
||||
|
||||
profile_cfg = kzalloc(sizeof(*profile_cfg), GFP_KERNEL);
|
||||
if (!profile_cfg) {
|
||||
ret = -ENOMEM;
|
||||
goto free_blacklist;
|
||||
}
|
||||
|
||||
cmd.data[0] = blacklist;
|
||||
cmd.len[0] = sizeof(*blacklist) * blacklist_len;
|
||||
cmd.data[1] = profile_cfg;
|
||||
|
||||
/* No blacklist configuration */
|
||||
|
||||
profile_cfg->num_profiles = req->n_match_sets;
|
||||
profile_cfg->active_clients = SCAN_CLIENT_SCHED_SCAN;
|
||||
profile_cfg->pass_match = SCAN_CLIENT_SCHED_SCAN;
|
||||
profile_cfg->match_notify = SCAN_CLIENT_SCHED_SCAN;
|
||||
|
||||
for (i = 0; i < req->n_match_sets; i++) {
|
||||
profile = &profile_cfg->profiles[i];
|
||||
profile->ssid_index = i;
|
||||
/* Support any cipher and auth algorithm */
|
||||
profile->unicast_cipher = 0xff;
|
||||
profile->auth_alg = 0xff;
|
||||
profile->network_type = IWL_NETWORK_TYPE_ANY;
|
||||
profile->band_selection = IWL_SCAN_OFFLOAD_SELECT_ANY;
|
||||
profile->client_bitmap = SCAN_CLIENT_SCHED_SCAN;
|
||||
}
|
||||
|
||||
IWL_DEBUG_SCAN(mvm, "Sending scheduled scan profile config\n");
|
||||
|
||||
ret = iwl_mvm_send_cmd(mvm, &cmd);
|
||||
kfree(profile_cfg);
|
||||
free_blacklist:
|
||||
kfree(blacklist);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
|
||||
struct cfg80211_sched_scan_request *req)
|
||||
{
|
||||
struct iwl_scan_offload_req scan_req = {
|
||||
.watchdog = IWL_SCHED_SCAN_WATCHDOG,
|
||||
|
||||
.schedule_line[0].iterations = IWL_FAST_SCHED_SCAN_ITERATIONS,
|
||||
.schedule_line[0].delay = req->interval / 1000,
|
||||
.schedule_line[0].full_scan_mul = 1,
|
||||
|
||||
.schedule_line[1].iterations = 0xff,
|
||||
.schedule_line[1].delay = req->interval / 1000,
|
||||
.schedule_line[1].full_scan_mul = IWL_FULL_SCAN_MULTIPLIER,
|
||||
};
|
||||
|
||||
if (req->n_match_sets && req->match_sets[0].ssid.ssid_len) {
|
||||
IWL_DEBUG_SCAN(mvm,
|
||||
"Sending scheduled scan with filtering, filter len %d\n",
|
||||
req->n_match_sets);
|
||||
scan_req.flags |=
|
||||
cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID);
|
||||
} else {
|
||||
IWL_DEBUG_SCAN(mvm,
|
||||
"Sending Scheduled scan without filtering\n");
|
||||
}
|
||||
|
||||
return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, CMD_SYNC,
|
||||
sizeof(scan_req), &scan_req);
|
||||
}
|
||||
|
||||
static int iwl_mvm_send_sched_scan_abort(struct iwl_mvm *mvm)
|
||||
{
|
||||
int ret;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = SCAN_OFFLOAD_ABORT_CMD,
|
||||
.flags = CMD_SYNC,
|
||||
};
|
||||
u32 status;
|
||||
|
||||
/* Exit instantly with error when device is not ready
|
||||
* to receive scan abort command or it does not perform
|
||||
* scheduled scan currently */
|
||||
if (mvm->scan_status != IWL_MVM_SCAN_SCHED)
|
||||
return -EIO;
|
||||
|
||||
ret = iwl_mvm_send_cmd_status(mvm, &cmd, &status);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (status != CAN_ABORT_STATUS) {
|
||||
/*
|
||||
* The scan abort will return 1 for success or
|
||||
* 2 for "failure". A failure condition can be
|
||||
* due to simply not being in an active scan which
|
||||
* can occur if we send the scan abort before the
|
||||
* microcode has notified us that a scan is completed.
|
||||
*/
|
||||
IWL_DEBUG_SCAN(mvm, "SCAN OFFLOAD ABORT ret %d.\n", status);
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&mvm->mutex);
|
||||
|
||||
if (mvm->scan_status != IWL_MVM_SCAN_SCHED) {
|
||||
IWL_DEBUG_SCAN(mvm, "No offloaded scan to stop\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = iwl_mvm_send_sched_scan_abort(mvm);
|
||||
if (ret)
|
||||
IWL_DEBUG_SCAN(mvm, "Send stop offload scan failed %d\n", ret);
|
||||
else
|
||||
IWL_DEBUG_SCAN(mvm, "Successfully sent stop offload scan\n");
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user