On Thu, 21 Feb 2013 16:24:50 +0000 "Hefty, Sean" <sean.he...@intel.com> wrote:
> > +#define UMAD_GENERIC_ATTRIBUTE_STR \ > > + case UMAD_ATTR_CLASS_PORT_INFO: \ > > + return "Class Port Info"; \ > > + case UMAD_ATTR_NOTICE: \ > > + return "Notice"; \ > > + case UMAD_ATTR_INFORM_INFO: \ > > + return "Inform Info" > > What if you convert this to something like: This would definitely work but I was concerned that someone reading the header file would confuse such a function with: static inline char * umad_attribute_str(uint8_t mgmt_class, be16_t attr_id) and not get proper decoding. Anyway, that is what I was thinking. The macro is pretty obfuscated. :-( Perhaps: static inline char *umad_common_attr_str(be16_t attr_id) That follows the spec better. Patch to follow, Ira > > static inline char *umad_attr_str(be16_t attr_id) > { > switch(ntohs(attr_id)) { > case UMAD_ATTR_CLASS_PORT_INFO: > return "Class Port Info"; > case UMAD_ATTR_NOTICE: > return "Notice"; > case UMAD_ATTR_INFORM_INFO: > return "Inform Info"; > default: > return "unknown"; > } > } > > and then... > > > +static inline char * umad_sm_attr_str(be16_t attr_id) > > +{ > > + switch(ntohs(attr_id)) { > > + > > remove this line > > > + UMAD_GENERIC_ATTRIBUTE_STR; > > and... > > > + > > + case UMAD_SMP_ATTR_NODE_DESC: > > + return ("NodeDescription"); > > + case UMAD_SMP_ATTR_NODE_INFO: > > + return ("NodeInfo"); > > + case UMAD_SMP_ATTR_SWITCH_INFO: > > + return ("SwitchInfo"); > > + case UMAD_SMP_ATTR_GUID_INFO: > > + return ("GUIDInfo"); > > + case UMAD_SMP_ATTR_PORT_INFO: > > + return ("PortInfo"); > > + case UMAD_SMP_ATTR_PKEY_TABLE: > > + return ("P_KeyTable"); > > + case UMAD_SMP_ATTR_SLVL_TABLE: > > + return ("SLtoVLMappingTable"); > > + case UMAD_SMP_ATTR_VL_ARB_TABLE: > > + return ("VLArbitrationTable"); > > + case UMAD_SMP_ATTR_LINEAR_FT: > > + return ("LinearForwardingTable"); > > + case UMAD_SMP_ATTR_RANDOM_FT: > > + return ("RandomForwardingTable"); > > + case UMAD_SMP_ATTR_MCAST_FT: > > + return ("MulticastForwardingTable"); > > + case UMAD_SMP_ATTR_SM_INFO: > > + return ("SMInfo"); > > + case UMAD_SMP_ATTR_VENDOR_DIAG: > > + return ("VendorDiag"); > > + case UMAD_SMP_ATTR_LED_INFO: > > + return ("LedInfo"); > > + case UMAD_SMP_ATTR_LINK_SPD_WIDTH_TABLE: > > + return ("LinkSpeedWidthPairsTable"); > > add: > default: > return umad_attr_str(attr_id); > > > + } > > + return ("<unknown>"); > > +} > > - Sean > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ira Weiny Member of Technical Staff Lawrence Livermore National Lab 925-423-8008 wei...@llnl.gov -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html