Commit 34b1ef04fc050d171e055f75d6a3384e1323bd38
Committed by
David S. Miller
1 parent
5bf74c91d7
Exists in
master
and in
38 other branches
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>
Showing 3 changed files with 76 additions and 2 deletions Side-by-side Diff
drivers/net/benet/be_cmds.c
... | ... | @@ -799,12 +799,12 @@ |
799 | 799 | return len_encoded; |
800 | 800 | } |
801 | 801 | |
802 | -int be_cmd_mccq_create(struct be_adapter *adapter, | |
802 | +int be_cmd_mccq_ext_create(struct be_adapter *adapter, | |
803 | 803 | struct be_queue_info *mccq, |
804 | 804 | struct be_queue_info *cq) |
805 | 805 | { |
806 | 806 | struct be_mcc_wrb *wrb; |
807 | - struct be_cmd_req_mcc_create *req; | |
807 | + struct be_cmd_req_mcc_ext_create *req; | |
808 | 808 | struct be_dma_mem *q_mem = &mccq->dma_mem; |
809 | 809 | void *ctxt; |
810 | 810 | int status; |
... | ... | @@ -856,6 +856,67 @@ |
856 | 856 | } |
857 | 857 | mutex_unlock(&adapter->mbox_lock); |
858 | 858 | |
859 | + return status; | |
860 | +} | |
861 | + | |
862 | +int 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 | + | |
907 | +int 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 | + } | |
859 | 920 | return status; |
860 | 921 | } |
861 | 922 |
drivers/net/benet/be_cmds.h
... | ... | @@ -434,6 +434,14 @@ |
434 | 434 | struct be_cmd_req_hdr hdr; |
435 | 435 | u16 num_pages; |
436 | 436 | u16 cq_id; |
437 | + u8 context[sizeof(struct amap_mcc_context_be) / 8]; | |
438 | + struct phys_addr pages[8]; | |
439 | +} __packed; | |
440 | + | |
441 | +struct be_cmd_req_mcc_ext_create { | |
442 | + struct be_cmd_req_hdr hdr; | |
443 | + u16 num_pages; | |
444 | + u16 cq_id; | |
437 | 445 | u32 async_event_bitmap[1]; |
438 | 446 | u8 context[sizeof(struct amap_mcc_context_be) / 8]; |
439 | 447 | struct phys_addr pages[8]; |
drivers/net/benet/be_main.c
... | ... | @@ -3396,6 +3396,11 @@ |
3396 | 3396 | } |
3397 | 3397 | |
3398 | 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 | 3404 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); |
3400 | 3405 | return 0; |
3401 | 3406 |