Part Number: AM2432
Hi
I am using AM2432 with the Industrial SDK 11.00.00.08.
Our product uses the HSR and PRP stack. We are conducting Storm Tests to verify the robustness of our device (such as ARP Storm Requests).
At first, during storm requests this error appeared:
[LWIPIF_LWIP]ERROR: Rx Pbuf_alloc() in LWIPIF_LWIP_INPUT failure.!
pbuf_free: p->ref > 0ASSERT: 85.697915s: C:/am243x-mcu-plus-sdk/mcu_plus_sdk/source/networking/lwip/lwip-stack/src/core/pbuf.c:pbuf_free:755: 0 failed !!!
I suppose it was because there wasn't any more memory left to allocate to the packets.
I noticed, however, that the Profinet demo enabled storm prevention, so I added the function:
{
...
if(status == SystemP_SUCCESS)
{
RedProtocolStart(&hsrPrphandle, prusshandle);
/*Load the default PCP to Queue mapping*/
hsrprp_loadPCPtoQueueMap(emachandle, default_pcp_2_queue_map);
hsrprp_enableBroadcastStormPrevention(emachandle);
}
...
}
static int32_t hsrprp_enableBroadcastStormPrevention(ICSS_EMAC_Handle emacHandle)
{
ICSS_EMAC_IoctlCmd ioctlParams;
ICSS_EMAC_StormPrevention *stormPrevention;
int32_t status;
ioctlParams.command = ICSS_EMAC_STORM_PREV_CTRL_INIT_BC;
ioctlParams.ioctlVal = NULL;
status = ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_1, &ioctlParams);
status &= ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_2, &ioctlParams);
if (status == SystemP_SUCCESS)
{
stormPrevention = (ICSS_EMAC_StormPrevention *)((ICSS_EMAC_Object *)emacHandle->object)->stormPrev;
stormPrevention[0].creditsBC = 100U;
stormPrevention[1].creditsBC = 100U;
ioctlParams.command = ICSS_EMAC_STORM_PREV_CTRL_RESET_BC;
status = ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_0, &ioctlParams);
}
if (status == SystemP_SUCCESS)
{
ioctlParams.command = ICSS_EMAC_STORM_PREV_CTRL_INIT_UC;
status = ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_1, &ioctlParams);
status &= ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_2, &ioctlParams);
}
if (status == SystemP_SUCCESS)
{
stormPrevention[0].creditsUC = 100U;
stormPrevention[1].creditsUC = 100U;
ioctlParams.command = ICSS_EMAC_STORM_PREV_CTRL_RESET_UC;
status = ICSS_EMAC_ioctl(emacHandle, ICSS_EMAC_IOCTL_STORM_PREV_CTRL, ICSS_EMAC_PORT_0, &ioctlParams);
}
if (status != SystemP_SUCCESS)
{
DebugP_log("Failed to enable ICSS EMAC broadcast storm prevention\r\n");
}
return status;
}
I didn't add the credit refresh part that's in the specific Profinet task PN_background_task, because I saw that it's already handled in Lwip2Emac_periodicFxn().
In this way the failed assert no longer occurs. However, I noticed that it still doesn't reply to ping during the storms, whereas with Profinet it was able to respond even during a storm.
How can I investigate this further? What am I missing?
Thank you,
Best Regards,
Andrea