[Previous] [Contents] [Index] [Next]

npkt_t

Main data structure for a packet

Synopsis:

typedef struct _npkt {
    TAILQ_HEAD(, _net_buf) buffers;
    npkt_t       *next;
    void         *io_net0;
    void         *org_data;
    uint32_t     flags;
    uint32_t     framelen;
    uint32_t     tot_iov;
    uint32_t     io_net1;
    uint32_t     ref_cnt;
    uint16_t     num_complete;
    uint16_t     req_complete;
    uint16_t     cell;
    uint16_t     endpoint;
    uint16_t     iface;
    uint16_t     skip;
    union {
        void     *p;
        unsigned char c [16];
    } inter_module;
} npkt_t;

// This field follows the structure implicitly:

npkt_done_t  c [];

Description:

The npkt_t structure is the main data structure for a packet. The fields include:

buffers
A queue of buffers, managed using the TAILQ*() macros from <sys/queue.h>.
next
A pointer to the next npkt_t. Modules can use this pointer to queue packets.
io_net0, io_net1, ref_cnt
Internal to io-net, don't examine or modify.
org_data
For the exclusive use of the originator of this npkt_t. No one else should touch this member.
flags
The status of the buffer. This is a combination of the following bits:

The originator of the packet can use the top 12 bits as it sees fit. _NPKT_ORG_MASK is a mask that you can use to get just these bits.

framelen
The total length of the entire packet.
tot_iov
The total number of iovs in the packet.
num_complete
The number of elements in the npkt_done_t array that implicitly immediately follows this structure.
req_complete
The required number of npkt_done_t elements this downward-headed packet required before it reached its final destination. This member is for information purposes only (read-only) in the originator's tx_done() function if the originator isn't using io-net's alloc_down_pkt() function.
cell
The cell to or from which the npkt_t is headed.
endpoint
The endpoint within the cell.
iface
The interface within the endpoint.
skip
For use by _REG_FILTER_BELOW types of modules. The idea is that they can receive a packet from above, modify it somehow, stuff their reg_hdl in the skip member, and return TX_DOWN_AGAIN (from <sys/io-net.h>) from their rx_down() function. The down producer sees TX_DOWN_AGAIN and resends it down (after recalculating the checksum, rerouting, etc.), but this time, the _REG_FILTER_BELOW is skipped by io-net. The down producer has to support the TX_DOWN_AGAIN return code.
inter_module.p, inter_module.c
A data area that can be used by any module to pass information to the module above or below it.

The npkt_t is implicitly followed immediately by an array, c, of npkt_done_t structures. On a downward-headed transmission, this array is num_complete elements long, whereas on an upward-headed transmission, it's always 1 element long.

Classification:

QNX


[Previous] [Contents] [Index] [Next]