aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorSathya Perla <sathyap@serverengines.com>2009-07-27 18:52:03 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-02 02:06:20 -0400
commit8788fdc2a53cf012a43808877eaa6ac7e3c923b4 (patch)
treeef62e30494ee1aaced18250ddb7295ff0bb28f7a /drivers/net/benet/be_main.c
parent2f6d7c1b34403b97fa57473edcb6749d1db5ace3 (diff)
be2net: get rid of be_ctrl_info struct/abstraction
Currently only the be_ctrl_info struct ptr (instead of adapter) is passed to all the routines in be_cmds.c. Instead pass be_adapter ptr to allow access to all its fields. Merge the contents of struct be_ctrl_info into be_adapter. The resulting code is simpler. Signed-off-by: Sathya Perla <sathyap@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r--drivers/net/benet/be_main.c229
1 files changed, 103 insertions, 126 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c56487e3700b..da5341f10384 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include "be.h" 18#include "be.h"
19#include "be_cmds.h"
19#include <asm/div64.h> 20#include <asm/div64.h>
20 21
21MODULE_VERSION(DRV_VER); 22MODULE_VERSION(DRV_VER);
@@ -60,9 +61,9 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
60 return 0; 61 return 0;
61} 62}
62 63
63static void be_intr_set(struct be_ctrl_info *ctrl, bool enable) 64static void be_intr_set(struct be_adapter *adapter, bool enable)
64{ 65{
65 u8 __iomem *addr = ctrl->pcicfg + PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET; 66 u8 __iomem *addr = adapter->pcicfg + PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET;
66 u32 reg = ioread32(addr); 67 u32 reg = ioread32(addr);
67 u32 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 68 u32 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
68 if (!enabled && enable) { 69 if (!enabled && enable) {
@@ -77,23 +78,23 @@ static void be_intr_set(struct be_ctrl_info *ctrl, bool enable)
77 iowrite32(reg, addr); 78 iowrite32(reg, addr);
78} 79}
79 80
80static void be_rxq_notify(struct be_ctrl_info *ctrl, u16 qid, u16 posted) 81static void be_rxq_notify(struct be_adapter *adapter, u16 qid, u16 posted)
81{ 82{
82 u32 val = 0; 83 u32 val = 0;
83 val |= qid & DB_RQ_RING_ID_MASK; 84 val |= qid & DB_RQ_RING_ID_MASK;
84 val |= posted << DB_RQ_NUM_POSTED_SHIFT; 85 val |= posted << DB_RQ_NUM_POSTED_SHIFT;
85 iowrite32(val, ctrl->db + DB_RQ_OFFSET); 86 iowrite32(val, adapter->db + DB_RQ_OFFSET);
86} 87}
87 88
88static void be_txq_notify(struct be_ctrl_info *ctrl, u16 qid, u16 posted) 89static void be_txq_notify(struct be_adapter *adapter, u16 qid, u16 posted)
89{ 90{
90 u32 val = 0; 91 u32 val = 0;
91 val |= qid & DB_TXULP_RING_ID_MASK; 92 val |= qid & DB_TXULP_RING_ID_MASK;
92 val |= (posted & DB_TXULP_NUM_POSTED_MASK) << DB_TXULP_NUM_POSTED_SHIFT; 93 val |= (posted & DB_TXULP_NUM_POSTED_MASK) << DB_TXULP_NUM_POSTED_SHIFT;
93 iowrite32(val, ctrl->db + DB_TXULP1_OFFSET); 94 iowrite32(val, adapter->db + DB_TXULP1_OFFSET);
94} 95}
95 96
96static void be_eq_notify(struct be_ctrl_info *ctrl, u16 qid, 97static void be_eq_notify(struct be_adapter *adapter, u16 qid,
97 bool arm, bool clear_int, u16 num_popped) 98 bool arm, bool clear_int, u16 num_popped)
98{ 99{
99 u32 val = 0; 100 u32 val = 0;
@@ -104,18 +105,17 @@ static void be_eq_notify(struct be_ctrl_info *ctrl, u16 qid,
104 val |= 1 << DB_EQ_CLR_SHIFT; 105 val |= 1 << DB_EQ_CLR_SHIFT;
105 val |= 1 << DB_EQ_EVNT_SHIFT; 106 val |= 1 << DB_EQ_EVNT_SHIFT;
106 val |= num_popped << DB_EQ_NUM_POPPED_SHIFT; 107 val |= num_popped << DB_EQ_NUM_POPPED_SHIFT;
107 iowrite32(val, ctrl->db + DB_EQ_OFFSET); 108 iowrite32(val, adapter->db + DB_EQ_OFFSET);
108} 109}
109 110
110void be_cq_notify(struct be_ctrl_info *ctrl, u16 qid, 111void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped)
111 bool arm, u16 num_popped)
112{ 112{
113 u32 val = 0; 113 u32 val = 0;
114 val |= qid & DB_CQ_RING_ID_MASK; 114 val |= qid & DB_CQ_RING_ID_MASK;
115 if (arm) 115 if (arm)
116 val |= 1 << DB_CQ_REARM_SHIFT; 116 val |= 1 << DB_CQ_REARM_SHIFT;
117 val |= num_popped << DB_CQ_NUM_POPPED_SHIFT; 117 val |= num_popped << DB_CQ_NUM_POPPED_SHIFT;
118 iowrite32(val, ctrl->db + DB_CQ_OFFSET); 118 iowrite32(val, adapter->db + DB_CQ_OFFSET);
119} 119}
120 120
121 121
@@ -126,12 +126,12 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
126 int status = 0; 126 int status = 0;
127 127
128 if (netif_running(netdev)) { 128 if (netif_running(netdev)) {
129 status = be_cmd_pmac_del(&adapter->ctrl, adapter->if_handle, 129 status = be_cmd_pmac_del(adapter, adapter->if_handle,
130 adapter->pmac_id); 130 adapter->pmac_id);
131 if (status) 131 if (status)
132 return status; 132 return status;
133 133
134 status = be_cmd_pmac_add(&adapter->ctrl, (u8 *)addr->sa_data, 134 status = be_cmd_pmac_add(adapter, (u8 *)addr->sa_data,
135 adapter->if_handle, &adapter->pmac_id); 135 adapter->if_handle, &adapter->pmac_id);
136 } 136 }
137 137
@@ -214,9 +214,8 @@ static void netdev_stats_update(struct be_adapter *adapter)
214 dev_stats->tx_window_errors = 0; 214 dev_stats->tx_window_errors = 0;
215} 215}
216 216
217void be_link_status_update(void *ctxt, bool link_up) 217void be_link_status_update(struct be_adapter *adapter, bool link_up)
218{ 218{
219 struct be_adapter *adapter = ctxt;
220 struct net_device *netdev = adapter->netdev; 219 struct net_device *netdev = adapter->netdev;
221 220
222 /* If link came up or went down */ 221 /* If link came up or went down */
@@ -237,7 +236,6 @@ void be_link_status_update(void *ctxt, bool link_up)
237/* Update the EQ delay n BE based on the RX frags consumed / sec */ 236/* Update the EQ delay n BE based on the RX frags consumed / sec */
238static void be_rx_eqd_update(struct be_adapter *adapter) 237static void be_rx_eqd_update(struct be_adapter *adapter)
239{ 238{
240 struct be_ctrl_info *ctrl = &adapter->ctrl;
241 struct be_eq_obj *rx_eq = &adapter->rx_eq; 239 struct be_eq_obj *rx_eq = &adapter->rx_eq;
242 struct be_drvr_stats *stats = &adapter->stats.drvr_stats; 240 struct be_drvr_stats *stats = &adapter->stats.drvr_stats;
243 ulong now = jiffies; 241 ulong now = jiffies;
@@ -270,7 +268,7 @@ static void be_rx_eqd_update(struct be_adapter *adapter)
270 if (eqd < 10) 268 if (eqd < 10)
271 eqd = 0; 269 eqd = 0;
272 if (eqd != rx_eq->cur_eqd) 270 if (eqd != rx_eq->cur_eqd)
273 be_cmd_modify_eqd(ctrl, rx_eq->q.id, eqd); 271 be_cmd_modify_eqd(adapter, rx_eq->q.id, eqd);
274 272
275 rx_eq->cur_eqd = eqd; 273 rx_eq->cur_eqd = eqd;
276} 274}
@@ -412,8 +410,8 @@ static int make_tx_wrbs(struct be_adapter *adapter,
412 struct skb_frag_struct *frag = 410 struct skb_frag_struct *frag =
413 &skb_shinfo(skb)->frags[i]; 411 &skb_shinfo(skb)->frags[i];
414 busaddr = pci_map_page(pdev, frag->page, 412 busaddr = pci_map_page(pdev, frag->page,
415 frag->page_offset, 413 frag->page_offset,
416 frag->size, PCI_DMA_TODEVICE); 414 frag->size, PCI_DMA_TODEVICE);
417 wrb = queue_head_node(txq); 415 wrb = queue_head_node(txq);
418 wrb_fill(wrb, busaddr, frag->size); 416 wrb_fill(wrb, busaddr, frag->size);
419 be_dws_cpu_to_le(wrb, sizeof(*wrb)); 417 be_dws_cpu_to_le(wrb, sizeof(*wrb));
@@ -461,7 +459,7 @@ static int be_xmit(struct sk_buff *skb, struct net_device *netdev)
461 stopped = true; 459 stopped = true;
462 } 460 }
463 461
464 be_txq_notify(&adapter->ctrl, txq->id, wrb_cnt); 462 be_txq_notify(adapter, txq->id, wrb_cnt);
465 463
466 be_tx_stats_update(adapter, wrb_cnt, copied, stopped); 464 be_tx_stats_update(adapter, wrb_cnt, copied, stopped);
467 return NETDEV_TX_OK; 465 return NETDEV_TX_OK;
@@ -502,10 +500,10 @@ static void be_vid_config(struct net_device *netdev)
502 ntags++; 500 ntags++;
503 } 501 }
504 } 502 }
505 be_cmd_vlan_config(&adapter->ctrl, adapter->if_handle, 503 be_cmd_vlan_config(adapter, adapter->if_handle,
506 vtag, ntags, 1, 0); 504 vtag, ntags, 1, 0);
507 } else { 505 } else {
508 be_cmd_vlan_config(&adapter->ctrl, adapter->if_handle, 506 be_cmd_vlan_config(adapter, adapter->if_handle,
509 NULL, 0, 1, 1); 507 NULL, 0, 1, 1);
510 } 508 }
511} 509}
@@ -515,13 +513,12 @@ static void be_vlan_register(struct net_device *netdev, struct vlan_group *grp)
515 struct be_adapter *adapter = netdev_priv(netdev); 513 struct be_adapter *adapter = netdev_priv(netdev);
516 struct be_eq_obj *rx_eq = &adapter->rx_eq; 514 struct be_eq_obj *rx_eq = &adapter->rx_eq;
517 struct be_eq_obj *tx_eq = &adapter->tx_eq; 515 struct be_eq_obj *tx_eq = &adapter->tx_eq;
518 struct be_ctrl_info *ctrl = &adapter->ctrl;
519 516
520 be_eq_notify(ctrl, rx_eq->q.id, false, false, 0); 517 be_eq_notify(adapter, rx_eq->q.id, false, false, 0);
521 be_eq_notify(ctrl, tx_eq->q.id, false, false, 0); 518 be_eq_notify(adapter, tx_eq->q.id, false, false, 0);
522 adapter->vlan_grp = grp; 519 adapter->vlan_grp = grp;
523 be_eq_notify(ctrl, rx_eq->q.id, true, false, 0); 520 be_eq_notify(adapter, rx_eq->q.id, true, false, 0);
524 be_eq_notify(ctrl, tx_eq->q.id, true, false, 0); 521 be_eq_notify(adapter, tx_eq->q.id, true, false, 0);
525} 522}
526 523
527static void be_vlan_add_vid(struct net_device *netdev, u16 vid) 524static void be_vlan_add_vid(struct net_device *netdev, u16 vid)
@@ -548,10 +545,9 @@ static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
548static void be_set_multicast_list(struct net_device *netdev) 545static void be_set_multicast_list(struct net_device *netdev)
549{ 546{
550 struct be_adapter *adapter = netdev_priv(netdev); 547 struct be_adapter *adapter = netdev_priv(netdev);
551 struct be_ctrl_info *ctrl = &adapter->ctrl;
552 548
553 if (netdev->flags & IFF_PROMISC) { 549 if (netdev->flags & IFF_PROMISC) {
554 be_cmd_promiscuous_config(ctrl, adapter->port_num, 1); 550 be_cmd_promiscuous_config(adapter, adapter->port_num, 1);
555 adapter->promiscuous = true; 551 adapter->promiscuous = true;
556 goto done; 552 goto done;
557 } 553 }
@@ -559,15 +555,15 @@ static void be_set_multicast_list(struct net_device *netdev)
559 /* BE was previously in promiscous mode; disable it */ 555 /* BE was previously in promiscous mode; disable it */
560 if (adapter->promiscuous) { 556 if (adapter->promiscuous) {
561 adapter->promiscuous = false; 557 adapter->promiscuous = false;
562 be_cmd_promiscuous_config(ctrl, adapter->port_num, 0); 558 be_cmd_promiscuous_config(adapter, adapter->port_num, 0);
563 } 559 }
564 560
565 if (netdev->flags & IFF_ALLMULTI) { 561 if (netdev->flags & IFF_ALLMULTI) {
566 be_cmd_multicast_set(ctrl, adapter->if_handle, NULL, 0); 562 be_cmd_multicast_set(adapter, adapter->if_handle, NULL, 0);
567 goto done; 563 goto done;
568 } 564 }
569 565
570 be_cmd_multicast_set(ctrl, adapter->if_handle, netdev->mc_list, 566 be_cmd_multicast_set(adapter, adapter->if_handle, netdev->mc_list,
571 netdev->mc_count); 567 netdev->mc_count);
572done: 568done:
573 return; 569 return;
@@ -942,7 +938,7 @@ static void be_post_rx_frags(struct be_adapter *adapter)
942 938
943 if (posted) { 939 if (posted) {
944 atomic_add(posted, &rxq->used); 940 atomic_add(posted, &rxq->used);
945 be_rxq_notify(&adapter->ctrl, rxq->id, posted); 941 be_rxq_notify(adapter, rxq->id, posted);
946 } else if (atomic_read(&rxq->used) == 0) { 942 } else if (atomic_read(&rxq->used) == 0) {
947 /* Let be_worker replenish when memory is available */ 943 /* Let be_worker replenish when memory is available */
948 adapter->rx_post_starved = true; 944 adapter->rx_post_starved = true;
@@ -1010,7 +1006,7 @@ static void be_rx_q_clean(struct be_adapter *adapter)
1010 while ((rxcp = be_rx_compl_get(adapter)) != NULL) { 1006 while ((rxcp = be_rx_compl_get(adapter)) != NULL) {
1011 be_rx_compl_discard(adapter, rxcp); 1007 be_rx_compl_discard(adapter, rxcp);
1012 be_rx_compl_reset(rxcp); 1008 be_rx_compl_reset(rxcp);
1013 be_cq_notify(&adapter->ctrl, rx_cq->id, true, 1); 1009 be_cq_notify(adapter, rx_cq->id, true, 1);
1014 } 1010 }
1015 1011
1016 /* Then free posted rx buffer that were not used */ 1012 /* Then free posted rx buffer that were not used */
@@ -1043,16 +1039,15 @@ static void be_tx_q_clean(struct be_adapter *adapter)
1043static void be_mcc_queues_destroy(struct be_adapter *adapter) 1039static void be_mcc_queues_destroy(struct be_adapter *adapter)
1044{ 1040{
1045 struct be_queue_info *q; 1041 struct be_queue_info *q;
1046 struct be_ctrl_info *ctrl = &adapter->ctrl;
1047 1042
1048 q = &ctrl->mcc_obj.q; 1043 q = &adapter->mcc_obj.q;
1049 if (q->created) 1044 if (q->created)
1050 be_cmd_q_destroy(ctrl, q, QTYPE_MCCQ); 1045 be_cmd_q_destroy(adapter, q, QTYPE_MCCQ);
1051 be_queue_free(adapter, q); 1046 be_queue_free(adapter, q);
1052 1047
1053 q = &ctrl->mcc_obj.cq; 1048 q = &adapter->mcc_obj.cq;
1054 if (q->created) 1049 if (q->created)
1055 be_cmd_q_destroy(ctrl, q, QTYPE_CQ); 1050 be_cmd_q_destroy(adapter, q, QTYPE_CQ);
1056 be_queue_free(adapter, q); 1051 be_queue_free(adapter, q);
1057} 1052}
1058 1053
@@ -1060,25 +1055,24 @@ static void be_mcc_queues_destroy(struct be_adapter *adapter)
1060static int be_mcc_queues_create(struct be_adapter *adapter) 1055static int be_mcc_queues_create(struct be_adapter *adapter)
1061{ 1056{
1062 struct be_queue_info *q, *cq; 1057 struct be_queue_info *q, *cq;
1063 struct be_ctrl_info *ctrl = &adapter->ctrl;
1064 1058
1065 /* Alloc MCC compl queue */ 1059 /* Alloc MCC compl queue */
1066 cq = &ctrl->mcc_obj.cq; 1060 cq = &adapter->mcc_obj.cq;
1067 if (be_queue_alloc(adapter, cq, MCC_CQ_LEN, 1061 if (be_queue_alloc(adapter, cq, MCC_CQ_LEN,
1068 sizeof(struct be_mcc_cq_entry))) 1062 sizeof(struct be_mcc_cq_entry)))
1069 goto err; 1063 goto err;
1070 1064
1071 /* Ask BE to create MCC compl queue; share TX's eq */ 1065 /* Ask BE to create MCC compl queue; share TX's eq */
1072 if (be_cmd_cq_create(ctrl, cq, &adapter->tx_eq.q, false, true, 0)) 1066 if (be_cmd_cq_create(adapter, cq, &adapter->tx_eq.q, false, true, 0))
1073 goto mcc_cq_free; 1067 goto mcc_cq_free;
1074 1068
1075 /* Alloc MCC queue */ 1069 /* Alloc MCC queue */
1076 q = &ctrl->mcc_obj.q; 1070 q = &adapter->mcc_obj.q;
1077 if (be_queue_alloc(adapter, q, MCC_Q_LEN, sizeof(struct be_mcc_wrb))) 1071 if (be_queue_alloc(adapter, q, MCC_Q_LEN, sizeof(struct be_mcc_wrb)))
1078 goto mcc_cq_destroy; 1072 goto mcc_cq_destroy;
1079 1073
1080 /* Ask BE to create MCC queue */ 1074 /* Ask BE to create MCC queue */
1081 if (be_cmd_mccq_create(ctrl, q, cq)) 1075 if (be_cmd_mccq_create(adapter, q, cq))
1082 goto mcc_q_free; 1076 goto mcc_q_free;
1083 1077
1084 return 0; 1078 return 0;
@@ -1086,7 +1080,7 @@ static int be_mcc_queues_create(struct be_adapter *adapter)
1086mcc_q_free: 1080mcc_q_free:
1087 be_queue_free(adapter, q); 1081 be_queue_free(adapter, q);
1088mcc_cq_destroy: 1082mcc_cq_destroy:
1089 be_cmd_q_destroy(ctrl, cq, QTYPE_CQ); 1083 be_cmd_q_destroy(adapter, cq, QTYPE_CQ);
1090mcc_cq_free: 1084mcc_cq_free:
1091 be_queue_free(adapter, cq); 1085 be_queue_free(adapter, cq);
1092err: 1086err:
@@ -1099,7 +1093,7 @@ static void be_tx_queues_destroy(struct be_adapter *adapter)
1099 1093
1100 q = &adapter->tx_obj.q; 1094 q = &adapter->tx_obj.q;
1101 if (q->created) { 1095 if (q->created) {
1102 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_TXQ); 1096 be_cmd_q_destroy(adapter, q, QTYPE_TXQ);
1103 1097
1104 /* No more tx completions can be rcvd now; clean up if there 1098 /* No more tx completions can be rcvd now; clean up if there
1105 * are any pending completions or pending tx requests */ 1099 * are any pending completions or pending tx requests */
@@ -1109,12 +1103,12 @@ static void be_tx_queues_destroy(struct be_adapter *adapter)
1109 1103
1110 q = &adapter->tx_obj.cq; 1104 q = &adapter->tx_obj.cq;
1111 if (q->created) 1105 if (q->created)
1112 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_CQ); 1106 be_cmd_q_destroy(adapter, q, QTYPE_CQ);
1113 be_queue_free(adapter, q); 1107 be_queue_free(adapter, q);
1114 1108
1115 q = &adapter->tx_eq.q; 1109 q = &adapter->tx_eq.q;
1116 if (q->created) 1110 if (q->created)
1117 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_EQ); 1111 be_cmd_q_destroy(adapter, q, QTYPE_EQ);
1118 be_queue_free(adapter, q); 1112 be_queue_free(adapter, q);
1119} 1113}
1120 1114
@@ -1132,7 +1126,7 @@ static int be_tx_queues_create(struct be_adapter *adapter)
1132 return -1; 1126 return -1;
1133 1127
1134 /* Ask BE to create Tx Event queue */ 1128 /* Ask BE to create Tx Event queue */
1135 if (be_cmd_eq_create(&adapter->ctrl, eq, adapter->tx_eq.cur_eqd)) 1129 if (be_cmd_eq_create(adapter, eq, adapter->tx_eq.cur_eqd))
1136 goto tx_eq_free; 1130 goto tx_eq_free;
1137 /* Alloc TX eth compl queue */ 1131 /* Alloc TX eth compl queue */
1138 cq = &adapter->tx_obj.cq; 1132 cq = &adapter->tx_obj.cq;
@@ -1141,7 +1135,7 @@ static int be_tx_queues_create(struct be_adapter *adapter)
1141 goto tx_eq_destroy; 1135 goto tx_eq_destroy;
1142 1136
1143 /* Ask BE to create Tx eth compl queue */ 1137 /* Ask BE to create Tx eth compl queue */
1144 if (be_cmd_cq_create(&adapter->ctrl, cq, eq, false, false, 3)) 1138 if (be_cmd_cq_create(adapter, cq, eq, false, false, 3))
1145 goto tx_cq_free; 1139 goto tx_cq_free;
1146 1140
1147 /* Alloc TX eth queue */ 1141 /* Alloc TX eth queue */
@@ -1150,18 +1144,18 @@ static int be_tx_queues_create(struct be_adapter *adapter)
1150 goto tx_cq_destroy; 1144 goto tx_cq_destroy;
1151 1145
1152 /* Ask BE to create Tx eth queue */ 1146 /* Ask BE to create Tx eth queue */
1153 if (be_cmd_txq_create(&adapter->ctrl, q, cq)) 1147 if (be_cmd_txq_create(adapter, q, cq))
1154 goto tx_q_free; 1148 goto tx_q_free;
1155 return 0; 1149 return 0;
1156 1150
1157tx_q_free: 1151tx_q_free:
1158 be_queue_free(adapter, q); 1152 be_queue_free(adapter, q);
1159tx_cq_destroy: 1153tx_cq_destroy:
1160 be_cmd_q_destroy(&adapter->ctrl, cq, QTYPE_CQ); 1154 be_cmd_q_destroy(adapter, cq, QTYPE_CQ);
1161tx_cq_free: 1155tx_cq_free:
1162 be_queue_free(adapter, cq); 1156 be_queue_free(adapter, cq);
1163tx_eq_destroy: 1157tx_eq_destroy:
1164 be_cmd_q_destroy(&adapter->ctrl, eq, QTYPE_EQ); 1158 be_cmd_q_destroy(adapter, eq, QTYPE_EQ);
1165tx_eq_free: 1159tx_eq_free:
1166 be_queue_free(adapter, eq); 1160 be_queue_free(adapter, eq);
1167 return -1; 1161 return -1;
@@ -1173,19 +1167,19 @@ static void be_rx_queues_destroy(struct be_adapter *adapter)
1173 1167
1174 q = &adapter->rx_obj.q; 1168 q = &adapter->rx_obj.q;
1175 if (q->created) { 1169 if (q->created) {
1176 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_RXQ); 1170 be_cmd_q_destroy(adapter, q, QTYPE_RXQ);
1177 be_rx_q_clean(adapter); 1171 be_rx_q_clean(adapter);
1178 } 1172 }
1179 be_queue_free(adapter, q); 1173 be_queue_free(adapter, q);
1180 1174
1181 q = &adapter->rx_obj.cq; 1175 q = &adapter->rx_obj.cq;
1182 if (q->created) 1176 if (q->created)
1183 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_CQ); 1177 be_cmd_q_destroy(adapter, q, QTYPE_CQ);
1184 be_queue_free(adapter, q); 1178 be_queue_free(adapter, q);
1185 1179
1186 q = &adapter->rx_eq.q; 1180 q = &adapter->rx_eq.q;
1187 if (q->created) 1181 if (q->created)
1188 be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_EQ); 1182 be_cmd_q_destroy(adapter, q, QTYPE_EQ);
1189 be_queue_free(adapter, q); 1183 be_queue_free(adapter, q);
1190} 1184}
1191 1185
@@ -1208,7 +1202,7 @@ static int be_rx_queues_create(struct be_adapter *adapter)
1208 return rc; 1202 return rc;
1209 1203
1210 /* Ask BE to create Rx Event queue */ 1204 /* Ask BE to create Rx Event queue */
1211 rc = be_cmd_eq_create(&adapter->ctrl, eq, adapter->rx_eq.cur_eqd); 1205 rc = be_cmd_eq_create(adapter, eq, adapter->rx_eq.cur_eqd);
1212 if (rc) 1206 if (rc)
1213 goto rx_eq_free; 1207 goto rx_eq_free;
1214 1208
@@ -1220,7 +1214,7 @@ static int be_rx_queues_create(struct be_adapter *adapter)
1220 goto rx_eq_destroy; 1214 goto rx_eq_destroy;
1221 1215
1222 /* Ask BE to create Rx eth compl queue */ 1216 /* Ask BE to create Rx eth compl queue */
1223 rc = be_cmd_cq_create(&adapter->ctrl, cq, eq, false, false, 3); 1217 rc = be_cmd_cq_create(adapter, cq, eq, false, false, 3);
1224 if (rc) 1218 if (rc)
1225 goto rx_cq_free; 1219 goto rx_cq_free;
1226 1220
@@ -1231,7 +1225,7 @@ static int be_rx_queues_create(struct be_adapter *adapter)
1231 goto rx_cq_destroy; 1225 goto rx_cq_destroy;
1232 1226
1233 /* Ask BE to create Rx eth queue */ 1227 /* Ask BE to create Rx eth queue */
1234 rc = be_cmd_rxq_create(&adapter->ctrl, q, cq->id, rx_frag_size, 1228 rc = be_cmd_rxq_create(adapter, q, cq->id, rx_frag_size,
1235 BE_MAX_JUMBO_FRAME_SIZE, adapter->if_handle, false); 1229 BE_MAX_JUMBO_FRAME_SIZE, adapter->if_handle, false);
1236 if (rc) 1230 if (rc)
1237 goto rx_q_free; 1231 goto rx_q_free;
@@ -1240,11 +1234,11 @@ static int be_rx_queues_create(struct be_adapter *adapter)
1240rx_q_free: 1234rx_q_free:
1241 be_queue_free(adapter, q); 1235 be_queue_free(adapter, q);
1242rx_cq_destroy: 1236rx_cq_destroy:
1243 be_cmd_q_destroy(&adapter->ctrl, cq, QTYPE_CQ); 1237 be_cmd_q_destroy(adapter, cq, QTYPE_CQ);
1244rx_cq_free: 1238rx_cq_free:
1245 be_queue_free(adapter, cq); 1239 be_queue_free(adapter, cq);
1246rx_eq_destroy: 1240rx_eq_destroy:
1247 be_cmd_q_destroy(&adapter->ctrl, eq, QTYPE_EQ); 1241 be_cmd_q_destroy(adapter, eq, QTYPE_EQ);
1248rx_eq_free: 1242rx_eq_free:
1249 be_queue_free(adapter, eq); 1243 be_queue_free(adapter, eq);
1250 return rc; 1244 return rc;
@@ -1264,8 +1258,7 @@ static bool event_get(struct be_eq_obj *eq_obj, u16 *rid)
1264 return true; 1258 return true;
1265} 1259}
1266 1260
1267static int event_handle(struct be_ctrl_info *ctrl, 1261static int event_handle(struct be_adapter *adapter, struct be_eq_obj *eq_obj)
1268 struct be_eq_obj *eq_obj)
1269{ 1262{
1270 u16 rid = 0, num = 0; 1263 u16 rid = 0, num = 0;
1271 1264
@@ -1273,7 +1266,7 @@ static int event_handle(struct be_ctrl_info *ctrl,
1273 num++; 1266 num++;
1274 1267
1275 /* We can see an interrupt and no event */ 1268 /* We can see an interrupt and no event */
1276 be_eq_notify(ctrl, eq_obj->q.id, true, true, num); 1269 be_eq_notify(adapter, eq_obj->q.id, true, true, num);
1277 if (num) 1270 if (num)
1278 napi_schedule(&eq_obj->napi); 1271 napi_schedule(&eq_obj->napi);
1279 1272
@@ -1283,25 +1276,24 @@ static int event_handle(struct be_ctrl_info *ctrl,
1283static irqreturn_t be_intx(int irq, void *dev) 1276static irqreturn_t be_intx(int irq, void *dev)
1284{ 1277{
1285 struct be_adapter *adapter = dev; 1278 struct be_adapter *adapter = dev;
1286 struct be_ctrl_info *ctrl = &adapter->ctrl; 1279 int isr;
1287 int isr;
1288 1280
1289 isr = ioread32(ctrl->csr + CEV_ISR0_OFFSET + 1281 isr = ioread32(adapter->csr + CEV_ISR0_OFFSET +
1290 ctrl->pci_func * CEV_ISR_SIZE); 1282 adapter->pci_func * CEV_ISR_SIZE);
1291 if (!isr) 1283 if (!isr)
1292 return IRQ_NONE; 1284 return IRQ_NONE;
1293 1285
1294 event_handle(ctrl, &adapter->tx_eq); 1286 event_handle(adapter, &adapter->tx_eq);
1295 event_handle(ctrl, &adapter->rx_eq); 1287 event_handle(adapter, &adapter->rx_eq);
1296 1288
1297 return IRQ_HANDLED; 1289 return IRQ_HANDLED;
1298} 1290}
1299 1291
1300static irqreturn_t be_msix_rx(int irq, void *dev) 1292static irqreturn_t be_msix_rx(int irq, void *dev)
1301{ 1293{
1302 struct be_adapter *adapter = dev; 1294 struct be_adapter *adapter = dev;
1303 1295
1304 event_handle(&adapter->ctrl, &adapter->rx_eq); 1296 event_handle(adapter, &adapter->rx_eq);
1305 1297
1306 return IRQ_HANDLED; 1298 return IRQ_HANDLED;
1307} 1299}
@@ -1310,7 +1302,7 @@ static irqreturn_t be_msix_tx_mcc(int irq, void *dev)
1310{ 1302{
1311 struct be_adapter *adapter = dev; 1303 struct be_adapter *adapter = dev;
1312 1304
1313 event_handle(&adapter->ctrl, &adapter->tx_eq); 1305 event_handle(adapter, &adapter->tx_eq);
1314 1306
1315 return IRQ_HANDLED; 1307 return IRQ_HANDLED;
1316} 1308}
@@ -1356,10 +1348,10 @@ int be_poll_rx(struct napi_struct *napi, int budget)
1356 /* All consumed */ 1348 /* All consumed */
1357 if (work_done < budget) { 1349 if (work_done < budget) {
1358 napi_complete(napi); 1350 napi_complete(napi);
1359 be_cq_notify(&adapter->ctrl, rx_cq->id, true, work_done); 1351 be_cq_notify(adapter, rx_cq->id, true, work_done);
1360 } else { 1352 } else {
1361 /* More to be consumed; continue with interrupts disabled */ 1353 /* More to be consumed; continue with interrupts disabled */
1362 be_cq_notify(&adapter->ctrl, rx_cq->id, false, work_done); 1354 be_cq_notify(adapter, rx_cq->id, false, work_done);
1363 } 1355 }
1364 return work_done; 1356 return work_done;
1365} 1357}
@@ -1380,7 +1372,7 @@ void be_process_tx(struct be_adapter *adapter)
1380 } 1372 }
1381 1373
1382 if (num_cmpl) { 1374 if (num_cmpl) {
1383 be_cq_notify(&adapter->ctrl, tx_cq->id, true, num_cmpl); 1375 be_cq_notify(adapter, tx_cq->id, true, num_cmpl);
1384 1376
1385 /* As Tx wrbs have been freed up, wake up netdev queue if 1377 /* As Tx wrbs have been freed up, wake up netdev queue if
1386 * it was stopped due to lack of tx wrbs. 1378 * it was stopped due to lack of tx wrbs.
@@ -1408,7 +1400,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1408 1400
1409 be_process_tx(adapter); 1401 be_process_tx(adapter);
1410 1402
1411 be_process_mcc(&adapter->ctrl); 1403 be_process_mcc(adapter);
1412 1404
1413 return 1; 1405 return 1;
1414} 1406}
@@ -1420,7 +1412,7 @@ static void be_worker(struct work_struct *work)
1420 int status; 1412 int status;
1421 1413
1422 /* Get Stats */ 1414 /* Get Stats */
1423 status = be_cmd_get_stats(&adapter->ctrl, &adapter->stats.cmd); 1415 status = be_cmd_get_stats(adapter, &adapter->stats.cmd);
1424 if (!status) 1416 if (!status)
1425 netdev_stats_update(adapter); 1417 netdev_stats_update(adapter);
1426 1418
@@ -1454,8 +1446,7 @@ static void be_msix_enable(struct be_adapter *adapter)
1454 1446
1455static inline int be_msix_vec_get(struct be_adapter *adapter, u32 eq_id) 1447static inline int be_msix_vec_get(struct be_adapter *adapter, u32 eq_id)
1456{ 1448{
1457 return adapter->msix_entries[eq_id - 1449 return adapter->msix_entries[eq_id - 8 * adapter->pci_func].vector;
1458 8 * adapter->ctrl.pci_func].vector;
1459} 1450}
1460 1451
1461static int be_msix_register(struct be_adapter *adapter) 1452static int be_msix_register(struct be_adapter *adapter)
@@ -1540,7 +1531,6 @@ done:
1540static int be_open(struct net_device *netdev) 1531static int be_open(struct net_device *netdev)
1541{ 1532{
1542 struct be_adapter *adapter = netdev_priv(netdev); 1533 struct be_adapter *adapter = netdev_priv(netdev);
1543 struct be_ctrl_info *ctrl = &adapter->ctrl;
1544 struct be_eq_obj *rx_eq = &adapter->rx_eq; 1534 struct be_eq_obj *rx_eq = &adapter->rx_eq;
1545 struct be_eq_obj *tx_eq = &adapter->tx_eq; 1535 struct be_eq_obj *tx_eq = &adapter->tx_eq;
1546 bool link_up; 1536 bool link_up;
@@ -1554,16 +1544,16 @@ static int be_open(struct net_device *netdev)
1554 1544
1555 be_irq_register(adapter); 1545 be_irq_register(adapter);
1556 1546
1557 be_intr_set(ctrl, true); 1547 be_intr_set(adapter, true);
1558 1548
1559 /* The evt queues are created in unarmed state; arm them */ 1549 /* The evt queues are created in unarmed state; arm them */
1560 be_eq_notify(ctrl, rx_eq->q.id, true, false, 0); 1550 be_eq_notify(adapter, rx_eq->q.id, true, false, 0);
1561 be_eq_notify(ctrl, tx_eq->q.id, true, false, 0); 1551 be_eq_notify(adapter, tx_eq->q.id, true, false, 0);
1562 1552
1563 /* Rx compl queue may be in unarmed state; rearm it */ 1553 /* Rx compl queue may be in unarmed state; rearm it */
1564 be_cq_notify(ctrl, adapter->rx_obj.cq.id, true, 0); 1554 be_cq_notify(adapter, adapter->rx_obj.cq.id, true, 0);
1565 1555
1566 status = be_cmd_link_status_query(ctrl, &link_up); 1556 status = be_cmd_link_status_query(adapter, &link_up);
1567 if (status) 1557 if (status)
1568 return status; 1558 return status;
1569 be_link_status_update(adapter, link_up); 1559 be_link_status_update(adapter, link_up);
@@ -1574,7 +1564,6 @@ static int be_open(struct net_device *netdev)
1574 1564
1575static int be_setup(struct be_adapter *adapter) 1565static int be_setup(struct be_adapter *adapter)
1576{ 1566{
1577 struct be_ctrl_info *ctrl = &adapter->ctrl;
1578 struct net_device *netdev = adapter->netdev; 1567 struct net_device *netdev = adapter->netdev;
1579 u32 if_flags; 1568 u32 if_flags;
1580 int status; 1569 int status;
@@ -1582,7 +1571,7 @@ static int be_setup(struct be_adapter *adapter)
1582 if_flags = BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PROMISCUOUS | 1571 if_flags = BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PROMISCUOUS |
1583 BE_IF_FLAGS_MCAST_PROMISCUOUS | BE_IF_FLAGS_UNTAGGED | 1572 BE_IF_FLAGS_MCAST_PROMISCUOUS | BE_IF_FLAGS_UNTAGGED |
1584 BE_IF_FLAGS_PASS_L3L4_ERRORS; 1573 BE_IF_FLAGS_PASS_L3L4_ERRORS;
1585 status = be_cmd_if_create(ctrl, if_flags, netdev->dev_addr, 1574 status = be_cmd_if_create(adapter, if_flags, netdev->dev_addr,
1586 false/* pmac_invalid */, &adapter->if_handle, 1575 false/* pmac_invalid */, &adapter->if_handle,
1587 &adapter->pmac_id); 1576 &adapter->pmac_id);
1588 if (status != 0) 1577 if (status != 0)
@@ -1590,7 +1579,7 @@ static int be_setup(struct be_adapter *adapter)
1590 1579
1591 be_vid_config(netdev); 1580 be_vid_config(netdev);
1592 1581
1593 status = be_cmd_set_flow_control(ctrl, true, true); 1582 status = be_cmd_set_flow_control(adapter, true, true);
1594 if (status != 0) 1583 if (status != 0)
1595 goto if_destroy; 1584 goto if_destroy;
1596 1585
@@ -1613,19 +1602,17 @@ rx_qs_destroy:
1613tx_qs_destroy: 1602tx_qs_destroy:
1614 be_tx_queues_destroy(adapter); 1603 be_tx_queues_destroy(adapter);
1615if_destroy: 1604if_destroy:
1616 be_cmd_if_destroy(ctrl, adapter->if_handle); 1605 be_cmd_if_destroy(adapter, adapter->if_handle);
1617do_none: 1606do_none:
1618 return status; 1607 return status;
1619} 1608}
1620 1609
1621static int be_clear(struct be_adapter *adapter) 1610static int be_clear(struct be_adapter *adapter)
1622{ 1611{
1623 struct be_ctrl_info *ctrl = &adapter->ctrl;
1624
1625 be_rx_queues_destroy(adapter); 1612 be_rx_queues_destroy(adapter);
1626 be_tx_queues_destroy(adapter); 1613 be_tx_queues_destroy(adapter);
1627 1614
1628 be_cmd_if_destroy(ctrl, adapter->if_handle); 1615 be_cmd_if_destroy(adapter, adapter->if_handle);
1629 1616
1630 be_mcc_queues_destroy(adapter); 1617 be_mcc_queues_destroy(adapter);
1631 return 0; 1618 return 0;
@@ -1634,7 +1621,6 @@ static int be_clear(struct be_adapter *adapter)
1634static int be_close(struct net_device *netdev) 1621static int be_close(struct net_device *netdev)
1635{ 1622{
1636 struct be_adapter *adapter = netdev_priv(netdev); 1623 struct be_adapter *adapter = netdev_priv(netdev);
1637 struct be_ctrl_info *ctrl = &adapter->ctrl;
1638 struct be_eq_obj *rx_eq = &adapter->rx_eq; 1624 struct be_eq_obj *rx_eq = &adapter->rx_eq;
1639 struct be_eq_obj *tx_eq = &adapter->tx_eq; 1625 struct be_eq_obj *tx_eq = &adapter->tx_eq;
1640 int vec; 1626 int vec;
@@ -1645,7 +1631,7 @@ static int be_close(struct net_device *netdev)
1645 netif_carrier_off(netdev); 1631 netif_carrier_off(netdev);
1646 adapter->link_up = false; 1632 adapter->link_up = false;
1647 1633
1648 be_intr_set(ctrl, false); 1634 be_intr_set(adapter, false);
1649 1635
1650 if (adapter->msix_enabled) { 1636 if (adapter->msix_enabled) {
1651 vec = be_msix_vec_get(adapter, tx_eq->q.id); 1637 vec = be_msix_vec_get(adapter, tx_eq->q.id);
@@ -1704,13 +1690,12 @@ static void be_netdev_init(struct net_device *netdev)
1704 1690
1705static void be_unmap_pci_bars(struct be_adapter *adapter) 1691static void be_unmap_pci_bars(struct be_adapter *adapter)
1706{ 1692{
1707 struct be_ctrl_info *ctrl = &adapter->ctrl; 1693 if (adapter->csr)
1708 if (ctrl->csr) 1694 iounmap(adapter->csr);
1709 iounmap(ctrl->csr); 1695 if (adapter->db)
1710 if (ctrl->db) 1696 iounmap(adapter->db);
1711 iounmap(ctrl->db); 1697 if (adapter->pcicfg)
1712 if (ctrl->pcicfg) 1698 iounmap(adapter->pcicfg);
1713 iounmap(ctrl->pcicfg);
1714} 1699}
1715 1700
1716static int be_map_pci_bars(struct be_adapter *adapter) 1701static int be_map_pci_bars(struct be_adapter *adapter)
@@ -1721,19 +1706,19 @@ static int be_map_pci_bars(struct be_adapter *adapter)
1721 pci_resource_len(adapter->pdev, 2)); 1706 pci_resource_len(adapter->pdev, 2));
1722 if (addr == NULL) 1707 if (addr == NULL)
1723 return -ENOMEM; 1708 return -ENOMEM;
1724 adapter->ctrl.csr = addr; 1709 adapter->csr = addr;
1725 1710
1726 addr = ioremap_nocache(pci_resource_start(adapter->pdev, 4), 1711 addr = ioremap_nocache(pci_resource_start(adapter->pdev, 4),
1727 128 * 1024); 1712 128 * 1024);
1728 if (addr == NULL) 1713 if (addr == NULL)
1729 goto pci_map_err; 1714 goto pci_map_err;
1730 adapter->ctrl.db = addr; 1715 adapter->db = addr;
1731 1716
1732 addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1), 1717 addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1),
1733 pci_resource_len(adapter->pdev, 1)); 1718 pci_resource_len(adapter->pdev, 1));
1734 if (addr == NULL) 1719 if (addr == NULL)
1735 goto pci_map_err; 1720 goto pci_map_err;
1736 adapter->ctrl.pcicfg = addr; 1721 adapter->pcicfg = addr;
1737 1722
1738 return 0; 1723 return 0;
1739pci_map_err: 1724pci_map_err:
@@ -1744,7 +1729,7 @@ pci_map_err:
1744 1729
1745static void be_ctrl_cleanup(struct be_adapter *adapter) 1730static void be_ctrl_cleanup(struct be_adapter *adapter)
1746{ 1731{
1747 struct be_dma_mem *mem = &adapter->ctrl.mbox_mem_alloced; 1732 struct be_dma_mem *mem = &adapter->mbox_mem_alloced;
1748 1733
1749 be_unmap_pci_bars(adapter); 1734 be_unmap_pci_bars(adapter);
1750 1735
@@ -1753,12 +1738,10 @@ static void be_ctrl_cleanup(struct be_adapter *adapter)
1753 mem->va, mem->dma); 1738 mem->va, mem->dma);
1754} 1739}
1755 1740
1756/* Initialize the mbox required to send cmds to BE */
1757static int be_ctrl_init(struct be_adapter *adapter) 1741static int be_ctrl_init(struct be_adapter *adapter)
1758{ 1742{
1759 struct be_ctrl_info *ctrl = &adapter->ctrl; 1743 struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced;
1760 struct be_dma_mem *mbox_mem_alloc = &ctrl->mbox_mem_alloced; 1744 struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem;
1761 struct be_dma_mem *mbox_mem_align = &ctrl->mbox_mem;
1762 int status; 1745 int status;
1763 u32 val; 1746 u32 val;
1764 1747
@@ -1777,15 +1760,12 @@ static int be_ctrl_init(struct be_adapter *adapter)
1777 mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16); 1760 mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16);
1778 mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16); 1761 mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16);
1779 memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox)); 1762 memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
1780 spin_lock_init(&ctrl->mbox_lock); 1763 spin_lock_init(&adapter->mbox_lock);
1781 spin_lock_init(&ctrl->mcc_lock); 1764 spin_lock_init(&adapter->mcc_lock);
1782 spin_lock_init(&ctrl->mcc_cq_lock); 1765 spin_lock_init(&adapter->mcc_cq_lock);
1783
1784 ctrl->async_cb = be_link_status_update;
1785 ctrl->adapter_ctxt = adapter;
1786 1766
1787 val = ioread32(ctrl->pcicfg + PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET); 1767 val = ioread32(adapter->pcicfg + PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET);
1788 ctrl->pci_func = (val >> MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT) & 1768 adapter->pci_func = (val >> MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT) &
1789 MEMBAR_CTRL_INT_CTRL_PFUNC_MASK; 1769 MEMBAR_CTRL_INT_CTRL_PFUNC_MASK;
1790 return 0; 1770 return 0;
1791} 1771}
@@ -1840,18 +1820,17 @@ static void __devexit be_remove(struct pci_dev *pdev)
1840 1820
1841static int be_hw_up(struct be_adapter *adapter) 1821static int be_hw_up(struct be_adapter *adapter)
1842{ 1822{
1843 struct be_ctrl_info *ctrl = &adapter->ctrl;
1844 int status; 1823 int status;
1845 1824
1846 status = be_cmd_POST(ctrl); 1825 status = be_cmd_POST(adapter);
1847 if (status) 1826 if (status)
1848 return status; 1827 return status;
1849 1828
1850 status = be_cmd_get_fw_ver(ctrl, adapter->fw_ver); 1829 status = be_cmd_get_fw_ver(adapter, adapter->fw_ver);
1851 if (status) 1830 if (status)
1852 return status; 1831 return status;
1853 1832
1854 status = be_cmd_query_fw_cfg(ctrl, &adapter->port_num); 1833 status = be_cmd_query_fw_cfg(adapter, &adapter->port_num);
1855 return status; 1834 return status;
1856} 1835}
1857 1836
@@ -1861,7 +1840,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
1861 int status = 0; 1840 int status = 0;
1862 struct be_adapter *adapter; 1841 struct be_adapter *adapter;
1863 struct net_device *netdev; 1842 struct net_device *netdev;
1864 struct be_ctrl_info *ctrl;
1865 u8 mac[ETH_ALEN]; 1843 u8 mac[ETH_ALEN];
1866 1844
1867 status = pci_enable_device(pdev); 1845 status = pci_enable_device(pdev);
@@ -1896,7 +1874,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
1896 } 1874 }
1897 } 1875 }
1898 1876
1899 ctrl = &adapter->ctrl;
1900 status = be_ctrl_init(adapter); 1877 status = be_ctrl_init(adapter);
1901 if (status) 1878 if (status)
1902 goto free_netdev; 1879 goto free_netdev;
@@ -1909,7 +1886,7 @@ static int __devinit be_probe(struct pci_dev *pdev,
1909 if (status) 1886 if (status)
1910 goto stats_clean; 1887 goto stats_clean;
1911 1888
1912 status = be_cmd_mac_addr_query(ctrl, mac, MAC_ADDRESS_TYPE_NETWORK, 1889 status = be_cmd_mac_addr_query(adapter, mac, MAC_ADDRESS_TYPE_NETWORK,
1913 true /* permanent */, 0); 1890 true /* permanent */, 0);
1914 if (status) 1891 if (status)
1915 goto stats_clean; 1892 goto stats_clean;