improve the performance by using the "wrap modus"
=> http://wiki.osdev.org/RTL8139
This commit is contained in:
parent
e5ac848901
commit
e0e3a4fd82
1 changed files with 6 additions and 7 deletions
|
@ -170,12 +170,11 @@ static void rtl_rx_inthandler(struct netif* netif)
|
||||||
#if ETH_PAD_SIZE
|
#if ETH_PAD_SIZE
|
||||||
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
||||||
#endif
|
#endif
|
||||||
for (q=p; q!=NULL; q=q->next) {
|
for (q=p, i=0; q!=NULL; q=q->next) {
|
||||||
for(i=0; i<q->len; i++) {
|
memcpy((uint8_t*) q->payload + i, rtl8139if->rx_buffer + rtl8139if->rx_pos + i, q->len);
|
||||||
((uint8_t*) q->payload)[i] = rtl8139if->rx_buffer[rtl8139if->rx_pos];
|
i += q->len;
|
||||||
rtl8139if->rx_pos = (rtl8139if->rx_pos + 1) % RX_BUF_LEN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
rtl8139if->rx_pos = (rtl8139if->rx_pos + p->tot_len) % RX_BUF_LEN;
|
||||||
#if ETH_PAD_SIZE
|
#if ETH_PAD_SIZE
|
||||||
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
|
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,7 +289,7 @@ err_t rtl8139if_init(struct netif* netif)
|
||||||
memset(rtl8139if, 0, sizeof(rtl1839if_t));
|
memset(rtl8139if, 0, sizeof(rtl1839if_t));
|
||||||
|
|
||||||
/* allocate the receive buffer */
|
/* allocate the receive buffer */
|
||||||
rtl8139if->rx_buffer = mem_allocation(RX_BUF_LEN/*+16*/, MAP_KERNEL_SPACE|MAP_NO_CACHE);
|
rtl8139if->rx_buffer = mem_allocation(RX_BUF_LEN + 1500 /*MTU*/ + 16 /* header size */, MAP_KERNEL_SPACE|MAP_NO_CACHE);
|
||||||
if (!(rtl8139if->rx_buffer)) {
|
if (!(rtl8139if->rx_buffer)) {
|
||||||
LWIP_DEBUGF(NETIF_DEBUG, ("rtl8139if_init: out of memory\n"));
|
LWIP_DEBUGF(NETIF_DEBUG, ("rtl8139if_init: out of memory\n"));
|
||||||
kfree(rtl8139if, sizeof(rtl1839if_t));
|
kfree(rtl8139if, sizeof(rtl1839if_t));
|
||||||
|
@ -388,7 +387,7 @@ err_t rtl8139if_init(struct netif* netif)
|
||||||
* APM - Accept Physical Match: Accept packets send to NIC's MAC address.
|
* APM - Accept Physical Match: Accept packets send to NIC's MAC address.
|
||||||
* AAP - Accept All Packets. Accept all packets (run in promiscuous mode).
|
* AAP - Accept All Packets. Accept all packets (run in promiscuous mode).
|
||||||
*/
|
*/
|
||||||
outportl(rtl8139if->iobase + RCR, RCR_MXDMA2|RCR_MXDMA1|RCR_MXDMA0|RCR_AB|RCR_AM|RCR_APM|RCR_AAP); // The WRAP bit isn't set
|
outportl(rtl8139if->iobase + RCR, RCR_MXDMA2|RCR_MXDMA1|RCR_WRAP|RCR_MXDMA0|RCR_AB|RCR_AM|RCR_APM|RCR_AAP); // The WRAP bit is set!
|
||||||
|
|
||||||
// set the transmit config register to
|
// set the transmit config register to
|
||||||
// be the normal interframe gap time
|
// be the normal interframe gap time
|
||||||
|
|
Loading…
Add table
Reference in a new issue