pktdescr_dyn.h

Reference Documentation

product_line_custom
Napatech SmartNIC
category
Reference Information

Go to the documentation of this file.

1/* 2 * %NT_SOFTWARE_LICENSE% 3 */ 4 5/** 6 * @file 7 * This source file contains the NT_DYN dynamic packet descriptor base.\n 8 * It is <b>not</b> to be used directly but via the @ref PacketMacros. 9 */ 10 11#ifndef DOXYGEN_INTERNAL_ONLY 12 13#ifndef __PKT_DESCR_DYN_H__ 14#define __PKT_DESCR_DYN_H__ 15 16// Ensure that the following is packed. 17#pragma pack(push, 1) 18 19// NT Dynamic base descriptor 20#define _NT_DESCR_DYN_FIELDS \ 21 uint64_t capLength:14; /* 0: The length of the packet incl. descriptor. */\ 22 uint64_t unused0:34; /* 14: To be used for acceleration fields. */\ 23 uint64_t descrFormat:8; /* 48: The variable descriptor format. */\ 24 uint64_t descrLength:6; /* 56: The length of the descriptor in bytes. */\ 25 uint64_t unused1:1; /* 62: To be used for acceleration fields. */\ 26 uint64_t ntDynDescr:1; /* 63: Set to 1 to identify this descriptor as a dynamic */\ 27 /* descriptor. */ 28 29 30typedef struct NtDynDescr_s { 31 _NT_DESCR_DYN_FIELDS 32} NtDynDescr_t; 33 34// Disable 1-byte packing 35#pragma pack(pop) 36 37#define _NT_NET_GET_PKT_DESCR_PTR_DYN(_hNetBuf_) ((NtDynDescr_t*)(_hNetBuf_)->hHdr) 38 39#define _NT_NET_GET_PKT_DESCR_FORMAT_DYN(_hNetBuf_) (_NT_NET_GET_PKT_DESCR_PTR_DYN(_hNetBuf_)->descrFormat) 40// descrLength == 0 means descriptor length is 64 41#define _NT_NET_GET_PKT_DESCR_LENGTH_DYN(_hNetBuf_) ((64&(_NT_NET_GET_PKT_DESCR_PTR_DYN(_hNetBuf_)->descrLength-1)) + _NT_NET_GET_PKT_DESCR_PTR_DYN(_hNetBuf_)->descrLength) 42#define _NT_NET_GET_PKT_CAP_LENGTH_DYN(_hNetBuf_) (_NT_NET_GET_PKT_DESCR_PTR_DYN(_hNetBuf_)->capLength) 43#define _NT_NET_GET_PKT_WIRE_LENGTH_DYN(_hNetBuf_) (uint16_t)(_NT_NET_GET_PKT_CAP_LENGTH_DYN(_hNetBuf_) - _NT_NET_GET_PKT_DESCR_LENGTH_DYN(_hNetBuf_)) 44 45#endif // __PKT_DESCR_VAR_H__ 46#endif // DOXYGEN_INTERNAL_ONLY