NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_random_sample.c File Reference
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <rte_ethdev.h>
#include <doca_log.h>
#include <doca_flow.h>
#include <doca_bitfield.h>
#include "doca_error.h"
#include "flow_common.h"
Include dependency graph for flow_random_sample.c:

Go to the source code of this file.

Macros

#define PACKET_BURST   256
 
#define RANDOM_WIDTH   16
 
#define GET_PERCENTAGE(part, total)   (((double)part / (double)total) * 100)
 

Functions

 DOCA_LOG_REGISTER (FLOW_RANDOM)
 
static doca_error_t create_root_pipe (struct doca_flow_port *port, struct doca_flow_pipe **pipe)
 
static doca_error_t add_root_pipe_entry (struct doca_flow_pipe *pipe, struct doca_flow_pipe *next_pipe, doca_be32_t src_ip_addr, struct entries_status *status, struct doca_flow_pipe_entry **entry)
 
static doca_error_t add_root_pipe_entries (struct doca_flow_pipe *pipe, struct entries_status *status, struct doca_flow_pipe *distribution_pipe, struct doca_flow_pipe *sampling_pipe, struct doca_flow_pipe_entry **distribution_entry, struct doca_flow_pipe_entry **sampling_entry)
 
static uint16_t get_random_mask (double percentage)
 
static doca_error_t create_random_sampling_pipe (struct doca_flow_port *port, int port_id, double percentage, struct doca_flow_pipe **pipe)
 
static doca_error_t add_random_sampling_pipe_entry (struct doca_flow_pipe *pipe, struct entries_status *status, struct doca_flow_pipe_entry **entry)
 
static doca_error_t create_random_distribution_pipe (struct doca_flow_port *port, int nb_flows, struct doca_flow_pipe **pipe)
 
static doca_error_t add_random_distribution_pipe_entries (struct doca_flow_pipe *pipe, int nb_entries, struct entries_status *status)
 
static doca_error_t random_sampling_results (uint16_t port_id, struct doca_flow_pipe_entry *root_entry, struct doca_flow_pipe_entry *random_entry, double requested_percentage)
 
static doca_error_t random_distribution_results (uint16_t port_id, uint16_t nb_queues, struct doca_flow_pipe_entry *root_entry)
 
doca_error_t flow_random (int nb_steering_queues, int nb_rss_queues)
 

Macro Definition Documentation

◆ GET_PERCENTAGE

#define GET_PERCENTAGE (   part,
  total 
)    (((double)part / (double)total) * 100)

Definition at line 48 of file flow_random_sample.c.

◆ PACKET_BURST

#define PACKET_BURST   256

Definition at line 42 of file flow_random_sample.c.

◆ RANDOM_WIDTH

#define RANDOM_WIDTH   16

Definition at line 45 of file flow_random_sample.c.

Function Documentation

◆ add_random_distribution_pipe_entries()

static doca_error_t add_random_distribution_pipe_entries ( struct doca_flow_pipe *  pipe,
int  nb_entries,
struct entries_status status 
)
static

Definition at line 384 of file flow_random_sample.c.

◆ add_random_sampling_pipe_entry()

static doca_error_t add_random_sampling_pipe_entry ( struct doca_flow_pipe *  pipe,
struct entries_status status,
struct doca_flow_pipe_entry **  entry 
)
static

Definition at line 303 of file flow_random_sample.c.

◆ add_root_pipe_entries()

static doca_error_t add_root_pipe_entries ( struct doca_flow_pipe *  pipe,
struct entries_status status,
struct doca_flow_pipe *  distribution_pipe,
struct doca_flow_pipe *  sampling_pipe,
struct doca_flow_pipe_entry **  distribution_entry,
struct doca_flow_pipe_entry **  sampling_entry 
)
static

Definition at line 162 of file flow_random_sample.c.

◆ add_root_pipe_entry()

static doca_error_t add_root_pipe_entry ( struct doca_flow_pipe *  pipe,
struct doca_flow_pipe *  next_pipe,
doca_be32_t  src_ip_addr,
struct entries_status status,
struct doca_flow_pipe_entry **  entry 
)
static

Definition at line 128 of file flow_random_sample.c.

◆ create_random_distribution_pipe()

static doca_error_t create_random_distribution_pipe ( struct doca_flow_port *  port,
int  nb_flows,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 327 of file flow_random_sample.c.

◆ create_random_sampling_pipe()

static doca_error_t create_random_sampling_pipe ( struct doca_flow_port *  port,
int  port_id,
double  percentage,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 232 of file flow_random_sample.c.

◆ create_root_pipe()

static doca_error_t create_root_pipe ( struct doca_flow_port *  port,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 57 of file flow_random_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( FLOW_RANDOM  )

◆ flow_random()

doca_error_t flow_random ( int  nb_steering_queues,
int  nb_rss_queues 
)

Definition at line 539 of file flow_random_sample.c.

◆ get_random_mask()

static uint16_t get_random_mask ( double  percentage)
static

Definition at line 199 of file flow_random_sample.c.

◆ random_distribution_results()

static doca_error_t random_distribution_results ( uint16_t  port_id,
uint16_t  nb_queues,
struct doca_flow_pipe_entry *  root_entry 
)
static

Definition at line 476 of file flow_random_sample.c.

◆ random_sampling_results()

static doca_error_t random_sampling_results ( uint16_t  port_id,
struct doca_flow_pipe_entry *  root_entry,
struct doca_flow_pipe_entry *  random_entry,
double  requested_percentage 
)
static

Definition at line 427 of file flow_random_sample.c.