topic Clarification of the hash algorithm for L2 Lookup Table Index calculation on the SJA1105TEL in QorIQ
https://community.nxp.com/t5/QorIQ/Clarification-of-the-hash-algorithm-for-L2-Lookup-Table-Index/m-p/834970#M7194
<HTML><HEAD></HEAD><BODY><DIV class=""><DIV class=""><DIV class=""><P>We are trying to figure out how to to programmatically fill the L2 Address Lookup table of the SJA1105TEL switch fabric.</P><P></P><P>In order to achieve this we need to replicate the hash algorithm that is used in the switch for lookup in our software. Unfortunately the specification is not 100% clear and we can’t find example data or a sample implementation for this.</P><P></P><P><STRONG>What would help us most is example code or at least data to generate the hash or index.</STRONG></P><P></P><P style="padding-left: 30px;"><EM>4.2.6 L2 Address Lookup table</EM></P><P style="padding-left: 30px;"><EM>Table 10</EM></P><P style="padding-left: 30px;"></P><P style="padding-left: 30px;"><EM>Contains the address in physical memory where this entry is stored. The physical address of an entry is calculated as INDEX = 4 x hash (MACADDR, VLANID) + i, where i Є {0;1;2;3}. If more than four MAC address/VLAN IDs pairs produce identical hashes, a different value for the POLY must be chosen or MAC addresses and VLAN IDs of endpoints or default VLANs of switch ports must be changed. If SHARED_LEARN is set, the VLANID portion of the hash computation is set to zero, regardless of the actual VLANID of the frame. The 8-bit CRC hash computation operates on 62 bits consisting of the 48-bit MAC address, 10-bit VLANID and 4 bits padded with 0.</EM></P><P></P><P>We have tried to implement this as specified and are not getting working hash values. The following points are unclear or possibly wrong:</P><P></P><P><STRONG>10-bit VLANID: VLAN IDs are 12 bit and its not clear where these 10bit come from. Are they a subset of the actual VLAN ID or is this wrongly specified and it’s actually 48bit MAC + 12bit Vid + 4 bit padding = 64bit?</STRONG></P><P></P><P>Some more information can be found in:</P><P></P><P style="padding-left: 30px;"><EM>4.2.14 L2 Lookup Parameters</EM></P><P style="padding-left: 30px;"></P><P style="padding-left: 30px;"><EM>This parameter defines the CRC polynomial used to compute the hash value from a MAC/VLAN pair. The polynomial is expected in Koopman notation and is provided in coefficients of degrees 1 to 8 with lower bit positions containing the coefficients of smaller degrees. The coefficient of degree 0 is hard-wired to 1. MAC addresses are fed MSB-first (i.e. first bit on the wire is fed first) to the linear-feedback chain constructed from the polynomial. The polynomial 0x97 resembles the following polynomial: 2^8 +2^5 +2^3 +2^2 +2^1 +1.</EM></P><P></P><P><STRONG>Confusing and incomplete:</STRONG></P><P></P><P style="padding-left: 30px;"><EM>“MAC addresses are fed MSB-first (i.e. first bit on the wire is fed first)”</EM></P><P></P><P>The first bit on the wire for Ethernet is the LSbit of the MSbyte. We tried that and sending the MSBit of the MSByte first and seem not to get working hashes.</P><P></P><P>Beside the problem described above with 10bit vs 12bit for the VLAN id there is <STRONG>no indication in which bit order the VLAN id is to be fed into the polynomial</STRONG>.</P><P></P><P>Thank you for your support.</P><P></P></DIV></DIV></DIV></BODY></HTML>Thu, 25 Oct 2018 14:37:20 GMTsebastien_merle2018-10-25T14:37:20ZClarification of the hash algorithm for L2 Lookup Table Index calculation on the SJA1105TEL
https://community.nxp.com/t5/QorIQ/Clarification-of-the-hash-algorithm-for-L2-Lookup-Table-Index/m-p/834970#M7194
<HTML><HEAD></HEAD><BODY><DIV class=""><DIV class=""><DIV class=""><P>We are trying to figure out how to to programmatically fill the L2 Address Lookup table of the SJA1105TEL switch fabric.</P><P></P><P>In order to achieve this we need to replicate the hash algorithm that is used in the switch for lookup in our software. Unfortunately the specification is not 100% clear and we can’t find example data or a sample implementation for this.</P><P></P><P><STRONG>What would help us most is example code or at least data to generate the hash or index.</STRONG></P><P></P><P style="padding-left: 30px;"><EM>4.2.6 L2 Address Lookup table</EM></P><P style="padding-left: 30px;"><EM>Table 10</EM></P><P style="padding-left: 30px;"></P><P style="padding-left: 30px;"><EM>Contains the address in physical memory where this entry is stored. The physical address of an entry is calculated as INDEX = 4 x hash (MACADDR, VLANID) + i, where i Є {0;1;2;3}. If more than four MAC address/VLAN IDs pairs produce identical hashes, a different value for the POLY must be chosen or MAC addresses and VLAN IDs of endpoints or default VLANs of switch ports must be changed. If SHARED_LEARN is set, the VLANID portion of the hash computation is set to zero, regardless of the actual VLANID of the frame. The 8-bit CRC hash computation operates on 62 bits consisting of the 48-bit MAC address, 10-bit VLANID and 4 bits padded with 0.</EM></P><P></P><P>We have tried to implement this as specified and are not getting working hash values. The following points are unclear or possibly wrong:</P><P></P><P><STRONG>10-bit VLANID: VLAN IDs are 12 bit and its not clear where these 10bit come from. Are they a subset of the actual VLAN ID or is this wrongly specified and it’s actually 48bit MAC + 12bit Vid + 4 bit padding = 64bit?</STRONG></P><P></P><P>Some more information can be found in:</P><P></P><P style="padding-left: 30px;"><EM>4.2.14 L2 Lookup Parameters</EM></P><P style="padding-left: 30px;"></P><P style="padding-left: 30px;"><EM>This parameter defines the CRC polynomial used to compute the hash value from a MAC/VLAN pair. The polynomial is expected in Koopman notation and is provided in coefficients of degrees 1 to 8 with lower bit positions containing the coefficients of smaller degrees. The coefficient of degree 0 is hard-wired to 1. MAC addresses are fed MSB-first (i.e. first bit on the wire is fed first) to the linear-feedback chain constructed from the polynomial. The polynomial 0x97 resembles the following polynomial: 2^8 +2^5 +2^3 +2^2 +2^1 +1.</EM></P><P></P><P><STRONG>Confusing and incomplete:</STRONG></P><P></P><P style="padding-left: 30px;"><EM>“MAC addresses are fed MSB-first (i.e. first bit on the wire is fed first)”</EM></P><P></P><P>The first bit on the wire for Ethernet is the LSbit of the MSbyte. We tried that and sending the MSBit of the MSByte first and seem not to get working hashes.</P><P></P><P>Beside the problem described above with 10bit vs 12bit for the VLAN id there is <STRONG>no indication in which bit order the VLAN id is to be fed into the polynomial</STRONG>.</P><P></P><P>Thank you for your support.</P><P></P></DIV></DIV></DIV></BODY></HTML>Thu, 25 Oct 2018 14:37:20 GMThttps://community.nxp.com/t5/QorIQ/Clarification-of-the-hash-algorithm-for-L2-Lookup-Table-Index/m-p/834970#M7194sebastien_merle2018-10-25T14:37:20Z