NET_RING structure

Warning

Some information in this topic relates to prereleased product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

NetAdapterCx is preview only in Windows 10, version 1903.

Specifies a buffer comprised of one or more NET_PACKET or NET_FRAGMENT structures.

Syntax

typedef struct _NET_RING {
  UINT16        OSReserved1;
  UINT16        ElementStride;
  UINT32        NumberOfElements;
  UINT32        ElementIndexMask;
  UINT32        BeginIndex;
  UINT32        NextIndex;
  UINT32        EndIndex;
  union {
    UINT32 OSReserved0;
    void   *OSReserved2[3];
  } DUMMYUNIONNAME;
  void          *NetAdapterScratch[2];
  unsigned char Buffer[ANYSIZE_ARRAY];
} NET_RING;

Members

OSReserved1

Reserved. Client drivers must not read or write to this value.

ElementStride

A read-only byte offset from the start of one element to the start of the next. Use ((BYTE*)p + ElementStride) to obtain the address of the next element.

NumberOfElements

A read-only value that indicates the number of packets in the ring buffer, which is always a power of two, and greater than one.

ElementIndexMask

A read-only UINT32 mask that can be used to efficiently clamp an index to [0, NumberOfElements). The client can use this value to calculate an index that wraps around the ring buffer. Use the identity (x % NumberofElements) == (x & ElementIndexMask).

BeginIndex

Specifies the index of the first element owned by the client driver in the inclusive range [0, NumberOfElements - 1].

NextIndex

Specifies the index of the next element that needs processing. For optional use by the client driver.

EndIndex

Specifies the read-only index of the last element that is owned by the client driver in the inclusive range [0, NumberOfElements - 1].

DUMMYUNIONNAME

A union that contains the OSReserved0 and OSReserved2 members.

field DUMMYUNIONNAME.OSReserved0

Reserved. Client drivers must not read or write to this value.

DUMMYUNIONNAME.OSReserved0

DUMMYUNIONNAME.OSReserved2

Reserved. Client drivers must not read or write to this value.

NetAdapterScratch

A pointer to a buffer that the client driver may use for any purpose.

Buffer

A byte array that contains the elements in the net ring. Typically, a client driver calls NetRingGetElementAtIndex to access elements in the ring buffer.

Remarks

The NET_RING structure is a generic ring buffer, optimized for efficient access from a single thread. A NET_RING contains NET_PACKET or NET_FRAGMENT elements.

For more info about packet and fragment ring buffers, see Packet descriptors and extensions.

For more info about using net rings, see Net rings and net ring iterators.

Requirements

   
Minimum KMDF version 1.29
Header ring.h