1 From 182bf3ddfc0168ca2df3da477b143bab17543b65 Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Wed, 13 Mar 2019 19:12:47 +0200
4 Subject: [PATCH] staging: fsl-dpaa2/mac: add pause frames support for managed
7 Read the configured dpmac options and depending on the supported
8 features set the according advertising bit.
10 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
11 Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
12 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
14 drivers/staging/fsl-dpaa2/mac/mac.c | 19 +++++++++++++++++++
15 1 file changed, 19 insertions(+)
17 --- a/drivers/staging/fsl-dpaa2/mac/mac.c
18 +++ b/drivers/staging/fsl-dpaa2/mac/mac.c
19 @@ -148,6 +148,11 @@ static void dpaa2_mac_link_changed(struc
21 state.options |= DPMAC_LINK_OPT_AUTONEG;
23 + if (phydev->pause && linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->advertising))
24 + state.options |= DPMAC_LINK_OPT_PAUSE;
25 + if (phydev->pause && linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->advertising))
26 + state.options |= DPMAC_LINK_OPT_ASYM_PAUSE;
28 netif_carrier_on(netdev);
30 netif_carrier_off(netdev);
31 @@ -415,6 +420,20 @@ static void configure_link(struct dpaa2_
32 link_mode_dpmac2phydev(cfg->advertising, phydev->advertising);
35 + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported)) {
36 + if (cfg->options & DPMAC_LINK_OPT_PAUSE)
37 + linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->advertising);
39 + linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->advertising);
42 + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported)) {
43 + if (cfg->options & DPMAC_LINK_OPT_ASYM_PAUSE)
44 + linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->advertising);
46 + linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->advertising);
49 if (cfg->options & DPMAC_LINK_OPT_AUTONEG) {
50 phydev->autoneg = AUTONEG_ENABLE;
51 linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising);