Quellcode durchsuchen

Fixed receive instability by not enabling interrupts. duh.

I have successfully booted DOS via iSCSI and PXELINUX via TFTP with this
version of the e1000 driver.
tags/v0.9.3
Marty Connor vor 17 Jahren
Ursprung
Commit
2d60a3963f
2 geänderte Dateien mit 27 neuen und 19 gelöschten Zeilen
  1. 24
    19
      src/drivers/net/e1000/e1000.c
  2. 3
    0
      src/drivers/net/e1000/e1000.h

+ 24
- 19
src/drivers/net/e1000/e1000.c Datei anzeigen

@@ -130,10 +130,11 @@ e1000_sw_init ( struct e1000_adapter *adapter )
130 130
 	adapter->rx_int_delay = 0;
131 131
 	adapter->rx_abs_int_delay = 0;
132 132
 
133
-	adapter->rx_buffer_len =  1600;
134
-	adapter->rx_ps_bsize0 = E1000_RXBUFFER_128;
135
-	hw->max_frame_size =  1600;
136
-	hw->min_frame_size = ETH_ZLEN;
133
+        adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
134
+        adapter->rx_ps_bsize0 = E1000_RXBUFFER_128;
135
+        hw->max_frame_size = MAXIMUM_ETHERNET_VLAN_SIZE +
136
+		ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
137
+        hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
137 138
 
138 139
 	/* identify the MAC */
139 140
 
@@ -170,7 +171,6 @@ e1000_sw_init ( struct e1000_adapter *adapter )
170 171
 		hw->master_slave = E1000_MASTER_SLAVE;
171 172
 	}
172 173
 
173
-	/* Explicitly disable IRQ since the NIC can be in any state. */
174 174
 	e1000_irq_disable ( adapter );
175 175
 
176 176
 	return 0;
@@ -370,7 +370,7 @@ e1000_setup_rx_resources ( struct e1000_adapter *adapter )
370 370
 
371 371
 	for ( i = 0; i < NUM_RX_DESC; i++ ) {
372 372
 	
373
-		adapter->rx_iobuf[i] = alloc_iob ( 1600 );
373
+		adapter->rx_iobuf[i] = alloc_iob ( MAXIMUM_ETHERNET_VLAN_SIZE );
374 374
 		
375 375
 		/* If unable to allocate all iobufs, free any that
376 376
 		 * were successfully allocated, and return an error 
@@ -386,6 +386,7 @@ e1000_setup_rx_resources ( struct e1000_adapter *adapter )
386 386
 					  ( i * sizeof ( *adapter->rx_base ) ); 
387 387
 			
388 388
 		rx_curr_desc->buffer_addr = virt_to_bus ( adapter->rx_iobuf[i]->data );	
389
+
389 390
 		DBG ( "i = %d  rx_curr_desc->buffer_addr = %#16llx\n", 
390 391
 		      i, rx_curr_desc->buffer_addr );
391 392
 		
@@ -571,22 +572,23 @@ static void
571 572
 e1000_close ( struct net_device *netdev )
572 573
 {
573 574
 	struct e1000_adapter *adapter = netdev_priv ( netdev );
575
+	struct e1000_hw *hw = &adapter->hw;
574 576
 	uint32_t rctl;
575 577
 	uint32_t icr;
576 578
 
577 579
 	DBG ( "e1000_close\n" );
578 580
 	
579
-	/* disable receives */
580
-	rctl = E1000_READ_REG ( &adapter->hw, RCTL );
581
-	E1000_WRITE_REG ( &adapter->hw, RCTL, rctl & ~E1000_RCTL_EN );
582
-	E1000_WRITE_FLUSH ( &adapter->hw );
583
-
584 581
 	/* Acknowledge interrupts */
585
-	icr = E1000_READ_REG ( &adapter->hw, ICR );
582
+	icr = E1000_READ_REG ( hw, ICR );
586 583
 
587 584
 	e1000_irq_disable ( adapter );
588 585
 
589
-	e1000_reset_hw ( &adapter->hw );
586
+	/* disable receives */
587
+	rctl = E1000_READ_REG ( hw, RCTL );
588
+	E1000_WRITE_REG ( hw, RCTL, rctl & ~E1000_RCTL_EN );
589
+	E1000_WRITE_FLUSH ( hw );
590
+
591
+	e1000_reset_hw ( hw );
590 592
 
591 593
 	e1000_free_tx_resources ( adapter );
592 594
 	e1000_free_rx_resources ( adapter );
@@ -678,6 +680,7 @@ e1000_poll ( struct net_device *netdev )
678 680
 	struct e1000_tx_desc *tx_curr_desc;
679 681
 	struct e1000_rx_desc *rx_curr_desc;
680 682
 	uint32_t i;
683
+	uint64_t tmp_buffer_addr;
681 684
 	
682 685
 #if 0
683 686
 	DBG ( "e1000_poll\n" );
@@ -776,9 +779,9 @@ e1000_poll ( struct net_device *netdev )
776 779
 			netdev_rx ( netdev, rx_iob );
777 780
 		}
778 781
 
782
+		tmp_buffer_addr = rx_curr_desc->buffer_addr;
779 783
 		memset ( rx_curr_desc, 0, sizeof ( *rx_curr_desc ) );
780
-
781
-		rx_curr_desc->buffer_addr = virt_to_bus ( adapter->rx_iobuf[adapter->rx_tail]->data );
784
+		rx_curr_desc->buffer_addr = tmp_buffer_addr;
782 785
 
783 786
 		E1000_WRITE_REG ( hw, RDT, adapter->rx_tail );
784 787
 
@@ -876,7 +879,6 @@ e1000_probe ( struct pci_device *pdev,
876 879
 	err = -EIO;
877 880
 
878 881
 	adapter->hw.hw_addr = ioremap ( mmio_start, mmio_len );
879
-	
880 882
 	DBG ( "adapter->hw.hw_addr: %p\n", adapter->hw.hw_addr );
881 883
 	
882 884
 	if ( ! adapter->hw.hw_addr )
@@ -989,6 +991,11 @@ e1000_remove ( struct pci_device *pdev )
989 991
 	
990 992
 	DBG ( "e1000_remove\n" );
991 993
 
994
+	if ( adapter->hw.flash_address )
995
+		iounmap ( adapter->hw.flash_address );
996
+	if  ( adapter->hw.hw_addr )
997
+		iounmap ( adapter->hw.hw_addr );
998
+
992 999
 	unregister_netdev ( netdev );
993 1000
 	e1000_reset_hw ( &adapter->hw );
994 1001
 	netdev_nullify ( netdev );
@@ -1030,8 +1037,6 @@ e1000_open ( struct net_device *netdev )
1030 1037
 	
1031 1038
         DBG ( "RXDCTL: %#08lx\n",  E1000_READ_REG ( &adapter->hw, RXDCTL ) );
1032 1039
 
1033
-	e1000_irq_enable ( adapter );
1034
-
1035 1040
 	return 0;
1036 1041
 
1037 1042
 err_setup_rx:
@@ -1064,7 +1069,7 @@ e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
1064 1069
 
1065 1070
     pci_read_config_word(adapter->pdev, cap_offset + reg, value);
1066 1071
 
1067
-    return E1000_SUCCESS;
1072
+    return 0;
1068 1073
 }
1069 1074
 
1070 1075
 void

+ 3
- 0
src/drivers/net/e1000/e1000.h Datei anzeigen

@@ -78,6 +78,9 @@ struct e1000_adapter;
78 78
 
79 79
 #define E1000_FC_PAUSE_TIME 0x0680 /* 858 usec */
80 80
 
81
+/* this is the size past which hardware will drop packets when setting LPE=0 */
82
+#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
83
+
81 84
 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
82 85
 #define E1000_TX_QUEUE_WAKE	16
83 86
 /* How many Rx Buffers do we bundle into one write to the hardware ? */

Laden…
Abbrechen
Speichern