Allocates an mbuf structure and attaches an external cluster.
Item | Description |
---|---|
ext_buf | Specifies the address of the external data area. |
ext_free | Specifies the address of a function to be called when this mbuf structure is freed. |
ext_size | Specifies the length of the external data area. |
ext_arg | Specifies an argument to pass to the above function. |
wait | Specifies either the M_WAIT or M_DONTWAIT value. |
The m_clattach kernel service allocates an mbuf structure and attaches the cluster specified by the ext_buf parameter. This data is owned by the caller. The m_data field of the returned mbuf structure points to the caller's data. Interrupt handlers can call this service only with the wait parameter set to M_DONTWAIT.
The calling function is required to fill out the mbuf structure sufficiently to support normal usage. This includes support for the DMA functions during network transmission. To support DMA functions, the ext_hasxm flag field needs to be set to true and the ext_xmemd structure needs to be filled out. For buffers allocated from the kernel pinned heap, the ext_xmemd.aspace_id field should be set to XMEM_GLOBAL.
The m_clattach kernel service can be called from either the process or interrupt environment.
The m_clattach kernel service returns the address of an allocated mbuf structure. If the wait parameter is set to M_DONTWAIT and there are no free mbuf structures, the m_clattach service returns null.