On Fri, Nov 23, 2012 at 11:57:50AM -0200, Gleydson Soares wrote:
> set ifp->if_baudrate with IF_Gbps() / IF_Mbps().
> 
> OK ?
> Index: if_ste.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_ste.c,v
> retrieving revision 1.48
> diff -u -p -r1.48 if_ste.c
> --- if_ste.c  18 Oct 2012 21:44:21 -0000      1.48
> +++ if_ste.c  23 Nov 2012 14:07:41 -0000
> @@ -931,7 +931,7 @@ ste_attach(struct device *parent, struct
>       ifp->if_ioctl = ste_ioctl;
>       ifp->if_start = ste_start;
>       ifp->if_watchdog = ste_watchdog;
> -     ifp->if_baudrate = 10000000;
> +     ifp->if_baudrate = IF_Mbps(100);

before:         10000000
IF_Mbps(100):   100000000

Do you want to bump the default from 10Mbps to the maximum of 100Mbps
in all of the Fast Ethernet drivers of this diff?

The driver should probably set the baudrate based on the negotiated
speed.  At least this is how we do it in recent drivers.

Please also note that this change does have an impact on altq in
certain configurations because it will try to read ifi_baudrate in
pfctl when using non-absolute interface bandwidth values.

We don't really have a fixed rule for if_baudrate/ifi_baudrate.
Should it show the minimum or maximum link speed?  Should it show the
current link speed?  Using the current link speed could cause some
race conditions when loading a pf ruleset with a relative altq
bandwidth (like bandwidth 100%) before the link is fully negotiated.

>       IFQ_SET_MAXLEN(&ifp->if_snd, STE_TX_LIST_CNT - 1);
>       IFQ_SET_READY(&ifp->if_snd);
>       bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
> Index: if_tl.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_tl.c,v
> retrieving revision 1.51
> diff -u -p -r1.51 if_tl.c
> --- if_tl.c   22 Jun 2011 16:44:27 -0000      1.51
> +++ if_tl.c   23 Nov 2012 14:07:42 -0000
> @@ -2125,7 +2125,7 @@ tl_attach(parent, self, aux)
>       ifp->if_ioctl = tl_ioctl;
>       ifp->if_start = tl_start;
>       ifp->if_watchdog = tl_watchdog;
> -     ifp->if_baudrate = 10000000;
> +     ifp->if_baudrate = IF_Mbps(100);

same here...

>       IFQ_SET_MAXLEN(&ifp->if_snd, TL_TX_LIST_CNT - 1);
>       IFQ_SET_READY(&ifp->if_snd);
>       bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
> Index: if_txp.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_txp.c,v
> retrieving revision 1.104
> diff -u -p -r1.104 if_txp.c
> --- if_txp.c  5 Apr 2011 18:01:21 -0000       1.104
> +++ if_txp.c  23 Nov 2012 14:07:42 -0000
> @@ -225,7 +225,7 @@ txp_attachhook(void *vsc)
>       ifp->if_ioctl = txp_ioctl;
>       ifp->if_start = txp_start;
>       ifp->if_watchdog = txp_watchdog;
> -     ifp->if_baudrate = 10000000;
> +     ifp->if_baudrate = IF_Mbps(100);

I see a pattern :)

>       IFQ_SET_MAXLEN(&ifp->if_snd, TX_ENTRIES);
>       IFQ_SET_READY(&ifp->if_snd);
>       ifp->if_capabilities = 0;
> Index: if_vge.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_vge.c,v
> retrieving revision 1.51
> diff -u -p -r1.51 if_vge.c
> --- if_vge.c  22 Jun 2011 16:44:27 -0000      1.51
> +++ if_vge.c  23 Nov 2012 14:07:42 -0000
> @@ -787,7 +787,7 @@ vge_attach(struct device *parent, struct
>       ifp->if_ioctl = vge_ioctl;
>       ifp->if_start = vge_start;
>       ifp->if_watchdog = vge_watchdog;
> -     ifp->if_baudrate = 1000000000;
> +     ifp->if_baudrate = IF_Gbps(1);

Ok, this is 1 Gbps in both cases.  OK for this bit ;-)

>  #ifdef VGE_JUMBO
>       ifp->if_hardmtu = VGE_JUMBO_MTU;
>  #endif
> Index: if_vr.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
> retrieving revision 1.117
> diff -u -p -r1.117 if_vr.c
> --- if_vr.c   20 Oct 2012 16:12:22 -0000      1.117
> +++ if_vr.c   23 Nov 2012 14:07:42 -0000
> @@ -623,7 +623,7 @@ vr_attach(struct device *parent, struct 
>       ifp->if_ioctl = vr_ioctl;
>       ifp->if_start = vr_start;
>       ifp->if_watchdog = vr_watchdog;
> -     ifp->if_baudrate = 10000000;
> +     ifp->if_baudrate = IF_Mbps(100);

10 to 100 again...

>       ifp->if_capabilities = 0;
>       IFQ_SET_READY(&ifp->if_snd);
>       bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
> Index: if_wb.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_wb.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 if_wb.c
> --- if_wb.c   18 Oct 2012 21:44:21 -0000      1.49
> +++ if_wb.c   23 Nov 2012 14:07:42 -0000
> @@ -794,7 +794,7 @@ wb_attach(parent, self, aux)
>       ifp->if_ioctl = wb_ioctl;
>       ifp->if_start = wb_start;
>       ifp->if_watchdog = wb_watchdog;
> -     ifp->if_baudrate = 10000000;
> +     ifp->if_baudrate = IF_Mbps(100);

and here.

>       IFQ_SET_MAXLEN(&ifp->if_snd, WB_TX_LIST_CNT - 1);
>       IFQ_SET_READY(&ifp->if_snd);
> 

Reyk

Reply via email to