aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet/be_cmds.c
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2013-08-27 07:27:34 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-27 15:57:05 -0400
commit7707133ceb38f590729d0165099555928630af1c (patch)
tree90ef4cfcedababd28b3df080d3fa690c66deb131 /drivers/net/ethernet/emulex/benet/be_cmds.c
parentbea5098848925351ed6fc84dc84c88b2765237f7 (diff)
be2net: refactor be_setup() to consolidate queue creation routines
1) Move be_cmd_if_create() above queue create routines to allow TXQ creation (that requires if_handle) to be clubbed with TX-CQ creation. 2) Consolidate all queue create routines into be_setup_queues() Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be_cmds.c')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 70d5db043f1e..52c9085ba5a1 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1182,25 +1182,16 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
1182 1182
1183int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo) 1183int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo)
1184{ 1184{
1185 struct be_mcc_wrb *wrb; 1185 struct be_mcc_wrb wrb = {0};
1186 struct be_cmd_req_eth_tx_create *req; 1186 struct be_cmd_req_eth_tx_create *req;
1187 struct be_queue_info *txq = &txo->q; 1187 struct be_queue_info *txq = &txo->q;
1188 struct be_queue_info *cq = &txo->cq; 1188 struct be_queue_info *cq = &txo->cq;
1189 struct be_dma_mem *q_mem = &txq->dma_mem; 1189 struct be_dma_mem *q_mem = &txq->dma_mem;
1190 int status, ver = 0; 1190 int status, ver = 0;
1191 1191
1192 spin_lock_bh(&adapter->mcc_lock); 1192 req = embedded_payload(&wrb);
1193
1194 wrb = wrb_from_mccq(adapter);
1195 if (!wrb) {
1196 status = -EBUSY;
1197 goto err;
1198 }
1199
1200 req = embedded_payload(wrb);
1201
1202 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, 1193 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
1203 OPCODE_ETH_TX_CREATE, sizeof(*req), wrb, NULL); 1194 OPCODE_ETH_TX_CREATE, sizeof(*req), &wrb, NULL);
1204 1195
1205 if (lancer_chip(adapter)) { 1196 if (lancer_chip(adapter)) {
1206 req->hdr.version = 1; 1197 req->hdr.version = 1;
@@ -1218,12 +1209,11 @@ int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo)
1218 req->cq_id = cpu_to_le16(cq->id); 1209 req->cq_id = cpu_to_le16(cq->id);
1219 req->queue_size = be_encoded_q_len(txq->len); 1210 req->queue_size = be_encoded_q_len(txq->len);
1220 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 1211 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
1221
1222 ver = req->hdr.version; 1212 ver = req->hdr.version;
1223 1213
1224 status = be_mcc_notify_wait(adapter); 1214 status = be_cmd_notify_wait(adapter, &wrb);
1225 if (!status) { 1215 if (!status) {
1226 struct be_cmd_resp_eth_tx_create *resp = embedded_payload(wrb); 1216 struct be_cmd_resp_eth_tx_create *resp = embedded_payload(&wrb);
1227 txq->id = le16_to_cpu(resp->cid); 1217 txq->id = le16_to_cpu(resp->cid);
1228 if (ver == 2) 1218 if (ver == 2)
1229 txo->db_offset = le32_to_cpu(resp->db_offset); 1219 txo->db_offset = le32_to_cpu(resp->db_offset);
@@ -1232,9 +1222,6 @@ int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo)
1232 txq->created = true; 1222 txq->created = true;
1233 } 1223 }
1234 1224
1235err:
1236 spin_unlock_bh(&adapter->mcc_lock);
1237
1238 return status; 1225 return status;
1239} 1226}
1240 1227