aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang, Xiong <xiong@qca.qualcomm.com>2012-04-17 15:32:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-18 15:35:30 -0400
commit9f1fd0ef65fcf6ee40e6fd3a7f1a4a16bfa9443a (patch)
tree1ade28df031810debfaaacfdb959848f20e2b2fa
parent70c9fbd38cecf8d1a58dde4165cd866c0934ae27 (diff)
atl1c: remove multiple-RX-Q code
the multiple-RX-Q in hardware doesn't work, all related register definition & code are removed. Signed-off-by: xiong <xiong@qca.qualcomm.com> Tested-by: Liu David <dwliu@qca.qualcomm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c.h22
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_hw.h36
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c218
3 files changed, 66 insertions, 210 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h
index ca70e16b6e2c..c725ee5d693a 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -297,20 +297,6 @@ enum atl1c_dma_req_block {
297 atl1c_dma_req_4096 = 5 297 atl1c_dma_req_4096 = 5
298}; 298};
299 299
300enum atl1c_rss_mode {
301 atl1c_rss_mode_disable = 0,
302 atl1c_rss_sig_que = 1,
303 atl1c_rss_mul_que_sig_int = 2,
304 atl1c_rss_mul_que_mul_int = 4,
305};
306
307enum atl1c_rss_type {
308 atl1c_rss_disable = 0,
309 atl1c_rss_ipv4 = 1,
310 atl1c_rss_ipv4_tcp = 2,
311 atl1c_rss_ipv6 = 4,
312 atl1c_rss_ipv6_tcp = 8
313};
314 300
315enum atl1c_nic_type { 301enum atl1c_nic_type {
316 athr_l1c = 0, 302 athr_l1c = 0,
@@ -451,9 +437,6 @@ struct atl1c_hw {
451 u16 tpd_thresh; 437 u16 tpd_thresh;
452 u8 tpd_burst; /* Number of TPD to prefetch in cache-aligned burst. */ 438 u8 tpd_burst; /* Number of TPD to prefetch in cache-aligned burst. */
453 u8 rfd_burst; 439 u8 rfd_burst;
454 enum atl1c_rss_type rss_type;
455 enum atl1c_rss_mode rss_mode;
456 u8 rss_hash_bits;
457 u32 base_cpu; 440 u32 base_cpu;
458 u32 indirect_tab; 441 u32 indirect_tab;
459 u8 mac_addr[ETH_ALEN]; 442 u8 mac_addr[ETH_ALEN];
@@ -586,11 +569,10 @@ struct atl1c_adapter {
586 /* All Descriptor memory */ 569 /* All Descriptor memory */
587 struct atl1c_ring_header ring_header; 570 struct atl1c_ring_header ring_header;
588 struct atl1c_tpd_ring tpd_ring[AT_MAX_TRANSMIT_QUEUE]; 571 struct atl1c_tpd_ring tpd_ring[AT_MAX_TRANSMIT_QUEUE];
589 struct atl1c_rfd_ring rfd_ring[AT_MAX_RECEIVE_QUEUE]; 572 struct atl1c_rfd_ring rfd_ring;
590 struct atl1c_rrd_ring rrd_ring[AT_MAX_RECEIVE_QUEUE]; 573 struct atl1c_rrd_ring rrd_ring;
591 struct atl1c_cmb cmb; 574 struct atl1c_cmb cmb;
592 struct atl1c_smb smb; 575 struct atl1c_smb smb;
593 int num_rx_queues;
594 u32 bd_number; /* board number;*/ 576 u32 bd_number; /* board number;*/
595}; 577};
596 578
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index 655fc6c4a8a4..855aca0ec4f7 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -461,17 +461,11 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
461#define REG_SMB_BASE_ADDR_HI 0x1548 461#define REG_SMB_BASE_ADDR_HI 0x1548
462#define REG_SMB_BASE_ADDR_LO 0x154C 462#define REG_SMB_BASE_ADDR_LO 0x154C
463#define REG_RFD0_HEAD_ADDR_LO 0x1550 463#define REG_RFD0_HEAD_ADDR_LO 0x1550
464#define REG_RFD1_HEAD_ADDR_LO 0x1554
465#define REG_RFD2_HEAD_ADDR_LO 0x1558
466#define REG_RFD3_HEAD_ADDR_LO 0x155C
467#define REG_RFD_RING_SIZE 0x1560 464#define REG_RFD_RING_SIZE 0x1560
468#define RFD_RING_SIZE_MASK 0x0FFF 465#define RFD_RING_SIZE_MASK 0x0FFF
469#define REG_RX_BUF_SIZE 0x1564 466#define REG_RX_BUF_SIZE 0x1564
470#define RX_BUF_SIZE_MASK 0xFFFF 467#define RX_BUF_SIZE_MASK 0xFFFF
471#define REG_RRD0_HEAD_ADDR_LO 0x1568 468#define REG_RRD0_HEAD_ADDR_LO 0x1568
472#define REG_RRD1_HEAD_ADDR_LO 0x156C
473#define REG_RRD2_HEAD_ADDR_LO 0x1570
474#define REG_RRD3_HEAD_ADDR_LO 0x1574
475#define REG_RRD_RING_SIZE 0x1578 469#define REG_RRD_RING_SIZE 0x1578
476#define RRD_RING_SIZE_MASK 0x0FFF 470#define RRD_RING_SIZE_MASK 0x0FFF
477#define REG_HTPD_HEAD_ADDR_LO 0x157C 471#define REG_HTPD_HEAD_ADDR_LO 0x157C
@@ -480,30 +474,6 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
480#define TPD_RING_SIZE_MASK 0xFFFF 474#define TPD_RING_SIZE_MASK 0xFFFF
481#define REG_CMB_BASE_ADDR_LO 0x1588 475#define REG_CMB_BASE_ADDR_LO 0x1588
482 476
483/* RSS about */
484#define REG_RSS_KEY0 0x14B0
485#define REG_RSS_KEY1 0x14B4
486#define REG_RSS_KEY2 0x14B8
487#define REG_RSS_KEY3 0x14BC
488#define REG_RSS_KEY4 0x14C0
489#define REG_RSS_KEY5 0x14C4
490#define REG_RSS_KEY6 0x14C8
491#define REG_RSS_KEY7 0x14CC
492#define REG_RSS_KEY8 0x14D0
493#define REG_RSS_KEY9 0x14D4
494#define REG_IDT_TABLE0 0x14E0
495#define REG_IDT_TABLE1 0x14E4
496#define REG_IDT_TABLE2 0x14E8
497#define REG_IDT_TABLE3 0x14EC
498#define REG_IDT_TABLE4 0x14F0
499#define REG_IDT_TABLE5 0x14F4
500#define REG_IDT_TABLE6 0x14F8
501#define REG_IDT_TABLE7 0x14FC
502#define REG_IDT_TABLE REG_IDT_TABLE0
503#define REG_RSS_HASH_VALUE 0x15B0
504#define REG_RSS_HASH_FLAG 0x15B4
505#define REG_BASE_CPU_NUMBER 0x15B8
506
507/* TXQ Control Register */ 477/* TXQ Control Register */
508#define REG_TXQ_CTRL 0x1590 478#define REG_TXQ_CTRL 0x1590
509#define TXQ_NUM_TPD_BURST_MASK 0xF 479#define TXQ_NUM_TPD_BURST_MASK 0xF
@@ -608,9 +578,6 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
608/* Mail box */ 578/* Mail box */
609#define MB_RFDX_PROD_IDX_MASK 0xFFFF 579#define MB_RFDX_PROD_IDX_MASK 0xFFFF
610#define REG_MB_RFD0_PROD_IDX 0x15E0 580#define REG_MB_RFD0_PROD_IDX 0x15E0
611#define REG_MB_RFD1_PROD_IDX 0x15E4
612#define REG_MB_RFD2_PROD_IDX 0x15E8
613#define REG_MB_RFD3_PROD_IDX 0x15EC
614 581
615#define MB_PRIO_PROD_IDX_MASK 0xFFFF 582#define MB_PRIO_PROD_IDX_MASK 0xFFFF
616#define REG_MB_PRIO_PROD_IDX 0x15F0 583#define REG_MB_PRIO_PROD_IDX 0x15F0
@@ -625,9 +592,6 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
625#define REG_MB_RFD01_CONS_IDX 0x15F8 592#define REG_MB_RFD01_CONS_IDX 0x15F8
626#define MB_RFD0_CONS_IDX_MASK 0x0000FFFF 593#define MB_RFD0_CONS_IDX_MASK 0x0000FFFF
627#define MB_RFD1_CONS_IDX_MASK 0xFFFF0000 594#define MB_RFD1_CONS_IDX_MASK 0xFFFF0000
628#define REG_MB_RFD23_CONS_IDX 0x15FC
629#define MB_RFD2_CONS_IDX_MASK 0x0000FFFF
630#define MB_RFD3_CONS_IDX_MASK 0xFFFF0000
631 595
632/* Interrupt Status Register */ 596/* Interrupt Status Register */
633#define REG_ISR 0x1600 597#define REG_ISR 0x1600
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 169da6866c43..a77cd9053c2d 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -66,7 +66,7 @@ static void atl1c_enable_tx_ctrl(struct atl1c_hw *hw);
66static void atl1c_disable_l0s_l1(struct atl1c_hw *hw); 66static void atl1c_disable_l0s_l1(struct atl1c_hw *hw);
67static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup); 67static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup);
68static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter); 68static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter);
69static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que, 69static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
70 int *work_done, int work_to_do); 70 int *work_done, int work_to_do);
71static int atl1c_up(struct atl1c_adapter *adapter); 71static int atl1c_up(struct atl1c_adapter *adapter);
72static void atl1c_down(struct atl1c_adapter *adapter); 72static void atl1c_down(struct atl1c_adapter *adapter);
@@ -75,29 +75,6 @@ static const u16 atl1c_pay_load_size[] = {
75 128, 256, 512, 1024, 2048, 4096, 75 128, 256, 512, 1024, 2048, 4096,
76}; 76};
77 77
78static const u16 atl1c_rfd_prod_idx_regs[AT_MAX_RECEIVE_QUEUE] =
79{
80 REG_MB_RFD0_PROD_IDX,
81 REG_MB_RFD1_PROD_IDX,
82 REG_MB_RFD2_PROD_IDX,
83 REG_MB_RFD3_PROD_IDX
84};
85
86static const u16 atl1c_rfd_addr_lo_regs[AT_MAX_RECEIVE_QUEUE] =
87{
88 REG_RFD0_HEAD_ADDR_LO,
89 REG_RFD1_HEAD_ADDR_LO,
90 REG_RFD2_HEAD_ADDR_LO,
91 REG_RFD3_HEAD_ADDR_LO
92};
93
94static const u16 atl1c_rrd_addr_lo_regs[AT_MAX_RECEIVE_QUEUE] =
95{
96 REG_RRD0_HEAD_ADDR_LO,
97 REG_RRD1_HEAD_ADDR_LO,
98 REG_RRD2_HEAD_ADDR_LO,
99 REG_RRD3_HEAD_ADDR_LO
100};
101 78
102static const u32 atl1c_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | 79static const u32 atl1c_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
103 NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP; 80 NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP;
@@ -730,9 +707,8 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
730 device_set_wakeup_enable(&pdev->dev, false); 707 device_set_wakeup_enable(&pdev->dev, false);
731 adapter->link_speed = SPEED_0; 708 adapter->link_speed = SPEED_0;
732 adapter->link_duplex = FULL_DUPLEX; 709 adapter->link_duplex = FULL_DUPLEX;
733 adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE;
734 adapter->tpd_ring[0].count = 1024; 710 adapter->tpd_ring[0].count = 1024;
735 adapter->rfd_ring[0].count = 512; 711 adapter->rfd_ring.count = 512;
736 712
737 hw->vendor_id = pdev->vendor; 713 hw->vendor_id = pdev->vendor;
738 hw->device_id = pdev->device; 714 hw->device_id = pdev->device;
@@ -751,14 +727,6 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
751 hw->phy_configured = false; 727 hw->phy_configured = false;
752 hw->preamble_len = 7; 728 hw->preamble_len = 7;
753 hw->max_frame_size = adapter->netdev->mtu; 729 hw->max_frame_size = adapter->netdev->mtu;
754 if (adapter->num_rx_queues < 2) {
755 hw->rss_type = atl1c_rss_disable;
756 hw->rss_mode = atl1c_rss_mode_disable;
757 } else {
758 hw->rss_type = atl1c_rss_ipv4;
759 hw->rss_mode = atl1c_rss_mul_que_mul_int;
760 hw->rss_hash_bits = 16;
761 }
762 hw->autoneg_advertised = ADVERTISED_Autoneg; 730 hw->autoneg_advertised = ADVERTISED_Autoneg;
763 hw->indirect_tab = 0xE4E4E4E4; 731 hw->indirect_tab = 0xE4E4E4E4;
764 hw->base_cpu = 0; 732 hw->base_cpu = 0;
@@ -852,24 +820,22 @@ static void atl1c_clean_tx_ring(struct atl1c_adapter *adapter,
852 */ 820 */
853static void atl1c_clean_rx_ring(struct atl1c_adapter *adapter) 821static void atl1c_clean_rx_ring(struct atl1c_adapter *adapter)
854{ 822{
855 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring; 823 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
856 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring; 824 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring;
857 struct atl1c_buffer *buffer_info; 825 struct atl1c_buffer *buffer_info;
858 struct pci_dev *pdev = adapter->pdev; 826 struct pci_dev *pdev = adapter->pdev;
859 int i, j; 827 int j;
860 828
861 for (i = 0; i < adapter->num_rx_queues; i++) { 829 for (j = 0; j < rfd_ring->count; j++) {
862 for (j = 0; j < rfd_ring[i].count; j++) { 830 buffer_info = &rfd_ring->buffer_info[j];
863 buffer_info = &rfd_ring[i].buffer_info[j]; 831 atl1c_clean_buffer(pdev, buffer_info, 0);
864 atl1c_clean_buffer(pdev, buffer_info, 0);
865 }
866 /* zero out the descriptor ring */
867 memset(rfd_ring[i].desc, 0, rfd_ring[i].size);
868 rfd_ring[i].next_to_clean = 0;
869 rfd_ring[i].next_to_use = 0;
870 rrd_ring[i].next_to_use = 0;
871 rrd_ring[i].next_to_clean = 0;
872 } 832 }
833 /* zero out the descriptor ring */
834 memset(rfd_ring->desc, 0, rfd_ring->size);
835 rfd_ring->next_to_clean = 0;
836 rfd_ring->next_to_use = 0;
837 rrd_ring->next_to_use = 0;
838 rrd_ring->next_to_clean = 0;
873} 839}
874 840
875/* 841/*
@@ -878,8 +844,8 @@ static void atl1c_clean_rx_ring(struct atl1c_adapter *adapter)
878static void atl1c_init_ring_ptrs(struct atl1c_adapter *adapter) 844static void atl1c_init_ring_ptrs(struct atl1c_adapter *adapter)
879{ 845{
880 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring; 846 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring;
881 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring; 847 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
882 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring; 848 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring;
883 struct atl1c_buffer *buffer_info; 849 struct atl1c_buffer *buffer_info;
884 int i, j; 850 int i, j;
885 851
@@ -891,15 +857,13 @@ static void atl1c_init_ring_ptrs(struct atl1c_adapter *adapter)
891 ATL1C_SET_BUFFER_STATE(&buffer_info[i], 857 ATL1C_SET_BUFFER_STATE(&buffer_info[i],
892 ATL1C_BUFFER_FREE); 858 ATL1C_BUFFER_FREE);
893 } 859 }
894 for (i = 0; i < adapter->num_rx_queues; i++) { 860 rfd_ring->next_to_use = 0;
895 rfd_ring[i].next_to_use = 0; 861 rfd_ring->next_to_clean = 0;
896 rfd_ring[i].next_to_clean = 0; 862 rrd_ring->next_to_use = 0;
897 rrd_ring[i].next_to_use = 0; 863 rrd_ring->next_to_clean = 0;
898 rrd_ring[i].next_to_clean = 0; 864 for (j = 0; j < rfd_ring->count; j++) {
899 for (j = 0; j < rfd_ring[i].count; j++) { 865 buffer_info = &rfd_ring->buffer_info[j];
900 buffer_info = &rfd_ring[i].buffer_info[j]; 866 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_FREE);
901 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_FREE);
902 }
903 } 867 }
904} 868}
905 869
@@ -936,27 +900,23 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
936{ 900{
937 struct pci_dev *pdev = adapter->pdev; 901 struct pci_dev *pdev = adapter->pdev;
938 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring; 902 struct atl1c_tpd_ring *tpd_ring = adapter->tpd_ring;
939 struct atl1c_rfd_ring *rfd_ring = adapter->rfd_ring; 903 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
940 struct atl1c_rrd_ring *rrd_ring = adapter->rrd_ring; 904 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring;
941 struct atl1c_ring_header *ring_header = &adapter->ring_header; 905 struct atl1c_ring_header *ring_header = &adapter->ring_header;
942 int num_rx_queues = adapter->num_rx_queues;
943 int size; 906 int size;
944 int i; 907 int i;
945 int count = 0; 908 int count = 0;
946 int rx_desc_count = 0; 909 int rx_desc_count = 0;
947 u32 offset = 0; 910 u32 offset = 0;
948 911
949 rrd_ring[0].count = rfd_ring[0].count; 912 rrd_ring->count = rfd_ring->count;
950 for (i = 1; i < AT_MAX_TRANSMIT_QUEUE; i++) 913 for (i = 1; i < AT_MAX_TRANSMIT_QUEUE; i++)
951 tpd_ring[i].count = tpd_ring[0].count; 914 tpd_ring[i].count = tpd_ring[0].count;
952 915
953 for (i = 1; i < adapter->num_rx_queues; i++)
954 rfd_ring[i].count = rrd_ring[i].count = rfd_ring[0].count;
955
956 /* 2 tpd queue, one high priority queue, 916 /* 2 tpd queue, one high priority queue,
957 * another normal priority queue */ 917 * another normal priority queue */
958 size = sizeof(struct atl1c_buffer) * (tpd_ring->count * 2 + 918 size = sizeof(struct atl1c_buffer) * (tpd_ring->count * 2 +
959 rfd_ring->count * num_rx_queues); 919 rfd_ring->count);
960 tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL); 920 tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL);
961 if (unlikely(!tpd_ring->buffer_info)) { 921 if (unlikely(!tpd_ring->buffer_info)) {
962 dev_err(&pdev->dev, "kzalloc failed, size = %d\n", 922 dev_err(&pdev->dev, "kzalloc failed, size = %d\n",
@@ -969,12 +929,11 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
969 count += tpd_ring[i].count; 929 count += tpd_ring[i].count;
970 } 930 }
971 931
972 for (i = 0; i < num_rx_queues; i++) { 932 rfd_ring->buffer_info =
973 rfd_ring[i].buffer_info = 933 (struct atl1c_buffer *) (tpd_ring->buffer_info + count);
974 (struct atl1c_buffer *) (tpd_ring->buffer_info + count); 934 count += rfd_ring->count;
975 count += rfd_ring[i].count; 935 rx_desc_count += rfd_ring->count;
976 rx_desc_count += rfd_ring[i].count; 936
977 }
978 /* 937 /*
979 * real ring DMA buffer 938 * real ring DMA buffer
980 * each ring/block may need up to 8 bytes for alignment, hence the 939 * each ring/block may need up to 8 bytes for alignment, hence the
@@ -985,7 +944,7 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
985 sizeof(struct atl1c_rx_free_desc) * rx_desc_count + 944 sizeof(struct atl1c_rx_free_desc) * rx_desc_count +
986 sizeof(struct atl1c_recv_ret_status) * rx_desc_count + 945 sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
987 sizeof(struct atl1c_hw_stats) + 946 sizeof(struct atl1c_hw_stats) +
988 8 * 4 + 8 * 2 * num_rx_queues; 947 8 * 4 + 8 * 2;
989 948
990 ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, 949 ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
991 &ring_header->dma); 950 &ring_header->dma);
@@ -1006,22 +965,17 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
1006 offset += roundup(tpd_ring[i].size, 8); 965 offset += roundup(tpd_ring[i].size, 8);
1007 } 966 }
1008 /* init RFD ring */ 967 /* init RFD ring */
1009 for (i = 0; i < num_rx_queues; i++) { 968 rfd_ring->dma = ring_header->dma + offset;
1010 rfd_ring[i].dma = ring_header->dma + offset; 969 rfd_ring->desc = (u8 *) ring_header->desc + offset;
1011 rfd_ring[i].desc = (u8 *) ring_header->desc + offset; 970 rfd_ring->size = sizeof(struct atl1c_rx_free_desc) * rfd_ring->count;
1012 rfd_ring[i].size = sizeof(struct atl1c_rx_free_desc) * 971 offset += roundup(rfd_ring->size, 8);
1013 rfd_ring[i].count;
1014 offset += roundup(rfd_ring[i].size, 8);
1015 }
1016 972
1017 /* init RRD ring */ 973 /* init RRD ring */
1018 for (i = 0; i < num_rx_queues; i++) { 974 rrd_ring->dma = ring_header->dma + offset;
1019 rrd_ring[i].dma = ring_header->dma + offset; 975 rrd_ring->desc = (u8 *) ring_header->desc + offset;
1020 rrd_ring[i].desc = (u8 *) ring_header->desc + offset; 976 rrd_ring->size = sizeof(struct atl1c_recv_ret_status) *
1021 rrd_ring[i].size = sizeof(struct atl1c_recv_ret_status) * 977 rrd_ring->count;
1022 rrd_ring[i].count; 978 offset += roundup(rrd_ring->size, 8);
1023 offset += roundup(rrd_ring[i].size, 8);
1024 }
1025 979
1026 adapter->smb.dma = ring_header->dma + offset; 980 adapter->smb.dma = ring_header->dma + offset;
1027 adapter->smb.smb = (u8 *)ring_header->desc + offset; 981 adapter->smb.smb = (u8 *)ring_header->desc + offset;
@@ -1035,15 +989,12 @@ err_nomem:
1035static void atl1c_configure_des_ring(struct atl1c_adapter *adapter) 989static void atl1c_configure_des_ring(struct atl1c_adapter *adapter)
1036{ 990{
1037 struct atl1c_hw *hw = &adapter->hw; 991 struct atl1c_hw *hw = &adapter->hw;
1038 struct atl1c_rfd_ring *rfd_ring = (struct atl1c_rfd_ring *) 992 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
1039 adapter->rfd_ring; 993 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring;
1040 struct atl1c_rrd_ring *rrd_ring = (struct atl1c_rrd_ring *)
1041 adapter->rrd_ring;
1042 struct atl1c_tpd_ring *tpd_ring = (struct atl1c_tpd_ring *) 994 struct atl1c_tpd_ring *tpd_ring = (struct atl1c_tpd_ring *)
1043 adapter->tpd_ring; 995 adapter->tpd_ring;
1044 struct atl1c_cmb *cmb = (struct atl1c_cmb *) &adapter->cmb; 996 struct atl1c_cmb *cmb = (struct atl1c_cmb *) &adapter->cmb;
1045 struct atl1c_smb *smb = (struct atl1c_smb *) &adapter->smb; 997 struct atl1c_smb *smb = (struct atl1c_smb *) &adapter->smb;
1046 int i;
1047 u32 data; 998 u32 data;
1048 999
1049 /* TPD */ 1000 /* TPD */
@@ -1063,22 +1014,20 @@ static void atl1c_configure_des_ring(struct atl1c_adapter *adapter)
1063 1014
1064 /* RFD */ 1015 /* RFD */
1065 AT_WRITE_REG(hw, REG_RX_BASE_ADDR_HI, 1016 AT_WRITE_REG(hw, REG_RX_BASE_ADDR_HI,
1066 (u32)((rfd_ring[0].dma & AT_DMA_HI_ADDR_MASK) >> 32)); 1017 (u32)((rfd_ring->dma & AT_DMA_HI_ADDR_MASK) >> 32));
1067 for (i = 0; i < adapter->num_rx_queues; i++) 1018 AT_WRITE_REG(hw, REG_RFD0_HEAD_ADDR_LO,
1068 AT_WRITE_REG(hw, atl1c_rfd_addr_lo_regs[i], 1019 (u32)(rfd_ring->dma & AT_DMA_LO_ADDR_MASK));
1069 (u32)(rfd_ring[i].dma & AT_DMA_LO_ADDR_MASK));
1070 1020
1071 AT_WRITE_REG(hw, REG_RFD_RING_SIZE, 1021 AT_WRITE_REG(hw, REG_RFD_RING_SIZE,
1072 rfd_ring[0].count & RFD_RING_SIZE_MASK); 1022 rfd_ring->count & RFD_RING_SIZE_MASK);
1073 AT_WRITE_REG(hw, REG_RX_BUF_SIZE, 1023 AT_WRITE_REG(hw, REG_RX_BUF_SIZE,
1074 adapter->rx_buffer_len & RX_BUF_SIZE_MASK); 1024 adapter->rx_buffer_len & RX_BUF_SIZE_MASK);
1075 1025
1076 /* RRD */ 1026 /* RRD */
1077 for (i = 0; i < adapter->num_rx_queues; i++) 1027 AT_WRITE_REG(hw, REG_RRD0_HEAD_ADDR_LO,
1078 AT_WRITE_REG(hw, atl1c_rrd_addr_lo_regs[i], 1028 (u32)(rrd_ring->dma & AT_DMA_LO_ADDR_MASK));
1079 (u32)(rrd_ring[i].dma & AT_DMA_LO_ADDR_MASK));
1080 AT_WRITE_REG(hw, REG_RRD_RING_SIZE, 1029 AT_WRITE_REG(hw, REG_RRD_RING_SIZE,
1081 (rrd_ring[0].count & RRD_RING_SIZE_MASK)); 1030 (rrd_ring->count & RRD_RING_SIZE_MASK));
1082 1031
1083 /* CMB */ 1032 /* CMB */
1084 AT_WRITE_REG(hw, REG_CMB_BASE_ADDR_LO, cmb->dma & AT_DMA_LO_ADDR_MASK); 1033 AT_WRITE_REG(hw, REG_CMB_BASE_ADDR_LO, cmb->dma & AT_DMA_LO_ADDR_MASK);
@@ -1152,21 +1101,7 @@ static void atl1c_configure_rx(struct atl1c_adapter *adapter)
1152 1101
1153 if (hw->ctrl_flags & ATL1C_RX_IPV6_CHKSUM) 1102 if (hw->ctrl_flags & ATL1C_RX_IPV6_CHKSUM)
1154 rxq_ctrl_data |= IPV6_CHKSUM_CTRL_EN; 1103 rxq_ctrl_data |= IPV6_CHKSUM_CTRL_EN;
1155 if (hw->rss_type == atl1c_rss_ipv4) 1104
1156 rxq_ctrl_data |= RSS_HASH_IPV4;
1157 if (hw->rss_type == atl1c_rss_ipv4_tcp)
1158 rxq_ctrl_data |= RSS_HASH_IPV4_TCP;
1159 if (hw->rss_type == atl1c_rss_ipv6)
1160 rxq_ctrl_data |= RSS_HASH_IPV6;
1161 if (hw->rss_type == atl1c_rss_ipv6_tcp)
1162 rxq_ctrl_data |= RSS_HASH_IPV6_TCP;
1163 if (hw->rss_type != atl1c_rss_disable)
1164 rxq_ctrl_data |= RRS_HASH_CTRL_EN;
1165
1166 rxq_ctrl_data |= (hw->rss_mode & RSS_MODE_MASK) <<
1167 RSS_MODE_SHIFT;
1168 rxq_ctrl_data |= (hw->rss_hash_bits & RSS_HASH_BITS_MASK) <<
1169 RSS_HASH_BITS_SHIFT;
1170 if (hw->ctrl_flags & ATL1C_ASPM_CTRL_MON) 1105 if (hw->ctrl_flags & ATL1C_ASPM_CTRL_MON)
1171 rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_1M & 1106 rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_1M &
1172 ASPM_THRUPUT_LIMIT_MASK) << ASPM_THRUPUT_LIMIT_SHIFT; 1107 ASPM_THRUPUT_LIMIT_MASK) << ASPM_THRUPUT_LIMIT_SHIFT;
@@ -1174,14 +1109,6 @@ static void atl1c_configure_rx(struct atl1c_adapter *adapter)
1174 AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data); 1109 AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data);
1175} 1110}
1176 1111
1177static void atl1c_configure_rss(struct atl1c_adapter *adapter)
1178{
1179 struct atl1c_hw *hw = &adapter->hw;
1180
1181 AT_WRITE_REG(hw, REG_IDT_TABLE, hw->indirect_tab);
1182 AT_WRITE_REG(hw, REG_BASE_CPU_NUMBER, hw->base_cpu);
1183}
1184
1185static void atl1c_configure_dma(struct atl1c_adapter *adapter) 1112static void atl1c_configure_dma(struct atl1c_adapter *adapter)
1186{ 1113{
1187 struct atl1c_hw *hw = &adapter->hw; 1114 struct atl1c_hw *hw = &adapter->hw;
@@ -1253,19 +1180,6 @@ static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw)
1253 u32 data; 1180 u32 data;
1254 1181
1255 AT_READ_REG(hw, REG_RXQ_CTRL, &data); 1182 AT_READ_REG(hw, REG_RXQ_CTRL, &data);
1256 switch (hw->adapter->num_rx_queues) {
1257 case 4:
1258 data |= (RXQ3_CTRL_EN | RXQ2_CTRL_EN | RXQ1_CTRL_EN);
1259 break;
1260 case 3:
1261 data |= (RXQ2_CTRL_EN | RXQ1_CTRL_EN);
1262 break;
1263 case 2:
1264 data |= RXQ1_CTRL_EN;
1265 break;
1266 default:
1267 break;
1268 }
1269 data |= RXQ_CTRL_EN; 1183 data |= RXQ_CTRL_EN;
1270 AT_WRITE_REG(hw, REG_RXQ_CTRL, data); 1184 AT_WRITE_REG(hw, REG_RXQ_CTRL, data);
1271} 1185}
@@ -1544,7 +1458,6 @@ static int atl1c_configure(struct atl1c_adapter *adapter)
1544 1458
1545 atl1c_configure_tx(adapter); 1459 atl1c_configure_tx(adapter);
1546 atl1c_configure_rx(adapter); 1460 atl1c_configure_rx(adapter);
1547 atl1c_configure_rss(adapter);
1548 atl1c_configure_dma(adapter); 1461 atl1c_configure_dma(adapter);
1549 1462
1550 return 0; 1463 return 0;
@@ -1747,9 +1660,9 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,
1747 skb_checksum_none_assert(skb); 1660 skb_checksum_none_assert(skb);
1748} 1661}
1749 1662
1750static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid) 1663static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)
1751{ 1664{
1752 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring[ringid]; 1665 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
1753 struct pci_dev *pdev = adapter->pdev; 1666 struct pci_dev *pdev = adapter->pdev;
1754 struct atl1c_buffer *buffer_info, *next_info; 1667 struct atl1c_buffer *buffer_info, *next_info;
1755 struct sk_buff *skb; 1668 struct sk_buff *skb;
@@ -1801,7 +1714,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid
1801 /* TODO: update mailbox here */ 1714 /* TODO: update mailbox here */
1802 wmb(); 1715 wmb();
1803 rfd_ring->next_to_use = rfd_next_to_use; 1716 rfd_ring->next_to_use = rfd_next_to_use;
1804 AT_WRITE_REG(&adapter->hw, atl1c_rfd_prod_idx_regs[ringid], 1717 AT_WRITE_REG(&adapter->hw, REG_MB_RFD0_PROD_IDX,
1805 rfd_ring->next_to_use & MB_RFDX_PROD_IDX_MASK); 1718 rfd_ring->next_to_use & MB_RFDX_PROD_IDX_MASK);
1806 } 1719 }
1807 1720
@@ -1840,7 +1753,7 @@ static void atl1c_clean_rfd(struct atl1c_rfd_ring *rfd_ring,
1840 rfd_ring->next_to_clean = rfd_index; 1753 rfd_ring->next_to_clean = rfd_index;
1841} 1754}
1842 1755
1843static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que, 1756static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
1844 int *work_done, int work_to_do) 1757 int *work_done, int work_to_do)
1845{ 1758{
1846 u16 rfd_num, rfd_index; 1759 u16 rfd_num, rfd_index;
@@ -1848,8 +1761,8 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que,
1848 u16 length; 1761 u16 length;
1849 struct pci_dev *pdev = adapter->pdev; 1762 struct pci_dev *pdev = adapter->pdev;
1850 struct net_device *netdev = adapter->netdev; 1763 struct net_device *netdev = adapter->netdev;
1851 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring[que]; 1764 struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
1852 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring[que]; 1765 struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring;
1853 struct sk_buff *skb; 1766 struct sk_buff *skb;
1854 struct atl1c_recv_ret_status *rrs; 1767 struct atl1c_recv_ret_status *rrs;
1855 struct atl1c_buffer *buffer_info; 1768 struct atl1c_buffer *buffer_info;
@@ -1915,7 +1828,7 @@ rrs_checked:
1915 count++; 1828 count++;
1916 } 1829 }
1917 if (count) 1830 if (count)
1918 atl1c_alloc_rx_buffer(adapter, que); 1831 atl1c_alloc_rx_buffer(adapter);
1919} 1832}
1920 1833
1921/* 1834/*
@@ -1932,7 +1845,7 @@ static int atl1c_clean(struct napi_struct *napi, int budget)
1932 if (!netif_carrier_ok(adapter->netdev)) 1845 if (!netif_carrier_ok(adapter->netdev))
1933 goto quit_polling; 1846 goto quit_polling;
1934 /* just enable one RXQ */ 1847 /* just enable one RXQ */
1935 atl1c_clean_rx_irq(adapter, 0, &work_done, budget); 1848 atl1c_clean_rx_irq(adapter, &work_done, budget);
1936 1849
1937 if (work_done < budget) { 1850 if (work_done < budget) {
1938quit_polling: 1851quit_polling:
@@ -2333,19 +2246,16 @@ static int atl1c_up(struct atl1c_adapter *adapter)
2333 struct net_device *netdev = adapter->netdev; 2246 struct net_device *netdev = adapter->netdev;
2334 int num; 2247 int num;
2335 int err; 2248 int err;
2336 int i;
2337 2249
2338 netif_carrier_off(netdev); 2250 netif_carrier_off(netdev);
2339 atl1c_init_ring_ptrs(adapter); 2251 atl1c_init_ring_ptrs(adapter);
2340 atl1c_set_multi(netdev); 2252 atl1c_set_multi(netdev);
2341 atl1c_restore_vlan(adapter); 2253 atl1c_restore_vlan(adapter);
2342 2254
2343 for (i = 0; i < adapter->num_rx_queues; i++) { 2255 num = atl1c_alloc_rx_buffer(adapter);
2344 num = atl1c_alloc_rx_buffer(adapter, i); 2256 if (unlikely(num == 0)) {
2345 if (unlikely(num == 0)) { 2257 err = -ENOMEM;
2346 err = -ENOMEM; 2258 goto err_alloc_rx;
2347 goto err_alloc_rx;
2348 }
2349 } 2259 }
2350 2260
2351 if (atl1c_configure(adapter)) { 2261 if (atl1c_configure(adapter)) {