Quellcode durchsuchen

Forward-port event queue fixes from 5.4 tree.

tags/v0.9.3
Michael Brown vor 18 Jahren
Ursprung
Commit
e5865e796b
1 geänderte Dateien mit 27 neuen und 0 gelöschten Zeilen
  1. 27
    0
      src/drivers/net/etherfabric.c

+ 27
- 0
src/drivers/net/etherfabric.c Datei anzeigen

@@ -746,6 +746,12 @@ static int mentormac_mdio_read ( struct efab_nic *efab, int phy_id,
746 746
 #define EF1_TX_ENGINE_EN_WIDTH 1
747 747
 #define EF1_RX_ENGINE_EN_LBN 18
748 748
 #define EF1_RX_ENGINE_EN_WIDTH 1
749
+#define EF1_TURBO2_LBN 17
750
+#define EF1_TURBO2_WIDTH 1
751
+#define EF1_TURBO1_LBN 16
752
+#define EF1_TURBO1_WIDTH 1
753
+#define EF1_TURBO3_LBN 14
754
+#define EF1_TURBO3_WIDTH 1
749 755
 #define EF1_LB_RESET_LBN 3
750 756
 #define EF1_LB_RESET_WIDTH 1
751 757
 #define EF1_MAC_RESET_LBN 2
@@ -900,6 +906,7 @@ static int mentormac_mdio_read ( struct efab_nic *efab, int phy_id,
900 906
 #define EF1_EV_CODE_WIDTH 8
901 907
 #define EF1_RX_EV_DECODE 0x01
902 908
 #define EF1_TX_EV_DECODE 0x02
909
+#define EF1_TIMER_EV_DECODE 0x0b
903 910
 #define EF1_DRV_GEN_EV_DECODE 0x0f
904 911
 
905 912
 /* Receive events */
@@ -1097,6 +1104,9 @@ static int ef1002_init_nic ( struct efab_nic *efab ) {
1097 1104
 	EFAB_SET_DWORD_FIELD ( reg, EF1_MASTER_EVENTS, 0 );
1098 1105
 	EFAB_SET_DWORD_FIELD ( reg, EF1_TX_ENGINE_EN, 0 );
1099 1106
 	EFAB_SET_DWORD_FIELD ( reg, EF1_RX_ENGINE_EN, 0 );
1107
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO2, 1 );
1108
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO1, 1 );
1109
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO3, 1 );
1100 1110
 	EFAB_SET_DWORD_FIELD ( reg, EF1_CAM_ENABLE, 1 );
1101 1111
 	ef1002_writel ( efab, &reg, EF1_CTR_GEN_STATUS0_REG );
1102 1112
 	udelay ( 1000 );
@@ -1184,6 +1194,7 @@ static void ef1002_build_rx_desc ( struct efab_nic *efab,
1184 1194
 				EF1_RX_KER_BUF_ADR,
1185 1195
 				virt_to_bus ( rx_buf->addr ) );
1186 1196
 	ef1002_writel ( efab, &rxd.dword[0], EF1_RX_DESC_FIFO + 0 );
1197
+	wmb();
1187 1198
 	ef1002_writel ( efab, &rxd.dword[1], EF1_RX_DESC_FIFO + 4 );
1188 1199
 	udelay ( 10 );
1189 1200
 }
@@ -1219,6 +1230,7 @@ static void ef1002_build_tx_desc ( struct efab_nic *efab,
1219 1230
 
1220 1231
 	ef1002_writel ( efab, &txd.dword[0], EF1_TX_DESC_FIFO + 0 );
1221 1232
 	ef1002_writel ( efab, &txd.dword[1], EF1_TX_DESC_FIFO + 4 );
1233
+	wmb();
1222 1234
 	ef1002_writel ( efab, &txd.dword[2], EF1_TX_DESC_FIFO + 8 );
1223 1235
 	udelay ( 10 );
1224 1236
 }
@@ -1266,6 +1278,13 @@ static int ef1002_fetch_event ( struct efab_nic *efab,
1266 1278
 		/* RX len not available via event FIFO */
1267 1279
 		event->rx_len = ETH_FRAME_LEN;
1268 1280
 		break;
1281
+	case EF1_TIMER_EV_DECODE:
1282
+		/* These are safe to ignore.  We seem to get some at
1283
+		 * start of day, presumably due to the timers starting
1284
+		 * up with random contents.
1285
+		 */
1286
+		event->type = EFAB_EV_NONE;
1287
+		break;
1269 1288
 	default:
1270 1289
 		printf ( "Unknown event type %d data %08lx\n", ev_code,
1271 1290
 			 EFAB_DWORD_FIELD ( reg, EFAB_DWORD_0 ) );
@@ -2717,6 +2736,14 @@ static int etherfabric_poll ( struct nic *nic, int retrieve ) {
2717 2736
 	if ( ! retrieve )
2718 2737
 		return 1;
2719 2738
 
2739
+	/* There seems to be a hardware race.  The event can show up
2740
+	 * on the event FIFO before the DMA has completed, so we
2741
+	 * insert a tiny delay.  If this proves unreliable, we should
2742
+	 * switch to using event DMA rather than the event FIFO, since
2743
+	 * event DMA ordering is guaranteed.
2744
+	 */
2745
+	udelay ( 1 );
2746
+
2720 2747
 	/* Copy packet contents */
2721 2748
 	nic->packetlen = rx_buf->len;
2722 2749
 	memcpy ( nic->packet, rx_buf->addr, nic->packetlen );

Laden…
Abbrechen
Speichern