kernel: bump 5.4 to 5.4.42
[openwrt/staging/luka.git] / target / linux / layerscape / patches-5.4 / 701-net-0195-dpaa2-eth-Add-helper-functions.patch
1 From 1ffb57beaefe23ceeb526bc238351f7725502571 Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Mon, 16 Sep 2019 21:04:49 +0300
4 Subject: [PATCH] dpaa2-eth: Add helper functions
5
6 Add convenient helper functions that determines whether Rx/Tx pause
7 frames are enabled based on link state flags received from firmware.
8
9 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
10 ---
11 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 3 +--
12 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 11 +++++++++++
13 drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 5 ++---
14 3 files changed, 14 insertions(+), 5 deletions(-)
15
16 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
17 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
18 @@ -1276,8 +1276,7 @@ static int link_state_update(struct dpaa
19 * Rx FQ taildrop configuration as well. We configure taildrop
20 * only when pause frame generation is disabled.
21 */
22 - tx_pause = !!(state.options & DPNI_LINK_OPT_PAUSE) ^
23 - !!(state.options & DPNI_LINK_OPT_ASYM_PAUSE);
24 + tx_pause = dpaa2_eth_tx_pause_enabled(state.options);
25 dpaa2_eth_set_rx_taildrop(priv, !tx_pause);
26
27 /* Chech link state; speed / duplex changes are not treated yet */
28 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
29 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
30 @@ -495,6 +495,17 @@ enum dpaa2_eth_rx_dist {
31 (dpaa2_eth_cmp_dpni_ver((priv), DPNI_PAUSE_VER_MAJOR, \
32 DPNI_PAUSE_VER_MINOR) >= 0)
33
34 +static inline bool dpaa2_eth_tx_pause_enabled(u64 link_options)
35 +{
36 + return !!(link_options & DPNI_LINK_OPT_PAUSE) ^
37 + !!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
38 +}
39 +
40 +static inline bool dpaa2_eth_rx_pause_enabled(u64 link_options)
41 +{
42 + return !!(link_options & DPNI_LINK_OPT_PAUSE);
43 +}
44 +
45 static inline
46 unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
47 struct sk_buff *skb)
48 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
49 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
50 @@ -99,9 +99,8 @@ static void dpaa2_eth_get_pauseparam(str
51 struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
52 u64 link_options = priv->link_state.options;
53
54 - pause->rx_pause = !!(link_options & DPNI_LINK_OPT_PAUSE);
55 - pause->tx_pause = pause->rx_pause ^
56 - !!(link_options & DPNI_LINK_OPT_ASYM_PAUSE);
57 + pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options);
58 + pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options);
59 pause->autoneg = AUTONEG_DISABLE;
60 }
61