net/cxgbe: minor fixes for link related changes
cover net/cxgbe: minor fixes for link related changes
Patch 1 fixes issue with link status always getting set to down by driver for every link config change request. This is not required for some link config changes, like Tx/Rx pause on/off. Instead, driver should rely on actual link status returned by firmware in link config change reply.
Patch 2 fixes issue with link FEC retraining during probe. If firmware had already saved FEC before probe is completed, then use the saved FEC for further link configuration, instead of triggering link retraining. Also simplifies get fec ops.
Thanks,
Rahul
Rahul Lakkireddy (2):
net/cxgbe: do not link down for every link config change net/cxgbe: avoid link FEC retraining during probe
drivers/net/cxgbe/base/t4_hw.c | 17 ++++++++++++----- drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++---------------- 2 files changed, 17 insertions(+), 21 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/2 net/cxgbe: do not link down for every link config change
Some commands like turning local Tx/Rx pause on/off do not need link to go down. If there are issues with link config params, then the firmware will explicitly indicate link down in reply. So, don't always link down for every link config param change request. Instead, rely on actual link status coming in firmware's link config change reply.
--- drivers/net/cxgbe/base/t4_hw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/cxgbe/base/t4_hw.c +2 -4
@@ -2844,14 +2844,12 @@ int t4_link_l1cfg_core(struct port_info *pi, u32 caps, u8 sleep_ok)else ret =t4_wr_mbox_ns (adap, adap->mbox, &cmd,sizeof (cmd),NULL ); -if (ret ==FW_SUCCESS ) { - lc->link_ok =0 ; +if (ret ==FW_SUCCESS ) lc->link_caps = caps; - }else { +else dev_err (adap,"Requested Port Capabilities %#x rejected, error %d\n" , caps, ret); - }return ret; }
Signature · 1 line
2.24.0
PATCH 2/2 net/cxgbe: avoid link FEC retraining during probe
In reply to Rahul LakkireddyIf link FEC has already been saved by firmware during link training in probe, then use the saved FEC value, instead of retraining the link. If link training is still not complete in probe, then firmware will send the actual FEC later in link config change reply after training is complete.
Also, there can only be 1 active FEC at any time. So, simplify the FEC get ops. If FEC is supported and if none of the supported FEC caps are set, then assume NOFEC by default, instead of AUTO.
--- drivers/net/cxgbe/base/t4_hw.c | 11 ++++++++++- drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-)
drivers/net/cxgbe/base/t4_hw.c +10 -1
@@ -4700,6 +4700,7 @@ void t4_reset_link_config(struct adapter *adap, int idx)void t4_init_link_config (struct port_info *pi,u32 pcaps,u32 acaps,u8 mdio_addr,u8 port_type,u8 mod_type) { +u8 fec_rs =0 , fec_baser =0 , fec_none =0 ;struct link_config *lc = &pi->link_cfg; lc->pcaps = pcaps;
@@ -4722,8 +4723,16 @@ void t4_init_link_config(struct port_info *pi, u32 pcaps, u32 acaps,/* Reset FEC caps to default values */ if (lc->pcaps &V_FW_PORT_CAP32_FEC (M_FW_PORT_CAP32_FEC )) { +if (lc->acaps &FW_PORT_CAP32_FEC_RS ) + fec_rs =1 ; +else if (lc->acaps &FW_PORT_CAP32_FEC_BASER_RS ) + fec_baser =1 ; +else + fec_none =1 ; + lc->admin_caps &= ~V_FW_PORT_CAP32_FEC (M_FW_PORT_CAP32_FEC ); -t4_set_link_fec (pi,0 ,0 ,0 , &lc->admin_caps); +t4_set_link_fec (pi, fec_rs, fec_baser, fec_none, + &lc->admin_caps); }if (lc->pcaps &FW_PORT_CAP32_FORCE_FEC )
drivers/net/cxgbe/cxgbe_ethdev.c +5 -16
@@ -1256,24 +1256,13 @@ static int cxgbe_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa)if (!(lc->pcaps &V_FW_PORT_CAP32_FEC (M_FW_PORT_CAP32_FEC )))return -EOPNOTSUPP ; -if (caps &FW_PORT_CAP32_FEC_NO_FEC ) { - fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (NOFEC ); - goto out; - } - -if (caps &FW_PORT_CAP32_FEC_BASER_RS ) { - fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (BASER ); - goto out; - } - -if (caps &FW_PORT_CAP32_FEC_RS ) { +if (caps &FW_PORT_CAP32_FEC_RS ) fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (RS ); - goto out; - } - - fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (AUTO ); +else if (caps &FW_PORT_CAP32_FEC_BASER_RS ) + fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (BASER ); +else + fec_caps =RTE_ETH_FEC_MODE_CAPA_MASK (NOFEC ); -out: *fec_capa = fec_caps;return 0 ; }
Signature · 1 line
2.24.0
Quoted 14 lines · Rahul Lakkireddy
Patch 1 fixes issue with link status always getting set to down by driver for every link config change request. This is not required for some link config changes, like Tx/Rx pause on/off. Instead, driver should rely on actual link status returned by firmware in link config change reply.
Patch 2 fixes issue with link FEC retraining during probe. If firmware had already saved FEC before probe is completed, then use the saved FEC for further link configuration, instead of triggering link retraining. Also simplifies get fec ops.
Thanks,
Rahul
Quoted 8 lines
Rahul Lakkireddy (2):
net/cxgbe: do not link down for every link config change net/cxgbe: avoid link FEC retraining during probedrivers/net/cxgbe/base/t4_hw.c | 17 ++++++++++++----- drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++---------------- 2 files changed, 17 insertions(+), 21 deletions(-)
Set squashed into relevant commits in next-net, thanks.