cxgbe(4): Do not request an FEC that is invalid for the requested speed.

This eliminates error messages like this from the driver when running at
50Gbps with 100G cables:
[3726] cc0: l1cfg failed: 71
[4407] cc0: l1cfg failed: 71

Note that link comes up anyway with or without this change.

Reported by:	Suhas Lokesha @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2022-01-05 10:45:06 -08:00
parent 9e007a88d6
commit f3c2987f2f

View File

@ -3924,6 +3924,9 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
if (speed & FW_PORT_CAP32_SPEED_100G) {
fec |= FW_PORT_CAP32_FEC_RS;
fec |= FW_PORT_CAP32_FEC_NO_FEC;
} else if (speed & FW_PORT_CAP32_SPEED_50G) {
fec |= FW_PORT_CAP32_FEC_BASER_RS;
fec |= FW_PORT_CAP32_FEC_NO_FEC;
} else {
fec |= FW_PORT_CAP32_FEC_RS;
fec |= FW_PORT_CAP32_FEC_BASER_RS;
@ -3937,6 +3940,19 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
* because we aren't setting FORCE_FEC here.
*/
fec |= fec_to_fwcap(lc->fec_hint);
MPASS(powerof2(fec));
/*
* Override the hint if the FEC is not valid for
* the potential top speed. Request the best
* FEC at that speed instead.
*/
if (speed & FW_PORT_CAP32_SPEED_100G &&
fec == FW_PORT_CAP32_FEC_BASER_RS)
fec = FW_PORT_CAP32_FEC_RS;
else if (speed & FW_PORT_CAP32_SPEED_50G &&
fec == FW_PORT_CAP32_FEC_RS)
fec = FW_PORT_CAP32_FEC_BASER_RS;
}
} else {
/*