Переглянути джерело

[realtek] Use explicit value for TCR.MXDMA

Some RTL8169 cards (observed with an RTL8169SC) power up with
TCR.MXDMA set to 16 bytes.  While this does not prevent proper
operation, it almost certainly degrades performance.

Fix by explicitly setting TCR.MXDMA to "unlimited".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 роки тому
джерело
коміт
77afdc5643
2 змінених файлів з 13 додано та 0 видалено
  1. 7
    0
      src/drivers/net/realtek.c
  2. 6
    0
      src/drivers/net/realtek.h

+ 7
- 0
src/drivers/net/realtek.c Переглянути файл

@@ -500,6 +500,7 @@ static void realtek_refill_rx ( struct realtek_nic *rtl ) {
500 500
  */
501 501
 static int realtek_open ( struct net_device *netdev ) {
502 502
 	struct realtek_nic *rtl = netdev->priv;
503
+	uint32_t tcr;
503 504
 	uint32_t rcr;
504 505
 	int rc;
505 506
 
@@ -524,6 +525,12 @@ static int realtek_open ( struct net_device *netdev ) {
524 525
 	 */
525 526
 	writeb ( ( RTL_CR_TE | RTL_CR_RE ), rtl->regs + RTL_CR );
526 527
 
528
+	/* Configure transmitter */
529
+	tcr = readl ( rtl->regs + RTL_TCR );
530
+	tcr &= ~RTL_TCR_MXDMA_MASK;
531
+	tcr |= RTL_TCR_MXDMA_DEFAULT;
532
+	writel ( tcr, rtl->regs + RTL_TCR );
533
+
527 534
 	/* Configure receiver */
528 535
 	rcr = readl ( rtl->regs + RTL_RCR );
529 536
 	rcr &= ~( RTL_RCR_RXFTH_MASK | RTL_RCR_RBLEN_MASK |

+ 6
- 0
src/drivers/net/realtek.h Переглянути файл

@@ -132,6 +132,12 @@ enum realtek_legacy_status {
132 132
 /** Interrupt Status Register (word) */
133 133
 #define RTL_ISR 0x3e
134 134
 
135
+/** Transmit (Tx) Configuration Register (dword) */
136
+#define RTL_TCR 0x40
137
+#define RTL_TCR_MXDMA(x)	( (x) << 8 ) /**< Max DMA burst size */
138
+#define RTL_TCR_MXDMA_MASK	RTL_TCR_MXDMA ( 0x7 )
139
+#define RTL_TCR_MXDMA_DEFAULT	RTL_TCR_MXDMA ( 0x7 /* Unlimited */ )
140
+
135 141
 /** Receive (Rx) Configuration Register (dword) */
136 142
 #define RTL_RCR 0x44
137 143
 #define RTL_RCR_RXFTH(x)	( (x) << 13 ) /**< Receive FIFO threshold */

Завантаження…
Відмінити
Зберегти