Commit ad054f26 authored by Ioana Radulescu's avatar Ioana Radulescu Committed by David S. Miller

dpaa2-eth: Add helper functions

Add convenient helper functions that determines whether Rx/Tx pause
frames are enabled based on link state flags received from firmware.
Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6aa90fe2
...@@ -1333,8 +1333,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv) ...@@ -1333,8 +1333,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv)
* Rx FQ taildrop configuration as well. We configure taildrop * Rx FQ taildrop configuration as well. We configure taildrop
* only when pause frame generation is disabled. * only when pause frame generation is disabled.
*/ */
tx_pause = !!(state.options & DPNI_LINK_OPT_PAUSE) ^ tx_pause = dpaa2_eth_tx_pause_enabled(state.options);
!!(state.options & DPNI_LINK_OPT_ASYM_PAUSE);
dpaa2_eth_set_rx_taildrop(priv, !tx_pause); dpaa2_eth_set_rx_taildrop(priv, !tx_pause);
/* When we manage the MAC/PHY using phylink there is no need /* When we manage the MAC/PHY using phylink there is no need
......
...@@ -510,6 +510,17 @@ enum dpaa2_eth_rx_dist { ...@@ -510,6 +510,17 @@ enum dpaa2_eth_rx_dist {
(dpaa2_eth_cmp_dpni_ver((priv), DPNI_PAUSE_VER_MAJOR, \ (dpaa2_eth_cmp_dpni_ver((priv), DPNI_PAUSE_VER_MAJOR, \
DPNI_PAUSE_VER_MINOR) >= 0) DPNI_PAUSE_VER_MINOR) >= 0)
static inline bool dpaa2_eth_tx_pause_enabled(u64 link_options)
{
return !!(link_options & DPNI_LINK_OPT_PAUSE) ^
!!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
}
static inline bool dpaa2_eth_rx_pause_enabled(u64 link_options)
{
return !!(link_options & DPNI_LINK_OPT_PAUSE);
}
static inline static inline
unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv, unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
struct sk_buff *skb) struct sk_buff *skb)
......
...@@ -130,9 +130,8 @@ static void dpaa2_eth_get_pauseparam(struct net_device *net_dev, ...@@ -130,9 +130,8 @@ static void dpaa2_eth_get_pauseparam(struct net_device *net_dev,
return; return;
} }
pause->rx_pause = !!(link_options & DPNI_LINK_OPT_PAUSE); pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options);
pause->tx_pause = pause->rx_pause ^ pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options);
!!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
pause->autoneg = AUTONEG_DISABLE; pause->autoneg = AUTONEG_DISABLE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment