diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2010-11-21 18:25:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-27 20:43:20 -0500 |
commit | fe6d2a38b2076cba515dc95b5dc1589a7ab51c17 (patch) | |
tree | b1d6268d43a051e31579984f98d65aa8ad341e8d /drivers/net/benet/be_cmds.c | |
parent | 1d24eb4815d1e0e8b451ecc546645f8ef1176d4f (diff) |
be2net: adding support for Lancer family of CNAs
Key changes are:
- EQ ids are not assigned consecutively in Lancer. So, fix mapping of MSIx
vector to EQ-id.
- BAR mapping and some req locations different for Lancer.
- TCP,UDP,IP checksum fields must be compulsorily set in TX wrb for TSO in
Lancer.
- CEV_IST reg not present in Lancer; so, peek into event queue to check for
new entries
- cq_create and mcc_create cmd interface is different for Lancer; handle
accordingly
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 96 |
1 files changed, 73 insertions, 23 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 36eca1ce75d4..3865b2bc65e6 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -323,7 +323,12 @@ static int be_mbox_notify_wait(struct be_adapter *adapter) | |||
323 | 323 | ||
324 | static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) | 324 | static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) |
325 | { | 325 | { |
326 | u32 sem = ioread32(adapter->csr + MPU_EP_SEMAPHORE_OFFSET); | 326 | u32 sem; |
327 | |||
328 | if (lancer_chip(adapter)) | ||
329 | sem = ioread32(adapter->db + MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET); | ||
330 | else | ||
331 | sem = ioread32(adapter->csr + MPU_EP_SEMAPHORE_OFFSET); | ||
327 | 332 | ||
328 | *stage = sem & EP_SEMAPHORE_POST_STAGE_MASK; | 333 | *stage = sem & EP_SEMAPHORE_POST_STAGE_MASK; |
329 | if ((sem >> EP_SEMAPHORE_POST_ERR_SHIFT) & EP_SEMAPHORE_POST_ERR_MASK) | 334 | if ((sem >> EP_SEMAPHORE_POST_ERR_SHIFT) & EP_SEMAPHORE_POST_ERR_MASK) |
@@ -465,14 +470,25 @@ int be_cmd_fw_init(struct be_adapter *adapter) | |||
465 | spin_lock(&adapter->mbox_lock); | 470 | spin_lock(&adapter->mbox_lock); |
466 | 471 | ||
467 | wrb = (u8 *)wrb_from_mbox(adapter); | 472 | wrb = (u8 *)wrb_from_mbox(adapter); |
468 | *wrb++ = 0xFF; | 473 | if (lancer_chip(adapter)) { |
469 | *wrb++ = 0x12; | 474 | *wrb++ = 0xFF; |
470 | *wrb++ = 0x34; | 475 | *wrb++ = 0x34; |
471 | *wrb++ = 0xFF; | 476 | *wrb++ = 0x12; |
472 | *wrb++ = 0xFF; | 477 | *wrb++ = 0xFF; |
473 | *wrb++ = 0x56; | 478 | *wrb++ = 0xFF; |
474 | *wrb++ = 0x78; | 479 | *wrb++ = 0x78; |
475 | *wrb = 0xFF; | 480 | *wrb++ = 0x56; |
481 | *wrb = 0xFF; | ||
482 | } else { | ||
483 | *wrb++ = 0xFF; | ||
484 | *wrb++ = 0x12; | ||
485 | *wrb++ = 0x34; | ||
486 | *wrb++ = 0xFF; | ||
487 | *wrb++ = 0xFF; | ||
488 | *wrb++ = 0x56; | ||
489 | *wrb++ = 0x78; | ||
490 | *wrb = 0xFF; | ||
491 | } | ||
476 | 492 | ||
477 | status = be_mbox_notify_wait(adapter); | 493 | status = be_mbox_notify_wait(adapter); |
478 | 494 | ||
@@ -680,16 +696,36 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
680 | OPCODE_COMMON_CQ_CREATE, sizeof(*req)); | 696 | OPCODE_COMMON_CQ_CREATE, sizeof(*req)); |
681 | 697 | ||
682 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); | 698 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); |
699 | if (lancer_chip(adapter)) { | ||
700 | req->hdr.version = 1; | ||
701 | req->page_size = 1; /* 1 for 4K */ | ||
702 | AMAP_SET_BITS(struct amap_cq_context_lancer, coalescwm, ctxt, | ||
703 | coalesce_wm); | ||
704 | AMAP_SET_BITS(struct amap_cq_context_lancer, nodelay, ctxt, | ||
705 | no_delay); | ||
706 | AMAP_SET_BITS(struct amap_cq_context_lancer, count, ctxt, | ||
707 | __ilog2_u32(cq->len/256)); | ||
708 | AMAP_SET_BITS(struct amap_cq_context_lancer, valid, ctxt, 1); | ||
709 | AMAP_SET_BITS(struct amap_cq_context_lancer, eventable, | ||
710 | ctxt, 1); | ||
711 | AMAP_SET_BITS(struct amap_cq_context_lancer, eqid, | ||
712 | ctxt, eq->id); | ||
713 | AMAP_SET_BITS(struct amap_cq_context_lancer, armed, ctxt, 1); | ||
714 | } else { | ||
715 | AMAP_SET_BITS(struct amap_cq_context_be, coalescwm, ctxt, | ||
716 | coalesce_wm); | ||
717 | AMAP_SET_BITS(struct amap_cq_context_be, nodelay, | ||
718 | ctxt, no_delay); | ||
719 | AMAP_SET_BITS(struct amap_cq_context_be, count, ctxt, | ||
720 | __ilog2_u32(cq->len/256)); | ||
721 | AMAP_SET_BITS(struct amap_cq_context_be, valid, ctxt, 1); | ||
722 | AMAP_SET_BITS(struct amap_cq_context_be, solevent, | ||
723 | ctxt, sol_evts); | ||
724 | AMAP_SET_BITS(struct amap_cq_context_be, eventable, ctxt, 1); | ||
725 | AMAP_SET_BITS(struct amap_cq_context_be, eqid, ctxt, eq->id); | ||
726 | AMAP_SET_BITS(struct amap_cq_context_be, armed, ctxt, 1); | ||
727 | } | ||
683 | 728 | ||
684 | AMAP_SET_BITS(struct amap_cq_context, coalescwm, ctxt, coalesce_wm); | ||
685 | AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay); | ||
686 | AMAP_SET_BITS(struct amap_cq_context, count, ctxt, | ||
687 | __ilog2_u32(cq->len/256)); | ||
688 | AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1); | ||
689 | AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts); | ||
690 | AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); | ||
691 | AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); | ||
692 | AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); | ||
693 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); | 729 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); |
694 | 730 | ||
695 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); | 731 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); |
@@ -737,13 +773,27 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
737 | OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req)); | 773 | OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req)); |
738 | 774 | ||
739 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); | 775 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); |
776 | if (lancer_chip(adapter)) { | ||
777 | req->hdr.version = 1; | ||
778 | req->cq_id = cpu_to_le16(cq->id); | ||
779 | |||
780 | AMAP_SET_BITS(struct amap_mcc_context_lancer, ring_size, ctxt, | ||
781 | be_encoded_q_len(mccq->len)); | ||
782 | AMAP_SET_BITS(struct amap_mcc_context_lancer, valid, ctxt, 1); | ||
783 | AMAP_SET_BITS(struct amap_mcc_context_lancer, async_cq_id, | ||
784 | ctxt, cq->id); | ||
785 | AMAP_SET_BITS(struct amap_mcc_context_lancer, async_cq_valid, | ||
786 | ctxt, 1); | ||
787 | |||
788 | } else { | ||
789 | AMAP_SET_BITS(struct amap_mcc_context_be, valid, ctxt, 1); | ||
790 | AMAP_SET_BITS(struct amap_mcc_context_be, ring_size, ctxt, | ||
791 | be_encoded_q_len(mccq->len)); | ||
792 | AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id); | ||
793 | } | ||
740 | 794 | ||
741 | AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); | ||
742 | AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, | ||
743 | be_encoded_q_len(mccq->len)); | ||
744 | AMAP_SET_BITS(struct amap_mcc_context, cq_id, ctxt, cq->id); | ||
745 | /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */ | 795 | /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */ |
746 | req->async_event_bitmap[0] |= 0x00000022; | 796 | req->async_event_bitmap[0] = cpu_to_le32(0x00000022); |
747 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); | 797 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); |
748 | 798 | ||
749 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); | 799 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); |