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

Go to the source code of this file.

Macros

#define GET_PERCENTAGE(part, total)   (((double)part / (double)total) * 100)
 
#define WAITING_TIME   15
 
#define MAX_ECMP_PORTS   (8)
 
#define MAX_TOTAL_PORTS   ((MAX_ECMP_PORTS) + 1)
 

Functions

 DOCA_LOG_REGISTER (FLOW_ECMP)
 
static doca_error_t create_root_pipe (struct doca_flow_port *port, uint32_t shared_counter_id, struct doca_flow_pipe *next_pipe, struct entries_status *status)
 
static bool is_power_of_two (uint8_t x)
 
static doca_error_t create_hash_pipe (struct doca_flow_port *port, uint8_t nb_flows, struct doca_flow_pipe **pipe)
 
static doca_error_t add_hash_pipe_entries (struct doca_flow_pipe *pipe, uint8_t nb_ecmp_ports, struct doca_flow_pipe_entry **entries, struct entries_status *status)
 
static doca_error_t show_ecmp_results (uint32_t counter_id, struct doca_flow_pipe_entry **entries, uint8_t nb_ecmp_ports)
 
doca_error_t flow_ecmp (int nb_queues, int nb_ports, struct flow_switch_ctx *ctx)
 

Macro Definition Documentation

◆ GET_PERCENTAGE

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

Definition at line 41 of file flow_ecmp_sample.c.

◆ MAX_ECMP_PORTS

#define MAX_ECMP_PORTS   (8)

Definition at line 46 of file flow_ecmp_sample.c.

◆ MAX_TOTAL_PORTS

#define MAX_TOTAL_PORTS   ((MAX_ECMP_PORTS) + 1)

Definition at line 47 of file flow_ecmp_sample.c.

◆ WAITING_TIME

#define WAITING_TIME   15

Definition at line 44 of file flow_ecmp_sample.c.

Function Documentation

◆ add_hash_pipe_entries()

static doca_error_t add_hash_pipe_entries ( struct doca_flow_pipe *  pipe,
uint8_t  nb_ecmp_ports,
struct doca_flow_pipe_entry **  entries,
struct entries_status status 
)
static

Definition at line 232 of file flow_ecmp_sample.c.

◆ create_hash_pipe()

static doca_error_t create_hash_pipe ( struct doca_flow_port *  port,
uint8_t  nb_flows,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 163 of file flow_ecmp_sample.c.

◆ create_root_pipe()

static doca_error_t create_root_pipe ( struct doca_flow_port *  port,
uint32_t  shared_counter_id,
struct doca_flow_pipe *  next_pipe,
struct entries_status status 
)
static

Definition at line 61 of file flow_ecmp_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( FLOW_ECMP  )

◆ flow_ecmp()

doca_error_t flow_ecmp ( int  nb_queues,
int  nb_ports,
struct flow_switch_ctx ctx 
)

Definition at line 322 of file flow_ecmp_sample.c.

◆ is_power_of_two()

static bool is_power_of_two ( uint8_t  x)
inlinestatic

Definition at line 148 of file flow_ecmp_sample.c.

◆ show_ecmp_results()

static doca_error_t show_ecmp_results ( uint32_t  counter_id,
struct doca_flow_pipe_entry **  entries,
uint8_t  nb_ecmp_ports 
)
static

Definition at line 269 of file flow_ecmp_sample.c.