diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-10-31 14:18:10 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-10-31 14:18:10 +0000 |
commit | ee63d8994f6d765c04d47f8aaabbcabaed8924c3 (patch) | |
tree | 918a5e36bb68f2f21142b9618e3b089623aead4c /sys | |
parent | 6b155933eab379240dd231f1a6c4af2703afd822 (diff) |
Increase max frame size and hard MTU so that we can use VLANs and
Jumbo frames on ure(4).
ok kevlo@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_ure.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_urereg.h | 9 |
2 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c index b6c6c99ef34..4f37a7a9409 100644 --- a/sys/dev/usb/if_ure.c +++ b/sys/dev/usb/if_ure.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ure.c,v 1.8 2017/07/20 08:30:34 mpi Exp $ */ +/* $OpenBSD: if_ure.c,v 1.9 2018/10/31 14:18:09 patrick Exp $ */ /*- * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> * All rights reserved. @@ -695,6 +695,9 @@ ure_rtl8152_init(struct ure_softc *sc) ure_init_fifo(sc); + /* Set allowed frame size. */ + ure_write_2(sc, URE_PLA_RMS, URE_MCU_TYPE_PLA, URE_MAX_FRAMELEN_8152); + ure_write_1(sc, URE_USB_TX_AGG, URE_MCU_TYPE_USB, URE_TX_AGG_MAX_THRESHOLD); ure_write_4(sc, URE_USB_RX_BUF_TH, URE_MCU_TYPE_USB, URE_RX_THR_HIGH); @@ -835,6 +838,10 @@ ure_rtl8153_init(struct ure_softc *sc) ure_init_fifo(sc); + /* Set allowed frame size. */ + ure_write_2(sc, URE_PLA_RMS, URE_MCU_TYPE_PLA, URE_MAX_FRAMELEN_8153); + ure_write_2(sc, URE_PLA_MTPS, URE_MCU_TYPE_PLA, URE_MTPS_JUMBO); + /* Enable Rx aggregation. */ ure_write_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, ure_read_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB) & @@ -1147,6 +1154,12 @@ ure_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = ure_start; ifp->if_capabilities = 0; + if (sc->ure_flags & URE_FLAG_8152) + ifp->if_hardmtu = URE_MAX_FRAMELEN_8152; + else + ifp->if_hardmtu = URE_MAX_FRAMELEN_8153; + ifp->if_hardmtu -= (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + mii = &sc->ure_mii; mii->mii_ifp = ifp; mii->mii_readreg = ure_miibus_readreg; diff --git a/sys/dev/usb/if_urereg.h b/sys/dev/usb/if_urereg.h index 2260ec37890..020b3004e92 100644 --- a/sys/dev/usb/if_urereg.h +++ b/sys/dev/usb/if_urereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urereg.h,v 1.3 2017/03/11 13:40:46 kettenis Exp $ */ +/* $OpenBSD: if_urereg.h,v 1.4 2018/10/31 14:18:09 patrick Exp $ */ /*- * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> * All rights reserved. @@ -41,7 +41,8 @@ #define URE_BYTE_EN_BYTE 0x11 #define URE_BYTE_EN_SIX_BYTES 0x3f -#define URE_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) +#define URE_MAX_FRAMELEN_8152 (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) +#define URE_MAX_FRAMELEN_8153 (9 * 1024) #define URE_PLA_IDR 0xc000 #define URE_PLA_RCR 0xc010 @@ -186,6 +187,10 @@ /* PLA_TCR1 */ #define URE_VERSION_MASK 0x7cf0 +/* PLA_MTPS */ +#define URE_MTPS_JUMBO (12 * 1024 / 64) +#define URE_MTPS_DEFAULT (6 * 1024 / 64) + /* PLA_CR */ #define URE_CR_RST 0x10 #define URE_CR_RE 0x08 |