forked from Minki/linux
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (89 commits) myri10ge: update driver version myri10ge: report when the link partner is running in Myrinet mode myri10ge: limit the number of recoveries NetXen: Fix link status messages Revert "[netdrvr e100] experiment with doing RX in a similar manner to eepro100" [PATCH] libertas: convert libertas_mpp into anycast_mask [PATCH] libertas: actually send mesh frames to mesh netdev [PATCH] libertas: deauthenticate from AP in channel switch [PATCH] libertas: pull current channel from firmware on mesh autostart [PATCH] libertas: reduce SSID and BSSID mixed-case abuse [PATCH] libertas: remove WPA_SUPPLICANT structure [PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid [PATCH] libertas: tweak association debug output [PATCH] libertas: fix big-endian associate command. [PATCH] libertas: don't byte-swap firmware version number. It's a byte array. [PATCH] libertas: more endianness fixes, in tx.c this time [PATCH] libertas: More endianness fixes. [PATCH] libertas: first pass at fixing up endianness issues [PATCH] libertas: sparse fixes [PATCH] libertas: fix character set in README ...
This commit is contained in:
commit
a0e1d1d075
@ -285,6 +285,12 @@ enum scb_status {
|
|||||||
rus_mask = 0x3C,
|
rus_mask = 0x3C,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ru_state {
|
||||||
|
RU_SUSPENDED = 0,
|
||||||
|
RU_RUNNING = 1,
|
||||||
|
RU_UNINITIALIZED = -1,
|
||||||
|
};
|
||||||
|
|
||||||
enum scb_stat_ack {
|
enum scb_stat_ack {
|
||||||
stat_ack_not_ours = 0x00,
|
stat_ack_not_ours = 0x00,
|
||||||
stat_ack_sw_gen = 0x04,
|
stat_ack_sw_gen = 0x04,
|
||||||
@ -526,6 +532,7 @@ struct nic {
|
|||||||
struct rx *rx_to_use;
|
struct rx *rx_to_use;
|
||||||
struct rx *rx_to_clean;
|
struct rx *rx_to_clean;
|
||||||
struct rfd blank_rfd;
|
struct rfd blank_rfd;
|
||||||
|
enum ru_state ru_running;
|
||||||
|
|
||||||
spinlock_t cb_lock ____cacheline_aligned;
|
spinlock_t cb_lock ____cacheline_aligned;
|
||||||
spinlock_t cmd_lock;
|
spinlock_t cmd_lock;
|
||||||
@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic)
|
|||||||
((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));
|
((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));
|
||||||
|
|
||||||
/* Template for a freshly allocated RFD */
|
/* Template for a freshly allocated RFD */
|
||||||
nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s);
|
nic->blank_rfd.command = cpu_to_le16(cb_el);
|
||||||
nic->blank_rfd.rbd = 0xFFFFFFFF;
|
nic->blank_rfd.rbd = 0xFFFFFFFF;
|
||||||
nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
|
nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
|
||||||
|
|
||||||
@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void e100_start_receiver(struct nic *nic)
|
static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
|
||||||
{
|
{
|
||||||
/* Start if RFA is non-NULL */
|
if(!nic->rxs) return;
|
||||||
if(nic->rx_to_clean->skb)
|
if(RU_SUSPENDED != nic->ru_running) return;
|
||||||
e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr);
|
|
||||||
|
/* handle init time starts */
|
||||||
|
if(!rx) rx = nic->rxs;
|
||||||
|
|
||||||
|
/* (Re)start RU if suspended or idle and RFA is non-NULL */
|
||||||
|
if(rx->skb) {
|
||||||
|
e100_exec_cmd(nic, ruc_start, rx->dma_addr);
|
||||||
|
nic->ru_running = RU_RUNNING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
|
#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
|
||||||
@ -1775,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
|
|||||||
put_unaligned(cpu_to_le32(rx->dma_addr),
|
put_unaligned(cpu_to_le32(rx->dma_addr),
|
||||||
(u32 *)&prev_rfd->link);
|
(u32 *)&prev_rfd->link);
|
||||||
wmb();
|
wmb();
|
||||||
prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s);
|
prev_rfd->command &= ~cpu_to_le16(cb_el);
|
||||||
pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
|
pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
|
||||||
sizeof(struct rfd), PCI_DMA_TODEVICE);
|
sizeof(struct rfd), PCI_DMA_TODEVICE);
|
||||||
}
|
}
|
||||||
@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
|
|||||||
pci_unmap_single(nic->pdev, rx->dma_addr,
|
pci_unmap_single(nic->pdev, rx->dma_addr,
|
||||||
RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
|
RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
|
||||||
|
|
||||||
|
/* this allows for a fast restart without re-enabling interrupts */
|
||||||
|
if(le16_to_cpu(rfd->command) & cb_el)
|
||||||
|
nic->ru_running = RU_SUSPENDED;
|
||||||
|
|
||||||
/* Pull off the RFD and put the actual data (minus eth hdr) */
|
/* Pull off the RFD and put the actual data (minus eth hdr) */
|
||||||
skb_reserve(skb, sizeof(struct rfd));
|
skb_reserve(skb, sizeof(struct rfd));
|
||||||
skb_put(skb, actual_size);
|
skb_put(skb, actual_size);
|
||||||
@ -1843,18 +1862,45 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
|
|||||||
unsigned int work_to_do)
|
unsigned int work_to_do)
|
||||||
{
|
{
|
||||||
struct rx *rx;
|
struct rx *rx;
|
||||||
|
int restart_required = 0;
|
||||||
|
struct rx *rx_to_start = NULL;
|
||||||
|
|
||||||
|
/* are we already rnr? then pay attention!!! this ensures that
|
||||||
|
* the state machine progression never allows a start with a
|
||||||
|
* partially cleaned list, avoiding a race between hardware
|
||||||
|
* and rx_to_clean when in NAPI mode */
|
||||||
|
if(RU_SUSPENDED == nic->ru_running)
|
||||||
|
restart_required = 1;
|
||||||
|
|
||||||
/* Indicate newly arrived packets */
|
/* Indicate newly arrived packets */
|
||||||
for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
|
for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
|
||||||
if(e100_rx_indicate(nic, rx, work_done, work_to_do))
|
int err = e100_rx_indicate(nic, rx, work_done, work_to_do);
|
||||||
|
if(-EAGAIN == err) {
|
||||||
|
/* hit quota so have more work to do, restart once
|
||||||
|
* cleanup is complete */
|
||||||
|
restart_required = 0;
|
||||||
|
break;
|
||||||
|
} else if(-ENODATA == err)
|
||||||
break; /* No more to clean */
|
break; /* No more to clean */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save our starting point as the place we'll restart the receiver */
|
||||||
|
if(restart_required)
|
||||||
|
rx_to_start = nic->rx_to_clean;
|
||||||
|
|
||||||
/* Alloc new skbs to refill list */
|
/* Alloc new skbs to refill list */
|
||||||
for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
|
for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
|
||||||
if(unlikely(e100_rx_alloc_skb(nic, rx)))
|
if(unlikely(e100_rx_alloc_skb(nic, rx)))
|
||||||
break; /* Better luck next time (see watchdog) */
|
break; /* Better luck next time (see watchdog) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(restart_required) {
|
||||||
|
// ack the rnr?
|
||||||
|
writeb(stat_ack_rnr, &nic->csr->scb.stat_ack);
|
||||||
|
e100_start_receiver(nic, rx_to_start);
|
||||||
|
if(work_done)
|
||||||
|
(*work_done)++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void e100_rx_clean_list(struct nic *nic)
|
static void e100_rx_clean_list(struct nic *nic)
|
||||||
@ -1862,6 +1908,8 @@ static void e100_rx_clean_list(struct nic *nic)
|
|||||||
struct rx *rx;
|
struct rx *rx;
|
||||||
unsigned int i, count = nic->params.rfds.count;
|
unsigned int i, count = nic->params.rfds.count;
|
||||||
|
|
||||||
|
nic->ru_running = RU_UNINITIALIZED;
|
||||||
|
|
||||||
if(nic->rxs) {
|
if(nic->rxs) {
|
||||||
for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
|
for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
|
||||||
if(rx->skb) {
|
if(rx->skb) {
|
||||||
@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic)
|
|||||||
unsigned int i, count = nic->params.rfds.count;
|
unsigned int i, count = nic->params.rfds.count;
|
||||||
|
|
||||||
nic->rx_to_use = nic->rx_to_clean = NULL;
|
nic->rx_to_use = nic->rx_to_clean = NULL;
|
||||||
|
nic->ru_running = RU_UNINITIALIZED;
|
||||||
|
|
||||||
if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
|
if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nic->rx_to_use = nic->rx_to_clean = nic->rxs;
|
nic->rx_to_use = nic->rx_to_clean = nic->rxs;
|
||||||
|
nic->ru_running = RU_SUSPENDED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
|
|||||||
/* Ack interrupt(s) */
|
/* Ack interrupt(s) */
|
||||||
iowrite8(stat_ack, &nic->csr->scb.stat_ack);
|
iowrite8(stat_ack, &nic->csr->scb.stat_ack);
|
||||||
|
|
||||||
|
/* We hit Receive No Resource (RNR); restart RU after cleaning */
|
||||||
|
if(stat_ack & stat_ack_rnr)
|
||||||
|
nic->ru_running = RU_SUSPENDED;
|
||||||
|
|
||||||
if(likely(netif_rx_schedule_prep(netdev))) {
|
if(likely(netif_rx_schedule_prep(netdev))) {
|
||||||
e100_disable_irq(nic);
|
e100_disable_irq(nic);
|
||||||
__netif_rx_schedule(netdev);
|
__netif_rx_schedule(netdev);
|
||||||
@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic)
|
|||||||
if((err = e100_hw_init(nic)))
|
if((err = e100_hw_init(nic)))
|
||||||
goto err_clean_cbs;
|
goto err_clean_cbs;
|
||||||
e100_set_multicast_list(nic->netdev);
|
e100_set_multicast_list(nic->netdev);
|
||||||
e100_start_receiver(nic);
|
e100_start_receiver(nic, NULL);
|
||||||
mod_timer(&nic->watchdog, jiffies);
|
mod_timer(&nic->watchdog, jiffies);
|
||||||
if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
|
if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
|
||||||
nic->netdev->name, nic->netdev)))
|
nic->netdev->name, nic->netdev)))
|
||||||
@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
|
|||||||
mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
|
mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
|
||||||
BMCR_LOOPBACK);
|
BMCR_LOOPBACK);
|
||||||
|
|
||||||
e100_start_receiver(nic);
|
e100_start_receiver(nic, NULL);
|
||||||
|
|
||||||
if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
|
if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
#define DRV_NAME "ehea"
|
#define DRV_NAME "ehea"
|
||||||
#define DRV_VERSION "EHEA_0061"
|
#define DRV_VERSION "EHEA_0064"
|
||||||
|
|
||||||
#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
|
#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
|
||||||
| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
|
| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
|
||||||
|
@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev,
|
|||||||
processed_rq3++;
|
processed_rq3++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
|
if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
|
||||||
|
&& port->vgrp)
|
||||||
vlan_hwaccel_receive_skb(skb, port->vgrp,
|
vlan_hwaccel_receive_skb(skb, port->vgrp,
|
||||||
cqe->vlan_tag);
|
cqe->vlan_tag);
|
||||||
else
|
else
|
||||||
@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grp)
|
memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
|
||||||
memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
|
|
||||||
else
|
|
||||||
memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter));
|
|
||||||
|
|
||||||
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
||||||
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
||||||
@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
index = (vid / 64);
|
index = (vid / 64);
|
||||||
cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F)));
|
cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F)));
|
||||||
|
|
||||||
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
||||||
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
||||||
@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
index = (vid / 64);
|
index = (vid / 64);
|
||||||
cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F)));
|
cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F)));
|
||||||
|
|
||||||
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
|
||||||
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
|
||||||
|
@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
|
|||||||
{
|
{
|
||||||
struct ibmveth_adapter *adapter = dev->priv;
|
struct ibmveth_adapter *adapter = dev->priv;
|
||||||
int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
|
int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
|
||||||
int i;
|
int reinit = 0;
|
||||||
|
int i, rc;
|
||||||
|
|
||||||
if (new_mtu < IBMVETH_MAX_MTU)
|
if (new_mtu < IBMVETH_MAX_MTU)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
for (i = 0; i < IbmVethNumBufferPools; i++)
|
||||||
|
if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == IbmVethNumBufferPools)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* Look for an active buffer pool that can hold the new MTU */
|
/* Look for an active buffer pool that can hold the new MTU */
|
||||||
for(i = 0; i<IbmVethNumBufferPools; i++) {
|
for(i = 0; i<IbmVethNumBufferPools; i++) {
|
||||||
if (!adapter->rx_buff_pool[i].active)
|
if (!adapter->rx_buff_pool[i].active) {
|
||||||
continue;
|
adapter->rx_buff_pool[i].active = 1;
|
||||||
|
reinit = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
|
if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
|
||||||
dev->mtu = new_mtu;
|
if (reinit && netif_running(adapter->netdev)) {
|
||||||
|
adapter->pool_config = 1;
|
||||||
|
ibmveth_close(adapter->netdev);
|
||||||
|
adapter->pool_config = 0;
|
||||||
|
dev->mtu = new_mtu;
|
||||||
|
if ((rc = ibmveth_open(adapter->netdev)))
|
||||||
|
return rc;
|
||||||
|
} else
|
||||||
|
dev->mtu = new_mtu;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1243,16 +1262,19 @@ const char * buf, size_t count)
|
|||||||
|
|
||||||
if (attr == &veth_active_attr) {
|
if (attr == &veth_active_attr) {
|
||||||
if (value && !pool->active) {
|
if (value && !pool->active) {
|
||||||
if(ibmveth_alloc_buffer_pool(pool)) {
|
if (netif_running(netdev)) {
|
||||||
ibmveth_error_printk("unable to alloc pool\n");
|
if(ibmveth_alloc_buffer_pool(pool)) {
|
||||||
return -ENOMEM;
|
ibmveth_error_printk("unable to alloc pool\n");
|
||||||
}
|
return -ENOMEM;
|
||||||
pool->active = 1;
|
}
|
||||||
adapter->pool_config = 1;
|
pool->active = 1;
|
||||||
ibmveth_close(netdev);
|
adapter->pool_config = 1;
|
||||||
adapter->pool_config = 0;
|
ibmveth_close(netdev);
|
||||||
if ((rc = ibmveth_open(netdev)))
|
adapter->pool_config = 0;
|
||||||
return rc;
|
if ((rc = ibmveth_open(netdev)))
|
||||||
|
return rc;
|
||||||
|
} else
|
||||||
|
pool->active = 1;
|
||||||
} else if (!value && pool->active) {
|
} else if (!value && pool->active) {
|
||||||
int mtu = netdev->mtu + IBMVETH_BUFF_OH;
|
int mtu = netdev->mtu + IBMVETH_BUFF_OH;
|
||||||
int i;
|
int i;
|
||||||
@ -1281,23 +1303,29 @@ const char * buf, size_t count)
|
|||||||
if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
|
if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
else {
|
else {
|
||||||
adapter->pool_config = 1;
|
if (netif_running(netdev)) {
|
||||||
ibmveth_close(netdev);
|
adapter->pool_config = 1;
|
||||||
adapter->pool_config = 0;
|
ibmveth_close(netdev);
|
||||||
pool->size = value;
|
adapter->pool_config = 0;
|
||||||
if ((rc = ibmveth_open(netdev)))
|
pool->size = value;
|
||||||
return rc;
|
if ((rc = ibmveth_open(netdev)))
|
||||||
|
return rc;
|
||||||
|
} else
|
||||||
|
pool->size = value;
|
||||||
}
|
}
|
||||||
} else if (attr == &veth_size_attr) {
|
} else if (attr == &veth_size_attr) {
|
||||||
if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
|
if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
else {
|
else {
|
||||||
adapter->pool_config = 1;
|
if (netif_running(netdev)) {
|
||||||
ibmveth_close(netdev);
|
adapter->pool_config = 1;
|
||||||
adapter->pool_config = 0;
|
ibmveth_close(netdev);
|
||||||
pool->buff_size = value;
|
adapter->pool_config = 0;
|
||||||
if ((rc = ibmveth_open(netdev)))
|
pool->buff_size = value;
|
||||||
return rc;
|
if ((rc = ibmveth_open(netdev)))
|
||||||
|
return rc;
|
||||||
|
} else
|
||||||
|
pool->buff_size = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#include "myri10ge_mcp.h"
|
#include "myri10ge_mcp.h"
|
||||||
#include "myri10ge_mcp_gen_header.h"
|
#include "myri10ge_mcp_gen_header.h"
|
||||||
|
|
||||||
#define MYRI10GE_VERSION_STR "1.3.0-1.233"
|
#define MYRI10GE_VERSION_STR "1.3.1-1.248"
|
||||||
|
|
||||||
MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
|
MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
|
||||||
MODULE_AUTHOR("Maintainer: help@myri.com");
|
MODULE_AUTHOR("Maintainer: help@myri.com");
|
||||||
@ -279,6 +279,8 @@ static int myri10ge_fill_thresh = 256;
|
|||||||
module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
|
module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
|
||||||
MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
|
MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
|
||||||
|
|
||||||
|
static int myri10ge_reset_recover = 1;
|
||||||
|
|
||||||
static int myri10ge_wcfifo = 0;
|
static int myri10ge_wcfifo = 0;
|
||||||
module_param(myri10ge_wcfifo, int, S_IRUGO);
|
module_param(myri10ge_wcfifo, int, S_IRUGO);
|
||||||
MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
|
MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
|
||||||
@ -1154,9 +1156,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
|
|||||||
struct mcp_irq_data *stats = mgp->fw_stats;
|
struct mcp_irq_data *stats = mgp->fw_stats;
|
||||||
|
|
||||||
if (unlikely(stats->stats_updated)) {
|
if (unlikely(stats->stats_updated)) {
|
||||||
if (mgp->link_state != stats->link_up) {
|
unsigned link_up = ntohl(stats->link_up);
|
||||||
mgp->link_state = stats->link_up;
|
if (mgp->link_state != link_up) {
|
||||||
if (mgp->link_state) {
|
mgp->link_state = link_up;
|
||||||
|
|
||||||
|
if (mgp->link_state == MXGEFW_LINK_UP) {
|
||||||
if (netif_msg_link(mgp))
|
if (netif_msg_link(mgp))
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"myri10ge: %s: link up\n",
|
"myri10ge: %s: link up\n",
|
||||||
@ -1166,8 +1170,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
|
|||||||
} else {
|
} else {
|
||||||
if (netif_msg_link(mgp))
|
if (netif_msg_link(mgp))
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"myri10ge: %s: link down\n",
|
"myri10ge: %s: link %s\n",
|
||||||
mgp->dev->name);
|
mgp->dev->name,
|
||||||
|
(link_up == MXGEFW_LINK_MYRINET ?
|
||||||
|
"mismatch (Myrinet detected)" :
|
||||||
|
"down"));
|
||||||
netif_carrier_off(mgp->dev);
|
netif_carrier_off(mgp->dev);
|
||||||
mgp->link_changes++;
|
mgp->link_changes++;
|
||||||
}
|
}
|
||||||
@ -2730,8 +2737,14 @@ static void myri10ge_watchdog(struct work_struct *work)
|
|||||||
* For now, just report it */
|
* For now, just report it */
|
||||||
reboot = myri10ge_read_reboot(mgp);
|
reboot = myri10ge_read_reboot(mgp);
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"myri10ge: %s: NIC rebooted (0x%x), resetting\n",
|
"myri10ge: %s: NIC rebooted (0x%x),%s resetting\n",
|
||||||
mgp->dev->name, reboot);
|
mgp->dev->name, reboot,
|
||||||
|
myri10ge_reset_recover ? " " : " not");
|
||||||
|
if (myri10ge_reset_recover == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
myri10ge_reset_recover--;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A rebooted nic will come back with config space as
|
* A rebooted nic will come back with config space as
|
||||||
* it was after power was applied to PCIe bus.
|
* it was after power was applied to PCIe bus.
|
||||||
|
@ -68,9 +68,10 @@
|
|||||||
#define _NETXEN_NIC_LINUX_SUBVERSION 2
|
#define _NETXEN_NIC_LINUX_SUBVERSION 2
|
||||||
#define NETXEN_NIC_LINUX_VERSIONID "3.4.2"
|
#define NETXEN_NIC_LINUX_VERSIONID "3.4.2"
|
||||||
|
|
||||||
#define NUM_FLASH_SECTORS (64)
|
#define NETXEN_NUM_FLASH_SECTORS (64)
|
||||||
#define FLASH_SECTOR_SIZE (64 * 1024)
|
#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
|
||||||
#define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE)
|
#define NETXEN_FLASH_TOTAL_SIZE (NETXEN_NUM_FLASH_SECTORS \
|
||||||
|
* NETXEN_FLASH_SECTOR_SIZE)
|
||||||
|
|
||||||
#define PHAN_VENDOR_ID 0x4040
|
#define PHAN_VENDOR_ID 0x4040
|
||||||
|
|
||||||
@ -677,28 +678,28 @@ struct netxen_new_user_info {
|
|||||||
|
|
||||||
/* Flash memory map */
|
/* Flash memory map */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CRBINIT_START = 0, /* Crbinit section */
|
NETXEN_CRBINIT_START = 0, /* Crbinit section */
|
||||||
BRDCFG_START = 0x4000, /* board config */
|
NETXEN_BRDCFG_START = 0x4000, /* board config */
|
||||||
INITCODE_START = 0x6000, /* pegtune code */
|
NETXEN_INITCODE_START = 0x6000, /* pegtune code */
|
||||||
BOOTLD_START = 0x10000, /* bootld */
|
NETXEN_BOOTLD_START = 0x10000, /* bootld */
|
||||||
IMAGE_START = 0x43000, /* compressed image */
|
NETXEN_IMAGE_START = 0x43000, /* compressed image */
|
||||||
SECONDARY_START = 0x200000, /* backup images */
|
NETXEN_SECONDARY_START = 0x200000, /* backup images */
|
||||||
PXE_START = 0x3E0000, /* user defined region */
|
NETXEN_PXE_START = 0x3E0000, /* user defined region */
|
||||||
USER_START = 0x3E8000, /* User defined region for new boards */
|
NETXEN_USER_START = 0x3E8000, /* User defined region for new boards */
|
||||||
FIXED_START = 0x3F0000 /* backup of crbinit */
|
NETXEN_FIXED_START = 0x3F0000 /* backup of crbinit */
|
||||||
} netxen_flash_map_t;
|
} netxen_flash_map_t;
|
||||||
|
|
||||||
#define USER_START_OLD PXE_START /* for backward compatibility */
|
#define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */
|
||||||
|
|
||||||
#define FLASH_START (CRBINIT_START)
|
#define NETXEN_FLASH_START (NETXEN_CRBINIT_START)
|
||||||
#define INIT_SECTOR (0)
|
#define NETXEN_INIT_SECTOR (0)
|
||||||
#define PRIMARY_START (BOOTLD_START)
|
#define NETXEN_PRIMARY_START (NETXEN_BOOTLD_START)
|
||||||
#define FLASH_CRBINIT_SIZE (0x4000)
|
#define NETXEN_FLASH_CRBINIT_SIZE (0x4000)
|
||||||
#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
|
#define NETXEN_FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
|
||||||
#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
|
#define NETXEN_FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
|
||||||
#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START)
|
#define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START)
|
||||||
#define NUM_PRIMARY_SECTORS (0x20)
|
#define NETXEN_NUM_PRIMARY_SECTORS (0x20)
|
||||||
#define NUM_CONFIG_SECTORS (1)
|
#define NETXEN_NUM_CONFIG_SECTORS (1)
|
||||||
#define PFX "NetXen: "
|
#define PFX "NetXen: "
|
||||||
extern char netxen_nic_driver_name[];
|
extern char netxen_nic_driver_name[];
|
||||||
|
|
||||||
@ -1048,6 +1049,7 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
|
|||||||
int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
|
int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
|
||||||
|
|
||||||
/* Functions from netxen_nic_isr.c */
|
/* Functions from netxen_nic_isr.c */
|
||||||
|
int netxen_nic_link_ok(struct netxen_adapter *adapter);
|
||||||
void netxen_nic_isr_other(struct netxen_adapter *adapter);
|
void netxen_nic_isr_other(struct netxen_adapter *adapter);
|
||||||
void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
|
void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
|
||||||
void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
|
void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
|
||||||
|
@ -94,7 +94,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
|
|||||||
|
|
||||||
static int netxen_nic_get_eeprom_len(struct net_device *dev)
|
static int netxen_nic_get_eeprom_len(struct net_device *dev)
|
||||||
{
|
{
|
||||||
return FLASH_TOTAL_SIZE;
|
return NETXEN_FLASH_TOTAL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -470,7 +470,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset == BOOTLD_START) {
|
if (offset == NETXEN_BOOTLD_START) {
|
||||||
ret = netxen_flash_erase_primary(adapter);
|
ret = netxen_flash_erase_primary(adapter);
|
||||||
if (ret != FLASH_SUCCESS) {
|
if (ret != FLASH_SUCCESS) {
|
||||||
printk(KERN_ERR "%s: Flash erase failed.\n",
|
printk(KERN_ERR "%s: Flash erase failed.\n",
|
||||||
@ -478,10 +478,10 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = netxen_rom_se(adapter, USER_START);
|
ret = netxen_rom_se(adapter, NETXEN_USER_START);
|
||||||
if (ret != FLASH_SUCCESS)
|
if (ret != FLASH_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
ret = netxen_rom_se(adapter, FIXED_START);
|
ret = netxen_rom_se(adapter, NETXEN_FIXED_START);
|
||||||
if (ret != FLASH_SUCCESS)
|
if (ret != FLASH_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ u64 ctx_addr_sig_regs[][3] = {
|
|||||||
#define ADDR_IN_RANGE(addr, low, high) \
|
#define ADDR_IN_RANGE(addr, low, high) \
|
||||||
(((addr) <= (high)) && ((addr) >= (low)))
|
(((addr) <= (high)) && ((addr) >= (low)))
|
||||||
|
|
||||||
#define NETXEN_FLASH_BASE (BOOTLD_START)
|
#define NETXEN_FLASH_BASE (NETXEN_BOOTLD_START)
|
||||||
#define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE)
|
#define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE)
|
||||||
#define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE
|
#define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE
|
||||||
#define NETXEN_MIN_MTU 64
|
#define NETXEN_MIN_MTU 64
|
||||||
@ -611,7 +611,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
|
|||||||
u32 *pmac = (u32 *) & mac[0];
|
u32 *pmac = (u32 *) & mac[0];
|
||||||
|
|
||||||
if (netxen_get_flash_block(adapter,
|
if (netxen_get_flash_block(adapter,
|
||||||
USER_START +
|
NETXEN_USER_START +
|
||||||
offsetof(struct netxen_new_user_info,
|
offsetof(struct netxen_new_user_info,
|
||||||
mac_addr),
|
mac_addr),
|
||||||
FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) {
|
FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) {
|
||||||
@ -619,7 +619,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
|
|||||||
}
|
}
|
||||||
if (*mac == ~0ULL) {
|
if (*mac == ~0ULL) {
|
||||||
if (netxen_get_flash_block(adapter,
|
if (netxen_get_flash_block(adapter,
|
||||||
USER_START_OLD +
|
NETXEN_USER_START_OLD +
|
||||||
offsetof(struct netxen_user_old_info,
|
offsetof(struct netxen_user_old_info,
|
||||||
mac_addr),
|
mac_addr),
|
||||||
FLASH_NUM_PORTS * sizeof(u64),
|
FLASH_NUM_PORTS * sizeof(u64),
|
||||||
@ -942,7 +942,7 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
|
|||||||
int
|
int
|
||||||
netxen_nic_erase_pxe(struct netxen_adapter *adapter)
|
netxen_nic_erase_pxe(struct netxen_adapter *adapter)
|
||||||
{
|
{
|
||||||
if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) {
|
if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) {
|
||||||
printk(KERN_ERR "%s: erase pxe failed\n",
|
printk(KERN_ERR "%s: erase pxe failed\n",
|
||||||
netxen_nic_driver_name);
|
netxen_nic_driver_name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -953,7 +953,7 @@ netxen_nic_erase_pxe(struct netxen_adapter *adapter)
|
|||||||
int netxen_nic_get_board_info(struct netxen_adapter *adapter)
|
int netxen_nic_get_board_info(struct netxen_adapter *adapter)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
int addr = BRDCFG_START;
|
int addr = NETXEN_BRDCFG_START;
|
||||||
struct netxen_board_info *boardinfo;
|
struct netxen_board_info *boardinfo;
|
||||||
int index;
|
int index;
|
||||||
u32 *ptr32;
|
u32 *ptr32;
|
||||||
@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
|
|||||||
u32 fw_build = 0;
|
u32 fw_build = 0;
|
||||||
char brd_name[NETXEN_MAX_SHORT_NAME];
|
char brd_name[NETXEN_MAX_SHORT_NAME];
|
||||||
struct netxen_new_user_info user_info;
|
struct netxen_new_user_info user_info;
|
||||||
int i, addr = USER_START;
|
int i, addr = NETXEN_USER_START;
|
||||||
__le32 *ptr32;
|
__le32 *ptr32;
|
||||||
|
|
||||||
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
|
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
|
||||||
|
@ -585,7 +585,7 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
|
|||||||
{
|
{
|
||||||
int ret = FLASH_SUCCESS;
|
int ret = FLASH_SUCCESS;
|
||||||
int val;
|
int val;
|
||||||
char *buffer = kmalloc(FLASH_SECTOR_SIZE, GFP_KERNEL);
|
char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL);
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -601,13 +601,13 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
|
|||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
|
|
||||||
/* copy sector 0 to sector 63 */
|
/* copy sector 0 to sector 63 */
|
||||||
ret = netxen_rom_fast_read_words(adapter, CRBINIT_START,
|
ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START,
|
||||||
buffer, FLASH_SECTOR_SIZE);
|
buffer, NETXEN_FLASH_SECTOR_SIZE);
|
||||||
if (ret != FLASH_SUCCESS)
|
if (ret != FLASH_SUCCESS)
|
||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
|
|
||||||
ret = netxen_rom_fast_write_words(adapter, FIXED_START,
|
ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START,
|
||||||
buffer, FLASH_SECTOR_SIZE);
|
buffer, NETXEN_FLASH_SECTOR_SIZE);
|
||||||
if (ret != FLASH_SUCCESS)
|
if (ret != FLASH_SUCCESS)
|
||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
|
|
||||||
@ -654,7 +654,8 @@ void check_erased_flash(struct netxen_adapter *adapter, int addr)
|
|||||||
int count = 0, erased_errors = 0;
|
int count = 0, erased_errors = 0;
|
||||||
int range;
|
int range;
|
||||||
|
|
||||||
range = (addr == USER_START) ? FIXED_START : addr + FLASH_SECTOR_SIZE;
|
range = (addr == NETXEN_USER_START) ?
|
||||||
|
NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE;
|
||||||
|
|
||||||
for (i = addr; i < range; i += 4) {
|
for (i = addr; i < range; i += 4) {
|
||||||
netxen_rom_fast_read(adapter, i, &val);
|
netxen_rom_fast_read(adapter, i, &val);
|
||||||
@ -689,7 +690,7 @@ netxen_flash_erase_sections(struct netxen_adapter *adapter, int start, int end)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = start; i < end; i++) {
|
for (i = start; i < end; i++) {
|
||||||
ret = netxen_rom_se(adapter, i * FLASH_SECTOR_SIZE);
|
ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
ret = netxen_rom_wip_poll(adapter);
|
ret = netxen_rom_wip_poll(adapter);
|
||||||
@ -706,8 +707,8 @@ netxen_flash_erase_secondary(struct netxen_adapter *adapter)
|
|||||||
int ret = FLASH_SUCCESS;
|
int ret = FLASH_SUCCESS;
|
||||||
int start, end;
|
int start, end;
|
||||||
|
|
||||||
start = SECONDARY_START / FLASH_SECTOR_SIZE;
|
start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
|
||||||
end = USER_START / FLASH_SECTOR_SIZE;
|
end = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE;
|
||||||
ret = netxen_flash_erase_sections(adapter, start, end);
|
ret = netxen_flash_erase_sections(adapter, start, end);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -719,8 +720,8 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter)
|
|||||||
int ret = FLASH_SUCCESS;
|
int ret = FLASH_SUCCESS;
|
||||||
int start, end;
|
int start, end;
|
||||||
|
|
||||||
start = PRIMARY_START / FLASH_SECTOR_SIZE;
|
start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE;
|
||||||
end = SECONDARY_START / FLASH_SECTOR_SIZE;
|
end = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
|
||||||
ret = netxen_flash_erase_sections(adapter, start, end);
|
ret = netxen_flash_erase_sections(adapter, start, end);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1036,18 +1037,23 @@ void netxen_watchdog_task(struct work_struct *work)
|
|||||||
if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter))
|
if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
netdev = adapter->netdev;
|
|
||||||
if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) {
|
|
||||||
printk(KERN_INFO "%s port %d, %s carrier is now ok\n",
|
|
||||||
netxen_nic_driver_name, adapter->portnum, netdev->name);
|
|
||||||
netif_carrier_on(netdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (netif_queue_stopped(netdev))
|
|
||||||
netif_wake_queue(netdev);
|
|
||||||
|
|
||||||
if (adapter->handle_phy_intr)
|
if (adapter->handle_phy_intr)
|
||||||
adapter->handle_phy_intr(adapter);
|
adapter->handle_phy_intr(adapter);
|
||||||
|
|
||||||
|
netdev = adapter->netdev;
|
||||||
|
if ((netif_running(netdev)) && !netif_carrier_ok(netdev) &&
|
||||||
|
netxen_nic_link_ok(adapter) ) {
|
||||||
|
printk(KERN_INFO "%s %s (port %d), Link is up\n",
|
||||||
|
netxen_nic_driver_name, netdev->name, adapter->portnum);
|
||||||
|
netif_carrier_on(netdev);
|
||||||
|
netif_wake_queue(netdev);
|
||||||
|
} else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) {
|
||||||
|
printk(KERN_ERR "%s %s Link is Down\n",
|
||||||
|
netxen_nic_driver_name, netdev->name);
|
||||||
|
netif_carrier_off(netdev);
|
||||||
|
netif_stop_queue(netdev);
|
||||||
|
}
|
||||||
|
|
||||||
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
|
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +169,24 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter)
|
|||||||
netxen_nic_isr_other(adapter);
|
netxen_nic_isr_other(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int netxen_nic_link_ok(struct netxen_adapter *adapter)
|
||||||
|
{
|
||||||
|
switch (adapter->ahw.board_type) {
|
||||||
|
case NETXEN_NIC_GBE:
|
||||||
|
return ((adapter->ahw.qg_linksup) & 1);
|
||||||
|
|
||||||
|
case NETXEN_NIC_XGBE:
|
||||||
|
return ((adapter->ahw.xg_linkup) & 1);
|
||||||
|
|
||||||
|
default:
|
||||||
|
printk(KERN_ERR"%s: Function: %s, Unknown board type\n",
|
||||||
|
netxen_nic_driver_name, __FUNCTION__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct net_device *netdev = adapter->netdev;
|
struct net_device *netdev = adapter->netdev;
|
||||||
@ -183,6 +201,10 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
|||||||
printk(KERN_INFO "%s: %s NIC Link is down\n",
|
printk(KERN_INFO "%s: %s NIC Link is down\n",
|
||||||
netxen_nic_driver_name, netdev->name);
|
netxen_nic_driver_name, netdev->name);
|
||||||
adapter->ahw.xg_linkup = 0;
|
adapter->ahw.xg_linkup = 0;
|
||||||
|
if (netif_running(netdev)) {
|
||||||
|
netif_carrier_off(netdev);
|
||||||
|
netif_stop_queue(netdev);
|
||||||
|
}
|
||||||
/* read twice to clear sticky bits */
|
/* read twice to clear sticky bits */
|
||||||
/* WINDOW = 0 */
|
/* WINDOW = 0 */
|
||||||
netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1);
|
netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1);
|
||||||
@ -196,5 +218,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
|||||||
printk(KERN_INFO "%s: %s NIC Link is up\n",
|
printk(KERN_INFO "%s: %s NIC Link is up\n",
|
||||||
netxen_nic_driver_name, netdev->name);
|
netxen_nic_driver_name, netdev->name);
|
||||||
adapter->ahw.xg_linkup = 1;
|
adapter->ahw.xg_linkup = 1;
|
||||||
|
netif_carrier_on(netdev);
|
||||||
|
netif_wake_queue(netdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,6 +542,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
|
NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
|
||||||
/* Handshake with the card before we register the devices. */
|
/* Handshake with the card before we register the devices. */
|
||||||
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
||||||
|
|
||||||
|
/* leave the hw in the same state as reboot */
|
||||||
|
writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
|
||||||
|
netxen_pinit_from_rom(adapter, 0);
|
||||||
|
udelay(500);
|
||||||
|
netxen_load_firmware(adapter);
|
||||||
|
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -454,16 +454,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
|
|||||||
|
|
||||||
int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
|
int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
|
||||||
{
|
{
|
||||||
u32 reg;
|
|
||||||
u32 portnum = physical_port[adapter->portnum];
|
u32 portnum = physical_port[adapter->portnum];
|
||||||
|
|
||||||
netxen_crb_writelit_adapter(adapter,
|
netxen_crb_writelit_adapter(adapter,
|
||||||
NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5);
|
NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447);
|
||||||
netxen_nic_hw_read_wx(adapter,
|
|
||||||
NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), ®, 4);
|
|
||||||
reg = (reg & ~0x2000UL);
|
|
||||||
netxen_crb_writelit_adapter(adapter,
|
netxen_crb_writelit_adapter(adapter,
|
||||||
NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), reg);
|
NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,12 @@
|
|||||||
#define MII_M1111_PHY_LED_CONTROL 0x18
|
#define MII_M1111_PHY_LED_CONTROL 0x18
|
||||||
#define MII_M1111_PHY_LED_DIRECT 0x4100
|
#define MII_M1111_PHY_LED_DIRECT 0x4100
|
||||||
#define MII_M1111_PHY_LED_COMBINE 0x411c
|
#define MII_M1111_PHY_LED_COMBINE 0x411c
|
||||||
|
#define MII_M1111_PHY_EXT_CR 0x14
|
||||||
|
#define MII_M1111_RX_DELAY 0x80
|
||||||
|
#define MII_M1111_TX_DELAY 0x2
|
||||||
|
#define MII_M1111_PHY_EXT_SR 0x1b
|
||||||
|
#define MII_M1111_HWCFG_MODE_MASK 0xf
|
||||||
|
#define MII_M1111_HWCFG_MODE_RGMII 0xb
|
||||||
|
|
||||||
MODULE_DESCRIPTION("Marvell PHY driver");
|
MODULE_DESCRIPTION("Marvell PHY driver");
|
||||||
MODULE_AUTHOR("Andy Fleming");
|
MODULE_AUTHOR("Andy Fleming");
|
||||||
@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int m88e1111_config_init(struct phy_device *phydev)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
|
||||||
|
(phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
|
||||||
|
int temp;
|
||||||
|
|
||||||
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
|
||||||
|
temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
|
||||||
|
if (temp < 0)
|
||||||
|
return temp;
|
||||||
|
|
||||||
|
temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
|
||||||
|
|
||||||
|
err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
|
||||||
|
if (temp < 0)
|
||||||
|
return temp;
|
||||||
|
|
||||||
|
temp &= ~(MII_M1111_HWCFG_MODE_MASK);
|
||||||
|
temp |= MII_M1111_HWCFG_MODE_RGMII;
|
||||||
|
|
||||||
|
err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = phy_write(phydev, MII_BMCR, BMCR_RESET);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int m88e1145_config_init(struct phy_device *phydev)
|
static int m88e1145_config_init(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
|
||||||
int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
|
int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
|
||||||
if (temp < 0)
|
if (temp < 0)
|
||||||
return temp;
|
return temp;
|
||||||
@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
|
|||||||
.driver = {.owner = THIS_MODULE,},
|
.driver = {.owner = THIS_MODULE,},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct phy_driver m88e1111s_driver = {
|
static struct phy_driver m88e1111_driver = {
|
||||||
.phy_id = 0x01410cc0,
|
.phy_id = 0x01410cc0,
|
||||||
.phy_id_mask = 0xfffffff0,
|
.phy_id_mask = 0xfffffff0,
|
||||||
.name = "Marvell 88E1111",
|
.name = "Marvell 88E1111",
|
||||||
@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = {
|
|||||||
.read_status = &genphy_read_status,
|
.read_status = &genphy_read_status,
|
||||||
.ack_interrupt = &marvell_ack_interrupt,
|
.ack_interrupt = &marvell_ack_interrupt,
|
||||||
.config_intr = &marvell_config_intr,
|
.config_intr = &marvell_config_intr,
|
||||||
|
.config_init = &m88e1111_config_init,
|
||||||
.driver = {.owner = THIS_MODULE,},
|
.driver = {.owner = THIS_MODULE,},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -241,9 +287,9 @@ static int __init marvell_init(void)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = phy_driver_register(&m88e1111s_driver);
|
ret = phy_driver_register(&m88e1111_driver);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err1111s;
|
goto err1111;
|
||||||
|
|
||||||
ret = phy_driver_register(&m88e1145_driver);
|
ret = phy_driver_register(&m88e1145_driver);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -251,9 +297,9 @@ static int __init marvell_init(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err1145:
|
err1145:
|
||||||
phy_driver_unregister(&m88e1111s_driver);
|
phy_driver_unregister(&m88e1111_driver);
|
||||||
err1111s:
|
err1111:
|
||||||
phy_driver_unregister(&m88e1101_driver);
|
phy_driver_unregister(&m88e1101_driver);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -261,7 +307,7 @@ static int __init marvell_init(void)
|
|||||||
static void __exit marvell_exit(void)
|
static void __exit marvell_exit(void)
|
||||||
{
|
{
|
||||||
phy_driver_unregister(&m88e1101_driver);
|
phy_driver_unregister(&m88e1101_driver);
|
||||||
phy_driver_unregister(&m88e1111s_driver);
|
phy_driver_unregister(&m88e1111_driver);
|
||||||
phy_driver_unregister(&m88e1145_driver);
|
phy_driver_unregister(&m88e1145_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,8 +313,8 @@ config USB_KC2190
|
|||||||
boolean "KT Technology KC2190 based cables (InstaNet)"
|
boolean "KT Technology KC2190 based cables (InstaNet)"
|
||||||
depends on USB_NET_CDC_SUBSET && EXPERIMENTAL
|
depends on USB_NET_CDC_SUBSET && EXPERIMENTAL
|
||||||
help
|
help
|
||||||
Choose this option if you're using a host-to-host cable
|
Choose this option if you're using a host-to-host cable
|
||||||
with one of these chips.
|
with one of these chips.
|
||||||
|
|
||||||
config USB_NET_ZAURUS
|
config USB_NET_ZAURUS
|
||||||
tristate "Sharp Zaurus (stock ROMs) and compatible"
|
tristate "Sharp Zaurus (stock ROMs) and compatible"
|
||||||
|
@ -1562,7 +1562,7 @@ static void velocity_print_link_status(struct velocity_info *vptr)
|
|||||||
if (vptr->mii_status & VELOCITY_LINK_FAIL) {
|
if (vptr->mii_status & VELOCITY_LINK_FAIL) {
|
||||||
VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name);
|
VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name);
|
||||||
} else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
|
} else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
|
||||||
VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link autonegation", vptr->dev->name);
|
VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name);
|
||||||
|
|
||||||
if (vptr->mii_status & VELOCITY_SPEED_1000)
|
if (vptr->mii_status & VELOCITY_SPEED_1000)
|
||||||
VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
|
VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
|
||||||
|
@ -266,16 +266,23 @@ config IPW2200_DEBUG
|
|||||||
|
|
||||||
If you are not sure, say N here.
|
If you are not sure, say N here.
|
||||||
|
|
||||||
config LIBERTAS_USB
|
config LIBERTAS
|
||||||
tristate "Marvell Libertas 8388 802.11a/b/g cards"
|
tristate "Marvell 8xxx Libertas WLAN driver support"
|
||||||
depends on USB && WLAN_80211
|
depends on WLAN_80211
|
||||||
|
select IEEE80211
|
||||||
select FW_LOADER
|
select FW_LOADER
|
||||||
|
---help---
|
||||||
|
A library for Marvell Libertas 8xxx devices.
|
||||||
|
|
||||||
|
config LIBERTAS_USB
|
||||||
|
tristate "Marvell Libertas 8388 USB 802.11b/g cards"
|
||||||
|
depends on LIBERTAS && USB
|
||||||
---help---
|
---help---
|
||||||
A driver for Marvell Libertas 8388 USB devices.
|
A driver for Marvell Libertas 8388 USB devices.
|
||||||
|
|
||||||
config LIBERTAS_USB_DEBUG
|
config LIBERTAS_DEBUG
|
||||||
bool "Enable full debugging output in the Libertas USB module."
|
bool "Enable full debugging output in the Libertas module."
|
||||||
depends on LIBERTAS_USB
|
depends on LIBERTAS
|
||||||
---help---
|
---help---
|
||||||
Debugging support.
|
Debugging support.
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
|
|||||||
|
|
||||||
for (i = 0; i < cfp_no; i++) {
|
for (i = 0; i < cfp_no; i++) {
|
||||||
if ((cfp + i)->channel == firstchan) {
|
if ((cfp + i)->channel == firstchan) {
|
||||||
lbs_pr_debug(1, "firstchan found\n");
|
lbs_deb_11d("firstchan found\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan,
|
|||||||
|
|
||||||
for (i = 0; i < nr_chan; i++) {
|
for (i = 0; i < nr_chan; i++) {
|
||||||
if (chan == chanpwr[i].chan) {
|
if (chan == chanpwr[i].chan) {
|
||||||
lbs_pr_debug(1, "11D: Found Chan:%d\n", chan);
|
lbs_deb_11d("11D: Found Chan:%d\n", chan);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan);
|
lbs_deb_11d("11D: Not Find Chan:%d\n", chan);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
|
|||||||
memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
|
memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
|
||||||
COUNTRY_CODE_LEN);
|
COUNTRY_CODE_LEN);
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan);
|
lbs_deb_11d("11D:nrchan=%d\n", nr_chan);
|
||||||
lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
|
lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
|
||||||
sizeof(struct parsed_region_chan_11d));
|
sizeof(struct parsed_region_chan_11d));
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
|
|||||||
}
|
}
|
||||||
domaininfo->nr_subband = nr_subband;
|
domaininfo->nr_subband = nr_subband;
|
||||||
|
|
||||||
lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband);
|
lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
|
||||||
lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
|
lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
|
||||||
COUNTRY_CODE_LEN + 1 +
|
COUNTRY_CODE_LEN + 1 +
|
||||||
sizeof(struct ieeetypes_subbandset) * nr_subband);
|
sizeof(struct ieeetypes_subbandset) * nr_subband);
|
||||||
@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
|
|||||||
struct chan_freq_power *cfp;
|
struct chan_freq_power *cfp;
|
||||||
|
|
||||||
if (region_chan == NULL) {
|
if (region_chan == NULL) {
|
||||||
lbs_pr_debug(1, "11D: region_chan is NULL\n");
|
lbs_deb_11d("11D: region_chan is NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfp = region_chan->CFP;
|
cfp = region_chan->CFP;
|
||||||
if (cfp == NULL) {
|
if (cfp == NULL) {
|
||||||
lbs_pr_debug(1, "11D: cfp equal NULL \n");
|
lbs_deb_11d("11D: cfp equal NULL \n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
|
|||||||
memcpy(parsed_region_chan->countrycode,
|
memcpy(parsed_region_chan->countrycode,
|
||||||
wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
|
wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
|
lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
|
||||||
parsed_region_chan->band);
|
parsed_region_chan->band);
|
||||||
|
|
||||||
for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
|
for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
|
||||||
parsed_region_chan->chanpwr[i].chan = cfp->channel;
|
parsed_region_chan->chanpwr[i].chan = cfp->channel;
|
||||||
parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
|
parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
|
||||||
lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n",
|
lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n",
|
||||||
parsed_region_chan->chanpwr[i].chan,
|
parsed_region_chan->chanpwr[i].chan,
|
||||||
parsed_region_chan->chanpwr[i].pwr);
|
parsed_region_chan->chanpwr[i].pwr);
|
||||||
}
|
}
|
||||||
parsed_region_chan->nr_chan = region_chan->nrcfp;
|
parsed_region_chan->nr_chan = region_chan->nrcfp;
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
|
lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
|
|||||||
struct chan_freq_power *cfp;
|
struct chan_freq_power *cfp;
|
||||||
int cfp_no;
|
int cfp_no;
|
||||||
u8 idx;
|
u8 idx;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
|
|
||||||
cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
|
cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
|
||||||
if (cfp == NULL)
|
if (cfp == NULL)
|
||||||
@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
|
|||||||
if (chan == (cfp + idx)->channel) {
|
if (chan == (cfp + idx)->channel) {
|
||||||
/* If Mrvl Chip Supported? */
|
/* If Mrvl Chip Supported? */
|
||||||
if ((cfp + idx)->unsupported) {
|
if ((cfp + idx)->unsupported) {
|
||||||
return 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*chan is not in the region table */
|
/*chan is not in the region table */
|
||||||
LEAVE();
|
|
||||||
return 0;
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
|
|
||||||
u8 j, i;
|
u8 j, i;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
|
|
||||||
/*validation Rules:
|
/*validation Rules:
|
||||||
1. valid region Code
|
1. valid region Code
|
||||||
@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
if ((*(countryinfo->countrycode)) == 0
|
if ((*(countryinfo->countrycode)) == 0
|
||||||
|| (countryinfo->len <= COUNTRY_CODE_LEN)) {
|
|| (countryinfo->len <= COUNTRY_CODE_LEN)) {
|
||||||
/* No region Info or Wrong region info: treat as No 11D info */
|
/* No region Info or Wrong region info: treat as No 11D info */
|
||||||
LEAVE();
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Step1: check region_code */
|
/*Step1: check region_code */
|
||||||
parsed_region_chan->region = region =
|
parsed_region_chan->region = region =
|
||||||
wlan_region_2_code(countryinfo->countrycode);
|
wlan_region_2_code(countryinfo->countrycode);
|
||||||
|
|
||||||
lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region);
|
lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region);
|
||||||
lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
|
lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
|
||||||
COUNTRY_CODE_LEN);
|
COUNTRY_CODE_LEN);
|
||||||
|
|
||||||
@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
|
|
||||||
if (countryinfo->subband[j].firstchan <= lastchan) {
|
if (countryinfo->subband[j].firstchan <= lastchan) {
|
||||||
/*Step2&3. Check First Chan Num increment and no overlap */
|
/*Step2&3. Check First Chan Num increment and no overlap */
|
||||||
lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n",
|
lbs_deb_11d("11D: Chan[%d>%d] Overlap\n",
|
||||||
countryinfo->subband[j].firstchan, lastchan);
|
countryinfo->subband[j].firstchan, lastchan);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
|
|
||||||
if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
|
if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
|
||||||
/* Chan is not found in UN table */
|
/* Chan is not found in UN table */
|
||||||
lbs_pr_debug(1, "chan is not supported: %d \n", i);
|
lbs_deb_11d("chan is not supported: %d \n", i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
idx++;
|
idx++;
|
||||||
} else {
|
} else {
|
||||||
/*not supported and ignore the chan */
|
/*not supported and ignore the chan */
|
||||||
lbs_pr_debug(1,
|
lbs_deb_11d(
|
||||||
"11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
|
"11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
|
||||||
i, curchan, region, band);
|
i, curchan, region, band);
|
||||||
}
|
}
|
||||||
@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||||||
|
|
||||||
parsed_region_chan->nr_chan = idx;
|
parsed_region_chan->nr_chan = idx;
|
||||||
|
|
||||||
lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan);
|
lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan);
|
||||||
lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
|
lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
|
||||||
2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
|
2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan,
|
|||||||
{
|
{
|
||||||
u8 scan_type = cmd_scan_type_passive;
|
u8 scan_type = cmd_scan_type_passive;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
|
|
||||||
if (wlan_channel_known_11d(chan, parsed_region_chan)) {
|
if (wlan_channel_known_11d(chan, parsed_region_chan)) {
|
||||||
lbs_pr_debug(1, "11D: Found and do Active Scan\n");
|
lbs_deb_11d("11D: Found and do Active Scan\n");
|
||||||
scan_type = cmd_scan_type_active;
|
scan_type = cmd_scan_type_active;
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n");
|
lbs_deb_11d("11D: Not Find and do Passive Scan\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type);
|
||||||
return scan_type;
|
return scan_type;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag)
|
|||||||
OID_802_11D_ENABLE,
|
OID_802_11D_ENABLE,
|
||||||
&priv->adapter->enable11d);
|
&priv->adapter->enable11d);
|
||||||
if (ret)
|
if (ret)
|
||||||
lbs_pr_debug(1, "11D: Fail to enable 11D \n");
|
lbs_deb_11d("11D: Fail to enable 11D \n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!priv->adapter->enable11d) {
|
if (!priv->adapter->enable11d) {
|
||||||
lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n");
|
lbs_deb_11d("11D: dnld domain Info with 11d disabled\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv)
|
|||||||
cmd_act_set,
|
cmd_act_set,
|
||||||
cmd_option_waitforrsp, 0, NULL);
|
cmd_option_waitforrsp, 0, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
lbs_pr_debug(1, "11D: Fail to dnld domain Info\n");
|
lbs_deb_11d("11D: Fail to dnld domain Info\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band)
|
|||||||
|
|
||||||
adapter->universal_channel[i].nrcfp =
|
adapter->universal_channel[i].nrcfp =
|
||||||
sizeof(channel_freq_power_UN_BG) / size;
|
sizeof(channel_freq_power_UN_BG) / size;
|
||||||
lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n",
|
lbs_deb_11d("11D: BG-band nrcfp=%d\n",
|
||||||
adapter->universal_channel[i].nrcfp);
|
adapter->universal_channel[i].nrcfp);
|
||||||
|
|
||||||
adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
|
adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
|
||||||
@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
u8 nr_subband = adapter->domainreg.nr_subband;
|
u8 nr_subband = adapter->domainreg.nr_subband;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
|
|
||||||
lbs_pr_debug(1, "nr_subband=%x\n", nr_subband);
|
lbs_deb_11d("nr_subband=%x\n", nr_subband);
|
||||||
|
|
||||||
cmd->command = cpu_to_le16(cmdno);
|
cmd->command = cpu_to_le16(cmdno);
|
||||||
pdomaininfo->action = cpu_to_le16(cmdoption);
|
pdomaininfo->action = cpu_to_le16(cmdoption);
|
||||||
@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
|
|||||||
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
|
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
|
||||||
lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
|
lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
|
||||||
(int)(cmd->size));
|
(int)(cmd->size));
|
||||||
LEAVE();
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
|
domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
|
||||||
@ -567,10 +570,10 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
|
|||||||
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
|
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size));
|
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size));
|
||||||
|
|
||||||
LEAVE();
|
|
||||||
|
|
||||||
|
done:
|
||||||
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
|
|||||||
int data = 0;
|
int data = 0;
|
||||||
int *val;
|
int *val;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
data = SUBCMD_DATA(wrq);
|
data = SUBCMD_DATA(wrq);
|
||||||
|
|
||||||
lbs_pr_debug(1, "enable 11D: %s\n",
|
lbs_deb_11d("enable 11D: %s\n",
|
||||||
(data == 1) ? "enable" : "Disable");
|
(data == 1) ? "enable" : "Disable");
|
||||||
|
|
||||||
wlan_enable_11d(priv, data);
|
wlan_enable_11d(priv, data);
|
||||||
val = (int *)wrq->u.name;
|
val = (int *)wrq->u.name;
|
||||||
*val = priv->adapter->enable11d;
|
*val = priv->adapter->enable11d;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,25 +611,24 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
|
|||||||
int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
struct cmd_ds_802_11d_domain_info
|
struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
|
||||||
*domaininfo = &resp->params.domaininforesp;
|
|
||||||
struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
|
struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
|
||||||
u16 action = le16_to_cpu(domaininfo->action);
|
u16 action = le16_to_cpu(domaininfo->action);
|
||||||
s16 ret = 0;
|
s16 ret = 0;
|
||||||
u8 nr_subband = 0;
|
u8 nr_subband = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
|
|
||||||
lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
|
lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
|
||||||
(int)le16_to_cpu(resp->size));
|
(int)le16_to_cpu(resp->size));
|
||||||
|
|
||||||
nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset);
|
nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
|
||||||
/* countrycode 3 bytes */
|
sizeof(struct ieeetypes_subbandset);
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband);
|
lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
|
||||||
|
|
||||||
if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
|
if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
|
||||||
lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n");
|
lbs_deb_11d("Invalid Numrer of Subband returned!!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,12 +639,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
|||||||
case cmd_act_get:
|
case cmd_act_get:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action);
|
lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,23 +653,22 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
|||||||
* @param priv pointer to wlan_private
|
* @param priv pointer to wlan_private
|
||||||
* @return 0; -1
|
* @return 0; -1
|
||||||
*/
|
*/
|
||||||
int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
|
int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
|
||||||
|
struct bss_descriptor * bss)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
if (priv->adapter->enable11d) {
|
if (priv->adapter->enable11d) {
|
||||||
memset(&adapter->parsed_region_chan, 0,
|
memset(&adapter->parsed_region_chan, 0,
|
||||||
sizeof(struct parsed_region_chan_11d));
|
sizeof(struct parsed_region_chan_11d));
|
||||||
ret = parse_domain_info_11d(&adapter->pattemptedbssdesc->
|
ret = parse_domain_info_11d(&bss->countryinfo, 0,
|
||||||
countryinfo, 0,
|
|
||||||
&adapter->parsed_region_chan);
|
&adapter->parsed_region_chan);
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n");
|
lbs_deb_11d("11D: Err Parse domain_info from AP..\n");
|
||||||
LEAVE();
|
goto done;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&adapter->domainreg, 0,
|
memset(&adapter->domainreg, 0,
|
||||||
@ -678,13 +679,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
|
|||||||
ret = set_domain_info_11d(priv);
|
ret = set_domain_info_11d(priv);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
|
lbs_deb_11d("11D: Err set domainInfo to FW\n");
|
||||||
LEAVE();
|
goto done;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LEAVE();
|
ret = 0;
|
||||||
return 0;
|
|
||||||
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -699,8 +702,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
|
|||||||
struct region_channel *region_chan;
|
struct region_channel *region_chan;
|
||||||
u8 j;
|
u8 j;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_11D);
|
||||||
lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
|
lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
|
||||||
|
|
||||||
if (priv->adapter->enable11d) {
|
if (priv->adapter->enable11d) {
|
||||||
/* update parsed_region_chan_11; dnld domaininf to FW */
|
/* update parsed_region_chan_11; dnld domaininf to FW */
|
||||||
@ -709,7 +712,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
|
|||||||
sizeof(adapter->region_channel[0]); j++) {
|
sizeof(adapter->region_channel[0]); j++) {
|
||||||
region_chan = &adapter->region_channel[j];
|
region_chan = &adapter->region_channel[j];
|
||||||
|
|
||||||
lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j,
|
lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j,
|
||||||
region_chan->band);
|
region_chan->band);
|
||||||
|
|
||||||
if (!region_chan || !region_chan->valid
|
if (!region_chan || !region_chan->valid
|
||||||
@ -722,10 +725,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
|
|||||||
|
|
||||||
if (j >= sizeof(adapter->region_channel) /
|
if (j >= sizeof(adapter->region_channel) /
|
||||||
sizeof(adapter->region_channel[0])) {
|
sizeof(adapter->region_channel[0])) {
|
||||||
lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n",
|
lbs_deb_11d("11D:region_chan not found. band[%d]\n",
|
||||||
adapter->curbssparams.band);
|
adapter->curbssparams.band);
|
||||||
LEAVE();
|
ret = -1;
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&adapter->parsed_region_chan, 0,
|
memset(&adapter->parsed_region_chan, 0,
|
||||||
@ -742,13 +745,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
|
|||||||
ret = set_domain_info_11d(priv);
|
ret = set_domain_info_11d(priv);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
|
lbs_deb_11d("11D: Err set domainInfo to FW\n");
|
||||||
LEAVE();
|
goto done;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
return 0;
|
lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11d_domain_info {
|
struct cmd_ds_802_11d_domain_info {
|
||||||
u16 action;
|
__le16 action;
|
||||||
struct mrvlietypes_domainparamset domain;
|
struct mrvlietypes_domainparamset domain;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
@ -98,7 +98,9 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq);
|
|||||||
int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
int libertas_ret_802_11d_domain_info(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp);
|
struct cmd_ds_command *resp);
|
||||||
|
|
||||||
int libertas_parse_dnld_countryinfo_11d(wlan_private * priv);
|
struct bss_descriptor;
|
||||||
|
int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
|
||||||
|
struct bss_descriptor * bss);
|
||||||
|
|
||||||
int libertas_create_dnld_countryinfo_11d(wlan_private * priv);
|
int libertas_create_dnld_countryinfo_11d(wlan_private * priv);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
usb8xxx-objs := main.o fw.o wext.o \
|
libertas-objs := main.o fw.o wext.o \
|
||||||
rx.o tx.o cmd.o \
|
rx.o tx.o cmd.o \
|
||||||
cmdresp.o scan.o \
|
cmdresp.o scan.o \
|
||||||
join.o 11d.o \
|
join.o 11d.o \
|
||||||
@ -8,5 +8,5 @@ usb8xxx-objs := main.o fw.o wext.o \
|
|||||||
usb8xxx-objs += if_bootcmd.o
|
usb8xxx-objs += if_bootcmd.o
|
||||||
usb8xxx-objs += if_usb.o
|
usb8xxx-objs += if_usb.o
|
||||||
|
|
||||||
|
obj-$(CONFIG_LIBERTAS) += libertas.o
|
||||||
obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
|
obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
================================================================================
|
================================================================================
|
||||||
README for USB8388
|
README for USB8388
|
||||||
|
|
||||||
(c) Copyright © 2003-2006, Marvell International Ltd.
|
(c) Copyright © 2003-2006, Marvell International Ltd.
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
This software file (the "File") is distributed by Marvell International
|
This software file (the "File") is distributed by Marvell International
|
||||||
@ -47,15 +47,19 @@ Version 5 Command:
|
|||||||
iwpriv ethX ledgpio <n>
|
iwpriv ethX ledgpio <n>
|
||||||
|
|
||||||
BT Commands:
|
BT Commands:
|
||||||
The blinding table (BT) contains a list of mac addresses that should be
|
The blinding table (BT) contains a list of mac addresses that will be,
|
||||||
ignored by the firmware. It is primarily used for debugging and
|
by default, ignored by the firmware. It is also possible to invert this
|
||||||
testing networks. It can be edited and inspected with the following
|
behavior so that we will ignore all traffic except for the portion
|
||||||
commands:
|
coming from mac addresess in the list. It is primarily used for
|
||||||
|
debugging and testing networks. It can be edited and inspected with
|
||||||
|
the following commands:
|
||||||
|
|
||||||
iwpriv ethX bt_reset
|
iwpriv ethX bt_reset
|
||||||
iwpriv ethX bt_add <mac_address>
|
iwpriv ethX bt_add <mac_address>
|
||||||
iwpriv ethX bt_del <mac_address>
|
iwpriv ethX bt_del <mac_address>
|
||||||
iwpriv ethX bt_list <id>
|
iwpriv ethX bt_list <id>
|
||||||
|
iwpriv ethX bt_get_invert <n>
|
||||||
|
iwpriv ethX bt_set_invert <n>
|
||||||
|
|
||||||
FWT Commands:
|
FWT Commands:
|
||||||
The forwarding table (FWT) is a feature used to manage mesh network
|
The forwarding table (FWT) is a feature used to manage mesh network
|
||||||
@ -135,7 +139,7 @@ fwt_add
|
|||||||
This command is used to insert an entry into the FWT table. The list of
|
This command is used to insert an entry into the FWT table. The list of
|
||||||
parameters must follow the following structure:
|
parameters must follow the following structure:
|
||||||
|
|
||||||
iwpriv ethX fwt_add da ra [metric dir ssn dsn hopcount ttl expiration sleepmode snr]
|
iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
|
||||||
|
|
||||||
The parameters between brackets are optional, but they must appear in
|
The parameters between brackets are optional, but they must appear in
|
||||||
the order specified. For example, if you want to specify the metric,
|
the order specified. For example, if you want to specify the metric,
|
||||||
@ -150,6 +154,9 @@ fwt_add
|
|||||||
preferred, default is 0)
|
preferred, default is 0)
|
||||||
dir -- direction (1 for direct, 0 for reverse,
|
dir -- direction (1 for direct, 0 for reverse,
|
||||||
default is 1)
|
default is 1)
|
||||||
|
rate -- data rate used for transmission to the RA,
|
||||||
|
as specified for the rateadapt command,
|
||||||
|
default is 3 (11Mbps)
|
||||||
ssn -- Source Sequence Number (time at the RA for
|
ssn -- Source Sequence Number (time at the RA for
|
||||||
reverse routes. Default is 0)
|
reverse routes. Default is 0)
|
||||||
dsn -- Destination Sequence Number (time at the DA
|
dsn -- Destination Sequence Number (time at the DA
|
||||||
@ -207,13 +214,17 @@ fwt_list
|
|||||||
|
|
||||||
The output is a string of the following form:
|
The output is a string of the following form:
|
||||||
|
|
||||||
da ra metric dir ssn dsn hopcount ttl expiration sleepmode snr
|
da ra valid metric dir rate ssn dsn hopcount ttl expiration
|
||||||
|
sleepmode snr precursor
|
||||||
|
|
||||||
where the different fields are:-
|
where the different fields are:-
|
||||||
da -- DA MAC address (in the form "00:11:22:33:44:55")
|
da -- DA MAC address (in the form "00:11:22:33:44:55")
|
||||||
ra -- RA MAC address (in the form "00:11:22:33:44:55")
|
ra -- RA MAC address (in the form "00:11:22:33:44:55")
|
||||||
|
valid -- whether the route is valid (0 if not valid)
|
||||||
metric -- route metric (cost: smaller-metric routes are preferred)
|
metric -- route metric (cost: smaller-metric routes are preferred)
|
||||||
dir -- direction (1 for direct, 0 for reverse)
|
dir -- direction (1 for direct, 0 for reverse)
|
||||||
|
rate -- data rate used for transmission to the RA,
|
||||||
|
as specified for the rateadapt command
|
||||||
ssn -- Source Sequence Number (time at the RA for reverse routes)
|
ssn -- Source Sequence Number (time at the RA for reverse routes)
|
||||||
dsn -- Destination Sequence Number (time at the DA for direct routes)
|
dsn -- Destination Sequence Number (time at the DA for direct routes)
|
||||||
hopcount -- hop count (currently unused)
|
hopcount -- hop count (currently unused)
|
||||||
@ -221,33 +232,10 @@ fwt_list
|
|||||||
expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
|
expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
|
||||||
sleepmode -- RA's sleep mode (currently unused)
|
sleepmode -- RA's sleep mode (currently unused)
|
||||||
snr -- SNR in the link to RA (currently unused)
|
snr -- SNR in the link to RA (currently unused)
|
||||||
|
precursor -- predecessor in direct routes
|
||||||
|
|
||||||
fwt_list_route
|
fwt_list_route
|
||||||
This command is used to list a route from the FWT table. The only
|
This command is equivalent to fwt_list.
|
||||||
parameter is the route ID. If you want to list all the routes in a
|
|
||||||
table, start with rid=0, and keep incrementing rid until you get a
|
|
||||||
"(null)" string. This function is similar to fwt_list. The only
|
|
||||||
difference is the output format. Also note that this command is meant
|
|
||||||
for debugging. It is expected that users will use fwt_lookup and
|
|
||||||
fwt_list. One important reason for this is that the route id may change
|
|
||||||
as the route table is altered.
|
|
||||||
|
|
||||||
iwpriv ethX fwt_list_route rid
|
|
||||||
|
|
||||||
The output is a string of the following form:
|
|
||||||
|
|
||||||
da metric dir nid ssn dsn hopcount ttl expiration
|
|
||||||
|
|
||||||
where the different fields are:-
|
|
||||||
da -- DA MAC address (in the form "00:11:22:33:44:55")
|
|
||||||
metric -- route metric (cost: smaller-metric routes are preferred)
|
|
||||||
dir -- direction (1 for direct, 0 for reverse)
|
|
||||||
nid -- Next-hop (neighbor) host ID (nid)
|
|
||||||
ssn -- Source Sequence Number (time at the RA for reverse routes)
|
|
||||||
dsn -- Destination Sequence Number (time at the DA for direct routes)
|
|
||||||
hopcount -- hop count (currently unused)
|
|
||||||
ttl -- TTL count (only used in reverse entries)
|
|
||||||
expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
|
|
||||||
|
|
||||||
fwt_list_neigh
|
fwt_list_neigh
|
||||||
This command is used to list a neighbor from the FWT table. The only
|
This command is used to list a neighbor from the FWT table. The only
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <net/ieee80211.h>
|
#include <net/ieee80211.h>
|
||||||
|
#include <linux/etherdevice.h>
|
||||||
|
|
||||||
#include "assoc.h"
|
#include "assoc.h"
|
||||||
#include "join.h"
|
#include "join.h"
|
||||||
@ -13,59 +14,88 @@
|
|||||||
static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
|
||||||
|
{
|
||||||
|
lbs_deb_assoc(
|
||||||
|
"#### Association Request: %s\n"
|
||||||
|
" flags: 0x%08lX\n"
|
||||||
|
" SSID: '%s'\n"
|
||||||
|
" channel: %d\n"
|
||||||
|
" band: %d\n"
|
||||||
|
" mode: %d\n"
|
||||||
|
" BSSID: " MAC_FMT "\n"
|
||||||
|
" Encryption:%s%s%s\n"
|
||||||
|
" auth: %d\n",
|
||||||
|
extra, assoc_req->flags,
|
||||||
|
escape_essid(assoc_req->ssid, assoc_req->ssid_len),
|
||||||
|
assoc_req->channel, assoc_req->band, assoc_req->mode,
|
||||||
|
MAC_ARG(assoc_req->bssid),
|
||||||
|
assoc_req->secinfo.WPAenabled ? " WPA" : "",
|
||||||
|
assoc_req->secinfo.WPA2enabled ? " WPA2" : "",
|
||||||
|
assoc_req->secinfo.wep_enabled ? " WEP" : "",
|
||||||
|
assoc_req->secinfo.auth_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int assoc_helper_essid(wlan_private *priv,
|
static int assoc_helper_essid(wlan_private *priv,
|
||||||
struct assoc_request * assoc_req)
|
struct assoc_request * assoc_req)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i;
|
struct bss_descriptor * bss;
|
||||||
|
int channel = -1;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
|
/* FIXME: take channel into account when picking SSIDs if a channel
|
||||||
|
* is set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
|
||||||
|
channel = assoc_req->channel;
|
||||||
|
|
||||||
|
lbs_deb_assoc("New SSID requested: '%s'\n",
|
||||||
|
escape_essid(assoc_req->ssid, assoc_req->ssid_len));
|
||||||
if (assoc_req->mode == IW_MODE_INFRA) {
|
if (assoc_req->mode == IW_MODE_INFRA) {
|
||||||
if (adapter->prescan) {
|
if (adapter->prescan) {
|
||||||
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
|
libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
|
||||||
|
assoc_req->ssid_len, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
|
bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
|
||||||
NULL, IW_MODE_INFRA);
|
assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
|
||||||
if (i >= 0) {
|
if (bss != NULL) {
|
||||||
lbs_pr_debug(1,
|
lbs_deb_assoc("SSID found in scan list, associating\n");
|
||||||
"SSID found in scan list ... associating...\n");
|
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
|
||||||
|
ret = wlan_associate(priv, assoc_req);
|
||||||
ret = wlan_associate(priv, &adapter->scantable[i]);
|
|
||||||
if (ret == 0) {
|
|
||||||
memcpy(&assoc_req->bssid,
|
|
||||||
&adapter->scantable[i].macaddress,
|
|
||||||
ETH_ALEN);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
|
lbs_deb_assoc("SSID not found; cannot associate\n");
|
||||||
assoc_req->ssid.ssid);
|
|
||||||
}
|
}
|
||||||
} else if (assoc_req->mode == IW_MODE_ADHOC) {
|
} else if (assoc_req->mode == IW_MODE_ADHOC) {
|
||||||
/* Scan for the network, do not save previous results. Stale
|
/* Scan for the network, do not save previous results. Stale
|
||||||
* scan data will cause us to join a non-existant adhoc network
|
* scan data will cause us to join a non-existant adhoc network
|
||||||
*/
|
*/
|
||||||
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0);
|
libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
|
||||||
|
assoc_req->ssid_len, 1);
|
||||||
|
|
||||||
/* Search for the requested SSID in the scan table */
|
/* Search for the requested SSID in the scan table */
|
||||||
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
|
bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
|
||||||
IW_MODE_ADHOC);
|
assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
|
||||||
if (i >= 0) {
|
if (bss != NULL) {
|
||||||
lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
|
lbs_deb_assoc("SSID found, will join\n");
|
||||||
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
|
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
|
||||||
|
libertas_join_adhoc_network(priv, assoc_req);
|
||||||
} else {
|
} else {
|
||||||
/* else send START command */
|
/* else send START command */
|
||||||
lbs_pr_debug(1, "SSID not found in list, so creating adhoc"
|
lbs_deb_assoc("SSID not found, creating adhoc network\n");
|
||||||
" with SSID '%s'\n", assoc_req->ssid.ssid);
|
memcpy(&assoc_req->bss.ssid, &assoc_req->ssid,
|
||||||
libertas_start_adhoc_network(priv, &assoc_req->ssid);
|
IW_ESSID_MAX_SIZE);
|
||||||
|
assoc_req->bss.ssid_len = assoc_req->ssid_len;
|
||||||
|
libertas_start_adhoc_network(priv, assoc_req);
|
||||||
}
|
}
|
||||||
memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,33 +104,31 @@ static int assoc_helper_bssid(wlan_private *priv,
|
|||||||
struct assoc_request * assoc_req)
|
struct assoc_request * assoc_req)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int i, ret = 0;
|
int ret = 0;
|
||||||
|
struct bss_descriptor * bss;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID " MAC_FMT,
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n",
|
|
||||||
MAC_ARG(assoc_req->bssid));
|
MAC_ARG(assoc_req->bssid));
|
||||||
|
|
||||||
/* Search for index position in list for requested MAC */
|
/* Search for index position in list for requested MAC */
|
||||||
i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
|
bss = libertas_find_bssid_in_list(adapter, assoc_req->bssid,
|
||||||
assoc_req->mode);
|
assoc_req->mode);
|
||||||
if (i < 0) {
|
if (bss == NULL) {
|
||||||
lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, "
|
lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
|
||||||
"cannot associate.\n", MAC_ARG(assoc_req->bssid));
|
"cannot associate.\n", MAC_ARG(assoc_req->bssid));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
|
||||||
if (assoc_req->mode == IW_MODE_INFRA) {
|
if (assoc_req->mode == IW_MODE_INFRA) {
|
||||||
ret = wlan_associate(priv, &adapter->scantable[i]);
|
ret = wlan_associate(priv, assoc_req);
|
||||||
lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
|
lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret);
|
||||||
} else if (assoc_req->mode == IW_MODE_ADHOC) {
|
} else if (assoc_req->mode == IW_MODE_ADHOC) {
|
||||||
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
|
libertas_join_adhoc_network(priv, assoc_req);
|
||||||
}
|
}
|
||||||
memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
|
|
||||||
sizeof(struct WLAN_802_11_SSID));
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,12 +141,12 @@ static int assoc_helper_associate(wlan_private *priv,
|
|||||||
/* If we're given and 'any' BSSID, try associating based on SSID */
|
/* If we're given and 'any' BSSID, try associating based on SSID */
|
||||||
|
|
||||||
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
||||||
if (memcmp(bssid_any, assoc_req->bssid, ETH_ALEN)
|
if (compare_ether_addr(bssid_any, assoc_req->bssid)
|
||||||
&& memcmp(bssid_off, assoc_req->bssid, ETH_ALEN)) {
|
&& compare_ether_addr(bssid_off, assoc_req->bssid)) {
|
||||||
ret = assoc_helper_bssid(priv, assoc_req);
|
ret = assoc_helper_bssid(priv, assoc_req);
|
||||||
done = 1;
|
done = 1;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
|
lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +154,7 @@ static int assoc_helper_associate(wlan_private *priv,
|
|||||||
if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_essid(priv, assoc_req);
|
ret = assoc_helper_essid(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
|
lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,12 +168,10 @@ static int assoc_helper_mode(wlan_private *priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
if (assoc_req->mode == adapter->mode) {
|
if (assoc_req->mode == adapter->mode)
|
||||||
LEAVE();
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assoc_req->mode == IW_MODE_INFRA) {
|
if (assoc_req->mode == IW_MODE_INFRA) {
|
||||||
if (adapter->psstate != PS_STATE_FULL_POWER)
|
if (adapter->psstate != PS_STATE_FULL_POWER)
|
||||||
@ -158,9 +184,81 @@ static int assoc_helper_mode(wlan_private *priv,
|
|||||||
cmd_802_11_snmp_mib,
|
cmd_802_11_snmp_mib,
|
||||||
0, cmd_option_waitforrsp,
|
0, cmd_option_waitforrsp,
|
||||||
OID_802_11_INFRASTRUCTURE_MODE,
|
OID_802_11_INFRASTRUCTURE_MODE,
|
||||||
(void *) (size_t) assoc_req->mode);
|
/* Shoot me now */ (void *) (size_t) assoc_req->mode);
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int update_channel(wlan_private * priv)
|
||||||
|
{
|
||||||
|
/* the channel in f/w could be out of sync, get the current channel */
|
||||||
|
return libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
|
||||||
|
cmd_opt_802_11_rf_channel_get,
|
||||||
|
cmd_option_waitforrsp, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void libertas_sync_channel(struct work_struct *work)
|
||||||
|
{
|
||||||
|
wlan_private *priv = container_of(work, wlan_private, sync_channel);
|
||||||
|
|
||||||
|
if (update_channel(priv) != 0)
|
||||||
|
lbs_pr_info("Channel synchronization failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int assoc_helper_channel(wlan_private *priv,
|
||||||
|
struct assoc_request * assoc_req)
|
||||||
|
{
|
||||||
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
|
ret = update_channel(priv);
|
||||||
|
if (ret < 0) {
|
||||||
|
lbs_deb_assoc("ASSOC: channel: error getting channel.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assoc_req->channel == adapter->curbssparams.channel)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
lbs_deb_assoc("ASSOC: channel: %d -> %d\n",
|
||||||
|
adapter->curbssparams.channel, assoc_req->channel);
|
||||||
|
|
||||||
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
|
||||||
|
cmd_opt_802_11_rf_channel_set,
|
||||||
|
cmd_option_waitforrsp, 0, &assoc_req->channel);
|
||||||
|
if (ret < 0) {
|
||||||
|
lbs_deb_assoc("ASSOC: channel: error setting channel.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = update_channel(priv);
|
||||||
|
if (ret < 0) {
|
||||||
|
lbs_deb_assoc("ASSOC: channel: error getting channel.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assoc_req->channel != adapter->curbssparams.channel) {
|
||||||
|
lbs_deb_assoc("ASSOC: channel: failed to update channel to %d",
|
||||||
|
assoc_req->channel);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( assoc_req->secinfo.wep_enabled
|
||||||
|
&& (assoc_req->wep_keys[0].len
|
||||||
|
|| assoc_req->wep_keys[1].len
|
||||||
|
|| assoc_req->wep_keys[2].len
|
||||||
|
|| assoc_req->wep_keys[3].len)) {
|
||||||
|
/* Make sure WEP keys are re-sent to firmware */
|
||||||
|
set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Must restart/rejoin adhoc networks after channel change */
|
||||||
|
set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
|
||||||
|
|
||||||
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +270,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
|
|||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
/* Set or remove WEP keys */
|
/* Set or remove WEP keys */
|
||||||
if ( assoc_req->wep_keys[0].len
|
if ( assoc_req->wep_keys[0].len
|
||||||
@ -216,7 +314,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
|
|||||||
mutex_unlock(&adapter->lock);
|
mutex_unlock(&adapter->lock);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,14 +324,24 @@ static int assoc_helper_secinfo(wlan_private *priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
memcpy(&adapter->secinfo, &assoc_req->secinfo,
|
memcpy(&adapter->secinfo, &assoc_req->secinfo,
|
||||||
sizeof(struct wlan_802_11_security));
|
sizeof(struct wlan_802_11_security));
|
||||||
|
|
||||||
ret = libertas_set_mac_packet_filter(priv);
|
ret = libertas_set_mac_packet_filter(priv);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
|
||||||
LEAVE();
|
/* enable/disable RSN */
|
||||||
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
|
cmd_802_11_enable_rsn,
|
||||||
|
cmd_act_set,
|
||||||
|
cmd_option_waitforrsp,
|
||||||
|
0, assoc_req);
|
||||||
|
|
||||||
|
out:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,16 +351,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
/* enable/Disable RSN */
|
|
||||||
ret = libertas_prepare_and_send_command(priv,
|
|
||||||
cmd_802_11_enable_rsn,
|
|
||||||
cmd_act_set,
|
|
||||||
cmd_option_waitforrsp,
|
|
||||||
0, assoc_req);
|
|
||||||
if (ret)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv,
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
cmd_802_11_key_material,
|
cmd_802_11_key_material,
|
||||||
@ -260,8 +359,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
|
|||||||
cmd_option_waitforrsp,
|
cmd_option_waitforrsp,
|
||||||
0, assoc_req);
|
0, assoc_req);
|
||||||
|
|
||||||
out:
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
LEAVE();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +370,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
|
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
|
||||||
memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
|
memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
|
||||||
@ -282,7 +380,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
|
|||||||
adapter->wpa_ie_len = 0;
|
adapter->wpa_ie_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,25 +392,30 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
||||||
lbs_pr_debug(1, "Deauthenticating due to new SSID in "
|
lbs_deb_assoc("Deauthenticating due to new SSID in "
|
||||||
" configuration request.\n");
|
" configuration request.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
|
||||||
if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
|
if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
|
||||||
lbs_pr_debug(1, "Deauthenticating due to updated security "
|
lbs_deb_assoc("Deauthenticating due to updated security "
|
||||||
"info in configuration request.\n");
|
"info in configuration request.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
||||||
lbs_pr_debug(1, "Deauthenticating due to new BSSID in "
|
lbs_deb_assoc("Deauthenticating due to new BSSID in "
|
||||||
" configuration request.\n");
|
" configuration request.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
|
||||||
|
lbs_deb_assoc("Deauthenticating due to channel switch.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: deal with 'auto' mode somehow */
|
/* FIXME: deal with 'auto' mode somehow */
|
||||||
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
|
||||||
if (assoc_req->mode != IW_MODE_INFRA)
|
if (assoc_req->mode != IW_MODE_INFRA)
|
||||||
@ -329,10 +432,9 @@ static int should_stop_adhoc(wlan_adapter *adapter,
|
|||||||
if (adapter->connect_status != libertas_connected)
|
if (adapter->connect_status != libertas_connected)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength)
|
if (libertas_ssid_cmp(adapter->curbssparams.ssid,
|
||||||
return 1;
|
adapter->curbssparams.ssid_len,
|
||||||
if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid,
|
assoc_req->ssid, assoc_req->ssid_len) != 0)
|
||||||
adapter->curbssparams.ssid.ssidlength))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* FIXME: deal with 'auto' mode somehow */
|
/* FIXME: deal with 'auto' mode somehow */
|
||||||
@ -341,11 +443,16 @@ static int should_stop_adhoc(wlan_adapter *adapter,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
|
||||||
|
if (assoc_req->channel != adapter->curbssparams.channel)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wlan_association_worker(struct work_struct *work)
|
void libertas_association_worker(struct work_struct *work)
|
||||||
{
|
{
|
||||||
wlan_private *priv = container_of(work, wlan_private, assoc_work.work);
|
wlan_private *priv = container_of(work, wlan_private, assoc_work.work);
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
@ -353,40 +460,38 @@ void wlan_association_worker(struct work_struct *work)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int find_any_ssid = 0;
|
int find_any_ssid = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ASSOC);
|
||||||
|
|
||||||
mutex_lock(&adapter->lock);
|
mutex_lock(&adapter->lock);
|
||||||
assoc_req = adapter->assoc_req;
|
assoc_req = adapter->pending_assoc_req;
|
||||||
adapter->assoc_req = NULL;
|
adapter->pending_assoc_req = NULL;
|
||||||
|
adapter->in_progress_assoc_req = assoc_req;
|
||||||
mutex_unlock(&adapter->lock);
|
mutex_unlock(&adapter->lock);
|
||||||
|
|
||||||
if (!assoc_req) {
|
if (!assoc_req)
|
||||||
LEAVE();
|
goto done;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n",
|
print_assoc_req(__func__, assoc_req);
|
||||||
assoc_req->flags);
|
|
||||||
|
|
||||||
/* If 'any' SSID was specified, find an SSID to associate with */
|
/* If 'any' SSID was specified, find an SSID to associate with */
|
||||||
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
|
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
|
||||||
&& !assoc_req->ssid.ssidlength)
|
&& !assoc_req->ssid_len)
|
||||||
find_any_ssid = 1;
|
find_any_ssid = 1;
|
||||||
|
|
||||||
/* But don't use 'any' SSID if there's a valid locked BSSID to use */
|
/* But don't use 'any' SSID if there's a valid locked BSSID to use */
|
||||||
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
|
||||||
if (memcmp(&assoc_req->bssid, bssid_any, ETH_ALEN)
|
if (compare_ether_addr(assoc_req->bssid, bssid_any)
|
||||||
&& memcmp(&assoc_req->bssid, bssid_off, ETH_ALEN))
|
&& compare_ether_addr(assoc_req->bssid, bssid_off))
|
||||||
find_any_ssid = 0;
|
find_any_ssid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (find_any_ssid) {
|
if (find_any_ssid) {
|
||||||
u8 new_mode;
|
u8 new_mode;
|
||||||
|
|
||||||
ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
|
ret = libertas_find_best_network_ssid(priv, assoc_req->ssid,
|
||||||
assoc_req->mode, &new_mode);
|
&assoc_req->ssid_len, assoc_req->mode, &new_mode);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "Could not find best network\n");
|
lbs_deb_assoc("Could not find best network\n");
|
||||||
ret = -ENETUNREACH;
|
ret = -ENETUNREACH;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -406,7 +511,7 @@ void wlan_association_worker(struct work_struct *work)
|
|||||||
if (should_deauth_infrastructure(adapter, assoc_req)) {
|
if (should_deauth_infrastructure(adapter, assoc_req)) {
|
||||||
ret = libertas_send_deauthentication(priv);
|
ret = libertas_send_deauthentication(priv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "Deauthentication due to new "
|
lbs_deb_assoc("Deauthentication due to new "
|
||||||
"configuration request failed: %d\n",
|
"configuration request failed: %d\n",
|
||||||
ret);
|
ret);
|
||||||
}
|
}
|
||||||
@ -415,7 +520,7 @@ void wlan_association_worker(struct work_struct *work)
|
|||||||
if (should_stop_adhoc(adapter, assoc_req)) {
|
if (should_stop_adhoc(adapter, assoc_req)) {
|
||||||
ret = libertas_stop_adhoc_network(priv);
|
ret = libertas_stop_adhoc_network(priv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "Teardown of AdHoc network due to "
|
lbs_deb_assoc("Teardown of AdHoc network due to "
|
||||||
"new configuration request failed: %d\n",
|
"new configuration request failed: %d\n",
|
||||||
ret);
|
ret);
|
||||||
}
|
}
|
||||||
@ -427,7 +532,16 @@ void wlan_association_worker(struct work_struct *work)
|
|||||||
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_mode(priv, assoc_req);
|
ret = assoc_helper_mode(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
|
lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
|
||||||
|
ret = assoc_helper_channel(priv, assoc_req);
|
||||||
|
if (ret) {
|
||||||
|
lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n",
|
||||||
|
__LINE__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +550,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
|
|||||||
|| test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
|
|| test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_wep_keys(priv, assoc_req);
|
ret = assoc_helper_wep_keys(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
|
lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,7 +558,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
|
|||||||
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_secinfo(priv, assoc_req);
|
ret = assoc_helper_secinfo(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
|
lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -452,7 +566,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
|
|||||||
if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
|
if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_wpa_ie(priv, assoc_req);
|
ret = assoc_helper_wpa_ie(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
|
lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,7 +575,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
|
|||||||
|| test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
|
|| test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
|
||||||
ret = assoc_helper_wpa_keys(priv, assoc_req);
|
ret = assoc_helper_wpa_keys(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
|
lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -475,21 +589,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
|
|||||||
|
|
||||||
ret = assoc_helper_associate(priv, assoc_req);
|
ret = assoc_helper_associate(priv, assoc_req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n",
|
lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
|
||||||
ret);
|
ret);
|
||||||
success = 0;
|
success = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter->connect_status != libertas_connected) {
|
if (adapter->connect_status != libertas_connected) {
|
||||||
lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, "
|
lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
|
||||||
"not connected.\n");
|
"not connected.\n");
|
||||||
success = 0;
|
success = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
lbs_pr_debug(1, "ASSOC: association attempt successful. "
|
lbs_deb_assoc("ASSOC: association attempt successful. "
|
||||||
"Associated to '%s' (" MAC_FMT ")\n",
|
"Associated to '%s' (" MAC_FMT ")\n",
|
||||||
assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid));
|
escape_essid(adapter->curbssparams.ssid,
|
||||||
|
adapter->curbssparams.ssid_len),
|
||||||
|
MAC_ARG(adapter->curbssparams.bssid));
|
||||||
libertas_prepare_and_send_command(priv,
|
libertas_prepare_and_send_command(priv,
|
||||||
cmd_802_11_rssi,
|
cmd_802_11_rssi,
|
||||||
0, cmd_option_waitforrsp, 0, NULL);
|
0, cmd_option_waitforrsp, 0, NULL);
|
||||||
@ -498,18 +614,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
|
|||||||
cmd_802_11_get_log,
|
cmd_802_11_get_log,
|
||||||
0, cmd_option_waitforrsp, 0, NULL);
|
0, cmd_option_waitforrsp, 0, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n",
|
lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
|
||||||
ret);
|
ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_lock(&adapter->lock);
|
||||||
|
adapter->in_progress_assoc_req = NULL;
|
||||||
|
mutex_unlock(&adapter->lock);
|
||||||
kfree(assoc_req);
|
kfree(assoc_req);
|
||||||
LEAVE();
|
|
||||||
|
done:
|
||||||
|
lbs_deb_leave(LBS_DEB_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -520,9 +641,10 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
|
|||||||
{
|
{
|
||||||
struct assoc_request * assoc_req;
|
struct assoc_request * assoc_req;
|
||||||
|
|
||||||
if (!adapter->assoc_req) {
|
if (!adapter->pending_assoc_req) {
|
||||||
adapter->assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL);
|
adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
|
||||||
if (!adapter->assoc_req) {
|
GFP_KERNEL);
|
||||||
|
if (!adapter->pending_assoc_req) {
|
||||||
lbs_pr_info("Not enough memory to allocate association"
|
lbs_pr_info("Not enough memory to allocate association"
|
||||||
" request!\n");
|
" request!\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -532,15 +654,19 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
|
|||||||
/* Copy current configuration attributes to the association request,
|
/* Copy current configuration attributes to the association request,
|
||||||
* but don't overwrite any that are already set.
|
* but don't overwrite any that are already set.
|
||||||
*/
|
*/
|
||||||
assoc_req = adapter->assoc_req;
|
assoc_req = adapter->pending_assoc_req;
|
||||||
if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
|
||||||
memcpy(&assoc_req->ssid, adapter->curbssparams.ssid.ssid,
|
memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
|
||||||
adapter->curbssparams.ssid.ssidlength);
|
IW_ESSID_MAX_SIZE);
|
||||||
|
assoc_req->ssid_len = adapter->curbssparams.ssid_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
|
if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
|
||||||
assoc_req->channel = adapter->curbssparams.channel;
|
assoc_req->channel = adapter->curbssparams.channel;
|
||||||
|
|
||||||
|
if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags))
|
||||||
|
assoc_req->band = adapter->curbssparams.band;
|
||||||
|
|
||||||
if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
|
if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
|
||||||
assoc_req->mode = adapter->mode;
|
assoc_req->mode = adapter->mode;
|
||||||
|
|
||||||
@ -581,7 +707,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
|
|||||||
assoc_req->wpa_ie_len = adapter->wpa_ie_len;
|
assoc_req->wpa_ie_len = adapter->wpa_ie_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_assoc_req(__func__, assoc_req);
|
||||||
|
|
||||||
return assoc_req;
|
return assoc_req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
|
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
|
|
||||||
void wlan_association_worker(struct work_struct *work);
|
void libertas_association_worker(struct work_struct *work);
|
||||||
|
|
||||||
struct assoc_request * wlan_get_association_request(wlan_adapter *adapter);
|
struct assoc_request * wlan_get_association_request(wlan_adapter *adapter);
|
||||||
|
|
||||||
|
void libertas_sync_channel(struct work_struct *work);
|
||||||
|
|
||||||
#define ASSOC_DELAY (HZ / 2)
|
#define ASSOC_DELAY (HZ / 2)
|
||||||
static inline void wlan_postpone_association_work(wlan_private *priv)
|
static inline void wlan_postpone_association_work(wlan_private *priv)
|
||||||
{
|
{
|
||||||
@ -21,9 +23,9 @@ static inline void wlan_postpone_association_work(wlan_private *priv)
|
|||||||
static inline void wlan_cancel_association_work(wlan_private *priv)
|
static inline void wlan_cancel_association_work(wlan_private *priv)
|
||||||
{
|
{
|
||||||
cancel_delayed_work(&priv->assoc_work);
|
cancel_delayed_work(&priv->assoc_work);
|
||||||
if (priv->adapter->assoc_req) {
|
if (priv->adapter->pending_assoc_req) {
|
||||||
kfree(priv->adapter->assoc_req);
|
kfree(priv->adapter->pending_assoc_req);
|
||||||
priv->adapter->assoc_req = NULL;
|
priv->adapter->pending_assoc_req = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,6 @@
|
|||||||
#include <net/iw_handler.h>
|
#include <net/iw_handler.h>
|
||||||
|
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "sbi.h"
|
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
@ -32,7 +31,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
|
|||||||
if (adapter->connect_status != libertas_connected)
|
if (adapter->connect_status != libertas_connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lbs_pr_debug(1, "Handles disconnect event.\n");
|
lbs_deb_cmd("Handles disconnect event.\n");
|
||||||
|
|
||||||
memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
|
memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
|
||||||
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
||||||
@ -43,15 +42,15 @@ void libertas_mac_event_disconnected(wlan_private * priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
msleep_interruptible(1000);
|
msleep_interruptible(1000);
|
||||||
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
|
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
|
||||||
|
|
||||||
/* Free Tx and Rx packets */
|
/* Free Tx and Rx packets */
|
||||||
kfree_skb(priv->adapter->currenttxskb);
|
kfree_skb(priv->adapter->currenttxskb);
|
||||||
priv->adapter->currenttxskb = NULL;
|
priv->adapter->currenttxskb = NULL;
|
||||||
|
|
||||||
/* report disconnect to upper layer */
|
/* report disconnect to upper layer */
|
||||||
netif_stop_queue(priv->wlan_dev.netdev);
|
netif_stop_queue(priv->dev);
|
||||||
netif_carrier_off(priv->wlan_dev.netdev);
|
netif_carrier_off(priv->dev);
|
||||||
|
|
||||||
/* reset SNR/NF/RSSI values */
|
/* reset SNR/NF/RSSI values */
|
||||||
memset(adapter->SNR, 0x00, sizeof(adapter->SNR));
|
memset(adapter->SNR, 0x00, sizeof(adapter->SNR));
|
||||||
@ -62,35 +61,32 @@ void libertas_mac_event_disconnected(wlan_private * priv)
|
|||||||
adapter->nextSNRNF = 0;
|
adapter->nextSNRNF = 0;
|
||||||
adapter->numSNRNF = 0;
|
adapter->numSNRNF = 0;
|
||||||
adapter->rxpd_rate = 0;
|
adapter->rxpd_rate = 0;
|
||||||
lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n",
|
lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
|
||||||
adapter->curbssparams.ssid.ssid,
|
escape_essid(adapter->curbssparams.ssid,
|
||||||
adapter->curbssparams.ssid.ssidlength);
|
adapter->curbssparams.ssid_len),
|
||||||
lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n",
|
adapter->curbssparams.ssid_len);
|
||||||
adapter->previousssid.ssid, adapter->previousssid.ssidlength);
|
lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
|
||||||
|
escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
|
||||||
/* reset internal flags */
|
adapter->prev_ssid_len);
|
||||||
adapter->secinfo.WPAenabled = 0;
|
|
||||||
adapter->secinfo.WPA2enabled = 0;
|
|
||||||
adapter->wpa_ie_len = 0;
|
|
||||||
|
|
||||||
adapter->connect_status = libertas_disconnected;
|
adapter->connect_status = libertas_disconnected;
|
||||||
|
|
||||||
/*
|
/* Save previous SSID and BSSID for possible reassociation */
|
||||||
* memorize the previous SSID and BSSID
|
memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
|
||||||
* it could be used for re-assoc
|
IW_ESSID_MAX_SIZE);
|
||||||
*/
|
adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
|
||||||
memcpy(&adapter->previousssid,
|
memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
|
||||||
&adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID));
|
|
||||||
memcpy(adapter->previousbssid,
|
|
||||||
adapter->curbssparams.bssid, ETH_ALEN);
|
|
||||||
|
|
||||||
/* need to erase the current SSID and BSSID info */
|
/* Clear out associated SSID and BSSID since connection is
|
||||||
adapter->pattemptedbssdesc = NULL;
|
* no longer valid.
|
||||||
memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
|
*/
|
||||||
|
memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
|
||||||
|
memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
|
||||||
|
adapter->curbssparams.ssid_len = 0;
|
||||||
|
|
||||||
if (adapter->psstate != PS_STATE_FULL_POWER) {
|
if (adapter->psstate != PS_STATE_FULL_POWER) {
|
||||||
/* make firmware to exit PS mode */
|
/* make firmware to exit PS mode */
|
||||||
lbs_pr_debug(1, "Disconnected, so exit PS mode.\n");
|
lbs_deb_cmd("Disconnected, so exit PS mode.\n");
|
||||||
libertas_ps_wakeup(priv, 0);
|
libertas_ps_wakeup(priv, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,55 +118,45 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
|
|||||||
static int wlan_ret_reg_access(wlan_private * priv,
|
static int wlan_ret_reg_access(wlan_private * priv,
|
||||||
u16 type, struct cmd_ds_command *resp)
|
u16 type, struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case cmd_ret_mac_reg_access:
|
case cmd_ret_mac_reg_access:
|
||||||
{
|
{
|
||||||
struct cmd_ds_mac_reg_access *reg;
|
struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
|
||||||
|
|
||||||
reg =
|
adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
|
||||||
(struct cmd_ds_mac_reg_access *)&resp->params.
|
adapter->offsetvalue.value = le32_to_cpu(reg->value);
|
||||||
macreg;
|
|
||||||
|
|
||||||
adapter->offsetvalue.offset = reg->offset;
|
|
||||||
adapter->offsetvalue.value = reg->value;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cmd_ret_bbp_reg_access:
|
case cmd_ret_bbp_reg_access:
|
||||||
{
|
{
|
||||||
struct cmd_ds_bbp_reg_access *reg;
|
struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
|
||||||
reg =
|
|
||||||
(struct cmd_ds_bbp_reg_access *)&resp->params.
|
|
||||||
bbpreg;
|
|
||||||
|
|
||||||
adapter->offsetvalue.offset = reg->offset;
|
adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
|
||||||
adapter->offsetvalue.value = reg->value;
|
adapter->offsetvalue.value = reg->value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cmd_ret_rf_reg_access:
|
case cmd_ret_rf_reg_access:
|
||||||
{
|
{
|
||||||
struct cmd_ds_rf_reg_access *reg;
|
struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
|
||||||
reg =
|
|
||||||
(struct cmd_ds_rf_reg_access *)&resp->params.
|
|
||||||
rfreg;
|
|
||||||
|
|
||||||
adapter->offsetvalue.offset = reg->offset;
|
adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
|
||||||
adapter->offsetvalue.value = reg->value;
|
adapter->offsetvalue.value = reg->value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LEAVE();
|
ret = -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlan_ret_get_hw_spec(wlan_private * priv,
|
static int wlan_ret_get_hw_spec(wlan_private * priv,
|
||||||
@ -181,19 +167,20 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
|
adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
|
||||||
|
|
||||||
adapter->fwreleasenumber = hwspec->fwreleasenumber;
|
memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4);
|
||||||
|
|
||||||
lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
|
lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- %u.%u.%u.p%u\n",
|
||||||
adapter->fwreleasenumber);
|
adapter->fwreleasenumber[2], adapter->fwreleasenumber[1],
|
||||||
lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
|
adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]);
|
||||||
|
lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
|
||||||
hwspec->permanentaddr[0], hwspec->permanentaddr[1],
|
hwspec->permanentaddr[0], hwspec->permanentaddr[1],
|
||||||
hwspec->permanentaddr[2], hwspec->permanentaddr[3],
|
hwspec->permanentaddr[2], hwspec->permanentaddr[3],
|
||||||
hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
|
hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
|
||||||
lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
|
lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
|
||||||
hwspec->hwifversion, hwspec->version);
|
hwspec->hwifversion, hwspec->version);
|
||||||
|
|
||||||
adapter->regioncode = le16_to_cpu(hwspec->regioncode);
|
adapter->regioncode = le16_to_cpu(hwspec->regioncode);
|
||||||
@ -210,17 +197,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
|
|||||||
if (i >= MRVDRV_MAX_REGION_CODE) {
|
if (i >= MRVDRV_MAX_REGION_CODE) {
|
||||||
adapter->regioncode = 0x10;
|
adapter->regioncode = 0x10;
|
||||||
adapter->regiontableindex = 0;
|
adapter->regiontableindex = 0;
|
||||||
lbs_pr_info(
|
lbs_pr_info("unidentified region code; using the default (USA)\n");
|
||||||
"unidentified region code, use the default (USA)\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter->current_addr[0] == 0xff) {
|
if (adapter->current_addr[0] == 0xff)
|
||||||
memmove(adapter->current_addr, hwspec->permanentaddr,
|
memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN);
|
||||||
ETH_ALEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN);
|
memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN);
|
||||||
memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
|
if (priv->mesh_dev)
|
||||||
|
memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
|
||||||
|
|
||||||
if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
|
if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -232,8 +217,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,19 +228,21 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
|
|||||||
struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
|
struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
|
lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
|
||||||
|
" extsleepclk=%x\n", le16_to_cpu(sp->error),
|
||||||
|
le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
|
||||||
|
sp->calcontrol, sp->externalsleepclk);
|
||||||
|
|
||||||
lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n"
|
|
||||||
" extsleepclk=%x\n", sp->error, sp->offset,
|
|
||||||
sp->stabletime, sp->calcontrol, sp->externalsleepclk);
|
|
||||||
adapter->sp.sp_error = le16_to_cpu(sp->error);
|
adapter->sp.sp_error = le16_to_cpu(sp->error);
|
||||||
adapter->sp.sp_offset = le16_to_cpu(sp->offset);
|
adapter->sp.sp_offset = le16_to_cpu(sp->offset);
|
||||||
adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
|
adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
|
||||||
adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol);
|
adapter->sp.sp_calcontrol = sp->calcontrol;
|
||||||
adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk);
|
adapter->sp.sp_extsleepclk = sp->externalsleepclk;
|
||||||
adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
|
adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,42 +268,38 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
|
|||||||
u16 oid = le16_to_cpu(smib->oid);
|
u16 oid = le16_to_cpu(smib->oid);
|
||||||
u16 querytype = le16_to_cpu(smib->querytype);
|
u16 querytype = le16_to_cpu(smib->querytype);
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
|
lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
|
||||||
querytype);
|
querytype);
|
||||||
lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n",
|
lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize));
|
||||||
le16_to_cpu(smib->bufsize));
|
|
||||||
|
|
||||||
if (querytype == cmd_act_get) {
|
if (querytype == cmd_act_get) {
|
||||||
switch (oid) {
|
switch (oid) {
|
||||||
case fragthresh_i:
|
case fragthresh_i:
|
||||||
priv->adapter->fragthsd =
|
priv->adapter->fragthsd =
|
||||||
le16_to_cpu(*
|
le16_to_cpu(*((__le16 *)(smib->value)));
|
||||||
((unsigned short *)(smib->value)));
|
lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
|
||||||
lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n",
|
priv->adapter->fragthsd);
|
||||||
priv->adapter->fragthsd);
|
|
||||||
break;
|
break;
|
||||||
case rtsthresh_i:
|
case rtsthresh_i:
|
||||||
priv->adapter->rtsthsd =
|
priv->adapter->rtsthsd =
|
||||||
le16_to_cpu(*
|
le16_to_cpu(*((__le16 *)(smib->value)));
|
||||||
((unsigned short *)(smib->value)));
|
lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
|
||||||
lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n",
|
priv->adapter->rtsthsd);
|
||||||
priv->adapter->rtsthsd);
|
|
||||||
break;
|
break;
|
||||||
case short_retrylim_i:
|
case short_retrylim_i:
|
||||||
priv->adapter->txretrycount =
|
priv->adapter->txretrycount =
|
||||||
le16_to_cpu(*
|
le16_to_cpu(*((__le16 *)(smib->value)));
|
||||||
((unsigned short *)(smib->value)));
|
lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
|
||||||
lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n",
|
priv->adapter->rtsthsd);
|
||||||
priv->adapter->rtsthsd);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +311,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
u16 action = le16_to_cpu(pkeymaterial->action);
|
u16 action = le16_to_cpu(pkeymaterial->action);
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
/* Copy the returned key to driver private data */
|
/* Copy the returned key to driver private data */
|
||||||
if (action == cmd_act_get) {
|
if (action == cmd_act_get) {
|
||||||
@ -371,7 +354,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,11 +364,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
|
|||||||
struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
|
struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
|
memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,13 +378,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
|
|||||||
struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
|
struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
|
adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel);
|
lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,14 +396,12 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
|
|||||||
u16 action = le16_to_cpu(pAntenna->action);
|
u16 action = le16_to_cpu(pAntenna->action);
|
||||||
|
|
||||||
if (action == cmd_act_get_rx)
|
if (action == cmd_act_get_rx)
|
||||||
adapter->rxantennamode =
|
adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode);
|
||||||
le16_to_cpu(pAntenna->antennamode);
|
|
||||||
|
|
||||||
if (action == cmd_act_get_tx)
|
if (action == cmd_act_get_tx)
|
||||||
adapter->txantennamode =
|
adapter->txantennamode = le16_to_cpu(pAntenna->antennamode);
|
||||||
le16_to_cpu(pAntenna->antennamode);
|
|
||||||
|
|
||||||
lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
|
lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
|
||||||
action, le16_to_cpu(pAntenna->antennamode));
|
action, le16_to_cpu(pAntenna->antennamode));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -429,19 +410,17 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
|
|||||||
static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
|
static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
struct cmd_ds_802_11_rate_adapt_rateset *rates =
|
struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
|
||||||
&resp->params.rateset;
|
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
if (rates->action == cmd_act_get) {
|
if (rates->action == cmd_act_get) {
|
||||||
adapter->enablehwauto = rates->enablehwauto;
|
adapter->enablehwauto = le16_to_cpu(rates->enablehwauto);
|
||||||
adapter->ratebitmap = rates->bitmap;
|
adapter->ratebitmap = le16_to_cpu(rates->bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,43 +431,42 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
u8 dot11datarate;
|
u8 dot11datarate;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
|
lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
|
||||||
(u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
|
(u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
|
||||||
|
|
||||||
dot11datarate = pdatarate->datarate[0];
|
dot11datarate = pdatarate->datarate[0];
|
||||||
if (pdatarate->action == cmd_act_get_tx_rate) {
|
if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) {
|
||||||
memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
|
memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
|
||||||
sizeof(adapter->libertas_supported_rates));
|
sizeof(adapter->libertas_supported_rates));
|
||||||
}
|
}
|
||||||
adapter->datarate = libertas_index_to_data_rate(dot11datarate);
|
adapter->datarate = libertas_index_to_data_rate(dot11datarate);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlan_ret_802_11_rf_channel(wlan_private * priv,
|
static int wlan_ret_802_11_rf_channel(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
struct cmd_ds_802_11_rf_channel *rfchannel =
|
struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
|
||||||
&resp->params.rfchannel;
|
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
u16 action = le16_to_cpu(rfchannel->action);
|
u16 action = le16_to_cpu(rfchannel->action);
|
||||||
u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
|
u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
if (action == cmd_opt_802_11_rf_channel_get
|
if (action == cmd_opt_802_11_rf_channel_get
|
||||||
&& adapter->curbssparams.channel != newchannel) {
|
&& adapter->curbssparams.channel != newchannel) {
|
||||||
lbs_pr_debug(1, "channel Switch: %d to %d\n",
|
lbs_deb_cmd("channel Switch: %d to %d\n",
|
||||||
adapter->curbssparams.channel, newchannel);
|
adapter->curbssparams.channel, newchannel);
|
||||||
|
|
||||||
/* Update the channel again */
|
/* Update the channel again */
|
||||||
adapter->curbssparams.channel = newchannel;
|
adapter->curbssparams.channel = newchannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,12 +478,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
|
|||||||
|
|
||||||
/* store the non average value */
|
/* store the non average value */
|
||||||
adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
|
adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
|
||||||
adapter->NF[TYPE_BEACON][TYPE_NOAVG] =
|
adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
|
||||||
le16_to_cpu(rssirsp->noisefloor);
|
|
||||||
|
|
||||||
adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
|
adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
|
||||||
adapter->NF[TYPE_BEACON][TYPE_AVG] =
|
adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
|
||||||
le16_to_cpu(rssirsp->avgnoisefloor);
|
|
||||||
|
|
||||||
adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
|
adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
|
||||||
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
|
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
|
||||||
@ -515,7 +491,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
|
|||||||
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
|
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
|
||||||
adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
|
adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n",
|
lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
|
||||||
adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
|
adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -528,11 +504,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
|
|||||||
struct wlan_ioctl_regrdwr *pbuf;
|
struct wlan_ioctl_regrdwr *pbuf;
|
||||||
pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
|
pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
|
||||||
|
|
||||||
lbs_pr_debug(1, "eeprom read len=%x\n",
|
lbs_deb_cmd("eeprom read len=%x\n",
|
||||||
le16_to_cpu(resp->params.rdeeprom.bytecount));
|
le16_to_cpu(resp->params.rdeeprom.bytecount));
|
||||||
if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
|
if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
|
||||||
pbuf->NOB = 0;
|
pbuf->NOB = 0;
|
||||||
lbs_pr_debug(1, "eeprom read return length is too big\n");
|
lbs_deb_cmd("eeprom read return length is too big\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
|
pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
|
||||||
@ -549,17 +525,15 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
|
|||||||
static int wlan_ret_get_log(wlan_private * priv,
|
static int wlan_ret_get_log(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
struct cmd_ds_802_11_get_log *logmessage =
|
struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
|
||||||
(struct cmd_ds_802_11_get_log *)&resp->params.glog;
|
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
/* TODO Convert it to Big Endian before copy */
|
/* Stored little-endian */
|
||||||
memcpy(&adapter->logmsg, logmessage,
|
memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
|
||||||
sizeof(struct cmd_ds_802_11_get_log));
|
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,8 +594,7 @@ static inline int handle_cmd_response(u16 respcmd,
|
|||||||
case cmd_ret_802_11_set_afc:
|
case cmd_ret_802_11_set_afc:
|
||||||
case cmd_ret_802_11_get_afc:
|
case cmd_ret_802_11_get_afc:
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
memmove(adapter->cur_cmd->pdata_buf,
|
memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc,
|
||||||
&resp->params.afc,
|
|
||||||
sizeof(struct cmd_ds_802_11_afc));
|
sizeof(struct cmd_ds_802_11_afc));
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
|
|
||||||
@ -663,7 +636,7 @@ static inline int handle_cmd_response(u16 respcmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case cmd_ret_802_11_key_material:
|
case cmd_ret_802_11_key_material:
|
||||||
lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n");
|
lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
|
||||||
ret = wlan_ret_802_11_key_material(priv, resp);
|
ret = wlan_ret_802_11_key_material(priv, resp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -687,22 +660,19 @@ static inline int handle_cmd_response(u16 respcmd,
|
|||||||
|
|
||||||
case cmd_ret_802_11_tpc_cfg:
|
case cmd_ret_802_11_tpc_cfg:
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
memmove(adapter->cur_cmd->pdata_buf,
|
memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg,
|
||||||
&resp->params.tpccfg,
|
|
||||||
sizeof(struct cmd_ds_802_11_tpc_cfg));
|
sizeof(struct cmd_ds_802_11_tpc_cfg));
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
break;
|
break;
|
||||||
case cmd_ret_802_11_led_gpio_ctrl:
|
case cmd_ret_802_11_led_gpio_ctrl:
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
memmove(adapter->cur_cmd->pdata_buf,
|
memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio,
|
||||||
&resp->params.ledgpio,
|
|
||||||
sizeof(struct cmd_ds_802_11_led_ctrl));
|
sizeof(struct cmd_ds_802_11_led_ctrl));
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
break;
|
break;
|
||||||
case cmd_ret_802_11_pwr_cfg:
|
case cmd_ret_802_11_pwr_cfg:
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
memmove(adapter->cur_cmd->pdata_buf,
|
memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg,
|
||||||
&resp->params.pwrcfg,
|
|
||||||
sizeof(struct cmd_ds_802_11_pwr_cfg));
|
sizeof(struct cmd_ds_802_11_pwr_cfg));
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
|
|
||||||
@ -724,23 +694,21 @@ static inline int handle_cmd_response(u16 respcmd,
|
|||||||
case cmd_ret_fwt_access:
|
case cmd_ret_fwt_access:
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
if (adapter->cur_cmd->pdata_buf)
|
if (adapter->cur_cmd->pdata_buf)
|
||||||
memcpy(adapter->cur_cmd->pdata_buf,
|
memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt,
|
||||||
&resp->params.fwt,
|
sizeof(resp->params.fwt));
|
||||||
sizeof(resp->params.fwt));
|
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
break;
|
break;
|
||||||
case cmd_ret_mesh_access:
|
case cmd_ret_mesh_access:
|
||||||
if (adapter->cur_cmd->pdata_buf)
|
if (adapter->cur_cmd->pdata_buf)
|
||||||
memcpy(adapter->cur_cmd->pdata_buf,
|
memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
|
||||||
&resp->params.mesh,
|
|
||||||
sizeof(resp->params.mesh));
|
sizeof(resp->params.mesh));
|
||||||
break;
|
break;
|
||||||
case cmd_rte_802_11_tx_rate_query:
|
case cmd_rte_802_11_tx_rate_query:
|
||||||
priv->adapter->txrate = resp->params.txrate.txrate;
|
priv->adapter->txrate = resp->params.txrate.txrate;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n",
|
lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
|
||||||
resp->command);
|
resp->command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -755,9 +723,9 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
ulong flags;
|
ulong flags;
|
||||||
u16 result;
|
u16 result;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies);
|
lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
|
||||||
|
|
||||||
/* Now we got response from FW, cancel the command timer */
|
/* Now we got response from FW, cancel the command timer */
|
||||||
del_timer(&adapter->command_timer);
|
del_timer(&adapter->command_timer);
|
||||||
@ -766,7 +734,7 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
|
|
||||||
if (!adapter->cur_cmd) {
|
if (!adapter->cur_cmd) {
|
||||||
lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
|
lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
goto done;
|
goto done;
|
||||||
@ -774,17 +742,17 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr);
|
resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr);
|
||||||
|
|
||||||
lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr,
|
lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr,
|
||||||
priv->wlan_dev.upld_len);
|
priv->upld_len);
|
||||||
|
|
||||||
respcmd = le16_to_cpu(resp->command);
|
respcmd = le16_to_cpu(resp->command);
|
||||||
|
|
||||||
result = le16_to_cpu(resp->result);
|
result = le16_to_cpu(resp->result);
|
||||||
|
|
||||||
lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd,
|
lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
|
||||||
result, priv->wlan_dev.upld_len);
|
result, priv->upld_len);
|
||||||
|
|
||||||
if (!(respcmd & 0x8000)) {
|
if (!(respcmd & 0x8000)) {
|
||||||
lbs_pr_debug(1, "Invalid response to command!");
|
lbs_deb_cmd("Invalid response to command!");
|
||||||
adapter->cur_cmd_retcode = -1;
|
adapter->cur_cmd_retcode = -1;
|
||||||
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
|
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
|
||||||
adapter->nr_cmd_pending--;
|
adapter->nr_cmd_pending--;
|
||||||
@ -795,56 +763,52 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store the response code to cur_cmd_retcode. */
|
/* Store the response code to cur_cmd_retcode. */
|
||||||
adapter->cur_cmd_retcode = le16_to_cpu(resp->result);
|
adapter->cur_cmd_retcode = result;;
|
||||||
|
|
||||||
if (respcmd == cmd_ret_802_11_ps_mode) {
|
if (respcmd == cmd_ret_802_11_ps_mode) {
|
||||||
struct cmd_ds_802_11_ps_mode *psmode;
|
struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
|
||||||
|
u16 action = le16_to_cpu(psmode->action);
|
||||||
|
|
||||||
psmode = &resp->params.psmode;
|
lbs_deb_cmd(
|
||||||
lbs_pr_debug(1,
|
|
||||||
"CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
|
"CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
|
||||||
resp->result, psmode->action);
|
result, action);
|
||||||
psmode->action = cpu_to_le16(psmode->action);
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
|
lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
|
||||||
resp->result);
|
result);
|
||||||
if (adapter->mode == IW_MODE_ADHOC) {
|
/*
|
||||||
/*
|
* We should not re-try enter-ps command in
|
||||||
* We should not re-try enter-ps command in
|
* ad-hoc mode. It takes place in
|
||||||
* ad-hoc mode. It takes place in
|
* libertas_execute_next_command().
|
||||||
* libertas_execute_next_command().
|
*/
|
||||||
*/
|
if (adapter->mode == IW_MODE_ADHOC &&
|
||||||
if (psmode->action == cmd_subcmd_enter_ps)
|
action == cmd_subcmd_enter_ps)
|
||||||
adapter->psmode =
|
adapter->psmode = wlan802_11powermodecam;
|
||||||
wlan802_11powermodecam;
|
} else if (action == cmd_subcmd_enter_ps) {
|
||||||
}
|
|
||||||
} else if (psmode->action == cmd_subcmd_enter_ps) {
|
|
||||||
adapter->needtowakeup = 0;
|
adapter->needtowakeup = 0;
|
||||||
adapter->psstate = PS_STATE_AWAKE;
|
adapter->psstate = PS_STATE_AWAKE;
|
||||||
|
|
||||||
lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n");
|
lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
|
||||||
if (adapter->connect_status != libertas_connected) {
|
if (adapter->connect_status != libertas_connected) {
|
||||||
/*
|
/*
|
||||||
* When Deauth Event received before Enter_PS command
|
* When Deauth Event received before Enter_PS command
|
||||||
* response, We need to wake up the firmware.
|
* response, We need to wake up the firmware.
|
||||||
*/
|
*/
|
||||||
lbs_pr_debug(1,
|
lbs_deb_cmd(
|
||||||
"Disconnected, Going to invoke libertas_ps_wakeup\n");
|
"Disconnected, Going to invoke libertas_ps_wakeup\n");
|
||||||
|
|
||||||
mutex_unlock(&adapter->lock);
|
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
|
mutex_unlock(&adapter->lock);
|
||||||
libertas_ps_wakeup(priv, 0);
|
libertas_ps_wakeup(priv, 0);
|
||||||
mutex_lock(&adapter->lock);
|
mutex_lock(&adapter->lock);
|
||||||
spin_lock_irqsave(&adapter->driver_lock, flags);
|
spin_lock_irqsave(&adapter->driver_lock, flags);
|
||||||
}
|
}
|
||||||
} else if (psmode->action == cmd_subcmd_exit_ps) {
|
} else if (action == cmd_subcmd_exit_ps) {
|
||||||
adapter->needtowakeup = 0;
|
adapter->needtowakeup = 0;
|
||||||
adapter->psstate = PS_STATE_FULL_POWER;
|
adapter->psstate = PS_STATE_FULL_POWER;
|
||||||
lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n");
|
lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n",
|
lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action);
|
||||||
psmode->action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
|
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
|
||||||
@ -865,15 +829,15 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
|
|
||||||
/* If the command is not successful, cleanup and return failure */
|
/* If the command is not successful, cleanup and return failure */
|
||||||
if ((result != 0 || !(respcmd & 0x8000))) {
|
if ((result != 0 || !(respcmd & 0x8000))) {
|
||||||
lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n",
|
lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
|
||||||
resp->command, resp->result);
|
respcmd, result);
|
||||||
/*
|
/*
|
||||||
* Handling errors here
|
* Handling errors here
|
||||||
*/
|
*/
|
||||||
switch (respcmd) {
|
switch (respcmd) {
|
||||||
case cmd_ret_hw_spec_info:
|
case cmd_ret_hw_spec_info:
|
||||||
case cmd_ret_802_11_reset:
|
case cmd_ret_802_11_reset:
|
||||||
lbs_pr_debug(1, "CMD_RESP: Reset command failed\n");
|
lbs_deb_cmd("CMD_RESP: Reset command failed\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -903,7 +867,7 @@ int libertas_process_rx_command(wlan_private * priv)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&adapter->lock);
|
mutex_unlock(&adapter->lock);
|
||||||
LEAVE();
|
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,37 +881,37 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
eventcause = adapter->eventcause;
|
eventcause = adapter->eventcause;
|
||||||
spin_unlock_irq(&adapter->driver_lock);
|
spin_unlock_irq(&adapter->driver_lock);
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_CMD);
|
||||||
|
|
||||||
lbs_pr_debug(1, "EVENT Cause %x\n", eventcause);
|
lbs_deb_cmd("EVENT Cause %x\n", eventcause);
|
||||||
|
|
||||||
switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
|
switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
|
||||||
case MACREG_INT_CODE_LINK_SENSED:
|
case MACREG_INT_CODE_LINK_SENSED:
|
||||||
lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n");
|
lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_DEAUTHENTICATED:
|
case MACREG_INT_CODE_DEAUTHENTICATED:
|
||||||
lbs_pr_debug(1, "EVENT: Deauthenticated\n");
|
lbs_deb_cmd("EVENT: Deauthenticated\n");
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_DISASSOCIATED:
|
case MACREG_INT_CODE_DISASSOCIATED:
|
||||||
lbs_pr_debug(1, "EVENT: Disassociated\n");
|
lbs_deb_cmd("EVENT: Disassociated\n");
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
|
case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
|
||||||
lbs_pr_debug(1, "EVENT: Link lost\n");
|
lbs_deb_cmd("EVENT: Link lost\n");
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_PS_SLEEP:
|
case MACREG_INT_CODE_PS_SLEEP:
|
||||||
lbs_pr_debug(1, "EVENT: SLEEP\n");
|
lbs_deb_cmd("EVENT: SLEEP\n");
|
||||||
lbs_pr_debug(1, "_");
|
lbs_deb_cmd("_");
|
||||||
|
|
||||||
/* handle unexpected PS SLEEP event */
|
/* handle unexpected PS SLEEP event */
|
||||||
if (adapter->psstate == PS_STATE_FULL_POWER) {
|
if (adapter->psstate == PS_STATE_FULL_POWER) {
|
||||||
lbs_pr_debug(1,
|
lbs_deb_cmd(
|
||||||
"EVENT: In FULL POWER mode - ignore PS SLEEP\n");
|
"EVENT: In FULL POWER mode - ignore PS SLEEP\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -958,12 +922,12 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_PS_AWAKE:
|
case MACREG_INT_CODE_PS_AWAKE:
|
||||||
lbs_pr_debug(1, "EVENT: AWAKE \n");
|
lbs_deb_cmd("EVENT: AWAKE \n");
|
||||||
lbs_pr_debug(1, "|");
|
lbs_deb_cmd("|");
|
||||||
|
|
||||||
/* handle unexpected PS AWAKE event */
|
/* handle unexpected PS AWAKE event */
|
||||||
if (adapter->psstate == PS_STATE_FULL_POWER) {
|
if (adapter->psstate == PS_STATE_FULL_POWER) {
|
||||||
lbs_pr_debug(1,
|
lbs_deb_cmd(
|
||||||
"EVENT: In FULL POWER mode - ignore PS AWAKE\n");
|
"EVENT: In FULL POWER mode - ignore PS AWAKE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -977,18 +941,18 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
* adapter->needtowakeup will be set to FALSE
|
* adapter->needtowakeup will be set to FALSE
|
||||||
* in libertas_ps_wakeup()
|
* in libertas_ps_wakeup()
|
||||||
*/
|
*/
|
||||||
lbs_pr_debug(1, "Waking up...\n");
|
lbs_deb_cmd("Waking up...\n");
|
||||||
libertas_ps_wakeup(priv, 0);
|
libertas_ps_wakeup(priv, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_MIC_ERR_UNICAST:
|
case MACREG_INT_CODE_MIC_ERR_UNICAST:
|
||||||
lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n");
|
lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
|
||||||
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
|
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_MIC_ERR_MULTICAST:
|
case MACREG_INT_CODE_MIC_ERR_MULTICAST:
|
||||||
lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n");
|
lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
|
||||||
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
|
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
|
||||||
break;
|
break;
|
||||||
case MACREG_INT_CODE_MIB_CHANGED:
|
case MACREG_INT_CODE_MIB_CHANGED:
|
||||||
@ -996,7 +960,7 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_ADHOC_BCN_LOST:
|
case MACREG_INT_CODE_ADHOC_BCN_LOST:
|
||||||
lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n");
|
lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACREG_INT_CODE_RSSI_LOW:
|
case MACREG_INT_CODE_RSSI_LOW:
|
||||||
@ -1015,6 +979,17 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
lbs_pr_alert( "EVENT: SNR_HIGH\n");
|
lbs_pr_alert( "EVENT: SNR_HIGH\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MACREG_INT_CODE_MESH_AUTO_STARTED:
|
||||||
|
lbs_pr_alert( "EVENT: MESH_AUTO_STARTED\n");
|
||||||
|
adapter->connect_status = libertas_connected ;
|
||||||
|
if (priv->mesh_open == 1) {
|
||||||
|
netif_wake_queue(priv->mesh_dev) ;
|
||||||
|
netif_carrier_on(priv->mesh_dev) ;
|
||||||
|
}
|
||||||
|
adapter->mode = IW_MODE_ADHOC ;
|
||||||
|
schedule_work(&priv->sync_channel);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lbs_pr_alert( "EVENT: unknown event id: %#x\n",
|
lbs_pr_alert( "EVENT: unknown event id: %#x\n",
|
||||||
eventcause >> SBI_EVENT_CAUSE_SHIFT);
|
eventcause >> SBI_EVENT_CAUSE_SHIFT);
|
||||||
@ -1024,6 +999,7 @@ int libertas_process_event(wlan_private * priv)
|
|||||||
spin_lock_irq(&adapter->driver_lock);
|
spin_lock_irq(&adapter->driver_lock);
|
||||||
adapter->eventcause = 0;
|
adapter->eventcause = 0;
|
||||||
spin_unlock_irq(&adapter->driver_lock);
|
spin_unlock_irq(&adapter->driver_lock);
|
||||||
LEAVE();
|
|
||||||
|
lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <net/iw_handler.h>
|
#include <net/iw_handler.h>
|
||||||
|
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
@ -15,7 +16,9 @@ static char *szStates[] = {
|
|||||||
"Disconnected"
|
"Disconnected"
|
||||||
};
|
};
|
||||||
|
|
||||||
void libertas_debug_init(wlan_private * priv, struct net_device *dev);
|
#ifdef PROC_DEBUG
|
||||||
|
static void libertas_debug_init(wlan_private * priv, struct net_device *dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
static int open_file_generic(struct inode *inode, struct file *file)
|
static int open_file_generic(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
@ -60,43 +63,33 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
|
|||||||
int numscansdone = 0, res;
|
int numscansdone = 0, res;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||||
char *buf = (char *)addr;
|
char *buf = (char *)addr;
|
||||||
|
struct bss_descriptor * iter_bss;
|
||||||
|
|
||||||
pos += snprintf(buf+pos, len-pos,
|
|
||||||
"---------------------------------------");
|
|
||||||
pos += snprintf(buf+pos, len-pos,
|
|
||||||
"---------------------------------------\n");
|
|
||||||
pos += snprintf(buf+pos, len-pos,
|
pos += snprintf(buf+pos, len-pos,
|
||||||
"# | ch | ss | bssid | cap | TSF | Qual | SSID \n");
|
"# | ch | ss | bssid | cap | TSF | Qual | SSID \n");
|
||||||
pos += snprintf(buf+pos, len-pos,
|
|
||||||
"---------------------------------------");
|
|
||||||
pos += snprintf(buf+pos, len-pos,
|
|
||||||
"---------------------------------------\n");
|
|
||||||
|
|
||||||
while (numscansdone < priv->adapter->numinscantable) {
|
mutex_lock(&priv->adapter->lock);
|
||||||
struct bss_descriptor *pbssinfo;
|
list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
|
||||||
u16 cap;
|
u16 cap;
|
||||||
|
|
||||||
pbssinfo = &priv->adapter->scantable[numscansdone];
|
memcpy(&cap, &iter_bss->cap, sizeof(cap));
|
||||||
memcpy(&cap, &pbssinfo->cap, sizeof(cap));
|
|
||||||
pos += snprintf(buf+pos, len-pos,
|
pos += snprintf(buf+pos, len-pos,
|
||||||
"%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |",
|
"%02u| %03d | %03ld | " MAC_FMT " |",
|
||||||
numscansdone, pbssinfo->channel, pbssinfo->rssi,
|
numscansdone, iter_bss->channel, iter_bss->rssi,
|
||||||
pbssinfo->macaddress[0], pbssinfo->macaddress[1],
|
MAC_ARG(iter_bss->bssid));
|
||||||
pbssinfo->macaddress[2], pbssinfo->macaddress[3],
|
|
||||||
pbssinfo->macaddress[4], pbssinfo->macaddress[5]);
|
|
||||||
pos += snprintf(buf+pos, len-pos, " %04x-", cap);
|
pos += snprintf(buf+pos, len-pos, " %04x-", cap);
|
||||||
pos += snprintf(buf+pos, len-pos, "%c%c%c |",
|
pos += snprintf(buf+pos, len-pos, "%c%c%c |",
|
||||||
pbssinfo->cap.ibss ? 'A' : 'I',
|
iter_bss->cap.ibss ? 'A' : 'I',
|
||||||
pbssinfo->cap.privacy ? 'P' : ' ',
|
iter_bss->cap.privacy ? 'P' : ' ',
|
||||||
pbssinfo->cap.spectrummgmt ? 'S' : ' ');
|
iter_bss->cap.spectrummgmt ? 'S' : ' ');
|
||||||
pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf);
|
pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
|
||||||
pos += snprintf(buf+pos, len-pos, " %d |",
|
pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
|
||||||
SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi));
|
pos += snprintf(buf+pos, len-pos, " %s\n",
|
||||||
|
escape_essid(iter_bss->ssid, iter_bss->ssid_len));
|
||||||
pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid);
|
|
||||||
|
|
||||||
numscansdone++;
|
numscansdone++;
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&priv->adapter->lock);
|
||||||
|
|
||||||
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
||||||
|
|
||||||
@ -111,7 +104,6 @@ static ssize_t libertas_sleepparams_write(struct file *file,
|
|||||||
wlan_private *priv = file->private_data;
|
wlan_private *priv = file->private_data;
|
||||||
ssize_t buf_size, res;
|
ssize_t buf_size, res;
|
||||||
int p1, p2, p3, p4, p5, p6;
|
int p1, p2, p3, p4, p5, p6;
|
||||||
struct sleep_params sp;
|
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||||
char *buf = (char *)addr;
|
char *buf = (char *)addr;
|
||||||
|
|
||||||
@ -125,14 +117,12 @@ static ssize_t libertas_sleepparams_write(struct file *file,
|
|||||||
res = -EFAULT;
|
res = -EFAULT;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
sp.sp_error = p1;
|
priv->adapter->sp.sp_error = p1;
|
||||||
sp.sp_offset = p2;
|
priv->adapter->sp.sp_offset = p2;
|
||||||
sp.sp_stabletime = p3;
|
priv->adapter->sp.sp_stabletime = p3;
|
||||||
sp.sp_calcontrol = p4;
|
priv->adapter->sp.sp_calcontrol = p4;
|
||||||
sp.sp_extsleepclk = p5;
|
priv->adapter->sp.sp_extsleepclk = p5;
|
||||||
sp.sp_reserved = p6;
|
priv->adapter->sp.sp_reserved = p6;
|
||||||
|
|
||||||
memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params));
|
|
||||||
|
|
||||||
res = libertas_prepare_and_send_command(priv,
|
res = libertas_prepare_and_send_command(priv,
|
||||||
cmd_802_11_sleep_params,
|
cmd_802_11_sleep_params,
|
||||||
@ -185,7 +175,6 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
|
|||||||
{
|
{
|
||||||
wlan_private *priv = file->private_data;
|
wlan_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
ssize_t res, buf_size;
|
||||||
struct WLAN_802_11_SSID extscan_ssid;
|
|
||||||
union iwreq_data wrqu;
|
union iwreq_data wrqu;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||||
char *buf = (char *)addr;
|
char *buf = (char *)addr;
|
||||||
@ -196,13 +185,10 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1);
|
libertas_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0);
|
||||||
extscan_ssid.ssidlength = strlen(buf)-1;
|
|
||||||
|
|
||||||
libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1);
|
|
||||||
|
|
||||||
memset(&wrqu, 0, sizeof(union iwreq_data));
|
memset(&wrqu, 0, sizeof(union iwreq_data));
|
||||||
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
|
wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -251,16 +237,13 @@ static void libertas_parse_bssid(char *buf, size_t count,
|
|||||||
{
|
{
|
||||||
char *hold;
|
char *hold;
|
||||||
unsigned int mac[ETH_ALEN];
|
unsigned int mac[ETH_ALEN];
|
||||||
int i;
|
|
||||||
|
|
||||||
hold = strstr(buf, "bssid=");
|
hold = strstr(buf, "bssid=");
|
||||||
if (!hold)
|
if (!hold)
|
||||||
return;
|
return;
|
||||||
hold += 6;
|
hold += 6;
|
||||||
sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3,
|
sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5);
|
||||||
mac+4, mac+5);
|
memcpy(scan_cfg->bssid, mac, ETH_ALEN);
|
||||||
for(i=0;i<ETH_ALEN;i++)
|
|
||||||
scan_cfg->specificBSSID[i] = mac[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void libertas_parse_ssid(char *buf, size_t count,
|
static void libertas_parse_ssid(char *buf, size_t count,
|
||||||
@ -278,28 +261,26 @@ static void libertas_parse_ssid(char *buf, size_t count,
|
|||||||
end = buf + count - 1;
|
end = buf + count - 1;
|
||||||
|
|
||||||
size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
|
size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
|
||||||
strncpy(scan_cfg->specificSSID, hold, size);
|
strncpy(scan_cfg->ssid, hold, size);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void libertas_parse_keep(char *buf, size_t count,
|
static int libertas_parse_clear(char *buf, size_t count, const char *tag)
|
||||||
struct wlan_ioctl_user_scan_cfg *scan_cfg)
|
|
||||||
{
|
{
|
||||||
char *hold;
|
char *hold;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
hold = strstr(buf, "keep=");
|
hold = strstr(buf, tag);
|
||||||
if (!hold)
|
if (!hold)
|
||||||
return;
|
return 0;
|
||||||
hold += 5;
|
hold += strlen(tag);
|
||||||
sscanf(hold, "%d", &val);
|
sscanf(hold, "%d", &val);
|
||||||
|
|
||||||
if (val != 0)
|
if (val != 0)
|
||||||
val = 1;
|
val = 1;
|
||||||
|
|
||||||
scan_cfg->keeppreviousscan = val;
|
return val;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int libertas_parse_dur(char *buf, size_t count,
|
static int libertas_parse_dur(char *buf, size_t count,
|
||||||
@ -382,17 +363,18 @@ static ssize_t libertas_setuserscan(struct file *file,
|
|||||||
dur = libertas_parse_dur(buf, count, scan_cfg);
|
dur = libertas_parse_dur(buf, count, scan_cfg);
|
||||||
libertas_parse_chan(buf, count, scan_cfg, dur);
|
libertas_parse_chan(buf, count, scan_cfg, dur);
|
||||||
libertas_parse_bssid(buf, count, scan_cfg);
|
libertas_parse_bssid(buf, count, scan_cfg);
|
||||||
|
scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid=");
|
||||||
libertas_parse_ssid(buf, count, scan_cfg);
|
libertas_parse_ssid(buf, count, scan_cfg);
|
||||||
libertas_parse_keep(buf, count, scan_cfg);
|
scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid=");
|
||||||
libertas_parse_probes(buf, count, scan_cfg);
|
libertas_parse_probes(buf, count, scan_cfg);
|
||||||
libertas_parse_type(buf, count, scan_cfg);
|
libertas_parse_type(buf, count, scan_cfg);
|
||||||
|
|
||||||
wlan_scan_networks(priv, scan_cfg);
|
wlan_scan_networks(priv, scan_cfg, 1);
|
||||||
wait_event_interruptible(priv->adapter->cmd_pending,
|
wait_event_interruptible(priv->adapter->cmd_pending,
|
||||||
!priv->adapter->nr_cmd_pending);
|
!priv->adapter->nr_cmd_pending);
|
||||||
|
|
||||||
memset(&wrqu, 0x00, sizeof(union iwreq_data));
|
memset(&wrqu, 0x00, sizeof(union iwreq_data));
|
||||||
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
|
wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -407,11 +389,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
|
|||||||
u16 wait_option = cmd_option_waitforrsp;
|
u16 wait_option = cmd_option_waitforrsp;
|
||||||
|
|
||||||
if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
|
if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
|
||||||
lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n");
|
lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
|
if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
|
||||||
lbs_pr_debug(1, "failed to allocate response buffer!\n");
|
lbs_deb_debugfs("failed to allocate response buffer!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
|
libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
|
||||||
@ -420,8 +402,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
|
|||||||
(*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
|
(*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
|
||||||
(*cmdnode)->cmdwaitqwoken = 0;
|
(*cmdnode)->cmdwaitqwoken = 0;
|
||||||
*cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
|
*cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
|
||||||
(*cmd)->command = cmd_802_11_subscribe_event;
|
(*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event);
|
||||||
(*cmd)->seqnum = ++priv->adapter->seqnum;
|
(*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum);
|
||||||
(*cmd)->result = 0;
|
(*cmd)->result = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -447,26 +429,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -474,17 +455,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_rssithreshold *Lowrssi;
|
struct mrvlietypes_rssithreshold *Lowrssi;
|
||||||
case TLV_TYPE_RSSI_LOW:
|
case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW):
|
||||||
Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len);
|
Lowrssi = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
||||||
Lowrssi->rssivalue,
|
Lowrssi->rssivalue,
|
||||||
Lowrssi->rssifreq,
|
Lowrssi->rssifreq,
|
||||||
(event->events & 0x0001)?1:0);
|
(event->events & cpu_to_le16(0x0001))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
||||||
break;
|
break;
|
||||||
@ -512,21 +493,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
|
|||||||
return res;
|
return res;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -538,7 +518,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
||||||
event_bitmap = event->events;
|
event_bitmap = le16_to_cpu(event->events);
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
return event_bitmap;
|
return event_bitmap;
|
||||||
}
|
}
|
||||||
@ -579,7 +559,7 @@ static ssize_t libertas_lowrssi_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_rssithreshold));
|
sizeof(struct mrvlietypes_rssithreshold));
|
||||||
@ -588,30 +568,30 @@ static ssize_t libertas_lowrssi_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
|
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
|
||||||
rssi_threshold->header.type = cpu_to_le16(0x0104);
|
rssi_threshold->header.type = cpu_to_le16(0x0104);
|
||||||
rssi_threshold->header.len = 2;
|
rssi_threshold->header.len = cpu_to_le16(2);
|
||||||
rssi_threshold->rssivalue = cpu_to_le16(value);
|
rssi_threshold->rssivalue = value;
|
||||||
rssi_threshold->rssifreq = cpu_to_le16(freq);
|
rssi_threshold->rssifreq = freq;
|
||||||
event_bitmap |= subscribed ? 0x0001 : 0x0;
|
event_bitmap |= subscribed ? 0x0001 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -645,27 +625,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -673,17 +652,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_snrthreshold *LowSnr;
|
struct mrvlietypes_snrthreshold *LowSnr;
|
||||||
case TLV_TYPE_SNR_LOW:
|
case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW):
|
||||||
LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len);
|
LowSnr = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
||||||
LowSnr->snrvalue,
|
LowSnr->snrvalue,
|
||||||
LowSnr->snrfreq,
|
LowSnr->snrfreq,
|
||||||
(event->events & 0x0002)?1:0);
|
(event->events & cpu_to_le16(0x0002))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
||||||
break;
|
break;
|
||||||
@ -733,7 +712,7 @@ static ssize_t libertas_lowsnr_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_snrthreshold));
|
sizeof(struct mrvlietypes_snrthreshold));
|
||||||
@ -741,30 +720,30 @@ static ssize_t libertas_lowsnr_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
|
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
|
||||||
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
|
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
|
||||||
snr_threshold->header.len = 2;
|
snr_threshold->header.len = cpu_to_le16(2);
|
||||||
snr_threshold->snrvalue = cpu_to_le16(value);
|
snr_threshold->snrvalue = value;
|
||||||
snr_threshold->snrfreq = cpu_to_le16(freq);
|
snr_threshold->snrfreq = freq;
|
||||||
event_bitmap |= subscribed ? 0x0002 : 0x0;
|
event_bitmap |= subscribed ? 0x0002 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -799,27 +778,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -827,17 +805,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_failurecount *failcount;
|
struct mrvlietypes_failurecount *failcount;
|
||||||
case TLV_TYPE_FAILCOUNT:
|
case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT):
|
||||||
failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len);
|
failcount = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
||||||
failcount->failvalue,
|
failcount->failvalue,
|
||||||
failcount->Failfreq,
|
failcount->Failfreq,
|
||||||
(event->events & 0x0004)?1:0);
|
(event->events & cpu_to_le16(0x0004))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_failurecount);
|
cmd_len += sizeof(struct mrvlietypes_failurecount);
|
||||||
break;
|
break;
|
||||||
@ -886,7 +864,7 @@ static ssize_t libertas_failcount_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_failurecount));
|
sizeof(struct mrvlietypes_failurecount));
|
||||||
@ -894,30 +872,30 @@ static ssize_t libertas_failcount_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
failcount = (struct mrvlietypes_failurecount *)(ptr);
|
failcount = (struct mrvlietypes_failurecount *)(ptr);
|
||||||
failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
|
failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
|
||||||
failcount->header.len = 2;
|
failcount->header.len = cpu_to_le16(2);
|
||||||
failcount->failvalue = cpu_to_le16(value);
|
failcount->failvalue = value;
|
||||||
failcount->Failfreq = cpu_to_le16(freq);
|
failcount->Failfreq = freq;
|
||||||
event_bitmap |= subscribed ? 0x0004 : 0x0;
|
event_bitmap |= subscribed ? 0x0004 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = (struct cmd_ds_command *)response_buf;
|
pcmdptr = (struct cmd_ds_command *)response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -951,27 +929,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
@ -979,16 +956,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_beaconsmissed *bcnmiss;
|
struct mrvlietypes_beaconsmissed *bcnmiss;
|
||||||
case TLV_TYPE_BCNMISS:
|
case __constant_cpu_to_le16(TLV_TYPE_BCNMISS):
|
||||||
bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len);
|
bcnmiss = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
|
||||||
bcnmiss->beaconmissed,
|
bcnmiss->beaconmissed,
|
||||||
(event->events & 0x0008)?1:0);
|
(event->events & cpu_to_le16(0x0008))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
|
cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
|
||||||
break;
|
break;
|
||||||
@ -1038,7 +1015,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_beaconsmissed));
|
sizeof(struct mrvlietypes_beaconsmissed));
|
||||||
@ -1046,29 +1023,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
|
bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
|
||||||
bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
|
bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
|
||||||
bcnmiss->header.len = 2;
|
bcnmiss->header.len = cpu_to_le16(2);
|
||||||
bcnmiss->beaconmissed = cpu_to_le16(value);
|
bcnmiss->beaconmissed = value;
|
||||||
event_bitmap |= subscribed ? 0x0008 : 0x0;
|
event_bitmap |= subscribed ? 0x0008 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
@ -1102,27 +1079,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -1130,17 +1106,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_rssithreshold *Highrssi;
|
struct mrvlietypes_rssithreshold *Highrssi;
|
||||||
case TLV_TYPE_RSSI_HIGH:
|
case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH):
|
||||||
Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len);
|
Highrssi = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
||||||
Highrssi->rssivalue,
|
Highrssi->rssivalue,
|
||||||
Highrssi->rssifreq,
|
Highrssi->rssifreq,
|
||||||
(event->events & 0x0010)?1:0);
|
(event->events & cpu_to_le16(0x0010))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
||||||
break;
|
break;
|
||||||
@ -1190,7 +1166,7 @@ static ssize_t libertas_highrssi_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_rssithreshold));
|
sizeof(struct mrvlietypes_rssithreshold));
|
||||||
@ -1198,29 +1174,29 @@ static ssize_t libertas_highrssi_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
|
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
|
||||||
rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
|
rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
|
||||||
rssi_threshold->header.len = 2;
|
rssi_threshold->header.len = cpu_to_le16(2);
|
||||||
rssi_threshold->rssivalue = cpu_to_le16(value);
|
rssi_threshold->rssivalue = value;
|
||||||
rssi_threshold->rssifreq = cpu_to_le16(freq);
|
rssi_threshold->rssifreq = freq;
|
||||||
event_bitmap |= subscribed ? 0x0010 : 0x0;
|
event_bitmap |= subscribed ? 0x0010 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1253,27 +1229,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_get;
|
event->action = cpu_to_le16(cmd_act_get);
|
||||||
pcmdptr->size =
|
pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -1281,17 +1256,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
|
||||||
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
|
event = (void *)(response_buf + S_DS_GEN);
|
||||||
while (cmd_len < pcmdptr->size) {
|
while (cmd_len < le16_to_cpu(pcmdptr->size)) {
|
||||||
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
|
struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
|
||||||
switch(header->type) {
|
switch (header->type) {
|
||||||
struct mrvlietypes_snrthreshold *HighSnr;
|
struct mrvlietypes_snrthreshold *HighSnr;
|
||||||
case TLV_TYPE_SNR_HIGH:
|
case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH):
|
||||||
HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len);
|
HighSnr = (void *)(response_buf + cmd_len);
|
||||||
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
|
||||||
HighSnr->snrvalue,
|
HighSnr->snrvalue,
|
||||||
HighSnr->snrfreq,
|
HighSnr->snrfreq,
|
||||||
(event->events & 0x0020)?1:0);
|
(event->events & cpu_to_le16(0x0020))?1:0);
|
||||||
default:
|
default:
|
||||||
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
cmd_len += sizeof(struct mrvlietypes_snrthreshold);
|
||||||
break;
|
break;
|
||||||
@ -1341,7 +1316,7 @@ static ssize_t libertas_highsnr_write(struct file *file,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
event = &pcmdptr->params.subscribe_event;
|
event = &pcmdptr->params.subscribe_event;
|
||||||
event->action = cmd_act_set;
|
event->action = cpu_to_le16(cmd_act_set);
|
||||||
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
pcmdptr->size = cpu_to_le16(S_DS_GEN +
|
||||||
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
sizeof(struct cmd_ds_802_11_subscribe_event) +
|
||||||
sizeof(struct mrvlietypes_snrthreshold));
|
sizeof(struct mrvlietypes_snrthreshold));
|
||||||
@ -1349,30 +1324,30 @@ static ssize_t libertas_highsnr_write(struct file *file,
|
|||||||
ptr = (u8*) pcmdptr+cmd_len;
|
ptr = (u8*) pcmdptr+cmd_len;
|
||||||
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
|
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
|
||||||
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
|
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
|
||||||
snr_threshold->header.len = 2;
|
snr_threshold->header.len = cpu_to_le16(2);
|
||||||
snr_threshold->snrvalue = cpu_to_le16(value);
|
snr_threshold->snrvalue = value;
|
||||||
snr_threshold->snrfreq = cpu_to_le16(freq);
|
snr_threshold->snrfreq = freq;
|
||||||
event_bitmap |= subscribed ? 0x0020 : 0x0;
|
event_bitmap |= subscribed ? 0x0020 : 0x0;
|
||||||
event->events = event_bitmap;
|
event->events = cpu_to_le16(event_bitmap);
|
||||||
|
|
||||||
libertas_queue_cmd(adapter, pcmdnode, 1);
|
libertas_queue_cmd(adapter, pcmdnode, 1);
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
|
||||||
/* Sleep until response is generated by FW */
|
/* Sleep until response is generated by FW */
|
||||||
wait_event_interruptible(pcmdnode->cmdwait_q,
|
wait_event_interruptible(pcmdnode->cmdwait_q,
|
||||||
pcmdnode->cmdwaitqwoken);
|
pcmdnode->cmdwaitqwoken);
|
||||||
|
|
||||||
pcmdptr = response_buf;
|
pcmdptr = response_buf;
|
||||||
|
|
||||||
if (pcmdptr->result) {
|
if (pcmdptr->result) {
|
||||||
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
|
lbs_pr_err("%s: fail, result=%d\n", __func__,
|
||||||
pcmdptr->result);
|
le16_to_cpu(pcmdptr->result));
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
|
if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
|
||||||
lbs_pr_err("command response incorrect!\n");
|
lbs_pr_err("command response incorrect!\n");
|
||||||
kfree(response_buf);
|
kfree(response_buf);
|
||||||
free_page(addr);
|
free_page(addr);
|
||||||
@ -1760,7 +1735,7 @@ void libertas_debugfs_remove_one(wlan_private *priv)
|
|||||||
|
|
||||||
debugfs_remove(priv->regs_dir);
|
debugfs_remove(priv->regs_dir);
|
||||||
|
|
||||||
for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
|
for(i=0; i<ARRAY_SIZE(debugfs_events_files); i++)
|
||||||
debugfs_remove(priv->debugfs_events_files[i]);
|
debugfs_remove(priv->debugfs_events_files[i]);
|
||||||
|
|
||||||
debugfs_remove(priv->events_dir);
|
debugfs_remove(priv->events_dir);
|
||||||
@ -1769,13 +1744,19 @@ void libertas_debugfs_remove_one(wlan_private *priv)
|
|||||||
#endif
|
#endif
|
||||||
for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
|
for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
|
||||||
debugfs_remove(priv->debugfs_files[i]);
|
debugfs_remove(priv->debugfs_files[i]);
|
||||||
|
debugfs_remove(priv->debugfs_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* debug entry */
|
/* debug entry */
|
||||||
|
|
||||||
|
#ifdef PROC_DEBUG
|
||||||
|
|
||||||
#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n))
|
#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n))
|
||||||
#define item_addr(n) (offsetof(wlan_adapter, n))
|
#define item_addr(n) (offsetof(wlan_adapter, n))
|
||||||
|
|
||||||
|
|
||||||
struct debug_data {
|
struct debug_data {
|
||||||
char name[32];
|
char name[32];
|
||||||
u32 size;
|
u32 size;
|
||||||
@ -1863,7 +1844,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (copy_from_user(pdata, buf, cnt)) {
|
if (copy_from_user(pdata, buf, cnt)) {
|
||||||
lbs_pr_debug(1, "Copy from user failed\n");
|
lbs_deb_debugfs("Copy from user failed\n");
|
||||||
kfree(pdata);
|
kfree(pdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1913,7 +1894,7 @@ static struct file_operations libertas_debug_fops = {
|
|||||||
* @param dev pointer net_device
|
* @param dev pointer net_device
|
||||||
* @return N/A
|
* @return N/A
|
||||||
*/
|
*/
|
||||||
void libertas_debug_init(wlan_private * priv, struct net_device *dev)
|
static void libertas_debug_init(wlan_private * priv, struct net_device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1927,4 +1908,5 @@ void libertas_debug_init(wlan_private * priv, struct net_device *dev)
|
|||||||
priv->debugfs_dir, &items[0],
|
priv->debugfs_dir, &items[0],
|
||||||
&libertas_debug_fops);
|
&libertas_debug_fops);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef _WLAN_DECL_H_
|
#ifndef _WLAN_DECL_H_
|
||||||
#define _WLAN_DECL_H_
|
#define _WLAN_DECL_H_
|
||||||
|
|
||||||
|
#include <linux/device.h>
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
/** Function Prototype Declaration */
|
/** Function Prototype Declaration */
|
||||||
@ -66,18 +68,24 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option);
|
|||||||
|
|
||||||
void libertas_tx_runqueue(wlan_private *priv);
|
void libertas_tx_runqueue(wlan_private *priv);
|
||||||
|
|
||||||
extern struct chan_freq_power *libertas_find_cfp_by_band_and_channel(
|
struct chan_freq_power *libertas_find_cfp_by_band_and_channel(
|
||||||
wlan_adapter * adapter, u8 band, u16 channel);
|
wlan_adapter * adapter, u8 band, u16 channel);
|
||||||
|
|
||||||
extern void libertas_mac_event_disconnected(wlan_private * priv);
|
void libertas_mac_event_disconnected(wlan_private * priv);
|
||||||
|
|
||||||
void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
|
void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
|
||||||
|
|
||||||
int reset_device(wlan_private *priv);
|
/* fw.c */
|
||||||
|
int libertas_init_fw(wlan_private * priv, char *fw_name);
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
|
struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
|
||||||
int *cfp_no);
|
int *cfp_no);
|
||||||
wlan_private *wlan_add_card(void *card);
|
wlan_private *libertas_add_card(void *card, struct device *dmdev);
|
||||||
int wlan_remove_card(void *card);
|
int libertas_activate_card(wlan_private *priv, char *fw_name);
|
||||||
|
int libertas_remove_card(wlan_private *priv);
|
||||||
|
int libertas_add_mesh(wlan_private *priv, struct device *dev);
|
||||||
|
void libertas_remove_mesh(wlan_private *priv);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _WLAN_DECL_H_ */
|
#endif /* _WLAN_DECL_H_ */
|
||||||
|
@ -7,14 +7,79 @@
|
|||||||
|
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
extern unsigned int libertas_debug;
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIBERTAS_DEBUG
|
#ifdef CONFIG_LIBERTAS_DEBUG
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#define PROC_DEBUG
|
#define PROC_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DRV_NAME "usb8xxx"
|
#ifndef DRV_NAME
|
||||||
|
#define DRV_NAME "libertas"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define LBS_DEB_ENTER 0x00000001
|
||||||
|
#define LBS_DEB_LEAVE 0x00000002
|
||||||
|
#define LBS_DEB_MAIN 0x00000004
|
||||||
|
#define LBS_DEB_NET 0x00000008
|
||||||
|
#define LBS_DEB_MESH 0x00000010
|
||||||
|
#define LBS_DEB_WEXT 0x00000020
|
||||||
|
#define LBS_DEB_IOCTL 0x00000040
|
||||||
|
#define LBS_DEB_SCAN 0x00000080
|
||||||
|
#define LBS_DEB_ASSOC 0x00000100
|
||||||
|
#define LBS_DEB_JOIN 0x00000200
|
||||||
|
#define LBS_DEB_11D 0x00000400
|
||||||
|
#define LBS_DEB_DEBUGFS 0x00000800
|
||||||
|
#define LBS_DEB_ETHTOOL 0x00001000
|
||||||
|
#define LBS_DEB_HOST 0x00002000
|
||||||
|
#define LBS_DEB_CMD 0x00004000
|
||||||
|
#define LBS_DEB_RX 0x00008000
|
||||||
|
#define LBS_DEB_TX 0x00010000
|
||||||
|
#define LBS_DEB_USB 0x00020000
|
||||||
|
#define LBS_DEB_CS 0x00040000
|
||||||
|
#define LBS_DEB_FW 0x00080000
|
||||||
|
#define LBS_DEB_THREAD 0x00100000
|
||||||
|
#define LBS_DEB_HEX 0x00200000
|
||||||
|
|
||||||
|
extern unsigned int libertas_debug;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define LBS_DEB_LL(grp, fmt, args...) \
|
||||||
|
do { if ((libertas_debug & (grp)) == (grp)) \
|
||||||
|
printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
|
||||||
|
in_interrupt() ? " (INT)" : "", ## args); } while (0)
|
||||||
|
#else
|
||||||
|
#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define lbs_deb_enter(grp) \
|
||||||
|
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s():%d enter\n", __FUNCTION__, __LINE__);
|
||||||
|
#define lbs_deb_enter_args(grp, fmt, args...) \
|
||||||
|
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
|
||||||
|
#define lbs_deb_leave(grp) \
|
||||||
|
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
|
||||||
|
#define lbs_deb_leave_args(grp, fmt, args...) \
|
||||||
|
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
|
||||||
|
__FUNCTION__, __LINE__, ##args);
|
||||||
|
#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
|
||||||
|
#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
|
||||||
|
#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
|
||||||
|
#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
|
||||||
|
#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
|
||||||
|
#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
|
||||||
|
#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
|
||||||
|
#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
|
||||||
|
#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
|
||||||
|
#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
|
||||||
|
#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
|
||||||
|
#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
|
||||||
|
#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
|
||||||
|
#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
|
||||||
|
#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
|
||||||
|
#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
|
||||||
|
#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
|
||||||
|
#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
|
||||||
|
#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
|
||||||
|
#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
|
||||||
|
|
||||||
#define lbs_pr_info(format, args...) \
|
#define lbs_pr_info(format, args...) \
|
||||||
printk(KERN_INFO DRV_NAME": " format, ## args)
|
printk(KERN_INFO DRV_NAME": " format, ## args)
|
||||||
@ -24,37 +89,25 @@ extern unsigned int libertas_debug;
|
|||||||
printk(KERN_ALERT DRV_NAME": " format, ## args)
|
printk(KERN_ALERT DRV_NAME": " format, ## args)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define lbs_pr_debug(level, format, args...) \
|
|
||||||
do { if (libertas_debug >= level) \
|
|
||||||
printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
|
|
||||||
#define lbs_dev_dbg(level, device, format, args...) \
|
|
||||||
lbs_pr_debug(level, "%s: " format, \
|
|
||||||
(device)->bus_id , ## args)
|
|
||||||
|
|
||||||
static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
|
static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!libertas_debug)
|
if (!(libertas_debug & LBS_DEB_HEX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printk(KERN_DEBUG "%s: ", prompt);
|
printk(KERN_DEBUG "%s: ", prompt);
|
||||||
for (i = 1; i <= len; i++) {
|
for (i = 1; i <= len; i++) {
|
||||||
printk(KERN_DEBUG "%02x ", (u8) * buf);
|
printk("%02x ", (u8) * buf);
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define lbs_pr_debug(level, format, args...) do {} while (0)
|
|
||||||
#define lbs_dev_dbg(level, device, format, args...) do {} while (0)
|
|
||||||
#define lbs_dbg_hex(x,y,z) do {} while (0)
|
#define lbs_dbg_hex(x,y,z) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ENTER() lbs_pr_debug(1, "Enter: %s, %s:%i\n", \
|
|
||||||
__FUNCTION__, __FILE__, __LINE__)
|
|
||||||
#define LEAVE() lbs_pr_debug(1, "Leave: %s, %s:%i\n", \
|
|
||||||
__FUNCTION__, __FILE__, __LINE__)
|
|
||||||
|
|
||||||
/** Buffer Constants */
|
/** Buffer Constants */
|
||||||
|
|
||||||
@ -74,7 +127,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
|
|||||||
#define MRVDRV_NUM_OF_CMD_BUFFER 10
|
#define MRVDRV_NUM_OF_CMD_BUFFER 10
|
||||||
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
|
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
|
||||||
#define MRVDRV_MAX_CHANNEL_SIZE 14
|
#define MRVDRV_MAX_CHANNEL_SIZE 14
|
||||||
#define MRVDRV_MAX_BSSID_LIST 64
|
|
||||||
#define MRVDRV_ASSOCIATION_TIME_OUT 255
|
#define MRVDRV_ASSOCIATION_TIME_OUT 255
|
||||||
#define MRVDRV_SNAP_HEADER_LEN 8
|
#define MRVDRV_SNAP_HEADER_LEN 8
|
||||||
|
|
||||||
@ -104,6 +156,13 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
|
|||||||
#define MRVDRV_MAX_BEACON_INTERVAL 1000
|
#define MRVDRV_MAX_BEACON_INTERVAL 1000
|
||||||
#define MRVDRV_BEACON_INTERVAL 100
|
#define MRVDRV_BEACON_INTERVAL 100
|
||||||
|
|
||||||
|
/** INT status Bit Definition*/
|
||||||
|
#define his_cmddnldrdy 0x01
|
||||||
|
#define his_cardevent 0x02
|
||||||
|
#define his_cmdupldrdy 0x04
|
||||||
|
|
||||||
|
#define SBI_EVENT_CAUSE_SHIFT 3
|
||||||
|
|
||||||
/** TxPD status */
|
/** TxPD status */
|
||||||
|
|
||||||
/* Station firmware use TxPD status field to report final Tx transmit
|
/* Station firmware use TxPD status field to report final Tx transmit
|
||||||
@ -205,8 +264,6 @@ typedef struct _wlan_adapter wlan_adapter;
|
|||||||
extern const char libertas_driver_version[];
|
extern const char libertas_driver_version[];
|
||||||
extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE];
|
extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE];
|
||||||
|
|
||||||
extern u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES];
|
|
||||||
|
|
||||||
extern u8 libertas_supported_rates[G_SUPPORTED_RATES];
|
extern u8 libertas_supported_rates[G_SUPPORTED_RATES];
|
||||||
|
|
||||||
extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES];
|
extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES];
|
||||||
@ -316,6 +373,8 @@ enum SNMP_MIB_VALUE_e {
|
|||||||
/* Default values for fwt commands. */
|
/* Default values for fwt commands. */
|
||||||
#define FWT_DEFAULT_METRIC 0
|
#define FWT_DEFAULT_METRIC 0
|
||||||
#define FWT_DEFAULT_DIR 1
|
#define FWT_DEFAULT_DIR 1
|
||||||
|
/* Default Rate, 11Mbps */
|
||||||
|
#define FWT_DEFAULT_RATE 3
|
||||||
#define FWT_DEFAULT_SSN 0xffffffff
|
#define FWT_DEFAULT_SSN 0xffffffff
|
||||||
#define FWT_DEFAULT_DSN 0
|
#define FWT_DEFAULT_DSN 0
|
||||||
#define FWT_DEFAULT_HOPCOUNT 0
|
#define FWT_DEFAULT_HOPCOUNT 0
|
||||||
|
@ -63,11 +63,11 @@ struct wlan_802_11_security {
|
|||||||
|
|
||||||
/** Current Basic Service Set State Structure */
|
/** Current Basic Service Set State Structure */
|
||||||
struct current_bss_params {
|
struct current_bss_params {
|
||||||
struct bss_descriptor bssdescriptor;
|
|
||||||
/** bssid */
|
/** bssid */
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
/** ssid */
|
/** ssid */
|
||||||
struct WLAN_802_11_SSID ssid;
|
u8 ssid[IW_ESSID_MAX_SIZE + 1];
|
||||||
|
u8 ssid_len;
|
||||||
|
|
||||||
/** band */
|
/** band */
|
||||||
u8 band;
|
u8 band;
|
||||||
@ -89,31 +89,6 @@ struct sleep_params {
|
|||||||
u16 sp_reserved;
|
u16 sp_reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Data structure for the Marvell WLAN device */
|
|
||||||
typedef struct _wlan_dev {
|
|
||||||
/** device name */
|
|
||||||
char name[DEV_NAME_LEN];
|
|
||||||
/** card pointer */
|
|
||||||
void *card;
|
|
||||||
/** IO port */
|
|
||||||
u32 ioport;
|
|
||||||
/** Upload received */
|
|
||||||
u32 upld_rcv;
|
|
||||||
/** Upload type */
|
|
||||||
u32 upld_typ;
|
|
||||||
/** Upload length */
|
|
||||||
u32 upld_len;
|
|
||||||
/** netdev pointer */
|
|
||||||
struct net_device *netdev;
|
|
||||||
/* Upload buffer */
|
|
||||||
u8 upld_buf[WLAN_UPLD_SIZE];
|
|
||||||
/* Download sent:
|
|
||||||
bit0 1/0=data_sent/data_tx_done,
|
|
||||||
bit1 1/0=cmd_sent/cmd_tx_done,
|
|
||||||
all other bits reserved 0 */
|
|
||||||
u8 dnld_sent;
|
|
||||||
} wlan_dev_t, *pwlan_dev_t;
|
|
||||||
|
|
||||||
/* Mesh statistics */
|
/* Mesh statistics */
|
||||||
struct wlan_mesh_stats {
|
struct wlan_mesh_stats {
|
||||||
u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
|
u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
|
||||||
@ -123,6 +98,7 @@ struct wlan_mesh_stats {
|
|||||||
u32 fwd_drop_noroute; /* Fwd: No route to Destination */
|
u32 fwd_drop_noroute; /* Fwd: No route to Destination */
|
||||||
u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
|
u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
|
||||||
u32 drop_blind; /* Rx: Dropped by blinding table */
|
u32 drop_blind; /* Rx: Dropped by blinding table */
|
||||||
|
u32 tx_failed_cnt; /* Tx: Failed transmissions */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Private structure for the MV device */
|
/** Private structure for the MV device */
|
||||||
@ -131,8 +107,11 @@ struct _wlan_private {
|
|||||||
int mesh_open;
|
int mesh_open;
|
||||||
int infra_open;
|
int infra_open;
|
||||||
|
|
||||||
|
char name[DEV_NAME_LEN];
|
||||||
|
|
||||||
|
void *card;
|
||||||
wlan_adapter *adapter;
|
wlan_adapter *adapter;
|
||||||
wlan_dev_t wlan_dev;
|
struct net_device *dev;
|
||||||
|
|
||||||
struct net_device_stats stats;
|
struct net_device_stats stats;
|
||||||
struct net_device *mesh_dev ; /* Virtual device */
|
struct net_device *mesh_dev ; /* Virtual device */
|
||||||
@ -153,6 +132,16 @@ struct _wlan_private {
|
|||||||
u32 bbp_offset;
|
u32 bbp_offset;
|
||||||
u32 rf_offset;
|
u32 rf_offset;
|
||||||
|
|
||||||
|
/** Upload length */
|
||||||
|
u32 upld_len;
|
||||||
|
/* Upload buffer */
|
||||||
|
u8 upld_buf[WLAN_UPLD_SIZE];
|
||||||
|
/* Download sent:
|
||||||
|
bit0 1/0=data_sent/data_tx_done,
|
||||||
|
bit1 1/0=cmd_sent/cmd_tx_done,
|
||||||
|
all other bits reserved 0 */
|
||||||
|
u8 dnld_sent;
|
||||||
|
|
||||||
const struct firmware *firmware;
|
const struct firmware *firmware;
|
||||||
struct device *hotplug_device;
|
struct device *hotplug_device;
|
||||||
|
|
||||||
@ -161,6 +150,15 @@ struct _wlan_private {
|
|||||||
|
|
||||||
struct delayed_work assoc_work;
|
struct delayed_work assoc_work;
|
||||||
struct workqueue_struct *assoc_thread;
|
struct workqueue_struct *assoc_thread;
|
||||||
|
struct work_struct sync_channel;
|
||||||
|
|
||||||
|
/** Hardware access */
|
||||||
|
int (*hw_register_dev) (wlan_private * priv);
|
||||||
|
int (*hw_unregister_dev) (wlan_private *);
|
||||||
|
int (*hw_prog_firmware) (wlan_private *);
|
||||||
|
int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb);
|
||||||
|
int (*hw_get_int_status) (wlan_private * priv, u8 *);
|
||||||
|
int (*hw_read_event_cause) (wlan_private *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Association request
|
/** Association request
|
||||||
@ -171,18 +169,21 @@ struct _wlan_private {
|
|||||||
struct assoc_request {
|
struct assoc_request {
|
||||||
#define ASSOC_FLAG_SSID 1
|
#define ASSOC_FLAG_SSID 1
|
||||||
#define ASSOC_FLAG_CHANNEL 2
|
#define ASSOC_FLAG_CHANNEL 2
|
||||||
#define ASSOC_FLAG_MODE 3
|
#define ASSOC_FLAG_BAND 3
|
||||||
#define ASSOC_FLAG_BSSID 4
|
#define ASSOC_FLAG_MODE 4
|
||||||
#define ASSOC_FLAG_WEP_KEYS 5
|
#define ASSOC_FLAG_BSSID 5
|
||||||
#define ASSOC_FLAG_WEP_TX_KEYIDX 6
|
#define ASSOC_FLAG_WEP_KEYS 6
|
||||||
#define ASSOC_FLAG_WPA_MCAST_KEY 7
|
#define ASSOC_FLAG_WEP_TX_KEYIDX 7
|
||||||
#define ASSOC_FLAG_WPA_UCAST_KEY 8
|
#define ASSOC_FLAG_WPA_MCAST_KEY 8
|
||||||
#define ASSOC_FLAG_SECINFO 9
|
#define ASSOC_FLAG_WPA_UCAST_KEY 9
|
||||||
#define ASSOC_FLAG_WPA_IE 10
|
#define ASSOC_FLAG_SECINFO 10
|
||||||
|
#define ASSOC_FLAG_WPA_IE 11
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
struct WLAN_802_11_SSID ssid;
|
u8 ssid[IW_ESSID_MAX_SIZE + 1];
|
||||||
|
u8 ssid_len;
|
||||||
u8 channel;
|
u8 channel;
|
||||||
|
u8 band;
|
||||||
u8 mode;
|
u8 mode;
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
|
|
||||||
@ -199,12 +200,15 @@ struct assoc_request {
|
|||||||
/** WPA Information Elements*/
|
/** WPA Information Elements*/
|
||||||
u8 wpa_ie[MAX_WPA_IE_LEN];
|
u8 wpa_ie[MAX_WPA_IE_LEN];
|
||||||
u8 wpa_ie_len;
|
u8 wpa_ie_len;
|
||||||
|
|
||||||
|
/* BSS to associate with for infrastructure of Ad-Hoc join */
|
||||||
|
struct bss_descriptor bss;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Wlan adapter data structure*/
|
/** Wlan adapter data structure*/
|
||||||
struct _wlan_adapter {
|
struct _wlan_adapter {
|
||||||
/** STATUS variables */
|
/** STATUS variables */
|
||||||
u32 fwreleasenumber;
|
u8 fwreleasenumber[4];
|
||||||
u32 fwcapinfo;
|
u32 fwcapinfo;
|
||||||
/* protected with big lock */
|
/* protected with big lock */
|
||||||
|
|
||||||
@ -255,13 +259,14 @@ struct _wlan_adapter {
|
|||||||
/* IW_MODE_* */
|
/* IW_MODE_* */
|
||||||
u8 mode;
|
u8 mode;
|
||||||
|
|
||||||
struct bss_descriptor *pattemptedbssdesc;
|
u8 prev_ssid[IW_ESSID_MAX_SIZE + 1];
|
||||||
|
u8 prev_ssid_len;
|
||||||
|
u8 prev_bssid[ETH_ALEN];
|
||||||
|
|
||||||
struct WLAN_802_11_SSID previousssid;
|
/* Scan results list */
|
||||||
u8 previousbssid[ETH_ALEN];
|
struct list_head network_list;
|
||||||
|
struct list_head network_free_list;
|
||||||
struct bss_descriptor *scantable;
|
struct bss_descriptor *networks;
|
||||||
u32 numinscantable;
|
|
||||||
|
|
||||||
u8 scantype;
|
u8 scantype;
|
||||||
u32 scanmode;
|
u32 scanmode;
|
||||||
@ -288,7 +293,6 @@ struct _wlan_adapter {
|
|||||||
u32 txantenna;
|
u32 txantenna;
|
||||||
u32 rxantenna;
|
u32 rxantenna;
|
||||||
|
|
||||||
u8 adhocchannel;
|
|
||||||
u32 fragthsd;
|
u32 fragthsd;
|
||||||
u32 rtsthsd;
|
u32 rtsthsd;
|
||||||
|
|
||||||
@ -324,7 +328,8 @@ struct _wlan_adapter {
|
|||||||
u16 locallisteninterval;
|
u16 locallisteninterval;
|
||||||
u16 nullpktinterval;
|
u16 nullpktinterval;
|
||||||
|
|
||||||
struct assoc_request * assoc_req;
|
struct assoc_request * pending_assoc_req;
|
||||||
|
struct assoc_request * in_progress_assoc_req;
|
||||||
|
|
||||||
/** Encryption parameter */
|
/** Encryption parameter */
|
||||||
struct wlan_802_11_security secinfo;
|
struct wlan_802_11_security secinfo;
|
||||||
@ -396,6 +401,8 @@ struct _wlan_adapter {
|
|||||||
u32 radiomode;
|
u32 radiomode;
|
||||||
u32 debugmode;
|
u32 debugmode;
|
||||||
u8 fw_ready;
|
u8 fw_ready;
|
||||||
|
|
||||||
|
u8 last_scanned_channel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _WLAN_DEV_H_ */
|
#endif /* _WLAN_DEV_H_ */
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "sbi.h"
|
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
@ -17,7 +15,8 @@ static const char * mesh_stat_strings[]= {
|
|||||||
"drop_no_buffers",
|
"drop_no_buffers",
|
||||||
"fwded_unicast_cnt",
|
"fwded_unicast_cnt",
|
||||||
"fwded_bcast_cnt",
|
"fwded_bcast_cnt",
|
||||||
"drop_blind_table"
|
"drop_blind_table",
|
||||||
|
"tx_failed_cnt"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void libertas_ethtool_get_drvinfo(struct net_device *dev,
|
static void libertas_ethtool_get_drvinfo(struct net_device *dev,
|
||||||
@ -69,7 +68,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
|
|||||||
|
|
||||||
/* +14 is for action, offset, and NOB in
|
/* +14 is for action, offset, and NOB in
|
||||||
* response */
|
* response */
|
||||||
lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n",
|
lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
|
||||||
regctrl.action, regctrl.offset, regctrl.NOB);
|
regctrl.action, regctrl.offset, regctrl.NOB);
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv,
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
@ -81,8 +80,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
if (adapter->prdeeprom)
|
if (adapter->prdeeprom)
|
||||||
kfree(adapter->prdeeprom);
|
kfree(adapter->prdeeprom);
|
||||||
LEAVE();
|
goto done;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
@ -101,7 +99,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
|
|||||||
kfree(adapter->prdeeprom);
|
kfree(adapter->prdeeprom);
|
||||||
// mutex_unlock(&priv->mutex);
|
// mutex_unlock(&priv->mutex);
|
||||||
|
|
||||||
return 0;
|
ret = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void libertas_ethtool_get_stats(struct net_device * dev,
|
static void libertas_ethtool_get_stats(struct net_device * dev,
|
||||||
@ -109,7 +111,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
|
|||||||
{
|
{
|
||||||
wlan_private *priv = dev->priv;
|
wlan_private *priv = dev->priv;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ETHTOOL);
|
||||||
|
|
||||||
stats->cmd = ETHTOOL_GSTATS;
|
stats->cmd = ETHTOOL_GSTATS;
|
||||||
BUG_ON(stats->n_stats != MESH_STATS_NUM);
|
BUG_ON(stats->n_stats != MESH_STATS_NUM);
|
||||||
@ -121,8 +123,9 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
|
|||||||
data[4] = priv->mstats.fwd_unicast_cnt;
|
data[4] = priv->mstats.fwd_unicast_cnt;
|
||||||
data[5] = priv->mstats.fwd_bcast_cnt;
|
data[5] = priv->mstats.fwd_bcast_cnt;
|
||||||
data[6] = priv->mstats.drop_blind;
|
data[6] = priv->mstats.drop_blind;
|
||||||
|
data[7] = priv->mstats.tx_failed_cnt;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_ETHTOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int libertas_ethtool_get_stats_count(struct net_device * dev)
|
static int libertas_ethtool_get_stats_count(struct net_device * dev)
|
||||||
@ -131,27 +134,32 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
|
|||||||
wlan_private *priv = dev->priv;
|
wlan_private *priv = dev->priv;
|
||||||
struct cmd_ds_mesh_access mesh_access;
|
struct cmd_ds_mesh_access mesh_access;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ETHTOOL);
|
||||||
|
|
||||||
/* Get Mesh Statistics */
|
/* Get Mesh Statistics */
|
||||||
ret = libertas_prepare_and_send_command(priv,
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
cmd_mesh_access, cmd_act_mesh_get_stats,
|
cmd_mesh_access, cmd_act_mesh_get_stats,
|
||||||
cmd_option_waitforrsp, 0, &mesh_access);
|
cmd_option_waitforrsp, 0, &mesh_access);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LEAVE();
|
ret = 0;
|
||||||
return 0;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->mstats.fwd_drop_rbt = mesh_access.data[0];
|
priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
|
||||||
priv->mstats.fwd_drop_ttl = mesh_access.data[1];
|
priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
|
||||||
priv->mstats.fwd_drop_noroute = mesh_access.data[2];
|
priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
|
||||||
priv->mstats.fwd_drop_nobuf = mesh_access.data[3];
|
priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
|
||||||
priv->mstats.fwd_unicast_cnt = mesh_access.data[4];
|
priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
|
||||||
priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
|
priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
|
||||||
priv->mstats.drop_blind = mesh_access.data[6];
|
priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
|
||||||
|
priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
|
||||||
|
|
||||||
LEAVE();
|
ret = MESH_STATS_NUM;
|
||||||
return MESH_STATS_NUM;
|
|
||||||
|
done:
|
||||||
|
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void libertas_ethtool_get_strings (struct net_device * dev,
|
static void libertas_ethtool_get_strings (struct net_device * dev,
|
||||||
@ -160,7 +168,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_ETHTOOL);
|
||||||
|
|
||||||
switch (stringset) {
|
switch (stringset) {
|
||||||
case ETH_SS_STATS:
|
case ETH_SS_STATS:
|
||||||
for (i=0; i < MESH_STATS_NUM; i++) {
|
for (i=0; i < MESH_STATS_NUM; i++) {
|
||||||
@ -170,7 +179,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LEAVE();
|
lbs_deb_enter(LBS_DEB_ETHTOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ethtool_ops libertas_ethtool_ops = {
|
struct ethtool_ops libertas_ethtool_ops = {
|
||||||
|
@ -1,28 +1,15 @@
|
|||||||
/**
|
/**
|
||||||
* This file contains the initialization for FW and HW
|
* This file contains the initialization for FW and HW
|
||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/moduleparam.h>
|
|
||||||
|
|
||||||
#include <linux/vmalloc.h>
|
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/version.h>
|
|
||||||
|
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "sbi.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
#include "fw.h"
|
|
||||||
#include "wext.h"
|
#include "wext.h"
|
||||||
#include "if_usb.h"
|
#include "if_usb.h"
|
||||||
|
|
||||||
char *libertas_fw_name = NULL;
|
|
||||||
module_param_named(fw_name, libertas_fw_name, charp, 0644);
|
|
||||||
|
|
||||||
unsigned int libertas_debug = 0;
|
|
||||||
module_param(libertas_debug, int, 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function checks the validity of Boot2/FW image.
|
* @brief This function checks the validity of Boot2/FW image.
|
||||||
*
|
*
|
||||||
@ -32,7 +19,7 @@ module_param(libertas_debug, int, 0);
|
|||||||
*/
|
*/
|
||||||
static int check_fwfile_format(u8 *data, u32 totlen)
|
static int check_fwfile_format(u8 *data, u32 totlen)
|
||||||
{
|
{
|
||||||
u8 bincmd, exit;
|
u32 bincmd, exit;
|
||||||
u32 blksize, offset, len;
|
u32 blksize, offset, len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -40,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen)
|
|||||||
exit = len = 0;
|
exit = len = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
bincmd = *data;
|
struct fwheader *fwh = (void *)data;
|
||||||
blksize = *(u32*)(data + offsetof(struct fwheader, datalength));
|
|
||||||
|
bincmd = le32_to_cpu(fwh->dnldcmd);
|
||||||
|
blksize = le32_to_cpu(fwh->datalength);
|
||||||
switch (bincmd) {
|
switch (bincmd) {
|
||||||
case FW_HAS_DATA_TO_RECV:
|
case FW_HAS_DATA_TO_RECV:
|
||||||
offset = sizeof(struct fwheader) + blksize;
|
offset = sizeof(struct fwheader) + blksize;
|
||||||
@ -61,9 +50,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
|
|||||||
} while (!exit);
|
} while (!exit);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
lbs_pr_err("bin file format check FAIL...\n");
|
lbs_pr_err("firmware file format check FAIL\n");
|
||||||
else
|
else
|
||||||
lbs_pr_debug(1, "bin file format check PASS...\n");
|
lbs_deb_fw("firmware file format check PASS\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -76,32 +65,31 @@ static int check_fwfile_format(u8 *data, u32 totlen)
|
|||||||
* @param priv A pointer to wlan_private structure
|
* @param priv A pointer to wlan_private structure
|
||||||
* @return 0 or -1
|
* @return 0 or -1
|
||||||
*/
|
*/
|
||||||
static int wlan_setup_station_hw(wlan_private * priv)
|
static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_FW);
|
||||||
|
|
||||||
if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
|
if ((ret = request_firmware(&priv->firmware, fw_name,
|
||||||
priv->hotplug_device)) < 0) {
|
priv->hotplug_device)) < 0) {
|
||||||
lbs_pr_err("request_firmware() failed, error code = %#x\n",
|
lbs_pr_err("request_firmware() failed with %#x\n", ret);
|
||||||
ret);
|
lbs_pr_err("firmware %s not found\n", fw_name);
|
||||||
lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name);
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
|
if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
|
||||||
release_firmware(priv->firmware);
|
release_firmware(priv->firmware);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = libertas_sbi_prog_firmware(priv);
|
ret = priv->hw_prog_firmware(priv);
|
||||||
|
|
||||||
release_firmware(priv->firmware);
|
release_firmware(priv->firmware);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "Bootloader in invalid state!\n");
|
lbs_deb_fw("bootloader in invalid state\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -133,28 +121,24 @@ static int wlan_setup_station_hw(wlan_private * priv)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlan_allocate_adapter(wlan_private * priv)
|
static int wlan_allocate_adapter(wlan_private * priv)
|
||||||
{
|
{
|
||||||
u32 ulbufsize;
|
size_t bufsize;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
struct bss_descriptor *ptempscantable;
|
|
||||||
|
|
||||||
/* Allocate buffer to store the BSSID list */
|
/* Allocate buffer to store the BSSID list */
|
||||||
ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST;
|
bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
|
||||||
if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) {
|
adapter->networks = kzalloc(bufsize, GFP_KERNEL);
|
||||||
|
if (!adapter->networks) {
|
||||||
|
lbs_pr_err("Out of memory allocating beacons\n");
|
||||||
libertas_free_adapter(priv);
|
libertas_free_adapter(priv);
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter->scantable = ptempscantable;
|
|
||||||
memset(adapter->scantable, 0, ulbufsize);
|
|
||||||
|
|
||||||
/* Allocate the command buffers */
|
/* Allocate the command buffers */
|
||||||
libertas_allocate_cmd_buffer(priv);
|
libertas_allocate_cmd_buffer(priv);
|
||||||
|
|
||||||
@ -202,15 +186,23 @@ static void wlan_init_adapter(wlan_private * priv)
|
|||||||
adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
|
adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
|
||||||
adapter->mode = IW_MODE_INFRA;
|
adapter->mode = IW_MODE_INFRA;
|
||||||
|
|
||||||
adapter->assoc_req = NULL;
|
adapter->pending_assoc_req = NULL;
|
||||||
|
adapter->in_progress_assoc_req = NULL;
|
||||||
|
|
||||||
|
/* Initialize scan result lists */
|
||||||
|
INIT_LIST_HEAD(&adapter->network_free_list);
|
||||||
|
INIT_LIST_HEAD(&adapter->network_list);
|
||||||
|
for (i = 0; i < MAX_NETWORK_COUNT; i++) {
|
||||||
|
list_add_tail(&adapter->networks[i].list,
|
||||||
|
&adapter->network_free_list);
|
||||||
|
}
|
||||||
|
|
||||||
adapter->numinscantable = 0;
|
|
||||||
adapter->pattemptedbssdesc = NULL;
|
|
||||||
mutex_init(&adapter->lock);
|
mutex_init(&adapter->lock);
|
||||||
|
|
||||||
adapter->prescan = 1;
|
adapter->prescan = 1;
|
||||||
|
|
||||||
memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
|
memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
|
||||||
|
adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
|
||||||
|
|
||||||
/* PnP and power profile */
|
/* PnP and power profile */
|
||||||
adapter->surpriseremoved = 0;
|
adapter->surpriseremoved = 0;
|
||||||
@ -230,8 +222,6 @@ static void wlan_init_adapter(wlan_private * priv)
|
|||||||
memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
|
memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
|
||||||
adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
|
adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
|
||||||
|
|
||||||
adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL;
|
|
||||||
|
|
||||||
adapter->psmode = wlan802_11powermodecam;
|
adapter->psmode = wlan802_11powermodecam;
|
||||||
adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
|
adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
|
||||||
|
|
||||||
@ -259,12 +249,12 @@ static void wlan_init_adapter(wlan_private * priv)
|
|||||||
|
|
||||||
static void command_timer_fn(unsigned long data);
|
static void command_timer_fn(unsigned long data);
|
||||||
|
|
||||||
int libertas_init_fw(wlan_private * priv)
|
int libertas_init_fw(wlan_private * priv, char *fw_name)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_FW);
|
||||||
|
|
||||||
/* Allocate adapter structure */
|
/* Allocate adapter structure */
|
||||||
if ((ret = wlan_allocate_adapter(priv)) != 0)
|
if ((ret = wlan_allocate_adapter(priv)) != 0)
|
||||||
@ -278,7 +268,7 @@ int libertas_init_fw(wlan_private * priv)
|
|||||||
(unsigned long)priv);
|
(unsigned long)priv);
|
||||||
|
|
||||||
/* download fimrware etc. */
|
/* download fimrware etc. */
|
||||||
if ((ret = wlan_setup_station_hw(priv)) != 0) {
|
if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
|
||||||
del_timer_sync(&adapter->command_timer);
|
del_timer_sync(&adapter->command_timer);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -288,7 +278,7 @@ int libertas_init_fw(wlan_private * priv)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,25 +287,22 @@ void libertas_free_adapter(wlan_private * priv)
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
lbs_pr_debug(1, "Why double free adapter?:)\n");
|
lbs_deb_fw("why double free adapter?\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "Free command buffer\n");
|
lbs_deb_fw("free command buffer\n");
|
||||||
libertas_free_cmd_buffer(priv);
|
libertas_free_cmd_buffer(priv);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Free commandTimer\n");
|
lbs_deb_fw("free command_timer\n");
|
||||||
del_timer(&adapter->command_timer);
|
del_timer(&adapter->command_timer);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Free scantable\n");
|
lbs_deb_fw("free scan results table\n");
|
||||||
if (adapter->scantable) {
|
kfree(adapter->networks);
|
||||||
kfree(adapter->scantable);
|
adapter->networks = NULL;
|
||||||
adapter->scantable = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
lbs_pr_debug(1, "Free adapter\n");
|
|
||||||
|
|
||||||
/* Free the adapter object itself */
|
/* Free the adapter object itself */
|
||||||
|
lbs_deb_fw("free adapter\n");
|
||||||
kfree(adapter);
|
kfree(adapter);
|
||||||
priv->adapter = NULL;
|
priv->adapter = NULL;
|
||||||
}
|
}
|
||||||
@ -334,17 +321,17 @@ static void command_timer_fn(unsigned long data)
|
|||||||
|
|
||||||
ptempnode = adapter->cur_cmd;
|
ptempnode = adapter->cur_cmd;
|
||||||
if (ptempnode == NULL) {
|
if (ptempnode == NULL) {
|
||||||
lbs_pr_debug(1, "PTempnode Empty\n");
|
lbs_deb_fw("ptempnode empty\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
|
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
lbs_pr_debug(1, "cmd is NULL\n");
|
lbs_deb_fw("cmd is NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command);
|
lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
|
||||||
|
|
||||||
if (!adapter->fw_ready)
|
if (!adapter->fw_ready)
|
||||||
return;
|
return;
|
||||||
@ -353,7 +340,7 @@ static void command_timer_fn(unsigned long data)
|
|||||||
adapter->cur_cmd = NULL;
|
adapter->cur_cmd = NULL;
|
||||||
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
spin_unlock_irqrestore(&adapter->driver_lock, flags);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Re-sending same command as it timeout...!\n");
|
lbs_deb_fw("re-sending same command because of timeout\n");
|
||||||
libertas_queue_cmd(adapter, ptempnode, 0);
|
libertas_queue_cmd(adapter, ptempnode, 0);
|
||||||
|
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* This header file contains FW interface related definitions.
|
|
||||||
*/
|
|
||||||
#ifndef _WLAN_FW_H_
|
|
||||||
#define _WLAN_FW_H_
|
|
||||||
|
|
||||||
#ifndef DEV_NAME_LEN
|
|
||||||
#define DEV_NAME_LEN 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int libertas_init_fw(wlan_private * priv);
|
|
||||||
|
|
||||||
#endif /* _WLAN_FW_H_ */
|
|
@ -99,11 +99,11 @@
|
|||||||
#define cmd_bt_access 0x0087
|
#define cmd_bt_access 0x0087
|
||||||
#define cmd_ret_bt_access 0x8087
|
#define cmd_ret_bt_access 0x8087
|
||||||
|
|
||||||
#define cmd_fwt_access 0x0088
|
#define cmd_fwt_access 0x0095
|
||||||
#define cmd_ret_fwt_access 0x8088
|
#define cmd_ret_fwt_access 0x8095
|
||||||
|
|
||||||
#define cmd_mesh_access 0x0090
|
#define cmd_mesh_access 0x009b
|
||||||
#define cmd_ret_mesh_access 0x8090
|
#define cmd_ret_mesh_access 0x809b
|
||||||
|
|
||||||
/* For the IEEE Power Save */
|
/* For the IEEE Power Save */
|
||||||
#define cmd_subcmd_enter_ps 0x0030
|
#define cmd_subcmd_enter_ps 0x0030
|
||||||
@ -287,7 +287,9 @@ enum cmd_bt_access_opts {
|
|||||||
cmd_act_bt_access_add = 5,
|
cmd_act_bt_access_add = 5,
|
||||||
cmd_act_bt_access_del,
|
cmd_act_bt_access_del,
|
||||||
cmd_act_bt_access_list,
|
cmd_act_bt_access_list,
|
||||||
cmd_act_bt_access_reset
|
cmd_act_bt_access_reset,
|
||||||
|
cmd_act_bt_access_set_invert,
|
||||||
|
cmd_act_bt_access_get_invert
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Define action or option for cmd_fwt_access */
|
/* Define action or option for cmd_fwt_access */
|
||||||
@ -308,8 +310,8 @@ enum cmd_mesh_access_opts {
|
|||||||
cmd_act_mesh_get_ttl = 1,
|
cmd_act_mesh_get_ttl = 1,
|
||||||
cmd_act_mesh_set_ttl,
|
cmd_act_mesh_set_ttl,
|
||||||
cmd_act_mesh_get_stats,
|
cmd_act_mesh_get_stats,
|
||||||
cmd_act_mesh_get_mpp,
|
cmd_act_mesh_get_anycast,
|
||||||
cmd_act_mesh_set_mpp,
|
cmd_act_mesh_set_anycast,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Card Event definition */
|
/** Card Event definition */
|
||||||
@ -334,5 +336,6 @@ enum cmd_mesh_access_opts {
|
|||||||
#define MACREG_INT_CODE_MAX_FAIL 0x0000001b
|
#define MACREG_INT_CODE_MAX_FAIL 0x0000001b
|
||||||
#define MACREG_INT_CODE_RSSI_HIGH 0x0000001c
|
#define MACREG_INT_CODE_RSSI_HIGH 0x0000001c
|
||||||
#define MACREG_INT_CODE_SNR_HIGH 0x0000001d
|
#define MACREG_INT_CODE_SNR_HIGH 0x0000001d
|
||||||
|
#define MACREG_INT_CODE_MESH_AUTO_STARTED 0x00000023
|
||||||
|
|
||||||
#endif /* _HOST_H_ */
|
#endif /* _HOST_H_ */
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
/* TxPD descriptor */
|
/* TxPD descriptor */
|
||||||
struct txpd {
|
struct txpd {
|
||||||
/* Current Tx packet status */
|
/* Current Tx packet status */
|
||||||
u32 tx_status;
|
__le32 tx_status;
|
||||||
/* Tx control */
|
/* Tx control */
|
||||||
u32 tx_control;
|
__le32 tx_control;
|
||||||
u32 tx_packet_location;
|
__le32 tx_packet_location;
|
||||||
/* Tx packet length */
|
/* Tx packet length */
|
||||||
u16 tx_packet_length;
|
__le16 tx_packet_length;
|
||||||
/* First 2 byte of destination MAC address */
|
/* First 2 byte of destination MAC address */
|
||||||
u8 tx_dest_addr_high[2];
|
u8 tx_dest_addr_high[2];
|
||||||
/* Last 4 byte of destination MAC address */
|
/* Last 4 byte of destination MAC address */
|
||||||
@ -37,7 +37,7 @@ struct txpd {
|
|||||||
/* RxPD Descriptor */
|
/* RxPD Descriptor */
|
||||||
struct rxpd {
|
struct rxpd {
|
||||||
/* Current Rx packet status */
|
/* Current Rx packet status */
|
||||||
u16 status;
|
__le16 status;
|
||||||
|
|
||||||
/* SNR */
|
/* SNR */
|
||||||
u8 snr;
|
u8 snr;
|
||||||
@ -46,7 +46,7 @@ struct rxpd {
|
|||||||
u8 rx_control;
|
u8 rx_control;
|
||||||
|
|
||||||
/* Pkt length */
|
/* Pkt length */
|
||||||
u16 pkt_len;
|
__le16 pkt_len;
|
||||||
|
|
||||||
/* Noise Floor */
|
/* Noise Floor */
|
||||||
u8 nf;
|
u8 nf;
|
||||||
@ -55,10 +55,10 @@ struct rxpd {
|
|||||||
u8 rx_rate;
|
u8 rx_rate;
|
||||||
|
|
||||||
/* Pkt addr */
|
/* Pkt addr */
|
||||||
u32 pkt_ptr;
|
__le32 pkt_ptr;
|
||||||
|
|
||||||
/* Next Rx RxPD addr */
|
/* Next Rx RxPD addr */
|
||||||
u32 next_rxpd_ptr;
|
__le32 next_rxpd_ptr;
|
||||||
|
|
||||||
/* Pkt Priority */
|
/* Pkt Priority */
|
||||||
u8 priority;
|
u8 priority;
|
||||||
@ -89,30 +89,17 @@ struct cmd_ctrl_node {
|
|||||||
* is determined from the keylength field.
|
* is determined from the keylength field.
|
||||||
*/
|
*/
|
||||||
struct WLAN_802_11_KEY {
|
struct WLAN_802_11_KEY {
|
||||||
u32 len;
|
__le32 len;
|
||||||
u32 flags; /* KEY_INFO_* from wlan_defs.h */
|
__le32 flags; /* KEY_INFO_* from wlan_defs.h */
|
||||||
u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
|
u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
|
||||||
u16 type; /* KEY_TYPE_* from wlan_defs.h */
|
__le16 type; /* KEY_TYPE_* from wlan_defs.h */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IE_WPA {
|
struct IE_WPA {
|
||||||
u8 elementid;
|
u8 elementid;
|
||||||
u8 len;
|
u8 len;
|
||||||
u8 oui[4];
|
u8 oui[4];
|
||||||
u16 version;
|
__le16 version;
|
||||||
};
|
|
||||||
|
|
||||||
struct WLAN_802_11_SSID {
|
|
||||||
/* SSID length */
|
|
||||||
u32 ssidlength;
|
|
||||||
|
|
||||||
/* SSID information field */
|
|
||||||
u8 ssid[IW_ESSID_MAX_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WPA_SUPPLICANT {
|
|
||||||
u8 wpa_ie[256];
|
|
||||||
u8 wpa_ie_len;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* wlan_offset_value */
|
/* wlan_offset_value */
|
||||||
@ -122,9 +109,9 @@ struct wlan_offset_value {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct WLAN_802_11_FIXED_IEs {
|
struct WLAN_802_11_FIXED_IEs {
|
||||||
u8 timestamp[8];
|
__le64 timestamp;
|
||||||
u16 beaconinterval;
|
__le16 beaconinterval;
|
||||||
u16 capabilities;
|
u16 capabilities; /* Actually struct ieeetypes_capinfo */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WLAN_802_11_VARIABLE_IEs {
|
struct WLAN_802_11_VARIABLE_IEs {
|
||||||
@ -136,10 +123,10 @@ struct WLAN_802_11_VARIABLE_IEs {
|
|||||||
/* Define general data structure */
|
/* Define general data structure */
|
||||||
/* cmd_DS_GEN */
|
/* cmd_DS_GEN */
|
||||||
struct cmd_ds_gen {
|
struct cmd_ds_gen {
|
||||||
u16 command;
|
__le16 command;
|
||||||
u16 size;
|
__le16 size;
|
||||||
u16 seqnum;
|
__le16 seqnum;
|
||||||
u16 result;
|
__le16 result;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define S_DS_GEN sizeof(struct cmd_ds_gen)
|
#define S_DS_GEN sizeof(struct cmd_ds_gen)
|
||||||
@ -149,44 +136,44 @@ struct cmd_ds_gen {
|
|||||||
*/
|
*/
|
||||||
struct cmd_ds_get_hw_spec {
|
struct cmd_ds_get_hw_spec {
|
||||||
/* HW Interface version number */
|
/* HW Interface version number */
|
||||||
u16 hwifversion;
|
__le16 hwifversion;
|
||||||
/* HW version number */
|
/* HW version number */
|
||||||
u16 version;
|
__le16 version;
|
||||||
/* Max number of TxPD FW can handle */
|
/* Max number of TxPD FW can handle */
|
||||||
u16 nr_txpd;
|
__le16 nr_txpd;
|
||||||
/* Max no of Multicast address */
|
/* Max no of Multicast address */
|
||||||
u16 nr_mcast_adr;
|
__le16 nr_mcast_adr;
|
||||||
/* MAC address */
|
/* MAC address */
|
||||||
u8 permanentaddr[6];
|
u8 permanentaddr[6];
|
||||||
|
|
||||||
/* region Code */
|
/* region Code */
|
||||||
u16 regioncode;
|
__le16 regioncode;
|
||||||
|
|
||||||
/* Number of antenna used */
|
/* Number of antenna used */
|
||||||
u16 nr_antenna;
|
__le16 nr_antenna;
|
||||||
|
|
||||||
/* FW release number, example 0x1234=1.2.3.4 */
|
/* FW release number, example 1,2,3,4 = 3.2.1p4 */
|
||||||
u32 fwreleasenumber;
|
u8 fwreleasenumber[4];
|
||||||
|
|
||||||
/* Base Address of TxPD queue */
|
/* Base Address of TxPD queue */
|
||||||
u32 wcb_base;
|
__le32 wcb_base;
|
||||||
/* Read Pointer of RxPd queue */
|
/* Read Pointer of RxPd queue */
|
||||||
u32 rxpd_rdptr;
|
__le32 rxpd_rdptr;
|
||||||
|
|
||||||
/* Write Pointer of RxPd queue */
|
/* Write Pointer of RxPd queue */
|
||||||
u32 rxpd_wrptr;
|
__le32 rxpd_wrptr;
|
||||||
|
|
||||||
/*FW/HW capability */
|
/*FW/HW capability */
|
||||||
u32 fwcapinfo;
|
__le32 fwcapinfo;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_reset {
|
struct cmd_ds_802_11_reset {
|
||||||
u16 action;
|
__le16 action;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_subscribe_event {
|
struct cmd_ds_802_11_subscribe_event {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 events;
|
__le16 events;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -205,35 +192,35 @@ struct cmd_ds_802_11_scan {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_scan_rsp {
|
struct cmd_ds_802_11_scan_rsp {
|
||||||
u16 bssdescriptsize;
|
__le16 bssdescriptsize;
|
||||||
u8 nr_sets;
|
u8 nr_sets;
|
||||||
u8 bssdesc_and_tlvbuffer[1];
|
u8 bssdesc_and_tlvbuffer[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_get_log {
|
struct cmd_ds_802_11_get_log {
|
||||||
u32 mcasttxframe;
|
__le32 mcasttxframe;
|
||||||
u32 failed;
|
__le32 failed;
|
||||||
u32 retry;
|
__le32 retry;
|
||||||
u32 multiretry;
|
__le32 multiretry;
|
||||||
u32 framedup;
|
__le32 framedup;
|
||||||
u32 rtssuccess;
|
__le32 rtssuccess;
|
||||||
u32 rtsfailure;
|
__le32 rtsfailure;
|
||||||
u32 ackfailure;
|
__le32 ackfailure;
|
||||||
u32 rxfrag;
|
__le32 rxfrag;
|
||||||
u32 mcastrxframe;
|
__le32 mcastrxframe;
|
||||||
u32 fcserror;
|
__le32 fcserror;
|
||||||
u32 txframe;
|
__le32 txframe;
|
||||||
u32 wepundecryptable;
|
__le32 wepundecryptable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_mac_control {
|
struct cmd_ds_mac_control {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_mac_multicast_adr {
|
struct cmd_ds_mac_multicast_adr {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 nr_of_adrs;
|
__le16 nr_of_adrs;
|
||||||
u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
|
u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -245,14 +232,14 @@ struct cmd_ds_802_11_authenticate {
|
|||||||
|
|
||||||
struct cmd_ds_802_11_deauthenticate {
|
struct cmd_ds_802_11_deauthenticate {
|
||||||
u8 macaddr[6];
|
u8 macaddr[6];
|
||||||
u16 reasoncode;
|
__le16 reasoncode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_associate {
|
struct cmd_ds_802_11_associate {
|
||||||
u8 peerstaaddr[6];
|
u8 peerstaaddr[6];
|
||||||
struct ieeetypes_capinfo capinfo;
|
struct ieeetypes_capinfo capinfo;
|
||||||
u16 listeninterval;
|
__le16 listeninterval;
|
||||||
u16 bcnperiod;
|
__le16 bcnperiod;
|
||||||
u8 dtimperiod;
|
u8 dtimperiod;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -265,7 +252,7 @@ struct cmd_ds_802_11_associate {
|
|||||||
|
|
||||||
struct cmd_ds_802_11_disassociate {
|
struct cmd_ds_802_11_disassociate {
|
||||||
u8 destmacaddr[6];
|
u8 destmacaddr[6];
|
||||||
u16 reasoncode;
|
__le16 reasoncode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_associate_rsp {
|
struct cmd_ds_802_11_associate_rsp {
|
||||||
@ -279,10 +266,10 @@ struct cmd_ds_802_11_ad_hoc_result {
|
|||||||
|
|
||||||
struct cmd_ds_802_11_set_wep {
|
struct cmd_ds_802_11_set_wep {
|
||||||
/* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
|
/* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
|
||||||
u16 action;
|
__le16 action;
|
||||||
|
|
||||||
/* key Index selected for Tx */
|
/* key Index selected for Tx */
|
||||||
u16 keyindex;
|
__le16 keyindex;
|
||||||
|
|
||||||
/* 40, 128bit or TXWEP */
|
/* 40, 128bit or TXWEP */
|
||||||
u8 keytype[4];
|
u8 keytype[4];
|
||||||
@ -290,96 +277,96 @@ struct cmd_ds_802_11_set_wep {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_3_get_stat {
|
struct cmd_ds_802_3_get_stat {
|
||||||
u32 xmitok;
|
__le32 xmitok;
|
||||||
u32 rcvok;
|
__le32 rcvok;
|
||||||
u32 xmiterror;
|
__le32 xmiterror;
|
||||||
u32 rcverror;
|
__le32 rcverror;
|
||||||
u32 rcvnobuffer;
|
__le32 rcvnobuffer;
|
||||||
u32 rcvcrcerror;
|
__le32 rcvcrcerror;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_get_stat {
|
struct cmd_ds_802_11_get_stat {
|
||||||
u32 txfragmentcnt;
|
__le32 txfragmentcnt;
|
||||||
u32 mcasttxframecnt;
|
__le32 mcasttxframecnt;
|
||||||
u32 failedcnt;
|
__le32 failedcnt;
|
||||||
u32 retrycnt;
|
__le32 retrycnt;
|
||||||
u32 Multipleretrycnt;
|
__le32 Multipleretrycnt;
|
||||||
u32 rtssuccesscnt;
|
__le32 rtssuccesscnt;
|
||||||
u32 rtsfailurecnt;
|
__le32 rtsfailurecnt;
|
||||||
u32 ackfailurecnt;
|
__le32 ackfailurecnt;
|
||||||
u32 frameduplicatecnt;
|
__le32 frameduplicatecnt;
|
||||||
u32 rxfragmentcnt;
|
__le32 rxfragmentcnt;
|
||||||
u32 mcastrxframecnt;
|
__le32 mcastrxframecnt;
|
||||||
u32 fcserrorcnt;
|
__le32 fcserrorcnt;
|
||||||
u32 bcasttxframecnt;
|
__le32 bcasttxframecnt;
|
||||||
u32 bcastrxframecnt;
|
__le32 bcastrxframecnt;
|
||||||
u32 txbeacon;
|
__le32 txbeacon;
|
||||||
u32 rxbeacon;
|
__le32 rxbeacon;
|
||||||
u32 wepundecryptable;
|
__le32 wepundecryptable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_snmp_mib {
|
struct cmd_ds_802_11_snmp_mib {
|
||||||
u16 querytype;
|
__le16 querytype;
|
||||||
u16 oid;
|
__le16 oid;
|
||||||
u16 bufsize;
|
__le16 bufsize;
|
||||||
u8 value[128];
|
u8 value[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_mac_reg_map {
|
struct cmd_ds_mac_reg_map {
|
||||||
u16 buffersize;
|
__le16 buffersize;
|
||||||
u8 regmap[128];
|
u8 regmap[128];
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_bbp_reg_map {
|
struct cmd_ds_bbp_reg_map {
|
||||||
u16 buffersize;
|
__le16 buffersize;
|
||||||
u8 regmap[128];
|
u8 regmap[128];
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_rf_reg_map {
|
struct cmd_ds_rf_reg_map {
|
||||||
u16 buffersize;
|
__le16 buffersize;
|
||||||
u8 regmap[64];
|
u8 regmap[64];
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_mac_reg_access {
|
struct cmd_ds_mac_reg_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 offset;
|
__le16 offset;
|
||||||
u32 value;
|
__le32 value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_bbp_reg_access {
|
struct cmd_ds_bbp_reg_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 offset;
|
__le16 offset;
|
||||||
u8 value;
|
u8 value;
|
||||||
u8 reserved[3];
|
u8 reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_rf_reg_access {
|
struct cmd_ds_rf_reg_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 offset;
|
__le16 offset;
|
||||||
u8 value;
|
u8 value;
|
||||||
u8 reserved[3];
|
u8 reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_radio_control {
|
struct cmd_ds_802_11_radio_control {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 control;
|
__le16 control;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_sleep_params {
|
struct cmd_ds_802_11_sleep_params {
|
||||||
/* ACT_GET/ACT_SET */
|
/* ACT_GET/ACT_SET */
|
||||||
u16 action;
|
__le16 action;
|
||||||
|
|
||||||
/* Sleep clock error in ppm */
|
/* Sleep clock error in ppm */
|
||||||
u16 error;
|
__le16 error;
|
||||||
|
|
||||||
/* Wakeup offset in usec */
|
/* Wakeup offset in usec */
|
||||||
u16 offset;
|
__le16 offset;
|
||||||
|
|
||||||
/* Clock stabilization time in usec */
|
/* Clock stabilization time in usec */
|
||||||
u16 stabletime;
|
__le16 stabletime;
|
||||||
|
|
||||||
/* control periodic calibration */
|
/* control periodic calibration */
|
||||||
u8 calcontrol;
|
u8 calcontrol;
|
||||||
@ -388,100 +375,100 @@ struct cmd_ds_802_11_sleep_params {
|
|||||||
u8 externalsleepclk;
|
u8 externalsleepclk;
|
||||||
|
|
||||||
/* reserved field, should be set to zero */
|
/* reserved field, should be set to zero */
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_inactivity_timeout {
|
struct cmd_ds_802_11_inactivity_timeout {
|
||||||
/* ACT_GET/ACT_SET */
|
/* ACT_GET/ACT_SET */
|
||||||
u16 action;
|
__le16 action;
|
||||||
|
|
||||||
/* Inactivity timeout in msec */
|
/* Inactivity timeout in msec */
|
||||||
u16 timeout;
|
__le16 timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rf_channel {
|
struct cmd_ds_802_11_rf_channel {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 currentchannel;
|
__le16 currentchannel;
|
||||||
u16 rftype;
|
__le16 rftype;
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
u8 channellist[32];
|
u8 channellist[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rssi {
|
struct cmd_ds_802_11_rssi {
|
||||||
/* weighting factor */
|
/* weighting factor */
|
||||||
u16 N;
|
__le16 N;
|
||||||
|
|
||||||
u16 reserved_0;
|
__le16 reserved_0;
|
||||||
u16 reserved_1;
|
__le16 reserved_1;
|
||||||
u16 reserved_2;
|
__le16 reserved_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rssi_rsp {
|
struct cmd_ds_802_11_rssi_rsp {
|
||||||
u16 SNR;
|
__le16 SNR;
|
||||||
u16 noisefloor;
|
__le16 noisefloor;
|
||||||
u16 avgSNR;
|
__le16 avgSNR;
|
||||||
u16 avgnoisefloor;
|
__le16 avgnoisefloor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_mac_address {
|
struct cmd_ds_802_11_mac_address {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u8 macadd[ETH_ALEN];
|
u8 macadd[ETH_ALEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rf_tx_power {
|
struct cmd_ds_802_11_rf_tx_power {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 currentlevel;
|
__le16 currentlevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rf_antenna {
|
struct cmd_ds_802_11_rf_antenna {
|
||||||
u16 action;
|
__le16 action;
|
||||||
|
|
||||||
/* Number of antennas or 0xffff(diversity) */
|
/* Number of antennas or 0xffff(diversity) */
|
||||||
u16 antennamode;
|
__le16 antennamode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_ps_mode {
|
struct cmd_ds_802_11_ps_mode {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 nullpktinterval;
|
__le16 nullpktinterval;
|
||||||
u16 multipledtim;
|
__le16 multipledtim;
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
u16 locallisteninterval;
|
__le16 locallisteninterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PS_CMD_ConfirmSleep {
|
struct PS_CMD_ConfirmSleep {
|
||||||
u16 command;
|
__le16 command;
|
||||||
u16 size;
|
__le16 size;
|
||||||
u16 seqnum;
|
__le16 seqnum;
|
||||||
u16 result;
|
__le16 result;
|
||||||
|
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 reserved1;
|
__le16 reserved1;
|
||||||
u16 multipledtim;
|
__le16 multipledtim;
|
||||||
u16 reserved;
|
__le16 reserved;
|
||||||
u16 locallisteninterval;
|
__le16 locallisteninterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_data_rate {
|
struct cmd_ds_802_11_data_rate {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 reserverd;
|
__le16 reserverd;
|
||||||
u8 datarate[G_SUPPORTED_RATES];
|
u8 datarate[G_SUPPORTED_RATES];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_rate_adapt_rateset {
|
struct cmd_ds_802_11_rate_adapt_rateset {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 enablehwauto;
|
__le16 enablehwauto;
|
||||||
u16 bitmap;
|
__le16 bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_ad_hoc_start {
|
struct cmd_ds_802_11_ad_hoc_start {
|
||||||
u8 SSID[IW_ESSID_MAX_SIZE];
|
u8 SSID[IW_ESSID_MAX_SIZE];
|
||||||
u8 bsstype;
|
u8 bsstype;
|
||||||
u16 beaconperiod;
|
__le16 beaconperiod;
|
||||||
u8 dtimperiod;
|
u8 dtimperiod;
|
||||||
union IEEEtypes_ssparamset ssparamset;
|
union IEEEtypes_ssparamset ssparamset;
|
||||||
union ieeetypes_phyparamset phyparamset;
|
union ieeetypes_phyparamset phyparamset;
|
||||||
u16 probedelay;
|
__le16 probedelay;
|
||||||
struct ieeetypes_capinfo cap;
|
struct ieeetypes_capinfo cap;
|
||||||
u8 datarate[G_SUPPORTED_RATES];
|
u8 datarate[G_SUPPORTED_RATES];
|
||||||
u8 tlv_memory_size_pad[100];
|
u8 tlv_memory_size_pad[100];
|
||||||
@ -491,10 +478,10 @@ struct adhoc_bssdesc {
|
|||||||
u8 BSSID[6];
|
u8 BSSID[6];
|
||||||
u8 SSID[32];
|
u8 SSID[32];
|
||||||
u8 bsstype;
|
u8 bsstype;
|
||||||
u16 beaconperiod;
|
__le16 beaconperiod;
|
||||||
u8 dtimperiod;
|
u8 dtimperiod;
|
||||||
u8 timestamp[8];
|
__le64 timestamp;
|
||||||
u8 localtime[8];
|
__le64 localtime;
|
||||||
union ieeetypes_phyparamset phyparamset;
|
union ieeetypes_phyparamset phyparamset;
|
||||||
union IEEEtypes_ssparamset ssparamset;
|
union IEEEtypes_ssparamset ssparamset;
|
||||||
struct ieeetypes_capinfo cap;
|
struct ieeetypes_capinfo cap;
|
||||||
@ -508,52 +495,52 @@ struct adhoc_bssdesc {
|
|||||||
|
|
||||||
struct cmd_ds_802_11_ad_hoc_join {
|
struct cmd_ds_802_11_ad_hoc_join {
|
||||||
struct adhoc_bssdesc bssdescriptor;
|
struct adhoc_bssdesc bssdescriptor;
|
||||||
u16 failtimeout;
|
__le16 failtimeout;
|
||||||
u16 probedelay;
|
__le16 probedelay;
|
||||||
|
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_enable_rsn {
|
struct cmd_ds_802_11_enable_rsn {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 enable;
|
__le16 enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MrvlIEtype_keyParamSet {
|
struct MrvlIEtype_keyParamSet {
|
||||||
/* type ID */
|
/* type ID */
|
||||||
u16 type;
|
__le16 type;
|
||||||
|
|
||||||
/* length of Payload */
|
/* length of Payload */
|
||||||
u16 length;
|
__le16 length;
|
||||||
|
|
||||||
/* type of key: WEP=0, TKIP=1, AES=2 */
|
/* type of key: WEP=0, TKIP=1, AES=2 */
|
||||||
u16 keytypeid;
|
__le16 keytypeid;
|
||||||
|
|
||||||
/* key control Info specific to a keytypeid */
|
/* key control Info specific to a keytypeid */
|
||||||
u16 keyinfo;
|
__le16 keyinfo;
|
||||||
|
|
||||||
/* length of key */
|
/* length of key */
|
||||||
u16 keylen;
|
__le16 keylen;
|
||||||
|
|
||||||
/* key material of size keylen */
|
/* key material of size keylen */
|
||||||
u8 key[32];
|
u8 key[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_ds_802_11_key_material {
|
struct cmd_ds_802_11_key_material {
|
||||||
u16 action;
|
__le16 action;
|
||||||
struct MrvlIEtype_keyParamSet keyParamSet[2];
|
struct MrvlIEtype_keyParamSet keyParamSet[2];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_eeprom_access {
|
struct cmd_ds_802_11_eeprom_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
|
|
||||||
/* multiple 4 */
|
/* multiple 4 */
|
||||||
u16 offset;
|
__le16 offset;
|
||||||
u16 bytecount;
|
__le16 bytecount;
|
||||||
u8 value;
|
u8 value;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_tpc_cfg {
|
struct cmd_ds_802_11_tpc_cfg {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u8 enable;
|
u8 enable;
|
||||||
s8 P0;
|
s8 P0;
|
||||||
s8 P1;
|
s8 P1;
|
||||||
@ -562,13 +549,13 @@ struct cmd_ds_802_11_tpc_cfg {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_led_ctrl {
|
struct cmd_ds_802_11_led_ctrl {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u16 numled;
|
__le16 numled;
|
||||||
u8 data[256];
|
u8 data[256];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_pwr_cfg {
|
struct cmd_ds_802_11_pwr_cfg {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u8 enable;
|
u8 enable;
|
||||||
s8 PA_P0;
|
s8 PA_P0;
|
||||||
s8 PA_P1;
|
s8 PA_P1;
|
||||||
@ -576,21 +563,21 @@ struct cmd_ds_802_11_pwr_cfg {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_802_11_afc {
|
struct cmd_ds_802_11_afc {
|
||||||
u16 afc_auto;
|
__le16 afc_auto;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u16 threshold;
|
__le16 threshold;
|
||||||
u16 period;
|
__le16 period;
|
||||||
};
|
};
|
||||||
struct {
|
struct {
|
||||||
s16 timing_offset;
|
__le16 timing_offset; /* signed */
|
||||||
s16 carrier_offset;
|
__le16 carrier_offset; /* signed */
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_tx_rate_query {
|
struct cmd_tx_rate_query {
|
||||||
u16 txrate;
|
__le16 txrate;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_get_tsf {
|
struct cmd_ds_get_tsf {
|
||||||
@ -598,41 +585,46 @@ struct cmd_ds_get_tsf {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_bt_access {
|
struct cmd_ds_bt_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u32 id;
|
__le32 id;
|
||||||
u8 addr1[ETH_ALEN];
|
u8 addr1[ETH_ALEN];
|
||||||
u8 addr2[ETH_ALEN];
|
u8 addr2[ETH_ALEN];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct cmd_ds_fwt_access {
|
struct cmd_ds_fwt_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u32 id;
|
__le32 id;
|
||||||
|
u8 valid;
|
||||||
u8 da[ETH_ALEN];
|
u8 da[ETH_ALEN];
|
||||||
u8 dir;
|
u8 dir;
|
||||||
u8 ra[ETH_ALEN];
|
u8 ra[ETH_ALEN];
|
||||||
u32 ssn;
|
__le32 ssn;
|
||||||
u32 dsn;
|
__le32 dsn;
|
||||||
u32 metric;
|
__le32 metric;
|
||||||
|
u8 rate;
|
||||||
u8 hopcount;
|
u8 hopcount;
|
||||||
u8 ttl;
|
u8 ttl;
|
||||||
u32 expiration;
|
__le32 expiration;
|
||||||
u8 sleepmode;
|
u8 sleepmode;
|
||||||
u32 snr;
|
__le32 snr;
|
||||||
u32 references;
|
__le32 references;
|
||||||
|
u8 prec[ETH_ALEN];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define MESH_STATS_NUM 7
|
|
||||||
struct cmd_ds_mesh_access {
|
struct cmd_ds_mesh_access {
|
||||||
u16 action;
|
__le16 action;
|
||||||
u32 data[MESH_STATS_NUM + 1]; /* last position reserved */
|
__le32 data[32]; /* last position reserved */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Number of stats counters returned by the firmware */
|
||||||
|
#define MESH_STATS_NUM 8
|
||||||
|
|
||||||
struct cmd_ds_command {
|
struct cmd_ds_command {
|
||||||
/* command header */
|
/* command header */
|
||||||
u16 command;
|
__le16 command;
|
||||||
u16 size;
|
__le16 size;
|
||||||
u16 seqnum;
|
__le16 seqnum;
|
||||||
u16 result;
|
__le16 result;
|
||||||
|
|
||||||
/* command Body */
|
/* command Body */
|
||||||
union {
|
union {
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
|
|
||||||
|
#define DRV_NAME "usb8xxx"
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
#include "if_usb.h"
|
#include "if_usb.h"
|
||||||
@ -20,12 +22,12 @@
|
|||||||
*/
|
*/
|
||||||
int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
|
int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
struct bootcmdstr sbootcmd;
|
struct bootcmdstr sbootcmd;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Prepare command */
|
/* Prepare command */
|
||||||
sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER;
|
sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER);
|
||||||
sbootcmd.u8cmd_tag = ivalue;
|
sbootcmd.u8cmd_tag = ivalue;
|
||||||
for (i=0; i<11; i++)
|
for (i=0; i<11; i++)
|
||||||
sbootcmd.au8dumy[i]=0x00;
|
sbootcmd.au8dumy[i]=0x00;
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
* This file contains functions used in USB interface module.
|
* This file contains functions used in USB interface module.
|
||||||
*/
|
*/
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/moduleparam.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
#include <linux/list.h>
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
|
|
||||||
|
#define DRV_NAME "usb8xxx"
|
||||||
|
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "sbi.h"
|
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
@ -16,15 +19,24 @@
|
|||||||
#define MESSAGE_HEADER_LEN 4
|
#define MESSAGE_HEADER_LEN 4
|
||||||
|
|
||||||
static const char usbdriver_name[] = "usb8xxx";
|
static const char usbdriver_name[] = "usb8xxx";
|
||||||
|
static u8 *default_fw_name = "usb8388.bin";
|
||||||
|
|
||||||
|
char *libertas_fw_name = NULL;
|
||||||
|
module_param_named(fw_name, libertas_fw_name, charp, 0644);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to send a RESET command to all USB devices before
|
||||||
|
* we tear down the USB connection. Otherwise we would not
|
||||||
|
* be able to re-init device the device if the module gets
|
||||||
|
* loaded again. This is a list of all initialized USB devices,
|
||||||
|
* for the reset code see if_usb_reset_device()
|
||||||
|
*/
|
||||||
|
static LIST_HEAD(usb_devices);
|
||||||
|
|
||||||
static struct usb_device_id if_usb_table[] = {
|
static struct usb_device_id if_usb_table[] = {
|
||||||
/* Enter the device signature inside */
|
/* Enter the device signature inside */
|
||||||
{
|
{ USB_DEVICE(0x1286, 0x2001) },
|
||||||
USB_DEVICE(USB8388_VID_1, USB8388_PID_1),
|
{ USB_DEVICE(0x05a3, 0x8388) },
|
||||||
},
|
|
||||||
{
|
|
||||||
USB_DEVICE(USB8388_VID_2, USB8388_PID_2),
|
|
||||||
},
|
|
||||||
{} /* Terminating entry */
|
{} /* Terminating entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -32,6 +44,13 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
|
|||||||
|
|
||||||
static void if_usb_receive(struct urb *urb);
|
static void if_usb_receive(struct urb *urb);
|
||||||
static void if_usb_receive_fwload(struct urb *urb);
|
static void if_usb_receive_fwload(struct urb *urb);
|
||||||
|
static int if_usb_reset_device(wlan_private *priv);
|
||||||
|
static int if_usb_register_dev(wlan_private * priv);
|
||||||
|
static int if_usb_unregister_dev(wlan_private *);
|
||||||
|
static int if_usb_prog_firmware(wlan_private *);
|
||||||
|
static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
|
||||||
|
static int if_usb_get_int_status(wlan_private * priv, u8 *);
|
||||||
|
static int if_usb_read_event_cause(wlan_private *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief call back function to handle the status of the URB
|
* @brief call back function to handle the status of the URB
|
||||||
@ -42,23 +61,27 @@ static void if_usb_write_bulk_callback(struct urb *urb)
|
|||||||
{
|
{
|
||||||
wlan_private *priv = (wlan_private *) (urb->context);
|
wlan_private *priv = (wlan_private *) (urb->context);
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct net_device *dev = priv->wlan_dev.netdev;
|
struct net_device *dev = priv->dev;
|
||||||
|
|
||||||
/* handle the transmission complete validations */
|
/* handle the transmission complete validations */
|
||||||
|
|
||||||
if (urb->status != 0) {
|
if (urb->status != 0) {
|
||||||
/* print the failure status number for debug */
|
/* print the failure status number for debug */
|
||||||
lbs_pr_info("URB in failure status\n");
|
lbs_pr_info("URB in failure status: %d\n", urb->status);
|
||||||
} else {
|
} else {
|
||||||
lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n");
|
/*
|
||||||
lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n",
|
lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n");
|
||||||
|
lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n",
|
||||||
urb->actual_length);
|
urb->actual_length);
|
||||||
priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
|
*/
|
||||||
|
priv->dnld_sent = DNLD_RES_RECEIVED;
|
||||||
/* Wake main thread if commands are pending */
|
/* Wake main thread if commands are pending */
|
||||||
if (!adapter->cur_cmd)
|
if (!adapter->cur_cmd)
|
||||||
wake_up_interruptible(&priv->mainthread.waitq);
|
wake_up_interruptible(&priv->mainthread.waitq);
|
||||||
if ((adapter->connect_status == libertas_connected))
|
if ((adapter->connect_status == libertas_connected)) {
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
|
netif_wake_queue(priv->mesh_dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -71,7 +94,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
|
|||||||
*/
|
*/
|
||||||
void if_usb_free(struct usb_card_rec *cardp)
|
void if_usb_free(struct usb_card_rec *cardp)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
/* Unlink tx & rx urb */
|
/* Unlink tx & rx urb */
|
||||||
usb_kill_urb(cardp->tx_urb);
|
usb_kill_urb(cardp->tx_urb);
|
||||||
@ -86,8 +109,7 @@ void if_usb_free(struct usb_card_rec *cardp)
|
|||||||
kfree(cardp->bulk_out_buffer);
|
kfree(cardp->bulk_out_buffer);
|
||||||
cardp->bulk_out_buffer = NULL;
|
cardp->bulk_out_buffer = NULL;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_USB);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,27 +124,27 @@ static int if_usb_probe(struct usb_interface *intf,
|
|||||||
struct usb_device *udev;
|
struct usb_device *udev;
|
||||||
struct usb_host_interface *iface_desc;
|
struct usb_host_interface *iface_desc;
|
||||||
struct usb_endpoint_descriptor *endpoint;
|
struct usb_endpoint_descriptor *endpoint;
|
||||||
wlan_private *pwlanpriv;
|
wlan_private *priv;
|
||||||
struct usb_card_rec *usb_cardp;
|
struct usb_card_rec *cardp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
udev = interface_to_usbdev(intf);
|
udev = interface_to_usbdev(intf);
|
||||||
|
|
||||||
usb_cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
|
cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
|
||||||
if (!usb_cardp) {
|
if (!cardp) {
|
||||||
lbs_pr_err("Out of memory allocating private data.\n");
|
lbs_pr_err("Out of memory allocating private data.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_cardp->udev = udev;
|
cardp->udev = udev;
|
||||||
iface_desc = intf->cur_altsetting;
|
iface_desc = intf->cur_altsetting;
|
||||||
|
|
||||||
lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
|
lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
|
||||||
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
|
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
|
||||||
udev->descriptor.bcdUSB,
|
le16_to_cpu(udev->descriptor.bcdUSB),
|
||||||
udev->descriptor.bDeviceClass,
|
udev->descriptor.bDeviceClass,
|
||||||
udev->descriptor.bDeviceSubClass,
|
udev->descriptor.bDeviceSubClass,
|
||||||
udev->descriptor.bDeviceProtocol);
|
udev->descriptor.bDeviceProtocol);
|
||||||
|
|
||||||
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
|
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
|
||||||
endpoint = &iface_desc->endpoint[i].desc;
|
endpoint = &iface_desc->endpoint[i].desc;
|
||||||
@ -130,23 +152,21 @@ static int if_usb_probe(struct usb_interface *intf,
|
|||||||
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
||||||
USB_ENDPOINT_XFER_BULK)) {
|
USB_ENDPOINT_XFER_BULK)) {
|
||||||
/* we found a bulk in endpoint */
|
/* we found a bulk in endpoint */
|
||||||
lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n",
|
lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
|
||||||
endpoint->wMaxPacketSize);
|
le16_to_cpu(endpoint->wMaxPacketSize));
|
||||||
if (!
|
if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
|
||||||
(usb_cardp->rx_urb =
|
lbs_deb_usbd(&udev->dev,
|
||||||
usb_alloc_urb(0, GFP_KERNEL))) {
|
|
||||||
lbs_dev_dbg(1, &udev->dev,
|
|
||||||
"Rx URB allocation failed\n");
|
"Rx URB allocation failed\n");
|
||||||
goto dealloc;
|
goto dealloc;
|
||||||
}
|
}
|
||||||
usb_cardp->rx_urb_recall = 0;
|
cardp->rx_urb_recall = 0;
|
||||||
|
|
||||||
usb_cardp->bulk_in_size =
|
cardp->bulk_in_size =
|
||||||
endpoint->wMaxPacketSize;
|
le16_to_cpu(endpoint->wMaxPacketSize);
|
||||||
usb_cardp->bulk_in_endpointAddr =
|
cardp->bulk_in_endpointAddr =
|
||||||
(endpoint->
|
(endpoint->
|
||||||
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
|
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
|
||||||
lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n",
|
lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n",
|
||||||
endpoint->bEndpointAddress);
|
endpoint->bEndpointAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,55 +176,63 @@ static int if_usb_probe(struct usb_interface *intf,
|
|||||||
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
||||||
USB_ENDPOINT_XFER_BULK)) {
|
USB_ENDPOINT_XFER_BULK)) {
|
||||||
/* We found bulk out endpoint */
|
/* We found bulk out endpoint */
|
||||||
if (!
|
if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
|
||||||
(usb_cardp->tx_urb =
|
lbs_deb_usbd(&udev->dev,
|
||||||
usb_alloc_urb(0, GFP_KERNEL))) {
|
|
||||||
lbs_dev_dbg(1,&udev->dev,
|
|
||||||
"Tx URB allocation failed\n");
|
"Tx URB allocation failed\n");
|
||||||
goto dealloc;
|
goto dealloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_cardp->bulk_out_size =
|
cardp->bulk_out_size =
|
||||||
endpoint->wMaxPacketSize;
|
le16_to_cpu(endpoint->wMaxPacketSize);
|
||||||
lbs_dev_dbg(1, &udev->dev,
|
lbs_deb_usbd(&udev->dev,
|
||||||
"Bulk out size is %d\n",
|
"Bulk out size is %d\n",
|
||||||
endpoint->wMaxPacketSize);
|
le16_to_cpu(endpoint->wMaxPacketSize));
|
||||||
usb_cardp->bulk_out_endpointAddr =
|
cardp->bulk_out_endpointAddr =
|
||||||
endpoint->bEndpointAddress;
|
endpoint->bEndpointAddress;
|
||||||
lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n",
|
lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
|
||||||
endpoint->bEndpointAddress);
|
endpoint->bEndpointAddress);
|
||||||
usb_cardp->bulk_out_buffer =
|
cardp->bulk_out_buffer =
|
||||||
kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
|
kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!usb_cardp->bulk_out_buffer) {
|
if (!cardp->bulk_out_buffer) {
|
||||||
lbs_dev_dbg(1, &udev->dev,
|
lbs_deb_usbd(&udev->dev,
|
||||||
"Could not allocate buffer\n");
|
"Could not allocate buffer\n");
|
||||||
goto dealloc;
|
goto dealloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(priv = libertas_add_card(cardp, &udev->dev)))
|
||||||
/* At this point wlan_add_card() will be called. Don't worry
|
|
||||||
* about keeping pwlanpriv around since it will be set on our
|
|
||||||
* usb device data in -> add() -> libertas_sbi_register_dev().
|
|
||||||
*/
|
|
||||||
if (!(pwlanpriv = wlan_add_card(usb_cardp)))
|
|
||||||
goto dealloc;
|
goto dealloc;
|
||||||
|
|
||||||
usb_get_dev(udev);
|
if (libertas_add_mesh(priv, &udev->dev))
|
||||||
usb_set_intfdata(intf, usb_cardp);
|
goto err_add_mesh;
|
||||||
|
|
||||||
|
priv->hw_register_dev = if_usb_register_dev;
|
||||||
|
priv->hw_unregister_dev = if_usb_unregister_dev;
|
||||||
|
priv->hw_prog_firmware = if_usb_prog_firmware;
|
||||||
|
priv->hw_host_to_card = if_usb_host_to_card;
|
||||||
|
priv->hw_get_int_status = if_usb_get_int_status;
|
||||||
|
priv->hw_read_event_cause = if_usb_read_event_cause;
|
||||||
|
|
||||||
|
if (libertas_activate_card(priv, libertas_fw_name))
|
||||||
|
goto err_activate_card;
|
||||||
|
|
||||||
|
list_add_tail(&cardp->list, &usb_devices);
|
||||||
|
|
||||||
|
usb_get_dev(udev);
|
||||||
|
usb_set_intfdata(intf, cardp);
|
||||||
|
|
||||||
/*
|
|
||||||
* return card structure, which can be got back in the
|
|
||||||
* diconnect function as the ptr
|
|
||||||
* argument.
|
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_activate_card:
|
||||||
|
libertas_remove_mesh(priv);
|
||||||
|
err_add_mesh:
|
||||||
|
free_netdev(priv->dev);
|
||||||
|
kfree(priv->adapter);
|
||||||
dealloc:
|
dealloc:
|
||||||
if_usb_free(usb_cardp);
|
if_usb_free(cardp);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -212,8 +240,7 @@ error:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief free resource and cleanup
|
* @brief free resource and cleanup
|
||||||
* @param udev pointer to usb_device
|
* @param intf USB interface structure
|
||||||
* @param ptr pointer to usb_cardp
|
|
||||||
* @return N/A
|
* @return N/A
|
||||||
*/
|
*/
|
||||||
static void if_usb_disconnect(struct usb_interface *intf)
|
static void if_usb_disconnect(struct usb_interface *intf)
|
||||||
@ -229,9 +256,12 @@ static void if_usb_disconnect(struct usb_interface *intf)
|
|||||||
*/
|
*/
|
||||||
adapter->surpriseremoved = 1;
|
adapter->surpriseremoved = 1;
|
||||||
|
|
||||||
|
list_del(&cardp->list);
|
||||||
|
|
||||||
/* card is removed and we can call wlan_remove_card */
|
/* card is removed and we can call wlan_remove_card */
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n");
|
lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
|
||||||
wlan_remove_card(cardp);
|
libertas_remove_mesh(priv);
|
||||||
|
libertas_remove_card(priv);
|
||||||
|
|
||||||
/* Unlink and free urb */
|
/* Unlink and free urb */
|
||||||
if_usb_free(cardp);
|
if_usb_free(cardp);
|
||||||
@ -249,7 +279,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
|
|||||||
*/
|
*/
|
||||||
static int if_prog_firmware(wlan_private * priv)
|
static int if_prog_firmware(wlan_private * priv)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
struct FWData *fwdata;
|
struct FWData *fwdata;
|
||||||
struct fwheader *fwheader;
|
struct fwheader *fwheader;
|
||||||
u8 *firmware = priv->firmware->data;
|
u8 *firmware = priv->firmware->data;
|
||||||
@ -266,8 +296,10 @@ static int if_prog_firmware(wlan_private * priv)
|
|||||||
cardp->fwseqnum = cardp->lastseqnum - 1;
|
cardp->fwseqnum = cardp->lastseqnum - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n",
|
/*
|
||||||
|
lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n",
|
||||||
cardp->totalbytes);
|
cardp->totalbytes);
|
||||||
|
*/
|
||||||
|
|
||||||
memcpy(fwheader, &firmware[cardp->totalbytes],
|
memcpy(fwheader, &firmware[cardp->totalbytes],
|
||||||
sizeof(struct fwheader));
|
sizeof(struct fwheader));
|
||||||
@ -275,40 +307,48 @@ static int if_prog_firmware(wlan_private * priv)
|
|||||||
cardp->fwlastblksent = cardp->totalbytes;
|
cardp->fwlastblksent = cardp->totalbytes;
|
||||||
cardp->totalbytes += sizeof(struct fwheader);
|
cardp->totalbytes += sizeof(struct fwheader);
|
||||||
|
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n");
|
/* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
|
||||||
memcpy(fwdata->data, &firmware[cardp->totalbytes],
|
memcpy(fwdata->data, &firmware[cardp->totalbytes],
|
||||||
fwdata->fwheader.datalength);
|
le32_to_cpu(fwdata->fwheader.datalength));
|
||||||
|
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
/*
|
||||||
"Data length = %d\n", fwdata->fwheader.datalength);
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
|
"Data length = %d\n", le32_to_cpu(fwdata->fwheader.datalength));
|
||||||
|
*/
|
||||||
|
|
||||||
cardp->fwseqnum = cardp->fwseqnum + 1;
|
cardp->fwseqnum = cardp->fwseqnum + 1;
|
||||||
|
|
||||||
fwdata->seqnum = cardp->fwseqnum;
|
fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
|
||||||
cardp->lastseqnum = fwdata->seqnum;
|
cardp->lastseqnum = cardp->fwseqnum;
|
||||||
cardp->totalbytes += fwdata->fwheader.datalength;
|
cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
|
||||||
|
|
||||||
if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) {
|
if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n");
|
/*
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
|
||||||
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
|
"seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
|
||||||
cardp->totalbytes);
|
cardp->totalbytes);
|
||||||
|
*/
|
||||||
memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
|
memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
|
||||||
usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
|
usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
|
||||||
|
|
||||||
} else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) {
|
} else if (fwdata->fwheader.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) {
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
/*
|
||||||
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Host has finished FW downloading\n");
|
"Host has finished FW downloading\n");
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Donwloading FW JUMP BLOCK\n");
|
"Donwloading FW JUMP BLOCK\n");
|
||||||
|
*/
|
||||||
memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
|
memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
|
||||||
usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
|
usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
|
||||||
cardp->fwfinalblk = 1;
|
cardp->fwfinalblk = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
/*
|
||||||
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"The firmware download is done size is %d\n",
|
"The firmware download is done size is %d\n",
|
||||||
cardp->totalbytes);
|
cardp->totalbytes);
|
||||||
|
*/
|
||||||
|
|
||||||
kfree(fwdata);
|
kfree(fwdata);
|
||||||
|
|
||||||
@ -318,14 +358,19 @@ static int if_prog_firmware(wlan_private * priv)
|
|||||||
static int libertas_do_reset(wlan_private *priv)
|
static int libertas_do_reset(wlan_private *priv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
ret = usb_reset_device(cardp->udev);
|
ret = usb_reset_device(cardp->udev);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
msleep(10);
|
msleep(10);
|
||||||
reset_device(priv);
|
if_usb_reset_device(priv);
|
||||||
msleep(10);
|
msleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,12 +384,12 @@ static int libertas_do_reset(wlan_private *priv)
|
|||||||
int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
|
int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
|
||||||
{
|
{
|
||||||
/* pointer to card structure */
|
/* pointer to card structure */
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
/* check if device is removed */
|
/* check if device is removed */
|
||||||
if (priv->adapter->surpriseremoved) {
|
if (priv->adapter->surpriseremoved) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n");
|
lbs_deb_usbd(&cardp->udev->dev, "Device removed\n");
|
||||||
goto tx_ret;
|
goto tx_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,10 +402,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
|
|||||||
|
|
||||||
if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
|
if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
|
||||||
/* transfer failed */
|
/* transfer failed */
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n");
|
lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else {
|
} else {
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n");
|
/* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +417,7 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
|
|||||||
void (*callbackfn)
|
void (*callbackfn)
|
||||||
(struct urb *urb))
|
(struct urb *urb))
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct read_cb_info *rinfo = &cardp->rinfo;
|
struct read_cb_info *rinfo = &cardp->rinfo;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -394,13 +439,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
|
|||||||
|
|
||||||
cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
|
cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
|
||||||
|
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb);
|
/* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */
|
||||||
if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
|
if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
|
||||||
/* handle failure conditions */
|
/* handle failure conditions */
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n");
|
lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else {
|
} else {
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n");
|
/* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,12 +468,12 @@ static void if_usb_receive_fwload(struct urb *urb)
|
|||||||
struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
|
struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
|
||||||
wlan_private *priv = rinfo->priv;
|
wlan_private *priv = rinfo->priv;
|
||||||
struct sk_buff *skb = rinfo->skb;
|
struct sk_buff *skb = rinfo->skb;
|
||||||
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
|
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
|
||||||
struct fwsyncheader *syncfwheader;
|
struct fwsyncheader *syncfwheader;
|
||||||
struct bootcmdrespStr bootcmdresp;
|
struct bootcmdrespStr bootcmdresp;
|
||||||
|
|
||||||
if (urb->status) {
|
if (urb->status) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"URB status is failed during fw load\n");
|
"URB status is failed during fw load\n");
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return;
|
return;
|
||||||
@ -437,18 +482,18 @@ static void if_usb_receive_fwload(struct urb *urb)
|
|||||||
if (cardp->bootcmdresp == 0) {
|
if (cardp->bootcmdresp == 0) {
|
||||||
memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
|
memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
|
||||||
sizeof(bootcmdresp));
|
sizeof(bootcmdresp));
|
||||||
if (cardp->udev->descriptor.bcdDevice < 0x3106) {
|
if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
if_usb_submit_rx_urb_fwload(priv);
|
if_usb_submit_rx_urb_fwload(priv);
|
||||||
cardp->bootcmdresp = 1;
|
cardp->bootcmdresp = 1;
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Received valid boot command response\n");
|
"Received valid boot command response\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) {
|
if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
|
||||||
lbs_pr_info(
|
lbs_pr_info(
|
||||||
"boot cmd response wrong magic number (0x%x)\n",
|
"boot cmd response wrong magic number (0x%x)\n",
|
||||||
bootcmdresp.u32magicnumber);
|
le32_to_cpu(bootcmdresp.u32magicnumber));
|
||||||
} else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
|
} else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
|
||||||
lbs_pr_info(
|
lbs_pr_info(
|
||||||
"boot cmd response cmd_tag error (%d)\n",
|
"boot cmd response cmd_tag error (%d)\n",
|
||||||
@ -459,7 +504,7 @@ static void if_usb_receive_fwload(struct urb *urb)
|
|||||||
bootcmdresp.u8result);
|
bootcmdresp.u8result);
|
||||||
} else {
|
} else {
|
||||||
cardp->bootcmdresp = 1;
|
cardp->bootcmdresp = 1;
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Received valid boot command response\n");
|
"Received valid boot command response\n");
|
||||||
}
|
}
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
@ -469,7 +514,7 @@ static void if_usb_receive_fwload(struct urb *urb)
|
|||||||
|
|
||||||
syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
|
syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
|
||||||
if (!syncfwheader) {
|
if (!syncfwheader) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n");
|
lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n");
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -478,14 +523,16 @@ static void if_usb_receive_fwload(struct urb *urb)
|
|||||||
sizeof(struct fwsyncheader));
|
sizeof(struct fwsyncheader));
|
||||||
|
|
||||||
if (!syncfwheader->cmd) {
|
if (!syncfwheader->cmd) {
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
/*
|
||||||
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"FW received Blk with correct CRC\n");
|
"FW received Blk with correct CRC\n");
|
||||||
lbs_dev_dbg(2, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"FW received Blk seqnum = %d\n",
|
"FW received Blk seqnum = %d\n",
|
||||||
syncfwheader->seqnum);
|
syncfwheader->seqnum);
|
||||||
|
*/
|
||||||
cardp->CRC_OK = 1;
|
cardp->CRC_OK = 1;
|
||||||
} else {
|
} else {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"FW received Blk with CRC error\n");
|
"FW received Blk with CRC error\n");
|
||||||
cardp->CRC_OK = 0;
|
cardp->CRC_OK = 0;
|
||||||
}
|
}
|
||||||
@ -515,7 +562,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
|
|||||||
{
|
{
|
||||||
if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
|
if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
|
||||||
MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
|
MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Packet length is Invalid\n");
|
"Packet length is Invalid\n");
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return;
|
return;
|
||||||
@ -525,7 +572,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
|
|||||||
skb_put(skb, recvlength);
|
skb_put(skb, recvlength);
|
||||||
skb_pull(skb, MESSAGE_HEADER_LEN);
|
skb_pull(skb, MESSAGE_HEADER_LEN);
|
||||||
libertas_process_rxed_packet(priv, skb);
|
libertas_process_rxed_packet(priv, skb);
|
||||||
priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN);
|
priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
|
static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
|
||||||
@ -535,7 +582,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
|
|||||||
{
|
{
|
||||||
u8 *cmdbuf;
|
u8 *cmdbuf;
|
||||||
if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
|
if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"The receive buffer is too large\n");
|
"The receive buffer is too large\n");
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return;
|
return;
|
||||||
@ -548,21 +595,21 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
|
|||||||
/* take care of cur_cmd = NULL case by reading the
|
/* take care of cur_cmd = NULL case by reading the
|
||||||
* data to clear the interrupt */
|
* data to clear the interrupt */
|
||||||
if (!priv->adapter->cur_cmd) {
|
if (!priv->adapter->cur_cmd) {
|
||||||
cmdbuf = priv->wlan_dev.upld_buf;
|
cmdbuf = priv->upld_buf;
|
||||||
priv->adapter->hisregcpy &= ~his_cmdupldrdy;
|
priv->adapter->hisregcpy &= ~his_cmdupldrdy;
|
||||||
} else
|
} else
|
||||||
cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
|
cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
|
||||||
|
|
||||||
cardp->usb_int_cause |= his_cmdupldrdy;
|
cardp->usb_int_cause |= his_cmdupldrdy;
|
||||||
priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN);
|
priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
|
||||||
memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN,
|
memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN,
|
||||||
priv->wlan_dev.upld_len);
|
priv->upld_len);
|
||||||
|
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
libertas_interrupt(priv->wlan_dev.netdev);
|
libertas_interrupt(priv->dev);
|
||||||
spin_unlock(&priv->adapter->driver_lock);
|
spin_unlock(&priv->adapter->driver_lock);
|
||||||
|
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Wake up main thread to handle cmd response\n");
|
"Wake up main thread to handle cmd response\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -580,17 +627,17 @@ static void if_usb_receive(struct urb *urb)
|
|||||||
struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
|
struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
|
||||||
wlan_private *priv = rinfo->priv;
|
wlan_private *priv = rinfo->priv;
|
||||||
struct sk_buff *skb = rinfo->skb;
|
struct sk_buff *skb = rinfo->skb;
|
||||||
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
|
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
|
||||||
|
|
||||||
int recvlength = urb->actual_length;
|
int recvlength = urb->actual_length;
|
||||||
u8 *recvbuff = NULL;
|
u8 *recvbuff = NULL;
|
||||||
u32 recvtype;
|
u32 recvtype;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
if (recvlength) {
|
if (recvlength) {
|
||||||
if (urb->status) {
|
if (urb->status) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"URB status is failed\n");
|
"URB status is failed\n");
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
goto setup_for_next;
|
goto setup_for_next;
|
||||||
@ -598,12 +645,12 @@ static void if_usb_receive(struct urb *urb)
|
|||||||
|
|
||||||
recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
|
recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
|
||||||
memcpy(&recvtype, recvbuff, sizeof(u32));
|
memcpy(&recvtype, recvbuff, sizeof(u32));
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Recv length = 0x%x\n", recvlength);
|
"Recv length = 0x%x\n", recvlength);
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Receive type = 0x%X\n", recvtype);
|
"Receive type = 0x%X\n", recvtype);
|
||||||
recvtype = le32_to_cpu(recvtype);
|
recvtype = le32_to_cpu(recvtype);
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,
|
lbs_deb_usbd(&cardp->udev->dev,
|
||||||
"Receive type after = 0x%X\n", recvtype);
|
"Receive type after = 0x%X\n", recvtype);
|
||||||
} else if (urb->status)
|
} else if (urb->status)
|
||||||
goto rx_exit;
|
goto rx_exit;
|
||||||
@ -621,18 +668,18 @@ static void if_usb_receive(struct urb *urb)
|
|||||||
case CMD_TYPE_INDICATION:
|
case CMD_TYPE_INDICATION:
|
||||||
/* Event cause handling */
|
/* Event cause handling */
|
||||||
spin_lock(&priv->adapter->driver_lock);
|
spin_lock(&priv->adapter->driver_lock);
|
||||||
cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN);
|
cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n",
|
lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
|
||||||
cardp->usb_event_cause);
|
cardp->usb_event_cause);
|
||||||
if (cardp->usb_event_cause & 0xffff0000) {
|
if (cardp->usb_event_cause & 0xffff0000) {
|
||||||
libertas_send_tx_feedback(priv);
|
libertas_send_tx_feedback(priv);
|
||||||
spin_unlock(&priv->adapter->driver_lock);
|
spin_unlock(&priv->adapter->driver_lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3;
|
cardp->usb_event_cause <<= 3;
|
||||||
cardp->usb_int_cause |= his_cardevent;
|
cardp->usb_int_cause |= his_cardevent;
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
libertas_interrupt(priv->wlan_dev.netdev);
|
libertas_interrupt(priv->dev);
|
||||||
spin_unlock(&priv->adapter->driver_lock);
|
spin_unlock(&priv->adapter->driver_lock);
|
||||||
goto rx_exit;
|
goto rx_exit;
|
||||||
default:
|
default:
|
||||||
@ -643,8 +690,7 @@ static void if_usb_receive(struct urb *urb)
|
|||||||
setup_for_next:
|
setup_for_next:
|
||||||
if_usb_submit_rx_urb(priv);
|
if_usb_submit_rx_urb(priv);
|
||||||
rx_exit:
|
rx_exit:
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_USB);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -655,24 +701,24 @@ rx_exit:
|
|||||||
* @param len number of bytes
|
* @param len number of bytes
|
||||||
* @return 0 or -1
|
* @return 0 or -1
|
||||||
*/
|
*/
|
||||||
int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
|
static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
|
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
|
||||||
|
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type);
|
lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type);
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb);
|
lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb);
|
||||||
|
|
||||||
if (type == MVMS_CMD) {
|
if (type == MVMS_CMD) {
|
||||||
tmp = cpu_to_le32(CMD_TYPE_REQUEST);
|
tmp = cpu_to_le32(CMD_TYPE_REQUEST);
|
||||||
priv->wlan_dev.dnld_sent = DNLD_CMD_SENT;
|
priv->dnld_sent = DNLD_CMD_SENT;
|
||||||
memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
|
memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
|
||||||
MESSAGE_HEADER_LEN);
|
MESSAGE_HEADER_LEN);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tmp = cpu_to_le32(CMD_TYPE_DATA);
|
tmp = cpu_to_le32(CMD_TYPE_DATA);
|
||||||
priv->wlan_dev.dnld_sent = DNLD_DATA_SENT;
|
priv->dnld_sent = DNLD_DATA_SENT;
|
||||||
memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
|
memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
|
||||||
MESSAGE_HEADER_LEN);
|
MESSAGE_HEADER_LEN);
|
||||||
}
|
}
|
||||||
@ -686,39 +732,41 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* called with adapter->driver_lock held */
|
/* called with adapter->driver_lock held */
|
||||||
int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg)
|
static int if_usb_get_int_status(wlan_private * priv, u8 * ireg)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
|
|
||||||
*ireg = cardp->usb_int_cause;
|
*ireg = cardp->usb_int_cause;
|
||||||
cardp->usb_int_cause = 0;
|
cardp->usb_int_cause = 0;
|
||||||
|
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
|
lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int libertas_sbi_read_event_cause(wlan_private * priv)
|
static int if_usb_read_event_cause(wlan_private * priv)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
priv->adapter->eventcause = cardp->usb_event_cause;
|
priv->adapter->eventcause = cardp->usb_event_cause;
|
||||||
/* Re-submit rx urb here to avoid event lost issue */
|
/* Re-submit rx urb here to avoid event lost issue */
|
||||||
if_usb_submit_rx_urb(priv);
|
if_usb_submit_rx_urb(priv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int reset_device(wlan_private *priv)
|
static int if_usb_reset_device(wlan_private *priv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset,
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset,
|
||||||
cmd_act_halt, 0, 0, NULL);
|
cmd_act_halt, 0, 0, NULL);
|
||||||
msleep_interruptible(10);
|
msleep_interruptible(10);
|
||||||
|
|
||||||
|
lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int libertas_sbi_unregister_dev(wlan_private * priv)
|
static int if_usb_unregister_dev(wlan_private * priv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -727,7 +775,7 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
|
|||||||
* again.
|
* again.
|
||||||
*/
|
*/
|
||||||
if (priv)
|
if (priv)
|
||||||
reset_device(priv);
|
if_usb_reset_device(priv);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -738,42 +786,41 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
|
|||||||
* @param priv pointer to wlan_private
|
* @param priv pointer to wlan_private
|
||||||
* @return 0 or -1
|
* @return 0 or -1
|
||||||
*/
|
*/
|
||||||
int libertas_sbi_register_dev(wlan_private * priv)
|
static int if_usb_register_dev(wlan_private * priv)
|
||||||
{
|
{
|
||||||
|
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
|
||||||
|
|
||||||
struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
ENTER();
|
|
||||||
|
|
||||||
cardp->priv = priv;
|
cardp->priv = priv;
|
||||||
cardp->eth_dev = priv->wlan_dev.netdev;
|
cardp->eth_dev = priv->dev;
|
||||||
priv->hotplug_device = &(cardp->udev->dev);
|
priv->hotplug_device = &(cardp->udev->dev);
|
||||||
|
|
||||||
SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
|
lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
|
||||||
|
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n",
|
|
||||||
cardp->udev);
|
cardp->udev);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_USB);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int libertas_sbi_prog_firmware(wlan_private * priv)
|
static int if_usb_prog_firmware(wlan_private * priv)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = priv->wlan_dev.card;
|
struct usb_card_rec *cardp = priv->card;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static int reset_count = 10;
|
static int reset_count = 10;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
cardp->rinfo.priv = priv;
|
cardp->rinfo.priv = priv;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
if (if_usb_submit_rx_urb_fwload(priv) < 0) {
|
if (if_usb_submit_rx_urb_fwload(priv) < 0) {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n");
|
lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
|
||||||
LEAVE();
|
ret = -1;
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
cardp->bootcmdresp = 0;
|
cardp->bootcmdresp = 0;
|
||||||
@ -811,7 +858,7 @@ restart:
|
|||||||
if_prog_firmware(priv);
|
if_prog_firmware(priv);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n");
|
lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n");
|
||||||
i++;
|
i++;
|
||||||
msleep_interruptible(100);
|
msleep_interruptible(100);
|
||||||
if (priv->adapter->surpriseremoved || i >= 20)
|
if (priv->adapter->surpriseremoved || i >= 20)
|
||||||
@ -826,8 +873,8 @@ restart:
|
|||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
|
lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
|
||||||
LEAVE();
|
ret = -1;
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if_usb_submit_rx_urb(priv);
|
if_usb_submit_rx_urb(priv);
|
||||||
@ -837,45 +884,24 @@ restart:
|
|||||||
|
|
||||||
priv->adapter->fw_ready = 1;
|
priv->adapter->fw_ready = 1;
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
return 0;
|
lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Given a usb_card_rec return its wlan_private
|
|
||||||
* @param card pointer to a usb_card_rec
|
|
||||||
* @return pointer to wlan_private
|
|
||||||
*/
|
|
||||||
wlan_private *libertas_sbi_get_priv(void *card)
|
|
||||||
{
|
|
||||||
struct usb_card_rec *cardp = card;
|
|
||||||
return cardp->priv;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_PM
|
|
||||||
int libertas_sbi_suspend(wlan_private * priv)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int libertas_sbi_resume(wlan_private * priv)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
|
static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = usb_get_intfdata(intf);
|
struct usb_card_rec *cardp = usb_get_intfdata(intf);
|
||||||
wlan_private *priv = cardp->priv;
|
wlan_private *priv = cardp->priv;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
if (priv->adapter->psstate != PS_STATE_FULL_POWER)
|
if (priv->adapter->psstate != PS_STATE_FULL_POWER)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
netif_device_detach(cardp->eth_dev);
|
netif_device_detach(cardp->eth_dev);
|
||||||
|
netif_device_detach(priv->mesh_dev);
|
||||||
|
|
||||||
/* Unlink tx & rx urb */
|
/* Unlink tx & rx urb */
|
||||||
usb_kill_urb(cardp->tx_urb);
|
usb_kill_urb(cardp->tx_urb);
|
||||||
@ -883,23 +909,25 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
|
|||||||
|
|
||||||
cardp->rx_urb_recall = 1;
|
cardp->rx_urb_recall = 1;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_USB);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int if_usb_resume(struct usb_interface *intf)
|
static int if_usb_resume(struct usb_interface *intf)
|
||||||
{
|
{
|
||||||
struct usb_card_rec *cardp = usb_get_intfdata(intf);
|
struct usb_card_rec *cardp = usb_get_intfdata(intf);
|
||||||
|
wlan_private *priv = cardp->priv;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_USB);
|
||||||
|
|
||||||
cardp->rx_urb_recall = 0;
|
cardp->rx_urb_recall = 0;
|
||||||
|
|
||||||
if_usb_submit_rx_urb(cardp->priv);
|
if_usb_submit_rx_urb(cardp->priv);
|
||||||
|
|
||||||
netif_device_attach(cardp->eth_dev);
|
netif_device_attach(cardp->eth_dev);
|
||||||
|
netif_device_attach(priv->mesh_dev);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_USB);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -920,32 +948,40 @@ static struct usb_driver if_usb_driver = {
|
|||||||
.resume = if_usb_resume,
|
.resume = if_usb_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
static int if_usb_init_module(void)
|
||||||
* @brief This function registers driver.
|
|
||||||
* @param add pointer to add_card callback function
|
|
||||||
* @param remove pointer to remove card callback function
|
|
||||||
* @param arg pointer to call back function parameter
|
|
||||||
* @return dummy success variable
|
|
||||||
*/
|
|
||||||
int libertas_sbi_register(void)
|
|
||||||
{
|
{
|
||||||
/*
|
int ret = 0;
|
||||||
* API registers the Marvell USB driver
|
|
||||||
* to the USB system
|
|
||||||
*/
|
|
||||||
usb_register(&if_usb_driver);
|
|
||||||
|
|
||||||
/* Return success to wlan layer */
|
lbs_deb_enter(LBS_DEB_MAIN);
|
||||||
return 0;
|
|
||||||
|
if (libertas_fw_name == NULL) {
|
||||||
|
libertas_fw_name = default_fw_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = usb_register(&if_usb_driver);
|
||||||
|
|
||||||
|
lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void if_usb_exit_module(void)
|
||||||
* @brief This function removes usb driver.
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
void libertas_sbi_unregister(void)
|
|
||||||
{
|
{
|
||||||
|
struct usb_card_rec *cardp, *cardp_temp;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_MAIN);
|
||||||
|
|
||||||
|
list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list)
|
||||||
|
if_usb_reset_device((wlan_private *) cardp->priv);
|
||||||
|
|
||||||
/* API unregisters the driver from USB subsystem */
|
/* API unregisters the driver from USB subsystem */
|
||||||
usb_deregister(&if_usb_driver);
|
usb_deregister(&if_usb_driver);
|
||||||
return;
|
|
||||||
|
lbs_deb_leave(LBS_DEB_MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(if_usb_init_module);
|
||||||
|
module_exit(if_usb_exit_module);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("8388 USB WLAN Driver");
|
||||||
|
MODULE_AUTHOR("Marvell International Ltd.");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
#ifndef _LIBERTAS_IF_USB_H
|
||||||
|
#define _LIBERTAS_IF_USB_H
|
||||||
|
|
||||||
|
#include <linux/list.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file contains definition for USB interface.
|
* This file contains definition for USB interface.
|
||||||
*/
|
*/
|
||||||
@ -7,11 +12,6 @@
|
|||||||
|
|
||||||
#define IPFIELD_ALIGN_OFFSET 2
|
#define IPFIELD_ALIGN_OFFSET 2
|
||||||
|
|
||||||
#define USB8388_VID_1 0x1286
|
|
||||||
#define USB8388_PID_1 0x2001
|
|
||||||
#define USB8388_VID_2 0x05a3
|
|
||||||
#define USB8388_PID_2 0x8388
|
|
||||||
|
|
||||||
#define BOOT_CMD_FW_BY_USB 0x01
|
#define BOOT_CMD_FW_BY_USB 0x01
|
||||||
#define BOOT_CMD_FW_IN_EEPROM 0x02
|
#define BOOT_CMD_FW_IN_EEPROM 0x02
|
||||||
#define BOOT_CMD_UPDATE_BOOT2 0x03
|
#define BOOT_CMD_UPDATE_BOOT2 0x03
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
struct bootcmdstr
|
struct bootcmdstr
|
||||||
{
|
{
|
||||||
u32 u32magicnumber;
|
__le32 u32magicnumber;
|
||||||
u8 u8cmd_tag;
|
u8 u8cmd_tag;
|
||||||
u8 au8dumy[11];
|
u8 au8dumy[11];
|
||||||
};
|
};
|
||||||
@ -30,7 +30,7 @@ struct bootcmdstr
|
|||||||
|
|
||||||
struct bootcmdrespStr
|
struct bootcmdrespStr
|
||||||
{
|
{
|
||||||
u32 u32magicnumber;
|
__le32 u32magicnumber;
|
||||||
u8 u8cmd_tag;
|
u8 u8cmd_tag;
|
||||||
u8 u8result;
|
u8 u8result;
|
||||||
u8 au8dumy[2];
|
u8 au8dumy[2];
|
||||||
@ -44,6 +44,7 @@ struct read_cb_info {
|
|||||||
|
|
||||||
/** USB card description structure*/
|
/** USB card description structure*/
|
||||||
struct usb_card_rec {
|
struct usb_card_rec {
|
||||||
|
struct list_head list;
|
||||||
struct net_device *eth_dev;
|
struct net_device *eth_dev;
|
||||||
struct usb_device *udev;
|
struct usb_device *udev;
|
||||||
struct urb *rx_urb, *tx_urb;
|
struct urb *rx_urb, *tx_urb;
|
||||||
@ -75,33 +76,34 @@ struct usb_card_rec {
|
|||||||
|
|
||||||
/** fwheader */
|
/** fwheader */
|
||||||
struct fwheader {
|
struct fwheader {
|
||||||
u32 dnldcmd;
|
__le32 dnldcmd;
|
||||||
u32 baseaddr;
|
__le32 baseaddr;
|
||||||
u32 datalength;
|
__le32 datalength;
|
||||||
u32 CRC;
|
__le32 CRC;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FW_MAX_DATA_BLK_SIZE 600
|
#define FW_MAX_DATA_BLK_SIZE 600
|
||||||
/** FWData */
|
/** FWData */
|
||||||
struct FWData {
|
struct FWData {
|
||||||
struct fwheader fwheader;
|
struct fwheader fwheader;
|
||||||
u32 seqnum;
|
__le32 seqnum;
|
||||||
u8 data[FW_MAX_DATA_BLK_SIZE];
|
u8 data[FW_MAX_DATA_BLK_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** fwsyncheader */
|
/** fwsyncheader */
|
||||||
struct fwsyncheader {
|
struct fwsyncheader {
|
||||||
u32 cmd;
|
__le32 cmd;
|
||||||
u32 seqnum;
|
__le32 seqnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FW_HAS_DATA_TO_RECV 0x00000001
|
#define FW_HAS_DATA_TO_RECV 0x00000001
|
||||||
#define FW_HAS_LAST_BLOCK 0x00000004
|
#define FW_HAS_LAST_BLOCK 0x00000004
|
||||||
|
|
||||||
#define FW_DATA_XMIT_SIZE \
|
#define FW_DATA_XMIT_SIZE \
|
||||||
sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32)
|
sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
|
||||||
|
|
||||||
int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb);
|
int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb);
|
||||||
void if_usb_free(struct usb_card_rec *cardp);
|
void if_usb_free(struct usb_card_rec *cardp);
|
||||||
int if_usb_issue_boot_command(wlan_private *priv, int ivalue);
|
int if_usb_issue_boot_command(wlan_private *priv, int ivalue);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
static int wlan_set_region(wlan_private * priv, u16 region_code)
|
static int wlan_set_region(wlan_private * priv, u16 region_code)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
|
for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
|
||||||
// use the region code to search for the index
|
// use the region code to search for the index
|
||||||
@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
|
|||||||
|
|
||||||
// if it's unidentified region code
|
// if it's unidentified region code
|
||||||
if (i >= MRVDRV_MAX_REGION_CODE) {
|
if (i >= MRVDRV_MAX_REGION_CODE) {
|
||||||
lbs_pr_debug(1, "region Code not identified\n");
|
lbs_deb_ioctl("region Code not identified\n");
|
||||||
LEAVE();
|
ret = -1;
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
|
if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
|
||||||
LEAVE();
|
ret = -EINVAL;
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int hex2int(char c)
|
static inline int hex2int(char c)
|
||||||
@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char ethaddrs_str[18];
|
char ethaddrs_str[18];
|
||||||
char *pos;
|
char *pos;
|
||||||
u8 ethaddr[ETH_ALEN];
|
u8 ethaddr[ETH_ALEN];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
ENTER();
|
|
||||||
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
|
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
|
||||||
sizeof(ethaddrs_str)))
|
sizeof(ethaddrs_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str);
|
lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
|
||||||
LEAVE();
|
ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
|
||||||
return (libertas_prepare_and_send_command(priv, cmd_bt_access,
|
|
||||||
cmd_act_bt_access_add,
|
cmd_act_bt_access_add,
|
||||||
cmd_option_waitforrsp, 0, ethaddr));
|
cmd_option_waitforrsp, 0, ethaddr);
|
||||||
|
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
u8 ethaddr[ETH_ALEN];
|
u8 ethaddr[ETH_ALEN];
|
||||||
char *pos;
|
char *pos;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
|
if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
|
||||||
sizeof(ethaddrs_str)))
|
sizeof(ethaddrs_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str);
|
lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
|
||||||
|
|
||||||
return (libertas_prepare_and_send_command(priv,
|
return (libertas_prepare_and_send_command(priv,
|
||||||
cmd_bt_access,
|
cmd_bt_access,
|
||||||
cmd_act_bt_access_del,
|
cmd_act_bt_access_del,
|
||||||
cmd_option_waitforrsp, 0, ethaddr));
|
cmd_option_waitforrsp, 0, ethaddr));
|
||||||
LEAVE();
|
|
||||||
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
*/
|
*/
|
||||||
static int wlan_bt_reset_ioctl(wlan_private * priv)
|
static int wlan_bt_reset_ioctl(wlan_private * priv)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
lbs_pr_alert( "BT: resetting\n");
|
lbs_pr_alert( "BT: resetting\n");
|
||||||
|
|
||||||
@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv)
|
|||||||
cmd_act_bt_access_reset,
|
cmd_act_bt_access_reset,
|
||||||
cmd_option_waitforrsp, 0, NULL));
|
cmd_option_waitforrsp, 0, NULL));
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,17 +216,17 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
struct iwreq *wrq = (struct iwreq *)req;
|
struct iwreq *wrq = (struct iwreq *)req;
|
||||||
/* used to pass id and store the bt entry returned by the FW */
|
/* used to pass id and store the bt entry returned by the FW */
|
||||||
union {
|
union {
|
||||||
int id;
|
u32 id;
|
||||||
char addr1addr2[2 * ETH_ALEN];
|
char addr1addr2[2 * ETH_ALEN];
|
||||||
} param;
|
} param;
|
||||||
static char outstr[64];
|
static char outstr[64];
|
||||||
char *pbuf = outstr;
|
char *pbuf = outstr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
|
if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
|
||||||
lbs_pr_debug(1, "Copy from user failed\n");
|
lbs_deb_ioctl("Copy from user failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
param.id = simple_strtoul(outstr, NULL, 10);
|
param.id = simple_strtoul(outstr, NULL, 10);
|
||||||
@ -234,7 +241,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
addr1 = param.addr1addr2;
|
addr1 = param.addr1addr2;
|
||||||
|
|
||||||
pos = sprintf(pbuf, "ignoring traffic from ");
|
pos = sprintf(pbuf, "BT includes node ");
|
||||||
pbuf += pos;
|
pbuf += pos;
|
||||||
pos = eth_addr2str(addr1, pbuf);
|
pos = eth_addr2str(addr1, pbuf);
|
||||||
pbuf += pos;
|
pbuf += pos;
|
||||||
@ -246,11 +253,70 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
wrq->u.data.length = strlen(outstr);
|
wrq->u.data.length = strlen(outstr);
|
||||||
if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
|
if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n");
|
lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets inverted state of blacklist (non-zero if inverted)
|
||||||
|
* @param priv A pointer to wlan_private structure
|
||||||
|
* @param req A pointer to ifreq structure
|
||||||
|
* @return 0 --success, otherwise fail
|
||||||
|
*/
|
||||||
|
static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct iwreq *wrq = (struct iwreq *)req;
|
||||||
|
union {
|
||||||
|
u32 id;
|
||||||
|
char addr1addr2[2 * ETH_ALEN];
|
||||||
|
} param;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
|
param.id = SUBCMD_DATA(wrq) ;
|
||||||
|
ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
|
||||||
|
cmd_act_bt_access_set_invert,
|
||||||
|
cmd_option_waitforrsp, 0,
|
||||||
|
(char *)¶m);
|
||||||
|
if (ret != 0)
|
||||||
|
return -EFAULT;
|
||||||
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets inverted state of blacklist (non-zero if inverted)
|
||||||
|
* @param priv A pointer to wlan_private structure
|
||||||
|
* @param req A pointer to ifreq structure
|
||||||
|
* @return 0 --success, otherwise fail
|
||||||
|
*/
|
||||||
|
static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
|
||||||
|
{
|
||||||
|
struct iwreq *wrq = (struct iwreq *)req;
|
||||||
|
int ret;
|
||||||
|
union {
|
||||||
|
u32 id;
|
||||||
|
char addr1addr2[2 * ETH_ALEN];
|
||||||
|
} param;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
|
ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
|
||||||
|
cmd_act_bt_access_get_invert,
|
||||||
|
cmd_option_waitforrsp, 0,
|
||||||
|
(char *)¶m);
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
|
wrq->u.param.value = le32_to_cpu(param.id);
|
||||||
|
else
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,8 +344,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char in_str[128];
|
char in_str[128];
|
||||||
static struct cmd_ds_fwt_access fwt_access;
|
static struct cmd_ds_fwt_access fwt_access;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
ENTER();
|
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -297,24 +365,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
fwt_access.metric =
|
fwt_access.metric =
|
||||||
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
else
|
else
|
||||||
fwt_access.metric = FWT_DEFAULT_METRIC;
|
fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
|
||||||
|
|
||||||
if ((ptr = next_param(ptr)))
|
if ((ptr = next_param(ptr)))
|
||||||
fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
|
fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
|
||||||
else
|
else
|
||||||
fwt_access.dir = FWT_DEFAULT_DIR;
|
fwt_access.dir = FWT_DEFAULT_DIR;
|
||||||
|
|
||||||
|
if ((ptr = next_param(ptr)))
|
||||||
|
fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
|
||||||
|
else
|
||||||
|
fwt_access.rate = FWT_DEFAULT_RATE;
|
||||||
|
|
||||||
if ((ptr = next_param(ptr)))
|
if ((ptr = next_param(ptr)))
|
||||||
fwt_access.ssn =
|
fwt_access.ssn =
|
||||||
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
else
|
else
|
||||||
fwt_access.ssn = FWT_DEFAULT_SSN;
|
fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
|
||||||
|
|
||||||
if ((ptr = next_param(ptr)))
|
if ((ptr = next_param(ptr)))
|
||||||
fwt_access.dsn =
|
fwt_access.dsn =
|
||||||
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
else
|
else
|
||||||
fwt_access.dsn = FWT_DEFAULT_DSN;
|
fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
|
||||||
|
|
||||||
if ((ptr = next_param(ptr)))
|
if ((ptr = next_param(ptr)))
|
||||||
fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
|
fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
|
||||||
@ -330,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
fwt_access.expiration =
|
fwt_access.expiration =
|
||||||
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
else
|
else
|
||||||
fwt_access.expiration = FWT_DEFAULT_EXPIRATION;
|
fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
|
||||||
|
|
||||||
if ((ptr = next_param(ptr)))
|
if ((ptr = next_param(ptr)))
|
||||||
fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
|
fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
|
||||||
@ -341,27 +414,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
fwt_access.snr =
|
fwt_access.snr =
|
||||||
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
else
|
else
|
||||||
fwt_access.snr = FWT_DEFAULT_SNR;
|
fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
char ethaddr1_str[18], ethaddr2_str[18];
|
char ethaddr1_str[18], ethaddr2_str[18];
|
||||||
eth_addr2str(fwt_access.da, ethaddr1_str);
|
eth_addr2str(fwt_access.da, ethaddr1_str);
|
||||||
eth_addr2str(fwt_access.ra, ethaddr2_str);
|
eth_addr2str(fwt_access.ra, ethaddr2_str);
|
||||||
lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
|
lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
|
||||||
fwt_access.dir, ethaddr2_str);
|
fwt_access.dir, ethaddr2_str);
|
||||||
lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
|
lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
|
||||||
fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
|
fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
|
||||||
fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
|
fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
|
||||||
fwt_access.sleepmode, fwt_access.snr);
|
fwt_access.sleepmode, fwt_access.snr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LEAVE();
|
ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
|
||||||
return (libertas_prepare_and_send_command(priv, cmd_fwt_access,
|
cmd_act_fwt_access_add,
|
||||||
cmd_act_fwt_access_add,
|
cmd_option_waitforrsp, 0,
|
||||||
cmd_option_waitforrsp, 0,
|
(void *)&fwt_access);
|
||||||
(void *)&fwt_access));
|
|
||||||
|
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,8 +451,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char in_str[64];
|
char in_str[64];
|
||||||
static struct cmd_ds_fwt_access fwt_access;
|
static struct cmd_ds_fwt_access fwt_access;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
ENTER();
|
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -399,20 +476,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
char ethaddr1_str[18], ethaddr2_str[18];
|
char ethaddr1_str[18], ethaddr2_str[18];
|
||||||
lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str);
|
lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
|
||||||
eth_addr2str(fwt_access.da, ethaddr1_str);
|
eth_addr2str(fwt_access.da, ethaddr1_str);
|
||||||
eth_addr2str(fwt_access.ra, ethaddr2_str);
|
eth_addr2str(fwt_access.ra, ethaddr2_str);
|
||||||
lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
|
lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
|
||||||
ethaddr2_str, fwt_access.dir);
|
ethaddr2_str, fwt_access.dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LEAVE();
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
return (libertas_prepare_and_send_command(priv,
|
cmd_fwt_access,
|
||||||
cmd_fwt_access,
|
cmd_act_fwt_access_del,
|
||||||
cmd_act_fwt_access_del,
|
cmd_option_waitforrsp, 0,
|
||||||
cmd_option_waitforrsp, 0,
|
(void *)&fwt_access);
|
||||||
(void *)&fwt_access));
|
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -427,15 +505,18 @@ static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf)
|
|||||||
buf += eth_addr2str(fwt_access.da, buf);
|
buf += eth_addr2str(fwt_access.da, buf);
|
||||||
buf += sprintf(buf, " ");
|
buf += sprintf(buf, " ");
|
||||||
buf += eth_addr2str(fwt_access.ra, buf);
|
buf += eth_addr2str(fwt_access.ra, buf);
|
||||||
|
buf += sprintf(buf, " %u", fwt_access.valid);
|
||||||
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
|
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
|
||||||
buf += sprintf(buf, " %u", fwt_access.dir);
|
buf += sprintf(buf, " %u", fwt_access.dir);
|
||||||
|
buf += sprintf(buf, " %u", fwt_access.rate);
|
||||||
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
|
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
|
||||||
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
|
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
|
||||||
buf += sprintf(buf, " %u", fwt_access.hopcount);
|
buf += sprintf(buf, " %u", fwt_access.hopcount);
|
||||||
buf += sprintf(buf, " %u", fwt_access.ttl);
|
buf += sprintf(buf, " %u", fwt_access.ttl);
|
||||||
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
|
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
|
||||||
buf += sprintf(buf, " %u", fwt_access.sleepmode);
|
buf += sprintf(buf, " %u", fwt_access.sleepmode);
|
||||||
buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr));
|
buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
|
||||||
|
buf += eth_addr2str(fwt_access.prec, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,7 +534,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
static char out_str[128];
|
static char out_str[128];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -465,9 +547,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
char ethaddr1_str[18];
|
char ethaddr1_str[18];
|
||||||
lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str);
|
lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
|
||||||
eth_addr2str(fwt_access.da, ethaddr1_str);
|
eth_addr2str(fwt_access.da, ethaddr1_str);
|
||||||
lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
|
lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -485,11 +567,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
wrq->u.data.length = strlen(out_str);
|
wrq->u.data.length = strlen(out_str);
|
||||||
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n");
|
lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +582,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
*/
|
*/
|
||||||
static int wlan_fwt_reset_ioctl(wlan_private * priv)
|
static int wlan_fwt_reset_ioctl(wlan_private * priv)
|
||||||
{
|
{
|
||||||
lbs_pr_debug(1, "FWT: resetting\n");
|
lbs_deb_ioctl("FWT: resetting\n");
|
||||||
|
|
||||||
return (libertas_prepare_and_send_command(priv,
|
return (libertas_prepare_and_send_command(priv,
|
||||||
cmd_fwt_access,
|
cmd_fwt_access,
|
||||||
@ -522,18 +604,21 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char *ptr = in_str;
|
char *ptr = in_str;
|
||||||
static char out_str[128];
|
static char out_str[128];
|
||||||
char *pbuf = out_str;
|
char *pbuf = out_str;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
|
||||||
return -EFAULT;
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) {
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str);
|
lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
|
||||||
lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -549,12 +634,16 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
wrq->u.data.length = strlen(out_str);
|
wrq->u.data.length = strlen(out_str);
|
||||||
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n");
|
lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
ret = 0;
|
||||||
return 0;
|
|
||||||
|
out:
|
||||||
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -573,7 +662,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char *pbuf = out_str;
|
char *pbuf = out_str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -581,8 +671,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str);
|
lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
|
||||||
lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -591,28 +681,18 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
cmd_option_waitforrsp, 0, (void *)&fwt_access);
|
cmd_option_waitforrsp, 0, (void *)&fwt_access);
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
pbuf += sprintf(pbuf, " ");
|
print_route(fwt_access, pbuf);
|
||||||
pbuf += eth_addr2str(fwt_access.da, pbuf);
|
|
||||||
pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.metric));
|
|
||||||
pbuf += sprintf(pbuf, " %u", fwt_access.dir);
|
|
||||||
/* note that the firmware returns the nid in the id field */
|
|
||||||
pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.id));
|
|
||||||
pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.ssn));
|
|
||||||
pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.dsn));
|
|
||||||
pbuf += sprintf(pbuf, " hop %u", fwt_access.hopcount);
|
|
||||||
pbuf += sprintf(pbuf, " ttl %u", fwt_access.ttl);
|
|
||||||
pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.expiration));
|
|
||||||
} else
|
} else
|
||||||
pbuf += sprintf(pbuf, " (null)");
|
pbuf += sprintf(pbuf, " (null)");
|
||||||
|
|
||||||
wrq->u.data.length = strlen(out_str);
|
wrq->u.data.length = strlen(out_str);
|
||||||
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n");
|
lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +712,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
char *pbuf = out_str;
|
char *pbuf = out_str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -641,8 +722,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str);
|
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
|
||||||
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -663,11 +744,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
wrq->u.data.length = strlen(out_str);
|
wrq->u.data.length = strlen(out_str);
|
||||||
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n");
|
lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,9 +765,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
static struct cmd_ds_fwt_access fwt_access;
|
static struct cmd_ds_fwt_access fwt_access;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
lbs_pr_debug(1, "FWT: cleaning up\n");
|
lbs_deb_ioctl("FWT: cleaning up\n");
|
||||||
|
|
||||||
memset(&fwt_access, 0, sizeof(fwt_access));
|
memset(&fwt_access, 0, sizeof(fwt_access));
|
||||||
|
|
||||||
@ -700,7 +781,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
else
|
else
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,9 +797,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
static struct cmd_ds_fwt_access fwt_access;
|
static struct cmd_ds_fwt_access fwt_access;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
lbs_pr_debug(1, "FWT: getting time\n");
|
lbs_deb_ioctl("FWT: getting time\n");
|
||||||
|
|
||||||
memset(&fwt_access, 0, sizeof(fwt_access));
|
memset(&fwt_access, 0, sizeof(fwt_access));
|
||||||
|
|
||||||
@ -732,7 +813,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
else
|
else
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +829,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
struct cmd_ds_mesh_access mesh_access;
|
struct cmd_ds_mesh_access mesh_access;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
memset(&mesh_access, 0, sizeof(mesh_access));
|
memset(&mesh_access, 0, sizeof(mesh_access));
|
||||||
|
|
||||||
@ -762,7 +843,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
|
|||||||
else
|
else
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -777,13 +858,13 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
|
|||||||
struct cmd_ds_mesh_access mesh_access;
|
struct cmd_ds_mesh_access mesh_access;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
if( (ttl > 0xff) || (ttl < 0) )
|
if( (ttl > 0xff) || (ttl < 0) )
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
memset(&mesh_access, 0, sizeof(mesh_access));
|
memset(&mesh_access, 0, sizeof(mesh_access));
|
||||||
mesh_access.data[0] = ttl;
|
mesh_access.data[0] = cpu_to_le32(ttl);
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
|
ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
|
||||||
cmd_act_mesh_set_ttl,
|
cmd_act_mesh_set_ttl,
|
||||||
@ -793,7 +874,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_IOCTL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,9 +896,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct iwreq *wrq = (struct iwreq *)req;
|
struct iwreq *wrq = (struct iwreq *)req;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_IOCTL);
|
||||||
|
|
||||||
lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
|
lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
|
case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
|
||||||
switch (wrq->u.data.flags) {
|
switch (wrq->u.data.flags) {
|
||||||
@ -848,6 +929,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
ret = wlan_mesh_set_ttl_ioctl(priv, idata);
|
ret = wlan_mesh_set_ttl_ioctl(priv, idata);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WLAN_SUBCMD_BT_SET_INVERT:
|
||||||
|
ret = wlan_bt_set_invert_ioctl(priv, req);
|
||||||
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
break;
|
break;
|
||||||
@ -905,6 +990,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
ret = wlan_mesh_get_ttl_ioctl(priv, req);
|
ret = wlan_mesh_get_ttl_ioctl(priv, req);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WLAN_SUBCMD_BT_GET_INVERT:
|
||||||
|
ret = wlan_bt_get_invert_ioctl(priv, req);
|
||||||
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
|
|
||||||
@ -937,7 +1026,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
(data, wrq->u.data.pointer,
|
(data, wrq->u.data.pointer,
|
||||||
sizeof(int) *
|
sizeof(int) *
|
||||||
wrq->u.data.length)) {
|
wrq->u.data.length)) {
|
||||||
lbs_pr_debug(1,
|
lbs_deb_ioctl(
|
||||||
"Copy from user failed\n");
|
"Copy from user failed\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
@ -970,7 +1059,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
if (copy_to_user(wrq->u.data.pointer, data,
|
if (copy_to_user(wrq->u.data.pointer, data,
|
||||||
sizeof(int) *
|
sizeof(int) *
|
||||||
gpio->header.len)) {
|
gpio->header.len)) {
|
||||||
lbs_pr_debug(1, "Copy to user failed\n");
|
lbs_deb_ioctl("Copy to user failed\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -984,7 +1073,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LEAVE();
|
|
||||||
|
lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
#include <linux/wireless.h>
|
#include <linux/wireless.h>
|
||||||
|
#include <linux/etherdevice.h>
|
||||||
|
|
||||||
#include <net/iw_handler.h>
|
#include <net/iw_handler.h>
|
||||||
|
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "join.h"
|
#include "join.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
|
#include "assoc.h"
|
||||||
|
|
||||||
#define AD_HOC_CAP_PRIVACY_ON 1
|
#define AD_HOC_CAP_PRIVACY_ON 1
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1,
|
|||||||
lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
|
lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
|
||||||
lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
|
lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
|
||||||
lbs_dbg_hex("Common rates:", ptr, rate1_size);
|
lbs_dbg_hex("Common rates:", ptr, rate1_size);
|
||||||
lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate);
|
lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate);
|
||||||
|
|
||||||
if (!adapter->is_datarate_auto) {
|
if (!adapter->is_datarate_auto) {
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
@ -104,24 +106,22 @@ int libertas_send_deauth(wlan_private * priv)
|
|||||||
*
|
*
|
||||||
* @return 0-success, otherwise fail
|
* @return 0-success, otherwise fail
|
||||||
*/
|
*/
|
||||||
int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
|
int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
|
||||||
0, cmd_option_waitforrsp,
|
0, cmd_option_waitforrsp,
|
||||||
0, pbssdesc->macaddress);
|
0, assoc_req->bss.bssid);
|
||||||
|
|
||||||
if (ret) {
|
if (ret)
|
||||||
LEAVE();
|
goto done;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set preamble to firmware */
|
/* set preamble to firmware */
|
||||||
if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble)
|
if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble)
|
||||||
adapter->preamble = cmd_type_short_preamble;
|
adapter->preamble = cmd_type_short_preamble;
|
||||||
else
|
else
|
||||||
adapter->preamble = cmd_type_long_preamble;
|
adapter->preamble = cmd_type_long_preamble;
|
||||||
@ -129,9 +129,10 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
|
|||||||
libertas_set_radio_control(priv);
|
libertas_set_radio_control(priv);
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
|
||||||
0, cmd_option_waitforrsp, 0, pbssdesc);
|
0, cmd_option_waitforrsp, 0, assoc_req);
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
|
|||||||
* @param adhocssid The ssid of the Adhoc Network
|
* @param adhocssid The ssid of the Adhoc Network
|
||||||
* @return 0--success, -1--fail
|
* @return 0--success, -1--fail
|
||||||
*/
|
*/
|
||||||
int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *adhocssid)
|
int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -150,22 +151,20 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
|
|||||||
adapter->adhoccreate = 1;
|
adapter->adhoccreate = 1;
|
||||||
|
|
||||||
if (!adapter->capinfo.shortpreamble) {
|
if (!adapter->capinfo.shortpreamble) {
|
||||||
lbs_pr_debug(1, "AdhocStart: Long preamble\n");
|
lbs_deb_join("AdhocStart: Long preamble\n");
|
||||||
adapter->preamble = cmd_type_long_preamble;
|
adapter->preamble = cmd_type_long_preamble;
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "AdhocStart: Short preamble\n");
|
lbs_deb_join("AdhocStart: Short preamble\n");
|
||||||
adapter->preamble = cmd_type_short_preamble;
|
adapter->preamble = cmd_type_short_preamble;
|
||||||
}
|
}
|
||||||
|
|
||||||
libertas_set_radio_control(priv);
|
libertas_set_radio_control(priv);
|
||||||
|
|
||||||
lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel);
|
lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel);
|
||||||
lbs_pr_debug(1, "curbssparams.channel = %d\n",
|
lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band);
|
||||||
adapter->curbssparams.channel);
|
|
||||||
lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band);
|
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
|
||||||
0, cmd_option_waitforrsp, 0, adhocssid);
|
0, cmd_option_waitforrsp, 0, assoc_req);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -179,52 +178,53 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
|
|||||||
*
|
*
|
||||||
* @return 0--success, -1--fail
|
* @return 0--success, -1--fail
|
||||||
*/
|
*/
|
||||||
int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbssdesc)
|
int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
struct bss_descriptor * bss = &assoc_req->bss;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n",
|
lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
|
||||||
adapter->curbssparams.ssid.ssid);
|
__func__,
|
||||||
lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
|
escape_essid(adapter->curbssparams.ssid,
|
||||||
adapter->curbssparams.ssid.ssidlength);
|
adapter->curbssparams.ssid_len),
|
||||||
lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid);
|
adapter->curbssparams.ssid_len);
|
||||||
lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n",
|
lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
|
||||||
pbssdesc->ssid.ssidlength);
|
__func__, escape_essid(bss->ssid, bss->ssid_len),
|
||||||
|
bss->ssid_len);
|
||||||
|
|
||||||
/* check if the requested SSID is already joined */
|
/* check if the requested SSID is already joined */
|
||||||
if (adapter->curbssparams.ssid.ssidlength
|
if (adapter->curbssparams.ssid_len
|
||||||
&& !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
|
&& !libertas_ssid_cmp(adapter->curbssparams.ssid,
|
||||||
|
adapter->curbssparams.ssid_len,
|
||||||
|
bss->ssid, bss->ssid_len)
|
||||||
&& (adapter->mode == IW_MODE_ADHOC)) {
|
&& (adapter->mode == IW_MODE_ADHOC)) {
|
||||||
|
lbs_deb_join(
|
||||||
lbs_pr_debug(1,
|
|
||||||
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
|
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
|
||||||
"not attempting to re-join");
|
"not attempting to re-join");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Use shortpreamble only when both creator and card supports
|
/*Use shortpreamble only when both creator and card supports
|
||||||
short preamble */
|
short preamble */
|
||||||
if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
|
if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
|
||||||
lbs_pr_debug(1, "AdhocJoin: Long preamble\n");
|
lbs_deb_join("AdhocJoin: Long preamble\n");
|
||||||
adapter->preamble = cmd_type_long_preamble;
|
adapter->preamble = cmd_type_long_preamble;
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "AdhocJoin: Short preamble\n");
|
lbs_deb_join("AdhocJoin: Short preamble\n");
|
||||||
adapter->preamble = cmd_type_short_preamble;
|
adapter->preamble = cmd_type_short_preamble;
|
||||||
}
|
}
|
||||||
|
|
||||||
libertas_set_radio_control(priv);
|
libertas_set_radio_control(priv);
|
||||||
|
|
||||||
lbs_pr_debug(1, "curbssparams.channel = %d\n",
|
lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel);
|
||||||
adapter->curbssparams.channel);
|
lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band);
|
||||||
lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band);
|
|
||||||
|
|
||||||
adapter->adhoccreate = 0;
|
adapter->adhoccreate = 0;
|
||||||
|
|
||||||
ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join,
|
ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join,
|
||||||
0, cmd_option_waitforrsp,
|
0, cmd_option_waitforrsp,
|
||||||
OID_802_11_SSID, pbssdesc);
|
OID_802_11_SSID, assoc_req);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -265,6 +265,8 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
u8 *bssid = pdata_buf;
|
u8 *bssid = pdata_buf;
|
||||||
|
|
||||||
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
cmd->command = cpu_to_le16(cmd_802_11_authenticate);
|
cmd->command = cpu_to_le16(cmd_802_11_authenticate);
|
||||||
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
|
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
|
||||||
+ S_DS_GEN);
|
+ S_DS_GEN);
|
||||||
@ -281,18 +283,19 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
|
|||||||
pauthenticate->authtype = 0x80;
|
pauthenticate->authtype = 0x80;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n",
|
lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
|
||||||
adapter->secinfo.auth_mode);
|
adapter->secinfo.auth_mode);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
|
memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
|
||||||
|
|
||||||
lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
|
lbs_deb_join("AUTH_CMD: BSSID is : " MAC_FMT " auth=0x%X\n",
|
||||||
bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
|
MAC_ARG(bssid), pauthenticate->authtype);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,22 +305,20 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
|
struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
|
cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
|
||||||
cmd->size =
|
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
|
|
||||||
S_DS_GEN);
|
S_DS_GEN);
|
||||||
|
|
||||||
/* set AP MAC address */
|
/* set AP MAC address */
|
||||||
memmove(dauth->macaddr, adapter->curbssparams.bssid,
|
memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
|
||||||
ETH_ALEN);
|
|
||||||
|
|
||||||
/* Reason code 3 = Station is leaving */
|
/* Reason code 3 = Station is leaving */
|
||||||
#define REASON_CODE_STA_LEAVING 3
|
#define REASON_CODE_STA_LEAVING 3
|
||||||
dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
|
dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_JOIN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,20 +328,20 @@ int libertas_cmd_80211_associate(wlan_private * priv,
|
|||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
|
struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct bss_descriptor *pbssdesc;
|
struct assoc_request * assoc_req = pdata_buf;
|
||||||
|
struct bss_descriptor * bss = &assoc_req->bss;
|
||||||
u8 *card_rates;
|
u8 *card_rates;
|
||||||
u8 *pos;
|
u8 *pos;
|
||||||
int card_rates_size;
|
int card_rates_size;
|
||||||
u16 tmpcap;
|
u16 tmpcap, tmplen;
|
||||||
struct mrvlietypes_ssidparamset *ssid;
|
struct mrvlietypes_ssidparamset *ssid;
|
||||||
struct mrvlietypes_phyparamset *phy;
|
struct mrvlietypes_phyparamset *phy;
|
||||||
struct mrvlietypes_ssparamset *ss;
|
struct mrvlietypes_ssparamset *ss;
|
||||||
struct mrvlietypes_ratesparamset *rates;
|
struct mrvlietypes_ratesparamset *rates;
|
||||||
struct mrvlietypes_rsnparamset *rsn;
|
struct mrvlietypes_rsnparamset *rsn;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
pbssdesc = pdata_buf;
|
|
||||||
pos = (u8 *) passo;
|
pos = (u8 *) passo;
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
@ -350,15 +351,11 @@ int libertas_cmd_80211_associate(wlan_private * priv,
|
|||||||
|
|
||||||
cmd->command = cpu_to_le16(cmd_802_11_associate);
|
cmd->command = cpu_to_le16(cmd_802_11_associate);
|
||||||
|
|
||||||
/* Save so we know which BSS Desc to use in the response handler */
|
memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr));
|
||||||
adapter->pattemptedbssdesc = pbssdesc;
|
|
||||||
|
|
||||||
memcpy(passo->peerstaaddr,
|
|
||||||
pbssdesc->macaddress, sizeof(passo->peerstaaddr));
|
|
||||||
pos += sizeof(passo->peerstaaddr);
|
pos += sizeof(passo->peerstaaddr);
|
||||||
|
|
||||||
/* set the listen interval */
|
/* set the listen interval */
|
||||||
passo->listeninterval = adapter->listeninterval;
|
passo->listeninterval = cpu_to_le16(adapter->listeninterval);
|
||||||
|
|
||||||
pos += sizeof(passo->capinfo);
|
pos += sizeof(passo->capinfo);
|
||||||
pos += sizeof(passo->listeninterval);
|
pos += sizeof(passo->listeninterval);
|
||||||
@ -367,30 +364,30 @@ int libertas_cmd_80211_associate(wlan_private * priv,
|
|||||||
|
|
||||||
ssid = (struct mrvlietypes_ssidparamset *) pos;
|
ssid = (struct mrvlietypes_ssidparamset *) pos;
|
||||||
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
|
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
|
||||||
ssid->header.len = pbssdesc->ssid.ssidlength;
|
tmplen = bss->ssid_len;
|
||||||
memcpy(ssid->ssid, pbssdesc->ssid.ssid, ssid->header.len);
|
ssid->header.len = cpu_to_le16(tmplen);
|
||||||
pos += sizeof(ssid->header) + ssid->header.len;
|
memcpy(ssid->ssid, bss->ssid, tmplen);
|
||||||
ssid->header.len = cpu_to_le16(ssid->header.len);
|
pos += sizeof(ssid->header) + tmplen;
|
||||||
|
|
||||||
phy = (struct mrvlietypes_phyparamset *) pos;
|
phy = (struct mrvlietypes_phyparamset *) pos;
|
||||||
phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
|
phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
|
||||||
phy->header.len = sizeof(phy->fh_ds.dsparamset);
|
tmplen = sizeof(phy->fh_ds.dsparamset);
|
||||||
|
phy->header.len = cpu_to_le16(tmplen);
|
||||||
memcpy(&phy->fh_ds.dsparamset,
|
memcpy(&phy->fh_ds.dsparamset,
|
||||||
&pbssdesc->phyparamset.dsparamset.currentchan,
|
&bss->phyparamset.dsparamset.currentchan,
|
||||||
sizeof(phy->fh_ds.dsparamset));
|
tmplen);
|
||||||
pos += sizeof(phy->header) + phy->header.len;
|
pos += sizeof(phy->header) + tmplen;
|
||||||
phy->header.len = cpu_to_le16(phy->header.len);
|
|
||||||
|
|
||||||
ss = (struct mrvlietypes_ssparamset *) pos;
|
ss = (struct mrvlietypes_ssparamset *) pos;
|
||||||
ss->header.type = cpu_to_le16(TLV_TYPE_CF);
|
ss->header.type = cpu_to_le16(TLV_TYPE_CF);
|
||||||
ss->header.len = sizeof(ss->cf_ibss.cfparamset);
|
tmplen = sizeof(ss->cf_ibss.cfparamset);
|
||||||
pos += sizeof(ss->header) + ss->header.len;
|
ss->header.len = cpu_to_le16(tmplen);
|
||||||
ss->header.len = cpu_to_le16(ss->header.len);
|
pos += sizeof(ss->header) + tmplen;
|
||||||
|
|
||||||
rates = (struct mrvlietypes_ratesparamset *) pos;
|
rates = (struct mrvlietypes_ratesparamset *) pos;
|
||||||
rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
|
rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
|
||||||
|
|
||||||
memcpy(&rates->rates, &pbssdesc->libertas_supported_rates, WLAN_SUPPORTED_RATES);
|
memcpy(&rates->rates, &bss->libertas_supported_rates, WLAN_SUPPORTED_RATES);
|
||||||
|
|
||||||
card_rates = libertas_supported_rates;
|
card_rates = libertas_supported_rates;
|
||||||
card_rates_size = sizeof(libertas_supported_rates);
|
card_rates_size = sizeof(libertas_supported_rates);
|
||||||
@ -401,41 +398,42 @@ int libertas_cmd_80211_associate(wlan_private * priv,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
|
tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
|
||||||
adapter->curbssparams.numofrates = rates->header.len;
|
adapter->curbssparams.numofrates = tmplen;
|
||||||
|
|
||||||
pos += sizeof(rates->header) + rates->header.len;
|
pos += sizeof(rates->header) + tmplen;
|
||||||
rates->header.len = cpu_to_le16(rates->header.len);
|
rates->header.len = cpu_to_le16(tmplen);
|
||||||
|
|
||||||
if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) {
|
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
|
||||||
rsn = (struct mrvlietypes_rsnparamset *) pos;
|
rsn = (struct mrvlietypes_rsnparamset *) pos;
|
||||||
rsn->header.type = (u16) adapter->wpa_ie[0]; /* WPA_IE or WPA2_IE */
|
/* WPA_IE or WPA2_IE */
|
||||||
rsn->header.type = cpu_to_le16(rsn->header.type);
|
rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
|
||||||
rsn->header.len = (u16) adapter->wpa_ie[1];
|
tmplen = (u16) assoc_req->wpa_ie[1];
|
||||||
memcpy(rsn->rsnie, &adapter->wpa_ie[2], rsn->header.len);
|
rsn->header.len = cpu_to_le16(tmplen);
|
||||||
|
memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen);
|
||||||
lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
|
lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
|
||||||
sizeof(rsn->header) + rsn->header.len);
|
sizeof(rsn->header) + tmplen);
|
||||||
pos += sizeof(rsn->header) + rsn->header.len;
|
pos += sizeof(rsn->header) + tmplen;
|
||||||
rsn->header.len = cpu_to_le16(rsn->header.len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update curbssparams */
|
/* update curbssparams */
|
||||||
adapter->curbssparams.channel =
|
adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
|
||||||
(pbssdesc->phyparamset.dsparamset.currentchan);
|
|
||||||
|
|
||||||
/* Copy the infra. association rates into Current BSS state structure */
|
/* Copy the infra. association rates into Current BSS state structure */
|
||||||
memcpy(&adapter->curbssparams.datarates, &rates->rates,
|
memcpy(&adapter->curbssparams.datarates, &rates->rates,
|
||||||
min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len));
|
min_t(size_t, sizeof(adapter->curbssparams.datarates),
|
||||||
|
cpu_to_le16(rates->header.len)));
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
|
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
|
||||||
|
cpu_to_le16(rates->header.len));
|
||||||
|
|
||||||
/* set IBSS field */
|
/* set IBSS field */
|
||||||
if (pbssdesc->mode == IW_MODE_INFRA) {
|
if (bss->mode == IW_MODE_INFRA) {
|
||||||
#define CAPINFO_ESS_MODE 1
|
#define CAPINFO_ESS_MODE 1
|
||||||
passo->capinfo.ess = CAPINFO_ESS_MODE;
|
passo->capinfo.ess = CAPINFO_ESS_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libertas_parse_dnld_countryinfo_11d(priv)) {
|
if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -443,31 +441,28 @@ int libertas_cmd_80211_associate(wlan_private * priv,
|
|||||||
cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
|
cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
|
||||||
|
|
||||||
/* set the capability info at last */
|
/* set the capability info at last */
|
||||||
memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo));
|
memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo));
|
||||||
tmpcap &= CAPINFO_MASK;
|
tmpcap &= CAPINFO_MASK;
|
||||||
lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
|
lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
|
||||||
tmpcap, CAPINFO_MASK);
|
tmpcap, CAPINFO_MASK);
|
||||||
tmpcap = cpu_to_le16(tmpcap);
|
|
||||||
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
|
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
||||||
struct cmd_ds_command *cmd, void *pssid)
|
struct cmd_ds_command *cmd, void *pdata_buf)
|
||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
|
struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int cmdappendsize = 0;
|
int cmdappendsize = 0;
|
||||||
int i;
|
int i;
|
||||||
u16 tmpcap;
|
struct assoc_request * assoc_req = pdata_buf;
|
||||||
struct bss_descriptor *pbssdesc;
|
|
||||||
struct WLAN_802_11_SSID *ssid = pssid;
|
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -476,9 +471,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
|
|
||||||
cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start);
|
cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start);
|
||||||
|
|
||||||
pbssdesc = &adapter->curbssparams.bssdescriptor;
|
|
||||||
adapter->pattemptedbssdesc = pbssdesc;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the parameters for 2 data structures:
|
* Fill in the parameters for 2 data structures:
|
||||||
* 1. cmd_ds_802_11_ad_hoc_start command
|
* 1. cmd_ds_802_11_ad_hoc_start command
|
||||||
@ -492,20 +484,16 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
|
memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
|
||||||
|
memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len);
|
||||||
|
|
||||||
memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength);
|
lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
|
||||||
|
escape_essid(assoc_req->ssid, assoc_req->ssid_len),
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
|
assoc_req->ssid_len);
|
||||||
|
|
||||||
memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE);
|
|
||||||
memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength);
|
|
||||||
|
|
||||||
pbssdesc->ssid.ssidlength = ssid->ssidlength;
|
|
||||||
|
|
||||||
/* set the BSS type */
|
/* set the BSS type */
|
||||||
adhs->bsstype = cmd_bss_type_ibss;
|
adhs->bsstype = cmd_bss_type_ibss;
|
||||||
pbssdesc->mode = IW_MODE_ADHOC;
|
adapter->mode = IW_MODE_ADHOC;
|
||||||
adhs->beaconperiod = adapter->beaconperiod;
|
adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod);
|
||||||
|
|
||||||
/* set Physical param set */
|
/* set Physical param set */
|
||||||
#define DS_PARA_IE_ID 3
|
#define DS_PARA_IE_ID 3
|
||||||
@ -514,18 +502,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
|
adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
|
||||||
adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
|
adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
|
||||||
|
|
||||||
WARN_ON(!adapter->adhocchannel);
|
WARN_ON(!assoc_req->channel);
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n",
|
lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
|
||||||
adapter->adhocchannel);
|
assoc_req->channel);
|
||||||
|
|
||||||
adapter->curbssparams.channel = adapter->adhocchannel;
|
adhs->phyparamset.dsparamset.currentchan = assoc_req->channel;
|
||||||
|
|
||||||
pbssdesc->channel = adapter->adhocchannel;
|
|
||||||
adhs->phyparamset.dsparamset.currentchan = adapter->adhocchannel;
|
|
||||||
|
|
||||||
memcpy(&pbssdesc->phyparamset,
|
|
||||||
&adhs->phyparamset, sizeof(union ieeetypes_phyparamset));
|
|
||||||
|
|
||||||
/* set IBSS param set */
|
/* set IBSS param set */
|
||||||
#define IBSS_PARA_IE_ID 6
|
#define IBSS_PARA_IE_ID 6
|
||||||
@ -533,26 +515,21 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
|
|
||||||
adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
|
adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
|
||||||
adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
|
adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
|
||||||
adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow;
|
adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
|
||||||
memcpy(&pbssdesc->ssparamset,
|
|
||||||
&adhs->ssparamset, sizeof(union IEEEtypes_ssparamset));
|
|
||||||
|
|
||||||
/* set capability info */
|
/* set capability info */
|
||||||
adhs->cap.ess = 0;
|
adhs->cap.ess = 0;
|
||||||
adhs->cap.ibss = 1;
|
adhs->cap.ibss = 1;
|
||||||
pbssdesc->cap.ibss = 1;
|
|
||||||
|
|
||||||
/* probedelay */
|
/* probedelay */
|
||||||
adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
|
adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
|
||||||
|
|
||||||
/* set up privacy in adapter->scantable[i] */
|
/* set up privacy in adapter->scantable[i] */
|
||||||
if (adapter->secinfo.wep_enabled) {
|
if (assoc_req->secinfo.wep_enabled) {
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n");
|
lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
|
||||||
pbssdesc->privacy = wlan802_11privfilter8021xWEP;
|
|
||||||
adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
|
adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
|
||||||
} else {
|
} else {
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n");
|
lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
|
||||||
pbssdesc->privacy = wlan802_11privfilteracceptall;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(adhs->datarate, 0, sizeof(adhs->datarate));
|
memset(adhs->datarate, 0, sizeof(adhs->datarate));
|
||||||
@ -574,29 +551,24 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
memcpy(&adapter->curbssparams.datarates,
|
memcpy(&adapter->curbssparams.datarates,
|
||||||
&adhs->datarate, adapter->curbssparams.numofrates);
|
&adhs->datarate, adapter->curbssparams.numofrates);
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
|
lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
|
||||||
adhs->datarate[0], adhs->datarate[1],
|
adhs->datarate[0], adhs->datarate[1],
|
||||||
adhs->datarate[2], adhs->datarate[3]);
|
adhs->datarate[2], adhs->datarate[3]);
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n");
|
lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
|
||||||
|
|
||||||
if (libertas_create_dnld_countryinfo_11d(priv)) {
|
if (libertas_create_dnld_countryinfo_11d(priv)) {
|
||||||
lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
|
lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->size =
|
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start)
|
S_DS_GEN + cmdappendsize);
|
||||||
+ S_DS_GEN + cmdappendsize);
|
|
||||||
|
|
||||||
memcpy(&tmpcap, &adhs->cap, sizeof(u16));
|
|
||||||
tmpcap = cpu_to_le16(tmpcap);
|
|
||||||
memcpy(&adhs->cap, &tmpcap, sizeof(u16));
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +586,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
|
|||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj;
|
struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj;
|
||||||
struct bss_descriptor *pbssdesc = pdata_buf;
|
struct assoc_request * assoc_req = pdata_buf;
|
||||||
|
struct bss_descriptor *bss = &assoc_req->bss;
|
||||||
int cmdappendsize = 0;
|
int cmdappendsize = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u8 *card_rates;
|
u8 *card_rates;
|
||||||
@ -622,70 +595,59 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
|
|||||||
u16 tmpcap;
|
u16 tmpcap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
adapter->pattemptedbssdesc = pbssdesc;
|
|
||||||
|
|
||||||
cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
|
cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
|
||||||
|
|
||||||
padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
|
padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
|
||||||
|
|
||||||
padhocjoin->bssdescriptor.beaconperiod = pbssdesc->beaconperiod;
|
padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
|
||||||
|
|
||||||
memcpy(&padhocjoin->bssdescriptor.BSSID,
|
memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
|
||||||
&pbssdesc->macaddress, ETH_ALEN);
|
memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
|
||||||
|
|
||||||
memcpy(&padhocjoin->bssdescriptor.SSID,
|
|
||||||
&pbssdesc->ssid.ssid, pbssdesc->ssid.ssidlength);
|
|
||||||
|
|
||||||
memcpy(&padhocjoin->bssdescriptor.phyparamset,
|
memcpy(&padhocjoin->bssdescriptor.phyparamset,
|
||||||
&pbssdesc->phyparamset, sizeof(union ieeetypes_phyparamset));
|
&bss->phyparamset, sizeof(union ieeetypes_phyparamset));
|
||||||
|
|
||||||
memcpy(&padhocjoin->bssdescriptor.ssparamset,
|
memcpy(&padhocjoin->bssdescriptor.ssparamset,
|
||||||
&pbssdesc->ssparamset, sizeof(union IEEEtypes_ssparamset));
|
&bss->ssparamset, sizeof(union IEEEtypes_ssparamset));
|
||||||
|
|
||||||
memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo));
|
memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo));
|
||||||
tmpcap &= CAPINFO_MASK;
|
tmpcap &= CAPINFO_MASK;
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
|
lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
|
||||||
tmpcap, CAPINFO_MASK);
|
tmpcap, CAPINFO_MASK);
|
||||||
memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
|
memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
|
||||||
sizeof(struct ieeetypes_capinfo));
|
sizeof(struct ieeetypes_capinfo));
|
||||||
|
|
||||||
/* information on BSSID descriptor passed to FW */
|
/* information on BSSID descriptor passed to FW */
|
||||||
lbs_pr_debug(1,
|
lbs_deb_join(
|
||||||
"ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n",
|
"ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n",
|
||||||
padhocjoin->bssdescriptor.BSSID[0],
|
MAC_ARG(padhocjoin->bssdescriptor.BSSID),
|
||||||
padhocjoin->bssdescriptor.BSSID[1],
|
|
||||||
padhocjoin->bssdescriptor.BSSID[2],
|
|
||||||
padhocjoin->bssdescriptor.BSSID[3],
|
|
||||||
padhocjoin->bssdescriptor.BSSID[4],
|
|
||||||
padhocjoin->bssdescriptor.BSSID[5],
|
|
||||||
padhocjoin->bssdescriptor.SSID);
|
padhocjoin->bssdescriptor.SSID);
|
||||||
|
|
||||||
/* failtimeout */
|
/* failtimeout */
|
||||||
padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
|
padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
|
||||||
|
|
||||||
/* probedelay */
|
/* probedelay */
|
||||||
padhocjoin->probedelay =
|
padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
|
||||||
cpu_to_le16(cmd_scan_probe_delay_time);
|
|
||||||
|
|
||||||
/* Copy Data rates from the rates recorded in scan response */
|
/* Copy Data rates from the rates recorded in scan response */
|
||||||
memset(padhocjoin->bssdescriptor.datarates, 0,
|
memset(padhocjoin->bssdescriptor.datarates, 0,
|
||||||
sizeof(padhocjoin->bssdescriptor.datarates));
|
sizeof(padhocjoin->bssdescriptor.datarates));
|
||||||
memcpy(padhocjoin->bssdescriptor.datarates, pbssdesc->datarates,
|
memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates,
|
||||||
min(sizeof(padhocjoin->bssdescriptor.datarates),
|
min(sizeof(padhocjoin->bssdescriptor.datarates),
|
||||||
sizeof(pbssdesc->datarates)));
|
sizeof(bss->datarates)));
|
||||||
|
|
||||||
card_rates = libertas_supported_rates;
|
card_rates = libertas_supported_rates;
|
||||||
card_rates_size = sizeof(libertas_supported_rates);
|
card_rates_size = sizeof(libertas_supported_rates);
|
||||||
|
|
||||||
adapter->curbssparams.channel = pbssdesc->channel;
|
adapter->curbssparams.channel = bss->channel;
|
||||||
|
|
||||||
if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
|
if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
|
||||||
sizeof(padhocjoin->bssdescriptor.datarates),
|
sizeof(padhocjoin->bssdescriptor.datarates),
|
||||||
card_rates, card_rates_size)) {
|
card_rates, card_rates_size)) {
|
||||||
lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n");
|
lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -704,17 +666,17 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
|
|||||||
adapter->curbssparams.numofrates);
|
adapter->curbssparams.numofrates);
|
||||||
|
|
||||||
padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
|
padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
|
||||||
cpu_to_le16(pbssdesc->atimwindow);
|
cpu_to_le16(bss->atimwindow);
|
||||||
|
|
||||||
if (adapter->secinfo.wep_enabled) {
|
if (assoc_req->secinfo.wep_enabled) {
|
||||||
padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
|
padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter->psmode == wlan802_11powermodemax_psp) {
|
if (adapter->psmode == wlan802_11powermodemax_psp) {
|
||||||
/* wake up first */
|
/* wake up first */
|
||||||
enum WLAN_802_11_POWER_MODE Localpsmode;
|
__le32 Localpsmode;
|
||||||
|
|
||||||
Localpsmode = wlan802_11powermodecam;
|
Localpsmode = cpu_to_le32(wlan802_11powermodecam);
|
||||||
ret = libertas_prepare_and_send_command(priv,
|
ret = libertas_prepare_and_send_command(priv,
|
||||||
cmd_802_11_ps_mode,
|
cmd_802_11_ps_mode,
|
||||||
cmd_act_set,
|
cmd_act_set,
|
||||||
@ -726,24 +688,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libertas_parse_dnld_countryinfo_11d(priv)) {
|
if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->size =
|
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
|
||||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join)
|
S_DS_GEN + cmdappendsize);
|
||||||
+ S_DS_GEN + cmdappendsize);
|
|
||||||
|
|
||||||
memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap,
|
done:
|
||||||
sizeof(struct ieeetypes_capinfo));
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
tmpcap = cpu_to_le16(tmpcap);
|
|
||||||
|
|
||||||
memcpy(&padhocjoin->bssdescriptor.cap,
|
|
||||||
&tmpcap, sizeof(struct ieeetypes_capinfo));
|
|
||||||
|
|
||||||
done:
|
|
||||||
LEAVE();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,19 +708,24 @@ int libertas_ret_80211_associate(wlan_private * priv,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
union iwreq_data wrqu;
|
union iwreq_data wrqu;
|
||||||
struct ieeetypes_assocrsp *passocrsp;
|
struct ieeetypes_assocrsp *passocrsp;
|
||||||
struct bss_descriptor *pbssdesc;
|
struct bss_descriptor * bss;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
|
if (!adapter->in_progress_assoc_req) {
|
||||||
|
lbs_deb_join("ASSOC_RESP: no in-progress association request\n");
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
bss = &adapter->in_progress_assoc_req->bss;
|
||||||
|
|
||||||
passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
|
passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
|
||||||
|
|
||||||
if (passocrsp->statuscode) {
|
if (le16_to_cpu(passocrsp->statuscode)) {
|
||||||
|
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
|
|
||||||
lbs_pr_debug(1,
|
lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
|
||||||
"ASSOC_RESP: Association failed, status code = %d\n",
|
le16_to_cpu(passocrsp->statuscode));
|
||||||
passocrsp->statuscode);
|
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
@ -778,24 +737,15 @@ int libertas_ret_80211_associate(wlan_private * priv,
|
|||||||
/* Send a Media Connected event, according to the Spec */
|
/* Send a Media Connected event, according to the Spec */
|
||||||
adapter->connect_status = libertas_connected;
|
adapter->connect_status = libertas_connected;
|
||||||
|
|
||||||
/* Set the attempted BSSID Index to current */
|
lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
|
||||||
pbssdesc = adapter->pattemptedbssdesc;
|
escape_essid(bss->ssid, bss->ssid_len));
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
|
/* Update current SSID and BSSID */
|
||||||
|
memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
|
||||||
|
adapter->curbssparams.ssid_len = bss->ssid_len;
|
||||||
|
memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
|
||||||
|
|
||||||
/* Set the new SSID to current SSID */
|
lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
|
||||||
memcpy(&adapter->curbssparams.ssid,
|
|
||||||
&pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID));
|
|
||||||
|
|
||||||
/* Set the new BSSID (AP's MAC address) to current BSSID */
|
|
||||||
memcpy(adapter->curbssparams.bssid,
|
|
||||||
pbssdesc->macaddress, ETH_ALEN);
|
|
||||||
|
|
||||||
/* Make a copy of current BSSID descriptor */
|
|
||||||
memcpy(&adapter->curbssparams.bssdescriptor,
|
|
||||||
pbssdesc, sizeof(struct bss_descriptor));
|
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n",
|
|
||||||
adapter->currentpacketfilter);
|
adapter->currentpacketfilter);
|
||||||
|
|
||||||
adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
|
adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
|
||||||
@ -806,28 +756,31 @@ int libertas_ret_80211_associate(wlan_private * priv,
|
|||||||
adapter->nextSNRNF = 0;
|
adapter->nextSNRNF = 0;
|
||||||
adapter->numSNRNF = 0;
|
adapter->numSNRNF = 0;
|
||||||
|
|
||||||
netif_carrier_on(priv->wlan_dev.netdev);
|
netif_carrier_on(priv->dev);
|
||||||
netif_wake_queue(priv->wlan_dev.netdev);
|
netif_wake_queue(priv->dev);
|
||||||
|
|
||||||
lbs_pr_debug(1, "ASSOC_RESP: Associated \n");
|
netif_carrier_on(priv->mesh_dev);
|
||||||
|
netif_wake_queue(priv->mesh_dev);
|
||||||
|
|
||||||
|
lbs_deb_join("ASSOC_RESP: Associated \n");
|
||||||
|
|
||||||
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
|
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
|
||||||
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
||||||
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
|
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int libertas_ret_80211_disassociate(wlan_private * priv,
|
int libertas_ret_80211_disassociate(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_JOIN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,90 +793,85 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
|
|||||||
u16 result = le16_to_cpu(resp->result);
|
u16 result = le16_to_cpu(resp->result);
|
||||||
struct cmd_ds_802_11_ad_hoc_result *padhocresult;
|
struct cmd_ds_802_11_ad_hoc_result *padhocresult;
|
||||||
union iwreq_data wrqu;
|
union iwreq_data wrqu;
|
||||||
struct bss_descriptor *pbssdesc;
|
struct bss_descriptor *bss;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
padhocresult = &resp->params.result;
|
padhocresult = &resp->params.result;
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size));
|
lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size));
|
||||||
lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command);
|
lbs_deb_join("ADHOC_RESP: command = %x\n", command);
|
||||||
lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result);
|
lbs_deb_join("ADHOC_RESP: result = %x\n", result);
|
||||||
|
|
||||||
pbssdesc = adapter->pattemptedbssdesc;
|
if (!adapter->in_progress_assoc_req) {
|
||||||
|
lbs_deb_join("ADHOC_RESP: no in-progress association request\n");
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
bss = &adapter->in_progress_assoc_req->bss;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Join result code 0 --> SUCCESS
|
* Join result code 0 --> SUCCESS
|
||||||
*/
|
*/
|
||||||
if (result) {
|
if (result) {
|
||||||
lbs_pr_debug(1, "ADHOC_RESP failed\n");
|
lbs_deb_join("ADHOC_RESP: failed\n");
|
||||||
if (adapter->connect_status == libertas_connected) {
|
if (adapter->connect_status == libertas_connected) {
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
}
|
}
|
||||||
|
ret = -1;
|
||||||
memset(&adapter->curbssparams.bssdescriptor,
|
goto done;
|
||||||
0x00, sizeof(adapter->curbssparams.bssdescriptor));
|
|
||||||
|
|
||||||
LEAVE();
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now the join cmd should be successful
|
* Now the join cmd should be successful
|
||||||
* If BSSID has changed use SSID to compare instead of BSSID
|
* If BSSID has changed use SSID to compare instead of BSSID
|
||||||
*/
|
*/
|
||||||
lbs_pr_debug(1, "ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid);
|
lbs_deb_join("ADHOC_RESP: associated to '%s'\n",
|
||||||
|
escape_essid(bss->ssid, bss->ssid_len));
|
||||||
|
|
||||||
/* Send a Media Connected event, according to the Spec */
|
/* Send a Media Connected event, according to the Spec */
|
||||||
adapter->connect_status = libertas_connected;
|
adapter->connect_status = libertas_connected;
|
||||||
|
|
||||||
if (command == cmd_ret_802_11_ad_hoc_start) {
|
if (command == cmd_ret_802_11_ad_hoc_start) {
|
||||||
/* Update the created network descriptor with the new BSSID */
|
/* Update the created network descriptor with the new BSSID */
|
||||||
memcpy(pbssdesc->macaddress,
|
memcpy(bss->bssid, padhocresult->BSSID, ETH_ALEN);
|
||||||
padhocresult->BSSID, ETH_ALEN);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Make a copy of current BSSID descriptor, only needed for join since
|
|
||||||
* the current descriptor is already being used for adhoc start
|
|
||||||
*/
|
|
||||||
memmove(&adapter->curbssparams.bssdescriptor,
|
|
||||||
pbssdesc, sizeof(struct bss_descriptor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the BSSID from the joined/started descriptor */
|
/* Set the BSSID from the joined/started descriptor */
|
||||||
memcpy(&adapter->curbssparams.bssid,
|
memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
|
||||||
pbssdesc->macaddress, ETH_ALEN);
|
|
||||||
|
|
||||||
/* Set the new SSID to current SSID */
|
/* Set the new SSID to current SSID */
|
||||||
memcpy(&adapter->curbssparams.ssid,
|
memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
|
||||||
&pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID));
|
adapter->curbssparams.ssid_len = bss->ssid_len;
|
||||||
|
|
||||||
netif_carrier_on(priv->wlan_dev.netdev);
|
netif_carrier_on(priv->dev);
|
||||||
netif_wake_queue(priv->wlan_dev.netdev);
|
netif_wake_queue(priv->dev);
|
||||||
|
|
||||||
|
netif_carrier_on(priv->mesh_dev);
|
||||||
|
netif_wake_queue(priv->mesh_dev);
|
||||||
|
|
||||||
memset(&wrqu, 0, sizeof(wrqu));
|
memset(&wrqu, 0, sizeof(wrqu));
|
||||||
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
|
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
|
||||||
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
||||||
wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
|
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
|
||||||
|
|
||||||
lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n");
|
lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
|
||||||
lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel);
|
lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel);
|
||||||
lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
lbs_deb_join("ADHOC_RESP: BSSID = " MAC_FMT "\n",
|
||||||
padhocresult->BSSID[0], padhocresult->BSSID[1],
|
MAC_ARG(padhocresult->BSSID));
|
||||||
padhocresult->BSSID[2], padhocresult->BSSID[3],
|
|
||||||
padhocresult->BSSID[4], padhocresult->BSSID[5]);
|
|
||||||
|
|
||||||
LEAVE();
|
done:
|
||||||
|
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
|
int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
|
||||||
struct cmd_ds_command *resp)
|
struct cmd_ds_command *resp)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_JOIN);
|
||||||
|
|
||||||
libertas_mac_event_disconnected(priv);
|
libertas_mac_event_disconnected(priv);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_JOIN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#define _WLAN_JOIN_H
|
#define _WLAN_JOIN_H
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "dev.h"
|
||||||
|
|
||||||
struct cmd_ds_command;
|
struct cmd_ds_command;
|
||||||
extern int libertas_cmd_80211_authenticate(wlan_private * priv,
|
extern int libertas_cmd_80211_authenticate(wlan_private * priv,
|
||||||
@ -21,7 +22,7 @@ extern int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv,
|
|||||||
struct cmd_ds_command *cmd);
|
struct cmd_ds_command *cmd);
|
||||||
extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
|
||||||
struct cmd_ds_command *cmd,
|
struct cmd_ds_command *cmd,
|
||||||
void *pssid);
|
void *pdata_buf);
|
||||||
extern int libertas_cmd_80211_deauthenticate(wlan_private * priv,
|
extern int libertas_cmd_80211_deauthenticate(wlan_private * priv,
|
||||||
struct cmd_ds_command *cmd);
|
struct cmd_ds_command *cmd);
|
||||||
extern int libertas_cmd_80211_associate(wlan_private * priv,
|
extern int libertas_cmd_80211_associate(wlan_private * priv,
|
||||||
@ -39,12 +40,10 @@ extern int libertas_ret_80211_associate(wlan_private * priv,
|
|||||||
|
|
||||||
extern int libertas_reassociation_thread(void *data);
|
extern int libertas_reassociation_thread(void *data);
|
||||||
|
|
||||||
struct WLAN_802_11_SSID;
|
|
||||||
struct bss_descriptor;
|
|
||||||
|
|
||||||
extern int libertas_start_adhoc_network(wlan_private * priv,
|
extern int libertas_start_adhoc_network(wlan_private * priv,
|
||||||
struct WLAN_802_11_SSID *adhocssid);
|
struct assoc_request * assoc_req);
|
||||||
extern int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor *pbssdesc);
|
extern int libertas_join_adhoc_network(wlan_private * priv,
|
||||||
|
struct assoc_request * assoc_req);
|
||||||
extern int libertas_stop_adhoc_network(wlan_private * priv);
|
extern int libertas_stop_adhoc_network(wlan_private * priv);
|
||||||
|
|
||||||
extern int libertas_send_deauthentication(wlan_private * priv);
|
extern int libertas_send_deauthentication(wlan_private * priv);
|
||||||
@ -52,6 +51,6 @@ extern int libertas_send_deauth(wlan_private * priv);
|
|||||||
|
|
||||||
extern int libertas_do_adhocstop_ioctl(wlan_private * priv);
|
extern int libertas_do_adhocstop_ioctl(wlan_private * priv);
|
||||||
|
|
||||||
int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc);
|
int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
|
|||||||
{
|
{
|
||||||
wlan_adapter *adapter = priv->adapter;
|
wlan_adapter *adapter = priv->adapter;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_RX);
|
||||||
|
|
||||||
lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf);
|
lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
|
||||||
lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n",
|
lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
|
||||||
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||||
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
|
|||||||
|
|
||||||
adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
|
adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
|
||||||
adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
|
adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
|
||||||
lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n",
|
lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
|
||||||
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||||
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||||
|
|
||||||
@ -133,18 +133,17 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
|
|||||||
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||||
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_RX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
|
void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
lbs_pr_debug(1, "skb->data=%p\n", skb->data);
|
lbs_deb_rx("skb->data %p\n", skb->data);
|
||||||
|
|
||||||
if(IS_MESH_FRAME(skb))
|
if (priv->mesh_dev && IS_MESH_FRAME(skb))
|
||||||
skb->dev = priv->mesh_dev;
|
skb->protocol = eth_type_trans(skb, priv->mesh_dev);
|
||||||
else
|
else
|
||||||
skb->dev = priv->wlan_dev.netdev;
|
skb->protocol = eth_type_trans(skb, priv->dev);
|
||||||
skb->protocol = eth_type_trans(skb, priv->wlan_dev.netdev);
|
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
|
|
||||||
netif_rx(skb);
|
netif_rx(skb);
|
||||||
@ -171,7 +170,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
|
const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_RX);
|
||||||
|
|
||||||
if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
|
if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
|
||||||
lbs_dbg_hex("RX packet: ", skb->data,
|
lbs_dbg_hex("RX packet: ", skb->data,
|
||||||
@ -191,7 +190,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
min_t(unsigned int, skb->len, 100));
|
min_t(unsigned int, skb->len, 100));
|
||||||
|
|
||||||
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
|
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
|
||||||
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
|
lbs_deb_rx("rx err: frame received with bad length\n");
|
||||||
priv->stats.rx_length_errors++;
|
priv->stats.rx_length_errors++;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
@ -200,15 +199,15 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
/*
|
/*
|
||||||
* Check rxpd status and update 802.3 stat,
|
* Check rxpd status and update 802.3 stat,
|
||||||
*/
|
*/
|
||||||
if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
|
if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
|
||||||
lbs_pr_debug(1, "RX error: frame received with bad status\n");
|
lbs_deb_rx("rx err: frame received with bad status\n");
|
||||||
lbs_pr_alert("rxpd Not OK\n");
|
lbs_pr_alert("rxpd not ok\n");
|
||||||
priv->stats.rx_errors++;
|
priv->stats.rx_errors++;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
|
lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
|
||||||
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
|
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
|
||||||
|
|
||||||
lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
|
lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
|
||||||
@ -266,7 +265,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
wlan_compute_rssi(priv, p_rx_pd);
|
wlan_compute_rssi(priv, p_rx_pd);
|
||||||
|
|
||||||
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
|
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
|
||||||
priv->stats.rx_bytes += skb->len;
|
priv->stats.rx_bytes += skb->len;
|
||||||
priv->stats.rx_packets++;
|
priv->stats.rx_packets++;
|
||||||
|
|
||||||
@ -274,10 +273,10 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(libertas_process_rxed_packet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function converts Tx/Rx rates from the Marvell WLAN format
|
* @brief This function converts Tx/Rx rates from the Marvell WLAN format
|
||||||
@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
|
|||||||
case 11: /* 54 Mbps */
|
case 11: /* 54 Mbps */
|
||||||
return 108;
|
return 108;
|
||||||
}
|
}
|
||||||
lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate);
|
lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
struct rx_radiotap_hdr radiotap_hdr;
|
struct rx_radiotap_hdr radiotap_hdr;
|
||||||
struct rx_radiotap_hdr *pradiotap_hdr;
|
struct rx_radiotap_hdr *pradiotap_hdr;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_RX);
|
||||||
|
|
||||||
p_rx_pkt = (struct rx80211packethdr *) skb->data;
|
p_rx_pkt = (struct rx80211packethdr *) skb->data;
|
||||||
prxpd = &p_rx_pkt->rx_pd;
|
prxpd = &p_rx_pkt->rx_pd;
|
||||||
@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
// lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
|
// lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
|
||||||
|
|
||||||
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
|
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
|
||||||
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
|
lbs_deb_rx("rx err: frame received wit bad length\n");
|
||||||
priv->stats.rx_length_errors++;
|
priv->stats.rx_length_errors++;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
@ -353,12 +352,12 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
/*
|
/*
|
||||||
* Check rxpd status and update 802.3 stat,
|
* Check rxpd status and update 802.3 stat,
|
||||||
*/
|
*/
|
||||||
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
|
if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
|
||||||
//lbs_pr_debug(1, "RX error: frame received with bad status\n");
|
//lbs_deb_rx("rx err: frame received with bad status\n");
|
||||||
priv->stats.rx_errors++;
|
priv->stats.rx_errors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
|
lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
|
||||||
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
|
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
|
||||||
|
|
||||||
/* create the exported radio header */
|
/* create the exported radio header */
|
||||||
@ -386,7 +385,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
/* XXX must check no carryout */
|
/* XXX must check no carryout */
|
||||||
radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
|
radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
|
||||||
radiotap_hdr.rx_flags = 0;
|
radiotap_hdr.rx_flags = 0;
|
||||||
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK))
|
if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
|
||||||
radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
|
radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
|
||||||
//memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
|
//memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
|
||||||
|
|
||||||
@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
|
if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
|
||||||
pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
|
pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
|
||||||
GFP_ATOMIC)) {
|
GFP_ATOMIC)) {
|
||||||
lbs_pr_alert( "%s: couldn't pskb_expand_head\n",
|
lbs_pr_alert("%s: couldn't pskb_expand_head\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* unknown header */
|
/* unknown header */
|
||||||
lbs_pr_alert( "Unknown radiomode (%i)\n",
|
lbs_pr_alert("Unknown radiomode %i\n",
|
||||||
priv->adapter->radiomode);
|
priv->adapter->radiomode);
|
||||||
/* don't export any header */
|
/* don't export any header */
|
||||||
/* chop the rxpd */
|
/* chop the rxpd */
|
||||||
@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
wlan_compute_rssi(priv, prxpd);
|
wlan_compute_rssi(priv, prxpd);
|
||||||
|
|
||||||
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
|
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
|
||||||
priv->stats.rx_bytes += skb->len;
|
priv->stats.rx_bytes += skb->len;
|
||||||
priv->stats.rx_packets++;
|
priv->stats.rx_packets++;
|
||||||
|
|
||||||
libertas_upload_rx_packet(priv, skb);
|
libertas_upload_rx_packet(priv, skb);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
|
||||||
LEAVE();
|
|
||||||
|
|
||||||
return (ret);
|
done:
|
||||||
|
skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
|
||||||
|
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file contains IF layer definitions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SBI_H_
|
|
||||||
#define _SBI_H_
|
|
||||||
|
|
||||||
#include <linux/interrupt.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
|
|
||||||
/** INT status Bit Definition*/
|
|
||||||
#define his_cmddnldrdy 0x01
|
|
||||||
#define his_cardevent 0x02
|
|
||||||
#define his_cmdupldrdy 0x04
|
|
||||||
|
|
||||||
#ifndef DEV_NAME_LEN
|
|
||||||
#define DEV_NAME_LEN 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SBI_EVENT_CAUSE_SHIFT 3
|
|
||||||
|
|
||||||
/* Probe and Check if the card is present*/
|
|
||||||
int libertas_sbi_register_dev(wlan_private * priv);
|
|
||||||
int libertas_sbi_unregister_dev(wlan_private *);
|
|
||||||
int libertas_sbi_get_int_status(wlan_private * priv, u8 *);
|
|
||||||
int libertas_sbi_register(void);
|
|
||||||
void libertas_sbi_unregister(void);
|
|
||||||
int libertas_sbi_prog_firmware(wlan_private *);
|
|
||||||
|
|
||||||
int libertas_sbi_read_event_cause(wlan_private *);
|
|
||||||
int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
|
|
||||||
wlan_private *libertas_sbi_get_priv(void *card);
|
|
||||||
|
|
||||||
#ifdef ENABLE_PM
|
|
||||||
int libertas_sbi_suspend(wlan_private *);
|
|
||||||
int libertas_sbi_resume(wlan_private *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SBI_H */
|
|
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,7 @@ struct wlan_scan_cmd_config {
|
|||||||
/**
|
/**
|
||||||
* @brief Specific BSSID used to filter scan results in the firmware
|
* @brief Specific BSSID used to filter scan results in the firmware
|
||||||
*/
|
*/
|
||||||
u8 specificBSSID[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief length of TLVs sent in command starting at tlvBuffer
|
* @brief length of TLVs sent in command starting at tlvBuffer
|
||||||
@ -91,15 +91,6 @@ struct wlan_ioctl_user_scan_chan {
|
|||||||
* @sa libertas_set_user_scan_ioctl
|
* @sa libertas_set_user_scan_ioctl
|
||||||
*/
|
*/
|
||||||
struct wlan_ioctl_user_scan_cfg {
|
struct wlan_ioctl_user_scan_cfg {
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Flag set to keep the previous scan table intact
|
|
||||||
*
|
|
||||||
* If set, the scan results will accumulate, replacing any previous
|
|
||||||
* matched entries for a BSS with the new scan data
|
|
||||||
*/
|
|
||||||
u8 keeppreviousscan; //!< Do not erase the existing scan results
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BSS type to be sent in the firmware command
|
* @brief BSS type to be sent in the firmware command
|
||||||
*
|
*
|
||||||
@ -117,15 +108,22 @@ struct wlan_ioctl_user_scan_cfg {
|
|||||||
*/
|
*/
|
||||||
u8 numprobes;
|
u8 numprobes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BSSID filter sent in the firmware command to limit the results
|
* @brief BSSID filter sent in the firmware command to limit the results
|
||||||
*/
|
*/
|
||||||
u8 specificBSSID[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
|
|
||||||
/**
|
/* Clear existing scan results matching this BSSID */
|
||||||
* @brief SSID filter sent in the firmware command to limit the results
|
u8 clear_bssid;
|
||||||
*/
|
|
||||||
char specificSSID[IW_ESSID_MAX_SIZE + 1];
|
/**
|
||||||
|
* @brief SSID filter sent in the firmware command to limit the results
|
||||||
|
*/
|
||||||
|
char ssid[IW_ESSID_MAX_SIZE];
|
||||||
|
u8 ssid_len;
|
||||||
|
|
||||||
|
/* Clear existing scan results matching this SSID */
|
||||||
|
u8 clear_ssid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Variable number (fixed maximum) of channels to scan up
|
* @brief Variable number (fixed maximum) of channels to scan up
|
||||||
@ -137,9 +135,10 @@ struct wlan_ioctl_user_scan_cfg {
|
|||||||
* @brief Structure used to store information for each beacon/probe response
|
* @brief Structure used to store information for each beacon/probe response
|
||||||
*/
|
*/
|
||||||
struct bss_descriptor {
|
struct bss_descriptor {
|
||||||
u8 macaddress[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
|
|
||||||
struct WLAN_802_11_SSID ssid;
|
u8 ssid[IW_ESSID_MAX_SIZE + 1];
|
||||||
|
u8 ssid_len;
|
||||||
|
|
||||||
/* WEP encryption requirement */
|
/* WEP encryption requirement */
|
||||||
u32 privacy;
|
u32 privacy;
|
||||||
@ -156,15 +155,15 @@ struct bss_descriptor {
|
|||||||
u8 mode;
|
u8 mode;
|
||||||
u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
|
u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
|
||||||
|
|
||||||
int extra_ie;
|
__le64 timestamp; //!< TSF value included in the beacon/probe response
|
||||||
|
unsigned long last_scanned;
|
||||||
|
|
||||||
u8 timestamp[8]; //!< TSF value included in the beacon/probe response
|
|
||||||
union ieeetypes_phyparamset phyparamset;
|
union ieeetypes_phyparamset phyparamset;
|
||||||
union IEEEtypes_ssparamset ssparamset;
|
union IEEEtypes_ssparamset ssparamset;
|
||||||
struct ieeetypes_capinfo cap;
|
struct ieeetypes_capinfo cap;
|
||||||
u8 datarates[WLAN_SUPPORTED_RATES];
|
u8 datarates[WLAN_SUPPORTED_RATES];
|
||||||
|
|
||||||
__le64 networktsf; //!< TSF timestamp from the current firmware TSF
|
u64 networktsf; //!< TSF timestamp from the current firmware TSF
|
||||||
|
|
||||||
struct ieeetypes_countryinfofullset countryinfo;
|
struct ieeetypes_countryinfofullset countryinfo;
|
||||||
|
|
||||||
@ -172,24 +171,29 @@ struct bss_descriptor {
|
|||||||
size_t wpa_ie_len;
|
size_t wpa_ie_len;
|
||||||
u8 rsn_ie[MAX_WPA_IE_LEN];
|
u8 rsn_ie[MAX_WPA_IE_LEN];
|
||||||
size_t rsn_ie_len;
|
size_t rsn_ie_len;
|
||||||
|
|
||||||
|
struct list_head list;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
|
extern int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
|
||||||
struct WLAN_802_11_SSID *ssid2);
|
|
||||||
extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
|
|
||||||
u8 * bssid, u8 mode);
|
|
||||||
int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
|
|
||||||
extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
|
|
||||||
|
|
||||||
int libertas_find_best_network_SSID(wlan_private * priv,
|
struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
|
||||||
struct WLAN_802_11_SSID *pSSID,
|
u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
|
||||||
u8 preferred_mode, u8 *out_mode);
|
int channel);
|
||||||
|
|
||||||
extern int libertas_send_specific_SSID_scan(wlan_private * priv,
|
struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter,
|
||||||
struct WLAN_802_11_SSID *prequestedssid,
|
u8 mode);
|
||||||
u8 keeppreviousscan);
|
|
||||||
extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
|
extern struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
|
||||||
u8 * bssid, u8 keeppreviousscan);
|
u8 * bssid, u8 mode);
|
||||||
|
|
||||||
|
int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid,
|
||||||
|
u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
|
||||||
|
|
||||||
|
extern int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid,
|
||||||
|
u8 ssid_len, u8 clear_ssid);
|
||||||
|
extern int libertas_send_specific_bssid_scan(wlan_private * priv,
|
||||||
|
u8 * bssid, u8 clear_bssid);
|
||||||
|
|
||||||
extern int libertas_cmd_80211_scan(wlan_private * priv,
|
extern int libertas_cmd_80211_scan(wlan_private * priv,
|
||||||
struct cmd_ds_command *cmd,
|
struct cmd_ds_command *cmd,
|
||||||
@ -199,7 +203,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv,
|
|||||||
struct cmd_ds_command *resp);
|
struct cmd_ds_command *resp);
|
||||||
|
|
||||||
int wlan_scan_networks(wlan_private * priv,
|
int wlan_scan_networks(wlan_private * priv,
|
||||||
const struct wlan_ioctl_user_scan_cfg * puserscanin);
|
const struct wlan_ioctl_user_scan_cfg * puserscanin,
|
||||||
|
int full_scan);
|
||||||
|
|
||||||
struct ifreq;
|
struct ifreq;
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
|
|||||||
|
|
||||||
static inline void wlan_deactivate_thread(struct wlan_thread * thr)
|
static inline void wlan_deactivate_thread(struct wlan_thread * thr)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_THREAD);
|
||||||
|
|
||||||
thr->pid = 0;
|
thr->pid = 0;
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void wlan_create_thread(int (*wlanfunc) (void *),
|
static inline void wlan_create_thread(int (*wlanfunc) (void *),
|
||||||
@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
|
|||||||
|
|
||||||
static inline int wlan_terminate_thread(struct wlan_thread * thr)
|
static inline int wlan_terminate_thread(struct wlan_thread * thr)
|
||||||
{
|
{
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_THREAD);
|
||||||
|
|
||||||
/* Check if the thread is active or not */
|
/* Check if the thread is active or not */
|
||||||
if (!thr->pid) {
|
if (!thr->pid) {
|
||||||
@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
|
|||||||
}
|
}
|
||||||
kthread_stop(thr->task);
|
kthread_stop(thr->task);
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave(LBS_DEB_THREAD);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "hostcmd.h"
|
#include "hostcmd.h"
|
||||||
#include "radiotap.h"
|
#include "radiotap.h"
|
||||||
#include "sbi.h"
|
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dev.h"
|
#include "dev.h"
|
||||||
@ -68,7 +67,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
u32 new_rate;
|
u32 new_rate;
|
||||||
u8 *ptr = priv->adapter->tmptxbuf;
|
u8 *ptr = priv->adapter->tmptxbuf;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_TX);
|
||||||
|
|
||||||
if (priv->adapter->surpriseremoved)
|
if (priv->adapter->surpriseremoved)
|
||||||
return -1;
|
return -1;
|
||||||
@ -78,7 +77,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
min_t(unsigned int, skb->len, 100));
|
min_t(unsigned int, skb->len, 100));
|
||||||
|
|
||||||
if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
|
if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
|
||||||
lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n",
|
lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
|
||||||
skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
|
skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
@ -86,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
memset(plocaltxpd, 0, sizeof(struct txpd));
|
memset(plocaltxpd, 0, sizeof(struct txpd));
|
||||||
|
|
||||||
plocaltxpd->tx_packet_length = skb->len;
|
plocaltxpd->tx_packet_length = cpu_to_le16(skb->len);
|
||||||
|
|
||||||
/* offset of actual data */
|
/* offset of actual data */
|
||||||
plocaltxpd->tx_packet_location = sizeof(struct txpd);
|
plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
|
||||||
|
|
||||||
/* TxCtrl set by user or default */
|
/* TxCtrl set by user or default */
|
||||||
plocaltxpd->tx_control = adapter->pkttxctrl;
|
plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl);
|
||||||
|
|
||||||
p802x_hdr = skb->data;
|
p802x_hdr = skb->data;
|
||||||
if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
|
if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
|
||||||
@ -103,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
/* set txpd fields from the radiotap header */
|
/* set txpd fields from the radiotap header */
|
||||||
new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
|
new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
|
||||||
if (new_rate != 0) {
|
if (new_rate != 0) {
|
||||||
/* erase tx_control[4:0] */
|
/* use new tx_control[4:0] */
|
||||||
plocaltxpd->tx_control &= ~0x1f;
|
new_rate |= (adapter->pkttxctrl & ~0x1f);
|
||||||
/* write new tx_control[4:0] */
|
plocaltxpd->tx_control = cpu_to_le32(new_rate);
|
||||||
plocaltxpd->tx_control |= new_rate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip the radiotap header */
|
/* skip the radiotap header */
|
||||||
p802x_hdr += sizeof(struct tx_radiotap_hdr);
|
p802x_hdr += sizeof(struct tx_radiotap_hdr);
|
||||||
plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr);
|
plocaltxpd->tx_packet_length =
|
||||||
|
cpu_to_le16(le16_to_cpu(plocaltxpd->tx_packet_length)
|
||||||
|
- sizeof(struct tx_radiotap_hdr));
|
||||||
|
|
||||||
}
|
}
|
||||||
/* copy destination address from 802.3 or 802.11 header */
|
/* copy destination address from 802.3 or 802.11 header */
|
||||||
@ -123,28 +123,28 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
|
lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
|
||||||
|
|
||||||
if (IS_MESH_FRAME(skb)) {
|
if (IS_MESH_FRAME(skb)) {
|
||||||
plocaltxpd->tx_control |= TxPD_MESH_FRAME;
|
plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(ptr, plocaltxpd, sizeof(struct txpd));
|
memcpy(ptr, plocaltxpd, sizeof(struct txpd));
|
||||||
|
|
||||||
ptr += sizeof(struct txpd);
|
ptr += sizeof(struct txpd);
|
||||||
|
|
||||||
lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length);
|
lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
|
||||||
memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length);
|
memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
|
||||||
ret = libertas_sbi_host_to_card(priv, MVMS_DAT,
|
ret = priv->hw_host_to_card(priv, MVMS_DAT,
|
||||||
priv->adapter->tmptxbuf,
|
priv->adapter->tmptxbuf,
|
||||||
plocaltxpd->tx_packet_length +
|
le16_to_cpu(plocaltxpd->tx_packet_length) +
|
||||||
sizeof(struct txpd));
|
sizeof(struct txpd));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret);
|
lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
lbs_pr_debug(1, "SendSinglePacket succeeds\n");
|
lbs_deb_tx("SendSinglePacket succeeds\n");
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
priv->stats.tx_packets++;
|
priv->stats.tx_packets++;
|
||||||
priv->stats.tx_bytes += skb->len;
|
priv->stats.tx_bytes += skb->len;
|
||||||
@ -158,7 +158,8 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
received from FW */
|
received from FW */
|
||||||
skb_orphan(skb);
|
skb_orphan(skb);
|
||||||
/* stop processing outgoing pkts */
|
/* stop processing outgoing pkts */
|
||||||
netif_stop_queue(priv->wlan_dev.netdev);
|
netif_stop_queue(priv->dev);
|
||||||
|
netif_stop_queue(priv->mesh_dev);
|
||||||
/* freeze any packets already in our queues */
|
/* freeze any packets already in our queues */
|
||||||
priv->adapter->TxLockFlag = 1;
|
priv->adapter->TxLockFlag = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -166,7 +167,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
|
|||||||
priv->adapter->currenttxskb = NULL;
|
priv->adapter->currenttxskb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,10 +196,13 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
|
WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
|
||||||
adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
|
adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
|
||||||
if (adapter->tx_queue_idx == NR_TX_QUEUE)
|
if (adapter->tx_queue_idx == NR_TX_QUEUE) {
|
||||||
netif_stop_queue(priv->wlan_dev.netdev);
|
netif_stop_queue(priv->dev);
|
||||||
else
|
netif_stop_queue(priv->mesh_dev);
|
||||||
netif_start_queue(priv->wlan_dev.netdev);
|
} else {
|
||||||
|
netif_start_queue(priv->dev);
|
||||||
|
netif_start_queue(priv->mesh_dev);
|
||||||
|
}
|
||||||
|
|
||||||
spin_unlock(&adapter->txqueue_lock);
|
spin_unlock(&adapter->txqueue_lock);
|
||||||
}
|
}
|
||||||
@ -214,13 +218,12 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
ENTER();
|
lbs_deb_enter(LBS_DEB_TX);
|
||||||
|
|
||||||
lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
|
lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
|
||||||
|
|
||||||
if (priv->wlan_dev.dnld_sent) {
|
if (priv->dnld_sent) {
|
||||||
lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n",
|
lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n",
|
||||||
priv->wlan_dev.dnld_sent);
|
priv->dnld_sent);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +237,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
|
|||||||
|
|
||||||
ret = SendSinglePacket(priv, skb);
|
ret = SendSinglePacket(priv, skb);
|
||||||
done:
|
done:
|
||||||
LEAVE();
|
lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +283,9 @@ void libertas_send_tx_feedback(wlan_private * priv)
|
|||||||
libertas_upload_rx_packet(priv, adapter->currenttxskb);
|
libertas_upload_rx_packet(priv, adapter->currenttxskb);
|
||||||
adapter->currenttxskb = NULL;
|
adapter->currenttxskb = NULL;
|
||||||
priv->adapter->TxLockFlag = 0;
|
priv->adapter->TxLockFlag = 0;
|
||||||
if (priv->adapter->connect_status == libertas_connected)
|
if (priv->adapter->connect_status == libertas_connected) {
|
||||||
netif_wake_queue(priv->wlan_dev.netdev);
|
netif_wake_queue(priv->dev);
|
||||||
|
netif_wake_queue(priv->mesh_dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(libertas_send_tx_feedback);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define _WLAN_TYPES_
|
#define _WLAN_TYPES_
|
||||||
|
|
||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
/** IEEE type definitions */
|
/** IEEE type definitions */
|
||||||
enum ieeetypes_elementid {
|
enum ieeetypes_elementid {
|
||||||
@ -29,9 +30,30 @@ enum ieeetypes_elementid {
|
|||||||
EXTRA_IE = 133,
|
EXTRA_IE = 133,
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
#ifdef __BIG_ENDIAN
|
||||||
#define CAPINFO_MASK (~(0xda00))
|
#define CAPINFO_MASK (~(0xda00))
|
||||||
|
#else
|
||||||
|
#define CAPINFO_MASK (~(0x00da))
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ieeetypes_capinfo {
|
struct ieeetypes_capinfo {
|
||||||
|
#ifdef __BIG_ENDIAN_BITFIELD
|
||||||
|
u8 chanagility:1;
|
||||||
|
u8 pbcc:1;
|
||||||
|
u8 shortpreamble:1;
|
||||||
|
u8 privacy:1;
|
||||||
|
u8 cfpollrqst:1;
|
||||||
|
u8 cfpollable:1;
|
||||||
|
u8 ibss:1;
|
||||||
|
u8 ess:1;
|
||||||
|
u8 rsrvd1:2;
|
||||||
|
u8 dsssofdm:1;
|
||||||
|
u8 rsvrd2:1;
|
||||||
|
u8 apsd:1;
|
||||||
|
u8 shortslottime:1;
|
||||||
|
u8 rsrvd3:1;
|
||||||
|
u8 spectrummgmt:1;
|
||||||
|
#else
|
||||||
u8 ess:1;
|
u8 ess:1;
|
||||||
u8 ibss:1;
|
u8 ibss:1;
|
||||||
u8 cfpollable:1;
|
u8 cfpollable:1;
|
||||||
@ -47,6 +69,7 @@ struct ieeetypes_capinfo {
|
|||||||
u8 rsvrd2:1;
|
u8 rsvrd2:1;
|
||||||
u8 dsssofdm:1;
|
u8 dsssofdm:1;
|
||||||
u8 rsrvd1:2;
|
u8 rsrvd1:2;
|
||||||
|
#endif
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct ieeetypes_cfparamset {
|
struct ieeetypes_cfparamset {
|
||||||
@ -54,15 +77,15 @@ struct ieeetypes_cfparamset {
|
|||||||
u8 len;
|
u8 len;
|
||||||
u8 cfpcnt;
|
u8 cfpcnt;
|
||||||
u8 cfpperiod;
|
u8 cfpperiod;
|
||||||
u16 cfpmaxduration;
|
__le16 cfpmaxduration;
|
||||||
u16 cfpdurationremaining;
|
__le16 cfpdurationremaining;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct ieeetypes_ibssparamset {
|
struct ieeetypes_ibssparamset {
|
||||||
u8 elementid;
|
u8 elementid;
|
||||||
u8 len;
|
u8 len;
|
||||||
u16 atimwindow;
|
__le16 atimwindow;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
union IEEEtypes_ssparamset {
|
union IEEEtypes_ssparamset {
|
||||||
@ -73,7 +96,7 @@ union IEEEtypes_ssparamset {
|
|||||||
struct ieeetypes_fhparamset {
|
struct ieeetypes_fhparamset {
|
||||||
u8 elementid;
|
u8 elementid;
|
||||||
u8 len;
|
u8 len;
|
||||||
u16 dwelltime;
|
__le16 dwelltime;
|
||||||
u8 hopset;
|
u8 hopset;
|
||||||
u8 hoppattern;
|
u8 hoppattern;
|
||||||
u8 hopindex;
|
u8 hopindex;
|
||||||
@ -92,8 +115,8 @@ union ieeetypes_phyparamset {
|
|||||||
|
|
||||||
struct ieeetypes_assocrsp {
|
struct ieeetypes_assocrsp {
|
||||||
struct ieeetypes_capinfo capability;
|
struct ieeetypes_capinfo capability;
|
||||||
u16 statuscode;
|
__le16 statuscode;
|
||||||
u16 aid;
|
__le16 aid;
|
||||||
u8 iebuffer[1];
|
u8 iebuffer[1];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
@ -138,8 +161,8 @@ struct ieeetypes_assocrsp {
|
|||||||
|
|
||||||
/** TLV related data structures*/
|
/** TLV related data structures*/
|
||||||
struct mrvlietypesheader {
|
struct mrvlietypesheader {
|
||||||
u16 type;
|
__le16 type;
|
||||||
u16 len;
|
__le16 len;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mrvlietypes_data {
|
struct mrvlietypes_data {
|
||||||
@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct chanscanmode {
|
struct chanscanmode {
|
||||||
|
#ifdef __BIG_ENDIAN_BITFIELD
|
||||||
|
u8 reserved_2_7:6;
|
||||||
|
u8 disablechanfilt:1;
|
||||||
|
u8 passivescan:1;
|
||||||
|
#else
|
||||||
u8 passivescan:1;
|
u8 passivescan:1;
|
||||||
u8 disablechanfilt:1;
|
u8 disablechanfilt:1;
|
||||||
u8 reserved_2_7:6;
|
u8 reserved_2_7:6;
|
||||||
|
#endif
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct chanscanparamset {
|
struct chanscanparamset {
|
||||||
u8 radiotype;
|
u8 radiotype;
|
||||||
u8 channumber;
|
u8 channumber;
|
||||||
struct chanscanmode chanscanmode;
|
struct chanscanmode chanscanmode;
|
||||||
u16 minscantime;
|
__le16 minscantime;
|
||||||
u16 maxscantime;
|
__le16 maxscantime;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mrvlietypes_chanlistparamset {
|
struct mrvlietypes_chanlistparamset {
|
||||||
@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset {
|
|||||||
struct cfparamset {
|
struct cfparamset {
|
||||||
u8 cfpcnt;
|
u8 cfpcnt;
|
||||||
u8 cfpperiod;
|
u8 cfpperiod;
|
||||||
u16 cfpmaxduration;
|
__le16 cfpmaxduration;
|
||||||
u16 cfpdurationremaining;
|
__le16 cfpdurationremaining;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct ibssparamset {
|
struct ibssparamset {
|
||||||
u16 atimwindow;
|
__le16 atimwindow;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mrvlietypes_ssparamset {
|
struct mrvlietypes_ssparamset {
|
||||||
@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct fhparamset {
|
struct fhparamset {
|
||||||
u16 dwelltime;
|
__le16 dwelltime;
|
||||||
u8 hopset;
|
u8 hopset;
|
||||||
u8 hoppattern;
|
u8 hoppattern;
|
||||||
u8 hopindex;
|
u8 hopindex;
|
||||||
@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed {
|
|||||||
|
|
||||||
struct mrvlietypes_numprobes {
|
struct mrvlietypes_numprobes {
|
||||||
struct mrvlietypesheader header;
|
struct mrvlietypesheader header;
|
||||||
u16 numprobes;
|
__le16 numprobes;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mrvlietypes_bcastprobe {
|
struct mrvlietypes_bcastprobe {
|
||||||
struct mrvlietypesheader header;
|
struct mrvlietypesheader header;
|
||||||
u16 bcastprobe;
|
__le16 bcastprobe;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mrvlietypes_numssidprobe {
|
struct mrvlietypes_numssidprobe {
|
||||||
struct mrvlietypesheader header;
|
struct mrvlietypesheader header;
|
||||||
u16 numssidprobe;
|
__le16 numssidprobe;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct led_pin {
|
struct led_pin {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,21 +20,23 @@
|
|||||||
#define WLAN_SUBCMD_FWT_CLEANUP 15
|
#define WLAN_SUBCMD_FWT_CLEANUP 15
|
||||||
#define WLAN_SUBCMD_FWT_TIME 16
|
#define WLAN_SUBCMD_FWT_TIME 16
|
||||||
#define WLAN_SUBCMD_MESH_GET_TTL 17
|
#define WLAN_SUBCMD_MESH_GET_TTL 17
|
||||||
|
#define WLAN_SUBCMD_BT_GET_INVERT 18
|
||||||
|
|
||||||
#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
|
#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
|
||||||
#define WLANSETREGION 8
|
#define WLANSETREGION 8
|
||||||
#define WLAN_SUBCMD_MESH_SET_TTL 18
|
#define WLAN_SUBCMD_MESH_SET_TTL 18
|
||||||
|
#define WLAN_SUBCMD_BT_SET_INVERT 19
|
||||||
|
|
||||||
#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
|
#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
|
||||||
#define WLAN_SUBCMD_BT_ADD 18
|
#define WLAN_SUBCMD_BT_ADD 18
|
||||||
#define WLAN_SUBCMD_BT_DEL 19
|
#define WLAN_SUBCMD_BT_DEL 19
|
||||||
#define WLAN_SUBCMD_BT_LIST 20
|
#define WLAN_SUBCMD_BT_LIST 20
|
||||||
#define WLAN_SUBCMD_FWT_ADD 21
|
#define WLAN_SUBCMD_FWT_ADD 21
|
||||||
#define WLAN_SUBCMD_FWT_DEL 22
|
#define WLAN_SUBCMD_FWT_DEL 22
|
||||||
#define WLAN_SUBCMD_FWT_LOOKUP 23
|
#define WLAN_SUBCMD_FWT_LOOKUP 23
|
||||||
#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24
|
#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24
|
||||||
#define WLAN_SUBCMD_FWT_LIST 25
|
#define WLAN_SUBCMD_FWT_LIST 25
|
||||||
#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
|
#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
|
||||||
|
|
||||||
#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
|
#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
|
||||||
#define WLAN_LED_GPIO_CTRL 5
|
#define WLAN_LED_GPIO_CTRL 5
|
||||||
@ -56,6 +58,7 @@ struct wlan_ioctl_regrdwr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct iw_handler_def libertas_handler_def;
|
extern struct iw_handler_def libertas_handler_def;
|
||||||
|
extern struct iw_handler_def mesh_handler_def;
|
||||||
int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
|
int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
|
||||||
int wlan_radio_ioctl(wlan_private * priv, u8 option);
|
int wlan_radio_ioctl(wlan_private * priv, u8 option);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user