cxgbe(4): Use t4_link_down_rc_str in shared code to decode the reason

the link is down, instead of doing it in OS specific code.
This commit is contained in:
Navdeep Parhar
2016-03-08 08:59:34 +00:00
parent 448f746eb6
commit f799998f84
3 changed files with 27 additions and 7 deletions
+1
View File
@@ -692,6 +692,7 @@ int t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid,
int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype,
u32 *data);
int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
const char *t4_link_down_rc_str(unsigned char link_down_rc);
int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val);
int t4_sched_config(struct adapter *adapter, int type, int minmaxen,
+25
View File
@@ -7429,6 +7429,31 @@ int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
}
/**
* t4_link_down_rc_str - return a string for a Link Down Reason Code
* @link_down_rc: Link Down Reason Code
*
* Returns a string representation of the Link Down Reason Code.
*/
const char *t4_link_down_rc_str(unsigned char link_down_rc)
{
static const char *reason[] = {
"Link Down",
"Remote Fault",
"Auto-negotiation Failure",
"Reserved3",
"Insufficient Airflow",
"Unable To Determine Reason",
"No RX Signal Detected",
"Reserved7",
};
if (link_down_rc >= ARRAY_SIZE(reason))
return "Bad Reason Code";
return reason[link_down_rc];
}
/**
* t4_handle_fw_rpl - process a FW reply message
* @adap: the adapter
+1 -7
View File
@@ -6020,10 +6020,6 @@ sysctl_linkdnrc(SYSCTL_HANDLER_ARGS)
int rc = 0;
struct port_info *pi = arg1;
struct sbuf *sb;
static const char *linkdnreasons[] = {
"non-specific", "remote fault", "autoneg failed", "reserved3",
"PHY overheated", "unknown", "rx los", "reserved7"
};
rc = sysctl_wire_old_buffer(req, 0);
if (rc != 0)
@@ -6034,10 +6030,8 @@ sysctl_linkdnrc(SYSCTL_HANDLER_ARGS)
if (pi->linkdnrc < 0)
sbuf_printf(sb, "n/a");
else if (pi->linkdnrc < nitems(linkdnreasons))
sbuf_printf(sb, "%s", linkdnreasons[pi->linkdnrc]);
else
sbuf_printf(sb, "%d", pi->linkdnrc);
sbuf_printf(sb, "%s", t4_link_down_rc_str(pi->linkdnrc));
rc = sbuf_finish(sb);
sbuf_delete(sb);