Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Zynq Ultrascale port for V4.x and Clean up #1187

Merged
merged 14 commits into from
Oct 3, 2024
Merged
2 changes: 2 additions & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ DIVIDEBY
DIVIDEDBY
DLPSTATE
DMAARBITRATION
DMAB
DMABD
DMABMR
DMAC
Expand Down Expand Up @@ -1562,6 +1563,7 @@ x
xaxiemacif
XCOL
xemac
XEMACMAP
xemacps
XEMACPS
xemacpsp
Expand Down
54 changes: 32 additions & 22 deletions source/portable/NetworkInterface/Zynq/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,40 +256,50 @@ static BaseType_t xZynqNetworkInterfaceInitialise( NetworkInterface_t * pxInterf

#if ( ipconfigUSE_LLMNR == 1 )
{
/* Also add LLMNR multicast MAC address. */
#if ( ipconfigUSE_IPv6 == 0 )
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddress.ucBytes );
}
#else
{
NetworkEndPoint_t * pxEndPoint;
NetworkInterface_t * pxInterface = pxMyInterfaces[ xEMACIndex ];

for( pxEndPoint = FreeRTOS_FirstEndPoint( pxInterface );
pxEndPoint != NULL;
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )
{
if( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED )
{
unsigned char ucMACAddress[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
ucMACAddress[ 3 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 13 ];
ucMACAddress[ 4 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 14 ];
ucMACAddress[ 5 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 15 ];
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucMACAddress );
}
}

XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddressIPv6.ucBytes );
}
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above is not correct, think of this:

    #if( ipconfigUSE_LLMNR == 1 )
    {
        #if( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) )
        {
            XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddress.ucBytes );
        }
        #endif

        #if( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
        {
            XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddressIPv6.ucBytes );
        }
        #endif
    }
    #endif /* ipconfigUSE_LLMNR == 1 */

It means that LLMNR can be enabled for IPv4 and on IPv6 at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course IPv4 and v6 can be both enabled. Done

}
#endif /* ipconfigUSE_LLMNR == 1 */

#if ( ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_IPv6 != 0 ) )
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
#endif
#if ( ipconfigUSE_MDNS == 1 )
{
#if ( ipconfigUSE_IPv6 == 0 )
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
}
#else
{
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
}
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
}
#endif /* ( ipconfigUSE_MDNS == 1 ) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also here:

    #if ( ipconfigIS_ENABLED( ipconfigUSE_MDNS ) )
        #if ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) )
        {
            XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
        }
        #endif

        #if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
        {
            XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MACAddressIPv6.ucBytes );
        }
        #endif
    #endif /* ipconfigUSE_MDNS */    

MDNS can also be active on both IP-versions.


#if ( ipconfigUSE_IPv6 != 0 )
{
/* set the solicited-node multicast address */
for( NetworkEndPoint_t * pxEndPointIter = FreeRTOS_FirstEndPoint( pxInterface );
pxEndPointIter != NULL;
pxEndPointIter = FreeRTOS_NextEndPoint( pxInterface, pxEndPointIter ) )
{
if( pxEndPointIter->bits.bIPv6 != pdFALSE_UNSIGNED )
{
unsigned char ucSsolicitedNodeMAC[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
ucSsolicitedNodeMAC[ 3 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 13 ];
ucSsolicitedNodeMAC[ 4 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 14 ];
ucSsolicitedNodeMAC[ 5 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 15 ];
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucSsolicitedNodeMAC );
}
}
}
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */

pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint );

Expand Down
Loading
Loading