Intel IXP400 Frozen Dessert Maker User Manual


 
Intel
®
IXP400 Software
Buffer Management
April 2005 IXP400 Software Version 2.0 Programmer’s Guide
48 Document Number: 252539, Revision: 007
It works on the following principles:
Each IXP_BUF is mapped to an skbuff (1:1 mapping)
The os_buf_ptr field of the ix_ctrl structure is used to store a pointer to the corresponding
skbuff.
The ix_data pointer field of the IX_MBUF structure within the IXP_BUF structure will be set
to point to the data field of the corresponding skbuff through use of the
IX_OSAL_MBUF_MDATA macro.
The ix_len and ix_pkt_len fields of the IX_MBUF structure within the IXP_BUF structure
will be set to the length of the skbuff data section (the len field in the skbuff structure) through
use of the IX_OSAL_MBUF_PKT_LEN and IX_OSAL_MBUF_MLEN macros.
The prototype for this function is shown in Table 4.
The suggested usage model of this function is:
Allocate a pool of IXP_BUF buffer headers. Do not allocate data sections for these buffers.
When passing a buffer from higher-level software (for example, OS network stack) to the
IXP400 software, attach the skbuff to an IXP_BUF using the translation function.
When receiving an IXP_BUF passed from the IXP400 software to higher-level software, use
the translation function to retrieve a pointer to the skbuff that was attached to the IXP_BUF,
and use that skbuff with the OS network stack to process the data.
The Intel
®
IXP400 Software Linux Ethernet Device driver (“ixp425_eth.c”), which is included in
the IXP400 software distribution in form of a patch, contains an example of this suggested usage
model.
Table 4. Buffer Translation Functions
IX_OSAL_CONVERT_OSBUF_TO_IXPBUF(osBufPtr,ixpBufPtr)
The following fields of IX_MBUF within the IXP_BUF structure
will get updated:
— ix_len
— ix_pktlen
— ix_data
— ix_ctrl.os_buf_ptr
IX_OSAL_CONVERT_IXPBUF_TO_OS_BUF(ixpBufPtr)
The following fields will get updated in the skbuffer
— (skb)osBufPtr = ix_ctrl.os_buf_ptr
— skb->data = IX_OSAL_MBUF_MDATA(ixMbufPtr)
— skb->len = IX_OSAL_MBUF_MLEN(ixMbufPtr)
— skb->len = IX_OSAL_MBUF_PKT_LEN(ixMbufPtr)