Commit a0e1d1d0 authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents dd14cbc9 b2329239
...@@ -285,6 +285,12 @@ enum scb_status { ...@@ -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 { ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 @@ ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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,16 +915,35 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) ...@@ -915,16 +915,35 @@ 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) {
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; dev->mtu = new_mtu;
return 0; return 0;
} }
...@@ -1243,6 +1262,7 @@ const char * buf, size_t count) ...@@ -1243,6 +1262,7 @@ 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 (netif_running(netdev)) {
if(ibmveth_alloc_buffer_pool(pool)) { if(ibmveth_alloc_buffer_pool(pool)) {
ibmveth_error_printk("unable to alloc pool\n"); ibmveth_error_printk("unable to alloc pool\n");
return -ENOMEM; return -ENOMEM;
...@@ -1253,6 +1273,8 @@ const char * buf, size_t count) ...@@ -1253,6 +1273,8 @@ const char * buf, size_t count)
adapter->pool_config = 0; adapter->pool_config = 0;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; 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) ...@@ -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 {
if (netif_running(netdev)) {
adapter->pool_config = 1; adapter->pool_config = 1;
ibmveth_close(netdev); ibmveth_close(netdev);
adapter->pool_config = 0; adapter->pool_config = 0;
pool->size = value; pool->size = value;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; 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 {
if (netif_running(netdev)) {
adapter->pool_config = 1; adapter->pool_config = 1;
ibmveth_close(netdev); ibmveth_close(netdev);
adapter->pool_config = 0; adapter->pool_config = 0;
pool->buff_size = value; pool->buff_size = value;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; return rc;
} else
pool->buff_size = value;
} }
} }
......
...@@ -71,7 +71,7 @@ ...@@ -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; ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 @@ ...@@ -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 { ...@@ -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); ...@@ -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] = { ...@@ -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, ...@@ -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, ...@@ -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] = { ...@@ -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[]) ...@@ -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[]) ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
if (adapter->handle_phy_intr)
adapter->handle_phy_intr(adapter);
netdev = adapter->netdev; netdev = adapter->netdev;
if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) { if ((netif_running(netdev)) && !netif_carrier_ok(netdev) &&
printk(KERN_INFO "%s port %d, %s carrier is now ok\n", netxen_nic_link_ok(adapter) ) {
netxen_nic_driver_name, adapter->portnum, netdev->name); printk(KERN_INFO "%s %s (port %d), Link is up\n",
netxen_nic_driver_name, netdev->name, adapter->portnum);
netif_carrier_on(netdev); netif_carrier_on(netdev);
}
if (netif_queue_stopped(netdev))
netif_wake_queue(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);
}
if (adapter->handle_phy_intr)
adapter->handle_phy_intr(adapter);
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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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), &reg, 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 @@ ...@@ -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) ...@@ -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) ...@@ -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 = { ...@@ -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 = { ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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.
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset { ...@@ -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); ...@@ -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);
......
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 \ ...@@ -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
================================================================================ ================================================================================
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: ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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
......
This diff is collapsed.
...@@ -5,10 +5,12 @@ ...@@ -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) ...@@ -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;
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -6,6 +6,8 @@ ...@@ -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); ...@@ -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 @@ ...@@ -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; ...@@ -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) ...@@ -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) ...@@ -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; ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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;
struct WLAN_802_11_SSID previousssid; u8 prev_bssid[ETH_ALEN];
u8 previousbssid[ETH_ALEN];
struct bss_descriptor *scantable; /* Scan results list */
u32 numinscantable; struct list_head network_list;
struct list_head network_free_list;
struct bss_descriptor *networks;
u8 scantype; u8 scantype;
u32 scanmode; u32 scanmode;
...@@ -288,7 +293,6 @@ struct _wlan_adapter { ...@@ -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 { ...@@ -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 { ...@@ -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_ */
#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[]= { ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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]);
ret = MESH_STATS_NUM;
LEAVE(); done:
return MESH_STATS_NUM; 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, ...@@ -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, ...@@ -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 = {
......
/** /**
* 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); ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
......
/**
* 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_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment