Subject: How to "force flow control if media == auto",etc.
To: None <tech-net@netbsd.org>
From: HITOSHI Osada <QFH02545@nifty.com>
List: tech-net
Date: 04/11/2004 05:09:53
Hello,

I'm now working on "802.3x flow control support".  I met problems and
I have no idea to solve these.  Please advice me.
------------------------------------------------
Problems:
A-1. Regardless of the capability of an Ethernet driver, a PHY driver
will always advertize "I support all flow control features". 

A-2. A user cannot specify "how to do/don't flow control
negotication".

  This problem is due to lack of API's between Ethernet drivers and
  PHY drivers. a Ethernet driver should tell PHY drivers "how to
  advertize" each ioctl(SIOCSIFMEDIA).

  IFM_ETH_TXPAUSE and IFM_ETH_RXPAUSE could not be used for this
  purpose becasue a PHY driver cannot determine PAUSE capabilities
  from these flags in principle. (eg. Both TXPAUSE and RXPAUSE(most
  case) => sym only? both sym and asym?)

    [idea 0.] Make new API or modify existing API.

    => Too difficult (for me).

B. In case of media == auto, the flow control setting cannot became
independent of the PHY's negotiation result.

  My current implementation has no method to force a flow control such
  case.  The problem will be occurred if the link partner is "do flow
  control, but don't advertize" one(eg. wm(4)).

    [Idea 1.] Create IFM_ETH_FORCEFLOW and IFM_ETH_FORCENOFLOW flag
    and handle these flag in the Ethernet driver's ioctl().

    => Too dirty, but simple and easy to use/implement.

    [Idea 2.] The Ethernet driver make a sysctl()
    (eg. hw.bge0.forceflwctl) variable. When this flag is set, the
    Ethernet driver ignores PHY results and do flow control as the
    user was specified by ifconfig.  

    => I think it's better than 1. but We should change the rc.d order
    "set sysctl variable BEFORE ifconfig".
--------------------------------------------------------------------
P.S.
  I've just released "20040411" patch. the changes from previous are:

*. gsip(4:) Bug fix.
*. gphyter(4): Bug fix.
*. Rename gmii_phy_getflowcontrol() -> mii_phy_flowstatus().
*. Tune mii_phy_flowstatus()'s logic a little.
*. Change to use mii_phy_flowstatus() in ukphy_subr.c.
*. gsip(4): Force disabling checksum offloading if mtu > 8109.
*. Import thorpej's changes. (no need to patch if_media.h. Thank you, Jason.)

The patch(etherflow-20040411.tar.gz) is located: 
http://homepage3.nifty.com/hosada/NetBSD/ether-flowcontrol/index.html


Regards,