diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-03-09 04:50:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-10 08:10:03 -0400 |
commit | becf46a012db667c562bbbe589c14e100b62e5a4 (patch) | |
tree | 1f6946aac18946fe2df637da385ac1020f755f76 /drivers/net/netxen/netxen_nic_ctx.c | |
parent | 9f5bc7f1908665d7cf379f698c7bdc53bc10da85 (diff) |
netxen: cleanup superfluous multi-context code
MAX_RCV_CTX was set to 1, there's only rx context per
PCI function.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_ctx.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 130 |
1 files changed, 62 insertions, 68 deletions
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 3e437065023d..d125dca0131a 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -141,7 +141,7 @@ int | |||
141 | nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu) | 141 | nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu) |
142 | { | 142 | { |
143 | u32 rcode = NX_RCODE_SUCCESS; | 143 | u32 rcode = NX_RCODE_SUCCESS; |
144 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx[0]; | 144 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; |
145 | 145 | ||
146 | if (recv_ctx->state == NX_HOST_CTX_STATE_ACTIVE) | 146 | if (recv_ctx->state == NX_HOST_CTX_STATE_ACTIVE) |
147 | rcode = netxen_issue_cmd(adapter, | 147 | rcode = netxen_issue_cmd(adapter, |
@@ -179,7 +179,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
179 | 179 | ||
180 | int err; | 180 | int err; |
181 | 181 | ||
182 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx[0]; | 182 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; |
183 | 183 | ||
184 | /* only one sds ring for now */ | 184 | /* only one sds ring for now */ |
185 | nrds_rings = adapter->max_rds_rings; | 185 | nrds_rings = adapter->max_rds_rings; |
@@ -292,7 +292,7 @@ out_free_rq: | |||
292 | static void | 292 | static void |
293 | nx_fw_cmd_destroy_rx_ctx(struct netxen_adapter *adapter) | 293 | nx_fw_cmd_destroy_rx_ctx(struct netxen_adapter *adapter) |
294 | { | 294 | { |
295 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx[0]; | 295 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; |
296 | 296 | ||
297 | if (netxen_issue_cmd(adapter, | 297 | if (netxen_issue_cmd(adapter, |
298 | adapter->ahw.pci_func, | 298 | adapter->ahw.pci_func, |
@@ -488,7 +488,7 @@ netxen_init_old_ctx(struct netxen_adapter *adapter) | |||
488 | { | 488 | { |
489 | struct netxen_recv_context *recv_ctx; | 489 | struct netxen_recv_context *recv_ctx; |
490 | struct nx_host_rds_ring *rds_ring; | 490 | struct nx_host_rds_ring *rds_ring; |
491 | int ctx, ring; | 491 | int ring; |
492 | int func_id = adapter->portnum; | 492 | int func_id = adapter->portnum; |
493 | 493 | ||
494 | adapter->ctx_desc->cmd_ring_addr = | 494 | adapter->ctx_desc->cmd_ring_addr = |
@@ -496,22 +496,20 @@ netxen_init_old_ctx(struct netxen_adapter *adapter) | |||
496 | adapter->ctx_desc->cmd_ring_size = | 496 | adapter->ctx_desc->cmd_ring_size = |
497 | cpu_to_le32(adapter->max_tx_desc_count); | 497 | cpu_to_le32(adapter->max_tx_desc_count); |
498 | 498 | ||
499 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 499 | recv_ctx = &adapter->recv_ctx; |
500 | recv_ctx = &adapter->recv_ctx[ctx]; | ||
501 | 500 | ||
502 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 501 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
503 | rds_ring = &recv_ctx->rds_rings[ring]; | 502 | rds_ring = &recv_ctx->rds_rings[ring]; |
504 | 503 | ||
505 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr = | 504 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr = |
506 | cpu_to_le64(rds_ring->phys_addr); | 505 | cpu_to_le64(rds_ring->phys_addr); |
507 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size = | 506 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size = |
508 | cpu_to_le32(rds_ring->max_rx_desc_count); | 507 | cpu_to_le32(rds_ring->max_rx_desc_count); |
509 | } | ||
510 | adapter->ctx_desc->sts_ring_addr = | ||
511 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); | ||
512 | adapter->ctx_desc->sts_ring_size = | ||
513 | cpu_to_le32(adapter->max_rx_desc_count); | ||
514 | } | 508 | } |
509 | adapter->ctx_desc->sts_ring_addr = | ||
510 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); | ||
511 | adapter->ctx_desc->sts_ring_size = | ||
512 | cpu_to_le32(adapter->max_rx_desc_count); | ||
515 | 513 | ||
516 | adapter->pci_write_normalize(adapter, CRB_CTX_ADDR_REG_LO(func_id), | 514 | adapter->pci_write_normalize(adapter, CRB_CTX_ADDR_REG_LO(func_id), |
517 | lower32(adapter->ctx_desc_phys_addr)); | 515 | lower32(adapter->ctx_desc_phys_addr)); |
@@ -533,7 +531,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
533 | u32 state = 0; | 531 | u32 state = 0; |
534 | void *addr; | 532 | void *addr; |
535 | int err = 0; | 533 | int err = 0; |
536 | int ctx, ring; | 534 | int ring; |
537 | struct netxen_recv_context *recv_ctx; | 535 | struct netxen_recv_context *recv_ctx; |
538 | struct nx_host_rds_ring *rds_ring; | 536 | struct nx_host_rds_ring *rds_ring; |
539 | 537 | ||
@@ -575,48 +573,46 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
575 | 573 | ||
576 | hw->cmd_desc_head = (struct cmd_desc_type0 *)addr; | 574 | hw->cmd_desc_head = (struct cmd_desc_type0 *)addr; |
577 | 575 | ||
578 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 576 | recv_ctx = &adapter->recv_ctx; |
579 | recv_ctx = &adapter->recv_ctx[ctx]; | ||
580 | |||
581 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | ||
582 | /* rx desc ring */ | ||
583 | rds_ring = &recv_ctx->rds_rings[ring]; | ||
584 | addr = pci_alloc_consistent(adapter->pdev, | ||
585 | RCV_DESC_RINGSIZE, | ||
586 | &rds_ring->phys_addr); | ||
587 | if (addr == NULL) { | ||
588 | printk(KERN_ERR "%s failed to allocate rx " | ||
589 | "desc ring[%d]\n", | ||
590 | netxen_nic_driver_name, ring); | ||
591 | err = -ENOMEM; | ||
592 | goto err_out_free; | ||
593 | } | ||
594 | rds_ring->desc_head = (struct rcv_desc *)addr; | ||
595 | |||
596 | if (adapter->fw_major < 4) | ||
597 | rds_ring->crb_rcv_producer = | ||
598 | recv_crb_registers[adapter->portnum]. | ||
599 | crb_rcv_producer[ring]; | ||
600 | } | ||
601 | 577 | ||
602 | /* status desc ring */ | 578 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
579 | /* rx desc ring */ | ||
580 | rds_ring = &recv_ctx->rds_rings[ring]; | ||
603 | addr = pci_alloc_consistent(adapter->pdev, | 581 | addr = pci_alloc_consistent(adapter->pdev, |
604 | STATUS_DESC_RINGSIZE, | 582 | RCV_DESC_RINGSIZE, |
605 | &recv_ctx->rcv_status_desc_phys_addr); | 583 | &rds_ring->phys_addr); |
606 | if (addr == NULL) { | 584 | if (addr == NULL) { |
607 | printk(KERN_ERR "%s failed to allocate sts desc ring\n", | 585 | printk(KERN_ERR "%s failed to allocate rx " |
608 | netxen_nic_driver_name); | 586 | "desc ring[%d]\n", |
587 | netxen_nic_driver_name, ring); | ||
609 | err = -ENOMEM; | 588 | err = -ENOMEM; |
610 | goto err_out_free; | 589 | goto err_out_free; |
611 | } | 590 | } |
612 | recv_ctx->rcv_status_desc_head = (struct status_desc *)addr; | 591 | rds_ring->desc_head = (struct rcv_desc *)addr; |
613 | 592 | ||
614 | if (adapter->fw_major < 4) | 593 | if (adapter->fw_major < 4) |
615 | recv_ctx->crb_sts_consumer = | 594 | rds_ring->crb_rcv_producer = |
616 | recv_crb_registers[adapter->portnum]. | 595 | recv_crb_registers[adapter->portnum]. |
617 | crb_sts_consumer; | 596 | crb_rcv_producer[ring]; |
618 | } | 597 | } |
619 | 598 | ||
599 | /* status desc ring */ | ||
600 | addr = pci_alloc_consistent(adapter->pdev, | ||
601 | STATUS_DESC_RINGSIZE, | ||
602 | &recv_ctx->rcv_status_desc_phys_addr); | ||
603 | if (addr == NULL) { | ||
604 | printk(KERN_ERR "%s failed to allocate sts desc ring\n", | ||
605 | netxen_nic_driver_name); | ||
606 | err = -ENOMEM; | ||
607 | goto err_out_free; | ||
608 | } | ||
609 | recv_ctx->rcv_status_desc_head = (struct status_desc *)addr; | ||
610 | |||
611 | if (adapter->fw_major < 4) | ||
612 | recv_ctx->crb_sts_consumer = | ||
613 | recv_crb_registers[adapter->portnum]. | ||
614 | crb_sts_consumer; | ||
615 | |||
620 | if (adapter->fw_major >= 4) { | 616 | if (adapter->fw_major >= 4) { |
621 | adapter->intr_scheme = INTR_SCHEME_PERPORT; | 617 | adapter->intr_scheme = INTR_SCHEME_PERPORT; |
622 | adapter->msi_mode = MSI_MODE_MULTIFUNC; | 618 | adapter->msi_mode = MSI_MODE_MULTIFUNC; |
@@ -654,7 +650,7 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
654 | { | 650 | { |
655 | struct netxen_recv_context *recv_ctx; | 651 | struct netxen_recv_context *recv_ctx; |
656 | struct nx_host_rds_ring *rds_ring; | 652 | struct nx_host_rds_ring *rds_ring; |
657 | int ctx, ring; | 653 | int ring; |
658 | 654 | ||
659 | if (adapter->fw_major >= 4) { | 655 | if (adapter->fw_major >= 4) { |
660 | nx_fw_cmd_destroy_tx_ctx(adapter); | 656 | nx_fw_cmd_destroy_tx_ctx(adapter); |
@@ -679,27 +675,25 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
679 | adapter->ahw.cmd_desc_head = NULL; | 675 | adapter->ahw.cmd_desc_head = NULL; |
680 | } | 676 | } |
681 | 677 | ||
682 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 678 | recv_ctx = &adapter->recv_ctx; |
683 | recv_ctx = &adapter->recv_ctx[ctx]; | 679 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
684 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 680 | rds_ring = &recv_ctx->rds_rings[ring]; |
685 | rds_ring = &recv_ctx->rds_rings[ring]; | ||
686 | |||
687 | if (rds_ring->desc_head != NULL) { | ||
688 | pci_free_consistent(adapter->pdev, | ||
689 | RCV_DESC_RINGSIZE, | ||
690 | rds_ring->desc_head, | ||
691 | rds_ring->phys_addr); | ||
692 | rds_ring->desc_head = NULL; | ||
693 | } | ||
694 | } | ||
695 | 681 | ||
696 | if (recv_ctx->rcv_status_desc_head != NULL) { | 682 | if (rds_ring->desc_head != NULL) { |
697 | pci_free_consistent(adapter->pdev, | 683 | pci_free_consistent(adapter->pdev, |
698 | STATUS_DESC_RINGSIZE, | 684 | RCV_DESC_RINGSIZE, |
699 | recv_ctx->rcv_status_desc_head, | 685 | rds_ring->desc_head, |
700 | recv_ctx->rcv_status_desc_phys_addr); | 686 | rds_ring->phys_addr); |
701 | recv_ctx->rcv_status_desc_head = NULL; | 687 | rds_ring->desc_head = NULL; |
702 | } | 688 | } |
703 | } | 689 | } |
690 | |||
691 | if (recv_ctx->rcv_status_desc_head != NULL) { | ||
692 | pci_free_consistent(adapter->pdev, | ||
693 | STATUS_DESC_RINGSIZE, | ||
694 | recv_ctx->rcv_status_desc_head, | ||
695 | recv_ctx->rcv_status_desc_phys_addr); | ||
696 | recv_ctx->rcv_status_desc_head = NULL; | ||
697 | } | ||
704 | } | 698 | } |
705 | 699 | ||