Netx packet pool depletion.

Hi all,

I am using Netx duo IP instance for TCP and UDP communication on synergy SK-S7G2 board. After a lot of packet transmission i have observed that associated packet pool gets depleted and hence my communication stops. In the packets pool configuration i have set Packet Size(in bytes) = 1568, Number of Packets in pool = 80.

Initially Number of Packets in pool were 32 which i increased to 80. Doing this the program is able to communicate fro a longer time but still the pool gets depleted.

After every UDP and TCP receive i am releasing the packet, and i understand there is no need to release the packet when we send. But to send a packet out i need to Allocate memory from the pool and then append the data, so during allocation the pool gets depleted. Am ultimately becomes empty.

Is there any way to solve this issue? Am i doing something wrong? Any technical help would be very helpful. 

Parents
  • I think the problem is in receive process, is important that:

    *** nx_udp_socket_receive - If status is NX_SUCCESS, the received UDP packet is pointed to by packet_ptr. the application is responsible for releasing the received packet when it is no longer needed ***


    /* Receive a packet from a previously created and bound UDP socket. If no packets are currently available, wait for 500 timer ticks before giving up. */

    status = nx_udp_socket_receive(&udp_receive_socket, &packet_ptr, NX_WAIT_FOREVER);
    /* If status is NX_SUCCESS, the received UDP packet is pointed to by packet_ptr. the application is responsible for releasing the received packet when it is no longer needed*/

    if (status == NX_SUCCESS)
    {
    /* Retrieve data from packet pointed to by "packet_ptr". */
    status = nx_packet_data_retrieve(packet_ptr, udpBufferMsg, &bytesRx);

    /* This service copies data from the supplied packet into the supplied buffer.
    The actual number of bytes copied is returned in the destination pointed to by bytes_copied */

    if ((status == NX_SUCCESS) && (bytesRx == ****DESIRED****)
    {

    ***** PROCESS PAYLOAD *****


    if (answer)
    {
    **** REPLY ****
    }

    /* Check for UDP enable errors. */

    nx_packet_release(packet_ptr); <-------- *** IMPORTANT *****
    }
    }

    I hope to be proved helpful,
    Simone
  • Hi simone, thanks for the response.
    I am releasing the packet after receive is successful, nx_udp_socket_receive , nx_udp_source_extract and nx_packet_release are being called respectively when UDP packet is received. The problem i faced while debugging in e2 studio was that the Packet Pool associated with Netx duo IP instance gets depleted such there is no more memory available when nx_packet_allocate is trying to allocate some memory for outgoing UDP socket.
    For sending i am using nx_packet_allocate , nx_packet_data_append , nx_udp_socket_send api's respectively. Hope my question is clear.
Reply
  • Hi simone, thanks for the response.
    I am releasing the packet after receive is successful, nx_udp_socket_receive , nx_udp_source_extract and nx_packet_release are being called respectively when UDP packet is received. The problem i faced while debugging in e2 studio was that the Packet Pool associated with Netx duo IP instance gets depleted such there is no more memory available when nx_packet_allocate is trying to allocate some memory for outgoing UDP socket.
    For sending i am using nx_packet_allocate , nx_packet_data_append , nx_udp_socket_send api's respectively. Hope my question is clear.
Children
  • This is an example of the function I use for transmission. At the beginning I also had a similar problem but then using the structure of the functions indicated to receive and transmit the problem was solved.
    Do you manage the release of the package in the event of a transmission error?

    My Function to send data :

    //:*****************************************************************************************************************************************
    UINT UDP_MulticastSendData(uint8_t* bufferData, ULONG lenData, ULONG addressIP, UINT port)
    {
    UINT status;
    NX_PACKET *packet_ptr;
    NXD_ADDRESS debug_slave_address;

    /* Imposto indirizzo di destinazione del pacchetto da inviare */
    debug_slave_address.nxd_ip_address.v4 = addressIP;
    debug_slave_address.nxd_ip_version = NX_IP_VERSION_V4;

    /* Allocate a packet. */
    status = nx_packet_allocate(&g_packet_pool1, &packet_ptr, NX_UDP_PACKET, 200); // NX_WAIT_FOREVER

    /* Check for error. */
    if (status == SSP_SUCCESS)
    {
    /* Place data in the packet. */
    status = nx_packet_data_append(packet_ptr, bufferData, lenData, &g_packet_pool1, NX_WAIT_FOREVER);

    if (status == SSP_SUCCESS)
    {
    status = nxd_udp_socket_send(&udp_multicast_socket, packet_ptr, &debug_slave_address, port);
    }
    /* Check for UDP enable errors. */
    if (status)
    {
    nx_packet_release(packet_ptr);
    }
    }

    return status;
    }
  • If Simone's logic doesn't nail doesn't the problem, a useful debugging technique is to use separate packet pools for receiving and transmitting packets. This will isolate which one is getting depleted. Proper handling of packets (and correct driver logic) should ensure neither pool is depleted.

    How large is the data you are appending to outgoing packets?

    Janet
  • Hi Janet, thanks for the suggestion. For Receiving udp packets i am not using any packet pool , just a Packet pointer is being used. Is this correct ??? As soon as i receive the packet i am extracting it and releasing the packet, no packet pool is used here. Am i ryt !!!! Should i change something???
  • Thank you Simone, if u share the code snippet for UDP receive as well,it would be very helpful.
  • The packet pool used for receiving in Synergy network drivers is the one used by the IP instance, so no worries there. You assign how big and how many packets are in this packet pool in the configurator.

    However, in your application you can also create a separate packet pool for transmitting packets from the X-ware tab: (X-ware -> NetX (Duo) -> NetX (Duo) Packet Pool. Then when you want to send out a packet, allocate the packet from that packet pool, and send the packet out.

    Now you can keep track of which packet is being depleted and try to zero in on the problem. I can't think of what might be causing the problem if you are using Simone's pseudo code but I'll be following this post.

    Janet
  • Hi, I don't know what you mean by the UDP reception code except what I had indicated above as a pseudo code.
    However, for example, I am attaching the task I use to perform a multicast UDP reception of commands from my work task on a project I am following.
    The non-multicast UDP reception differs simply from the fact that the JOIN operation is not necessary then everything is the same.

    The same goes for the difference between UDP send and UDP multicast is only relative to the group of IP addresses used, the functions are the same.

    The packet pool I allocated in the external SDRAM memory to be able to do very large having a very high flow of data and then I have a whole management of functions to check for any disconnections and network reconnection.

    There will certainly be more code than you need, but I hope it can be useful in some way.

    Simone

    ************************************************************************************************************+




    #define LINK_AND_INTERFACE_ENABLE_DONE (NX_IP_LINK_ENABLED | NX_IP_INTERFACE_LINK_ENABLED | NX_IP_INITIALIZE_DONE)


    #define FORK_IP_ADDRESS IP_ADDRESS(192,168,100,10) /*!< Ip Address PC Debug use */


    #define ETH_PACK_SIZE 1568 /*!< The internal structure of an Ethernet frame is specified in IEEE 802.3
    where the maximum size of payload is defined as 1500bytes.
    Add 0x38 (56 dez) for the ETH, IP and UDP / TCP Header
    Then to be on the save side align to a 32byte value which results in 1568. */

    #define EXT_POOL_MEMORY_MSG 512 /*!< Memory message number allocated in pool in external memory */


    /*! ****************************************************************************************************************************************
    \brief Entry Point del task NETXDUO_Thread.
    \details La funzione rappresenta l'entrata del task NETXDUO_Thread dopo le inizializzazioni dell'ambiente SSP Renesas.
    \return void - nessuno
    */
    //:*****************************************************************************************************************************************
    void NETXDUO_Thread_entry(void)
    {
    ssp_err_t status;
    ULONG bytesRx;
    NX_PACKET *packet_ptr;

    // NX_PACKET *receive_packet;
    // NXD_ADDRESS slave_address;
    // ULONG source_ip_address;
    // UINT source_udp_port;

    uint8_t answer = false;

    uint8_t TransmitPower;
    uint8_t TransmitPower4;
    uint8_t invSearchMode;
    uint16_t ModeIndex;

    /* Send Thread Identify Information */
    PrintThreadIdentify(msgBuffer);

    /* Create packet pool on ext memory */
    packet_pool1_init_ext();

    /** Create an IP instance: IP1 - Call initialization function if user has selected to do so. */
    ip_init1();

    SendDebugMessage("IP1 - NETX - Start\n\r");

    /* Previously created IP Instance ip_1 joins the multicast group REMOTE_CMD_MULTICAST_ADDRESS */
    status = nx_igmp_multicast_join(&g_ip1, REMOTE_CMD_MULTICAST_ADDRESS);
    /* If status is NX_SUCCESS, this IP instance has successfully joined the multicast group REMOTE_CMD_MULTICAST_ADDRESS. */

    if (status == NX_SUCCESS) // init is done go to next step ...
    {
    SendDebugMessageData(msgBuffer, "nx_igmp_multicast_join [0x%02X]\n\r", status);
    }

    while (true)
    {
    /* Attendo che l'interfaccia IP sia pronta */
    status = nx_ip_interface_status_check(&g_ip1, 0, LINK_AND_INTERFACE_ENABLE_DONE, (ULONG *)&IP1_link_status, NX_NO_WAIT);

    if ((status == NX_SUCCESS) && (IP1_link_status == LINK_AND_INTERFACE_ENABLE_DONE)) // init is done go to next step ...
    {
    SendDebugMessageData(msgBuffer, "WAIT LINK : nx_ip_interface_status_check IP1 [0x%02X]\n\r", IP1_link_status);
    break;
    }

    SendDebugMessageData(msgBuffer, "WAIT LINK : nx_ip_interface_status_check IP1 [0x%02X]\n\r", IP1_link_status);

    tx_thread_sleep(nx_ms_to_ticks(2000));
    }

    // UpdateLedLink1StatusCallback();

    /* Creazione del socket UDP */
    SocketCreateAndBind(&g_ip1, &udp_multicast_socket, UDP_SOURCER_PORT);

    /* Creazione del socket UDP in ricezione */
    SocketCreateAndBind(&g_ip1, &udp_receive_socket, REMOTE_CMD_UDP_DESTINATION_PORT);

    SendDebugMessage("IP1 DEBUG Istance - Started\n\r");

    /* ******************************************************** Thread MAIN LOOP ******************************************************** */
    while (true)
    {
    /* Receive a packet from a previously created and bound UDP socket. If no packets are currently available, wait for 500 timer ticks before giving up. */
    status = nx_udp_socket_receive(&udp_receive_socket, &packet_ptr, NX_WAIT_FOREVER);
    /* If status is NX_SUCCESS, the received UDP packet is pointed to by packet_ptr. the application is responsible for releasing
    the received packet when it is no longer needed*/

    if (status == NX_SUCCESS)
    {
    /* Retrieve data from packet pointed to by "packet_ptr". */
    status = nx_packet_data_retrieve(packet_ptr, udpBufferMsg, &bytesRx);
    /* This service copies data from the supplied packet into the supplied buffer.
    The actual number of bytes copied is returned in the destination pointed to by bytes_copied */

    // SendDebugStatusMessage(msgBuffer, "nx_packet_data_retrieve bytesRx=[%d]\n\r", bytesRx);
    answer = false;

    if ((status == NX_SUCCESS) && (bytesRx == sizeof(sRemoteCommand)))
    {
    answer = true;
    memcpy((uint8_t*)&remoteCommand, udpBufferMsg, sizeof(sRemoteCommand));

    #if 0
    nx_udp_source_extract(packet_ptr, &source_ip_address, &source_udp_port);


    sprintf(msgBuffer, "nx_udp_source_extract source_ip_address=[%d.%d.%d.%d] source_udp_port=[%d]\n\r",
    (uint8_t)((source_ip_address >> 24) & 0xFF),
    (uint8_t)((source_ip_address >> 16) & 0xFF),
    (uint8_t)((source_ip_address >> 8) & 0xFF),
    (uint8_t)((source_ip_address >> 0) & 0xFF), source_udp_port);
    SendDebugMessage(msgBuffer);

    sprintf(msgBuffer, "cmdID=[%04X]-subCmdID=[%04X]-Data=[%d]-crcCCITT=[%04X]\n\r",
    remoteCommand.cmdID, remoteCommand.subCmdID, remoteCommand.data, remoteCommand.crcCCITT);

    SendDebugMessage(msgBuffer);
    #endif

    /* ------------------------------------------------- CMD ID ------------------------------------------------- */
    switch (remoteCommand.cmdID)
    {
    case ESPEED_CMD_ID:

    /* ------------------------------------------------- SUB CMD ID ------------------------------------------------- */
    switch (remoteCommand.subCmdID)
    {
    case RESET_SUBCMD_ID:
    eSpeed_SendResetAndInitBoard();
    break;
    case SET_MODE_SUBCMD_ID:
    eSpeed_SetModeOperation(remoteCommand.data);
    break;
    case SET_LED_SUBCMD_ID:
    eSpeed_SyncSetLedLuminosity((uint8_t)remoteCommand.data);
    break;
    case SET_HEIGHT_SUBCMD_ID:
    eSpeed_SyncGetSetHeight(HEIGHT_MEASURE_REQ);
    break;
    case SET_RESOL_SUBCMD_ID:
    eSpeed_SyncSetCountResolutionLSB_U32(remoteCommand.data);
    break;
    case SET_FRAME_RATE:
    eSpeed_SetFrameRate((uint16_t)remoteCommand.data);
    break;
    case SET_SHUTTER:
    eSpeed_SetShutter((uint16_t)remoteCommand.data);
    break;
    case ZERO_MOVE:
    eSpeed_SendZeroCount();
    break;
    case INC_ACC_SCALE:
    eSpeed_SendIncAccScale();
    break;
    case INC_GYRO_SCALE:
    eSpeed_SendIncGyroScale();
    break;
    case DEBUG_SPI:
    eSpeed_ReadDebugSpiRegister();
    break;

    default:
    answer = false;
    break;
    }
    break;
    /* ------------------------------------------------- SUB CMD END ------------------------------------------------- */

    case RFID_CMD_ID:

    /* ------------------------------------------------- SUB CMD ID ------------------------------------------------- */
    switch (remoteCommand.subCmdID)
    {
    case ENABLE_FORK_POS:
    READER_EnableDisableRO_SPEC(ENABLE_RO, ROSpecID_FORK_POS);
    break;
    case DISABLE_FORK_POS:
    READER_EnableDisableRO_SPEC(DISABLE_RO, ROSpecID_FORK_POS);
    break;
    case ENABLE_FORK_PALLET:
    READER_EnableDisableRO_SPEC(ENABLE_RO, ROSpecID_FORK_PALLET);
    break;
    case DISABLE_FORK_PALLET:
    READER_EnableDisableRO_SPEC(DISABLE_RO, ROSpecID_FORK_PALLET);
    break;
    case ENABLE_FORK_POS_PALLET:
    READER_EnableDisableRO_SPEC(ENABLE_RO, ROSpecID_FORK_POS_PALLET);
    break;
    case DISABLE_FORK_POS_PALLET:
    READER_EnableDisableRO_SPEC(DISABLE_RO, ROSpecID_FORK_POS_PALLET);
    break;
    case RFID_CONFIG:
    TransmitPower = (uint8_t)((remoteCommand.data >> 24) & 0xFF);
    TransmitPower = (uint8_t)(1 + (TransmitPower - 10) * 4);
    TransmitPower4 = (uint8_t)((remoteCommand.data >> 16) & 0xFF);
    TransmitPower4 = (uint8_t)(1 + (TransmitPower4 - 10) * 4);
    invSearchMode = (uint8_t)((remoteCommand.data >> 8) & 0xFF);
    ModeIndex = (uint8_t)((remoteCommand.data >> 0) & 0xFF);
    if (ModeIndex == 5)
    ModeIndex = 1000;
    else if (ModeIndex >= 6)
    ModeIndex = (uint8_t)(ModeIndex - 6 + 1002);
    READER_CONFIG_SPEC(TransmitPower,TransmitPower4,invSearchMode,ModeIndex);
    break;

    default:
    answer = false;
    break;
    }
    break;
    /* ------------------------------------------------- SUB CMD END ------------------------------------------------- */

    default:
    answer = false;
    break;
    }
    }
    else
    {
    /* Invio informazioni relativi all'errore */
    SendDebugMessage2Data(msgBuffer, "ERR: nx_packet_data_retrieve status [0x%02X] - bytesRx=[%d]\n\r", status, bytesRx);
    }

    if (answer)
    {
    SendDebugMessageData(msgBuffer, remote_subcmdID_str[remoteCommand.subCmdID], remoteCommand.data);
    }

    /* Check for UDP enable errors. */
    nx_packet_release(packet_ptr);
    }
    }
    }


    //:*****************************************************************************************************************************************
    void UpdateLedLink1StatusCallback()
    {
    // ssp_err_t status;

    /* Phy_GetLinkStatus - Returns the status of the physical link. Recupero lo stato del link associato alle due interfacce ethernet del physical layer
    - R_PHY_OK PHY device is initialized successfully
    - R_PHY_ERROR PHY device is not initialized successfully
    */
    linkChannel1 = bsp_ethernet_phy_get_link_status(1);

    if (linkChannel1 == R_PHY_OK)
    {
    g_ioport.p_api->pinWrite(IOPORT_PORT_08_PIN_09, IOPORT_LEVEL_HIGH); ///< LED2_G
    g_ioport.p_api->pinWrite(IOPORT_PORT_08_PIN_10, IOPORT_LEVEL_LOW); ///< LED2_R

    SendDebugMessage("IP1 LINK - HOST - OK\n\r");
    }
    else
    {
    g_ioport.p_api->pinWrite(IOPORT_PORT_08_PIN_09, IOPORT_LEVEL_LOW); ///< LED2_G
    g_ioport.p_api->pinWrite(IOPORT_PORT_08_PIN_10, IOPORT_LEVEL_HIGH); ///< LED2_R

    SendDebugMessage("IP1 LINK - HOST - ERROR\n\r");
    }
    }



    /*! ****************************************************************************************************************************************
    \brief Effettua le operazioni di creazione e bind di un socket UDP.
    \details La funzione chiama le primitive NETX per eseguire le operazioni di create e bind del socket UDP.
    \param ip_ptr[OUT] - puntatore alla struttura NX_IP
    \param socket_ptr[OUT] - puntatore alla struttura NX_UDP_SOCKET
    \return UINT - codice d'errore dell'API NetX
    */
    //:*****************************************************************************************************************************************
    UINT SocketCreateAndBind(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, UINT port)
    {
    UINT status;

    /* Creo il socket per la comunicazione UDP */
    status = nx_udp_socket_create(ip_ptr, socket_ptr, "UDP Socket", NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, MAX_QUEUE_UDP_PACKET);

    /* Check for UDP enable errors. */
    if (status != NX_SUCCESS)
    {
    SendDebugMessageData(msgBuffer, "nx_udp_socket_create error [0x%02X]\n\r", status);
    return status;
    }

    /* Bind the previously created UDP socket to port 11000 on the previously created IP instance. If the port is already bound,
    wait for 300 timer ticks before giving up. */
    status = nx_udp_socket_bind(socket_ptr, port, UDP_SOCKET_BIND_TIME_OUT);

    if (status != NX_SUCCESS)
    {
    SendDebugMessageData(msgBuffer, "nx_udp_socket_bind error [0x%02X]\n\r", status);
    return status;
    }

    /* Check for UDP enable errors. */
    status = nx_udp_socket_checksum_enable(&udp_multicast_socket);

    if (status != NX_SUCCESS)
    {
    SendDebugMessageData(msgBuffer, "nx_udp_socket_checksum_enable error [0x%02X]\n\r", status);
    }

    return status;
    }



    /*! ****************************************************************************************************************************************
    \brief Effettua l'unbind e la delete le socket UDP passato per riferimento.
    \details La funzione chiama le primitive NETX per eseguire le operazioni di unbind e delete del socket UDP.
    \param socket_ptr[OUT] - puntatore alla struttura NX_UDP_SOCKET
    \return UINT - codice d'errore dell'API NetX
    */
    //:*****************************************************************************************************************************************
    UINT SocketUnboundAndDelete(NX_UDP_SOCKET *socket_ptr)
    {
    UINT status;

    /* This service releases the binding between the UDP socket and a UDP port.
    Any received packets stored in the receive queue are released as part of the unbind operation. */
    status = nx_udp_socket_unbind(socket_ptr);

    if (status != NX_SUCCESS)
    {
    SendDebugMessageData(msgBuffer, "nx_udp_socket_unbind error [0x%02X]\n\r", status);
    }

    /* This service deletes a previously created UDP socket. If the socket was bound to a port, the socket must be unbound first */
    status = nx_udp_socket_delete(socket_ptr);

    /* Check for UDP enable errors. */
    if (status != NX_SUCCESS)
    {
    SendDebugMessageData(msgBuffer, "nx_udp_socket_delete error [0x%02X]\n\r", status);
    }

    return status;
    }



    //:*****************************************************************************************************************************************
    UINT UDP_MulticastSendData(uint8_t* bufferData, ULONG lenData, ULONG addressIP, UINT port)
    {
    UINT status;
    NX_PACKET *packet_ptr;
    NXD_ADDRESS debug_slave_address;

    /* Imposto indirizzo di destinazione del pacchetto da inviare */
    debug_slave_address.nxd_ip_address.v4 = addressIP;
    debug_slave_address.nxd_ip_version = NX_IP_VERSION_V4;

    /* Allocate a packet. */
    status = nx_packet_allocate(&g_packet_pool1, &packet_ptr, NX_UDP_PACKET, 200); // NX_WAIT_FOREVER

    /* Check for error. */
    if (status == SSP_SUCCESS)
    {
    /* Place data in the packet. */
    status = nx_packet_data_append(packet_ptr, bufferData, lenData, &g_packet_pool1, NX_WAIT_FOREVER);

    if (status == SSP_SUCCESS)
    {
    status = nxd_udp_socket_send(&udp_multicast_socket, packet_ptr, &debug_slave_address, port);
    }
    /* Check for UDP enable errors. */
    if (status)
    {
    nx_packet_release(packet_ptr);
    }
    }

    return status;
    }



    /*! ****************************************************************************************************************************************
    \brief Funzione di inizializzazione per il packet_pool1 per l'utilizzo della memoria esterna su SRAM.
    \details La funzione chiama la primitiva NETX "nx_packet_pool_create" per creare del packet pool NETX su IP1.
    \return UINT - codice d'errore dell'API NetX
    */
    //:*****************************************************************************************************************************************
    UINT packet_pool1_init_ext(void)
    {
    UINT g_packet_pool1_err;
    /* Create Client packet pool. */
    g_packet_pool1_err = nx_packet_pool_create (&g_packet_pool1, "g_packet_pool_ext Packet Pool", ETH_PACK_SIZE,
    &g_packet_pool_pool_ext_memory[0], (EXT_POOL_MEMORY_MSG * (ETH_PACK_SIZE + sizeof(NX_PACKET))));
    if (NX_SUCCESS != g_packet_pool1_err)
    {
    g_packet_pool1_err_callback ((void *) &g_packet_pool1, &g_packet_pool1_err);
    }

    return g_packet_pool1_err;
    }


    /*! ****************************************************************************************************************************************
    \brief Funzione di RE-inizializzazione per il packet_pool1 per l'utilizzo della memoria esterna su SRAM.
    \details La funzione chiama le primitive NETX per eseguire le operazioni di delete e create del packet pool NETX.
    \return UINT - codice d'errore dell'API NetX
    */
    //:*****************************************************************************************************************************************
    UINT PacketPoolDeleteAndCreate()
    {
    UINT status;

    status = nx_packet_pool_delete(&g_packet_pool1);
    memset(&g_packet_pool1, 0, sizeof(g_packet_pool1));

    SendDebugMessageData(msgBuffer, "nx_packet_pool_delete [0x%02X]\n\r", status);

    status = nx_packet_pool_create(&g_packet_pool1, "g_packet_pool0 Packet Pool", ETH_PACK_SIZE,
    &g_packet_pool1_pool_memory[0], (128 * (ETH_PACK_SIZE + sizeof(NX_PACKET))));

    SendDebugMessageData(msgBuffer, "nx_packet_pool_create [0x%02X]\n\r", status);

    return status;
    }

    /*! ****************************************************************************************************************************************
    \brief Funzione di RE-inizializzazione per il packet_pool con passaggio parametri.
    \details La funzione chiama le primitive NETX per eseguire le operazioni di delete e create del packet pool NETX.
    \param pPacketPool[IN] - istanza del packet pool su cui operare
    \param packetPoolMemory[IN] - buffer di memoria da associare al packet pool
    \param packetNumber[IN] - numero di pacchetti da allocare nel pool
    \return UINT - codice d'errore dell'API NetX
    */
    //:*****************************************************************************************************************************************
    UINT PacketPoolDeleteAndCreateParam(NX_PACKET_POOL* pPacketPool, uint8_t packetPoolMemory[], uint32_t packetNumber)
    {
    UINT status;

    status = nx_packet_pool_delete(pPacketPool);
    memset(pPacketPool, 0, sizeof(NX_PACKET_POOL));

    SendDebugMessageData(msgBuffer, "nx_packet_pool_delete [0x%02X]\n\r", status);

    status = nx_packet_pool_create(pPacketPool, "g_packet_pool0 Packet Pool", ETH_PACK_SIZE,
    packetPoolMemory, (packetNumber * (ETH_PACK_SIZE + sizeof(NX_PACKET))));

    SendDebugMessageData(msgBuffer, "nx_packet_pool_create [0x%02X]\n\r", status);

    return status;
    }
  • I looked at the code above and I don't see anything above that would cause a packet leak . I don't see the use of a separate packet pool for packet transmission. I see a function that deletes and recreates a packet pool but that doesn't seem to create separate concurrent packet pools. So without any new information I cannot offer any suggestions as to what might be causing the leak.

    Also when joining a multicast group, NetX handles queries and join messages internally and the application should not interfere with that. Not sure if that is happening above but occasionally people try to manage IGMP from the application level instead of letting NetX do so.

    Janet
  • Hello JanetC,

    Was this problem resolved.

    I also have similar issue. I have MODBUS TCP server (s7G2) and it  looses IP pool assigned to send replies and stops working after some time.

    Please provide a link to solution for the problem.

    Thanks in advance

    Vijay

  • Hi VK-

    Please start a new thread since this post is very old.

  • Hi Warren,

    Please follow this thread, We created this as per your Suggestion,

    community.renesas.com/.../ip-pool-depletion