aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-17 23:53:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-17 23:53:52 -0400
commitf205ce83a766c08965ec78342f138cdc00631fba (patch)
tree7a9d2db6c16594ef7c730ca93a87131cf0abca41 /drivers/net
parent3dc95666df0e1ae5b7381a8ec97a583bb3ce4306 (diff)
parentb31c50a7f9e93a61d14740dedcbbf2c376998bc7 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (66 commits) be2net: fix some cmds to use mccq instead of mbox atl1e: fix 2.6.31-git4 -- ATL1E 0000:03:00.0: DMA-API: device driver frees DMA pkt_sched: Fix qstats.qlen updating in dump_stats ipv6: Log the affected address when DAD failure occurs wl12xx: Fix print_mac() conversion. af_iucv: fix race when queueing skbs on the backlog queue af_iucv: do not call iucv_sock_kill() twice af_iucv: handle non-accepted sockets after resuming from suspend af_iucv: fix race in __iucv_sock_wait() iucv: use correct output register in iucv_query_maxconn() iucv: fix iucv_buffer_cpumask check when calling IUCV functions iucv: suspend/resume error msg for left over pathes wl12xx: switch to %pM to print the mac address b44: the poll handler b44_poll must not enable IRQ unconditionally ipv6: Ignore route option with ROUTER_PREF_INVALID bonding: make ab_arp select active slaves as other modes cfg80211: fix SME connect rc80211_minstrel: fix contention window calculation ssb/sdio: fix printk format warnings p54usb: add Zcomax XG-705A usbid ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/atl1e/atl1e.h9
-rw-r--r--drivers/net/atl1e/atl1e_main.c15
-rw-r--r--drivers/net/b44.c7
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_cmds.c412
-rw-r--r--drivers/net/benet/be_cmds.h5
-rw-r--r--drivers/net/benet/be_main.c42
-rw-r--r--drivers/net/bonding/bond_main.c131
-rw-r--r--drivers/net/can/vcan.c2
-rw-r--r--drivers/net/igb/e1000_82575.c198
-rw-r--r--drivers/net/igb/e1000_82575.h2
-rw-r--r--drivers/net/igb/e1000_defines.h2
-rw-r--r--drivers/net/igb/e1000_phy.c5
-rw-r--r--drivers/net/igb/igb_main.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h2
-rw-r--r--drivers/net/mlx4/catas.c11
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c10
-rw-r--r--drivers/net/pppol2tp.c4
-rw-r--r--drivers/net/sky2.c24
-rw-r--r--drivers/net/smc91x.h28
-rw-r--r--drivers/net/usb/cdc-phonet.c1
-rw-r--r--drivers/net/wireless/Kconfig1
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c6
-rw-r--r--drivers/net/wireless/b43/main.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c24
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c5
37 files changed, 545 insertions, 479 deletions
diff --git a/drivers/net/atl1e/atl1e.h b/drivers/net/atl1e/atl1e.h
index ba48220df16a..490d3b38e0cb 100644
--- a/drivers/net/atl1e/atl1e.h
+++ b/drivers/net/atl1e/atl1e.h
@@ -377,10 +377,19 @@ struct atl1e_hw {
377 */ 377 */
378struct atl1e_tx_buffer { 378struct atl1e_tx_buffer {
379 struct sk_buff *skb; 379 struct sk_buff *skb;
380 u16 flags;
381#define ATL1E_TX_PCIMAP_SINGLE 0x0001
382#define ATL1E_TX_PCIMAP_PAGE 0x0002
383#define ATL1E_TX_PCIMAP_TYPE_MASK 0x0003
380 u16 length; 384 u16 length;
381 dma_addr_t dma; 385 dma_addr_t dma;
382}; 386};
383 387
388#define ATL1E_SET_PCIMAP_TYPE(tx_buff, type) do { \
389 ((tx_buff)->flags) &= ~ATL1E_TX_PCIMAP_TYPE_MASK; \
390 ((tx_buff)->flags) |= (type); \
391 } while (0)
392
384struct atl1e_rx_page { 393struct atl1e_rx_page {
385 dma_addr_t dma; /* receive rage DMA address */ 394 dma_addr_t dma; /* receive rage DMA address */
386 u8 *addr; /* receive rage virtual address */ 395 u8 *addr; /* receive rage virtual address */
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 69b830f4b68f..955da733c2ad 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -635,7 +635,11 @@ static void atl1e_clean_tx_ring(struct atl1e_adapter *adapter)
635 for (index = 0; index < ring_count; index++) { 635 for (index = 0; index < ring_count; index++) {
636 tx_buffer = &tx_ring->tx_buffer[index]; 636 tx_buffer = &tx_ring->tx_buffer[index];
637 if (tx_buffer->dma) { 637 if (tx_buffer->dma) {
638 pci_unmap_page(pdev, tx_buffer->dma, 638 if (tx_buffer->flags & ATL1E_TX_PCIMAP_SINGLE)
639 pci_unmap_single(pdev, tx_buffer->dma,
640 tx_buffer->length, PCI_DMA_TODEVICE);
641 else if (tx_buffer->flags & ATL1E_TX_PCIMAP_PAGE)
642 pci_unmap_page(pdev, tx_buffer->dma,
639 tx_buffer->length, PCI_DMA_TODEVICE); 643 tx_buffer->length, PCI_DMA_TODEVICE);
640 tx_buffer->dma = 0; 644 tx_buffer->dma = 0;
641 } 645 }
@@ -1220,7 +1224,11 @@ static bool atl1e_clean_tx_irq(struct atl1e_adapter *adapter)
1220 while (next_to_clean != hw_next_to_clean) { 1224 while (next_to_clean != hw_next_to_clean) {
1221 tx_buffer = &tx_ring->tx_buffer[next_to_clean]; 1225 tx_buffer = &tx_ring->tx_buffer[next_to_clean];
1222 if (tx_buffer->dma) { 1226 if (tx_buffer->dma) {
1223 pci_unmap_page(adapter->pdev, tx_buffer->dma, 1227 if (tx_buffer->flags & ATL1E_TX_PCIMAP_SINGLE)
1228 pci_unmap_single(adapter->pdev, tx_buffer->dma,
1229 tx_buffer->length, PCI_DMA_TODEVICE);
1230 else if (tx_buffer->flags & ATL1E_TX_PCIMAP_PAGE)
1231 pci_unmap_page(adapter->pdev, tx_buffer->dma,
1224 tx_buffer->length, PCI_DMA_TODEVICE); 1232 tx_buffer->length, PCI_DMA_TODEVICE);
1225 tx_buffer->dma = 0; 1233 tx_buffer->dma = 0;
1226 } 1234 }
@@ -1741,6 +1749,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
1741 tx_buffer->length = map_len; 1749 tx_buffer->length = map_len;
1742 tx_buffer->dma = pci_map_single(adapter->pdev, 1750 tx_buffer->dma = pci_map_single(adapter->pdev,
1743 skb->data, hdr_len, PCI_DMA_TODEVICE); 1751 skb->data, hdr_len, PCI_DMA_TODEVICE);
1752 ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_SINGLE);
1744 mapped_len += map_len; 1753 mapped_len += map_len;
1745 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma); 1754 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
1746 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) | 1755 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) |
@@ -1766,6 +1775,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
1766 tx_buffer->dma = 1775 tx_buffer->dma =
1767 pci_map_single(adapter->pdev, skb->data + mapped_len, 1776 pci_map_single(adapter->pdev, skb->data + mapped_len,
1768 map_len, PCI_DMA_TODEVICE); 1777 map_len, PCI_DMA_TODEVICE);
1778 ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_SINGLE);
1769 mapped_len += map_len; 1779 mapped_len += map_len;
1770 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma); 1780 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
1771 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) | 1781 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) |
@@ -1801,6 +1811,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
1801 (i * MAX_TX_BUF_LEN), 1811 (i * MAX_TX_BUF_LEN),
1802 tx_buffer->length, 1812 tx_buffer->length,
1803 PCI_DMA_TODEVICE); 1813 PCI_DMA_TODEVICE);
1814 ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_PAGE);
1804 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma); 1815 use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
1805 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) | 1816 use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) |
1806 ((cpu_to_le32(tx_buffer->length) & 1817 ((cpu_to_le32(tx_buffer->length) &
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 0189dcd36f31..e046943ef29d 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -847,23 +847,22 @@ static int b44_poll(struct napi_struct *napi, int budget)
847{ 847{
848 struct b44 *bp = container_of(napi, struct b44, napi); 848 struct b44 *bp = container_of(napi, struct b44, napi);
849 int work_done; 849 int work_done;
850 unsigned long flags;
850 851
851 spin_lock_irq(&bp->lock); 852 spin_lock_irqsave(&bp->lock, flags);
852 853
853 if (bp->istat & (ISTAT_TX | ISTAT_TO)) { 854 if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
854 /* spin_lock(&bp->tx_lock); */ 855 /* spin_lock(&bp->tx_lock); */
855 b44_tx(bp); 856 b44_tx(bp);
856 /* spin_unlock(&bp->tx_lock); */ 857 /* spin_unlock(&bp->tx_lock); */
857 } 858 }
858 spin_unlock_irq(&bp->lock); 859 spin_unlock_irqrestore(&bp->lock, flags);
859 860
860 work_done = 0; 861 work_done = 0;
861 if (bp->istat & ISTAT_RX) 862 if (bp->istat & ISTAT_RX)
862 work_done += b44_rx(bp, budget); 863 work_done += b44_rx(bp, budget);
863 864
864 if (bp->istat & ISTAT_ERRORS) { 865 if (bp->istat & ISTAT_ERRORS) {
865 unsigned long flags;
866
867 spin_lock_irqsave(&bp->lock, flags); 866 spin_lock_irqsave(&bp->lock, flags);
868 b44_halt(bp); 867 b44_halt(bp);
869 b44_init_rings(bp); 868 b44_init_rings(bp);
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 13b72ce870de..684c6fe24c8d 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -362,5 +362,6 @@ static inline u8 is_udp_pkt(struct sk_buff *skb)
362extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, 362extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
363 u16 num_popped); 363 u16 num_popped);
364extern void be_link_status_update(struct be_adapter *adapter, bool link_up); 364extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
365extern void netdev_stats_update(struct be_adapter *adapter);
365extern int be_load_fw(struct be_adapter *adapter, u8 *func); 366extern int be_load_fw(struct be_adapter *adapter, u8 *func);
366#endif /* BE_H */ 367#endif /* BE_H */
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 1db092498309..3dd76c4170bf 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -59,15 +59,22 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
59 59
60 compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) & 60 compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
61 CQE_STATUS_COMPL_MASK; 61 CQE_STATUS_COMPL_MASK;
62 if (compl_status != MCC_STATUS_SUCCESS) { 62 if (compl_status == MCC_STATUS_SUCCESS) {
63 if (compl->tag0 == OPCODE_ETH_GET_STATISTICS) {
64 struct be_cmd_resp_get_stats *resp =
65 adapter->stats.cmd.va;
66 be_dws_le_to_cpu(&resp->hw_stats,
67 sizeof(resp->hw_stats));
68 netdev_stats_update(adapter);
69 }
70 } else if (compl_status != MCC_STATUS_NOT_SUPPORTED) {
63 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & 71 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
64 CQE_STATUS_EXTD_MASK; 72 CQE_STATUS_EXTD_MASK;
65 dev_warn(&adapter->pdev->dev, 73 dev_warn(&adapter->pdev->dev,
66 "Error in cmd completion: status(compl/extd)=%d/%d\n", 74 "Error in cmd completion: status(compl/extd)=%d/%d\n",
67 compl_status, extd_status); 75 compl_status, extd_status);
68 return -1;
69 } 76 }
70 return 0; 77 return compl_status;
71} 78}
72 79
73/* Link state evt is a string of bytes; no need for endian swapping */ 80/* Link state evt is a string of bytes; no need for endian swapping */
@@ -97,10 +104,10 @@ static struct be_mcc_compl *be_mcc_compl_get(struct be_adapter *adapter)
97 return NULL; 104 return NULL;
98} 105}
99 106
100void be_process_mcc(struct be_adapter *adapter) 107int be_process_mcc(struct be_adapter *adapter)
101{ 108{
102 struct be_mcc_compl *compl; 109 struct be_mcc_compl *compl;
103 int num = 0; 110 int num = 0, status = 0;
104 111
105 spin_lock_bh(&adapter->mcc_cq_lock); 112 spin_lock_bh(&adapter->mcc_cq_lock);
106 while ((compl = be_mcc_compl_get(adapter))) { 113 while ((compl = be_mcc_compl_get(adapter))) {
@@ -111,38 +118,47 @@ void be_process_mcc(struct be_adapter *adapter)
111 /* Interpret compl as a async link evt */ 118 /* Interpret compl as a async link evt */
112 be_async_link_state_process(adapter, 119 be_async_link_state_process(adapter,
113 (struct be_async_event_link_state *) compl); 120 (struct be_async_event_link_state *) compl);
114 } else { 121 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
115 be_mcc_compl_process(adapter, compl); 122 status = be_mcc_compl_process(adapter, compl);
116 atomic_dec(&adapter->mcc_obj.q.used); 123 atomic_dec(&adapter->mcc_obj.q.used);
117 } 124 }
118 be_mcc_compl_use(compl); 125 be_mcc_compl_use(compl);
119 num++; 126 num++;
120 } 127 }
128
121 if (num) 129 if (num)
122 be_cq_notify(adapter, adapter->mcc_obj.cq.id, true, num); 130 be_cq_notify(adapter, adapter->mcc_obj.cq.id, true, num);
131
123 spin_unlock_bh(&adapter->mcc_cq_lock); 132 spin_unlock_bh(&adapter->mcc_cq_lock);
133 return status;
124} 134}
125 135
126/* Wait till no more pending mcc requests are present */ 136/* Wait till no more pending mcc requests are present */
127static void be_mcc_wait_compl(struct be_adapter *adapter) 137static int be_mcc_wait_compl(struct be_adapter *adapter)
128{ 138{
129#define mcc_timeout 50000 /* 5s timeout */ 139#define mcc_timeout 120000 /* 12s timeout */
130 int i; 140 int i, status;
131 for (i = 0; i < mcc_timeout; i++) { 141 for (i = 0; i < mcc_timeout; i++) {
132 be_process_mcc(adapter); 142 status = be_process_mcc(adapter);
143 if (status)
144 return status;
145
133 if (atomic_read(&adapter->mcc_obj.q.used) == 0) 146 if (atomic_read(&adapter->mcc_obj.q.used) == 0)
134 break; 147 break;
135 udelay(100); 148 udelay(100);
136 } 149 }
137 if (i == mcc_timeout) 150 if (i == mcc_timeout) {
138 dev_err(&adapter->pdev->dev, "mccq poll timed out\n"); 151 dev_err(&adapter->pdev->dev, "mccq poll timed out\n");
152 return -1;
153 }
154 return 0;
139} 155}
140 156
141/* Notify MCC requests and wait for completion */ 157/* Notify MCC requests and wait for completion */
142static void be_mcc_notify_wait(struct be_adapter *adapter) 158static int be_mcc_notify_wait(struct be_adapter *adapter)
143{ 159{
144 be_mcc_notify(adapter); 160 be_mcc_notify(adapter);
145 be_mcc_wait_compl(adapter); 161 return be_mcc_wait_compl(adapter);
146} 162}
147 163
148static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) 164static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
@@ -173,7 +189,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
173 * Insert the mailbox address into the doorbell in two steps 189 * Insert the mailbox address into the doorbell in two steps
174 * Polls on the mbox doorbell till a command completion (or a timeout) occurs 190 * Polls on the mbox doorbell till a command completion (or a timeout) occurs
175 */ 191 */
176static int be_mbox_notify(struct be_adapter *adapter) 192static int be_mbox_notify_wait(struct be_adapter *adapter)
177{ 193{
178 int status; 194 int status;
179 u32 val = 0; 195 u32 val = 0;
@@ -182,8 +198,6 @@ static int be_mbox_notify(struct be_adapter *adapter)
182 struct be_mcc_mailbox *mbox = mbox_mem->va; 198 struct be_mcc_mailbox *mbox = mbox_mem->va;
183 struct be_mcc_compl *compl = &mbox->compl; 199 struct be_mcc_compl *compl = &mbox->compl;
184 200
185 memset(compl, 0, sizeof(*compl));
186
187 val |= MPU_MAILBOX_DB_HI_MASK; 201 val |= MPU_MAILBOX_DB_HI_MASK;
188 /* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */ 202 /* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
189 val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2; 203 val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
@@ -310,34 +324,40 @@ static u32 eq_delay_to_mult(u32 usec_delay)
310 return multiplier; 324 return multiplier;
311} 325}
312 326
313static inline struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem) 327static inline struct be_mcc_wrb *wrb_from_mbox(struct be_adapter *adapter)
314{ 328{
315 return &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb; 329 struct be_dma_mem *mbox_mem = &adapter->mbox_mem;
330 struct be_mcc_wrb *wrb
331 = &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb;
332 memset(wrb, 0, sizeof(*wrb));
333 return wrb;
316} 334}
317 335
318static inline struct be_mcc_wrb *wrb_from_mcc(struct be_queue_info *mccq) 336static struct be_mcc_wrb *wrb_from_mccq(struct be_adapter *adapter)
319{ 337{
320 struct be_mcc_wrb *wrb = NULL; 338 struct be_queue_info *mccq = &adapter->mcc_obj.q;
321 if (atomic_read(&mccq->used) < mccq->len) { 339 struct be_mcc_wrb *wrb;
322 wrb = queue_head_node(mccq); 340
323 queue_head_inc(mccq); 341 BUG_ON(atomic_read(&mccq->used) >= mccq->len);
324 atomic_inc(&mccq->used); 342 wrb = queue_head_node(mccq);
325 memset(wrb, 0, sizeof(*wrb)); 343 queue_head_inc(mccq);
326 } 344 atomic_inc(&mccq->used);
345 memset(wrb, 0, sizeof(*wrb));
327 return wrb; 346 return wrb;
328} 347}
329 348
330int be_cmd_eq_create(struct be_adapter *adapter, 349int be_cmd_eq_create(struct be_adapter *adapter,
331 struct be_queue_info *eq, int eq_delay) 350 struct be_queue_info *eq, int eq_delay)
332{ 351{
333 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 352 struct be_mcc_wrb *wrb;
334 struct be_cmd_req_eq_create *req = embedded_payload(wrb); 353 struct be_cmd_req_eq_create *req;
335 struct be_cmd_resp_eq_create *resp = embedded_payload(wrb);
336 struct be_dma_mem *q_mem = &eq->dma_mem; 354 struct be_dma_mem *q_mem = &eq->dma_mem;
337 int status; 355 int status;
338 356
339 spin_lock(&adapter->mbox_lock); 357 spin_lock(&adapter->mbox_lock);
340 memset(wrb, 0, sizeof(*wrb)); 358
359 wrb = wrb_from_mbox(adapter);
360 req = embedded_payload(wrb);
341 361
342 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 362 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
343 363
@@ -359,25 +379,29 @@ int be_cmd_eq_create(struct be_adapter *adapter,
359 379
360 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 380 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
361 381
362 status = be_mbox_notify(adapter); 382 status = be_mbox_notify_wait(adapter);
363 if (!status) { 383 if (!status) {
384 struct be_cmd_resp_eq_create *resp = embedded_payload(wrb);
364 eq->id = le16_to_cpu(resp->eq_id); 385 eq->id = le16_to_cpu(resp->eq_id);
365 eq->created = true; 386 eq->created = true;
366 } 387 }
388
367 spin_unlock(&adapter->mbox_lock); 389 spin_unlock(&adapter->mbox_lock);
368 return status; 390 return status;
369} 391}
370 392
393/* Uses mbox */
371int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, 394int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
372 u8 type, bool permanent, u32 if_handle) 395 u8 type, bool permanent, u32 if_handle)
373{ 396{
374 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 397 struct be_mcc_wrb *wrb;
375 struct be_cmd_req_mac_query *req = embedded_payload(wrb); 398 struct be_cmd_req_mac_query *req;
376 struct be_cmd_resp_mac_query *resp = embedded_payload(wrb);
377 int status; 399 int status;
378 400
379 spin_lock(&adapter->mbox_lock); 401 spin_lock(&adapter->mbox_lock);
380 memset(wrb, 0, sizeof(*wrb)); 402
403 wrb = wrb_from_mbox(adapter);
404 req = embedded_payload(wrb);
381 405
382 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 406 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
383 407
@@ -388,27 +412,32 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
388 if (permanent) { 412 if (permanent) {
389 req->permanent = 1; 413 req->permanent = 1;
390 } else { 414 } else {
391 req->if_id = cpu_to_le16((u16)if_handle); 415 req->if_id = cpu_to_le16((u16) if_handle);
392 req->permanent = 0; 416 req->permanent = 0;
393 } 417 }
394 418
395 status = be_mbox_notify(adapter); 419 status = be_mbox_notify_wait(adapter);
396 if (!status) 420 if (!status) {
421 struct be_cmd_resp_mac_query *resp = embedded_payload(wrb);
397 memcpy(mac_addr, resp->mac.addr, ETH_ALEN); 422 memcpy(mac_addr, resp->mac.addr, ETH_ALEN);
423 }
398 424
399 spin_unlock(&adapter->mbox_lock); 425 spin_unlock(&adapter->mbox_lock);
400 return status; 426 return status;
401} 427}
402 428
429/* Uses synchronous MCCQ */
403int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, 430int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
404 u32 if_id, u32 *pmac_id) 431 u32 if_id, u32 *pmac_id)
405{ 432{
406 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 433 struct be_mcc_wrb *wrb;
407 struct be_cmd_req_pmac_add *req = embedded_payload(wrb); 434 struct be_cmd_req_pmac_add *req;
408 int status; 435 int status;
409 436
410 spin_lock(&adapter->mbox_lock); 437 spin_lock_bh(&adapter->mcc_lock);
411 memset(wrb, 0, sizeof(*wrb)); 438
439 wrb = wrb_from_mccq(adapter);
440 req = embedded_payload(wrb);
412 441
413 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 442 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
414 443
@@ -418,24 +447,27 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
418 req->if_id = cpu_to_le32(if_id); 447 req->if_id = cpu_to_le32(if_id);
419 memcpy(req->mac_address, mac_addr, ETH_ALEN); 448 memcpy(req->mac_address, mac_addr, ETH_ALEN);
420 449
421 status = be_mbox_notify(adapter); 450 status = be_mcc_notify_wait(adapter);
422 if (!status) { 451 if (!status) {
423 struct be_cmd_resp_pmac_add *resp = embedded_payload(wrb); 452 struct be_cmd_resp_pmac_add *resp = embedded_payload(wrb);
424 *pmac_id = le32_to_cpu(resp->pmac_id); 453 *pmac_id = le32_to_cpu(resp->pmac_id);
425 } 454 }
426 455
427 spin_unlock(&adapter->mbox_lock); 456 spin_unlock_bh(&adapter->mcc_lock);
428 return status; 457 return status;
429} 458}
430 459
460/* Uses synchronous MCCQ */
431int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id) 461int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id)
432{ 462{
433 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 463 struct be_mcc_wrb *wrb;
434 struct be_cmd_req_pmac_del *req = embedded_payload(wrb); 464 struct be_cmd_req_pmac_del *req;
435 int status; 465 int status;
436 466
437 spin_lock(&adapter->mbox_lock); 467 spin_lock_bh(&adapter->mcc_lock);
438 memset(wrb, 0, sizeof(*wrb)); 468
469 wrb = wrb_from_mccq(adapter);
470 req = embedded_payload(wrb);
439 471
440 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 472 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
441 473
@@ -445,25 +477,29 @@ int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id)
445 req->if_id = cpu_to_le32(if_id); 477 req->if_id = cpu_to_le32(if_id);
446 req->pmac_id = cpu_to_le32(pmac_id); 478 req->pmac_id = cpu_to_le32(pmac_id);
447 479
448 status = be_mbox_notify(adapter); 480 status = be_mcc_notify_wait(adapter);
449 spin_unlock(&adapter->mbox_lock); 481
482 spin_unlock_bh(&adapter->mcc_lock);
450 483
451 return status; 484 return status;
452} 485}
453 486
487/* Uses Mbox */
454int be_cmd_cq_create(struct be_adapter *adapter, 488int be_cmd_cq_create(struct be_adapter *adapter,
455 struct be_queue_info *cq, struct be_queue_info *eq, 489 struct be_queue_info *cq, struct be_queue_info *eq,
456 bool sol_evts, bool no_delay, int coalesce_wm) 490 bool sol_evts, bool no_delay, int coalesce_wm)
457{ 491{
458 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 492 struct be_mcc_wrb *wrb;
459 struct be_cmd_req_cq_create *req = embedded_payload(wrb); 493 struct be_cmd_req_cq_create *req;
460 struct be_cmd_resp_cq_create *resp = embedded_payload(wrb);
461 struct be_dma_mem *q_mem = &cq->dma_mem; 494 struct be_dma_mem *q_mem = &cq->dma_mem;
462 void *ctxt = &req->context; 495 void *ctxt;
463 int status; 496 int status;
464 497
465 spin_lock(&adapter->mbox_lock); 498 spin_lock(&adapter->mbox_lock);
466 memset(wrb, 0, sizeof(*wrb)); 499
500 wrb = wrb_from_mbox(adapter);
501 req = embedded_payload(wrb);
502 ctxt = &req->context;
467 503
468 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 504 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
469 505
@@ -486,11 +522,13 @@ int be_cmd_cq_create(struct be_adapter *adapter,
486 522
487 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 523 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
488 524
489 status = be_mbox_notify(adapter); 525 status = be_mbox_notify_wait(adapter);
490 if (!status) { 526 if (!status) {
527 struct be_cmd_resp_cq_create *resp = embedded_payload(wrb);
491 cq->id = le16_to_cpu(resp->cq_id); 528 cq->id = le16_to_cpu(resp->cq_id);
492 cq->created = true; 529 cq->created = true;
493 } 530 }
531
494 spin_unlock(&adapter->mbox_lock); 532 spin_unlock(&adapter->mbox_lock);
495 533
496 return status; 534 return status;
@@ -508,14 +546,17 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
508 struct be_queue_info *mccq, 546 struct be_queue_info *mccq,
509 struct be_queue_info *cq) 547 struct be_queue_info *cq)
510{ 548{
511 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 549 struct be_mcc_wrb *wrb;
512 struct be_cmd_req_mcc_create *req = embedded_payload(wrb); 550 struct be_cmd_req_mcc_create *req;
513 struct be_dma_mem *q_mem = &mccq->dma_mem; 551 struct be_dma_mem *q_mem = &mccq->dma_mem;
514 void *ctxt = &req->context; 552 void *ctxt;
515 int status; 553 int status;
516 554
517 spin_lock(&adapter->mbox_lock); 555 spin_lock(&adapter->mbox_lock);
518 memset(wrb, 0, sizeof(*wrb)); 556
557 wrb = wrb_from_mbox(adapter);
558 req = embedded_payload(wrb);
559 ctxt = &req->context;
519 560
520 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 561 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
521 562
@@ -534,7 +575,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
534 575
535 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 576 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
536 577
537 status = be_mbox_notify(adapter); 578 status = be_mbox_notify_wait(adapter);
538 if (!status) { 579 if (!status) {
539 struct be_cmd_resp_mcc_create *resp = embedded_payload(wrb); 580 struct be_cmd_resp_mcc_create *resp = embedded_payload(wrb);
540 mccq->id = le16_to_cpu(resp->id); 581 mccq->id = le16_to_cpu(resp->id);
@@ -549,15 +590,17 @@ int be_cmd_txq_create(struct be_adapter *adapter,
549 struct be_queue_info *txq, 590 struct be_queue_info *txq,
550 struct be_queue_info *cq) 591 struct be_queue_info *cq)
551{ 592{
552 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 593 struct be_mcc_wrb *wrb;
553 struct be_cmd_req_eth_tx_create *req = embedded_payload(wrb); 594 struct be_cmd_req_eth_tx_create *req;
554 struct be_dma_mem *q_mem = &txq->dma_mem; 595 struct be_dma_mem *q_mem = &txq->dma_mem;
555 void *ctxt = &req->context; 596 void *ctxt;
556 int status; 597 int status;
557 u32 len_encoded;
558 598
559 spin_lock(&adapter->mbox_lock); 599 spin_lock(&adapter->mbox_lock);
560 memset(wrb, 0, sizeof(*wrb)); 600
601 wrb = wrb_from_mbox(adapter);
602 req = embedded_payload(wrb);
603 ctxt = &req->context;
561 604
562 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 605 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
563 606
@@ -568,10 +611,8 @@ int be_cmd_txq_create(struct be_adapter *adapter,
568 req->ulp_num = BE_ULP1_NUM; 611 req->ulp_num = BE_ULP1_NUM;
569 req->type = BE_ETH_TX_RING_TYPE_STANDARD; 612 req->type = BE_ETH_TX_RING_TYPE_STANDARD;
570 613
571 len_encoded = fls(txq->len); /* log2(len) + 1 */ 614 AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt,
572 if (len_encoded == 16) 615 be_encoded_q_len(txq->len));
573 len_encoded = 0;
574 AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, len_encoded);
575 AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt, 616 AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt,
576 be_pci_func(adapter)); 617 be_pci_func(adapter));
577 AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); 618 AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1);
@@ -581,28 +622,32 @@ int be_cmd_txq_create(struct be_adapter *adapter,
581 622
582 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 623 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
583 624
584 status = be_mbox_notify(adapter); 625 status = be_mbox_notify_wait(adapter);
585 if (!status) { 626 if (!status) {
586 struct be_cmd_resp_eth_tx_create *resp = embedded_payload(wrb); 627 struct be_cmd_resp_eth_tx_create *resp = embedded_payload(wrb);
587 txq->id = le16_to_cpu(resp->cid); 628 txq->id = le16_to_cpu(resp->cid);
588 txq->created = true; 629 txq->created = true;
589 } 630 }
631
590 spin_unlock(&adapter->mbox_lock); 632 spin_unlock(&adapter->mbox_lock);
591 633
592 return status; 634 return status;
593} 635}
594 636
637/* Uses mbox */
595int be_cmd_rxq_create(struct be_adapter *adapter, 638int be_cmd_rxq_create(struct be_adapter *adapter,
596 struct be_queue_info *rxq, u16 cq_id, u16 frag_size, 639 struct be_queue_info *rxq, u16 cq_id, u16 frag_size,
597 u16 max_frame_size, u32 if_id, u32 rss) 640 u16 max_frame_size, u32 if_id, u32 rss)
598{ 641{
599 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 642 struct be_mcc_wrb *wrb;
600 struct be_cmd_req_eth_rx_create *req = embedded_payload(wrb); 643 struct be_cmd_req_eth_rx_create *req;
601 struct be_dma_mem *q_mem = &rxq->dma_mem; 644 struct be_dma_mem *q_mem = &rxq->dma_mem;
602 int status; 645 int status;
603 646
604 spin_lock(&adapter->mbox_lock); 647 spin_lock(&adapter->mbox_lock);
605 memset(wrb, 0, sizeof(*wrb)); 648
649 wrb = wrb_from_mbox(adapter);
650 req = embedded_payload(wrb);
606 651
607 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 652 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
608 653
@@ -617,29 +662,34 @@ int be_cmd_rxq_create(struct be_adapter *adapter,
617 req->max_frame_size = cpu_to_le16(max_frame_size); 662 req->max_frame_size = cpu_to_le16(max_frame_size);
618 req->rss_queue = cpu_to_le32(rss); 663 req->rss_queue = cpu_to_le32(rss);
619 664
620 status = be_mbox_notify(adapter); 665 status = be_mbox_notify_wait(adapter);
621 if (!status) { 666 if (!status) {
622 struct be_cmd_resp_eth_rx_create *resp = embedded_payload(wrb); 667 struct be_cmd_resp_eth_rx_create *resp = embedded_payload(wrb);
623 rxq->id = le16_to_cpu(resp->id); 668 rxq->id = le16_to_cpu(resp->id);
624 rxq->created = true; 669 rxq->created = true;
625 } 670 }
671
626 spin_unlock(&adapter->mbox_lock); 672 spin_unlock(&adapter->mbox_lock);
627 673
628 return status; 674 return status;
629} 675}
630 676
631/* Generic destroyer function for all types of queues */ 677/* Generic destroyer function for all types of queues
678 * Uses Mbox
679 */
632int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, 680int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
633 int queue_type) 681 int queue_type)
634{ 682{
635 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 683 struct be_mcc_wrb *wrb;
636 struct be_cmd_req_q_destroy *req = embedded_payload(wrb); 684 struct be_cmd_req_q_destroy *req;
637 u8 subsys = 0, opcode = 0; 685 u8 subsys = 0, opcode = 0;
638 int status; 686 int status;
639 687
640 spin_lock(&adapter->mbox_lock); 688 spin_lock(&adapter->mbox_lock);
641 689
642 memset(wrb, 0, sizeof(*wrb)); 690 wrb = wrb_from_mbox(adapter);
691 req = embedded_payload(wrb);
692
643 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 693 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
644 694
645 switch (queue_type) { 695 switch (queue_type) {
@@ -669,23 +719,27 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
669 be_cmd_hdr_prepare(&req->hdr, subsys, opcode, sizeof(*req)); 719 be_cmd_hdr_prepare(&req->hdr, subsys, opcode, sizeof(*req));
670 req->id = cpu_to_le16(q->id); 720 req->id = cpu_to_le16(q->id);
671 721
672 status = be_mbox_notify(adapter); 722 status = be_mbox_notify_wait(adapter);
673 723
674 spin_unlock(&adapter->mbox_lock); 724 spin_unlock(&adapter->mbox_lock);
675 725
676 return status; 726 return status;
677} 727}
678 728
679/* Create an rx filtering policy configuration on an i/f */ 729/* Create an rx filtering policy configuration on an i/f
730 * Uses mbox
731 */
680int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac, 732int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac,
681 bool pmac_invalid, u32 *if_handle, u32 *pmac_id) 733 bool pmac_invalid, u32 *if_handle, u32 *pmac_id)
682{ 734{
683 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 735 struct be_mcc_wrb *wrb;
684 struct be_cmd_req_if_create *req = embedded_payload(wrb); 736 struct be_cmd_req_if_create *req;
685 int status; 737 int status;
686 738
687 spin_lock(&adapter->mbox_lock); 739 spin_lock(&adapter->mbox_lock);
688 memset(wrb, 0, sizeof(*wrb)); 740
741 wrb = wrb_from_mbox(adapter);
742 req = embedded_payload(wrb);
689 743
690 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 744 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
691 745
@@ -694,10 +748,11 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac,
694 748
695 req->capability_flags = cpu_to_le32(flags); 749 req->capability_flags = cpu_to_le32(flags);
696 req->enable_flags = cpu_to_le32(flags); 750 req->enable_flags = cpu_to_le32(flags);
751 req->pmac_invalid = pmac_invalid;
697 if (!pmac_invalid) 752 if (!pmac_invalid)
698 memcpy(req->mac_addr, mac, ETH_ALEN); 753 memcpy(req->mac_addr, mac, ETH_ALEN);
699 754
700 status = be_mbox_notify(adapter); 755 status = be_mbox_notify_wait(adapter);
701 if (!status) { 756 if (!status) {
702 struct be_cmd_resp_if_create *resp = embedded_payload(wrb); 757 struct be_cmd_resp_if_create *resp = embedded_payload(wrb);
703 *if_handle = le32_to_cpu(resp->interface_id); 758 *if_handle = le32_to_cpu(resp->interface_id);
@@ -709,14 +764,17 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac,
709 return status; 764 return status;
710} 765}
711 766
767/* Uses mbox */
712int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id) 768int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
713{ 769{
714 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 770 struct be_mcc_wrb *wrb;
715 struct be_cmd_req_if_destroy *req = embedded_payload(wrb); 771 struct be_cmd_req_if_destroy *req;
716 int status; 772 int status;
717 773
718 spin_lock(&adapter->mbox_lock); 774 spin_lock(&adapter->mbox_lock);
719 memset(wrb, 0, sizeof(*wrb)); 775
776 wrb = wrb_from_mbox(adapter);
777 req = embedded_payload(wrb);
720 778
721 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 779 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
722 780
@@ -724,7 +782,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
724 OPCODE_COMMON_NTWK_INTERFACE_DESTROY, sizeof(*req)); 782 OPCODE_COMMON_NTWK_INTERFACE_DESTROY, sizeof(*req));
725 783
726 req->interface_id = cpu_to_le32(interface_id); 784 req->interface_id = cpu_to_le32(interface_id);
727 status = be_mbox_notify(adapter); 785
786 status = be_mbox_notify_wait(adapter);
728 787
729 spin_unlock(&adapter->mbox_lock); 788 spin_unlock(&adapter->mbox_lock);
730 789
@@ -733,20 +792,22 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
733 792
734/* Get stats is a non embedded command: the request is not embedded inside 793/* Get stats is a non embedded command: the request is not embedded inside
735 * WRB but is a separate dma memory block 794 * WRB but is a separate dma memory block
795 * Uses asynchronous MCC
736 */ 796 */
737int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) 797int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
738{ 798{
739 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 799 struct be_mcc_wrb *wrb;
740 struct be_cmd_req_get_stats *req = nonemb_cmd->va; 800 struct be_cmd_req_get_stats *req;
741 struct be_sge *sge = nonembedded_sgl(wrb); 801 struct be_sge *sge;
742 int status;
743 802
744 spin_lock(&adapter->mbox_lock); 803 spin_lock_bh(&adapter->mcc_lock);
745 memset(wrb, 0, sizeof(*wrb));
746 804
747 memset(req, 0, sizeof(*req)); 805 wrb = wrb_from_mccq(adapter);
806 req = nonemb_cmd->va;
807 sge = nonembedded_sgl(wrb);
748 808
749 be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); 809 be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
810 wrb->tag0 = OPCODE_ETH_GET_STATISTICS;
750 811
751 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, 812 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
752 OPCODE_ETH_GET_STATISTICS, sizeof(*req)); 813 OPCODE_ETH_GET_STATISTICS, sizeof(*req));
@@ -754,59 +815,61 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
754 sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); 815 sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
755 sge->len = cpu_to_le32(nonemb_cmd->size); 816 sge->len = cpu_to_le32(nonemb_cmd->size);
756 817
757 status = be_mbox_notify(adapter); 818 be_mcc_notify(adapter);
758 if (!status) {
759 struct be_cmd_resp_get_stats *resp = nonemb_cmd->va;
760 be_dws_le_to_cpu(&resp->hw_stats, sizeof(resp->hw_stats));
761 }
762 819
763 spin_unlock(&adapter->mbox_lock); 820 spin_unlock_bh(&adapter->mcc_lock);
764 return status; 821 return 0;
765} 822}
766 823
824/* Uses synchronous mcc */
767int be_cmd_link_status_query(struct be_adapter *adapter, 825int be_cmd_link_status_query(struct be_adapter *adapter,
768 bool *link_up) 826 bool *link_up)
769{ 827{
770 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 828 struct be_mcc_wrb *wrb;
771 struct be_cmd_req_link_status *req = embedded_payload(wrb); 829 struct be_cmd_req_link_status *req;
772 int status; 830 int status;
773 831
774 spin_lock(&adapter->mbox_lock); 832 spin_lock_bh(&adapter->mcc_lock);
833
834 wrb = wrb_from_mccq(adapter);
835 req = embedded_payload(wrb);
775 836
776 *link_up = false; 837 *link_up = false;
777 memset(wrb, 0, sizeof(*wrb));
778 838
779 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 839 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
780 840
781 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 841 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
782 OPCODE_COMMON_NTWK_LINK_STATUS_QUERY, sizeof(*req)); 842 OPCODE_COMMON_NTWK_LINK_STATUS_QUERY, sizeof(*req));
783 843
784 status = be_mbox_notify(adapter); 844 status = be_mcc_notify_wait(adapter);
785 if (!status) { 845 if (!status) {
786 struct be_cmd_resp_link_status *resp = embedded_payload(wrb); 846 struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
787 if (resp->mac_speed != PHY_LINK_SPEED_ZERO) 847 if (resp->mac_speed != PHY_LINK_SPEED_ZERO)
788 *link_up = true; 848 *link_up = true;
789 } 849 }
790 850
791 spin_unlock(&adapter->mbox_lock); 851 spin_unlock_bh(&adapter->mcc_lock);
792 return status; 852 return status;
793} 853}
794 854
855/* Uses Mbox */
795int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver) 856int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
796{ 857{
797 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 858 struct be_mcc_wrb *wrb;
798 struct be_cmd_req_get_fw_version *req = embedded_payload(wrb); 859 struct be_cmd_req_get_fw_version *req;
799 int status; 860 int status;
800 861
801 spin_lock(&adapter->mbox_lock); 862 spin_lock(&adapter->mbox_lock);
802 memset(wrb, 0, sizeof(*wrb)); 863
864 wrb = wrb_from_mbox(adapter);
865 req = embedded_payload(wrb);
803 866
804 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 867 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
805 868
806 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 869 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
807 OPCODE_COMMON_GET_FW_VERSION, sizeof(*req)); 870 OPCODE_COMMON_GET_FW_VERSION, sizeof(*req));
808 871
809 status = be_mbox_notify(adapter); 872 status = be_mbox_notify_wait(adapter);
810 if (!status) { 873 if (!status) {
811 struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb); 874 struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb);
812 strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); 875 strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN);
@@ -816,15 +879,18 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
816 return status; 879 return status;
817} 880}
818 881
819/* set the EQ delay interval of an EQ to specified value */ 882/* set the EQ delay interval of an EQ to specified value
883 * Uses async mcc
884 */
820int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd) 885int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd)
821{ 886{
822 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 887 struct be_mcc_wrb *wrb;
823 struct be_cmd_req_modify_eq_delay *req = embedded_payload(wrb); 888 struct be_cmd_req_modify_eq_delay *req;
824 int status;
825 889
826 spin_lock(&adapter->mbox_lock); 890 spin_lock_bh(&adapter->mcc_lock);
827 memset(wrb, 0, sizeof(*wrb)); 891
892 wrb = wrb_from_mccq(adapter);
893 req = embedded_payload(wrb);
828 894
829 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 895 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
830 896
@@ -836,21 +902,24 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd)
836 req->delay[0].phase = 0; 902 req->delay[0].phase = 0;
837 req->delay[0].delay_multiplier = cpu_to_le32(eqd); 903 req->delay[0].delay_multiplier = cpu_to_le32(eqd);
838 904
839 status = be_mbox_notify(adapter); 905 be_mcc_notify(adapter);
840 906
841 spin_unlock(&adapter->mbox_lock); 907 spin_unlock_bh(&adapter->mcc_lock);
842 return status; 908 return 0;
843} 909}
844 910
911/* Uses sycnhronous mcc */
845int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, 912int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
846 u32 num, bool untagged, bool promiscuous) 913 u32 num, bool untagged, bool promiscuous)
847{ 914{
848 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 915 struct be_mcc_wrb *wrb;
849 struct be_cmd_req_vlan_config *req = embedded_payload(wrb); 916 struct be_cmd_req_vlan_config *req;
850 int status; 917 int status;
851 918
852 spin_lock(&adapter->mbox_lock); 919 spin_lock_bh(&adapter->mcc_lock);
853 memset(wrb, 0, sizeof(*wrb)); 920
921 wrb = wrb_from_mccq(adapter);
922 req = embedded_payload(wrb);
854 923
855 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 924 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
856 925
@@ -866,23 +935,24 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
866 req->num_vlan * sizeof(vtag_array[0])); 935 req->num_vlan * sizeof(vtag_array[0]));
867 } 936 }
868 937
869 status = be_mbox_notify(adapter); 938 status = be_mcc_notify_wait(adapter);
870 939
871 spin_unlock(&adapter->mbox_lock); 940 spin_unlock_bh(&adapter->mcc_lock);
872 return status; 941 return status;
873} 942}
874 943
875/* Use MCC for this command as it may be called in BH context */ 944/* Uses MCC for this command as it may be called in BH context
945 * Uses synchronous mcc
946 */
876int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en) 947int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en)
877{ 948{
878 struct be_mcc_wrb *wrb; 949 struct be_mcc_wrb *wrb;
879 struct be_cmd_req_promiscuous_config *req; 950 struct be_cmd_req_promiscuous_config *req;
951 int status;
880 952
881 spin_lock_bh(&adapter->mcc_lock); 953 spin_lock_bh(&adapter->mcc_lock);
882 954
883 wrb = wrb_from_mcc(&adapter->mcc_obj.q); 955 wrb = wrb_from_mccq(adapter);
884 BUG_ON(!wrb);
885
886 req = embedded_payload(wrb); 956 req = embedded_payload(wrb);
887 957
888 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 958 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
@@ -895,14 +965,14 @@ int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en)
895 else 965 else
896 req->port0_promiscuous = en; 966 req->port0_promiscuous = en;
897 967
898 be_mcc_notify_wait(adapter); 968 status = be_mcc_notify_wait(adapter);
899 969
900 spin_unlock_bh(&adapter->mcc_lock); 970 spin_unlock_bh(&adapter->mcc_lock);
901 return 0; 971 return status;
902} 972}
903 973
904/* 974/*
905 * Use MCC for this command as it may be called in BH context 975 * Uses MCC for this command as it may be called in BH context
906 * (mc == NULL) => multicast promiscous 976 * (mc == NULL) => multicast promiscous
907 */ 977 */
908int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, 978int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
@@ -914,9 +984,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
914 984
915 spin_lock_bh(&adapter->mcc_lock); 985 spin_lock_bh(&adapter->mcc_lock);
916 986
917 wrb = wrb_from_mcc(&adapter->mcc_obj.q); 987 wrb = wrb_from_mccq(adapter);
918 BUG_ON(!wrb);
919
920 req = embedded_payload(wrb); 988 req = embedded_payload(wrb);
921 989
922 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 990 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
@@ -944,15 +1012,17 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
944 return 0; 1012 return 0;
945} 1013}
946 1014
1015/* Uses synchrounous mcc */
947int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc) 1016int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc)
948{ 1017{
949 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 1018 struct be_mcc_wrb *wrb;
950 struct be_cmd_req_set_flow_control *req = embedded_payload(wrb); 1019 struct be_cmd_req_set_flow_control *req;
951 int status; 1020 int status;
952 1021
953 spin_lock(&adapter->mbox_lock); 1022 spin_lock_bh(&adapter->mcc_lock);
954 1023
955 memset(wrb, 0, sizeof(*wrb)); 1024 wrb = wrb_from_mccq(adapter);
1025 req = embedded_payload(wrb);
956 1026
957 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 1027 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
958 1028
@@ -962,28 +1032,30 @@ int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc)
962 req->tx_flow_control = cpu_to_le16((u16)tx_fc); 1032 req->tx_flow_control = cpu_to_le16((u16)tx_fc);
963 req->rx_flow_control = cpu_to_le16((u16)rx_fc); 1033 req->rx_flow_control = cpu_to_le16((u16)rx_fc);
964 1034
965 status = be_mbox_notify(adapter); 1035 status = be_mcc_notify_wait(adapter);
966 1036
967 spin_unlock(&adapter->mbox_lock); 1037 spin_unlock_bh(&adapter->mcc_lock);
968 return status; 1038 return status;
969} 1039}
970 1040
1041/* Uses sycn mcc */
971int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) 1042int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
972{ 1043{
973 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 1044 struct be_mcc_wrb *wrb;
974 struct be_cmd_req_get_flow_control *req = embedded_payload(wrb); 1045 struct be_cmd_req_get_flow_control *req;
975 int status; 1046 int status;
976 1047
977 spin_lock(&adapter->mbox_lock); 1048 spin_lock_bh(&adapter->mcc_lock);
978 1049
979 memset(wrb, 0, sizeof(*wrb)); 1050 wrb = wrb_from_mccq(adapter);
1051 req = embedded_payload(wrb);
980 1052
981 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 1053 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
982 1054
983 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 1055 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
984 OPCODE_COMMON_GET_FLOW_CONTROL, sizeof(*req)); 1056 OPCODE_COMMON_GET_FLOW_CONTROL, sizeof(*req));
985 1057
986 status = be_mbox_notify(adapter); 1058 status = be_mcc_notify_wait(adapter);
987 if (!status) { 1059 if (!status) {
988 struct be_cmd_resp_get_flow_control *resp = 1060 struct be_cmd_resp_get_flow_control *resp =
989 embedded_payload(wrb); 1061 embedded_payload(wrb);
@@ -991,26 +1063,28 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
991 *rx_fc = le16_to_cpu(resp->rx_flow_control); 1063 *rx_fc = le16_to_cpu(resp->rx_flow_control);
992 } 1064 }
993 1065
994 spin_unlock(&adapter->mbox_lock); 1066 spin_unlock_bh(&adapter->mcc_lock);
995 return status; 1067 return status;
996} 1068}
997 1069
1070/* Uses mbox */
998int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num) 1071int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num)
999{ 1072{
1000 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 1073 struct be_mcc_wrb *wrb;
1001 struct be_cmd_req_query_fw_cfg *req = embedded_payload(wrb); 1074 struct be_cmd_req_query_fw_cfg *req;
1002 int status; 1075 int status;
1003 1076
1004 spin_lock(&adapter->mbox_lock); 1077 spin_lock(&adapter->mbox_lock);
1005 1078
1006 memset(wrb, 0, sizeof(*wrb)); 1079 wrb = wrb_from_mbox(adapter);
1080 req = embedded_payload(wrb);
1007 1081
1008 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 1082 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1009 1083
1010 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 1084 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1011 OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req)); 1085 OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req));
1012 1086
1013 status = be_mbox_notify(adapter); 1087 status = be_mbox_notify_wait(adapter);
1014 if (!status) { 1088 if (!status) {
1015 struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb); 1089 struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb);
1016 *port_num = le32_to_cpu(resp->phys_port); 1090 *port_num = le32_to_cpu(resp->phys_port);
@@ -1020,22 +1094,24 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num)
1020 return status; 1094 return status;
1021} 1095}
1022 1096
1097/* Uses mbox */
1023int be_cmd_reset_function(struct be_adapter *adapter) 1098int be_cmd_reset_function(struct be_adapter *adapter)
1024{ 1099{
1025 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 1100 struct be_mcc_wrb *wrb;
1026 struct be_cmd_req_hdr *req = embedded_payload(wrb); 1101 struct be_cmd_req_hdr *req;
1027 int status; 1102 int status;
1028 1103
1029 spin_lock(&adapter->mbox_lock); 1104 spin_lock(&adapter->mbox_lock);
1030 1105
1031 memset(wrb, 0, sizeof(*wrb)); 1106 wrb = wrb_from_mbox(adapter);
1107 req = embedded_payload(wrb);
1032 1108
1033 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 1109 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1034 1110
1035 be_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON, 1111 be_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON,
1036 OPCODE_COMMON_FUNCTION_RESET, sizeof(*req)); 1112 OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
1037 1113
1038 status = be_mbox_notify(adapter); 1114 status = be_mbox_notify_wait(adapter);
1039 1115
1040 spin_unlock(&adapter->mbox_lock); 1116 spin_unlock(&adapter->mbox_lock);
1041 return status; 1117 return status;
@@ -1044,13 +1120,17 @@ int be_cmd_reset_function(struct be_adapter *adapter)
1044int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, 1120int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
1045 u32 flash_type, u32 flash_opcode, u32 buf_size) 1121 u32 flash_type, u32 flash_opcode, u32 buf_size)
1046{ 1122{
1047 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem); 1123 struct be_mcc_wrb *wrb;
1048 struct be_cmd_write_flashrom *req = cmd->va; 1124 struct be_cmd_write_flashrom *req = cmd->va;
1049 struct be_sge *sge = nonembedded_sgl(wrb); 1125 struct be_sge *sge;
1050 int status; 1126 int status;
1051 1127
1052 spin_lock(&adapter->mbox_lock); 1128 spin_lock_bh(&adapter->mcc_lock);
1053 memset(wrb, 0, sizeof(*wrb)); 1129
1130 wrb = wrb_from_mccq(adapter);
1131 req = embedded_payload(wrb);
1132 sge = nonembedded_sgl(wrb);
1133
1054 be_wrb_hdr_prepare(wrb, cmd->size, false, 1); 1134 be_wrb_hdr_prepare(wrb, cmd->size, false, 1);
1055 1135
1056 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 1136 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
@@ -1063,8 +1143,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
1063 req->params.op_code = cpu_to_le32(flash_opcode); 1143 req->params.op_code = cpu_to_le32(flash_opcode);
1064 req->params.data_buf_size = cpu_to_le32(buf_size); 1144 req->params.data_buf_size = cpu_to_le32(buf_size);
1065 1145
1066 status = be_mbox_notify(adapter); 1146 status = be_mcc_notify_wait(adapter);
1067 1147
1068 spin_unlock(&adapter->mbox_lock); 1148 spin_unlock_bh(&adapter->mcc_lock);
1069 return status; 1149 return status;
1070} 1150}
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index fd7028e5b78e..93e432f3d926 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -61,7 +61,8 @@ enum {
61/* The command is completing because the queue was getting flushed */ 61/* The command is completing because the queue was getting flushed */
62 MCC_STATUS_QUEUE_FLUSHING = 0x4, 62 MCC_STATUS_QUEUE_FLUSHING = 0x4,
63/* The command is completing with a DMA error */ 63/* The command is completing with a DMA error */
64 MCC_STATUS_DMA_FAILED = 0x5 64 MCC_STATUS_DMA_FAILED = 0x5,
65 MCC_STATUS_NOT_SUPPORTED = 0x66
65}; 66};
66 67
67#define CQE_STATUS_COMPL_MASK 0xFFFF 68#define CQE_STATUS_COMPL_MASK 0xFFFF
@@ -761,7 +762,7 @@ extern int be_cmd_get_flow_control(struct be_adapter *adapter,
761 u32 *tx_fc, u32 *rx_fc); 762 u32 *tx_fc, u32 *rx_fc);
762extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num); 763extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num);
763extern int be_cmd_reset_function(struct be_adapter *adapter); 764extern int be_cmd_reset_function(struct be_adapter *adapter);
764extern void be_process_mcc(struct be_adapter *adapter); 765extern int be_process_mcc(struct be_adapter *adapter);
765extern int be_cmd_write_flashrom(struct be_adapter *adapter, 766extern int be_cmd_write_flashrom(struct be_adapter *adapter,
766 struct be_dma_mem *cmd, u32 flash_oper, 767 struct be_dma_mem *cmd, u32 flash_oper,
767 u32 flash_opcode, u32 buf_size); 768 u32 flash_opcode, u32 buf_size);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index ce11bba2cb67..409cf0595903 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -135,7 +135,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
135 return status; 135 return status;
136} 136}
137 137
138static void netdev_stats_update(struct be_adapter *adapter) 138void netdev_stats_update(struct be_adapter *adapter)
139{ 139{
140 struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats.cmd.va); 140 struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats.cmd.va);
141 struct be_rxf_stats *rxf_stats = &hw_stats->rxf; 141 struct be_rxf_stats *rxf_stats = &hw_stats->rxf;
@@ -431,8 +431,7 @@ static int make_tx_wrbs(struct be_adapter *adapter,
431} 431}
432 432
433static netdev_tx_t be_xmit(struct sk_buff *skb, 433static netdev_tx_t be_xmit(struct sk_buff *skb,
434 struct net_device *netdev) 434 struct net_device *netdev)
435
436{ 435{
437 struct be_adapter *adapter = netdev_priv(netdev); 436 struct be_adapter *adapter = netdev_priv(netdev);
438 struct be_tx_obj *tx_obj = &adapter->tx_obj; 437 struct be_tx_obj *tx_obj = &adapter->tx_obj;
@@ -490,11 +489,11 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
490 * program them in BE. If more than BE_NUM_VLANS_SUPPORTED are configured, 489 * program them in BE. If more than BE_NUM_VLANS_SUPPORTED are configured,
491 * set the BE in promiscuous VLAN mode. 490 * set the BE in promiscuous VLAN mode.
492 */ 491 */
493static void be_vid_config(struct net_device *netdev) 492static int be_vid_config(struct be_adapter *adapter)
494{ 493{
495 struct be_adapter *adapter = netdev_priv(netdev);
496 u16 vtag[BE_NUM_VLANS_SUPPORTED]; 494 u16 vtag[BE_NUM_VLANS_SUPPORTED];
497 u16 ntags = 0, i; 495 u16 ntags = 0, i;
496 int status;
498 497
499 if (adapter->num_vlans <= BE_NUM_VLANS_SUPPORTED) { 498 if (adapter->num_vlans <= BE_NUM_VLANS_SUPPORTED) {
500 /* Construct VLAN Table to give to HW */ 499 /* Construct VLAN Table to give to HW */
@@ -504,12 +503,13 @@ static void be_vid_config(struct net_device *netdev)
504 ntags++; 503 ntags++;
505 } 504 }
506 } 505 }
507 be_cmd_vlan_config(adapter, adapter->if_handle, 506 status = be_cmd_vlan_config(adapter, adapter->if_handle,
508 vtag, ntags, 1, 0); 507 vtag, ntags, 1, 0);
509 } else { 508 } else {
510 be_cmd_vlan_config(adapter, adapter->if_handle, 509 status = be_cmd_vlan_config(adapter, adapter->if_handle,
511 NULL, 0, 1, 1); 510 NULL, 0, 1, 1);
512 } 511 }
512 return status;
513} 513}
514 514
515static void be_vlan_register(struct net_device *netdev, struct vlan_group *grp) 515static void be_vlan_register(struct net_device *netdev, struct vlan_group *grp)
@@ -532,7 +532,7 @@ static void be_vlan_add_vid(struct net_device *netdev, u16 vid)
532 adapter->num_vlans++; 532 adapter->num_vlans++;
533 adapter->vlan_tag[vid] = 1; 533 adapter->vlan_tag[vid] = 1;
534 534
535 be_vid_config(netdev); 535 be_vid_config(adapter);
536} 536}
537 537
538static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) 538static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
@@ -543,7 +543,7 @@ static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
543 adapter->vlan_tag[vid] = 0; 543 adapter->vlan_tag[vid] = 0;
544 544
545 vlan_group_set_device(adapter->vlan_grp, vid, NULL); 545 vlan_group_set_device(adapter->vlan_grp, vid, NULL);
546 be_vid_config(netdev); 546 be_vid_config(adapter);
547} 547}
548 548
549static void be_set_multicast_list(struct net_device *netdev) 549static void be_set_multicast_list(struct net_device *netdev)
@@ -1444,12 +1444,8 @@ static void be_worker(struct work_struct *work)
1444{ 1444{
1445 struct be_adapter *adapter = 1445 struct be_adapter *adapter =
1446 container_of(work, struct be_adapter, work.work); 1446 container_of(work, struct be_adapter, work.work);
1447 int status;
1448 1447
1449 /* Get Stats */ 1448 be_cmd_get_stats(adapter, &adapter->stats.cmd);
1450 status = be_cmd_get_stats(adapter, &adapter->stats.cmd);
1451 if (!status)
1452 netdev_stats_update(adapter);
1453 1449
1454 /* Set EQ delay */ 1450 /* Set EQ delay */
1455 be_rx_eqd_update(adapter); 1451 be_rx_eqd_update(adapter);
@@ -1622,11 +1618,6 @@ static int be_setup(struct be_adapter *adapter)
1622 if (status != 0) 1618 if (status != 0)
1623 goto do_none; 1619 goto do_none;
1624 1620
1625 be_vid_config(netdev);
1626
1627 status = be_cmd_set_flow_control(adapter, true, true);
1628 if (status != 0)
1629 goto if_destroy;
1630 1621
1631 status = be_tx_queues_create(adapter); 1622 status = be_tx_queues_create(adapter);
1632 if (status != 0) 1623 if (status != 0)
@@ -1640,8 +1631,17 @@ static int be_setup(struct be_adapter *adapter)
1640 if (status != 0) 1631 if (status != 0)
1641 goto rx_qs_destroy; 1632 goto rx_qs_destroy;
1642 1633
1634 status = be_vid_config(adapter);
1635 if (status != 0)
1636 goto mccqs_destroy;
1637
1638 status = be_cmd_set_flow_control(adapter, true, true);
1639 if (status != 0)
1640 goto mccqs_destroy;
1643 return 0; 1641 return 0;
1644 1642
1643mccqs_destroy:
1644 be_mcc_queues_destroy(adapter);
1645rx_qs_destroy: 1645rx_qs_destroy:
1646 be_rx_queues_destroy(adapter); 1646 be_rx_queues_destroy(adapter);
1647tx_qs_destroy: 1647tx_qs_destroy:
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a7e731f8a0da..69c5b15e22da 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1093,15 +1093,8 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
1093 return NULL; /* still no slave, return NULL */ 1093 return NULL; /* still no slave, return NULL */
1094 } 1094 }
1095 1095
1096 /*
1097 * first try the primary link; if arping, a link must tx/rx
1098 * traffic before it can be considered the curr_active_slave.
1099 * also, we would skip slaves between the curr_active_slave
1100 * and primary_slave that may be up and able to arp
1101 */
1102 if ((bond->primary_slave) && 1096 if ((bond->primary_slave) &&
1103 (!bond->params.arp_interval) && 1097 bond->primary_slave->link == BOND_LINK_UP) {
1104 (IS_UP(bond->primary_slave->dev))) {
1105 new_active = bond->primary_slave; 1098 new_active = bond->primary_slave;
1106 } 1099 }
1107 1100
@@ -1109,15 +1102,14 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
1109 old_active = new_active; 1102 old_active = new_active;
1110 1103
1111 bond_for_each_slave_from(bond, new_active, i, old_active) { 1104 bond_for_each_slave_from(bond, new_active, i, old_active) {
1112 if (IS_UP(new_active->dev)) { 1105 if (new_active->link == BOND_LINK_UP) {
1113 if (new_active->link == BOND_LINK_UP) { 1106 return new_active;
1114 return new_active; 1107 } else if (new_active->link == BOND_LINK_BACK &&
1115 } else if (new_active->link == BOND_LINK_BACK) { 1108 IS_UP(new_active->dev)) {
1116 /* link up, but waiting for stabilization */ 1109 /* link up, but waiting for stabilization */
1117 if (new_active->delay < mintime) { 1110 if (new_active->delay < mintime) {
1118 mintime = new_active->delay; 1111 mintime = new_active->delay;
1119 bestslave = new_active; 1112 bestslave = new_active;
1120 }
1121 } 1113 }
1122 } 1114 }
1123 } 1115 }
@@ -1211,7 +1203,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1211 write_unlock_bh(&bond->curr_slave_lock); 1203 write_unlock_bh(&bond->curr_slave_lock);
1212 read_unlock(&bond->lock); 1204 read_unlock(&bond->lock);
1213 1205
1214 netdev_bonding_change(bond->dev); 1206 netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER);
1215 1207
1216 read_lock(&bond->lock); 1208 read_lock(&bond->lock);
1217 write_lock_bh(&bond->curr_slave_lock); 1209 write_lock_bh(&bond->curr_slave_lock);
@@ -1469,14 +1461,17 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1469 */ 1461 */
1470 if (bond->slave_cnt == 0) { 1462 if (bond->slave_cnt == 0) {
1471 if (bond_dev->type != slave_dev->type) { 1463 if (bond_dev->type != slave_dev->type) {
1472 dev_close(bond_dev);
1473 pr_debug("%s: change device type from %d to %d\n", 1464 pr_debug("%s: change device type from %d to %d\n",
1474 bond_dev->name, bond_dev->type, slave_dev->type); 1465 bond_dev->name, bond_dev->type, slave_dev->type);
1466
1467 netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE);
1468
1475 if (slave_dev->type != ARPHRD_ETHER) 1469 if (slave_dev->type != ARPHRD_ETHER)
1476 bond_setup_by_slave(bond_dev, slave_dev); 1470 bond_setup_by_slave(bond_dev, slave_dev);
1477 else 1471 else
1478 ether_setup(bond_dev); 1472 ether_setup(bond_dev);
1479 dev_open(bond_dev); 1473
1474 netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE);
1480 } 1475 }
1481 } else if (bond_dev->type != slave_dev->type) { 1476 } else if (bond_dev->type != slave_dev->type) {
1482 pr_err(DRV_NAME ": %s ether type (%d) is different " 1477 pr_err(DRV_NAME ": %s ether type (%d) is different "
@@ -2929,18 +2924,6 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
2929 } 2924 }
2930 } 2925 }
2931 2926
2932 read_lock(&bond->curr_slave_lock);
2933
2934 /*
2935 * Trigger a commit if the primary option setting has changed.
2936 */
2937 if (bond->primary_slave &&
2938 (bond->primary_slave != bond->curr_active_slave) &&
2939 (bond->primary_slave->link == BOND_LINK_UP))
2940 commit++;
2941
2942 read_unlock(&bond->curr_slave_lock);
2943
2944 return commit; 2927 return commit;
2945} 2928}
2946 2929
@@ -2961,90 +2944,58 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2961 continue; 2944 continue;
2962 2945
2963 case BOND_LINK_UP: 2946 case BOND_LINK_UP:
2964 write_lock_bh(&bond->curr_slave_lock); 2947 if ((!bond->curr_active_slave &&
2965 2948 time_before_eq(jiffies,
2966 if (!bond->curr_active_slave && 2949 dev_trans_start(slave->dev) +
2967 time_before_eq(jiffies, dev_trans_start(slave->dev) + 2950 delta_in_ticks)) ||
2968 delta_in_ticks)) { 2951 bond->curr_active_slave != slave) {
2969 slave->link = BOND_LINK_UP; 2952 slave->link = BOND_LINK_UP;
2970 bond_change_active_slave(bond, slave);
2971 bond->current_arp_slave = NULL; 2953 bond->current_arp_slave = NULL;
2972 2954
2973 pr_info(DRV_NAME 2955 pr_info(DRV_NAME
2974 ": %s: %s is up and now the " 2956 ": %s: link status definitely "
2975 "active interface\n", 2957 "up for interface %s.\n",
2976 bond->dev->name, slave->dev->name); 2958 bond->dev->name, slave->dev->name);
2977
2978 } else if (bond->curr_active_slave != slave) {
2979 /* this slave has just come up but we
2980 * already have a current slave; this can
2981 * also happen if bond_enslave adds a new
2982 * slave that is up while we are searching
2983 * for a new slave
2984 */
2985 slave->link = BOND_LINK_UP;
2986 bond_set_slave_inactive_flags(slave);
2987 bond->current_arp_slave = NULL;
2988 2959
2989 pr_info(DRV_NAME 2960 if (!bond->curr_active_slave ||
2990 ": %s: backup interface %s is now up\n", 2961 (slave == bond->primary_slave))
2991 bond->dev->name, slave->dev->name); 2962 goto do_failover;
2992 }
2993 2963
2994 write_unlock_bh(&bond->curr_slave_lock); 2964 }
2995 2965
2996 break; 2966 continue;
2997 2967
2998 case BOND_LINK_DOWN: 2968 case BOND_LINK_DOWN:
2999 if (slave->link_failure_count < UINT_MAX) 2969 if (slave->link_failure_count < UINT_MAX)
3000 slave->link_failure_count++; 2970 slave->link_failure_count++;
3001 2971
3002 slave->link = BOND_LINK_DOWN; 2972 slave->link = BOND_LINK_DOWN;
2973 bond_set_slave_inactive_flags(slave);
3003 2974
3004 if (slave == bond->curr_active_slave) { 2975 pr_info(DRV_NAME
3005 pr_info(DRV_NAME 2976 ": %s: link status definitely down for "
3006 ": %s: link status down for active " 2977 "interface %s, disabling it\n",
3007 "interface %s, disabling it\n", 2978 bond->dev->name, slave->dev->name);
3008 bond->dev->name, slave->dev->name);
3009
3010 bond_set_slave_inactive_flags(slave);
3011
3012 write_lock_bh(&bond->curr_slave_lock);
3013
3014 bond_select_active_slave(bond);
3015 if (bond->curr_active_slave)
3016 bond->curr_active_slave->jiffies =
3017 jiffies;
3018
3019 write_unlock_bh(&bond->curr_slave_lock);
3020 2979
2980 if (slave == bond->curr_active_slave) {
3021 bond->current_arp_slave = NULL; 2981 bond->current_arp_slave = NULL;
3022 2982 goto do_failover;
3023 } else if (slave->state == BOND_STATE_BACKUP) {
3024 pr_info(DRV_NAME
3025 ": %s: backup interface %s is now down\n",
3026 bond->dev->name, slave->dev->name);
3027
3028 bond_set_slave_inactive_flags(slave);
3029 } 2983 }
3030 break; 2984
2985 continue;
3031 2986
3032 default: 2987 default:
3033 pr_err(DRV_NAME 2988 pr_err(DRV_NAME
3034 ": %s: impossible: new_link %d on slave %s\n", 2989 ": %s: impossible: new_link %d on slave %s\n",
3035 bond->dev->name, slave->new_link, 2990 bond->dev->name, slave->new_link,
3036 slave->dev->name); 2991 slave->dev->name);
2992 continue;
3037 } 2993 }
3038 }
3039 2994
3040 /* 2995do_failover:
3041 * No race with changes to primary via sysfs, as we hold rtnl. 2996 ASSERT_RTNL();
3042 */
3043 if (bond->primary_slave &&
3044 (bond->primary_slave != bond->curr_active_slave) &&
3045 (bond->primary_slave->link == BOND_LINK_UP)) {
3046 write_lock_bh(&bond->curr_slave_lock); 2997 write_lock_bh(&bond->curr_slave_lock);
3047 bond_change_active_slave(bond, bond->primary_slave); 2998 bond_select_active_slave(bond);
3048 write_unlock_bh(&bond->curr_slave_lock); 2999 write_unlock_bh(&bond->curr_slave_lock);
3049 } 3000 }
3050 3001
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 6971f6cd37fa..80ac56313981 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -80,7 +80,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
80 skb->dev = dev; 80 skb->dev = dev;
81 skb->ip_summed = CHECKSUM_UNNECESSARY; 81 skb->ip_summed = CHECKSUM_UNNECESSARY;
82 82
83 netif_rx(skb); 83 netif_rx_ni(skb);
84} 84}
85 85
86static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) 86static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index 6158c0f3b205..f8f5772557ce 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -49,11 +49,10 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *);
49static s32 igb_reset_hw_82575(struct e1000_hw *); 49static s32 igb_reset_hw_82575(struct e1000_hw *);
50static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool); 50static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool);
51static s32 igb_setup_copper_link_82575(struct e1000_hw *); 51static s32 igb_setup_copper_link_82575(struct e1000_hw *);
52static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *); 52static s32 igb_setup_serdes_link_82575(struct e1000_hw *);
53static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16); 53static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16);
54static void igb_clear_hw_cntrs_82575(struct e1000_hw *); 54static void igb_clear_hw_cntrs_82575(struct e1000_hw *);
55static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *, u16); 55static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *, u16);
56static void igb_configure_pcs_link_82575(struct e1000_hw *);
57static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *, u16 *, 56static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *, u16 *,
58 u16 *); 57 u16 *);
59static s32 igb_get_phy_id_82575(struct e1000_hw *); 58static s32 igb_get_phy_id_82575(struct e1000_hw *);
@@ -105,16 +104,20 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
105 dev_spec->sgmii_active = false; 104 dev_spec->sgmii_active = false;
106 105
107 ctrl_ext = rd32(E1000_CTRL_EXT); 106 ctrl_ext = rd32(E1000_CTRL_EXT);
108 if ((ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) == 107 switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) {
109 E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES) { 108 case E1000_CTRL_EXT_LINK_MODE_SGMII:
110 hw->phy.media_type = e1000_media_type_internal_serdes;
111 ctrl_ext |= E1000_CTRL_I2C_ENA;
112 } else if (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII) {
113 dev_spec->sgmii_active = true; 109 dev_spec->sgmii_active = true;
114 ctrl_ext |= E1000_CTRL_I2C_ENA; 110 ctrl_ext |= E1000_CTRL_I2C_ENA;
115 } else { 111 break;
112 case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
113 hw->phy.media_type = e1000_media_type_internal_serdes;
114 ctrl_ext |= E1000_CTRL_I2C_ENA;
115 break;
116 default:
116 ctrl_ext &= ~E1000_CTRL_I2C_ENA; 117 ctrl_ext &= ~E1000_CTRL_I2C_ENA;
118 break;
117 } 119 }
120
118 wr32(E1000_CTRL_EXT, ctrl_ext); 121 wr32(E1000_CTRL_EXT, ctrl_ext);
119 122
120 /* Set mta register count */ 123 /* Set mta register count */
@@ -134,7 +137,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
134 mac->ops.setup_physical_interface = 137 mac->ops.setup_physical_interface =
135 (hw->phy.media_type == e1000_media_type_copper) 138 (hw->phy.media_type == e1000_media_type_copper)
136 ? igb_setup_copper_link_82575 139 ? igb_setup_copper_link_82575
137 : igb_setup_fiber_serdes_link_82575; 140 : igb_setup_serdes_link_82575;
138 141
139 /* NVM initialization */ 142 /* NVM initialization */
140 eecd = rd32(E1000_EECD); 143 eecd = rd32(E1000_EECD);
@@ -379,6 +382,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
379 struct e1000_phy_info *phy = &hw->phy; 382 struct e1000_phy_info *phy = &hw->phy;
380 s32 ret_val = 0; 383 s32 ret_val = 0;
381 u16 phy_id; 384 u16 phy_id;
385 u32 ctrl_ext;
382 386
383 /* 387 /*
384 * For SGMII PHYs, we try the list of possible addresses until 388 * For SGMII PHYs, we try the list of possible addresses until
@@ -393,6 +397,12 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
393 goto out; 397 goto out;
394 } 398 }
395 399
400 /* Power on sgmii phy if it is disabled */
401 ctrl_ext = rd32(E1000_CTRL_EXT);
402 wr32(E1000_CTRL_EXT, ctrl_ext & ~E1000_CTRL_EXT_SDP3_DATA);
403 wrfl();
404 msleep(300);
405
396 /* 406 /*
397 * The address field in the I2CCMD register is 3 bits and 0 is invalid. 407 * The address field in the I2CCMD register is 3 bits and 0 is invalid.
398 * Therefore, we need to test 1-7 408 * Therefore, we need to test 1-7
@@ -418,9 +428,12 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
418 phy->addr = 0; 428 phy->addr = 0;
419 ret_val = -E1000_ERR_PHY; 429 ret_val = -E1000_ERR_PHY;
420 goto out; 430 goto out;
431 } else {
432 ret_val = igb_get_phy_id(hw);
421 } 433 }
422 434
423 ret_val = igb_get_phy_id(hw); 435 /* restore previous sfp cage power state */
436 wr32(E1000_CTRL_EXT, ctrl_ext);
424 437
425out: 438out:
426 return ret_val; 439 return ret_val;
@@ -766,17 +779,18 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed,
766} 779}
767 780
768/** 781/**
769 * igb_shutdown_fiber_serdes_link_82575 - Remove link during power down 782 * igb_shutdown_serdes_link_82575 - Remove link during power down
770 * @hw: pointer to the HW structure 783 * @hw: pointer to the HW structure
771 * 784 *
772 * In the case of fiber serdes, shut down optics and PCS on driver unload 785 * In the case of fiber serdes, shut down optics and PCS on driver unload
773 * when management pass thru is not enabled. 786 * when management pass thru is not enabled.
774 **/ 787 **/
775void igb_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw) 788void igb_shutdown_serdes_link_82575(struct e1000_hw *hw)
776{ 789{
777 u32 reg; 790 u32 reg;
778 791
779 if (hw->phy.media_type != e1000_media_type_internal_serdes) 792 if (hw->phy.media_type != e1000_media_type_internal_serdes ||
793 igb_sgmii_active_82575(hw))
780 return; 794 return;
781 795
782 /* if the management interface is not enabled, then power down */ 796 /* if the management interface is not enabled, then power down */
@@ -788,7 +802,7 @@ void igb_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw)
788 802
789 /* shutdown the laser */ 803 /* shutdown the laser */
790 reg = rd32(E1000_CTRL_EXT); 804 reg = rd32(E1000_CTRL_EXT);
791 reg |= E1000_CTRL_EXT_SDP7_DATA; 805 reg |= E1000_CTRL_EXT_SDP3_DATA;
792 wr32(E1000_CTRL_EXT, reg); 806 wr32(E1000_CTRL_EXT, reg);
793 807
794 /* flush the write to verify completion */ 808 /* flush the write to verify completion */
@@ -927,6 +941,17 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
927 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); 941 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
928 wr32(E1000_CTRL, ctrl); 942 wr32(E1000_CTRL, ctrl);
929 943
944 ret_val = igb_setup_serdes_link_82575(hw);
945 if (ret_val)
946 goto out;
947
948 if (igb_sgmii_active_82575(hw) && !hw->phy.reset_disable) {
949 ret_val = hw->phy.ops.reset(hw);
950 if (ret_val) {
951 hw_dbg("Error resetting the PHY.\n");
952 goto out;
953 }
954 }
930 switch (hw->phy.type) { 955 switch (hw->phy.type) {
931 case e1000_phy_m88: 956 case e1000_phy_m88:
932 ret_val = igb_copper_link_setup_m88(hw); 957 ret_val = igb_copper_link_setup_m88(hw);
@@ -963,8 +988,6 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
963 } 988 }
964 } 989 }
965 990
966 igb_configure_pcs_link_82575(hw);
967
968 /* 991 /*
969 * Check link status. Wait up to 100 microseconds for link to become 992 * Check link status. Wait up to 100 microseconds for link to become
970 * valid. 993 * valid.
@@ -987,14 +1010,18 @@ out:
987} 1010}
988 1011
989/** 1012/**
990 * igb_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes 1013 * igb_setup_serdes_link_82575 - Setup link for fiber/serdes
991 * @hw: pointer to the HW structure 1014 * @hw: pointer to the HW structure
992 * 1015 *
993 * Configures speed and duplex for fiber and serdes links. 1016 * Configures speed and duplex for fiber and serdes links.
994 **/ 1017 **/
995static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw) 1018static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
996{ 1019{
997 u32 reg; 1020 u32 ctrl_reg, reg;
1021
1022 if ((hw->phy.media_type != e1000_media_type_internal_serdes) &&
1023 !igb_sgmii_active_82575(hw))
1024 return 0;
998 1025
999 /* 1026 /*
1000 * On the 82575, SerDes loopback mode persists until it is 1027 * On the 82575, SerDes loopback mode persists until it is
@@ -1004,26 +1031,38 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1004 */ 1031 */
1005 wr32(E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); 1032 wr32(E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
1006 1033
1007 /* Force link up, set 1gb, set both sw defined pins */ 1034 /* power on the sfp cage if present */
1008 reg = rd32(E1000_CTRL); 1035 reg = rd32(E1000_CTRL_EXT);
1009 reg |= E1000_CTRL_SLU | 1036 reg &= ~E1000_CTRL_EXT_SDP3_DATA;
1010 E1000_CTRL_SPD_1000 | 1037 wr32(E1000_CTRL_EXT, reg);
1011 E1000_CTRL_FRCSPD | 1038
1012 E1000_CTRL_SWDPIN0 | 1039 ctrl_reg = rd32(E1000_CTRL);
1013 E1000_CTRL_SWDPIN1; 1040 ctrl_reg |= E1000_CTRL_SLU;
1014 wr32(E1000_CTRL, reg); 1041
1015 1042 if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) {
1016 /* Power on phy for 82576 fiber adapters */ 1043 /* set both sw defined pins */
1017 if (hw->mac.type == e1000_82576) { 1044 ctrl_reg |= E1000_CTRL_SWDPIN0 | E1000_CTRL_SWDPIN1;
1018 reg = rd32(E1000_CTRL_EXT); 1045
1019 reg &= ~E1000_CTRL_EXT_SDP7_DATA; 1046 /* Set switch control to serdes energy detect */
1020 wr32(E1000_CTRL_EXT, reg); 1047 reg = rd32(E1000_CONNSW);
1048 reg |= E1000_CONNSW_ENRGSRC;
1049 wr32(E1000_CONNSW, reg);
1050 }
1051
1052 reg = rd32(E1000_PCS_LCTL);
1053
1054 if (igb_sgmii_active_82575(hw)) {
1055 /* allow time for SFP cage to power up phy */
1056 msleep(300);
1057
1058 /* AN time out should be disabled for SGMII mode */
1059 reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT);
1060 } else {
1061 ctrl_reg |= E1000_CTRL_SPD_1000 | E1000_CTRL_FRCSPD |
1062 E1000_CTRL_FD | E1000_CTRL_FRCDPX;
1021 } 1063 }
1022 1064
1023 /* Set switch control to serdes energy detect */ 1065 wr32(E1000_CTRL, ctrl_reg);
1024 reg = rd32(E1000_CONNSW);
1025 reg |= E1000_CONNSW_ENRGSRC;
1026 wr32(E1000_CONNSW, reg);
1027 1066
1028 /* 1067 /*
1029 * New SerDes mode allows for forcing speed or autonegotiating speed 1068 * New SerDes mode allows for forcing speed or autonegotiating speed
@@ -1031,12 +1070,21 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1031 * mode that will be compatible with older link partners and switches. 1070 * mode that will be compatible with older link partners and switches.
1032 * However, both are supported by the hardware and some drivers/tools. 1071 * However, both are supported by the hardware and some drivers/tools.
1033 */ 1072 */
1034 reg = rd32(E1000_PCS_LCTL);
1035 1073
1036 reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP | 1074 reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP |
1037 E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); 1075 E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK);
1038 1076
1039 if (hw->mac.autoneg) { 1077 /*
1078 * We force flow control to prevent the CTRL register values from being
1079 * overwritten by the autonegotiated flow control values
1080 */
1081 reg |= E1000_PCS_LCTL_FORCE_FCTRL;
1082
1083 /*
1084 * we always set sgmii to autoneg since it is the phy that will be
1085 * forcing the link and the serdes is just a go-between
1086 */
1087 if (hw->mac.autoneg || igb_sgmii_active_82575(hw)) {
1040 /* Set PCS register for autoneg */ 1088 /* Set PCS register for autoneg */
1041 reg |= E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ 1089 reg |= E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */
1042 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ 1090 E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */
@@ -1053,75 +1101,12 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1053 hw_dbg("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg); 1101 hw_dbg("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg);
1054 } 1102 }
1055 1103
1056 if (hw->mac.type == e1000_82576) {
1057 reg |= E1000_PCS_LCTL_FORCE_FCTRL;
1058 igb_force_mac_fc(hw);
1059 }
1060
1061 wr32(E1000_PCS_LCTL, reg); 1104 wr32(E1000_PCS_LCTL, reg);
1062 1105
1063 return 0; 1106 if (!igb_sgmii_active_82575(hw))
1064} 1107 igb_force_mac_fc(hw);
1065
1066/**
1067 * igb_configure_pcs_link_82575 - Configure PCS link
1068 * @hw: pointer to the HW structure
1069 *
1070 * Configure the physical coding sub-layer (PCS) link. The PCS link is
1071 * only used on copper connections where the serialized gigabit media
1072 * independent interface (sgmii) is being used. Configures the link
1073 * for auto-negotiation or forces speed/duplex.
1074 **/
1075static void igb_configure_pcs_link_82575(struct e1000_hw *hw)
1076{
1077 struct e1000_mac_info *mac = &hw->mac;
1078 u32 reg = 0;
1079
1080 if (hw->phy.media_type != e1000_media_type_copper ||
1081 !(igb_sgmii_active_82575(hw)))
1082 return;
1083
1084 /* For SGMII, we need to issue a PCS autoneg restart */
1085 reg = rd32(E1000_PCS_LCTL);
1086
1087 /* AN time out should be disabled for SGMII mode */
1088 reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT);
1089
1090 if (mac->autoneg) {
1091 /* Make sure forced speed and force link are not set */
1092 reg &= ~(E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK);
1093
1094 /*
1095 * The PHY should be setup prior to calling this function.
1096 * All we need to do is restart autoneg and enable autoneg.
1097 */
1098 reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE;
1099 } else {
1100 /* Set PCS register for forced speed */
1101
1102 /* Turn off bits for full duplex, speed, and autoneg */
1103 reg &= ~(E1000_PCS_LCTL_FSV_1000 |
1104 E1000_PCS_LCTL_FSV_100 |
1105 E1000_PCS_LCTL_FDV_FULL |
1106 E1000_PCS_LCTL_AN_ENABLE);
1107
1108 /* Check for duplex first */
1109 if (mac->forced_speed_duplex & E1000_ALL_FULL_DUPLEX)
1110 reg |= E1000_PCS_LCTL_FDV_FULL;
1111
1112 /* Now set speed */
1113 if (mac->forced_speed_duplex & E1000_ALL_100_SPEED)
1114 reg |= E1000_PCS_LCTL_FSV_100;
1115
1116 /* Force speed and force link */
1117 reg |= E1000_PCS_LCTL_FSD |
1118 E1000_PCS_LCTL_FORCE_LINK |
1119 E1000_PCS_LCTL_FLV_LINK_UP;
1120 1108
1121 hw_dbg("Wrote 0x%08X to PCS_LCTL to configure forced link\n", 1109 return 0;
1122 reg);
1123 }
1124 wr32(E1000_PCS_LCTL, reg);
1125} 1110}
1126 1111
1127/** 1112/**
@@ -1248,7 +1233,8 @@ static void igb_clear_hw_cntrs_82575(struct e1000_hw *hw)
1248 temp = rd32(E1000_LENERRS); 1233 temp = rd32(E1000_LENERRS);
1249 1234
1250 /* This register should not be read in copper configurations */ 1235 /* This register should not be read in copper configurations */
1251 if (hw->phy.media_type == e1000_media_type_internal_serdes) 1236 if (hw->phy.media_type == e1000_media_type_internal_serdes ||
1237 igb_sgmii_active_82575(hw))
1252 temp = rd32(E1000_SCVPC); 1238 temp = rd32(E1000_SCVPC);
1253} 1239}
1254 1240
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h
index 8a1e6597061f..ebd146fd4e15 100644
--- a/drivers/net/igb/e1000_82575.h
+++ b/drivers/net/igb/e1000_82575.h
@@ -28,7 +28,7 @@
28#ifndef _E1000_82575_H_ 28#ifndef _E1000_82575_H_
29#define _E1000_82575_H_ 29#define _E1000_82575_H_
30 30
31extern void igb_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw); 31extern void igb_shutdown_serdes_link_82575(struct e1000_hw *hw);
32extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw); 32extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw);
33 33
34#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \ 34#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index c85829355d50..cb916833f303 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -44,7 +44,7 @@
44#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 44#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
45 45
46/* Extended Device Control */ 46/* Extended Device Control */
47#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ 47#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */
48/* Physical Func Reset Done Indication */ 48/* Physical Func Reset Done Indication */
49#define E1000_CTRL_EXT_PFRSTD 0x00004000 49#define E1000_CTRL_EXT_PFRSTD 0x00004000
50#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 50#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c
index c1f4da630420..ee460600e74b 100644
--- a/drivers/net/igb/e1000_phy.c
+++ b/drivers/net/igb/e1000_phy.c
@@ -1565,9 +1565,12 @@ out:
1565 **/ 1565 **/
1566s32 igb_phy_sw_reset(struct e1000_hw *hw) 1566s32 igb_phy_sw_reset(struct e1000_hw *hw)
1567{ 1567{
1568 s32 ret_val; 1568 s32 ret_val = 0;
1569 u16 phy_ctrl; 1569 u16 phy_ctrl;
1570 1570
1571 if (!(hw->phy.ops.read_reg))
1572 goto out;
1573
1571 ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); 1574 ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
1572 if (ret_val) 1575 if (ret_val)
1573 goto out; 1576 goto out;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 943186b78483..d2639c4a086d 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -5320,7 +5320,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake)
5320 5320
5321 *enable_wake = wufc || adapter->en_mng_pt; 5321 *enable_wake = wufc || adapter->en_mng_pt;
5322 if (!*enable_wake) 5322 if (!*enable_wake)
5323 igb_shutdown_fiber_serdes_link_82575(hw); 5323 igb_shutdown_serdes_link_82575(hw);
5324 5324
5325 /* Release control of h/w to f/w. If f/w is AMT enabled, this 5325 /* Release control of h/w to f/w. If f/w is AMT enabled, this
5326 * would have already happened in close and is redundant. */ 5326 * would have already happened in close and is redundant. */
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index cb7f0c3c6e16..56b12f3192f1 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -322,14 +322,16 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
322 break; 322 break;
323 case IXGBE_DEV_ID_82598AF_DUAL_PORT: 323 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
324 case IXGBE_DEV_ID_82598AF_SINGLE_PORT: 324 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
325 case IXGBE_DEV_ID_82598EB_CX4:
326 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
327 case IXGBE_DEV_ID_82598_DA_DUAL_PORT: 325 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
328 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM: 326 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
329 case IXGBE_DEV_ID_82598EB_XF_LR: 327 case IXGBE_DEV_ID_82598EB_XF_LR:
330 case IXGBE_DEV_ID_82598EB_SFP_LOM: 328 case IXGBE_DEV_ID_82598EB_SFP_LOM:
331 media_type = ixgbe_media_type_fiber; 329 media_type = ixgbe_media_type_fiber;
332 break; 330 break;
331 case IXGBE_DEV_ID_82598EB_CX4:
332 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
333 media_type = ixgbe_media_type_cx4;
334 break;
333 case IXGBE_DEV_ID_82598AT: 335 case IXGBE_DEV_ID_82598AT:
334 case IXGBE_DEV_ID_82598AT2: 336 case IXGBE_DEV_ID_82598AT2:
335 media_type = ixgbe_media_type_copper; 337 media_type = ixgbe_media_type_copper;
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 61af47e75aa1..2ec58dcdb82b 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -337,6 +337,9 @@ static enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw)
337 case IXGBE_DEV_ID_82599_SFP: 337 case IXGBE_DEV_ID_82599_SFP:
338 media_type = ixgbe_media_type_fiber; 338 media_type = ixgbe_media_type_fiber;
339 break; 339 break;
340 case IXGBE_DEV_ID_82599_CX4:
341 media_type = ixgbe_media_type_cx4;
342 break;
340 default: 343 default:
341 media_type = ixgbe_media_type_unknown; 344 media_type = ixgbe_media_type_unknown;
342 break; 345 break;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 45bf8b9716e3..59ad9590e700 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -97,6 +97,8 @@ static struct pci_device_id ixgbe_pci_tbl[] = {
97 board_82599 }, 97 board_82599 },
98 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP), 98 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP),
99 board_82599 }, 99 board_82599 },
100 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_CX4),
101 board_82599 },
100 102
101 /* required last entry */ 103 /* required last entry */
102 {0, } 104 {0, }
@@ -2055,6 +2057,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2055 2057
2056 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) 2058 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)
2057 rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED; 2059 rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED;
2060 else
2061 rx_ring->flags &= ~IXGBE_RING_RX_PS_ENABLED;
2058 2062
2059#ifdef IXGBE_FCOE 2063#ifdef IXGBE_FCOE
2060 if (netdev->features & NETIF_F_FCOE_MTU) { 2064 if (netdev->features & NETIF_F_FCOE_MTU) {
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 8ba90eec1dc9..8761d7899f7d 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -49,6 +49,7 @@
49#define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1 49#define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1
50#define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4 50#define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4
51#define IXGBE_DEV_ID_82599_KX4 0x10F7 51#define IXGBE_DEV_ID_82599_KX4 0x10F7
52#define IXGBE_DEV_ID_82599_CX4 0x10F9
52#define IXGBE_DEV_ID_82599_SFP 0x10FB 53#define IXGBE_DEV_ID_82599_SFP 0x10FB
53#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC 54#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC
54 55
@@ -2143,6 +2144,7 @@ enum ixgbe_media_type {
2143 ixgbe_media_type_fiber, 2144 ixgbe_media_type_fiber,
2144 ixgbe_media_type_copper, 2145 ixgbe_media_type_copper,
2145 ixgbe_media_type_backplane, 2146 ixgbe_media_type_backplane,
2147 ixgbe_media_type_cx4,
2146 ixgbe_media_type_virtual 2148 ixgbe_media_type_virtual
2147}; 2149};
2148 2150
diff --git a/drivers/net/mlx4/catas.c b/drivers/net/mlx4/catas.c
index aa9674b7f19c..f599294fa8ab 100644
--- a/drivers/net/mlx4/catas.c
+++ b/drivers/net/mlx4/catas.c
@@ -96,12 +96,17 @@ static void catas_reset(struct work_struct *work)
96 spin_unlock_irq(&catas_lock); 96 spin_unlock_irq(&catas_lock);
97 97
98 list_for_each_entry_safe(priv, tmppriv, &tlist, catas_err.list) { 98 list_for_each_entry_safe(priv, tmppriv, &tlist, catas_err.list) {
99 struct pci_dev *pdev = priv->dev.pdev;
100
99 ret = mlx4_restart_one(priv->dev.pdev); 101 ret = mlx4_restart_one(priv->dev.pdev);
100 dev = &priv->dev; 102 /* 'priv' now is not valid */
101 if (ret) 103 if (ret)
102 mlx4_err(dev, "Reset failed (%d)\n", ret); 104 printk(KERN_ERR "mlx4 %s: Reset failed (%d)\n",
103 else 105 pci_name(pdev), ret);
106 else {
107 dev = pci_get_drvdata(pdev);
104 mlx4_dbg(dev, "Reset succeeded\n"); 108 mlx4_dbg(dev, "Reset succeeded\n");
109 }
105 } 110 }
106} 111}
107 112
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 90a94d215831..97db1c732342 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1750,11 +1750,11 @@ static struct pcmcia_device_id pcnet_ids[] = {
1750 PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), 1750 PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078),
1751 /* too generic! */ 1751 /* too generic! */
1752 /* PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100 Ethernet Card", 0x281f1c5d, 0x11b0ffc0), */ 1752 /* PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100 Ethernet Card", 0x281f1c5d, 0x11b0ffc0), */
1753 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "PCMLM28.cis"), 1753 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "cis/PCMLM28.cis"),
1754 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "PCMLM28.cis"), 1754 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "cis/PCMLM28.cis"),
1755 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "PCMLM28.cis"), 1755 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"),
1756 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "PCMLM28.cis"), 1756 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"),
1757 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "PCMLM28.cis"), 1757 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"),
1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), 1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"),
1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), 1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"),
1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), 1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"),
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index e0f9219a0aea..cc394d073755 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -229,7 +229,7 @@ static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel);
229static atomic_t pppol2tp_tunnel_count; 229static atomic_t pppol2tp_tunnel_count;
230static atomic_t pppol2tp_session_count; 230static atomic_t pppol2tp_session_count;
231static struct ppp_channel_ops pppol2tp_chan_ops = { pppol2tp_xmit , NULL }; 231static struct ppp_channel_ops pppol2tp_chan_ops = { pppol2tp_xmit , NULL };
232static struct proto_ops pppol2tp_ops; 232static const struct proto_ops pppol2tp_ops;
233 233
234/* per-net private data for this module */ 234/* per-net private data for this module */
235static int pppol2tp_net_id; 235static int pppol2tp_net_id;
@@ -2574,7 +2574,7 @@ static const struct file_operations pppol2tp_proc_fops = {
2574 * Init and cleanup 2574 * Init and cleanup
2575 *****************************************************************************/ 2575 *****************************************************************************/
2576 2576
2577static struct proto_ops pppol2tp_ops = { 2577static const struct proto_ops pppol2tp_ops = {
2578 .family = AF_PPPOX, 2578 .family = AF_PPPOX,
2579 .owner = THIS_MODULE, 2579 .owner = THIS_MODULE,
2580 .release = pppol2tp_release, 2580 .release = pppol2tp_release,
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 00bc65a0aac9..4bb52e9cd371 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -65,8 +65,8 @@
65#define RX_DEF_PENDING RX_MAX_PENDING 65#define RX_DEF_PENDING RX_MAX_PENDING
66 66
67/* This is the worst case number of transmit list elements for a single skb: 67/* This is the worst case number of transmit list elements for a single skb:
68 VLAN + TSO + CKSUM + Data + skb_frags * DMA */ 68 VLAN:GSO + CKSUM + Data + skb_frags * DMA */
69#define MAX_SKB_TX_LE (4 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS) 69#define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1))
70#define TX_MIN_PENDING (MAX_SKB_TX_LE+1) 70#define TX_MIN_PENDING (MAX_SKB_TX_LE+1)
71#define TX_MAX_PENDING 4096 71#define TX_MAX_PENDING 4096
72#define TX_DEF_PENDING 127 72#define TX_DEF_PENDING 127
@@ -1567,11 +1567,13 @@ static unsigned tx_le_req(const struct sk_buff *skb)
1567{ 1567{
1568 unsigned count; 1568 unsigned count;
1569 1569
1570 count = sizeof(dma_addr_t) / sizeof(u32); 1570 count = (skb_shinfo(skb)->nr_frags + 1)
1571 count += skb_shinfo(skb)->nr_frags * count; 1571 * (sizeof(dma_addr_t) / sizeof(u32));
1572 1572
1573 if (skb_is_gso(skb)) 1573 if (skb_is_gso(skb))
1574 ++count; 1574 ++count;
1575 else if (sizeof(dma_addr_t) == sizeof(u32))
1576 ++count; /* possible vlan */
1575 1577
1576 if (skb->ip_summed == CHECKSUM_PARTIAL) 1578 if (skb->ip_summed == CHECKSUM_PARTIAL)
1577 ++count; 1579 ++count;
@@ -4548,16 +4550,18 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4548 if (hw->ports > 1) { 4550 if (hw->ports > 1) {
4549 struct net_device *dev1; 4551 struct net_device *dev1;
4550 4552
4553 err = -ENOMEM;
4551 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); 4554 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default);
4552 if (!dev1) 4555 if (dev1 && (err = register_netdev(dev1)) == 0)
4553 dev_warn(&pdev->dev, "allocation for second device failed\n"); 4556 sky2_show_addr(dev1);
4554 else if ((err = register_netdev(dev1))) { 4557 else {
4555 dev_warn(&pdev->dev, 4558 dev_warn(&pdev->dev,
4556 "register of second port failed (%d)\n", err); 4559 "register of second port failed (%d)\n", err);
4557 hw->dev[1] = NULL; 4560 hw->dev[1] = NULL;
4558 free_netdev(dev1); 4561 hw->ports = 1;
4559 } else 4562 if (dev1)
4560 sky2_show_addr(dev1); 4563 free_netdev(dev1);
4564 }
4561 } 4565 }
4562 4566
4563 setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw); 4567 setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw);
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 784b631cfa3c..3911be7c0cba 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -83,34 +83,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
83 } 83 }
84} 84}
85 85
86#elif defined(CONFIG_BLACKFIN)
87
88#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
89#define RPC_LSA_DEFAULT RPC_LED_100_10
90#define RPC_LSB_DEFAULT RPC_LED_TX_RX
91
92#define SMC_CAN_USE_8BIT 0
93#define SMC_CAN_USE_16BIT 1
94# if defined(CONFIG_BF561)
95#define SMC_CAN_USE_32BIT 1
96# else
97#define SMC_CAN_USE_32BIT 0
98# endif
99#define SMC_IO_SHIFT 0
100#define SMC_NOWAIT 1
101#define SMC_USE_BFIN_DMA 0
102
103#define SMC_inw(a, r) readw((a) + (r))
104#define SMC_outw(v, a, r) writew(v, (a) + (r))
105#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
106#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
107# if SMC_CAN_USE_32BIT
108#define SMC_inl(a, r) readl((a) + (r))
109#define SMC_outl(v, a, r) writel(v, (a) + (r))
110#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
111#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
112# endif
113
114#elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6) 86#elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6)
115 87
116/* We can only do 16-bit reads and writes in the static memory space. */ 88/* We can only do 16-bit reads and writes in the static memory space. */
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 97e54d9d03ce..33d5c579c5ad 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -264,7 +264,6 @@ static int usbpn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
264 switch (cmd) { 264 switch (cmd) {
265 case SIOCPNGAUTOCONF: 265 case SIOCPNGAUTOCONF:
266 req->ifr_phonet_autoconf.device = PN_DEV_PC; 266 req->ifr_phonet_autoconf.device = PN_DEV_PC;
267 printk(KERN_CRIT"device is PN_DEV_PC\n");
268 return 0; 267 return 0;
269 } 268 }
270 return -ENOIOCTLCMD; 269 return -ENOIOCTLCMD;
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index ad89d23968df..49ea9c92b7e6 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -5,6 +5,7 @@
5menuconfig WLAN 5menuconfig WLAN
6 bool "Wireless LAN" 6 bool "Wireless LAN"
7 depends on !S390 7 depends on !S390
8 default y
8 ---help--- 9 ---help---
9 This section contains all the pre 802.11 and 802.11 wireless 10 This section contains all the pre 802.11 and 802.11 wireless
10 device drivers. For a complete list of drivers and documentation 11 device drivers. For a complete list of drivers and documentation
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index a7cbb07988cf..2b493742ef10 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -327,7 +327,8 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
327 aniState->firstepLevel + 1); 327 aniState->firstepLevel + 1);
328 return; 328 return;
329 } else { 329 } else {
330 if (conf->channel->band == IEEE80211_BAND_2GHZ) { 330 if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
331 !conf_is_ht(conf)) {
331 if (!aniState->ofdmWeakSigDetectOff) 332 if (!aniState->ofdmWeakSigDetectOff)
332 ath9k_hw_ani_control(ah, 333 ath9k_hw_ani_control(ah,
333 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, 334 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
@@ -369,7 +370,8 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
369 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 370 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
370 aniState->firstepLevel + 1); 371 aniState->firstepLevel + 1);
371 } else { 372 } else {
372 if (conf->channel->band == IEEE80211_BAND_2GHZ) { 373 if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
374 !conf_is_ht(conf)) {
373 if (aniState->firstepLevel > 0) 375 if (aniState->firstepLevel > 0)
374 ath9k_hw_ani_control(ah, 376 ath9k_hw_ani_control(ah,
375 ATH9K_ANI_FIRSTEP_LEVEL, 0); 377 ATH9K_ANI_FIRSTEP_LEVEL, 0);
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 7a9a3fa55425..e789792a36bc 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2289,11 +2289,7 @@ static int b43_upload_microcode(struct b43_wldev *dev)
2289 err = -ENODEV; 2289 err = -ENODEV;
2290 goto error; 2290 goto error;
2291 } 2291 }
2292 msleep_interruptible(50); 2292 msleep(50);
2293 if (signal_pending(current)) {
2294 err = -EINTR;
2295 goto error;
2296 }
2297 } 2293 }
2298 b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); /* dummy read */ 2294 b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); /* dummy read */
2299 2295
@@ -4287,6 +4283,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4287 if (!dev->suspend_in_progress) 4283 if (!dev->suspend_in_progress)
4288 b43_rng_init(wl); 4284 b43_rng_init(wl);
4289 4285
4286 ieee80211_wake_queues(dev->wl->hw);
4287
4290 b43_set_status(dev, B43_STAT_INITIALIZED); 4288 b43_set_status(dev, B43_STAT_INITIALIZED);
4291 4289
4292 if (!dev->suspend_in_progress) 4290 if (!dev->suspend_in_progress)
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 6fe122f18c0d..eb57d1ea361f 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -875,15 +875,16 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
875 875
876 switch(type) { 876 switch(type) {
877 case HOSTAP_INTERFACE_AP: 877 case HOSTAP_INTERFACE_AP:
878 dev->tx_queue_len = 0; /* use main radio device queue */
878 dev->netdev_ops = &hostap_mgmt_netdev_ops; 879 dev->netdev_ops = &hostap_mgmt_netdev_ops;
879 dev->type = ARPHRD_IEEE80211; 880 dev->type = ARPHRD_IEEE80211;
880 dev->header_ops = &hostap_80211_ops; 881 dev->header_ops = &hostap_80211_ops;
881 break; 882 break;
882 case HOSTAP_INTERFACE_MASTER: 883 case HOSTAP_INTERFACE_MASTER:
883 dev->tx_queue_len = 0; /* use main radio device queue */
884 dev->netdev_ops = &hostap_master_ops; 884 dev->netdev_ops = &hostap_master_ops;
885 break; 885 break;
886 default: 886 default:
887 dev->tx_queue_len = 0; /* use main radio device queue */
887 dev->netdev_ops = &hostap_netdev_ops; 888 dev->netdev_ops = &hostap_netdev_ops;
888 } 889 }
889 890
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 6a13bfbc9d98..ca61d3796cef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2346,6 +2346,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
2346 .mod_params = &iwl4965_mod_params, 2346 .mod_params = &iwl4965_mod_params,
2347 .use_isr_legacy = true, 2347 .use_isr_legacy = true,
2348 .ht_greenfield_support = false, 2348 .ht_greenfield_support = false,
2349 .broken_powersave = true,
2349}; 2350};
2350 2351
2351/* Module firmware */ 2352/* Module firmware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 40b207aa8fef..346dc06fa7b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -760,6 +760,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
760 u16 high_low; 760 u16 high_low;
761 u8 switch_to_legacy = 0; 761 u8 switch_to_legacy = 0;
762 u8 is_green = lq_sta->is_green; 762 u8 is_green = lq_sta->is_green;
763 struct iwl_priv *priv = lq_sta->drv;
763 764
764 /* check if we need to switch from HT to legacy rates. 765 /* check if we need to switch from HT to legacy rates.
765 * assumption is that mandatory rates (1Mbps or 6Mbps) 766 * assumption is that mandatory rates (1Mbps or 6Mbps)
@@ -773,7 +774,8 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
773 tbl->lq_type = LQ_G; 774 tbl->lq_type = LQ_G;
774 775
775 if (num_of_ant(tbl->ant_type) > 1) 776 if (num_of_ant(tbl->ant_type) > 1)
776 tbl->ant_type = ANT_A;/*FIXME:RS*/ 777 tbl->ant_type =
778 first_antenna(priv->hw_params.valid_tx_ant);
777 779
778 tbl->is_ht40 = 0; 780 tbl->is_ht40 = 0;
779 tbl->is_SGI = 0; 781 tbl->is_SGI = 0;
@@ -883,6 +885,12 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
883 mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ 885 mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */
884 if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) 886 if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE))
885 mac_index++; 887 mac_index++;
888 /*
889 * mac80211 HT index is always zero-indexed; we need to move
890 * HT OFDM rates after CCK rates in 2.4 GHz band
891 */
892 if (priv->band == IEEE80211_BAND_2GHZ)
893 mac_index += IWL_FIRST_OFDM_RATE;
886 } 894 }
887 895
888 if ((mac_index < 0) || 896 if ((mac_index < 0) ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index acfd7b40afb8..fd26c0dc9c54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1585,9 +1585,12 @@ int iwl_setup_mac(struct iwl_priv *priv)
1585 hw->flags = IEEE80211_HW_SIGNAL_DBM | 1585 hw->flags = IEEE80211_HW_SIGNAL_DBM |
1586 IEEE80211_HW_NOISE_DBM | 1586 IEEE80211_HW_NOISE_DBM |
1587 IEEE80211_HW_AMPDU_AGGREGATION | 1587 IEEE80211_HW_AMPDU_AGGREGATION |
1588 IEEE80211_HW_SPECTRUM_MGMT | 1588 IEEE80211_HW_SPECTRUM_MGMT;
1589 IEEE80211_HW_SUPPORTS_PS | 1589
1590 IEEE80211_HW_SUPPORTS_DYNAMIC_PS; 1590 if (!priv->cfg->broken_powersave)
1591 hw->flags |= IEEE80211_HW_SUPPORTS_PS |
1592 IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
1593
1591 hw->wiphy->interface_modes = 1594 hw->wiphy->interface_modes =
1592 BIT(NL80211_IFTYPE_STATION) | 1595 BIT(NL80211_IFTYPE_STATION) |
1593 BIT(NL80211_IFTYPE_ADHOC); 1596 BIT(NL80211_IFTYPE_ADHOC);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index c04d2a270819..7ff9ffb2b702 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -252,6 +252,7 @@ struct iwl_cfg {
252 const u16 max_ll_items; 252 const u16 max_ll_items;
253 const bool shadow_ram_support; 253 const bool shadow_ram_support;
254 const bool ht_greenfield_support; 254 const bool ht_greenfield_support;
255 const bool broken_powersave;
255}; 256};
256 257
257/*************************** 258/***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 4ec6a8307cc6..60be976afff8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -292,8 +292,9 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
292 else 292 else
293 dtimper = 1; 293 dtimper = 1;
294 294
295 /* TT power setting overwrites everything */ 295 if (priv->cfg->broken_powersave)
296 if (tt->state >= IWL_TI_1) 296 iwl_power_sleep_cam_cmd(priv, &cmd);
297 else if (tt->state >= IWL_TI_1)
297 iwl_static_sleep_cmd(priv, &cmd, tt->tt_power_mode, dtimper); 298 iwl_static_sleep_cmd(priv, &cmd, tt->tt_power_mode, dtimper);
298 else if (!enabled) 299 else if (!enabled)
299 iwl_power_sleep_cam_cmd(priv, &cmd); 300 iwl_power_sleep_cam_cmd(priv, &cmd);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8150c5c3a16b..b90adcb73b06 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -239,26 +239,22 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
239 struct iwl_rx_queue *rxq = &priv->rxq; 239 struct iwl_rx_queue *rxq = &priv->rxq;
240 struct list_head *element; 240 struct list_head *element;
241 struct iwl_rx_mem_buffer *rxb; 241 struct iwl_rx_mem_buffer *rxb;
242 struct sk_buff *skb;
242 unsigned long flags; 243 unsigned long flags;
243 244
244 while (1) { 245 while (1) {
245 spin_lock_irqsave(&rxq->lock, flags); 246 spin_lock_irqsave(&rxq->lock, flags);
246
247 if (list_empty(&rxq->rx_used)) { 247 if (list_empty(&rxq->rx_used)) {
248 spin_unlock_irqrestore(&rxq->lock, flags); 248 spin_unlock_irqrestore(&rxq->lock, flags);
249 return; 249 return;
250 } 250 }
251 element = rxq->rx_used.next;
252 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
253 list_del(element);
254
255 spin_unlock_irqrestore(&rxq->lock, flags); 251 spin_unlock_irqrestore(&rxq->lock, flags);
256 252
257 /* Alloc a new receive buffer */ 253 /* Alloc a new receive buffer */
258 rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, 254 skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
259 priority); 255 priority);
260 256
261 if (!rxb->skb) { 257 if (!skb) {
262 IWL_CRIT(priv, "Can not allocate SKB buffers\n"); 258 IWL_CRIT(priv, "Can not allocate SKB buffers\n");
263 /* We don't reschedule replenish work here -- we will 259 /* We don't reschedule replenish work here -- we will
264 * call the restock method and if it still needs 260 * call the restock method and if it still needs
@@ -266,6 +262,20 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
266 break; 262 break;
267 } 263 }
268 264
265 spin_lock_irqsave(&rxq->lock, flags);
266
267 if (list_empty(&rxq->rx_used)) {
268 spin_unlock_irqrestore(&rxq->lock, flags);
269 dev_kfree_skb_any(skb);
270 return;
271 }
272 element = rxq->rx_used.next;
273 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
274 list_del(element);
275
276 spin_unlock_irqrestore(&rxq->lock, flags);
277
278 rxb->skb = skb;
269 /* Get physical address of RB/SKB */ 279 /* Get physical address of RB/SKB */
270 rxb->real_dma_addr = pci_map_single( 280 rxb->real_dma_addr = pci_map_single(
271 priv->pci_dev, 281 priv->pci_dev,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2238c9f2018c..090966837f3c 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1134,6 +1134,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1134 struct iwl_rx_queue *rxq = &priv->rxq; 1134 struct iwl_rx_queue *rxq = &priv->rxq;
1135 struct list_head *element; 1135 struct list_head *element;
1136 struct iwl_rx_mem_buffer *rxb; 1136 struct iwl_rx_mem_buffer *rxb;
1137 struct sk_buff *skb;
1137 unsigned long flags; 1138 unsigned long flags;
1138 1139
1139 while (1) { 1140 while (1) {
@@ -1143,17 +1144,11 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1143 spin_unlock_irqrestore(&rxq->lock, flags); 1144 spin_unlock_irqrestore(&rxq->lock, flags);
1144 return; 1145 return;
1145 } 1146 }
1146
1147 element = rxq->rx_used.next;
1148 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1149 list_del(element);
1150 spin_unlock_irqrestore(&rxq->lock, flags); 1147 spin_unlock_irqrestore(&rxq->lock, flags);
1151 1148
1152 /* Alloc a new receive buffer */ 1149 /* Alloc a new receive buffer */
1153 rxb->skb = 1150 skb = alloc_skb(priv->hw_params.rx_buf_size, priority);
1154 alloc_skb(priv->hw_params.rx_buf_size, 1151 if (!skb) {
1155 priority);
1156 if (!rxb->skb) {
1157 if (net_ratelimit()) 1152 if (net_ratelimit())
1158 IWL_CRIT(priv, ": Can not allocate SKB buffers\n"); 1153 IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
1159 /* We don't reschedule replenish work here -- we will 1154 /* We don't reschedule replenish work here -- we will
@@ -1162,6 +1157,19 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1162 break; 1157 break;
1163 } 1158 }
1164 1159
1160 spin_lock_irqsave(&rxq->lock, flags);
1161 if (list_empty(&rxq->rx_used)) {
1162 spin_unlock_irqrestore(&rxq->lock, flags);
1163 dev_kfree_skb_any(skb);
1164 return;
1165 }
1166 element = rxq->rx_used.next;
1167 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1168 list_del(element);
1169 spin_unlock_irqrestore(&rxq->lock, flags);
1170
1171 rxb->skb = skb;
1172
1165 /* If radiotap head is required, reserve some headroom here. 1173 /* If radiotap head is required, reserve some headroom here.
1166 * The physical head count is a variable rx_stats->phy_count. 1174 * The physical head count is a variable rx_stats->phy_count.
1167 * We reserve 4 bytes here. Plus these extra bytes, the 1175 * We reserve 4 bytes here. Plus these extra bytes, the
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index e44460ff149c..17e199546eeb 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -67,6 +67,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
67 {USB_DEVICE(0x0bf8, 0x1009)}, /* FUJITSU E-5400 USB D1700*/ 67 {USB_DEVICE(0x0bf8, 0x1009)}, /* FUJITSU E-5400 USB D1700*/
68 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion MD40900 */ 68 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion MD40900 */
69 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ 69 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */
70 {USB_DEVICE(0x0cde, 0x0015)}, /* Zcomax XG-705A */
70 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ 71 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */
71 {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */ 72 {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */
72 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ 73 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index d9169b47ac42..27298b19d5bd 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -644,11 +644,10 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
644{ 644{
645 struct wl1271 *wl = hw->priv; 645 struct wl1271 *wl = hw->priv;
646 struct sk_buff *beacon; 646 struct sk_buff *beacon;
647 DECLARE_MAC_BUF(mac);
648 int ret; 647 int ret;
649 648
650 wl1271_debug(DEBUG_MAC80211, "mac80211 config_interface bssid %s", 649 wl1271_debug(DEBUG_MAC80211, "mac80211 config_interface bssid %pM",
651 print_mac(mac, conf->bssid)); 650 conf->bssid);
652 wl1271_dump_ascii(DEBUG_MAC80211, "ssid: ", conf->ssid, 651 wl1271_dump_ascii(DEBUG_MAC80211, "ssid: ", conf->ssid,
653 conf->ssid_len); 652 conf->ssid_len);
654 653