Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8c30832 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

mii: Add mii_advertise_flowctrl()



This converts flow control capabilites to an advertising mask and can
be useful in combination with mii_resolve_flowctrl_fdx().

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44c22ee9
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -239,6 +239,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
	return 0;
}

/**
 * mii_advertise_flowctrl - get flow control advertisement flags
 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
 */
static inline u16 mii_advertise_flowctrl(int cap)
{
	u16 adv = 0;

	if (cap & FLOW_CTRL_RX)
		adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
	if (cap & FLOW_CTRL_TX)
		adv ^= ADVERTISE_PAUSE_ASYM;

	return adv;
}

/**
 * mii_resolve_flowctrl_fdx
 * @lcladv: value of MII ADVERTISE register