This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Data structure describing a packet
typedef struct _npkt { net_buf buffers; npkt_t *next; void *org_data; uint32_t flags; uint32_t framelen; uint32_t tot_iov; uint32_t csum_flags; uint32_t ref_cnt; uint16_t req_complete; union { void *p; unsigned char c [16]; } inter_module; } npkt_t;
A packet consists of an npkt_t structure, which has data buffers associated with it. If the driver wants to create a packet to send upstream, it should call alloc_up_npkt().
A data buffer is described by a structure of type net_buf_t, as defined in <sys/io-net.h>. The data in a buffer is comprised of one or more contiguous fragments. Each fragment is described by a net_iov_t structure (also defined in <sys/io-net.h>) that contains a pointer to the fragment's data, the size of the fragment, and the physical address of the fragment. Note that packets being sent upstream must consist of a single fragment.
The npkt_t structure is defined in <sys/io-net.h>.
The npkt_t structure is the main data structure for a packet. The following fields of the npkt_t structure are of importance to the network driver:
If you're using the new lightweight Qnet, a network driver developed with releases prior to 6.3 could malfunction because the assignment of the bits in the flags field of the npkt_t structure has changed. See _NPKT_ORG_MASK and _NPKT_SCRATCH_MASK in <sys/io-net.h>. |
The driver can use the eight most significant bits while it's processing a packet. The driver shouldn't make assumptions about the state of these bits when it receives a packet from the upper layers.
The next four most significant bits are for the use of the originator of a packet. The driver can use these flags for packets being sent upstream. If a packet didn't originate with the driver, the driver must not alter these flags.
A queue of structures of type net_buf_t is used to describe the data fragments that are associated with the packet.
typedef struct _net_buf { TAILQ_ENTRY (_net_buf) ptrs; int niov; net_iov_t *net_iov; } ;
The members of this structure are as follows:
The net_iov_t structure is used to describe the data fragment descriptors associated with the packet.
typedef struct _net_iovec { void *iov_base; paddr_t iov_phys; size_t iov_len; } ;
The members of this structure are as follows:
QNX Neutrino