From 4cc4dabe80eb7d19c20920b7ec20899d6a76a1dd Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Tue, 28 May 2019 15:31:43 +0200 Subject: Added support for DPDK 19.02 and 19.05 This includes supporting following API changes - RTE_VER_... now in rte_config.h instead of rte_version.h - now seems required by - rte_sched_port_pkt_write takes extra argument - rte_sched_port_pkt_read_tree_path takes extra argument - enum rte_meter_color replaced by rte_color The extra argument, sched_port, is initialized based on qos_conf parameters. Modes such as qinq_encap4 uses sched_port when doing classification, but does not set qos_conf params. It inherits the sched_port from QoS Change-Id: If8312918241e7d482161a7538f53faac6c303e86 Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/handle_police.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'VNFs/DPPD-PROX/handle_police.c') diff --git a/VNFs/DPPD-PROX/handle_police.c b/VNFs/DPPD-PROX/handle_police.c index c897bc1d..0d46cc16 100644 --- a/VNFs/DPPD-PROX/handle_police.c +++ b/VNFs/DPPD-PROX/handle_police.c @@ -33,6 +33,7 @@ #include "qinq.h" #include "prox_cfg.h" #include "prox_shared.h" +#include "prox_compat.h" #if RTE_VERSION < RTE_VERSION_NUM(1,8,0,0) #define RTE_CACHE_LINE_SIZE CACHE_LINE_SIZE @@ -54,14 +55,15 @@ struct task_police { enum police_action police_act[3][3]; uint16_t overhead; uint8_t runtime_flags; + struct rte_sched_port *sched_port; }; typedef uint8_t (*hp) (struct task_police *task, struct rte_mbuf *mbuf, uint64_t tsc, uint32_t user); static uint8_t handle_police(struct task_police *task, struct rte_mbuf *mbuf, uint64_t tsc, uint32_t user) { - enum rte_meter_color in_color = e_RTE_METER_GREEN; - enum rte_meter_color out_color; + enum prox_rte_color in_color = RTE_COLOR_GREEN; + enum prox_rte_color out_color; uint32_t pkt_len = rte_pktmbuf_pkt_len(mbuf) + task->overhead; #if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0) @@ -74,8 +76,8 @@ static uint8_t handle_police(struct task_police *task, struct rte_mbuf *mbuf, ui static uint8_t handle_police_tr(struct task_police *task, struct rte_mbuf *mbuf, uint64_t tsc, uint32_t user) { - enum rte_meter_color in_color = e_RTE_METER_GREEN; - enum rte_meter_color out_color; + enum prox_rte_color in_color = RTE_COLOR_GREEN; + enum prox_rte_color out_color; uint32_t pkt_len = rte_pktmbuf_pkt_len(mbuf) + task->overhead; #if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0) out_color = rte_meter_trtcm_color_aware_check(&task->tr_flows[user], tsc, pkt_len, in_color); @@ -86,12 +88,12 @@ static uint8_t handle_police_tr(struct task_police *task, struct rte_mbuf *mbuf, if (task->runtime_flags & TASK_MARK) { #if RTE_VERSION >= RTE_VERSION_NUM(1,8,0,0) uint32_t subport, pipe, traffic_class, queue; - enum rte_meter_color color; + enum prox_rte_color color; - rte_sched_port_pkt_read_tree_path(mbuf, &subport, &pipe, &traffic_class, &queue); + prox_rte_sched_port_pkt_read_tree_path(task->sched_port, mbuf, &subport, &pipe, &traffic_class, &queue); color = task->police_act[in_color][out_color]; - rte_sched_port_pkt_write(mbuf, subport, pipe, traffic_class, queue, color); + prox_rte_sched_port_pkt_write(task->sched_port, mbuf, subport, pipe, traffic_class, queue, color); #else struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &mbuf->pkt.hash.sched; @@ -113,7 +115,7 @@ static inline int get_user(struct task_police *task, struct rte_mbuf *mbuf) uint32_t dummy; uint32_t pipe; - rte_sched_port_pkt_read_tree_path(mbuf, &dummy, &pipe, &dummy, &dummy); + prox_rte_sched_port_pkt_read_tree_path(task->sched_port, mbuf, &dummy, &pipe, &dummy, &dummy); return pipe; #else struct rte_sched_port_hierarchy *sched = @@ -215,6 +217,8 @@ static void init_task_police(struct task_base *tbase, struct task_args *targ) prox_sh_add_socket(socket_id, "user_table", task->user_table); } + task->sched_port = rte_sched_port_config(&targ->qos_conf.port_params); + if (strcmp(targ->task_init->sub_mode_str, "trtcm")) { task->sr_flows = prox_zmalloc(targ->n_flows * sizeof(*task->sr_flows), socket_id); PROX_PANIC(task->sr_flows == NULL, "Failed to allocate flow contexts\n"); @@ -273,6 +277,7 @@ static void init_task_police(struct task_base *tbase, struct task_args *targ) } static struct task_init task_init_police = { + .mode = POLICE, .mode_str = "police", .init = init_task_police, .handle = handle_police_bulk, @@ -281,6 +286,7 @@ static struct task_init task_init_police = { }; static struct task_init task_init_police2 = { + .mode = POLICE, .mode_str = "police", .sub_mode_str = "trtcm", .init = init_task_police, -- cgit 1.2.3-korg