Skip to content

Commit ad054f2

Browse files
Ioana Radulescudavem330
authored andcommitted
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: Ioana Radulescu <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6aa90fe commit ad054f2

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,8 +1333,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv)
13331333
* Rx FQ taildrop configuration as well. We configure taildrop
13341334
* only when pause frame generation is disabled.
13351335
*/
1336-
tx_pause = !!(state.options & DPNI_LINK_OPT_PAUSE) ^
1337-
!!(state.options & DPNI_LINK_OPT_ASYM_PAUSE);
1336+
tx_pause = dpaa2_eth_tx_pause_enabled(state.options);
13381337
dpaa2_eth_set_rx_taildrop(priv, !tx_pause);
13391338

13401339
/* When we manage the MAC/PHY using phylink there is no need

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,17 @@ enum dpaa2_eth_rx_dist {
510510
(dpaa2_eth_cmp_dpni_ver((priv), DPNI_PAUSE_VER_MAJOR, \
511511
DPNI_PAUSE_VER_MINOR) >= 0)
512512

513+
static inline bool dpaa2_eth_tx_pause_enabled(u64 link_options)
514+
{
515+
return !!(link_options & DPNI_LINK_OPT_PAUSE) ^
516+
!!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
517+
}
518+
519+
static inline bool dpaa2_eth_rx_pause_enabled(u64 link_options)
520+
{
521+
return !!(link_options & DPNI_LINK_OPT_PAUSE);
522+
}
523+
513524
static inline
514525
unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
515526
struct sk_buff *skb)

drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ static void dpaa2_eth_get_pauseparam(struct net_device *net_dev,
130130
return;
131131
}
132132

133-
pause->rx_pause = !!(link_options & DPNI_LINK_OPT_PAUSE);
134-
pause->tx_pause = pause->rx_pause ^
135-
!!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
133+
pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options);
134+
pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options);
136135
pause->autoneg = AUTONEG_DISABLE;
137136
}
138137

0 commit comments

Comments
 (0)