Index: sys/dev/cxgbe/t4_sge.c =================================================================== --- sys/dev/cxgbe/t4_sge.c +++ sys/dev/cxgbe/t4_sge.c @@ -312,6 +312,69 @@ return (refs - rels); } +/** + * t4_handle_wrerr_rpl - process a FW work request error message + * @adap: the adapter + * @rpl: start of the FW message + */ +static int +t4_handle_wrerr_rpl(struct adapter *adap, const __be64 *rpl) +{ + u8 opcode = *(const u8 *)rpl; + const struct fw_error_cmd *e = (const void *)rpl; + unsigned int i; + + if (opcode != FW_ERROR_CMD) { + device_printf(adap->dev, + "Received WRERR_RPL message with opcode %#x\n", opcode); + return -EINVAL; + } + device_printf(adap->dev, "FW_ERROR (%s) ", + G_FW_ERROR_CMD_FATAL(be32toh(e->op_to_type)) ? "fatal" : + "non-fatal"); + switch (G_FW_ERROR_CMD_TYPE(be32toh(e->op_to_type))) { + case FW_ERROR_TYPE_EXCEPTION: + printf("exception info:\n"); + for (i = 0; i < nitems(e->u.exception.info); i++) + printf("%s%08x", i == 0 ? "\t" : " ", + be32toh(e->u.exception.info[i])); + printf("\n"); + break; + case FW_ERROR_TYPE_HWMODULE: + printf("HW module regaddr %08x regval %08x\n", + be32toh(e->u.hwmodule.regaddr), + be32toh(e->u.hwmodule.regval)); + break; + case FW_ERROR_TYPE_WR: + printf("WR cidx %d PF %d VF %d eqid %d hdr:\n", + be16toh(e->u.wr.cidx), + G_FW_ERROR_CMD_PFN(be16toh(e->u.wr.pfn_vfn)), + G_FW_ERROR_CMD_VFN(be16toh(e->u.wr.pfn_vfn)), + be32toh(e->u.wr.eqid)); + for (i = 0; i < nitems(e->u.wr.wrhdr); i++) + printf("%s%02x", i == 0 ? "\t" : " ", e->u.wr.wrhdr[i]); + printf("\n"); + break; + case FW_ERROR_TYPE_ACL: + printf("ACL cidx %d PF %d VF %d eqid %d %s", + be16toh(e->u.acl.cidx), + G_FW_ERROR_CMD_PFN(be16toh(e->u.acl.pfn_vfn)), + G_FW_ERROR_CMD_VFN(be16toh(e->u.acl.pfn_vfn)), + be32toh(e->u.acl.eqid), + G_FW_ERROR_CMD_MV(be16toh(e->u.acl.mv_pkd)) ? "vlanid" : + "MAC"); + for (i = 0; i < nitems(e->u.acl.val); i++) + printf(" %02x", e->u.acl.val[i]); + printf("\n"); + break; + default: + printf("type %#x\n", + G_FW_ERROR_CMD_TYPE(be32toh(e->op_to_type))); + return -EINVAL; + } + return 0; +} + void t4_init_sge_cpl_handlers(struct adapter *sc) { @@ -321,6 +384,7 @@ t4_register_cpl_handler(sc, CPL_SGE_EGR_UPDATE, handle_sge_egr_update); t4_register_cpl_handler(sc, CPL_RX_PKT, t4_eth_rx); t4_register_fw_msg_handler(sc, FW6_TYPE_CMD_RPL, t4_handle_fw_rpl); + t4_register_fw_msg_handler(sc, FW6_TYPE_WRERR_RPL, t4_handle_wrerr_rpl); } static inline void