On Tue, Oct 30, 2018 at 05:30:55PM +0800, Kevin Lo wrote:
> On Tue, Oct 30, 2018 at 09:43:08AM +0100, Patrick Wildt wrote:
> > +   if (sc->ure_flags & URE_FLAG_8152)
> > +           ifp->ifp_hardmtu = URE_MAX_FRAMELEN_8152;
> > +   else
> > +           ifp->ifp_hardmtu = URE_MAX_FRAMELEN_8153;
> > +   ifp->ifp_hardmtu -= (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
> 
> Typo. Should be ifp->if_hardmtu, not ifp->ifp_hardmtu.

Oops, yes, I sent the wrong diff that still had the typo.  Fixed diff
attached which has no other change.

diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index b6c6c99ef34..9ec0dedceff 100644
--- a/sys/dev/usb/if_ure.c
+++ b/sys/dev/usb/if_ure.c
@@ -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..8963d2753ed 100644
--- a/sys/dev/usb/if_urereg.h
+++ b/sys/dev/usb/if_urereg.h
@@ -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

Reply via email to