Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ifconfig xx0 -mediaopt flowcontrol (was Re: disabling mediaopts for if_wm(4))

Well, I tried to explicitly configure the speed to 100baseTX, which (according to all other reports) will disable all auto-negotiation.

That actually makes things worse, as it causes 50% reduction in the
"speed test" download results (from 50Mb/sec reduces to 24Mb/sec), with no change in the upload results (still varies in a range aroud 3Mb/sec to 5Mb/sec).

I did a tcpdump while the speed-test was running and noticed large numbers of tcp packets with SACK options, indicating that packets are getting dropped.

I also tried to run the same test with a re(4) RealTek interface instead of the wm(4). The re(4) did not negotiate any flow-control, and when I tried the speed-test it could not even connect to the servers! It took dhcpcd several minutes before the link would even configure, and still it was nearly impossible to do any DNS look-ups (with google 8.8.8.{4,8} as the servers).

So, it seems that the switch requires functional flow-control on its ports, and neither the re(4) nor wm(4) drivers seem to work correctly. I will be replacing the switch as soon as my budget permits!

The speed-test can be found at

On Thu, 11 May 2017, Masanobu SAITOH wrote:

Hi, all.

Currently, (almost?) all Ethernet driver can't disable flow control

	ifconfig xxN -mediaopt flowcontrol

FreeBSD has the same problem.

Flow control stuff can be separated into three different parts:

	A) interface (UI, API) to control Ethernet interface

	B) Autonego

		0) Set PHY's auto negotiation advertise register's
		flow bits first.

		1) and then, do autonego

	C) set MAC

		Check link partner's advertise bit from B-1's result
		and set MAC registers correctly.
B) and C) works on wm(4) and ixg(4) now. Problem"s" are in A).

A few years ago, I noticed that I can't change flow control setting
of wm(4) via ifconfig(8). And then, I added some printf()s to track
the problem. One of the problem is that the second argument of ifmedia_init().
Almost all driver has no IFM_ETH_FMASK in the second argument.
Another problem is in ifmedia_match(). I forgot the detail, but
the problem was caused by not passing flowcontrol media mask into
each driver correctly. See also PR#48950

For ixg(4), it has a special sysctl to change the setting

% sysctl hw.ixg0.fc
hw.ixg0.fc = 3
% sysctl -d hw.ixg0.fc
Set flow control mode using these values:
        0 - off
        1 - rx pause
        2 - tx pause
        3 - tx and rx pause

               SAITOH Masanobu (


| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |

Home | Main Index | Thread Index | Old Index