MFC r197566
Increase the rx buffer size to 16384 bytes, this increases RX performance from 50Mbps to 220Mbps on PLANEX GU-1000T.
This commit is contained in:
parent
c21bee0c36
commit
381882bf15
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=198651
@ -205,10 +205,7 @@ static const struct usb_config axe_config[AXE_N_TRANSFER] = {
|
|||||||
.type = UE_BULK,
|
.type = UE_BULK,
|
||||||
.endpoint = UE_ADDR_ANY,
|
.endpoint = UE_ADDR_ANY,
|
||||||
.direction = UE_DIR_IN,
|
.direction = UE_DIR_IN,
|
||||||
#if (MCLBYTES < 2048)
|
.bufsize = 16384, /* bytes */
|
||||||
#error "(MCLBYTES < 2048)"
|
|
||||||
#endif
|
|
||||||
.bufsize = MCLBYTES,
|
|
||||||
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
|
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
|
||||||
.callback = axe_bulk_read_callback,
|
.callback = axe_bulk_read_callback,
|
||||||
.timeout = 0, /* no timeout */
|
.timeout = 0, /* no timeout */
|
||||||
@ -777,7 +774,7 @@ axe_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
|||||||
struct ifnet *ifp = uether_getifp(ue);
|
struct ifnet *ifp = uether_getifp(ue);
|
||||||
struct axe_sframe_hdr hdr;
|
struct axe_sframe_hdr hdr;
|
||||||
struct usb_page_cache *pc;
|
struct usb_page_cache *pc;
|
||||||
int err, pos, len, adjust;
|
int err, pos, len;
|
||||||
int actlen;
|
int actlen;
|
||||||
|
|
||||||
usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
|
usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
|
||||||
@ -785,50 +782,42 @@ axe_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
|||||||
switch (USB_GET_STATE(xfer)) {
|
switch (USB_GET_STATE(xfer)) {
|
||||||
case USB_ST_TRANSFERRED:
|
case USB_ST_TRANSFERRED:
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
len = 0;
|
||||||
|
err = 0;
|
||||||
|
|
||||||
pc = usbd_xfer_get_frame(xfer, 0);
|
pc = usbd_xfer_get_frame(xfer, 0);
|
||||||
while (1) {
|
if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
|
||||||
if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
|
while (pos < actlen) {
|
||||||
if (actlen < sizeof(hdr)) {
|
if ((pos + sizeof(hdr)) > actlen) {
|
||||||
/* too little data */
|
/* too little data */
|
||||||
|
err = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usbd_copy_out(pc, pos, &hdr, sizeof(hdr));
|
usbd_copy_out(pc, pos, &hdr, sizeof(hdr));
|
||||||
|
|
||||||
if ((hdr.len ^ hdr.ilen) != 0xFFFF) {
|
if ((hdr.len ^ hdr.ilen) != 0xFFFF) {
|
||||||
/* we lost sync */
|
/* we lost sync */
|
||||||
|
err = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
actlen -= sizeof(hdr);
|
|
||||||
pos += sizeof(hdr);
|
pos += sizeof(hdr);
|
||||||
|
|
||||||
len = le16toh(hdr.len);
|
len = le16toh(hdr.len);
|
||||||
if (len > actlen) {
|
if ((pos + len) > actlen) {
|
||||||
/* invalid length */
|
/* invalid length */
|
||||||
|
err = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
adjust = (len & 1);
|
err = uether_rxbuf(ue, pc, pos, len);
|
||||||
|
|
||||||
} else {
|
pos += len + (len % 2);
|
||||||
len = actlen;
|
|
||||||
adjust = 0;
|
|
||||||
}
|
}
|
||||||
err = uether_rxbuf(ue, pc, pos, len);
|
} else {
|
||||||
if (err)
|
err = uether_rxbuf(ue, pc, 0, actlen);
|
||||||
break;
|
|
||||||
|
|
||||||
pos += len;
|
|
||||||
actlen -= len;
|
|
||||||
|
|
||||||
if (actlen <= adjust) {
|
|
||||||
/* we are finished */
|
|
||||||
goto tr_setup;
|
|
||||||
}
|
|
||||||
pos += adjust;
|
|
||||||
actlen -= adjust;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count an error */
|
if (err != 0)
|
||||||
ifp->if_ierrors++;
|
ifp->if_ierrors++;
|
||||||
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case USB_ST_SETUP:
|
case USB_ST_SETUP:
|
||||||
@ -1011,7 +1000,15 @@ axe_init(struct usb_ether *ue)
|
|||||||
/* Enable receiver, set RX mode */
|
/* Enable receiver, set RX mode */
|
||||||
rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
|
rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
|
||||||
if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
|
if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
|
||||||
|
#if 0
|
||||||
rxmode |= AXE_178_RXCMD_MFB_2048; /* chip default */
|
rxmode |= AXE_178_RXCMD_MFB_2048; /* chip default */
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Default Rx buffer size is too small to get
|
||||||
|
* maximum performance.
|
||||||
|
*/
|
||||||
|
rxmode |= AXE_178_RXCMD_MFB_16384;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
rxmode |= AXE_172_RXCMD_UNICAST;
|
rxmode |= AXE_172_RXCMD_UNICAST;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user