LCOV - code coverage report
Current view: top level - waltz/xdp - fd_xsk_aio_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 10 10 100.0 %
Date: 2024-11-13 11:58:15 Functions: 6 9 66.7 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_waltz_xdp_fd_xsk_aio_private_h
       2             : #define HEADER_fd_src_waltz_xdp_fd_xsk_aio_private_h
       3             : 
       4             : #include "fd_xsk_aio.h"
       5             : #include "../aio/fd_aio.h"
       6             : 
       7             : /* Private definition of an fd_xsk_aio_t */
       8             : 
       9           3 : #define FD_XSK_AIO_MAGIC (0xf17ed2c778736b61UL) /* firednc hex(xska) */
      10             : 
      11             : struct __attribute__((aligned(FD_XSK_AIO_ALIGN))) fd_xsk_aio_private {
      12             :   /* Data Layout Config ***********************************************/
      13             : 
      14             :   ulong magic;          /* ==FD_XSK_AIO_MAGIC                         */
      15             :   ulong pkt_depth;      /* depth of fd_aio_pkt_info_t buffer          */
      16             :   ulong tx_depth;       /* depth of the fd_xsk_t tx_depth/cr_depth    */
      17             :   ulong meta_off;       /* offset of fd_xsk_frame_meta_t[ batch_cnt ] */
      18             :   ulong pkt_off;        /* offset of fd_aio_pkt_info_t  [ batch_cnt ] */
      19             :   ulong tx_stack_off;   /* offset of ulong              [ tx_depth  ] */
      20             : 
      21             :   /* Join Config ******************************************************/
      22             : 
      23             :   fd_xsk_t * xsk;
      24             :   fd_aio_t   rx;  /* from outside to user (externally owned) */
      25             :   fd_aio_t   tx;  /* from user to outside (owned by fd_xsk_aio) */
      26             :   void *     frame_mem; /* Address of start of frame memory */
      27             : 
      28             :   /* {rx,tx}_off: Offset from frame_mem to {rx,tx} frames.
      29             :      Unit is xsk->frame_sz. TODO consider using byte offset */
      30             :   ulong   rx_off;
      31             :   ulong   tx_off;
      32             : 
      33             :   ulong * tx_stack;       /* stack of unused tx frame indices
      34             :                              TODO consider using uint array */
      35             :   ulong   tx_stack_depth; /* item count capacity of stack */
      36             :   ulong   tx_top;         /* number of items currently on stack */
      37             : 
      38             :   ulong   frame_sz;       /* Frame size from fd_xsk_params_t */
      39             : 
      40             :   struct {
      41             :     ulong tx_cnt;
      42             :     ulong tx_sz;
      43             : 
      44             :     ulong rx_cnt;
      45             :     ulong rx_sz;
      46             :   } metrics;
      47             : 
      48             :   /* Variable-length data *********************************************/
      49             : 
      50             :   /* ... fd_xsk_frame_meta_t[ pkt_depth ] follows ... */
      51             :   /* ... fd_aio_pkt_info_t  [ pkt_depth ] follows ... */
      52             :   /* ... ulong              [ tx_depth  ] follows ... */
      53             : };
      54             : 
      55             : FD_FN_PURE static inline fd_xsk_frame_meta_t *
      56          18 : fd_xsk_aio_meta( fd_xsk_aio_t * xsk_aio ) {
      57          18 :   return (fd_xsk_frame_meta_t *)( (ulong)xsk_aio + xsk_aio->meta_off );
      58          18 : }
      59             : 
      60             : FD_FN_PURE static inline fd_aio_pkt_info_t *
      61          15 : fd_xsk_aio_pkts( fd_xsk_aio_t * xsk_aio ) {
      62          15 :   return (fd_aio_pkt_info_t *)( (ulong)xsk_aio + xsk_aio->pkt_off );
      63          15 : }
      64             : 
      65             : FD_FN_PURE static inline ulong *
      66           6 : fd_xsk_aio_tx_stack( fd_xsk_aio_t * xsk_aio ) {
      67           6 :   return (ulong *)( (ulong)xsk_aio + xsk_aio->tx_stack_off );
      68           6 : }
      69             : 
      70             : #endif /* HEADER_fd_src_waltz_xdp_fd_xsk_aio_private_h */

Generated by: LCOV version 1.14