On Tue, Sep 02, 2014 at 07:20:30AM -0400, Brad Smith wrote:
> On Tue, Sep 02, 2014 at 06:28:48AM -0400, Brad Smith wrote:
> > Add some feature flags and store in the softc the various max Jumbo frame 
> > sizes
> > for the different generations of chips. No behavioral change.
> > 
> > Tested with..
> > 
> > re0 at pci2 dev 0 function 0 "Realtek 8168" rev 0x03: RTL8168D/8111D 
> > (0x2800)
> > re0 at pci2 dev 0 function 0 "Realtek 8168" rev 0x0c: RTL8168G/8111G 
> > (0x4c00)
> > 
> > OK?
> 
> Fix a typo with RL_FLAG_HWIM.

Why not leave the assignment of sc_hwrev in re.c and stash the product
as sc_product or some such?

>       case RL_HWREV_8168C:
>       case RL_HWREV_8168CP:
> -     case RL_HWREV_8168DP:
> -             sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE |
> -                 RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT |
> -                 RL_FLAG_HWIM | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
> -             /*
> -              * These controllers support jumbo frame but it seems
> -              * that enabling it requires touching additional magic
> -              * registers. Depending on MAC revisions some
> -              * controllers need to disable checksum offload. So
> -              * disable jumbo frame until I have better idea what
> -              * it really requires to make it support.
> -              * RTL8168C/CP : supports up to 6KB jumbo frame.
> -              * RTL8111C/CP : supports up to 9KB jumbo frame.
> -              */
> -             sc->rl_flags |= RL_FLAG_NOJUMBO;
> +             sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
> +                 RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP |
> +                 RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK;
> +             sc->rl_max_mtu = RL_JUMBO_MTU_6K;
>               break;

Assuming the goal is the sync these flags with the FreeBSD driver this
misses:

case RL_HWREV_8168C:
        if (sc->rl_macrev == 0x00200000)
                sc->rl_flags |= RL_FLAG_MACSLEEP;
        /* FALLTHROUGH */
case RL_HWREV_8168CP:

macrev is not sc_hwrev but is read from the same RL_TXCFG register
with a different mask (0x00700000).

The other flags and jumbo values all seem to match FreeBSD
from a quick comparison.

> @@ -957,8 +981,8 @@ re_attach(struct rl_softc *sc, const cha
>       ifp->if_ioctl = re_ioctl;
>       ifp->if_start = re_start;
>       ifp->if_watchdog = re_watchdog;
> -     if ((sc->rl_flags & RL_FLAG_NOJUMBO) == 0)
> -             ifp->if_hardmtu = RL_JUMBO_MTU;
> +     if ((sc->rl_flags & RL_FLAG_JUMBOV2) == 0)
> +             ifp->if_hardmtu = sc->rl_max_mtu;
>       IFQ_SET_MAXLEN(&ifp->if_snd, RL_TX_QLEN);
>       IFQ_SET_READY(&ifp->if_snd);
>  

Anything with RL_FLAG_JUMBOV2 won't do jumbos, because
the relevant code for this isn't there at the moment?

Reply via email to