summaryrefslogtreecommitdiff
path: root/target/linux/storm/patches/1006-gmac-napi-tx.patch
blob: e9c6d94e9288cdb16a10a411cf50320906fe6476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
Index: linux-2.6.23.17/drivers/net/sl351x_gmac.c
===================================================================
--- linux-2.6.23.17.orig/drivers/net/sl351x_gmac.c
+++ linux-2.6.23.17/drivers/net/sl351x_gmac.c
@@ -43,9 +43,13 @@
 
 #include <linux/mtd/kvctl.h>
 
+#define GET_RPTR(x) ((x) & 0xFFFF)
+#define GET_WPTR(x) ((x) >> 16)
+
 #define	 MIDWAY
 #define	 SL_LEPUS
-#define VITESSE_G5SWITCH	1
+// #define VITESSE_G5SWITCH	1
+#undef VITESSE_G5SWITCH
 
 #ifndef CONFIG_SL351x_RXTOE
 //#define CONFIG_SL351x_RXTOE	1
@@ -126,7 +130,6 @@ static	char _debug_prefetch_buf[_DEBUG_P
  *************************************************************/
 static int	gmac_initialized = 0;
 TOE_INFO_T toe_private_data;
-static int		do_again = 0;
 static int rx_poll_enabled;
 spinlock_t gmac_fq_lock;
 unsigned int FLAG_SWITCH;
@@ -190,7 +193,7 @@ void mac_get_sw_tx_weight(struct net_dev
 void mac_set_sw_tx_weight(struct net_device *dev, char *weight);
 void mac_get_hw_tx_weight(struct net_device *dev, char *weight);
 void mac_set_hw_tx_weight(struct net_device *dev, char *weight);
-static inline void toe_gmac_fill_free_q(void);
+static inline void toe_gmac_fill_free_q(int count);
 
 #ifdef VITESSE_G5SWITCH
 extern int Get_Set_port_status(void);
@@ -295,12 +298,14 @@ static int __init gmac_init_module(void)
 	for(j = 0; i<CONFIG_MAC_NUM; j++)
 	{
 		i=j;
+#ifdef VITESSE_G5SWITCH
 		if(Giga_switch){		// if gswitch present, swap eth0/1
 			if(j==0)
 				i=1;
 			else if(j==1)
 				i=0;
 		}
+#endif
 
 		tp = (GMAC_INFO_T *)&toe_private_data.gmac[i];
 		tp->dev = NULL;
@@ -459,7 +464,7 @@ void mac_init_drv(void)
 		toe->gmac[1].dma_base_addr = TOE_GMAC1_DMA_BASE;
         toe->gmac[0].auto_nego_cfg = 1;
         toe->gmac[1].auto_nego_cfg = 1;
-#ifdef CONFIG_SL3516_ASIC
+#ifndef CONFIG_SL3516_ASIC
         toe->gmac[0].speed_cfg = GMAC_SPEED_1000;
         toe->gmac[1].speed_cfg = GMAC_SPEED_1000;
 #else
@@ -508,7 +513,7 @@ void mac_init_drv(void)
 		// Write GLOBAL_QUEUE_THRESHOLD_REG
 		threshold.bits32 = 0;
 		threshold.bits.swfq_empty = (TOE_SW_FREEQ_DESC_NUM > 256) ? 255 :
-		                                        TOE_SW_FREEQ_DESC_NUM/2;
+		                                        TOE_SW_FREEQ_DESC_NUM/16;
 		threshold.bits.hwfq_empty = (TOE_HW_FREEQ_DESC_NUM > 256) ? 256/4 :
 		                                        TOE_HW_FREEQ_DESC_NUM/4;
 		threshold.bits.toe_class = (TOE_TOE_DESC_NUM > 256) ? 256/4 :
@@ -613,18 +618,25 @@ static void toe_init_free_queue(void)
 	rwptr_reg.bits.rptr = 0;
 	toe->fq_rx_rwptr.bits32 = rwptr_reg.bits32;
 	writel(rwptr_reg.bits32, TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
+	printk("SWFQ: %08X\n", readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG));
 
 	// SW Free Queue Descriptors
 	for (i=0; i<TOE_SW_FREEQ_DESC_NUM; i++)
 	{
+		void *data = NULL;
 		sw_desc_ptr->word0.bits.buffer_size = SW_RX_BUF_SIZE;
-		sw_desc_ptr->word1.bits.sw_id = i;	// used to locate skb
+		sw_desc_ptr->word1.bits.sw_id = 0;	// used to locate skb
 		if ( (skb = dev_alloc_skb(SW_RX_BUF_SIZE))==NULL)  /* allocate socket buffer */
 		{
 			printk("%s::skb buffer allocation fail !\n",__func__); while(1);
 		}
-		REG32(skb->data) = (unsigned int)skb;
+
+		data = skb->data;
 		skb_reserve(skb, SKB_RESERVE_BYTES);
+
+		REG32(data + 0) = (unsigned int)skb;
+		REG32(data + 4) = (unsigned short)i;
+
 		// toe->rx_skb[i] = skb;
 		sw_desc_ptr->word2.buf_adr = (unsigned int)__pa(skb->data);
 //   		consistent_sync((unsigned int)desc_ptr, sizeof(GMAC_RXDESC_T), PCI_DMA_TODEVICE);
@@ -851,14 +863,14 @@ static void toe_init_hwtx_queue(void)
 *----------------------------------------------------------------------*/
 static void toe_init_default_queue(void)
 {
-	TOE_INFO_T				*toe;
+	TOE_INFO_T		*toe;
 	volatile NONTOE_QHDR_T	*qhdr;
-	GMAC_RXDESC_T			*desc_ptr;
-	DMA_SKB_SIZE_T			skb_size;
+	GMAC_RXDESC_T		*desc_ptr;
+	DMA_SKB_SIZE_T		skb_size;
 
 	toe = (TOE_INFO_T *)&toe_private_data;
 	desc_ptr = (GMAC_RXDESC_T *)DMA_MALLOC((TOE_DEFAULT_Q0_DESC_NUM * sizeof(GMAC_RXDESC_T)),
-											(dma_addr_t *)&toe->gmac[0].default_desc_base_dma);
+					       (dma_addr_t *)&toe->gmac[0].default_desc_base_dma);
 	if (!desc_ptr)
 	{
 		printk("%s::DMA_MALLOC fail !\n",__func__);
@@ -866,14 +878,17 @@ static void toe_init_default_queue(void)
 	}
 	memset((void *)desc_ptr, 0, TOE_DEFAULT_Q0_DESC_NUM * sizeof(GMAC_RXDESC_T));
 	toe->gmac[0].default_desc_base = (unsigned int)desc_ptr;
+	printk("toe->gmac[0].default_desc_base_dma: %08X\n", toe->gmac[0].default_desc_base_dma);
+
 	toe->gmac[0].default_desc_num = TOE_DEFAULT_Q0_DESC_NUM;
 	qhdr = (volatile NONTOE_QHDR_T *)TOE_DEFAULT_Q0_HDR_BASE;
 	qhdr->word0.base_size = ((unsigned int)toe->gmac[0].default_desc_base_dma & NONTOE_QHDR0_BASE_MASK) | TOE_DEFAULT_Q0_DESC_POWER;
 	qhdr->word1.bits32 = 0;
 	toe->gmac[0].rx_rwptr.bits32 = 0;
 	toe->gmac[0].default_qhdr = (NONTOE_QHDR_T *)qhdr;
+
 	desc_ptr = (GMAC_RXDESC_T *)DMA_MALLOC((TOE_DEFAULT_Q1_DESC_NUM * sizeof(GMAC_RXDESC_T)),
-											(dma_addr_t *)&toe->gmac[1].default_desc_base_dma);
+					       (dma_addr_t *)&toe->gmac[1].default_desc_base_dma);
 	if (!desc_ptr)
 	{
 		printk("%s::DMA_MALLOC fail !\n",__func__);
@@ -1071,12 +1086,16 @@ static void toe_init_gmac(struct net_dev
 
 	    data = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_0_REG) & ~tp->intr0_selected;
 	    writel(data, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_0_REG);
+
 	    data = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_1_REG) & ~tp->intr1_selected;
 	    writel(data, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_1_REG);
+
 	    data = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_2_REG) & ~tp->intr2_selected;
 	    writel(data, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_2_REG);
+
 	    data = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_3_REG) & ~tp->intr3_selected;
 	    writel(data, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_3_REG);
+
 	    data = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG) & ~tp->intr4_selected;
 	    writel(data, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
 	}
@@ -1176,11 +1195,11 @@ static int toe_gmac_init_chip(struct net
 	GMAC_CONFIG2_T	config2_val;
 	GMAC_CONFIG0_T	config0,config0_mask;
 	GMAC_CONFIG1_T	config1;
-	#ifdef CONFIG_SL351x_NAT
 	GMAC_CONFIG3_T	config3_val;
-	#endif
 	GMAC_TX_WCR0_T	hw_weigh;
 	GMAC_TX_WCR1_T	sw_weigh;
+
+	uint32_t weight = 0;
 //	GMAC_HASH_ENABLE_REG0_T hash_ctrl;
 //
 #if 0 /* mac address will be set in late_initcall */
@@ -1202,24 +1221,23 @@ static int toe_gmac_init_chip(struct net
 	//	config1.bits32 = 0x002004;	//next version
 	/* set flow control threshold */
 	config1.bits32 = 0;
-	config1.bits.set_threshold = 32 / 2;
-	config1.bits.rel_threshold = 32 / 4 * 3;
+	config1.bits.set_threshold = (32 / 2);
+	config1.bits.rel_threshold = (32 / 4) * 3;
 	gmac_write_reg(tp->base_addr, GMAC_CONFIG1, config1.bits32, 0xffffffff);
 
-	/* set flow control threshold */
+	/* TODO: set flow control threshold */
 	config2_val.bits32 = 0;
-	config2_val.bits.set_threshold = TOE_SW_FREEQ_DESC_NUM/2;
-	config2_val.bits.rel_threshold = TOE_SW_FREEQ_DESC_NUM*3/4;
+	config2_val.bits.set_threshold = TOE_SW_FREEQ_DESC_NUM/4;
+	config2_val.bits.rel_threshold = TOE_SW_FREEQ_DESC_NUM/2;
 	gmac_write_reg(tp->base_addr, GMAC_CONFIG2, config2_val.bits32,0xffffffff);
 
-	#ifdef CONFIG_SL351x_NAT
-	/* set HW free queue flow control threshold */
+	/* TODO: set HW free queue flow control threshold */
 	config3_val.bits32 = 0;
 	config3_val.bits.set_threshold = PAUSE_SET_HW_FREEQ;
 	config3_val.bits.rel_threshold = PAUSE_REL_HW_FREEQ;
 	gmac_write_reg(tp->base_addr, GMAC_CONFIG3, config3_val.bits32,0xffffffff);
-	#endif
-	/* set_mcast_filter mask*/
+
+	/* TODO: set_mcast_filter mask*/
 	//	gmac_write_reg(tp->base_addr,GMAC_MCAST_FIL0,0x0,0xffffffff);
 	//  gmac_write_reg(tp->base_addr,GMAC_MCAST_FIL1,0x0,0xffffffff);
 
@@ -1249,7 +1267,7 @@ static int toe_gmac_init_chip(struct net
 	config0.bits.dis_rx = 1;  /* disable rx */
 	config0.bits.dis_tx = 1;  /* disable tx */
 	config0.bits.loop_back = 0; /* enable/disable GMAC loopback */
-	config0.bits.rx_err_detect = 1;
+	config0.bits.rx_err_detect = 1;	/* TODO: was 1, means disabled, 0 enabled ! */
 	config0.bits.rgmii_en = 0;
 	config0.bits.rgmm_edge = 1;
 	config0.bits.rxc_inv = 0;
@@ -1342,6 +1360,9 @@ static int toe_gmac_init_chip(struct net
 	gmac_write_reg(tp->dma_base_addr, GMAC_AHB_WEIGHT_REG, ahb_weight.bits32, ahb_weight_mask.bits32);
 	#endif
 
+	weight = gmac_read_reg(tp->dma_base_addr, GMAC_AHB_WEIGHT_REG);
+	printk("====> %08X\n", weight);
+
 	#if defined(CONFIG_SL351x_NAT) || defined(CONFIG_SL351x_RXTOE)
 	gmac_write_reg(tp->dma_base_addr, GMAC_SPR0, IPPROTO_TCP, 0xffffffff);
 	#endif
@@ -1552,7 +1573,7 @@ static  void toe_gmac_tx_complete(GMAC_I
 		rwptr.bits32 = readl(swtxq->rwptr_reg);
 		if (rwptr.bits.rptr == swtxq->finished_idx)
 			break;
-    	curr_desc = (volatile GMAC_TXDESC_T *)swtxq->desc_base + swtxq->finished_idx;
+		curr_desc = (volatile GMAC_TXDESC_T *)swtxq->desc_base + swtxq->finished_idx;
 //   		consistent_sync((void *)curr_desc, sizeof(GMAC_TXDESC_T), PCI_DMA_FROMDEVICE);
 		word0.bits32 = curr_desc->word0.bits32;
 		word1.bits32 = curr_desc->word1.bits32;
@@ -1573,6 +1594,7 @@ static  void toe_gmac_tx_complete(GMAC_I
 				swtxq->finished_idx = RWPTR_ADVANCE_ONE(swtxq->finished_idx, swtxq->total_desc_num);
 				curr_desc = (GMAC_TXDESC_T *)swtxq->desc_base + swtxq->finished_idx;
 				word0.bits32 = curr_desc->word0.bits32;
+
 #ifdef _DUMP_TX_TCP_CONTENT
 				if (curr_desc->word0.bits.buffer_size < 16)
 				{
@@ -1592,12 +1614,12 @@ static  void toe_gmac_tx_complete(GMAC_I
 			word0.bits.status_tx_ok = 0;
 			if (swtxq->tx_skb[swtxq->finished_idx])
 			{
-				if (interrupt)
-					dev_kfree_skb_irq(swtxq->tx_skb[swtxq->finished_idx]);
-				else
-					dev_kfree_skb(swtxq->tx_skb[swtxq->finished_idx]);
+				dev_kfree_skb(swtxq->tx_skb[swtxq->finished_idx]);
 				swtxq->tx_skb[swtxq->finished_idx] = NULL;
+			} else {
+				BUG();
 			}
+
 			curr_desc->word0.bits32 = word0.bits32;
   			swtxq->curr_finished_desc = (GMAC_TXDESC_T *)curr_desc;
  			swtxq->total_finished++;
@@ -1624,31 +1646,29 @@ static  void toe_gmac_tx_complete(GMAC_I
 *----------------------------------------------------------------------*/
 static int gmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	GMAC_INFO_T 			*tp= dev->priv;
-//	static unsigned int     pcount = 0;
-//	unsigned int			tx_qid;
-    DMA_RWPTR_T				rwptr;
-	volatile GMAC_TXDESC_T	*curr_desc;
-	int 					snd_pages = skb_shinfo(skb)->nr_frags + 1;  /* get number of descriptor */
-	int 					frag_id = 0;
-	int 					len, total_len = skb->len;
+	GMAC_INFO_T *tp= dev->priv;
+	DMA_RWPTR_T rwptr;
+	GMAC_TXDESC_T *curr_desc;
+	int snd_pages = skb_shinfo(skb)->nr_frags + 1;  /* get number of descriptor */
+	int frag_id = 0;
+	int len, total_len = skb->len;
 	struct net_device_stats *isPtr;
-	unsigned int			free_desc;
-	GMAC_SWTXQ_T			*swtxq;
+	unsigned int free_desc;
+	GMAC_SWTXQ_T *swtxq;
 	register unsigned long	word0, word1, word2, word3;
 	unsigned short			wptr, rptr;
 #ifdef	L2_jumbo_frame
 	int header_len = skb->len;
 	struct iphdr	*ip_hdr;
-    struct tcphdr	*tcp_hdr;
-    int             tcp_hdr_len;
-    unsigned char 	*ptr;
-    int             data_len,a;
-    unsigned int    val;
+	struct tcphdr	*tcp_hdr;
+	int             tcp_hdr_len;
+	unsigned char 	*ptr;
+	int             data_len,a;
+	unsigned int    val;
 #endif
 
 #ifdef GMAC_LEN_1_2_ISSUE
-	int						total_pages;
+	int total_pages;
 	total_pages = snd_pages;
 #endif
 
@@ -1664,13 +1684,6 @@ static int gmac_start_xmit(struct sk_buf
     }
 #endif
 
-#if 0
-	if (storlink_ctl.recvfile==2)
-	{
-	    printk("snd_pages=%d skb->len=%d\n",snd_pages,skb->len);
-	}
-#endif
-
 #ifdef GMAC_USE_TXQ0
 	#define tx_qid 	0
 #endif
@@ -1703,9 +1716,9 @@ static int gmac_start_xmit(struct sk_buf
 	toe_gmac_tx_complete(tp, tx_qid, dev, 0);
 
 	if (wptr >= swtxq->finished_idx)
-		free_desc = swtxq->total_desc_num - wptr - 1 + swtxq->finished_idx;
+		free_desc = swtxq->total_desc_num - wptr + swtxq->finished_idx;
 	else
-		free_desc = swtxq->finished_idx - wptr - 1;
+		free_desc = swtxq->finished_idx - wptr;
 	if (free_desc < snd_pages)
 	{
 //		spin_unlock(&tp->tx_mutex);
@@ -2063,9 +2076,10 @@ void mac_start_txdma(struct net_device *
 struct net_device_stats * gmac_get_stats(struct net_device *dev)
 {
     GMAC_INFO_T *tp = (GMAC_INFO_T *)dev->priv;
+#if 0	/* don't read stats from hardware, scary numbers. */
     // unsigned int        flags;
-    unsigned int        pkt_drop;
-    unsigned int        pkt_error;
+    unsigned int        pkt_drop = 0;
+    unsigned int        pkt_error = 0;
 
     if (netif_running(dev))
     {
@@ -2073,10 +2087,14 @@ struct net_device_stats * gmac_get_stats
         // spin_lock_irqsave(&tp->lock,flags);
         pkt_drop = gmac_read_reg(tp->base_addr,GMAC_IN_DISCARDS);
         pkt_error = gmac_read_reg(tp->base_addr,GMAC_IN_ERRORS);
+	printk("**** stack: %lu, hw: %lu\n", tp->ifStatics.rx_dropped, pkt_drop);
+
         tp->ifStatics.rx_dropped = tp->ifStatics.rx_dropped + pkt_drop;
         tp->ifStatics.rx_errors = tp->ifStatics.rx_errors + pkt_error;
         // spin_unlock_irqrestore(&tp->lock,flags);
     }
+#endif
+
     return &tp->ifStatics;
 }
 
@@ -2401,36 +2419,63 @@ static int gmac_close(struct net_device 
 * toe_gmac_fill_free_q
 * allocate buffers for free queue.
 *----------------------------------------------------------------------*/
-static inline void toe_gmac_fill_free_q(void)
+static inline void toe_gmac_fill_free_q(int count)
 {
 	struct sk_buff	*skb;
 	volatile DMA_RWPTR_T	fq_rwptr;
 	volatile GMAC_RXDESC_T	*fq_desc;
-	unsigned long	flags;
+	unsigned long flags;
+	unsigned short index;
+	int filled = 0;
+	static int entered;
 	// unsigned short max_cnt=TOE_SW_FREEQ_DESC_NUM>>1;
 
+	BUG_ON(entered == 1);
+
+	entered = 1;
+
+
 	fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
 	// spin_lock_irqsave(&gmac_fq_lock, flags);
 	//while ((max_cnt--) && (unsigned short)RWPTR_ADVANCE_ONE(fq_rwptr.bits.wptr,
 	//				TOE_SW_FREEQ_DESC_NUM) != fq_rwptr.bits.rptr) {
-	while ((unsigned short)RWPTR_ADVANCE_ONE(fq_rwptr.bits.wptr,
-					TOE_SW_FREEQ_DESC_NUM) != fq_rwptr.bits.rptr) {
+	index = fq_rwptr.bits.wptr;
+#if 0
+	printk("wptr: %hu, rptr: %hu, refill idx: %hu\n",
+	       GET_RPTR(fq_rwptr.bits32),
+	       GET_WPTR(fq_rwptr.bits32),
+	       index);
+#endif
+
+	index = RWPTR_ADVANCE_ONE(index, TOE_SW_FREEQ_DESC_NUM);
+	fq_desc = (GMAC_RXDESC_T*)toe_private_data.swfq_desc_base + index;
+	while (fq_desc->word2.buf_adr == 0) {
+		void *data = NULL;
+
 		if ((skb = dev_alloc_skb(SW_RX_BUF_SIZE)) == NULL) {
 			printk("%s::skb allocation fail!\n", __func__);
-			//while(1);
-			break;
+			goto out;
 		}
-		REG32(skb->data) = (unsigned int)skb;
+		++ filled;
+		data = skb->data;
 		skb_reserve(skb, SKB_RESERVE_BYTES);
-		// fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-		fq_rwptr.bits.wptr = RWPTR_ADVANCE_ONE(fq_rwptr.bits.wptr,
-			TOE_SW_FREEQ_DESC_NUM);
-		fq_desc = (GMAC_RXDESC_T*)toe_private_data.swfq_desc_base+fq_rwptr.bits.wptr;
+
+		REG32(data + 0) = (unsigned int)skb;
+		REG32(data + 4) = (unsigned short)index;
+
+		// printk("refill skb: %p, idx: %hu\n", skb, index);
 		fq_desc->word2.buf_adr = (unsigned int)__pa(skb->data);
-		SET_WPTR(TOE_GLOBAL_BASE+GLOBAL_SWFQ_RWPTR_REG, fq_rwptr.bits.wptr);
-		toe_private_data.fq_rx_rwptr.bits32 = fq_rwptr.bits32;
+	writel(0x07960202, TOE_GMAC0_BASE+GMAC_CONFIG0);
+		SET_WPTR(TOE_GLOBAL_BASE+GLOBAL_SWFQ_RWPTR_REG, index);
+	writel(0x07960200, TOE_GMAC0_BASE+GMAC_CONFIG0);
+
+		index = RWPTR_ADVANCE_ONE(index, TOE_SW_FREEQ_DESC_NUM);
+		fq_desc = (GMAC_RXDESC_T*)toe_private_data.swfq_desc_base+index;
 	}
+out:
 	// spin_unlock_irqrestore(&gmac_fq_lock, flags);
+
+	entered = 0;
 }
 // EXPORT_SYMBOL(toe_gmac_fill_free_q);
 
@@ -2442,14 +2487,14 @@ static void gmac_registers(const char *m
 	unsigned int		status3;
 	unsigned int		status4;
 
-	printk("%s\n", message);
-
 	status0 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_0_REG);
 	status1 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
 	status2 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_2_REG);
 	status3 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_3_REG);
 	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
 
+	printk("%s\n", message);
+
 	printk("status: s0:%08X, s1:%08X, s2:%08X, s3:%08X, s4:%08X\n",
 		   status0, status1, status2, status3, status4);
 
@@ -2468,8 +2513,9 @@ static void gmac_registers(const char *m
 	status3 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_3_REG);
 	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
 
-	printk("select: s0:%08X, s1:%08X, s2:%08X, s3:%08X, s4:%08X\n",
-		   status0, status1, status2, status3, status4);
+	if (status0 || status1 || status2 || status3 || status4)
+			printk("select: s0:%08X, s1:%08X, s2:%08X, s3:%08X, s4:%08X\n",
+				   status0, status1, status2, status3, status4);
 }
 /*----------------------------------------------------------------------
 * toe_gmac_interrupt
@@ -2485,75 +2531,44 @@ static irqreturn_t toe_gmac_interrupt (i
 	unsigned int		status3;
 	unsigned int		status4;
 
-//	struct net_device_stats *isPtr = (struct net_device_stats *)&tp->ifStatics;
 	toe = (TOE_INFO_T *)&toe_private_data;
-//	handle NAPI
-#ifdef CONFIG_SL_NAPI
-	/* XXX: check this, changed from 'storlink_ctl.pauseoff == 1' to if (1) */
-if (1)
-{
-/* disable GMAC interrupt */
-    //toe_gmac_disable_interrupt(tp->irq);
 
-//	isPtr->interrupts++;
+	if (0 && rx_poll_enabled) {
+		gmac_registers("interrupt handler");
+	}
+
 	/* read Interrupt status */
 	status0 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_0_REG);
 	status1 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
 	status2 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_2_REG);
 	status3 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_3_REG);
 	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
-	// prompt warning if status bit ON but not enabled
+
 #if 0
-	if (status0 & ~tp->intr0_enabled)
-		printk("Intr 0 Status error. status = 0x%X, enable = 0x%X\n",
-				status0, tp->intr0_enabled);
-	if (status1 & ~tp->intr1_enabled)
-		printk("Intr 1 Status error. status = 0x%X, enable = 0x%X\n",
-				status1, tp->intr1_enabled);
-	if (status2 & ~tp->intr2_enabled)
-		printk("Intr 2 Status error. status = 0x%X, enable = 0x%X\n",
-				status2, tp->intr2_enabled);
-	if (status3 & ~tp->intr3_enabled)
-		printk("Intr 3 Status error. status = 0x%X, enable = 0x%X\n",
-				status3, tp->intr3_enabled);
-	if (status4 & ~tp->intr4_enabled)
-		printk("Intr 4 Status error. status = 0x%X, enable = 0x%X\n",
-				status4, tp->intr4_enabled);
+	/* handle freeq interrupt first */
+	if (status4 & SWFQ_EMPTY_INT_BIT)
+	{
+		toe_gmac_fill_free_q();
+		writel(status4 & SWFQ_EMPTY_INT_BIT, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
+		tp->sw_fq_empty_cnt++;
+	}
 #endif
 
+	if (status4 & GMAC0_MIB_INT_BIT)
+		writel(GMAC0_MIB_INT_BIT, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
+
+	if (status4 & GMAC0_RX_OVERRUN_INT_BIT)
+		writel(GMAC0_RX_OVERRUN_INT_BIT, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
+
 	if (status0)
 		writel(status0 & tp->intr0_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_0_REG);
-	if (status1)
-		writel(status1 & tp->intr1_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_1_REG);
 	if (status2)
 		writel(status2 & tp->intr2_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_2_REG);
 	if (status3)
 		writel(status3 & tp->intr3_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_3_REG);
-	if (status4)
-		writel(status4 & tp->intr4_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
-
-#if 0
-	/* handle freeq interrupt first */
-	if (status4 & tp->intr4_enabled) {
-		if ((status4 & SWFQ_EMPTY_INT_BIT) && (tp->intr4_enabled & SWFQ_EMPTY_INT_BIT))
-		{
-			// unsigned long data = REG32(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-			//gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_ENABLE_4_REG,
-			//	tp->intr4_enabled & ~SWFQ_EMPTY_INT_BIT, SWFQ_EMPTY_INT_BIT);
-
-			if (toe->gmac[0].dev && netif_running(toe->gmac[0].dev))
-				toe_gmac_handle_default_rxq(toe->gmac[0].dev,&toe->gmac[0]);
-			if (toe->gmac[1].dev && netif_running(toe->gmac[1].dev))
-				toe_gmac_handle_default_rxq(toe->gmac[1].dev,&toe->gmac[1]);
-			printk("\nfreeq int\n");
-			toe_gmac_fill_free_q();
-			tp->sw_fq_empty_cnt++;
 
-		}
-	}
-#endif
 	// Interrupt Status 1
-	if (status1 & tp->intr1_enabled)
+	if ((status1 & 3) || (status4 & 1))
 	{
 		#define G1_INTR0_BITS	(GMAC1_HWTQ13_EOF_INT_BIT | GMAC1_HWTQ12_EOF_INT_BIT | GMAC1_HWTQ11_EOF_INT_BIT | GMAC1_HWTQ10_EOF_INT_BIT)
 		#define G0_INTR0_BITS	(GMAC0_HWTQ03_EOF_INT_BIT | GMAC0_HWTQ02_EOF_INT_BIT | GMAC0_HWTQ01_EOF_INT_BIT | GMAC0_HWTQ00_EOF_INT_BIT)
@@ -2563,7 +2578,7 @@ if (1)
 		// because they should pass packets to upper layer
 		if (tp->port_id == 0)
 		{
-			if (netif_running(dev) && (status1 & G0_INTR0_BITS) && (tp->intr1_enabled & G0_INTR0_BITS))
+			if (((status1 & G0_INTR0_BITS) && (tp->intr1_enabled & G0_INTR0_BITS)) || (status4 & 1))
 			{
 				if (status1 & GMAC0_HWTQ03_EOF_INT_BIT)
 					tp->hwtxq[3].eof_cnt++;
@@ -2574,50 +2589,51 @@ if (1)
 				if (status1 & GMAC0_HWTQ00_EOF_INT_BIT)
 					tp->hwtxq[0].eof_cnt++;
 			}
-				if (netif_running(dev) && (status1 & DEFAULT_Q0_INT_BIT) && (tp->intr1_enabled & DEFAULT_Q0_INT_BIT))
+			if (status1 & DEFAULT_Q0_INT_BIT || status4 & 1)
+			{
+				if (likely(netif_rx_schedule_prep(dev)))
 				{
-					if (!rx_poll_enabled && likely(netif_rx_schedule_prep(dev)))
-        			{
-        				unsigned int data32;
+					unsigned int data32;
+
+					BUG_ON(rx_poll_enabled == 1);
 
-						if (rx_poll_enabled)
-								gmac_registers("check #1");
+					/* Masks GMAC-0 rx interrupt */
+					data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
+					data32 &= ~(DEFAULT_Q0_INT_BIT);
+					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
 
-						BUG_ON(rx_poll_enabled == 1);
+					/* Masks GMAC-0 queue empty interrupt */
+					data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
+					data32 &= ~DEFAULT_Q0_INT_BIT;
+					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
 
+					__netif_rx_schedule(dev);
+					rx_poll_enabled = 1;
+				} else {
 #if 0
-        				/* Masks GMAC-0 rx interrupt */
-						data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-						data32 &= ~(DEFAULT_Q0_INT_BIT);
-						writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-
-        				/* Masks GMAC-0 queue empty interrupt */
-						data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
-						data32 &= ~DEFAULT_Q0_INT_BIT;
-						writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
-
-						data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
-						data32 &= ~DEFAULT_Q0_INT_BIT;
-						writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
-#endif
-
-        				// class-Q & TOE-Q are implemented in future
-        				//data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-        				//data32 &= ~DEFAULT_Q0_INT_BIT;
-						//writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-						//printk("\%s: DEFAULT_Q0_INT_BIT===================>>>>>>>>>>>>\n",__func__);
-						writel(0x0, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_ENABLE_1_REG);
-						//tp->total_q_cnt_napi=0;
-						//rx_time = jiffies;
-						//rx_old_bytes = isPtr->rx_bytes;
-						__netif_rx_schedule(dev);
-						rx_poll_enabled = 1;
-        			}
+					unsigned int data32;
+
+					if (rx_poll_enabled)
+						gmac_registers("->poll() running.");
+					/* Masks GMAC-0 rx interrupt */
+					data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
+					data32 &= ~(DEFAULT_Q0_INT_BIT);
+					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
+
+					/* Masks GMAC-0 queue empty interrupt */
+					data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
+					data32 &= ~DEFAULT_Q0_INT_BIT;
+					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
+#endif
+				}
+			} else {
+				if (0)
+					gmac_registers("status1 & DEFAULT_Q0_INT_BIT || status4 & 1");
 			}
 		}
-		else if (tp->port_id == 1)
+		else if (tp->port_id == 1 && netif_running(dev))
 		{
-			if (netif_running(dev) && (status1 & G1_INTR0_BITS) && (tp->intr1_enabled & G1_INTR0_BITS))
+			if ((status1 & G1_INTR0_BITS) && (tp->intr1_enabled & G1_INTR0_BITS))
 			{
 				if (status1 & GMAC1_HWTQ13_EOF_INT_BIT)
 					tp->hwtxq[3].eof_cnt++;
@@ -2629,14 +2645,14 @@ if (1)
 					tp->hwtxq[0].eof_cnt++;
 			}
 
-			if (netif_running(dev) && (status1 & DEFAULT_Q1_INT_BIT) && (tp->intr1_enabled & DEFAULT_Q1_INT_BIT))
+			if ((status1 & DEFAULT_Q1_INT_BIT) && (tp->intr1_enabled & DEFAULT_Q1_INT_BIT))
 			{
 				if (!rx_poll_enabled && likely(netif_rx_schedule_prep(dev)))
-        		{
-        			unsigned int data32;
+				{
+					unsigned int data32;
 
 					if (rx_poll_enabled)
-							gmac_registers("check #2");
+						gmac_registers("check #2");
 
 					BUG_ON(rx_poll_enabled == 1);
 
@@ -2646,7 +2662,7 @@ if (1)
 					data32 &= ~(DEFAULT_Q1_INT_BIT);
 					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
 
-        			/* Masks GMAC-1 queue empty interrupt */
+					/* Masks GMAC-1 queue empty interrupt */
 					data32  = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
 					data32 &= ~DEFAULT_Q1_INT_BIT;
 					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
@@ -2656,24 +2672,21 @@ if (1)
 					writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
 #endif
 
-         			// disable GMAC-0 rx interrupt
-        			// class-Q & TOE-Q are implemented in future
-        			//data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-        			//data32 &= ~DEFAULT_Q1_INT_BIT;
+					// disable GMAC-0 rx interrupt
+					// class-Q & TOE-Q are implemented in future
+					//data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
+					//data32 &= ~DEFAULT_Q1_INT_BIT;
 					//writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
 					//printk("\%s: 1111111111--->DEFAULT_Q1_INT_BIT===================>>>>>>>>>>>>\n",__func__);
 					writel(0x0, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_ENABLE_1_REG);
 					//tp->total_q_cnt_napi=0;
 					//rx_time = jiffies;
 					//rx_old_bytes = isPtr->rx_bytes;
-           			__netif_rx_schedule(dev);
-				rx_poll_enabled = 1;
-        		}
+					__netif_rx_schedule(dev);
+					rx_poll_enabled = 1;
+				}
 			}
 		}
-	} else {
-
-		gmac_registers("check #3");
 	}
 
 	// Interrupt Status 0
@@ -2814,676 +2827,93 @@ if (1)
 		}
 	}
 
-	//toe_gmac_enable_interrupt(tp->irq);
-#ifdef IxscriptMate_1518
-	if (storlink_ctl.pauseoff == 1)
-	{
-		GMAC_CONFIG0_T config0;
-		config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 0;
-		writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 0;
-		writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-	}
-#endif
-//	 enable_irq(gmac_irq[dev_index]);
-	//printk("gmac_interrupt complete!\n\n");
-//	return IRQ_RETVAL(handled);
 	return	IRQ_RETVAL(1);
 }
-else
-{
-#endif	//endif NAPI
 
+/*----------------------------------------------------------------------
+* gmac_get_phy_vendor
+*----------------------------------------------------------------------*/
+static unsigned int gmac_get_phy_vendor(int phy_addr)
+{
+    unsigned int	reg_val;
+    reg_val=(mii_read(phy_addr,0x02) << 16) + mii_read(phy_addr,0x03);
+    return reg_val;
+}
 
-	/* disable GMAC interrupt */
-    toe_gmac_disable_interrupt(tp->irq);
+/*----------------------------------------------------------------------
+* gmac_set_phy_status
+*----------------------------------------------------------------------*/
+void gmac_set_phy_status(struct net_device *dev)
+{
+	GMAC_INFO_T *tp = dev->priv;
+	GMAC_STATUS_T   status;
+	unsigned int    reg_val, ability,wan_port_id;
+	unsigned int    i = 0;
 
-//	isPtr->interrupts++;
-	/* read Interrupt status */
-	status0 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_0_REG);
-	status1 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
-	status2 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_2_REG);
-	status3 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_3_REG);
-	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
-	// prompt warning if status bit ON but not enabled
+#ifdef VITESSE_G5SWITCH
+	if((tp->port_id == GMAC_PORT1)&&(Giga_switch==1)){
 #if 0
-	if (status0 & ~tp->intr0_enabled)
-		printk("Intr 0 Status error. status = 0x%X, enable = 0x%X\n",
-				status0, tp->intr0_enabled);
-	if (status1 & ~tp->intr1_enabled)
-		printk("Intr 1 Status error. status = 0x%X, enable = 0x%X\n",
-				status1, tp->intr1_enabled);
-	if (status2 & ~tp->intr2_enabled)
-		printk("Intr 2 Status error. status = 0x%X, enable = 0x%X\n",
-				status2, tp->intr2_enabled);
-	if (status3 & ~tp->intr3_enabled)
-		printk("Intr 3 Status error. status = 0x%X, enable = 0x%X\n",
-				status3, tp->intr3_enabled);
-	if (status4 & ~tp->intr4_enabled)
-		printk("Intr 4 Status error. status = 0x%X, enable = 0x%X\n",
-				status4, tp->intr4_enabled);
-#endif
-#define	INTERRUPT_SELECT			1
-	if (status0)
-		writel(status0 & tp->intr0_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_0_REG);
-	if (status1)
-		writel(status1 & tp->intr1_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_1_REG);
-	if (status2)
-		writel(status2 & tp->intr2_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_2_REG);
-	if (status3)
-		writel(status3 & tp->intr3_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_3_REG);
-	if (status4)
-		writel(status4 & tp->intr4_enabled, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
-
-	/* handle freeq interrupt first */
-	if (status4 & tp->intr4_enabled) {
-		if ((status4 & SWFQ_EMPTY_INT_BIT) && (tp->intr4_enabled & SWFQ_EMPTY_INT_BIT))
-		{
-			// unsigned long data = REG32(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-			//gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_ENABLE_4_REG,
-			//	tp->intr4_enabled & ~SWFQ_EMPTY_INT_BIT, SWFQ_EMPTY_INT_BIT);
-
-			//gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG,
-			//	SWFQ_EMPTY_INT_BIT, SWFQ_EMPTY_INT_BIT);
-			if (toe->gmac[0].dev && netif_running(toe->gmac[0].dev))
-				toe_gmac_handle_default_rxq(toe->gmac[0].dev,&toe->gmac[0]);
-			if (toe->gmac[1].dev && netif_running(toe->gmac[1].dev))
-				toe_gmac_handle_default_rxq(toe->gmac[1].dev,&toe->gmac[1]);
-			printk("\nfreeq int\n");
-			toe_gmac_fill_free_q();
-			tp->sw_fq_empty_cnt++;
-
-			gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG, status4,
-				SWFQ_EMPTY_INT_BIT);
-		}
-	}
-
-	// Interrupt Status 1
-	if (status1 & tp->intr1_enabled)
-	{
-		#define G1_INTR0_BITS	(GMAC1_HWTQ13_EOF_INT_BIT | GMAC1_HWTQ12_EOF_INT_BIT | GMAC1_HWTQ11_EOF_INT_BIT | GMAC1_HWTQ10_EOF_INT_BIT)
-		#define G0_INTR0_BITS	(GMAC0_HWTQ03_EOF_INT_BIT | GMAC0_HWTQ02_EOF_INT_BIT | GMAC0_HWTQ01_EOF_INT_BIT | GMAC0_HWTQ00_EOF_INT_BIT)
-		// Handle GMAC 0/1 HW Tx queue 0-3 EOF events
-		// Only count
-		// TOE, Classification, and default queues interrupts are handled by ISR
-		// because they should pass packets to upper layer
-		if (tp->port_id == 0)
-		{
-#ifndef	INTERRUPT_SELECT
-			if (netif_running(dev) && (status1 & G0_INTR0_BITS) && (tp->intr1_enabled & G0_INTR0_BITS))
-			{
-				if (status1 & GMAC0_HWTQ03_EOF_INT_BIT)
-					tp->hwtxq[3].eof_cnt++;
-				if (status1 & GMAC0_HWTQ02_EOF_INT_BIT)
-					tp->hwtxq[2].eof_cnt++;
-				if (status1 & GMAC0_HWTQ01_EOF_INT_BIT)
-					tp->hwtxq[1].eof_cnt++;
-				if (status1 & GMAC0_HWTQ00_EOF_INT_BIT)
-					tp->hwtxq[0].eof_cnt++;
-#endif	//INTERRUPT_SELECT
-#ifndef	INTERRUPT_SELECT
-			}
-#endif	//INTERRUPT_SELECT
-			if (netif_running(dev) && (status1 & DEFAULT_Q0_INT_BIT) && (tp->intr1_enabled & DEFAULT_Q0_INT_BIT))
-			{
-				tp->default_q_intr_cnt++;
-				toe_gmac_handle_default_rxq(dev, tp);
+		rcv_mask = SPI_read(2,0,0x10);			// Receive mask
+		rcv_mask |= 0x4F;
+		for(i=0;i<4;i++){
+			reg_val = BIT(26)|(i<<21)|(10<<16);
+			SPI_write(3,0,1,reg_val);
+			msleep(10);
+			reg_val = SPI_read(3,0,2);
+			if(reg_val & 0x0c00){
+				printk("Port%d:Giga mode\n",i);
+				SPI_write(1,i,0x00,0x300701B1);
+				SPI_write(1,i,0x00,0x10070181);
+				switch_pre_link[i]=LINK_UP;
+				switch_pre_speed[i]=GMAC_SPEED_1000;
 			}
-#ifdef CONFIG_SL351x_RXTOE
-			if (netif_running(dev) && (status1 & TOE_IQ_ALL_BITS) &&
-			    (tp->intr1_enabled & TOE_IQ_ALL_BITS)) {
-				//printk("status %x, bits %x, slct %x\n", status1, TOE_IQ_ALL_BITS, tp->intr1_selected);
-				toe_gmac_handle_toeq(dev, tp, status1);
-				//toe_gmac_handle_toeq(dev, toe, tp, status1);
+			else{
+				reg_val = BIT(26)|(i<<21)|(5<<16);
+				SPI_write(3,0,1,reg_val);
+				msleep(10);
+				ability = (reg_val = SPI_read(3,0,2)&0x5e0) >>5;
+				if ((ability & 0x0C)) /* 100M full duplex */
+				{
+					SPI_write(1,i,0x00,0x30050472);
+					SPI_write(1,i,0x00,0x10050442);
+					printk("Port%d:100M\n",i);
+					switch_pre_link[i]=LINK_UP;
+				switch_pre_speed[i]=GMAC_SPEED_100;
+				}
+				else if((ability & 0x03)) /* 10M full duplex */
+				{
+					SPI_write(1,i,0x00,0x30050473);
+					SPI_write(1,i,0x00,0x10050443);
+					printk("Port%d:10M\n",i);
+					switch_pre_link[i]=LINK_UP;
+					switch_pre_speed[i]=GMAC_SPEED_10;
+				}
+				else{
+					SPI_write(1,i,0x00,BIT(16));			// disable RX
+					SPI_write(5,0,0x0E,BIT(i));			// dicard packet
+					while((SPI_read(5,0,0x0C)&BIT(i))==0)		// wait to be empty
+						msleep(1);
+
+					SPI_write(1,i,0x00,0x20000030);			// PORT_RST
+					switch_pre_link[i]=LINK_DOWN;
+					switch_pre_speed[i]=GMAC_SPEED_10;
+					rcv_mask &= ~BIT(i);
+					SPI_write(2,0,0x10,rcv_mask);			// Disable Receive
+				}
 			}
-#endif
 		}
-		else if (tp->port_id == 1)
-		{
-#ifndef	INTERRUPT_SELECT
-			if (netif_running(dev) && (status1 & G1_INTR0_BITS) && (tp->intr1_enabled & G1_INTR0_BITS))
-			{
-				if (status1 & GMAC1_HWTQ13_EOF_INT_BIT)
-					tp->hwtxq[3].eof_cnt++;
-				if (status1 & GMAC1_HWTQ12_EOF_INT_BIT)
-					tp->hwtxq[2].eof_cnt++;
-				if (status1 & GMAC1_HWTQ11_EOF_INT_BIT)
-					tp->hwtxq[1].eof_cnt++;
-				if (status1 & GMAC1_HWTQ10_EOF_INT_BIT)
-					tp->hwtxq[0].eof_cnt++;
-#endif	//INTERRUPT_SELECT
-#ifndef	INTERRUPT_SELECT
-			}
-#endif	//INTERRUPT_SELECT
-			if (netif_running(dev) && (status1 & DEFAULT_Q1_INT_BIT) && (tp->intr1_enabled & DEFAULT_Q1_INT_BIT))
-			{
-				tp->default_q_intr_cnt++;
-				toe_gmac_handle_default_rxq(dev, tp);
-			}
-#ifdef CONFIG_SL351x_RXTOE
-			if (netif_running(dev) && (status1 & TOE_IQ_ALL_BITS) &&
-			    (tp->intr1_enabled & TOE_IQ_ALL_BITS)) {
-				//printk("status %x, bits %x, slct %x\n", status1, TOE_IQ_ALL_BITS, tp->intr1_selected);
-				toe_gmac_handle_toeq(dev, tp, status1);
-				//toe_gmac_handle_toeq(dev, toe, tp, status1);
-			}
 #endif
-		}
+		gmac_get_switch_status(dev);
+		gmac_write_reg(tp->base_addr, GMAC_STATUS, 0x7d, 0x0000007f);
+//		SPI_write(2,0,0x10,rcv_mask);			// Enable Receive
+		return ;
 	}
+#endif
 
+	reg_val = gmac_get_phy_vendor(tp->phy_addr);
+	printk("GMAC-%d Addr %d Vendor ID: 0x%08x\n", tp->port_id, tp->phy_addr, reg_val);
 
-	// Interrupt Status 0
-	if (status0 & tp->intr0_enabled)
-	{
-
-		#define ERR_INTR_BITS	(GMAC0_TXDERR_INT_BIT | GMAC0_TXPERR_INT_BIT |	\
-								 GMAC1_TXDERR_INT_BIT | GMAC1_TXPERR_INT_BIT |	\
-								 GMAC0_RXDERR_INT_BIT | GMAC0_RXPERR_INT_BIT |	\
-								 GMAC1_RXDERR_INT_BIT | GMAC1_RXPERR_INT_BIT)
-#ifndef	INTERRUPT_SELECT
-		if (status0 &  ERR_INTR_BITS)
-		{
-			if ((status0 & GMAC0_TXDERR_INT_BIT) && (tp->intr0_enabled & GMAC0_TXDERR_INT_BIT))
-			{
-				tp->txDerr_cnt[0]++;
-				printk("GMAC0 TX AHB Bus Error!\n");
-			}
-			if ((status0 & GMAC0_TXPERR_INT_BIT) && (tp->intr0_enabled & GMAC0_TXPERR_INT_BIT))
-			{
-				tp->txPerr_cnt[0]++;
-				printk("GMAC0 Tx Descriptor Protocol Error!\n");
-			}
-			if ((status0 & GMAC1_TXDERR_INT_BIT) && (tp->intr0_enabled & GMAC1_TXDERR_INT_BIT))
-			{
-				tp->txDerr_cnt[1]++;
-				printk("GMAC1 Tx AHB Bus Error!\n");
-			}
-			if ((status0 & GMAC1_TXPERR_INT_BIT) && (tp->intr0_enabled & GMAC1_TXPERR_INT_BIT))
-			{
-				tp->txPerr_cnt[1]++;
-				printk("GMAC1 Tx Descriptor Protocol Error!\n");
-			}
-
-			if ((status0 & GMAC0_RXDERR_INT_BIT) && (tp->intr0_enabled & GMAC0_RXDERR_INT_BIT))
-			{
-				tp->RxDerr_cnt[0]++;
-				printk("GMAC0 Rx AHB Bus Error!\n");
-			}
-			if ((status0 & GMAC0_RXPERR_INT_BIT) && (tp->intr0_enabled & GMAC0_RXPERR_INT_BIT))
-			{
-				tp->RxPerr_cnt[0]++;
-				printk("GMAC0 Rx Descriptor Protocol Error!\n");
-			}
-			if ((status0 & GMAC1_RXDERR_INT_BIT) && (tp->intr0_enabled & GMAC1_RXDERR_INT_BIT))
-			{
-				tp->RxDerr_cnt[1]++;
-				printk("GMAC1 Rx AHB Bus Error!\n");
-			}
-			if ((status0 & GMAC1_RXPERR_INT_BIT) && (tp->intr0_enabled & GMAC1_RXPERR_INT_BIT))
-			{
-				tp->RxPerr_cnt[1]++;
-				printk("GMAC1 Rx Descriptor Protocol Error!\n");
-			}
-		}
-#endif	//INTERRUPT_SELECT
-#ifndef	GMAX_TX_INTR_DISABLED
-		if (tp->port_id == 1 &&	netif_running(dev) &&
-			(((status0 & GMAC1_SWTQ10_FIN_INT_BIT) && (tp->intr0_enabled & GMAC1_SWTQ10_FIN_INT_BIT))
-			||
-			((status0 & GMAC1_SWTQ10_EOF_INT_BIT) && (tp->intr0_enabled & GMAC1_SWTQ10_EOF_INT_BIT))))
-		{
-			toe_gmac_tx_complete(&toe_private_data.gmac[1], 0, dev, 1);
-		}
-
-		if (tp->port_id == 0 &&	netif_running(dev) &&
-			(((status0 & GMAC0_SWTQ00_FIN_INT_BIT) && (tp->intr0_enabled & GMAC0_SWTQ00_FIN_INT_BIT))
-			||
-			((status0 & GMAC0_SWTQ00_EOF_INT_BIT) && (tp->intr0_enabled & GMAC0_SWTQ00_EOF_INT_BIT))))
-		{
-			toe_gmac_tx_complete(&toe_private_data.gmac[0], 0, dev, 1);
-		}
-#endif
-		// clear enabled status bits
-	}
-	// Interrupt Status 4
-#ifndef	INTERRUPT_SELECT
-	if (status4 & tp->intr4_enabled)
-	{
-		#define G1_INTR4_BITS		(0xff000000)
-		#define G0_INTR4_BITS		(0x00ff0000)
-
-		if (tp->port_id == 0)
-		{
-			if ((status4 & G0_INTR4_BITS) && (tp->intr4_enabled & G0_INTR4_BITS))
-			{
-				if (status4 & GMAC0_RESERVED_INT_BIT)
-					printk("GMAC0_RESERVED_INT_BIT is ON\n");
-				if (status4 & GMAC0_MIB_INT_BIT)
-					tp->mib_full_cnt++;
-				if (status4 & GMAC0_RX_PAUSE_ON_INT_BIT)
-					tp->rx_pause_on_cnt++;
-				if (status4 & GMAC0_TX_PAUSE_ON_INT_BIT)
-					tp->tx_pause_on_cnt++;
-				if (status4 & GMAC0_RX_PAUSE_OFF_INT_BIT)
-					tp->rx_pause_off_cnt++;
-				if (status4 & GMAC0_TX_PAUSE_OFF_INT_BIT)
-					tp->rx_pause_off_cnt++;
-				if (status4 & GMAC0_RX_OVERRUN_INT_BIT)
-					tp->rx_overrun_cnt++;
-				if (status4 & GMAC0_STATUS_CHANGE_INT_BIT)
-					tp->status_changed_cnt++;
-			}
-		}
-		else if (tp->port_id == 1)
-		{
-			if ((status4 & G1_INTR4_BITS) && (tp->intr4_enabled & G1_INTR4_BITS))
-			{
-				if (status4 & GMAC1_RESERVED_INT_BIT)
-					printk("GMAC1_RESERVED_INT_BIT is ON\n");
-				if (status4 & GMAC1_MIB_INT_BIT)
-					tp->mib_full_cnt++;
-				if (status4 & GMAC1_RX_PAUSE_ON_INT_BIT)
-				{
-					//printk("Gmac pause on\n");
-					tp->rx_pause_on_cnt++;
-				}
-				if (status4 & GMAC1_TX_PAUSE_ON_INT_BIT)
-				{
-					//printk("Gmac pause on\n");
-					tp->tx_pause_on_cnt++;
-				}
-				if (status4 & GMAC1_RX_PAUSE_OFF_INT_BIT)
-				{
-					//printk("Gmac pause off\n");
-					tp->rx_pause_off_cnt++;
-				}
-				if (status4 & GMAC1_TX_PAUSE_OFF_INT_BIT)
-				{
-					//printk("Gmac pause off\n");
-					tp->rx_pause_off_cnt++;
-				}
-				if (status4 & GMAC1_RX_OVERRUN_INT_BIT)
-				{
-					//printk("Gmac Rx Overrun \n");
-					tp->rx_overrun_cnt++;
-				}
-				if (status4 & GMAC1_STATUS_CHANGE_INT_BIT)
-					tp->status_changed_cnt++;
-			}
-		}
-#if 0
-		if ((status4 & SWFQ_EMPTY_INT_BIT) && (tp->intr4_enabled & SWFQ_EMPTY_INT_BIT))
-		{
-			// unsigned long data = REG32(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-//			mac_stop_rxdma(tp->sc);
-			gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_ENABLE_4_REG,
-				tp->intr4_enabled & ~SWFQ_EMPTY_INT_BIT, SWFQ_EMPTY_INT_BIT);
-
-			gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG,
-				SWFQ_EMPTY_INT_BIT, SWFQ_EMPTY_INT_BIT);
-			toe_gmac_fill_free_q();
-			tp->sw_fq_empty_cnt++;
-
-			gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG, status4,
-				SWFQ_EMPTY_INT_BIT);
-//#if 0
-/*			if (netif_running(dev))
-				toe_gmac_handle_default_rxq(dev, tp);
-			printk("SWFQ_EMPTY_INT_BIT is ON!\n");	// should not be happened */
-//#endif
-		}
-#endif
-	}
-#endif	//INTERRUPT_SELECT
-	toe_gmac_enable_interrupt(tp->irq);
-//enable gmac rx function when do RFC 2544
-#ifdef IxscriptMate_1518
-	if (storlink_ctl.pauseoff == 1)
-	{
-		GMAC_CONFIG0_T config0;
-		config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 0;
-		writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 0;
-		writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-	}
-#endif
-	//printk("gmac_interrupt complete!\n\n");
-//	return IRQ_RETVAL(handled);
-	return	IRQ_RETVAL(1);
-#ifdef CONFIG_SL_NAPI
-}
-#endif
-}
-
-/*----------------------------------------------------------------------
-*	toe_gmac_handle_default_rxq
-*	(1) Get rx Buffer for default Rx queue
-*	(2) notify or call upper-routine to handle it
-*	(3) get a new buffer and insert it into SW free queue
-*	(4) Note: The SW free queue Read-Write Pointer should be locked when accessing
-*----------------------------------------------------------------------*/
-//static inline void toe_gmac_handle_default_rxq(struct net_device *dev, GMAC_INFO_T *tp)
-static void toe_gmac_handle_default_rxq(struct net_device *dev, GMAC_INFO_T *tp)
-{
-	TOE_INFO_T			*toe;
-    GMAC_RXDESC_T   	*curr_desc;
-	struct sk_buff 		*skb;
-    DMA_RWPTR_T			rwptr;
-	unsigned int 		pkt_size;
-	int					max_cnt;
-	unsigned int        desc_count;
-	unsigned int        good_frame, chksum_status, rx_status;
-	struct net_device_stats *isPtr = (struct net_device_stats *)&tp->ifStatics;
-
-//when do ixia RFC 2544 test and packet size is select 1518 bytes,disable gmace rx function immediately after one interrupt come in.
-#ifdef IxscriptMate_1518
-	if (storlink_ctl.pauseoff == 1)
-	{
-		GMAC_CONFIG0_T config0;
-		config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 1;
-		writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-		config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-		config0.bits.dis_rx = 1;
-		writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-	}
-#endif
-	rwptr.bits32 = readl(&tp->default_qhdr->word1);
-#if 0
-	if (rwptr.bits.rptr != tp->rx_rwptr.bits.rptr)
-	{
-		mac_stop_txdma((struct net_device *)tp->dev);
-		printk("Default Queue HW RD ptr (0x%x) != SW RD Ptr (0x%x)\n",
-				rwptr.bits32, tp->rx_rwptr.bits.rptr);
-		while(1);
-	}
-#endif
-	toe = (TOE_INFO_T *)&toe_private_data;
-	max_cnt = DEFAULT_RXQ_MAX_CNT;
-	while ((--max_cnt) && rwptr.bits.rptr != rwptr.bits.wptr)
-//	while (rwptr.bits.rptr != rwptr.bits.wptr)
-	{
-//if packet size is not 1518 for RFC 2544,enable gmac rx function.The other packet size have RX workaround.
-#ifdef IxscriptMate_1518
-    	if (storlink_ctl.pauseoff == 1)
-		{
-			if (pkt_size != 1514)
-			{
-						GMAC_CONFIG0_T config0;
-						config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-						config0.bits.dis_rx = 0;
-						writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-						config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-						config0.bits.dis_rx = 0;
-						writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-			}
-		}
-#endif
-    	curr_desc = (GMAC_RXDESC_T *)tp->default_desc_base + rwptr.bits.rptr;
-//		consistent_sync(curr_desc, sizeof(GMAC_RXDESC_T), PCI_DMA_FROMDEVICE);
-		tp->default_q_cnt++;
-    	tp->rx_curr_desc = (unsigned int)curr_desc;
-    	rx_status = curr_desc->word0.bits.status;
-    	chksum_status = curr_desc->word0.bits.chksum_status;
-    	tp->rx_status_cnt[rx_status]++;
-    	tp->rx_chksum_cnt[chksum_status]++;
-        pkt_size = curr_desc->word1.bits.byte_count;  /*total byte count in a frame*/
-		desc_count = curr_desc->word0.bits.desc_count; /* get descriptor count per frame */
-		good_frame=1;
-		if ((curr_desc->word0.bits32 & (GMAC_RXDESC_0_T_derr | GMAC_RXDESC_0_T_perr))
-			|| (pkt_size < 60)
-		    || (chksum_status & 0x4)
-			|| rx_status)
-		{
-			good_frame = 0;
-			if (curr_desc->word0.bits32 & GMAC_RXDESC_0_T_derr)
-				printk("%s::derr (GMAC-%d)!!!\n", __func__, tp->port_id);
-			if (curr_desc->word0.bits32 & GMAC_RXDESC_0_T_perr)
-				printk("%s::perr (GMAC-%d)!!!\n", __func__, tp->port_id);
-			if (rx_status)
-			{
-				if (rx_status == 4 || rx_status == 7)
-					isPtr->rx_crc_errors++;
-//				printk("%s::Status=%d (GMAC-%d)!!!\n", __func__, rx_status, tp->port_id);
-			}
-#ifdef SL351x_GMAC_WORKAROUND
-			else if (pkt_size < 60)
-			{
-				if (tp->short_frames_cnt < GMAC_SHORT_FRAME_THRESHOLD)
-					tp->short_frames_cnt++;
-				if (tp->short_frames_cnt >= GMAC_SHORT_FRAME_THRESHOLD)
-				{
-					GMAC_CONFIG0_T config0;
-					config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-					config0.bits.dis_rx = 1;
-					writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-					config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-					config0.bits.dis_rx = 1;
-					writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-				}
-			}
-#endif
-//			if (chksum_status)
-//				printk("%s::Checksum Status=%d (GMAC-%d)!!!\n", __func__, chksum_status, tp->port_id);
-			skb = (struct sk_buff *)(REG32(__va(curr_desc->word2.buf_adr) - SKB_RESERVE_BYTES));
-			dev_kfree_skb_irq(skb);
-		}
-		if (good_frame)
-		{
-			if (curr_desc->word0.bits.drop)
-				printk("%s::Drop (GMAC-%d)!!!\n", __func__, tp->port_id);
-//			if (chksum_status)
-//				printk("%s::Checksum Status=%d (GMAC-%d)!!!\n", __func__, chksum_status, tp->port_id);
-
-	    	/* get frame information from the first descriptor of the frame */
-#ifdef SL351x_GMAC_WORKAROUND
-			if (tp->short_frames_cnt >= GMAC_SHORT_FRAME_THRESHOLD)
-			{
-				GMAC_CONFIG0_T config0;
-				config0.bits32 = readl(TOE_GMAC0_BASE+GMAC_CONFIG0);
-				config0.bits.dis_rx = 0;
-				writel(config0.bits32, TOE_GMAC0_BASE+GMAC_CONFIG0);
-				config0.bits32 = readl(TOE_GMAC1_BASE+GMAC_CONFIG0);
-				config0.bits.dis_rx = 0;
-				writel(config0.bits32, TOE_GMAC1_BASE+GMAC_CONFIG0);
-			}
-			tp->short_frames_cnt = 0;
-#endif
-			isPtr->rx_packets++;
-			skb = (struct sk_buff *)(REG32(__va(curr_desc->word2.buf_adr - SKB_RESERVE_BYTES)));
-			if (!skb)
-			{
-				printk("Fatal Error!!skb==NULL\n");
-				goto next_rx;
-			}
-			tp->curr_rx_skb = skb;
-			// consistent_sync((void *)__va(curr_desc->word2.buf_adr), pkt_size, PCI_DMA_FROMDEVICE);
-
-	//		curr_desc->word2.buf_adr = 0;
-
-			skb_reserve (skb, RX_INSERT_BYTES);	/* 16 byte align the IP fields. */
-			skb_put(skb, pkt_size);
-			skb->dev = dev;
-			if (chksum_status == RX_CHKSUM_IP_UDP_TCP_OK)
-			{
-				skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef CONFIG_SL351x_NAT
-				if (nat_cfg.enabled && curr_desc->word3.bits.l3_offset && curr_desc->word3.bits.l4_offset)
-				{
-					struct iphdr	*ip_hdr;
-					ip_hdr = (struct iphdr *)&(skb->data[curr_desc->word3.bits.l3_offset]);
-					sl351x_nat_input(skb,
-									tp->port_id,
-									(void *)curr_desc->word3.bits.l3_offset,
-								  	(void *)curr_desc->word3.bits.l4_offset);
-				}
-#endif
-				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
-#if 0
-#ifdef CONFIG_SL351x_RXTOE
-				if (storlink_ctl.rx_max_pktsize) {
-					struct iphdr	*ip_hdr;
-					struct tcphdr	*tcp_hdr;
-					int ip_hdrlen;
-
- 					ip_hdr = (struct iphdr*)&(skb->data[0]);
-					if ((skb->protocol == __constant_htons(ETH_P_IP)) &&
-					   ((ip_hdr->protocol & 0x00ff) == IPPROTO_TCP)) {
-						ip_hdrlen = ip_hdr->ihl << 2;
-						tcp_hdr = (struct tcphdr*)&(skb->data[ip_hdrlen]);
-						if (tcp_hdr->syn) {
-							struct toe_conn* connection = init_toeq(ip_hdr->version,
-									ip_hdr, tcp_hdr, toe, &(skb->data[0]) - 14);
-							TCP_SKB_CB(skb)->connection = connection;
-							//	hash_dump_entry(TCP_SKB_CB(skb)->connection->hash_entry_index);
-							//		printk("%s::skb data %x, conn %x, mode %x\n",
-							//			__func__, skb->data, connection, connection->mode);
-						}
-					}
-				}
-#endif
-#endif
-			}
-			else if (chksum_status == RX_CHKSUM_IP_OK_ONLY)
-			{
-				skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef CONFIG_SL351x_NAT
-				if (nat_cfg.enabled && curr_desc->word3.bits.l3_offset && curr_desc->word3.bits.l4_offset)
-				{
-					struct iphdr		*ip_hdr;
-					//struct tcphdr		*tcp_hdr;
-					ip_hdr = (struct iphdr *)&(skb->data[curr_desc->word3.bits.l3_offset]);
-					//tcp_hdr = (struct tcphdr *)&(skb->data[curr_desc->word3.bits.l4_offset]);
-					if (ip_hdr->protocol == IPPROTO_UDP)
-					{
-						sl351x_nat_input(skb,
-										tp->port_id,
-										(void *)curr_desc->word3.bits.l3_offset,
-								  		(void *)curr_desc->word3.bits.l4_offset);
-					}
-					else if (ip_hdr->protocol == IPPROTO_GRE)
-					{
-						sl351x_nat_input(skb,
-									tp->port_id,
-									(void *)curr_desc->word3.bits.l3_offset,
-								  	(void *)curr_desc->word3.bits.l4_offset);
-					}
-				}
-#endif
-				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
-			}
-			else
-			{
-				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
-			}
-
-			netif_rx(skb);  /* socket rx */
-			dev->last_rx = jiffies;
-
-			isPtr->rx_bytes += pkt_size;
-
-        }
-
-next_rx:
-		// advance one for Rx default Q 0/1
-		rwptr.bits.rptr = RWPTR_ADVANCE_ONE(rwptr.bits.rptr, tp->default_desc_num);
-		SET_RPTR(&tp->default_qhdr->word1, rwptr.bits.rptr);
-     	tp->rx_rwptr.bits32 = rwptr.bits32;
-
-	}
-
-	/* Handles first available packets only then refill the queue. */
-	toe_gmac_fill_free_q();
-}
-
-/*----------------------------------------------------------------------
-* gmac_get_phy_vendor
-*----------------------------------------------------------------------*/
-static unsigned int gmac_get_phy_vendor(int phy_addr)
-{
-    unsigned int	reg_val;
-    reg_val=(mii_read(phy_addr,0x02) << 16) + mii_read(phy_addr,0x03);
-    return reg_val;
-}
-
-/*----------------------------------------------------------------------
-* gmac_set_phy_status
-*----------------------------------------------------------------------*/
-void gmac_set_phy_status(struct net_device *dev)
-{
-	GMAC_INFO_T *tp = dev->priv;
-	GMAC_STATUS_T   status;
-	unsigned int    reg_val, ability,wan_port_id;
-	unsigned int    i = 0;
-
-#ifdef VITESSE_G5SWITCH
-	if((tp->port_id == GMAC_PORT1)&&(Giga_switch==1)){
-#if 0
-		rcv_mask = SPI_read(2,0,0x10);			// Receive mask
-		rcv_mask |= 0x4F;
-		for(i=0;i<4;i++){
-			reg_val = BIT(26)|(i<<21)|(10<<16);
-			SPI_write(3,0,1,reg_val);
-			msleep(10);
-			reg_val = SPI_read(3,0,2);
-			if(reg_val & 0x0c00){
-				printk("Port%d:Giga mode\n",i);
-				SPI_write(1,i,0x00,0x300701B1);
-				SPI_write(1,i,0x00,0x10070181);
-				switch_pre_link[i]=LINK_UP;
-				switch_pre_speed[i]=GMAC_SPEED_1000;
-			}
-			else{
-				reg_val = BIT(26)|(i<<21)|(5<<16);
-				SPI_write(3,0,1,reg_val);
-				msleep(10);
-				ability = (reg_val = SPI_read(3,0,2)&0x5e0) >>5;
-				if ((ability & 0x0C)) /* 100M full duplex */
-				{
-					SPI_write(1,i,0x00,0x30050472);
-					SPI_write(1,i,0x00,0x10050442);
-					printk("Port%d:100M\n",i);
-					switch_pre_link[i]=LINK_UP;
-				switch_pre_speed[i]=GMAC_SPEED_100;
-				}
-				else if((ability & 0x03)) /* 10M full duplex */
-				{
-					SPI_write(1,i,0x00,0x30050473);
-					SPI_write(1,i,0x00,0x10050443);
-					printk("Port%d:10M\n",i);
-					switch_pre_link[i]=LINK_UP;
-					switch_pre_speed[i]=GMAC_SPEED_10;
-				}
-				else{
-					SPI_write(1,i,0x00,BIT(16));			// disable RX
-					SPI_write(5,0,0x0E,BIT(i));			// dicard packet
-					while((SPI_read(5,0,0x0C)&BIT(i))==0)		// wait to be empty
-						msleep(1);
-
-					SPI_write(1,i,0x00,0x20000030);			// PORT_RST
-					switch_pre_link[i]=LINK_DOWN;
-					switch_pre_speed[i]=GMAC_SPEED_10;
-					rcv_mask &= ~BIT(i);
-					SPI_write(2,0,0x10,rcv_mask);			// Disable Receive
-				}
-			}
-		}
-#endif
-		gmac_get_switch_status(dev);
-		gmac_write_reg(tp->base_addr, GMAC_STATUS, 0x7d, 0x0000007f);
-//		SPI_write(2,0,0x10,rcv_mask);			// Enable Receive
-		return ;
-	}
-#endif
-
-	reg_val = gmac_get_phy_vendor(tp->phy_addr);
-	printk("GMAC-%d Addr %d Vendor ID: 0x%08x\n", tp->port_id, tp->phy_addr, reg_val);
-
-	switch (tp->phy_mode)
+	switch (tp->phy_mode)
 	{
 		case GMAC_PHY_GMII:
 		mii_write(tp->phy_addr,0x04,0x05e1); /* advertisement 100M full duplex, pause capable on */
@@ -3552,6 +2982,7 @@ void gmac_set_phy_status(struct net_devi
 		status.bits.link = LINK_DOWN;
 		//		clear_bit(__LINK_STATE_START, &dev->state);
 		printk("Link Down (0x%04x) ", reg_val);
+#ifdef VITESSE_G5SWITCH
 		if(Giga_switch == 1)
 		{
 				wan_port_id = 1;
@@ -3565,6 +2996,7 @@ void gmac_set_phy_status(struct net_devi
 				storlink_ctl.link[ tp->port_id] = 0;
 #endif
 		}
+#endif
 	}
 	else
 	{
@@ -3572,6 +3004,7 @@ void gmac_set_phy_status(struct net_devi
 		status.bits.link = LINK_UP;
 		//		set_bit(__LINK_STATE_START, &dev->state);
 		printk("Link Up (0x%04x) ",reg_val);
+#ifdef VITESSE_G5SWITCH
 		if(Giga_switch == 1)
 		{
 				wan_port_id = 1;
@@ -3585,6 +3018,7 @@ void gmac_set_phy_status(struct net_devi
 				storlink_ctl.link[ tp->port_id] = 1;
 #endif
 		}
+#endif
 	}
 	//    value = mii_read(PHY_ADDR,0x05);
 
@@ -3863,6 +3297,7 @@ void gmac_get_phy_status(struct net_devi
 			}
 		}
 		status.bits.link = LINK_UP; /* link up */
+#ifdef VITESSE_G5SWITCH
 		if(Giga_switch==1)
 		{
 				wan_port_id = 1;
@@ -3874,6 +3309,7 @@ void gmac_get_phy_status(struct net_devi
 				storlink_ctl.link[ tp->port_id] = 1;
 #endif
 		}
+#endif
 		if ((ability & 0x20)==0x20)
 		{
 			if (tp->flow_control_enable == 0)
@@ -3914,6 +3350,7 @@ void gmac_get_phy_status(struct net_devi
 	else
 	{
 		status.bits.link = LINK_DOWN; /* link down */
+#ifdef VITESSE_G5SWITCH
 		if(Giga_switch == 1)
 		{
 				wan_port_id = 1;
@@ -3925,6 +3362,7 @@ void gmac_get_phy_status(struct net_devi
 				storlink_ctl.link[ tp->port_id] = 0;
 #endif
 		}
+#endif
 		if (tp->pre_phy_status == LINK_UP)
 		{
 			printk("GMAC-%d LINK_Down......\n",tp->port_id);
@@ -4298,86 +3736,102 @@ static void gmac_set_rx_mode(struct net_
 }
 
 #ifdef CONFIG_SL_NAPI
+
+static int gmax_rx(struct net_device *dev, int *budget)
+{
+	return 0;
+}
+
+static int gmac_tx(struct net_device *dev, int *budget)
+{
+	return 0;
+}
+
 /*----------------------------------------------------------------------
 * gmac_rx_poll
 *----------------------------------------------------------------------*/
 static int gmac_rx_poll(struct net_device *dev, int *budget)
 {
-	TOE_INFO_T			*toe;
-    GMAC_RXDESC_T   	*curr_desc;
-	struct sk_buff 		*skb;
-    DMA_RWPTR_T			rwptr;
-    unsigned int data32;
-	unsigned int 		pkt_size;
-	unsigned int        desc_count;
-	unsigned int        good_frame, chksum_status, rx_status;
-	int                 rx_pkts_num = 0;
-	int                 quota = min(dev->quota, *budget);
-	GMAC_INFO_T			*tp = (GMAC_INFO_T *)dev->priv;
-	unsigned int		status4;
-	volatile DMA_RWPTR_T	fq_rwptr;
-	// int					max_cnt = TOE_SW_FREEQ_DESC_NUM;//TOE_SW_FREEQ_DESC_NUM = 64
-	//unsigned long		rx_old_bytes;
+	TOE_INFO_T	*toe;
+	GMAC_RXDESC_T	*curr_desc;
+	struct sk_buff	*skb;
+	DMA_RWPTR_T	rwptr;
+	unsigned int	data32;
+	unsigned int	pkt_size;
+	unsigned int	desc_count;
+	unsigned int	good_frame, chksum_status, rx_status;
+	int		rx_pkts_num = 0;
+	int		quota = min(dev->quota, *budget);
+	GMAC_INFO_T	*tp = (GMAC_INFO_T *)dev->priv;
+	unsigned int	status1;
+	unsigned int	status4;
 	struct net_device_stats *isPtr = (struct net_device_stats *)&tp->ifStatics;
-	//unsigned long long	rx_time;
-
 
 	BUG_ON(rx_poll_enabled == 0);
-#if 1
-	if (do_again)
-	{
-			toe_gmac_fill_free_q();
-			status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
-			fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-			//printk("\n%s:: do_again toe_gmac_fill_free_q =======>status4=0x%x =====fq_rwptr =0x%8x======>JKJKJKJKJKJKJKJKJ \n", __func__,status4,fq_rwptr.bits32);
-			if (fq_rwptr.bits.wptr != fq_rwptr.bits.rptr)
-			{
-						//status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
-						do_again =0;
-						//netif_rx_complete(dev);
-						gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG, status4,	0x1);
-						fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-						rwptr.bits32 = readl(&tp->default_qhdr->word1);
-			}
-			else
-				return 1;
-	}
-#endif
-	rwptr.bits32 = readl(&tp->default_qhdr->word1);
-#if 0
-	if (rwptr.bits.rptr != tp->rx_rwptr.bits.rptr)
-	{
-		mac_stop_txdma((struct net_device *)tp->dev);
-		printk("Default Queue HW RD ptr (0x%x) != SW RD Ptr (0x%x)\n",
-				rwptr.bits32, tp->rx_rwptr.bits.rptr);
-		while(1);
-	}
-#endif
+
 	toe = (TOE_INFO_T *)&toe_private_data;
 
-	fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-	//printk("%s:---Before-------------->Default Queue HW RW ptr (0x%8x),   fq_rwptr =0x%8x \n",__func__,rwptr.bits32,fq_rwptr.bits32 );
-	//printk("%s:---Before while   rx_pkts_num=%d------rx_finished_idx=0x%x------->Default_Q [rwptr.bits.rptr(SW)=0x%x,   rwptr.bits.wptr(HW) = 0x%x ]---->Free_Q(SW_HW) = 0x%8x \n",__func__,rx_pkts_num,rx_finished_idx,rwptr.bits.rptr,rwptr.bits.wptr,fq_rwptr.bits32 );
-//	while ((--max_cnt) && (rwptr.bits.rptr != rwptr.bits.wptr) && (rx_pkts_num < quota))
+rx_poll_retry:
+	status1 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
+	if (status1 & 1) {
+		writel(1, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
+	}
 
+	rwptr.bits32 = readl(&tp->default_qhdr->word1);
 	while ((rwptr.bits.rptr != rwptr.bits.wptr) && (rx_pkts_num < quota))
 	{
-
-    	curr_desc = (GMAC_RXDESC_T *)tp->default_desc_base + rwptr.bits.rptr;
+		curr_desc = (GMAC_RXDESC_T *)tp->default_desc_base + rwptr.bits.rptr;
 		tp->default_q_cnt++;
-    	tp->rx_curr_desc = (unsigned int)curr_desc;
-    	rx_status = curr_desc->word0.bits.status;
-    	chksum_status = curr_desc->word0.bits.chksum_status;
-    	tp->rx_status_cnt[rx_status]++;
-    	tp->rx_chksum_cnt[chksum_status]++;
-        pkt_size = curr_desc->word1.bits.byte_count;  /*total byte count in a frame*/
+		tp->rx_curr_desc = (unsigned int)curr_desc;
+		rx_status = curr_desc->word0.bits.status;
+		chksum_status = curr_desc->word0.bits.chksum_status;
+		tp->rx_status_cnt[rx_status]++;
+		tp->rx_chksum_cnt[chksum_status]++;
+		pkt_size = curr_desc->word1.bits.byte_count;  /*total byte count in a frame*/
 		desc_count = curr_desc->word0.bits.desc_count; /* get descriptor count per frame */
 		good_frame=1;
+
+		if (0) {
+
+				int free, busy;
+				uint32_t rwptr1;
+				uint32_t rwptr2;
+
+				rwptr1 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
+				free = (GET_WPTR(rwptr1) - GET_RPTR(rwptr1)) & 0xFF;
+
+				rwptr2 = readl(&tp->default_qhdr->word1);
+				busy = (GET_RPTR(rwptr2) - GET_WPTR(rwptr2)) & 0xFF;
+
+				if (GET_WPTR(rwptr1) == GET_RPTR(rwptr1)) {
+					printk("frame  status: %d\n"
+					       "SWFQ: wptr: %hu, rptr: %hu, free: %d\n"
+					       "GMAC: wptr: %hu, rptr: %hu, free: %d\n",
+					       rx_status,
+					       GET_WPTR(rwptr1), GET_RPTR(rwptr1), free,
+					       GET_WPTR(rwptr2), GET_RPTR(rwptr2), busy);
+				}
+		}
+
+		{
+			GMAC_RXDESC_T	*fq_desc;
+			void *data;
+			struct sk_buff *skb;
+			unsigned short idx;
+
+			skb = (struct sk_buff *)(REG32(__va(curr_desc->word2.buf_adr) - SKB_RESERVE_BYTES));
+			idx = (unsigned short)(REG32(__va(curr_desc->word2.buf_adr) - SKB_RESERVE_BYTES + 4));
+
+			BUG_ON(idx > TOE_SW_FREEQ_DESC_NUM);
+			BUG_ON(skb == NULL);
+			fq_desc = (GMAC_RXDESC_T*)toe->swfq_desc_base + idx;
+			fq_desc->word2.buf_adr = 0;
+		}
+
 		if ((curr_desc->word0.bits32 & (GMAC_RXDESC_0_T_derr | GMAC_RXDESC_0_T_perr))
-			|| (pkt_size < 60)
+		    || (pkt_size < 60)
 		    || (chksum_status & 0x4)
 		    || rx_status )
-//			|| rx_status || (rwptr.bits.rptr > rwptr.bits.wptr ))
 		{
 			good_frame = 0;
 			if (curr_desc->word0.bits32 & GMAC_RXDESC_0_T_derr)
@@ -4388,7 +3842,6 @@ static int gmac_rx_poll(struct net_devic
 			{
 				if (rx_status == 4 || rx_status == 7)
 					isPtr->rx_crc_errors++;
-//				printk("%s::Status=%d (GMAC-%d)!!!\n", __func__, rx_status, tp->port_id);
 			}
 #ifdef SL351x_GMAC_WORKAROUND
 			else if (pkt_size < 60)
@@ -4407,17 +3860,32 @@ static int gmac_rx_poll(struct net_devic
 				}
 			}
 #endif
-//			if (chksum_status)
-//				printk("%s::Checksum Status=%d (GMAC-%d)!!!\n", __func__, chksum_status, tp->port_id);
 			skb = (struct sk_buff *)(REG32(__va(curr_desc->word2.buf_adr) - SKB_RESERVE_BYTES));
-			dev_kfree_skb_irq(skb);
+			dev_kfree_skb(skb);
+
+			if (0) {
+				int free, busy;
+				uint32_t rwptr1;
+				uint32_t rwptr2;
+
+				rwptr1 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
+				free = (GET_WPTR(rwptr1) - GET_RPTR(rwptr1)) & 0xFF;
+
+				rwptr2 = readl(&tp->default_qhdr->word1);
+				busy = (GET_RPTR(rwptr2) - GET_WPTR(rwptr2)) & 0xFF;
+
+				printk("frame  status: %d\n"
+				       "SWFQ: wptr: %hu, rptr: %hu, free: %d\n"
+				       "GMAC: wptr: %hu, rptr: %hu, free: %d\n",
+				       rx_status,
+				       GET_WPTR(rwptr1), GET_RPTR(rwptr1), free,
+				       GET_WPTR(rwptr2), GET_RPTR(rwptr2), busy);
+			}
 		}
 		if (good_frame)
 		{
 			if (curr_desc->word0.bits.drop)
 				printk("%s::Drop (GMAC-%d)!!!\n", __func__, tp->port_id);
-//			if (chksum_status)
-//				printk("%s::Checksum Status=%d (GMAC-%d)!!!\n", __func__, chksum_status, tp->port_id);
 
 #ifdef SL351x_GMAC_WORKAROUND
 			if (tp->short_frames_cnt >= GMAC_SHORT_FRAME_THRESHOLD)
@@ -4432,225 +3900,118 @@ static int gmac_rx_poll(struct net_devic
 			}
 			tp->short_frames_cnt = 0;
 #endif
-	    	/* get frame information from the first descriptor of the frame */
+			/* get frame information from the first descriptor of the frame */
 			isPtr->rx_packets++;
-			//consistent_sync((void *)__va(curr_desc->word2.buf_adr), pkt_size, PCI_DMA_FROMDEVICE);
+			consistent_sync((void *)__va(curr_desc->word2.buf_adr), pkt_size, PCI_DMA_FROMDEVICE);
 			skb = (struct sk_buff *)(REG32(__va(curr_desc->word2.buf_adr) - SKB_RESERVE_BYTES));
 			tp->curr_rx_skb = skb;
-	//		curr_desc->word2.buf_adr = 0;
 
-		    //skb_reserve (skb, SKB_RESERVE_BYTES);
 			skb_reserve (skb, RX_INSERT_BYTES);	/* 2 byte align the IP fields. */
-			//if ((skb->tail+pkt_size) > skb->end )
-			//printk("%s::------------->Here skb->len=%d,pkt_size= %d,skb->head=0x%x,skb->tail= 0x%x, skb->end= 0x%x\n", __func__, skb->len, pkt_size,skb->head,skb->tail,skb->end);
 			skb_put(skb, pkt_size);
 
-
 			skb->dev = dev;
 			if (chksum_status == RX_CHKSUM_IP_UDP_TCP_OK)
 			{
 				skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef CONFIG_SL351x_NAT
-				if (nat_cfg.enabled && curr_desc->word3.bits.l3_offset && curr_desc->word3.bits.l4_offset)
-				{
-					struct iphdr	*ip_hdr;
-					ip_hdr = (struct iphdr *)&(skb->data[curr_desc->word3.bits.l3_offset]);
-					sl351x_nat_input(skb,
-									tp->port_id,
-									(void *)curr_desc->word3.bits.l3_offset,
-								  	(void *)curr_desc->word3.bits.l4_offset);
-				}
-#endif
 				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
-#if 0
-#ifdef CONFIG_SL351x_RXTOE
-				if (storlink_ctl.rx_max_pktsize) {
-					struct iphdr	*ip_hdr;
-					struct tcphdr	*tcp_hdr;
-					int ip_hdrlen;
-
- 					ip_hdr = (struct iphdr*)&(skb->data[0]);
-					if ((skb->protocol == __constant_htons(ETH_P_IP)) &&
-					   ((ip_hdr->protocol & 0x00ff) == IPPROTO_TCP)) {
-						ip_hdrlen = ip_hdr->ihl << 2;
-						tcp_hdr = (struct tcphdr*)&(skb->data[ip_hdrlen]);
-						if (tcp_hdr->syn) {
-							struct toe_conn* connection = init_toeq(ip_hdr->version,
-									ip_hdr, tcp_hdr, toe, &(skb->data[0]) - 14);
-							TCP_SKB_CB(skb)->connection = connection;
-							//	hash_dump_entry(TCP_SKB_CB(skb)->connection->hash_entry_index);
-							//		printk("%s::skb data %x, conn %x, mode %x\n",
-							//			__func__, skb->data, connection, connection->mode);
-						}
-					}
-				}
-#endif
-#endif
 			}
 			else if (chksum_status == RX_CHKSUM_IP_OK_ONLY)
 			{
 				skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef CONFIG_SL351x_NAT
-				if (nat_cfg.enabled && curr_desc->word3.bits.l3_offset && curr_desc->word3.bits.l4_offset)
-				{
-					struct iphdr	*ip_hdr;
-					ip_hdr = (struct iphdr *)&(skb->data[curr_desc->word3.bits.l3_offset]);
-					if (ip_hdr->protocol == IPPROTO_UDP)
-					{
-						sl351x_nat_input(skb,
-										tp->port_id,
-										(void *)curr_desc->word3.bits.l3_offset,
-								  		(void *)curr_desc->word3.bits.l4_offset);
-					}
-					else if (ip_hdr->protocol == IPPROTO_GRE)
-					{
-						sl351x_nat_input(skb,
-									tp->port_id,
-									(void *)curr_desc->word3.bits.l3_offset,
-								  	(void *)curr_desc->word3.bits.l4_offset);
-					}
-				}
-#endif
 				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
 			}
 			else
 			{
 				skb->protocol = eth_type_trans(skb,dev); /* set skb protocol */
 			}
-			//netif_rx(skb);  /* socket rx */
+
 			netif_receive_skb(skb); //For NAPI
 			dev->last_rx = jiffies;
 
 			isPtr->rx_bytes += pkt_size;
-			//printk("------------------->isPtr->rx_bytes = %d\n",isPtr->rx_bytes);
-
+		}
 
-        }
 		// advance one for Rx default Q 0/1
 		rwptr.bits.rptr = RWPTR_ADVANCE_ONE(rwptr.bits.rptr, tp->default_desc_num);
 		SET_RPTR(&tp->default_qhdr->word1, rwptr.bits.rptr);
-     	tp->rx_rwptr.bits32 = rwptr.bits32;
+		tp->rx_rwptr.bits32 = rwptr.bits32;
 		rx_pkts_num++;
-		//rwptr.bits32 = readl(&tp->default_qhdr->word1);//try read default_qhdr again
-		//fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-		//printk("%s:---Loop  -------->rx_pkts_num=%d------------>Default Queue HW RW ptr = (0x%8x),   fq_rwptr =0x%8x \n",__func__,rx_pkts_num,rwptr.bits32,fq_rwptr.bits32 );
-#if 0
-		if ((status4 & 0x1) == 0)
-		{
-			//if (!((dev->last_rx <= (rx_time + 2)) &&  (isPtr->rx_bytes > (rx_old_bytes + 1000000 ))))
-			if (tp->total_q_cnt_napi < 1024)
-			{
-				tp->total_q_cnt_napi++;
-				toe_gmac_fill_free_q();  //for iperf test disable
-			}
-			//else
-				//printk("%s:---isPtr->rx_bytes =%u , rx_old_bytes =%u\n",__func__,isPtr->rx_bytes,rx_old_bytes );
+		// rwptr.bits32 = readl(&tp->default_qhdr->word1);
 
+		status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
+		if (status4 & 1) {
+			writel(status4 & SWFQ_EMPTY_INT_BIT, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
 		}
+
+		toe_gmac_fill_free_q(5);
+	}
+
+#if 0
+	/* avoid races with hard_start_xmit() */
+
+	spin_lock(&gmac_fq_lock);
+	toe_gmac_tx_complete(&toe_private_data.gmac[0], 0, dev, 1);
+	spin_unlock(&gmac_fq_lock);
 #endif
-		//rwptr.bits.rptr = RWPTR_ADVANCE_ONE(rwptr.bits.rptr, tp->default_desc_num);
-		//printk("%s:---Loop  -------->rx_pkts_num=%d----rwptr.bits.rptr=0x%x-------->Default Queue HW RW ptr = (0x%8x),   fq_rwptr =0x%8x \n",__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits32,fq_rwptr.bits32 );
-		//printk("%s:---Loop  rx_pkts_num=%d------rwptr.bits.rptr=0x%x------->Default_Q [rwptr.bits.rptr(SW)=0x%x,   rwptr.bits.wptr(HW) = 0x%x ]---->Free_Q(SW_HW) = 0x%8x \n",__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.rptr,rwptr.bits.wptr,fq_rwptr.bits32 );
+
+	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
+	if (status4 & 1)
+	{
+		writel(status4 & SWFQ_EMPTY_INT_BIT, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_STATUS_4_REG);
+		status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);
+		toe_gmac_fill_free_q(rx_pkts_num);
 	}
-	// advance one for Rx default Q 0/1
 
-		//rwptr.bits.rptr = RWPTR_ADVANCE_ONE(rwptr.bits.rptr, tp->default_desc_num);
-		//SET_RPTR(&tp->default_qhdr->word1, rwptr.bits.rptr);
-     	//tp->rx_rwptr.bits32 = rwptr.bits32;
-     	//rwptr.bits.rptr = rwptr.bits.rptr;
+	rwptr.bits32 = readl(&tp->default_qhdr->word1);
+	if (rwptr.bits.rptr != rwptr.bits.wptr &&
+	    quota > rx_pkts_num)
+		goto rx_poll_retry;
 
 	dev->quota -= rx_pkts_num;
 	*budget -= rx_pkts_num;
 
-	status4 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_4_REG);//try read SWFQ empty again
-	//fq_rwptr.bits32 = readl(TOE_GLOBAL_BASE + GLOBAL_SWFQ_RWPTR_REG);
-	rwptr.bits32 = readl(&tp->default_qhdr->word1); //try read default_qhdr again
-	//printk("%s:---After    rx_pkts_num=%d------rwptr.bits.rptr=0x%x------->Default_Q [rwptr.bits.rptr(SW)=0x%x,   rwptr.bits.wptr(HW) = 0x%x ]---->Free_Q(SW_HW) = 0x%8x \n",__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.rptr,rwptr.bits.wptr,fq_rwptr.bits32 );
-//	if (rwptr.bits.rptr > rwptr.bits.wptr )
-//			{
-				//toe_gmac_disable_rx(dev);
-				//wait_event_interruptible_timeout(freeq_wait,
-					//(rx_pkts_num == 100), CMTP_INTEROP_TIMEOUT);
-				//printk("\n%s:: return 22222=======> rx_pkts_num =%d,   rwptr.bits.rptr=%d,   rwptr.bits.wptr = %d ====---------=======>JKJKJKJKJK\n",
-					//__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.wptr);
-//				return 1;
-//			}
-
-	if (rwptr.bits.rptr == rwptr.bits.wptr)
+	/* Receive queue is empty now */
+	if (quota >= rx_pkts_num)
 	{
-		// unsigned int data32;
-			//printk("%s:---[rwptr.bits.rptr == rwptr.bits.wptr]   rx_pkts_num=%d------rwptr.bits.rptr=0x%x------->Default_Q [rwptr.bits.rptr(SW)=0x%x,   rwptr.bits.wptr(HW) = 0x%x ]---->Free_Q(SW_HW) = 0x%8x \n",__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.rptr,rwptr.bits.wptr,fq_rwptr.bits32 );
-
-	    /* Receive descriptor is empty now */
-#if 1
-     if (status4 & 0x1)
-   			{
-   				do_again =1;
-   				//writel(0x40400000, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_ENABLE_4_REG); //disable SWFQ empty interrupt
-   				//toe_gmac_disable_interrupt(tp->irq);
-   				tp->sw_fq_empty_cnt++;
-   				//toe_gmac_disable_rx(dev);
-   				writel(0x07960202, TOE_GMAC0_BASE+GMAC_CONFIG0);
-				writel(0x07960202, TOE_GMAC1_BASE+GMAC_CONFIG0);
-   				//printk("\n%s ::  freeq int-----tp->sw_fq_empty_cnt  =%d---------====================----------------->\n",__func__,tp->sw_fq_empty_cnt);
-   				//while ((fq_rwptr.bits.wptr >= (fq_rwptr.bits.rptr+256)) || (fq_rwptr.bits.wptr <= (fq_rwptr.bits.rptr+256)))
-   				//{
-   					//gmac_write_reg(TOE_GLOBAL_BASE, GLOBAL_INTERRUPT_STATUS_4_REG, status4,
-					//0x1);
-				//printk("\n%s::fq_rwptr.wrptr = %x =======> ===========>here \n", __func__,fq_rwptr.bits32);
-				//if ((status4 & 0x1) == 0)
-					//break;
-				 return 1;
-				//}
+		unsigned long flags;
 
+		netif_rx_complete(dev);
+		rx_poll_enabled = 0;
+#if 0
+		status1 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_STATUS_1_REG);
+		if (status1 & 1) {
+			if (netif_rx_reschedule(dev, rx_pkts_num)) {
+				rx_poll_enabled = 1;
+				return 1;
 			}
+		}
 #endif
-        //toe_gmac_fill_free_q();
-        netif_rx_complete(dev);
-
-		rx_poll_enabled = 0;
 
-		data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-		if (tp->port_id == 0)
-				data32 |= DEFAULT_Q0_INT_BIT;
-		else
-				data32 |= DEFAULT_Q1_INT_BIT;
-		writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
+		spin_lock_irqsave(&gmac_fq_lock, flags);
 
 		data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
 		if (tp->port_id == 0)
-				data32 |= DEFAULT_Q0_INT_BIT;
+			data32 |= DEFAULT_Q0_INT_BIT;
 		else
-				data32 |= DEFAULT_Q1_INT_BIT;
+			data32 |= DEFAULT_Q1_INT_BIT;
 		writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_4_REG);
 
-		data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
+		data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
 		if (tp->port_id == 0)
-				data32 |= DEFAULT_Q0_INT_BIT;
+			data32 |= DEFAULT_Q0_INT_BIT;
 		else
-				data32 |= DEFAULT_Q1_INT_BIT;
-		writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_SELECT_4_REG);
+			data32 |= DEFAULT_Q1_INT_BIT;
+		writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
 
-        // enable GMAC-0 rx interrupt
-        // class-Q & TOE-Q are implemented in future
-        //data32 = readl(TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-        //if (tp->port_id == 0)
-        	//data32 |= DEFAULT_Q0_INT_BIT;
-        //else
-        	//data32 |= DEFAULT_Q1_INT_BIT;
-        //writel(data32, TOE_GLOBAL_BASE + GLOBAL_INTERRUPT_ENABLE_1_REG);
-		writel(0x3, TOE_GLOBAL_BASE+GLOBAL_INTERRUPT_ENABLE_1_REG);
-		//printk("\n%s::netif_rx_complete-->  rx_pkts_num =%d,   rwptr.bits.rptr=0x%x,   rwptr.bits.wptr = 0x%x ====---------=======>JKJKJKJKJK\n",
-		//__func__,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.wptr);
-        writel(0x07960200, TOE_GMAC0_BASE+GMAC_CONFIG0);
-		writel(0x07960200, TOE_GMAC1_BASE+GMAC_CONFIG0);
-        return 0;
-    }
-    else
-    {
-        //printk("\n%s:: return 1 -->status4= 0x%x,rx_pkts_num =%d,   rwptr.bits.rptr=0x%x,   rwptr.bits.wptr = 0x%x  ======> \n", __func__,status4,rx_pkts_num,rwptr.bits.rptr,rwptr.bits.wptr);
-        return 1;
-    }
+		spin_unlock_irqrestore(&gmac_fq_lock, flags);
+
+		return 0;
+	}
+	else
+	{
+		/* not done, will call ->poll() later. */
+		return 1;
+	}
 }
 #endif
 
@@ -5114,6 +4475,7 @@ void sl351x_poll_gmac_hanged_status(u32 
 			{
 				sl351x_nat_workaround_cnt++;
 				sl351x_nat_workaround_handler();
+				printk("%():%d - workaround\n", __func__, __LINE__);
 			}
 #endif
 #endif
@@ -5124,6 +4486,7 @@ void sl351x_poll_gmac_hanged_status(u32 
 	}
 
 do_workaround:
+	printk("doing workaround ?!\n");
 
 	gmac_initialized = 0;
 	if (hanged_state)
@@ -5290,6 +4653,7 @@ static void sl351x_gmac_release_swtx_q(v
 	GMAC_SWTXQ_T	*swtxq;
 	DMA_RWPTR_T		rwptr;
 
+	printk("**** %s():%d\n", __func__, __LINE__);
 	toe = (TOE_INFO_T *)&toe_private_data;
 	tp = (GMAC_INFO_T *)&toe->gmac[0];
 	for (i=0; i<GMAC_NUM; i++, tp++)
@@ -5341,6 +4705,7 @@ static void sl351x_gmac_release_rx_q(voi
 	volatile GMAC_RXDESC_T	*curr_desc;
 	struct sk_buff			*skb;
 
+	printk("**** %s():%d\n", __func__, __LINE__);
 	toe = (TOE_INFO_T *)&toe_private_data;
 	tp = (GMAC_INFO_T *)&toe->gmac[0];
 	for (i=0; i<GMAC_NUM; i++, tp++)
@@ -5374,6 +4739,7 @@ static void sl351x_gmac_release_class_q(
 	volatile GMAC_RXDESC_T	*curr_desc;
 	struct sk_buff			*skb;
 
+	printk("**** %s():%d\n", __func__, __LINE__);
 	toe = (TOE_INFO_T *)&toe_private_data;
 	classq = (CLASSQ_INFO_T *)&toe->classq[0];
 	for (i=0; i<TOE_CLASS_QUEUE_NUM; i++, classq++)
@@ -5410,6 +4776,7 @@ static void sl351x_gmac_release_toe_q(vo
 	GMAC_RXDESC_T	*toe_curr_desc;
 	struct sk_buff			*skb;
 
+	printk("**** %s():%d\n", __func__, __LINE__);
 	toe = (TOE_INFO_T *)&toe_private_data;
 	toe_qhdr = (TOE_QHDR_T *)TOE_TOE_QUE_HDR_BASE;
 	for (i=0; i<TOE_TOE_QUEUE_NUM; i++, toe_qhdr++)
Index: linux-2.6.23.17/include/asm-arm/arch-sl2312/sl351x_gmac.h
===================================================================
--- linux-2.6.23.17.orig/include/asm-arm/arch-sl2312/sl351x_gmac.h
+++ linux-2.6.23.17/include/asm-arm/arch-sl2312/sl351x_gmac.h
@@ -107,7 +107,7 @@
  * The base address and descriptor number are configured at
  * DMA Queues Descriptor Ring Base Address/Size Register (offset 0x0004)
  **********************************************************************/
-#define TOE_SW_FREEQ_DESC_POWER		10
+#define TOE_SW_FREEQ_DESC_POWER		8
 #define TOE_SW_FREEQ_DESC_NUM		(1<<TOE_SW_FREEQ_DESC_POWER)
 #define TOE_HW_FREEQ_DESC_POWER		8
 #define TOE_HW_FREEQ_DESC_NUM		(1<<TOE_HW_FREEQ_DESC_POWER)
@@ -123,12 +123,12 @@
 #define TOE_DEFAULT_Q0_DESC_NUM		(1<<TOE_DEFAULT_Q0_DESC_POWER)
 #define TOE_DEFAULT_Q1_DESC_POWER	8
 #define TOE_DEFAULT_Q1_DESC_NUM		(1<<TOE_DEFAULT_Q1_DESC_POWER)
-#define TOE_TOE_DESC_POWER			8
-#define TOE_TOE_DESC_NUM			(1<<TOE_TOE_DESC_POWER)
+#define TOE_TOE_DESC_POWER		8
+#define TOE_TOE_DESC_NUM		(1<<TOE_TOE_DESC_POWER)
 #define TOE_CLASS_DESC_POWER		8
-#define TOE_CLASS_DESC_NUM			(1<<TOE_CLASS_DESC_POWER)
-#define TOE_INTR_DESC_POWER			8
-#define TOE_INTR_DESC_NUM			(1<<TOE_INTR_DESC_POWER)
+#define TOE_CLASS_DESC_NUM		(1<<TOE_CLASS_DESC_POWER)
+#define TOE_INTR_DESC_POWER		8
+#define TOE_INTR_DESC_NUM		(1<<TOE_INTR_DESC_POWER)
 
 #define TOE_TOE_QUEUE_MAX			64
 #define TOE_TOE_QUEUE_NUM			64