This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PBM_alloc() for transmit packets

I’m working with the NDK version 1.9, adding support for IPsec, which requires increasing the data buffer size of outgoing packets to leave room for extra headers. I believe I need to increase the size passed to PBM_alloc(). Is there a  central place in the NDK HAL where that alloc is called for transmit packets?

  • Tim,

    I see that the PBM_alloc() function is called within the Ethernet driver code in two places:

    A. HwPktOpen() - this opens and configures the EMAC

    B. RxPacket() - passes a received packet to the driver

    In the stack itself, PBM_alloc is called indirectly by several layers - e.g. ICMP, IGMP, IP.  This is done via the API:

    PBM_Pkt* NIMUCreatePacket (uint packet_size)

    It sounds to me like the IPsec will be a new module you're adding to the stack, and should probably follow suit by call NIMUCreatePacke() to allocate your packet.

    Which exact version of NDK 1.9x are you using?  Do you have the stack source code?

    Just FYI, NDK 1.9x is pretty old at this point, and there have been many newer releases since then which ship with full source code.  (the current version is NDK 2.20)

    Lastly, I did see a FAQ about receiving large ping packets, which may be related to what you want to do.  It's in the NDK User's Guide (spru524_ug.pdf) in Section 3.4 Application Debug and Troubleshooting.  I've pasted this below:


    Pings to NDK target Fails Beyond 3012 Size
    The NDK's default configuration allows reassembly of packets up to "3012" bytes. To be able to ping
    bigger sizes, the stack needs to be reconfigured as follows:
    · Change the "MMALLOC_MAXSIZE" definition in "pbm.c" file. (i.e. #define MMALLOC_MAXSIZE
    · Change the "RAW_PAGE_SIZE" definition in "mem.c" file. (i.e. #define RAW_PAGE_SIZE 65504)
    · Rebuild the OSAL libary as explained in this User's Guide's Section 1.2.2
    · Configure "CFGITEM_IP_IPREASMMAXSIZE" accordingly to set maximum IP reassembly size.
    For instance, the following code sample configures IP reassembly maximum size up to 65,500 bytes:
    uint tmp = 65500;
    CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8*) &tmp, 0);