IPMI Sensor Name limitation of 16 bytes

Johnathan Mantey johnathanx.mantey at intel.com
Thu Jun 29 00:11:36 AEST 2023


On 6/28/23 03:23, Rohit Pai wrote:
>
> Hello,
>
> Below I have the proposal for a simple algorithm which seem to work 
> for the sensors names we have in our platforms.
>
> Any feedback on making it more generic and reusable would be appreciated.
>
I am currently in the process of a different solution. Instead of using 
an algorithm, which is either going to come up with a very mangled 
solution (50 char example below), or an algorithm that may mistakenly 
generate duplicate sensor names, we're proposing adding a "ShortName" 
entry to the JSON configuration file read by Entity Manager. Doing so 
allows each company to decide for themselves how they want the name to 
appear.

For example:
"Name": "CPU_ADC_Controller",
"ShortName": "CPU_ADC_Ctrlr",

The long example below might be represented by a human like this:
"Name": "ProcessorModule_0_MemCntl_0_PageRetirementCountl_0",
"ShortName": "PM0_MC0_PgRC0"
This is 13 chars, and leaves room for regex replacement of the '0' 
characters to allow for PM1_MC0, PM0_MC2, etc...

This also does away with the current solution that erases specific 
strings, which increases the probability of a sensor name collision.
  constexpr std::array<const char*, 7> suffixes = {
      "_Output_Voltage", "_Input_Voltage", "_Output_Current", 
"_Input_Current",
      "_Output_Power",   "_Input_Power",   "_Temperature"};

> Step 1: Split the given name into sub words using predefined delimiter 
> set, remove all delimiters, and combine the sub words, remember the 
> position of the delimiters. Some examples of delimiter are _, space, 
> -, camelCase pattern, etc. Combine the words without delimiters and 
> exit if the new string is less than 16 chars.
>
> Step 2: Start from the first sub word and repeat for all the sub words.
>
>                2.1: if the sub word character length is less than 
> allowed_min_char_length then skip and leave it as it is.
>
>                2.2: else remove all the characters from the sub word 
> which appear after the offset allowed_min_char_length
>
>                2.3: Stop the abbreviation process if the total length 
> of the new string is less than 16 chars.
>
> Step 3: Start by setting threshold as ( allowed_min_char_length - 1 ) 
> and repeat by decreasing threshold by 1 in each iteration until it 
> reaches value 1.
>
>                3.1: if the sub word character length is less than 
> threshold then skip and leave it as it is.
>
>                3.2: else remove all the characters from the sub word 
> which appear after the offset threshold.
>
>                3.3: Stop the abbreviation process if the total length 
> of the new string is less than 16 chars.
>
> Step 4    Remove sub words starting from the first sub word until we 
> reach last sub word or if the total length of the new string is less 
> than 16 chars.
>
> Some unit test data with allowed_min_char_length set to value 5.
>
> Length
>
> 	
>
> Input Names
>
> 	
>
> New Length
>
> 	
>
> Short Names
>
> 14
>
> 	
>
> CPU_0_Energy_0
>
> 	
>
> 14
>
> 	
>
> CPU_0_Energy_0
>
> 20
>
> 	
>
> GPU_0_DRAM_0_Power_0
>
> 	
>
> 15
>
> 	
>
> GPU0DRAM0Power0
>
> 20
>
> 	
>
> CPU_0_EDPViolation_0
>
> 	
>
> 15
>
> 	
>
> CPU0EDPViolati0
>
> 26
>
> 	
>
> ProcessorModule_0_Energy_0
>
> 	
>
> 15
>
> 	
>
> ProcModu0Energ0
>
> 23
>
> 	
>
> Baseboard_HSC_0_Power_0
>
> 	
>
> 15
>
> 	
>
> BasebHSC0Power0
>
> 50
>
> 	
>
> ProcessorModule_0_MemCntl_0_PageRetirementCountl_0
>
> 	
>
> 15
>
> 	
>
> PM0MC0PaReCoun0
>
> Thanks
>
> Rohit
>
-- 
Johnathan Mantey
Senior Software Engineer
*azad te**chnology partners*
Contributing to Technology Innovation since 1992
Phone: (503) 712-6764
Email: johnathanx.mantey at intel.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20230628/855f7661/attachment-0001.htm>


More information about the openbmc mailing list