Ticket #10412: 0001-Updated-FreeBSD-rtl81xx-network-driver-with-the-10.0.patch

File 0001-Updated-FreeBSD-rtl81xx-network-driver-with-the-10.0.patch, 9.5 KB (added by MasterM, 10 years ago)

Updated rtl81xx driver to release 10.0.

  • src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c

    From 6a833692e63bbf0cfa86b89dbd9f7def017680d2 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Micha=C5=82=20Siejak?= <michal@siejak.pl>
    Date: Thu, 29 May 2014 13:28:49 +0200
    Subject: [PATCH] Updated FreeBSD rtl81xx network driver with the 10.0 release.
    
    Should fix #10412.
    ---
     .../drivers/network/rtl81xx/dev/mii/rgephy.c       |  7 +++-
     .../kernel/drivers/network/rtl81xx/dev/re/if_re.c  | 45 ++++++++++++++++------
     .../kernel/drivers/network/rtl81xx/pci/if_rlreg.h  | 11 ++++++
     .../compat/freebsd_network/compat/dev/mii/miidevs  |  1 +
     4 files changed, 51 insertions(+), 13 deletions(-)
    
    diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c b/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c
    index aa919f5..8345f1f 100644
    a b static void rgephy_load_dspcode(struct mii_softc *);  
    9090
    9191static const struct mii_phydesc rgephys[] = {
    9292    MII_PHY_DESC(REALTEK, RTL8169S),
     93    MII_PHY_DESC(REALTEK, RTL8251),
    9394    MII_PHY_END
    9495};
    9596
    rgephy_loop(struct mii_softc *sc)  
    406407{
    407408    int i;
    408409
    409     if (sc->mii_mpd_rev < 2) {
     410    if (sc->mii_mpd_model != MII_MODEL_REALTEK_RTL8251 &&
     411        sc->mii_mpd_rev < 2) {
    410412        PHY_WRITE(sc, RGEPHY_MII_BMCR, RGEPHY_BMCR_PDOWN);
    411413        DELAY(1000);
    412414    }
    rgephy_load_dspcode(struct mii_softc *sc)  
    439441{
    440442    int val;
    441443
    442     if (sc->mii_mpd_rev >= 2)
     444    if (sc->mii_mpd_model == MII_MODEL_REALTEK_RTL8251 ||
     445        sc->mii_mpd_rev >= 2)
    443446        return;
    444447
    445448    PHY_WRITE(sc, 31, 0x0001);
  • src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c

    diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c b/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c
    index 4aada16..99a5438 100644
    a b static const struct rl_type re_devs[] = {  
    181181    { RT_VENDORID, RT_DEVICEID_8101E, 0,
    182182        "RealTek 810xE PCIe 10/100baseTX" },
    183183    { RT_VENDORID, RT_DEVICEID_8168, 0,
    184         "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" },
     184        "RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet" },
    185185    { RT_VENDORID, RT_DEVICEID_8169, 0,
    186186        "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" },
    187187    { RT_VENDORID, RT_DEVICEID_8169SC, 0,
    static const struct rl_hwrev re_hwrevs[] = {  
    223223    { RL_HWREV_8402, RL_8169, "8402", RL_MTU },
    224224    { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU },
    225225    { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU },
     226    { RL_HWREV_8106E, RL_8169, "8106E", RL_MTU },
    226227    { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU },
    227228    { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU },
    228229    { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K },
    static const struct rl_hwrev re_hwrevs[] = {  
    232233    { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K },
    233234    { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K},
    234235    { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K},
     236    { RL_HWREV_8168EP, RL_8169, "8168EP/8111EP", RL_JUMBO_MTU_9K},
    235237    { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K},
     238    { RL_HWREV_8168G, RL_8169, "8168G/8111G", RL_JUMBO_MTU_9K},
     239    { RL_HWREV_8168GU, RL_8169, "8168GU/8111GU", RL_JUMBO_MTU_9K},
    236240    { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K},
     241    { RL_HWREV_8411B, RL_8169, "8411B", RL_JUMBO_MTU_9K},
    237242    { 0, 0, NULL, 0 }
    238243};
    239244
    re_attach(device_t dev)  
    13211326                SYS_RES_IRQ, &rid, RF_ACTIVE);
    13221327            if (sc->rl_irq[i] == NULL) {
    13231328                device_printf(dev,
    1324                     "couldn't llocate IRQ resources for "
     1329                    "couldn't allocate IRQ resources for "
    13251330                    "message %d\n", rid);
    13261331                error = ENXIO;
    13271332                goto fail;
    re_attach(device_t dev)  
    13471352        if ((cap & PCIEM_LINK_CAP_ASPM) != 0) {
    13481353            ctl = pci_read_config(dev, sc->rl_expcap +
    13491354                PCIER_LINK_CTL, 2);
    1350             if ((ctl & 0x0003) != 0) {
    1351                 ctl &= ~0x0003;
     1355            if ((ctl & PCIEM_LINK_CTL_ASPMC) != 0) {
     1356                ctl &= ~PCIEM_LINK_CTL_ASPMC;
    13521357                pci_write_config(dev, sc->rl_expcap +
    13531358                    PCIER_LINK_CTL, ctl, 2);
    13541359                device_printf(dev, "ASPM disabled\n");
    re_attach(device_t dev)  
    13671372        break;
    13681373    default:
    13691374        device_printf(dev, "Chip rev. 0x%08x\n", hwrev & 0x7c800000);
     1375        sc->rl_macrev = hwrev & 0x00700000;
    13701376        hwrev &= RL_TXCFG_HWREV;
    13711377        break;
    13721378    }
    1373     device_printf(dev, "MAC rev. 0x%08x\n", hwrev & 0x00700000);
     1379    device_printf(dev, "MAC rev. 0x%08x\n", sc->rl_macrev);
    13741380    while (hw_rev->rl_desc != NULL) {
    13751381        if (hw_rev->rl_rev == hwrev) {
    13761382            sc->rl_type = hw_rev->rl_type;
    re_attach(device_t dev)  
    14081414    case RL_HWREV_8401E:
    14091415    case RL_HWREV_8105E:
    14101416    case RL_HWREV_8105E_SPIN1:
     1417    case RL_HWREV_8106E:
    14111418        sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM |
    14121419            RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT |
    14131420            RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
    re_attach(device_t dev)  
    14291436        sc->rl_flags |= RL_FLAG_MACSLEEP;
    14301437        /* FALLTHROUGH */
    14311438    case RL_HWREV_8168C:
    1432         if ((hwrev & 0x00700000) == 0x00200000)
     1439        if (sc->rl_macrev == 0x00200000)
    14331440            sc->rl_flags |= RL_FLAG_MACSLEEP;
    14341441        /* FALLTHROUGH */
    14351442    case RL_HWREV_8168CP:
    re_attach(device_t dev)  
    14551462            RL_FLAG_WOL_MANLINK;
    14561463        break;
    14571464    case RL_HWREV_8168E_VL:
     1465    case RL_HWREV_8168EP:
    14581466    case RL_HWREV_8168F:
     1467    case RL_HWREV_8168G:
    14591468    case RL_HWREV_8411:
     1469    case RL_HWREV_8411B:
    14601470        sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
    14611471            RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP |
    14621472            RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 |
    14631473            RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK;
    14641474        break;
     1475    case RL_HWREV_8168GU:
     1476        if (pci_get_device(dev) == RT_DEVICEID_8101E) {
     1477            /* RTL8106EUS */
     1478            sc->rl_flags |= RL_FLAG_FASTETHER;
     1479        } else
     1480            sc->rl_flags |= RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK;
     1481
     1482        sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
     1483            RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP |
     1484            RL_FLAG_AUTOPAD | RL_FLAG_CMDSTOP_WAIT_TXQ;
     1485        break;
    14651486    case RL_HWREV_8169_8110SB:
    14661487    case RL_HWREV_8169_8110SBL:
    14671488    case RL_HWREV_8169_8110SC:
    re_attach(device_t dev)  
    16321653    /*
    16331654     * Don't enable TSO by default.  It is known to generate
    16341655     * corrupted TCP segments(bad TCP options) under certain
    1635      * circumtances.
     1656     * circumstances.
    16361657     */
    16371658    ifp->if_hwassist &= ~CSUM_TSO;
    16381659    ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO);
    re_encap(struct rl_softc *sc, struct mbuf **m_head)  
    27842805        /*
    27852806         * Unconditionally enable IP checksum if TCP or UDP
    27862807         * checksum is required. Otherwise, TCP/UDP checksum
    2787          * does't make effects.
     2808         * doesn't make effects.
    27882809         */
    27892810        if (((*m_head)->m_pkthdr.csum_flags & RE_CSUM_FEATURES) != 0) {
    27902811            if ((sc->rl_flags & RL_FLAG_DESCV2) == 0) {
    re_init_locked(struct rl_softc *sc)  
    32473268        if ((sc->rl_flags & RL_FLAG_JUMBOV2) != 0) {
    32483269            /*
    32493270             * For controllers that use new jumbo frame scheme,
    3250              * set maximum size of jumbo frame depedning on
     3271             * set maximum size of jumbo frame depending on
    32513272             * controller revisions.
    32523273             */
    32533274            if (ifp->if_mtu > RL_MTU)
    re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)  
    33323353    switch (command) {
    33333354    case SIOCSIFMTU:
    33343355        if (ifr->ifr_mtu < ETHERMIN ||
    3335             ifr->ifr_mtu > sc->rl_hwrev->rl_max_mtu) {
     3356            ifr->ifr_mtu > sc->rl_hwrev->rl_max_mtu ||
     3357            ((sc->rl_flags & RL_FLAG_FASTETHER) != 0 &&
     3358            ifr->ifr_mtu > RL_MTU)) {
    33363359            error = EINVAL;
    33373360            break;
    33383361        }
    re_sysctl_stats(SYSCTL_HANDLER_ARGS)  
    39483971        RL_UNLOCK(sc);
    39493972        if (i == 0) {
    39503973            device_printf(sc->rl_dev,
    3951                 "DUMP statistics request timedout\n");
     3974                "DUMP statistics request timed out\n");
    39523975            return (ETIMEDOUT);
    39533976        }
    39543977done:
  • src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h

    diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h b/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h
    index 7822ce3..13a111a 100644
    a b  
    189189#define RL_HWREV_8105E      0x40800000
    190190#define RL_HWREV_8105E_SPIN1    0x40C00000
    191191#define RL_HWREV_8402       0x44000000
     192#define RL_HWREV_8106E      0x44800000
    192193#define RL_HWREV_8168F      0x48000000
    193194#define RL_HWREV_8411       0x48800000
     195#define RL_HWREV_8168G      0x4C000000
     196#define RL_HWREV_8168EP     0x50000000
     197#define RL_HWREV_8168GU     0x50800000
     198#define RL_HWREV_8411B      0x5C800000
    194199#define RL_HWREV_8139       0x60000000
    195200#define RL_HWREV_8139A      0x70000000
    196201#define RL_HWREV_8139AG     0x70800000
    struct rl_softc {  
    877882    bus_dma_tag_t       rl_parent_tag;
    878883    uint8_t         rl_type;
    879884    const struct rl_hwrev   *rl_hwrev;
     885    uint32_t        rl_macrev;
    880886    int         rl_eecmd_read;
    881887    int         rl_eewidth;
    882888    int         rl_expcap;
    struct rl_softc {  
    10481054#define DLINK_DEVICEID_530TXPLUS        0x1300
    10491055
    10501056/*
     1057 * D-Link DFE-520TX rev. C1 device ID
     1058 */
     1059#define DLINK_DEVICEID_520TX_REVC1      0x4200
     1060
     1061/*
    10511062 * D-Link DFE-5280T device ID
    10521063 */
    10531064#define DLINK_DEVICEID_528T         0x4300
  • src/libs/compat/freebsd_network/compat/dev/mii/miidevs

    diff --git a/src/libs/compat/freebsd_network/compat/dev/mii/miidevs b/src/libs/compat/freebsd_network/compat/dev/mii/miidevs
    index 24662f9..431bcd8 100644
    a b model yyREALTEK RTL8201L 0x0020 RTL8201L 10/100 media interface  
    299299model xxREALTEK RTL8169S    0x0011 RTL8169S/8110S/8211 1000BASE-T media interface
    300300model REALTEK RTL8305SC     0x0005 RTL8305SC 10/100 802.1q switch
    301301model REALTEK RTL8201E      0x0008 RTL8201E 10/100 media interface
     302model REALTEK RTL8251       0x0000 RTL8251 1000BASE-T media interface
    302303model REALTEK RTL8169S      0x0011 RTL8169S/8110S/8211 1000BASE-T media interface
    303304
    304305/* Seeq Seeq PHYs */