]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfp: add support for reporting active FEC mode
authorYinjun Zhang <yinjun.zhang@corigine.com>
Thu, 29 Sep 2022 08:58:28 +0000 (10:58 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 1 Oct 2022 01:47:52 +0000 (18:47 -0700)
The latest management firmware can now report the active FEC
mode. Adapt driver accordingly so that user can get the active
FEC mode by running command:

  # ethtool --show-fec <intf>

Also correct use of `fec` field.

Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c

index db58532364b6306d2a1ee36bc70227e9d605f978..d50af23642a296f14388d705c887c43dfc5c79b6 100644 (file)
@@ -996,7 +996,7 @@ nfp_port_get_fecparam(struct net_device *netdev,
                return 0;
 
        param->fec = nfp_port_fec_nsp_to_ethtool(eth_port->fec_modes_supported);
-       param->active_fec = nfp_port_fec_nsp_to_ethtool(eth_port->fec);
+       param->active_fec = nfp_port_fec_nsp_to_ethtool(BIT(eth_port->act_fec));
 
        return 0;
 }
index 77d66855be42e12ea4065611567f16850fa2bf96..52465670a01e7205f323f96ab89e826d118e99f8 100644 (file)
@@ -132,6 +132,7 @@ enum nfp_eth_fec {
  * @ports.interface:   interface (module) plugged in
  * @ports.media:       media type of the @interface
  * @ports.fec:         forward error correction mode
+ * @ports.act_fec:     active forward error correction mode
  * @ports.aneg:                auto negotiation mode
  * @ports.mac_addr:    interface MAC address
  * @ports.label_port:  port id
@@ -162,6 +163,7 @@ struct nfp_eth_table {
                enum nfp_eth_media media;
 
                enum nfp_eth_fec fec;
+               enum nfp_eth_fec act_fec;
                enum nfp_eth_aneg aneg;
 
                u8 mac_addr[ETH_ALEN];
index 4cc38799eabc700bf7ddd85fc90d2252548f193c..18ba7629cdc23caf8d9c41a261b241adda6ac9c5 100644 (file)
@@ -40,6 +40,7 @@
 #define NSP_ETH_STATE_OVRD_CHNG                BIT_ULL(22)
 #define NSP_ETH_STATE_ANEG             GENMASK_ULL(25, 23)
 #define NSP_ETH_STATE_FEC              GENMASK_ULL(27, 26)
+#define NSP_ETH_STATE_ACT_FEC          GENMASK_ULL(29, 28)
 
 #define NSP_ETH_CTRL_CONFIGURED                BIT_ULL(0)
 #define NSP_ETH_CTRL_ENABLED           BIT_ULL(1)
@@ -170,7 +171,13 @@ nfp_eth_port_translate(struct nfp_nsp *nsp, const union eth_table_entry *src,
        if (dst->fec_modes_supported)
                dst->fec_modes_supported |= NFP_FEC_AUTO | NFP_FEC_DISABLED;
 
-       dst->fec = 1 << FIELD_GET(NSP_ETH_STATE_FEC, state);
+       dst->fec = FIELD_GET(NSP_ETH_STATE_FEC, state);
+       dst->act_fec = dst->fec;
+
+       if (nfp_nsp_get_abi_ver_minor(nsp) < 33)
+               return;
+
+       dst->act_fec = FIELD_GET(NSP_ETH_STATE_ACT_FEC, state);
 }
 
 static void