aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@emulex.com>2011-05-31 20:33:22 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-01 01:15:28 -0400
commit34b1ef04fc050d171e055f75d6a3384e1323bd38 (patch)
tree8f1f77fb1b2440a07c412c52d9cd5bd979d4516a /drivers/net/benet
parent5bf74c91d7bf56be47c215e6a314ba42da0b68ad (diff)
be2net: Fallback to the older opcode if MCC_CREATE_EXT opcode is not supported on the card
Instead of failing the init/probe code in the driver fallback to the older opcode to ensure the driver is loaded thereby enabling users to upgrade the f/w to whatever version is required. Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be_cmds.c65
-rw-r--r--drivers/net/benet/be_cmds.h8
-rw-r--r--drivers/net/benet/be_main.c5
3 files changed, 76 insertions, 2 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 81654ae16c63..0c12c2d4532a 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -799,12 +799,12 @@ static u32 be_encoded_q_len(int q_len)
799 return len_encoded; 799 return len_encoded;
800} 800}
801 801
802int be_cmd_mccq_create(struct be_adapter *adapter, 802int be_cmd_mccq_ext_create(struct be_adapter *adapter,
803 struct be_queue_info *mccq, 803 struct be_queue_info *mccq,
804 struct be_queue_info *cq) 804 struct be_queue_info *cq)
805{ 805{
806 struct be_mcc_wrb *wrb; 806 struct be_mcc_wrb *wrb;
807 struct be_cmd_req_mcc_create *req; 807 struct be_cmd_req_mcc_ext_create *req;
808 struct be_dma_mem *q_mem = &mccq->dma_mem; 808 struct be_dma_mem *q_mem = &mccq->dma_mem;
809 void *ctxt; 809 void *ctxt;
810 int status; 810 int status;
@@ -859,6 +859,67 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
859 return status; 859 return status;
860} 860}
861 861
862int be_cmd_mccq_org_create(struct be_adapter *adapter,
863 struct be_queue_info *mccq,
864 struct be_queue_info *cq)
865{
866 struct be_mcc_wrb *wrb;
867 struct be_cmd_req_mcc_create *req;
868 struct be_dma_mem *q_mem = &mccq->dma_mem;
869 void *ctxt;
870 int status;
871
872 if (mutex_lock_interruptible(&adapter->mbox_lock))
873 return -1;
874
875 wrb = wrb_from_mbox(adapter);
876 req = embedded_payload(wrb);
877 ctxt = &req->context;
878
879 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
880 OPCODE_COMMON_MCC_CREATE);
881
882 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
883 OPCODE_COMMON_MCC_CREATE, sizeof(*req));
884
885 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
886
887 AMAP_SET_BITS(struct amap_mcc_context_be, valid, ctxt, 1);
888 AMAP_SET_BITS(struct amap_mcc_context_be, ring_size, ctxt,
889 be_encoded_q_len(mccq->len));
890 AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id);
891
892 be_dws_cpu_to_le(ctxt, sizeof(req->context));
893
894 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
895
896 status = be_mbox_notify_wait(adapter);
897 if (!status) {
898 struct be_cmd_resp_mcc_create *resp = embedded_payload(wrb);
899 mccq->id = le16_to_cpu(resp->id);
900 mccq->created = true;
901 }
902
903 mutex_unlock(&adapter->mbox_lock);
904 return status;
905}
906
907int be_cmd_mccq_create(struct be_adapter *adapter,
908 struct be_queue_info *mccq,
909 struct be_queue_info *cq)
910{
911 int status;
912
913 status = be_cmd_mccq_ext_create(adapter, mccq, cq);
914 if (status && !lancer_chip(adapter)) {
915 dev_warn(&adapter->pdev->dev, "Upgrade to F/W ver 2.102.235.0 "
916 "or newer to avoid conflicting priorities between NIC "
917 "and FCoE traffic");
918 status = be_cmd_mccq_org_create(adapter, mccq, cq);
919 }
920 return status;
921}
922
862int be_cmd_txq_create(struct be_adapter *adapter, 923int be_cmd_txq_create(struct be_adapter *adapter,
863 struct be_queue_info *txq, 924 struct be_queue_info *txq,
864 struct be_queue_info *cq) 925 struct be_queue_info *cq)
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 8148cc66cbe9..d08289e21f61 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -434,6 +434,14 @@ struct be_cmd_req_mcc_create {
434 struct be_cmd_req_hdr hdr; 434 struct be_cmd_req_hdr hdr;
435 u16 num_pages; 435 u16 num_pages;
436 u16 cq_id; 436 u16 cq_id;
437 u8 context[sizeof(struct amap_mcc_context_be) / 8];
438 struct phys_addr pages[8];
439} __packed;
440
441struct be_cmd_req_mcc_ext_create {
442 struct be_cmd_req_hdr hdr;
443 u16 num_pages;
444 u16 cq_id;
437 u32 async_event_bitmap[1]; 445 u32 async_event_bitmap[1];
438 u8 context[sizeof(struct amap_mcc_context_be) / 8]; 446 u8 context[sizeof(struct amap_mcc_context_be) / 8];
439 struct phys_addr pages[8]; 447 struct phys_addr pages[8];
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a485f7fdaf37..5824c95c7843 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -3396,6 +3396,11 @@ static int __devinit be_probe(struct pci_dev *pdev,
3396 } 3396 }
3397 3397
3398 dev_info(&pdev->dev, "%s port %d\n", nic_name(pdev), adapter->port_num); 3398 dev_info(&pdev->dev, "%s port %d\n", nic_name(pdev), adapter->port_num);
3399 /* By default all priorities are enabled.
3400 * Needed in case of no GRP5 evt support
3401 */
3402 adapter->vlan_prio_bmap = 0xff;
3403
3399 schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); 3404 schedule_delayed_work(&adapter->work, msecs_to_jiffies(100));
3400 return 0; 3405 return 0;
3401 3406