Use updated DPDK scheduling schema in Prox
[samplevnf.git] / VNFs / DPPD-PROX / handle_qos.c
index 142143e..de9548f 100644 (file)
@@ -34,6 +34,7 @@
 #include "qinq.h"
 #include "prox_cfg.h"
 #include "prox_shared.h"
+#include "prox_compat.h"
 
 struct task_qos {
        struct task_base base;
@@ -75,7 +76,7 @@ static inline int handle_qos_bulk(struct task_base *tbase, struct rte_mbuf **mbu
                                const struct qinq_hdr *pqinq = rte_pktmbuf_mtod(mbufs[j], const struct qinq_hdr *);
                                uint32_t qinq = PKT_TO_LUTQINQ(pqinq->svlan.vlan_tci, pqinq->cvlan.vlan_tci);
                                if (pqinq->ether_type == ETYPE_IPv4) {
-                                       const struct ipv4_hdr *ipv4_hdr = (const struct ipv4_hdr *)(pqinq + 1);
+                                       const prox_rte_ipv4_hdr *ipv4_hdr = (const prox_rte_ipv4_hdr *)(pqinq + 1);
                                        queue = task->dscp[ipv4_hdr->type_of_service >> 2] & 0x3;
                                        tc = task->dscp[ipv4_hdr->type_of_service >> 2] >> 2;
                                } else {
@@ -83,8 +84,7 @@ static inline int handle_qos_bulk(struct task_base *tbase, struct rte_mbuf **mbu
                                        queue = 0;
                                        tc = 0;
                                }
-
-                               rte_sched_port_pkt_write(mbufs[j], 0, task->user_table[qinq], tc, queue, 0);
+                               prox_rte_sched_port_pkt_write(task->sched_port, mbufs[j], 0, task->user_table[qinq], tc, queue, 0);
                        }
 #ifdef PROX_PREFETCH_OFFSET
                        prefetch_nta(rte_pktmbuf_mtod(mbufs[n_pkts - 1], void *));
@@ -92,7 +92,7 @@ static inline int handle_qos_bulk(struct task_base *tbase, struct rte_mbuf **mbu
                                const struct qinq_hdr *pqinq = rte_pktmbuf_mtod(mbufs[j], const struct qinq_hdr *);
                                uint32_t qinq = PKT_TO_LUTQINQ(pqinq->svlan.vlan_tci, pqinq->cvlan.vlan_tci);
                                if (pqinq->ether_type == ETYPE_IPv4) {
-                                       const struct ipv4_hdr *ipv4_hdr = (const struct ipv4_hdr *)(pqinq + 1);
+                                       const prox_rte_ipv4_hdr *ipv4_hdr = (const prox_rte_ipv4_hdr *)(pqinq + 1);
                                        queue = task->dscp[ipv4_hdr->type_of_service >> 2] & 0x3;
                                        tc = task->dscp[ipv4_hdr->type_of_service >> 2] >> 2;
                                } else {
@@ -101,7 +101,7 @@ static inline int handle_qos_bulk(struct task_base *tbase, struct rte_mbuf **mbu
                                        tc = 0;
                                }
 
-                               rte_sched_port_pkt_write(mbufs[j], 0, task->user_table[qinq], tc, queue, 0);
+                               prox_rte_sched_port_pkt_write(task->sched_port, mbufs[j], 0, task->user_table[qinq], tc, queue, 0);
                        }
 #endif
                }
@@ -135,7 +135,11 @@ static void init_task_qos(struct task_base *tbase, struct task_args *targ)
        PROX_PANIC(task->sched_port == NULL, "failed to create sched_port");
 
        plog_info("number of pipes: %d\n\n", targ->qos_conf.port_params.n_pipes_per_subport);
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+       int err = rte_sched_subport_config(task->sched_port, 0, targ->qos_conf.subport_params, 0);
+#else
        int err = rte_sched_subport_config(task->sched_port, 0, targ->qos_conf.subport_params);
+#endif
        PROX_PANIC(err != 0, "Failed setting up sched_port subport, error: %d", err);
 
        /* only single subport and single pipe profile is supported */
@@ -166,6 +170,7 @@ static void init_task_qos(struct task_base *tbase, struct task_args *targ)
 }
 
 static struct task_init task_init_qos = {
+       .mode = QOS,
        .mode_str = "qos",
        .init = init_task_qos,
        .handle = handle_qos_bulk,