Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
__netio_packet_queue_t Struct Reference

#include <drv_xgbe_impl.h>

Data Fields

volatile uint32_t __packet_write
 
uint32_t __last_packet_plus_one
 

Detailed Description

A queue of packets.

This structure partially defines a queue of packets waiting to be processed. The queue as a whole is written to by an interrupt handler and read by non-interrupt code; this data structure is what's touched by the interrupt handler. The other part of the queue state, the read offset, is kept in user space, not in hypervisor space, so it is in a separate data structure.

The read offset (__packet_receive_read in the user part of the queue structure) points to the next packet to be read. When the read offset is equal to the write offset, the queue is empty; therefore the queue must contain one more slot than the required maximum queue size.

Here's an example of all 3 state variables and what they mean. All pointers move left to right.

I I V V V V I I I I
0 1 2 3 4 5 6 7 8 9 10
^ ^ ^ ^
| | |
| __buffer_write
__packet_receive_read

This queue has 10 slots, and thus can hold 9 packets (_last_packet_plus_one = 10). The read pointer is at 2, and the write pointer is at 6; thus, there are valid, unread packets in slots 2, 3, 4, and 5. The remaining slots are invalid (do not contain a packet).

Definition at line 111 of file drv_xgbe_impl.h.

Field Documentation

uint32_t __last_packet_plus_one

Offset of the packet after the last valid packet (i.e., when any pointer is incremented to this value, it wraps back to zero).

Definition at line 119 of file drv_xgbe_impl.h.

volatile uint32_t __packet_write

Byte offset of the next notify packet to be written: zero for the first packet on the queue, sizeof (netio_pkt_t) for the second packet on the queue, etc.

Definition at line 115 of file drv_xgbe_impl.h.


The documentation for this struct was generated from the following file: