NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
eth_txq_batch_send_ethernet_frames_sample.c File Reference
#include <time.h>
#include <stdint.h>
#include <unistd.h>
#include <doca_buf.h>
#include <doca_buf_inventory.h>
#include <doca_ctx.h>
#include <doca_eth_txq.h>
#include <doca_eth_txq_cpu_data_path.h>
#include <doca_error.h>
#include <doca_log.h>
#include "common.h"
#include "eth_common.h"
Include dependency graph for eth_txq_batch_send_ethernet_frames_sample.c:

Go to the source code of this file.

Data Structures

struct  eth_txq_batch_send_sample_objects
 

Macros

#define SLEEP_IN_NANOS   (10 * 1000) /* sample the task batch every 10 microseconds */
 
#define MAX_BURST_SIZE   256 /* Max burst size to set for eth_txq */
 
#define MAX_LIST_LENGTH   1 /* Max number of elements in a doca_buf */
 
#define TASKS_IN_TASK_BATCH   32 /* Number of tasks associated with task batch */
 
#define BUFS_NUM   TASKS_IN_TASK_BATCH /* Number of DOCA buffers */
 
#define TASK_BATCHES_NUM   1 /* Task batches number */
 
#define REGULAR_PKT_SIZE   1500 /* Size of the packets in send task batch */
 
#define SEND_TASK_BATCH_USER_DATA   0x43210 /* User data for send task batch */
 
#define ETHER_TYPE_IPV4   0x0800 /* IPV4 type */
 

Functions

 DOCA_LOG_REGISTER (ETH_TXQ_BATCH_SEND_ETHERNET_FRAMES)
 
static void task_batch_send_common_cb (struct doca_task_batch *task_batch, uint16_t tasks_num, union doca_data ctx_user_data, union doca_data task_batch_user_data, union doca_data *task_user_data_array, struct doca_buf **pkt_array, doca_error_t *status_array)
 
static doca_error_t destroy_eth_txq_ctx (struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t destroy_eth_txq_packet_buffers (struct eth_txq_batch_send_sample_objects *state)
 
static void destroy_eth_txq_task_batch (struct eth_txq_batch_send_sample_objects *state)
 
static void retrieve_eth_txq_task_batch (struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t submit_eth_txq_task_batch (struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t create_eth_txq_task_batch (struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t create_eth_txq_packet_buffers (uint8_t *dest_mac_addr, struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t create_eth_txq_ctx (struct eth_txq_batch_send_sample_objects *state)
 
static void eth_txq_cleanup (struct eth_txq_batch_send_sample_objects *state)
 
static doca_error_t check_device (struct doca_devinfo *devinfo)
 
doca_error_t eth_txq_batch_send_ethernet_frames (const char *ib_dev_name, uint8_t *dest_mac_addr)
 

Macro Definition Documentation

◆ BUFS_NUM

#define BUFS_NUM   TASKS_IN_TASK_BATCH /* Number of DOCA buffers */

Definition at line 47 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ ETHER_TYPE_IPV4

#define ETHER_TYPE_IPV4   0x0800 /* IPV4 type */

Definition at line 51 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ MAX_BURST_SIZE

#define MAX_BURST_SIZE   256 /* Max burst size to set for eth_txq */

Definition at line 44 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ MAX_LIST_LENGTH

#define MAX_LIST_LENGTH   1 /* Max number of elements in a doca_buf */

Definition at line 45 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ REGULAR_PKT_SIZE

#define REGULAR_PKT_SIZE   1500 /* Size of the packets in send task batch */

Definition at line 49 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ SEND_TASK_BATCH_USER_DATA

#define SEND_TASK_BATCH_USER_DATA   0x43210 /* User data for send task batch */

Definition at line 50 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ SLEEP_IN_NANOS

#define SLEEP_IN_NANOS   (10 * 1000) /* sample the task batch every 10 microseconds */

Definition at line 43 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ TASK_BATCHES_NUM

#define TASK_BATCHES_NUM   1 /* Task batches number */

Definition at line 48 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ TASKS_IN_TASK_BATCH

#define TASKS_IN_TASK_BATCH   32 /* Number of tasks associated with task batch */

Definition at line 46 of file eth_txq_batch_send_ethernet_frames_sample.c.

Function Documentation

◆ check_device()

static doca_error_t check_device ( struct doca_devinfo *  devinfo)
static

Definition at line 424 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ create_eth_txq_ctx()

static doca_error_t create_eth_txq_ctx ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 328 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ create_eth_txq_packet_buffers()

static doca_error_t create_eth_txq_packet_buffers ( uint8_t *  dest_mac_addr,
struct eth_txq_batch_send_sample_objects state 
)
static

Definition at line 278 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ create_eth_txq_task_batch()

static doca_error_t create_eth_txq_task_batch ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 244 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ destroy_eth_txq_ctx()

static doca_error_t destroy_eth_txq_ctx ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 127 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ destroy_eth_txq_packet_buffers()

static doca_error_t destroy_eth_txq_packet_buffers ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 172 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ destroy_eth_txq_task_batch()

static void destroy_eth_txq_task_batch ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 194 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( ETH_TXQ_BATCH_SEND_ETHERNET_FRAMES  )

◆ eth_txq_batch_send_ethernet_frames()

doca_error_t eth_txq_batch_send_ethernet_frames ( const char *  ib_dev_name,
uint8_t *  dest_mac_addr 
)

Definition at line 455 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ eth_txq_cleanup()

static void eth_txq_cleanup ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 397 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ retrieve_eth_txq_task_batch()

static void retrieve_eth_txq_task_batch ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 204 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ submit_eth_txq_task_batch()

static doca_error_t submit_eth_txq_task_batch ( struct eth_txq_batch_send_sample_objects state)
static

Definition at line 223 of file eth_txq_batch_send_ethernet_frames_sample.c.

◆ task_batch_send_common_cb()

static void task_batch_send_common_cb ( struct doca_task_batch *  task_batch,
uint16_t  tasks_num,
union doca_data  ctx_user_data,
union doca_data  task_batch_user_data,
union doca_data task_user_data_array,
struct doca_buf **  pkt_array,
doca_error_t status_array 
)
static

Definition at line 74 of file eth_txq_batch_send_ethernet_frames_sample.c.