NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
ip_frag_dp.c File Reference
#include "ip_frag_dp.h"
#include <flow_common.h>
#include <doca_log.h>
#include <doca_flow.h>
#include <dpdk_utils.h>
#include <packet_parser.h>
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_ethdev.h>
#include <rte_ip_frag.h>
#include <rte_cycles.h>
#include <rte_mempool.h>
#include <stdbool.h>
Include dependency graph for ip_frag_dp.c:

Go to the source code of this file.

Data Structures

struct  ip_frag_sw_counters
 
struct  ip_frag_wt_data
 

Macros

#define IP_FRAG_MAX_PKT_BURST   32
 
#define IP_FRAG_BURST_PREFETCH   (IP_FRAG_MAX_PKT_BURST / 8)
 
#define IP_FRAG_FLUSH_THRESHOLD   16
 
#define IP_FRAG_TBL_BUCKET_SIZE   4
 

Functions

 DOCA_LOG_REGISTER (IP_FRAG::DP)
 
struct ip_frag_wt_data __rte_aligned (RTE_CACHE_LINE_SIZE)
 
static void ip_frag_pkt_err_drop (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, struct rte_mbuf *pkt)
 
static doca_error_t ip_frag_pkt_parse (enum parser_pkt_type *pkt_type, struct rte_mbuf *pkt, struct tun_parser_ctx *parse_ctx)
 
static void ip_frag_pkt_reassemble_prepare (struct rte_mbuf *pkt, size_t l2_len, size_t l3_len, uint64_t flags)
 
static void ip_frag_ipv4_hdr_cksum (struct rte_ipv4_hdr *hdr)
 
static void ip_frag_network_cksum (struct network_parser_ctx *ctx)
 
static void ip_frag_ipv4_cksum_handle (struct ip_frag_wt_data *wt_data, struct rte_mbuf *pkt, uint64_t l2_len, uint64_t l3_len, struct rte_ipv4_hdr *ipv4_hdr)
 
static void ip_frag_network_cksum_handle (struct ip_frag_wt_data *wt_data, struct rte_mbuf *pkt, struct link_parser_ctx *link_ctx, struct network_parser_ctx *network_ctx)
 
static void ip_frag_udp_cksum_handle (struct ip_frag_wt_data *wt_data, struct rte_mbuf *pkt, struct link_parser_ctx *link_ctx, struct network_parser_ctx *network_ctx, struct transport_parser_ctx *transport_ctx)
 
static void ip_frag_pkt_fixup (struct ip_frag_wt_data *wt_data, enum parser_pkt_type pkt_type, struct rte_mbuf *pkt, struct tun_parser_ctx *parse_ctx)
 
static doca_error_t ip_frag_pkt_flatten (struct rte_mbuf *pkt)
 
static struct rte_mbuf * ip_frag_pkt_reassemble_push_outer (struct ip_frag_wt_data *wt_data, struct rte_mbuf *pkt, struct tun_parser_ctx *parse_ctx, uint64_t rx_ts)
 
static struct rte_mbuf * ip_frag_pkt_reassemble_push_inner (struct ip_frag_wt_data *wt_data, enum parser_pkt_type pkt_type, struct rte_mbuf *pkt, struct tun_parser_ctx *parse_ctx, uint64_t rx_ts)
 
static doca_error_t ip_frag_pkt_reassemble_push (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, enum parser_pkt_type pkt_type, struct rte_mbuf *pkt, struct tun_parser_ctx *parse_ctx, uint64_t rx_ts, struct rte_mbuf **whole_pkt)
 
static void ip_frag_pkt_reassemble (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id, enum parser_pkt_type pkt_type, struct rte_mbuf *pkt, uint64_t rx_ts)
 
static void ip_frag_pkts_reassemble (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id, enum parser_pkt_type pkt_type, struct rte_mbuf *pkts[], int pkts_cnt, uint64_t rx_ts)
 
static void ip_frag_wt_reassemble (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id, enum parser_pkt_type pkt_type)
 
static int32_t ip_frag_mbuf_fragment (struct ip_frag_wt_data *wt_data, struct conn_parser_ctx *parse_ctx, struct rte_mbuf *pkt_in, struct rte_mbuf **pkts_out, uint16_t pkts_out_max, uint16_t mtu, struct rte_mempool *direct_pool, struct rte_mempool *indirect_pool)
 
static void ip_frag_pkt_fragment (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id, struct rte_mbuf *pkt)
 
static void ip_frag_pkts_fragment (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id, struct rte_mbuf *pkts[], int pkts_cnt)
 
static void ip_frag_wt_fragment (struct ip_frag_wt_data *wt_data, uint16_t rx_port_id, uint16_t tx_port_id)
 
static int ip_frag_wt_thread_main (void *param)
 
static doca_error_t ip_frag_mbuf_flags_init (struct ip_frag_config *cfg)
 
static doca_error_t ip_frag_indirect_pool_init (uint16_t nb_queues, struct rte_mempool *indirect_pools[])
 
static void ip_frag_wt_data_cleanup (struct ip_frag_wt_data *wt_data_arr)
 
static doca_error_t ip_frag_wt_data_init (const struct ip_frag_config *cfg, struct rte_mempool *indirect_pools[], struct ip_frag_wt_data **wt_data_arr_out)
 
static void ip_frag_sw_counters_print (struct ip_frag_ctx *ctx, struct ip_frag_wt_data *wt_data_arr)
 
static void ip_frag_tx_buffer_error_print (struct ip_frag_wt_data *wt_data_arr)
 
static void ip_frag_tbl_stats_print (struct ip_frag_wt_data *wt_data_arr)
 
static void ip_frag_debug_counters_print (struct ip_frag_ctx *ctx, struct ip_frag_wt_data *wt_data_arr)
 
static doca_error_t ip_frag_pipe_create (struct ip_frag_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
 
static doca_error_t ip_frag_rss_pipe_create (struct ip_frag_ctx *ctx, uint16_t port_id, char *pipe_name, bool is_root, uint32_t flags, struct doca_flow_pipe *pipe_miss, struct doca_flow_pipe **pipe_out)
 
static doca_error_t ip_frag_rss_pipes_create (struct ip_frag_ctx *ctx)
 
doca_error_t ip_frag (struct ip_frag_config *cfg, struct application_dpdk_config *dpdk_cfg)
 

Variables

const struct ip_frag_configcfg
 
uint16_t queue_id
 
struct ip_frag_sw_counters sw_counters [IP_FRAG_PORT_NUM]
 
struct rte_eth_dev_tx_buffer * tx_buffer
 
uint64_t tx_buffer_err
 
struct rte_ip_frag_tbl * frag_tbl
 
struct rte_mempool * indirect_pool
 
struct rte_ip_frag_death_row death_row
 
bool force_stop = false
 

Macro Definition Documentation

◆ IP_FRAG_BURST_PREFETCH

#define IP_FRAG_BURST_PREFETCH   (IP_FRAG_MAX_PKT_BURST / 8)

Definition at line 44 of file ip_frag_dp.c.

◆ IP_FRAG_FLUSH_THRESHOLD

#define IP_FRAG_FLUSH_THRESHOLD   16

Definition at line 45 of file ip_frag_dp.c.

◆ IP_FRAG_MAX_PKT_BURST

#define IP_FRAG_MAX_PKT_BURST   32

Definition at line 43 of file ip_frag_dp.c.

◆ IP_FRAG_TBL_BUCKET_SIZE

#define IP_FRAG_TBL_BUCKET_SIZE   4

Definition at line 47 of file ip_frag_dp.c.

Function Documentation

◆ __rte_aligned()

struct ip_frag_wt_data __rte_aligned ( RTE_CACHE_LINE_SIZE  )

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( IP_FRAG::DP  )

◆ ip_frag()

doca_error_t ip_frag ( struct ip_frag_config cfg,
struct application_dpdk_config dpdk_cfg 
)

Definition at line 1243 of file ip_frag_dp.c.

◆ ip_frag_debug_counters_print()

static void ip_frag_debug_counters_print ( struct ip_frag_ctx ctx,
struct ip_frag_wt_data wt_data_arr 
)
static

Definition at line 1053 of file ip_frag_dp.c.

◆ ip_frag_indirect_pool_init()

static doca_error_t ip_frag_indirect_pool_init ( uint16_t  nb_queues,
struct rte_mempool *  indirect_pools[] 
)
static

Definition at line 809 of file ip_frag_dp.c.

◆ ip_frag_ipv4_cksum_handle()

static void ip_frag_ipv4_cksum_handle ( struct ip_frag_wt_data wt_data,
struct rte_mbuf *  pkt,
uint64_t  l2_len,
uint64_t  l3_len,
struct rte_ipv4_hdr *  ipv4_hdr 
)
static

Definition at line 160 of file ip_frag_dp.c.

◆ ip_frag_ipv4_hdr_cksum()

static void ip_frag_ipv4_hdr_cksum ( struct rte_ipv4_hdr *  hdr)
static

Definition at line 134 of file ip_frag_dp.c.

◆ ip_frag_mbuf_flags_init()

static doca_error_t ip_frag_mbuf_flags_init ( struct ip_frag_config cfg)
static

Definition at line 774 of file ip_frag_dp.c.

◆ ip_frag_mbuf_fragment()

static int32_t ip_frag_mbuf_fragment ( struct ip_frag_wt_data wt_data,
struct conn_parser_ctx parse_ctx,
struct rte_mbuf *  pkt_in,
struct rte_mbuf **  pkts_out,
uint16_t  pkts_out_max,
uint16_t  mtu,
struct rte_mempool *  direct_pool,
struct rte_mempool *  indirect_pool 
)
static

Definition at line 568 of file ip_frag_dp.c.

◆ ip_frag_network_cksum()

static void ip_frag_network_cksum ( struct network_parser_ctx ctx)
static

Definition at line 145 of file ip_frag_dp.c.

◆ ip_frag_network_cksum_handle()

static void ip_frag_network_cksum_handle ( struct ip_frag_wt_data wt_data,
struct rte_mbuf *  pkt,
struct link_parser_ctx link_ctx,
struct network_parser_ctx network_ctx 
)
static

Definition at line 183 of file ip_frag_dp.c.

◆ ip_frag_pipe_create()

static doca_error_t ip_frag_pipe_create ( struct ip_frag_pipe_cfg pipe_cfg,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 1073 of file ip_frag_dp.c.

◆ ip_frag_pkt_err_drop()

static void ip_frag_pkt_err_drop ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
struct rte_mbuf *  pkt 
)
static

Definition at line 80 of file ip_frag_dp.c.

◆ ip_frag_pkt_fixup()

static void ip_frag_pkt_fixup ( struct ip_frag_wt_data wt_data,
enum parser_pkt_type  pkt_type,
struct rte_mbuf *  pkt,
struct tun_parser_ctx parse_ctx 
)
static

Definition at line 233 of file ip_frag_dp.c.

◆ ip_frag_pkt_flatten()

static doca_error_t ip_frag_pkt_flatten ( struct rte_mbuf *  pkt)
static

Definition at line 296 of file ip_frag_dp.c.

◆ ip_frag_pkt_fragment()

static void ip_frag_pkt_fragment ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id,
struct rte_mbuf *  pkt 
)
static

Definition at line 599 of file ip_frag_dp.c.

◆ ip_frag_pkt_parse()

static doca_error_t ip_frag_pkt_parse ( enum parser_pkt_type pkt_type,
struct rte_mbuf *  pkt,
struct tun_parser_ctx parse_ctx 
)
static

Definition at line 94 of file ip_frag_dp.c.

◆ ip_frag_pkt_reassemble()

static void ip_frag_pkt_reassemble ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id,
enum parser_pkt_type  pkt_type,
struct rte_mbuf *  pkt,
uint64_t  rx_ts 
)
static

Definition at line 457 of file ip_frag_dp.c.

◆ ip_frag_pkt_reassemble_prepare()

static void ip_frag_pkt_reassemble_prepare ( struct rte_mbuf *  pkt,
size_t  l2_len,
size_t  l3_len,
uint64_t  flags 
)
static

Definition at line 122 of file ip_frag_dp.c.

◆ ip_frag_pkt_reassemble_push()

static doca_error_t ip_frag_pkt_reassemble_push ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
enum parser_pkt_type  pkt_type,
struct rte_mbuf *  pkt,
struct tun_parser_ctx parse_ctx,
uint64_t  rx_ts,
struct rte_mbuf **  whole_pkt 
)
static

Definition at line 412 of file ip_frag_dp.c.

◆ ip_frag_pkt_reassemble_push_inner()

static struct rte_mbuf* ip_frag_pkt_reassemble_push_inner ( struct ip_frag_wt_data wt_data,
enum parser_pkt_type  pkt_type,
struct rte_mbuf *  pkt,
struct tun_parser_ctx parse_ctx,
uint64_t  rx_ts 
)
static

Definition at line 372 of file ip_frag_dp.c.

◆ ip_frag_pkt_reassemble_push_outer()

static struct rte_mbuf* ip_frag_pkt_reassemble_push_outer ( struct ip_frag_wt_data wt_data,
struct rte_mbuf *  pkt,
struct tun_parser_ctx parse_ctx,
uint64_t  rx_ts 
)
static

Definition at line 338 of file ip_frag_dp.c.

◆ ip_frag_pkts_fragment()

static void ip_frag_pkts_fragment ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id,
struct rte_mbuf *  pkts[],
int  pkts_cnt 
)
static

Definition at line 684 of file ip_frag_dp.c.

◆ ip_frag_pkts_reassemble()

static void ip_frag_pkts_reassemble ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id,
enum parser_pkt_type  pkt_type,
struct rte_mbuf *  pkts[],
int  pkts_cnt,
uint64_t  rx_ts 
)
static

Definition at line 520 of file ip_frag_dp.c.

◆ ip_frag_rss_pipe_create()

static doca_error_t ip_frag_rss_pipe_create ( struct ip_frag_ctx ctx,
uint16_t  port_id,
char *  pipe_name,
bool  is_root,
uint32_t  flags,
struct doca_flow_pipe *  pipe_miss,
struct doca_flow_pipe **  pipe_out 
)
static

Definition at line 1133 of file ip_frag_dp.c.

◆ ip_frag_rss_pipes_create()

static doca_error_t ip_frag_rss_pipes_create ( struct ip_frag_ctx ctx)
static

Definition at line 1209 of file ip_frag_dp.c.

◆ ip_frag_sw_counters_print()

static void ip_frag_sw_counters_print ( struct ip_frag_ctx ctx,
struct ip_frag_wt_data wt_data_arr 
)
static

Definition at line 935 of file ip_frag_dp.c.

◆ ip_frag_tbl_stats_print()

static void ip_frag_tbl_stats_print ( struct ip_frag_wt_data wt_data_arr)
static

Definition at line 1032 of file ip_frag_dp.c.

◆ ip_frag_tx_buffer_error_print()

static void ip_frag_tx_buffer_error_print ( struct ip_frag_wt_data wt_data_arr)
static

Definition at line 1007 of file ip_frag_dp.c.

◆ ip_frag_udp_cksum_handle()

static void ip_frag_udp_cksum_handle ( struct ip_frag_wt_data wt_data,
struct rte_mbuf *  pkt,
struct link_parser_ctx link_ctx,
struct network_parser_ctx network_ctx,
struct transport_parser_ctx transport_ctx 
)
static

Definition at line 202 of file ip_frag_dp.c.

◆ ip_frag_wt_data_cleanup()

static void ip_frag_wt_data_cleanup ( struct ip_frag_wt_data wt_data_arr)
static

Definition at line 844 of file ip_frag_dp.c.

◆ ip_frag_wt_data_init()

static doca_error_t ip_frag_wt_data_init ( const struct ip_frag_config cfg,
struct rte_mempool *  indirect_pools[],
struct ip_frag_wt_data **  wt_data_arr_out 
)
static

Definition at line 869 of file ip_frag_dp.c.

◆ ip_frag_wt_fragment()

static void ip_frag_wt_fragment ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id 
)
static

Definition at line 717 of file ip_frag_dp.c.

◆ ip_frag_wt_reassemble()

static void ip_frag_wt_reassemble ( struct ip_frag_wt_data wt_data,
uint16_t  rx_port_id,
uint16_t  tx_port_id,
enum parser_pkt_type  pkt_type 
)
static

Definition at line 550 of file ip_frag_dp.c.

◆ ip_frag_wt_thread_main()

static int ip_frag_wt_thread_main ( void *  param)
static

Definition at line 733 of file ip_frag_dp.c.

Variable Documentation

◆ cfg

const struct ip_frag_config* cfg

Definition at line 0 of file ip_frag_dp.c.

◆ death_row

struct rte_ip_frag_death_row death_row

Definition at line 6 of file ip_frag_dp.c.

◆ force_stop

bool force_stop = false

Definition at line 71 of file ip_frag_dp.c.

◆ frag_tbl

struct rte_ip_frag_tbl* frag_tbl

Definition at line 5 of file ip_frag_dp.c.

◆ indirect_pool

struct rte_mempool* indirect_pool

Definition at line 6 of file ip_frag_dp.c.

◆ queue_id

uint16_t queue_id

Definition at line 1 of file ip_frag_dp.c.

◆ sw_counters

Definition at line 1 of file ip_frag_dp.c.

◆ tx_buffer

struct rte_eth_dev_tx_buffer* tx_buffer

Definition at line 3 of file ip_frag_dp.c.

◆ tx_buffer_err

uint64_t tx_buffer_err

Definition at line 4 of file ip_frag_dp.c.