aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic.h27
-rw-r--r--drivers/net/netxen/netxen_nic_ctx.c127
-rw-r--r--drivers/net/netxen/netxen_nic_main.c21
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h5
4 files changed, 137 insertions, 43 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f13fd0282f55..ebd6c2edc343 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -195,6 +195,8 @@
195#define MAX_JUMBO_RCV_DESCRIPTORS 1024 195#define MAX_JUMBO_RCV_DESCRIPTORS 1024
196#define MAX_LRO_RCV_DESCRIPTORS 8 196#define MAX_LRO_RCV_DESCRIPTORS 8
197#define NETXEN_CTX_SIGNATURE 0xdee0 197#define NETXEN_CTX_SIGNATURE 0xdee0
198#define NETXEN_CTX_SIGNATURE_V2 0x0002dee0
199#define NETXEN_CTX_RESET 0xbad0
198#define NETXEN_RCV_PRODUCER(ringid) (ringid) 200#define NETXEN_RCV_PRODUCER(ringid) (ringid)
199 201
200#define PHAN_PEG_RCV_INITIALIZED 0xff01 202#define PHAN_PEG_RCV_INITIALIZED 0xff01
@@ -234,12 +236,19 @@ typedef u32 netxen_ctx_msg;
234#define netxen_set_msg_opcode(config_word, val) \ 236#define netxen_set_msg_opcode(config_word, val) \
235 ((config_word) &= ~(0xf<<28), (config_word) |= (val & 0xf) << 28) 237 ((config_word) &= ~(0xf<<28), (config_word) |= (val & 0xf) << 28)
236 238
237struct netxen_rcv_context { 239struct netxen_rcv_ring {
238 __le64 rcv_ring_addr; 240 __le64 addr;
239 __le32 rcv_ring_size; 241 __le32 size;
240 __le32 rsrvd; 242 __le32 rsrvd;
241}; 243};
242 244
245struct netxen_sts_ring {
246 __le64 addr;
247 __le32 size;
248 __le16 msi_index;
249 __le16 rsvd;
250} ;
251
243struct netxen_ring_ctx { 252struct netxen_ring_ctx {
244 253
245 /* one command ring */ 254 /* one command ring */
@@ -249,13 +258,18 @@ struct netxen_ring_ctx {
249 __le32 rsrvd; 258 __le32 rsrvd;
250 259
251 /* three receive rings */ 260 /* three receive rings */
252 struct netxen_rcv_context rcv_ctx[3]; 261 struct netxen_rcv_ring rcv_rings[NUM_RCV_DESC_RINGS];
253 262
254 /* one status ring */
255 __le64 sts_ring_addr; 263 __le64 sts_ring_addr;
256 __le32 sts_ring_size; 264 __le32 sts_ring_size;
257 265
258 __le32 ctx_id; 266 __le32 ctx_id;
267
268 __le64 rsrvd_2[3];
269 __le32 sts_ring_count;
270 __le32 rsrvd_3;
271 struct netxen_sts_ring sts_rings[NUM_STS_DESC_RINGS];
272
259} __attribute__ ((aligned(64))); 273} __attribute__ ((aligned(64)));
260 274
261/* 275/*
@@ -1219,7 +1233,8 @@ struct netxen_adapter {
1219 1233
1220 u8 mc_enabled; 1234 u8 mc_enabled;
1221 u8 max_mc_count; 1235 u8 max_mc_count;
1222 u16 resv2; 1236 u8 rss_supported;
1237 u8 resv2;
1223 u32 resv3; 1238 u32 resv3;
1224 1239
1225 u8 has_link_events; 1240 u8 has_link_events;
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 32f48398398b..fd82adf4f876 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -441,7 +441,19 @@ static struct netxen_recv_crb recv_crb_registers[] = {
441 NETXEN_NIC_REG(0x120) 441 NETXEN_NIC_REG(0x120)
442 }, 442 },
443 /* crb_sts_consumer: */ 443 /* crb_sts_consumer: */
444 NETXEN_NIC_REG(0x138), 444 {
445 NETXEN_NIC_REG(0x138),
446 NETXEN_NIC_REG_2(0x000),
447 NETXEN_NIC_REG_2(0x004),
448 NETXEN_NIC_REG_2(0x008),
449 },
450 /* sw_int_mask */
451 {
452 CRB_SW_INT_MASK_0,
453 NETXEN_NIC_REG_2(0x044),
454 NETXEN_NIC_REG_2(0x048),
455 NETXEN_NIC_REG_2(0x04c),
456 },
445 }, 457 },
446 /* Instance 1 */ 458 /* Instance 1 */
447 { 459 {
@@ -454,7 +466,19 @@ static struct netxen_recv_crb recv_crb_registers[] = {
454 NETXEN_NIC_REG(0x164) 466 NETXEN_NIC_REG(0x164)
455 }, 467 },
456 /* crb_sts_consumer: */ 468 /* crb_sts_consumer: */
457 NETXEN_NIC_REG(0x17c), 469 {
470 NETXEN_NIC_REG(0x17c),
471 NETXEN_NIC_REG_2(0x020),
472 NETXEN_NIC_REG_2(0x024),
473 NETXEN_NIC_REG_2(0x028),
474 },
475 /* sw_int_mask */
476 {
477 CRB_SW_INT_MASK_1,
478 NETXEN_NIC_REG_2(0x064),
479 NETXEN_NIC_REG_2(0x068),
480 NETXEN_NIC_REG_2(0x06c),
481 },
458 }, 482 },
459 /* Instance 2 */ 483 /* Instance 2 */
460 { 484 {
@@ -467,7 +491,19 @@ static struct netxen_recv_crb recv_crb_registers[] = {
467 NETXEN_NIC_REG(0x208) 491 NETXEN_NIC_REG(0x208)
468 }, 492 },
469 /* crb_sts_consumer: */ 493 /* crb_sts_consumer: */
470 NETXEN_NIC_REG(0x220), 494 {
495 NETXEN_NIC_REG(0x220),
496 NETXEN_NIC_REG_2(0x03c),
497 NETXEN_NIC_REG_2(0x03c),
498 NETXEN_NIC_REG_2(0x03c),
499 },
500 /* sw_int_mask */
501 {
502 CRB_SW_INT_MASK_2,
503 NETXEN_NIC_REG_2(0x03c),
504 NETXEN_NIC_REG_2(0x03c),
505 NETXEN_NIC_REG_2(0x03c),
506 },
471 }, 507 },
472 /* Instance 3 */ 508 /* Instance 3 */
473 { 509 {
@@ -480,7 +516,19 @@ static struct netxen_recv_crb recv_crb_registers[] = {
480 NETXEN_NIC_REG(0x24c) 516 NETXEN_NIC_REG(0x24c)
481 }, 517 },
482 /* crb_sts_consumer: */ 518 /* crb_sts_consumer: */
483 NETXEN_NIC_REG(0x264), 519 {
520 NETXEN_NIC_REG(0x264),
521 NETXEN_NIC_REG_2(0x03c),
522 NETXEN_NIC_REG_2(0x03c),
523 NETXEN_NIC_REG_2(0x03c),
524 },
525 /* sw_int_mask */
526 {
527 CRB_SW_INT_MASK_3,
528 NETXEN_NIC_REG_2(0x03c),
529 NETXEN_NIC_REG_2(0x03c),
530 NETXEN_NIC_REG_2(0x03c),
531 },
484 }, 532 },
485}; 533};
486 534
@@ -492,40 +540,50 @@ netxen_init_old_ctx(struct netxen_adapter *adapter)
492 struct nx_host_sds_ring *sds_ring; 540 struct nx_host_sds_ring *sds_ring;
493 struct nx_host_tx_ring *tx_ring; 541 struct nx_host_tx_ring *tx_ring;
494 int ring; 542 int ring;
495 int func_id = adapter->portnum; 543 int port = adapter->portnum;
544 struct netxen_ring_ctx *hwctx = adapter->ctx_desc;
545 u32 signature;
496 546
497 tx_ring = &adapter->tx_ring; 547 tx_ring = &adapter->tx_ring;
498 adapter->ctx_desc->cmd_ring_addr = cpu_to_le64(tx_ring->phys_addr); 548 hwctx->cmd_ring_addr = cpu_to_le64(tx_ring->phys_addr);
499 adapter->ctx_desc->cmd_ring_size = cpu_to_le32(tx_ring->num_desc); 549 hwctx->cmd_ring_size = cpu_to_le32(tx_ring->num_desc);
500 550
501 recv_ctx = &adapter->recv_ctx; 551 recv_ctx = &adapter->recv_ctx;
502 552
503 for (ring = 0; ring < adapter->max_rds_rings; ring++) { 553 for (ring = 0; ring < adapter->max_rds_rings; ring++) {
504 rds_ring = &recv_ctx->rds_rings[ring]; 554 rds_ring = &recv_ctx->rds_rings[ring];
505 555
506 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr = 556 hwctx->rcv_rings[ring].addr =
507 cpu_to_le64(rds_ring->phys_addr); 557 cpu_to_le64(rds_ring->phys_addr);
508 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size = 558 hwctx->rcv_rings[ring].size =
509 cpu_to_le32(rds_ring->num_desc); 559 cpu_to_le32(rds_ring->num_desc);
510 } 560 }
511 sds_ring = &recv_ctx->sds_rings[0];
512 adapter->ctx_desc->sts_ring_addr = cpu_to_le64(sds_ring->phys_addr);
513 adapter->ctx_desc->sts_ring_size = cpu_to_le32(sds_ring->num_desc);
514 561
515 NXWR32(adapter, CRB_CTX_ADDR_REG_LO(func_id), 562 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
563 sds_ring = &recv_ctx->sds_rings[ring];
564
565 if (ring == 0) {
566 hwctx->sts_ring_addr = cpu_to_le64(sds_ring->phys_addr);
567 hwctx->sts_ring_size = cpu_to_le32(sds_ring->num_desc);
568 }
569 hwctx->sts_rings[ring].addr = cpu_to_le64(sds_ring->phys_addr);
570 hwctx->sts_rings[ring].size = cpu_to_le32(sds_ring->num_desc);
571 hwctx->sts_rings[ring].msi_index = cpu_to_le16(ring);
572 }
573 hwctx->sts_ring_count = cpu_to_le32(adapter->max_sds_rings);
574
575 signature = (adapter->max_sds_rings > 1) ?
576 NETXEN_CTX_SIGNATURE_V2 : NETXEN_CTX_SIGNATURE;
577
578 NXWR32(adapter, CRB_CTX_ADDR_REG_LO(port),
516 lower32(adapter->ctx_desc_phys_addr)); 579 lower32(adapter->ctx_desc_phys_addr));
517 NXWR32(adapter, CRB_CTX_ADDR_REG_HI(func_id), 580 NXWR32(adapter, CRB_CTX_ADDR_REG_HI(port),
518 upper32(adapter->ctx_desc_phys_addr)); 581 upper32(adapter->ctx_desc_phys_addr));
519 NXWR32(adapter, CRB_CTX_SIGNATURE_REG(func_id), 582 NXWR32(adapter, CRB_CTX_SIGNATURE_REG(port),
520 NETXEN_CTX_SIGNATURE | func_id); 583 signature | port);
521 return 0; 584 return 0;
522} 585}
523 586
524static uint32_t sw_int_mask[4] = {
525 CRB_SW_INT_MASK_0, CRB_SW_INT_MASK_1,
526 CRB_SW_INT_MASK_2, CRB_SW_INT_MASK_3
527};
528
529int netxen_alloc_hw_resources(struct netxen_adapter *adapter) 587int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
530{ 588{
531 void *addr; 589 void *addr;
@@ -538,6 +596,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
538 596
539 struct pci_dev *pdev = adapter->pdev; 597 struct pci_dev *pdev = adapter->pdev;
540 struct net_device *netdev = adapter->netdev; 598 struct net_device *netdev = adapter->netdev;
599 int port = adapter->portnum;
541 600
542 addr = pci_alloc_consistent(pdev, 601 addr = pci_alloc_consistent(pdev,
543 sizeof(struct netxen_ring_ctx) + sizeof(uint32_t), 602 sizeof(struct netxen_ring_ctx) + sizeof(uint32_t),
@@ -549,7 +608,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
549 } 608 }
550 memset(addr, 0, sizeof(struct netxen_ring_ctx)); 609 memset(addr, 0, sizeof(struct netxen_ring_ctx));
551 adapter->ctx_desc = (struct netxen_ring_ctx *)addr; 610 adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
552 adapter->ctx_desc->ctx_id = cpu_to_le32(adapter->portnum); 611 adapter->ctx_desc->ctx_id = cpu_to_le32(port);
553 adapter->ctx_desc->cmd_consumer_offset = 612 adapter->ctx_desc->cmd_consumer_offset =
554 cpu_to_le64(adapter->ctx_desc_phys_addr + 613 cpu_to_le64(adapter->ctx_desc_phys_addr +
555 sizeof(struct netxen_ring_ctx)); 614 sizeof(struct netxen_ring_ctx));
@@ -586,8 +645,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
586 645
587 if (adapter->fw_major < 4) 646 if (adapter->fw_major < 4)
588 rds_ring->crb_rcv_producer = 647 rds_ring->crb_rcv_producer =
589 recv_crb_registers[adapter->portnum]. 648 recv_crb_registers[port].crb_rcv_producer[ring];
590 crb_rcv_producer[ring];
591 } 649 }
592 650
593 for (ring = 0; ring < adapter->max_sds_rings; ring++) { 651 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
@@ -604,6 +662,12 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
604 goto err_out_free; 662 goto err_out_free;
605 } 663 }
606 sds_ring->desc_head = (struct status_desc *)addr; 664 sds_ring->desc_head = (struct status_desc *)addr;
665
666 sds_ring->crb_sts_consumer =
667 recv_crb_registers[port].crb_sts_consumer[ring];
668
669 sds_ring->crb_intr_mask =
670 recv_crb_registers[port].sw_int_mask[ring];
607 } 671 }
608 672
609 673
@@ -615,19 +679,11 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
615 if (err) 679 if (err)
616 goto err_out_free; 680 goto err_out_free;
617 } else { 681 } else {
618 sds_ring = &recv_ctx->sds_rings[0];
619 sds_ring->crb_sts_consumer =
620 recv_crb_registers[adapter->portnum].crb_sts_consumer;
621
622 recv_ctx->sds_rings[0].crb_intr_mask =
623 sw_int_mask[adapter->portnum];
624
625 err = netxen_init_old_ctx(adapter); 682 err = netxen_init_old_ctx(adapter);
626 if (err) { 683 if (err) {
627 netxen_free_hw_resources(adapter); 684 netxen_free_hw_resources(adapter);
628 return err; 685 return err;
629 } 686 }
630
631 } 687 }
632 688
633 return 0; 689 return 0;
@@ -645,9 +701,16 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter)
645 struct nx_host_tx_ring *tx_ring; 701 struct nx_host_tx_ring *tx_ring;
646 int ring; 702 int ring;
647 703
704 int port = adapter->portnum;
705
648 if (adapter->fw_major >= 4) { 706 if (adapter->fw_major >= 4) {
649 nx_fw_cmd_destroy_tx_ctx(adapter); 707 nx_fw_cmd_destroy_tx_ctx(adapter);
650 nx_fw_cmd_destroy_rx_ctx(adapter); 708 nx_fw_cmd_destroy_rx_ctx(adapter);
709 } else {
710 netxen_api_lock(adapter);
711 NXWR32(adapter, CRB_CTX_SIGNATURE_REG(port),
712 NETXEN_CTX_RESET | port);
713 netxen_api_unlock(adapter);
651 } 714 }
652 715
653 if (adapter->ctx_desc != NULL) { 716 if (adapter->ctx_desc != NULL) {
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 8426092deda3..da9b90da5207 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -175,7 +175,8 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
175 struct nx_host_sds_ring *sds_ring; 175 struct nx_host_sds_ring *sds_ring;
176 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; 176 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
177 177
178 if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) 178 if ((adapter->flags & NETXEN_NIC_MSIX_ENABLED) &&
179 adapter->rss_supported)
179 adapter->max_sds_rings = (num_online_cpus() >= 4) ? 4 : 2; 180 adapter->max_sds_rings = (num_online_cpus() >= 4) ? 4 : 2;
180 else 181 else
181 adapter->max_sds_rings = 1; 182 adapter->max_sds_rings = 1;
@@ -288,10 +289,22 @@ static void netxen_check_options(struct netxen_adapter *adapter)
288 else if (adapter->ahw.port_type == NETXEN_NIC_GBE) 289 else if (adapter->ahw.port_type == NETXEN_NIC_GBE)
289 adapter->num_rxd = MAX_RCV_DESCRIPTORS_1G; 290 adapter->num_rxd = MAX_RCV_DESCRIPTORS_1G;
290 291
291 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) 292 adapter->msix_supported = 0;
293 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
292 adapter->msix_supported = !!use_msi_x; 294 adapter->msix_supported = !!use_msi_x;
293 else 295 adapter->rss_supported = !!use_msi_x;
294 adapter->msix_supported = 0; 296 } else if (adapter->fw_version >= NETXEN_VERSION_CODE(3, 4, 336)) {
297 switch (adapter->ahw.board_type) {
298 case NETXEN_BRDTYPE_P2_SB31_10G:
299 case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
300 case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
301 adapter->msix_supported = !!use_msi_x;
302 adapter->rss_supported = !!use_msi_x;
303 break;
304 default:
305 break;
306 }
307 }
295 308
296 adapter->num_txd = MAX_CMD_DESCRIPTORS_HOST; 309 adapter->num_txd = MAX_CMD_DESCRIPTORS_HOST;
297 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS; 310 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS;
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index ecd622ead0e9..845dcf436cf6 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -36,6 +36,8 @@
36 */ 36 */
37#define NIC_CRB_BASE NETXEN_CAM_RAM(0x200) 37#define NIC_CRB_BASE NETXEN_CAM_RAM(0x200)
38#define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X)) 38#define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X))
39#define NIC_CRB_BASE_2 NETXEN_CAM_RAM(0x700)
40#define NETXEN_NIC_REG_2(X) (NIC_CRB_BASE_2+(X))
39 41
40#define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00) 42#define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00)
41#define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04) 43#define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04)
@@ -160,7 +162,8 @@
160 162
161struct netxen_recv_crb { 163struct netxen_recv_crb {
162 u32 crb_rcv_producer[NUM_RCV_DESC_RINGS]; 164 u32 crb_rcv_producer[NUM_RCV_DESC_RINGS];
163 u32 crb_sts_consumer; 165 u32 crb_sts_consumer[NUM_STS_DESC_RINGS];
166 u32 sw_int_mask[NUM_STS_DESC_RINGS];
164}; 167};
165 168
166/* 169/*