X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=VNFs%2FDPPD-PROX%2Ftask_base.h;h=df876e9a10d9ea921326ccee138e71ba026dd866;hb=8442f6a8ce0962d818b7cd800150980c65983719;hp=62841e96c0eb95cd4a0d3f22a543099553d8dbd8;hpb=f608601d06f2da7dcb52f0a0da6caebd12412ad1;p=samplevnf.git diff --git a/VNFs/DPPD-PROX/task_base.h b/VNFs/DPPD-PROX/task_base.h index 62841e96..df876e9a 100644 --- a/VNFs/DPPD-PROX/task_base.h +++ b/VNFs/DPPD-PROX/task_base.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ #define TASK_FEATURE_NEVER_DISCARDS 0x0008 #define TASK_FEATURE_NO_RX 0x0010 #define TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS 0x0020 -#define TASK_FEATURE_TXQ_FLAGS_NOMULTSEGS 0x0040 +#define TASK_FEATURE_TXQ_FLAGS_MULTSEGS 0x0040 #define TASK_FEATURE_ZERO_RX 0x0080 #define TASK_FEATURE_TXQ_FLAGS_REFCOUNT 0x0100 #define TASK_FEATURE_TSC_RX 0x0200 @@ -53,8 +53,7 @@ #define TASK_FEATURE_LUT_QINQ_RSS 0x2000 #define TASK_FEATURE_LUT_QINQ_HASH 0x4000 #define TASK_FEATURE_RX_ALL 0x8000 -#define TASK_MULTIPLE_MAC 0x10000 -#define TASK_FEATURE_L3 0x20000 +#define TASK_FEATURE_TXQ_FLAGS_MULTIPLE_MEMPOOL 0x20000 #define FLAG_TX_FLUSH 0x01 #define FLAG_NEVER_FLUSH 0x02 @@ -144,6 +143,9 @@ struct task_base; #define MAX_RX_PKT_ALL 16384 +#define RX_BUCKET_SIZE (2 * MAX_RING_BURST + 1) /* Limit RX bucket size */ +#define TX_BUCKET_SIZE (MAX_RING_BURST +1) + #define MAX_STACKED_RX_FUCTIONS 16 typedef uint16_t (*rx_pkt_func) (struct task_base *tbase, struct rte_mbuf ***mbufs); @@ -151,7 +153,6 @@ typedef uint16_t (*rx_pkt_func) (struct task_base *tbase, struct rte_mbuf ***mbu struct task_base_aux { /* Not used when PROX_STATS is not defined */ struct task_rt_stats stats; - struct task_rt_dump task_rt_dump; /* Used if TASK_TSC_RX is enabled*/ struct { @@ -161,20 +162,23 @@ struct task_base_aux { struct rte_mbuf **all_mbufs; - int rx_prev_count; - int rx_prev_idx; + uint16_t rx_prev_count; + uint16_t rx_prev_idx; uint16_t (*rx_pkt_prev[MAX_STACKED_RX_FUCTIONS])(struct task_base *tbase, struct rte_mbuf ***mbufs); - uint32_t rx_bucket[MAX_RING_BURST + 1]; - uint32_t tx_bucket[MAX_RING_BURST + 1]; + uint32_t rx_bucket[RX_BUCKET_SIZE]; + uint32_t tx_bucket[TX_BUCKET_SIZE]; int (*tx_pkt_l2)(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts, uint8_t *out); int (*tx_pkt_orig)(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts, uint8_t *out); int (*tx_pkt_hw)(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts, uint8_t *out); uint16_t (*tx_pkt_try)(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts); void (*stop)(struct task_base *tbase); + int (*tx_ctrlplane_pkt)(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts, uint8_t *out); void (*start)(struct task_base *tbase); void (*stop_last)(struct task_base *tbase); void (*start_first)(struct task_base *tbase); + struct task_rt_dump task_rt_dump; + struct rte_mbuf *mbuf; }; /* The task_base is accessed for _all_ task types. In case @@ -205,7 +209,6 @@ struct task_base { struct tx_params_hw_sw tx_params_hw_sw; }; struct l3_base l3; - uint32_t local_ipv4; } __attribute__((packed)) __rte_cache_aligned; static void task_base_add_rx_pkt_function(struct task_base *tbase, rx_pkt_func to_add) @@ -214,8 +217,8 @@ static void task_base_add_rx_pkt_function(struct task_base *tbase, rx_pkt_func t return; } - for (int16_t i = tbase->aux->rx_prev_count; i >= 0; --i) { - tbase->aux->rx_pkt_prev[i + 1] = tbase->aux->rx_pkt_prev[i]; + for (int16_t i = tbase->aux->rx_prev_count; i > 0; --i) { + tbase->aux->rx_pkt_prev[i] = tbase->aux->rx_pkt_prev[i - 1]; } tbase->aux->rx_pkt_prev[0] = tbase->rx_pkt; tbase->rx_pkt = to_add; @@ -227,8 +230,13 @@ static void task_base_del_rx_pkt_function(struct task_base *tbase, rx_pkt_func t int cur = 0; int found = 0; - if (tbase->aux->rx_prev_count == 1) { + if (unlikely(tbase->aux->rx_prev_count == 0)) { + return; + } else if (tbase->rx_pkt == to_del) { tbase->rx_pkt = tbase->aux->rx_pkt_prev[0]; + for (int16_t i = 0; i < tbase->aux->rx_prev_count - 1; ++i) { + tbase->aux->rx_pkt_prev[i] = tbase->aux->rx_pkt_prev[i + 1]; + } found = 1; } else { for (int16_t i = 0; i < tbase->aux->rx_prev_count; ++i) {