Renaming of defines for clarity 56/74056/1
authorLuc Provoost <luc.provoost@gmail.com>
Thu, 29 Jun 2023 08:58:18 +0000 (10:58 +0200)
committerLuc Provoost <luc.provoost@gmail.com>
Thu, 29 Jun 2023 08:58:18 +0000 (10:58 +0200)
Add the prefix TBASE_FLAG to all defines that are used in the flags field
of the tbase structure

Signed-off-by: Luc Provoost <luc.provoost@gmail.com>
Change-Id: Ic7c6c1ba66fbda5a4a43e9a3bf966710157b5b17

VNFs/DPPD-PROX/handle_esp.c
VNFs/DPPD-PROX/handle_lb_qinq.c
VNFs/DPPD-PROX/lconf.h
VNFs/DPPD-PROX/task_base.h
VNFs/DPPD-PROX/task_init.c
VNFs/DPPD-PROX/tx_pkt.c

index bdcd157..be46c21 100644 (file)
@@ -427,7 +427,7 @@ static void init_task_esp_enc(struct task_base *tbase, struct task_args *targ)
        struct task_esp *task = (struct task_esp *)tbase;
        unsigned int session_size;
 
-       tbase->flags |= FLAG_NEVER_FLUSH;
+       tbase->flags |= TBASE_FLAG_NEVER_FLUSH;
 
        uint8_t lcore_id = targ->lconf->id;
        char name[64];
@@ -525,7 +525,7 @@ static void init_task_esp_dec(struct task_base *tbase, struct task_args *targ)
        struct task_esp *task = (struct task_esp *)tbase;
        unsigned int session_size;
 
-       tbase->flags |= FLAG_NEVER_FLUSH;
+       tbase->flags |= TBASE_FLAG_NEVER_FLUSH;
 
        uint8_t lcore_id = targ->lconf->id;
        char name[64];
index a2f1b1f..9726edd 100644 (file)
@@ -104,9 +104,9 @@ static void init_task_lb_qinq(struct task_base *tbase, struct task_args *targ)
        plog_info("\t\ttask_lb_qinq protocols_mask = 0x%x\n", task->protocols_mask);
 
        if (targ->task_init->flag_features & TASK_FEATURE_LUT_QINQ_RSS)
-               tbase->flags |=  BASE_FLAG_LUT_QINQ_RSS;
+               tbase->flags |=  TBASE_FLAG_LUT_QINQ_RSS;
        if (targ->task_init->flag_features & TASK_FEATURE_LUT_QINQ_HASH)
-               tbase->flags |=  BASE_FLAG_LUT_QINQ_HASH;
+               tbase->flags |=  TBASE_FLAG_LUT_QINQ_HASH;
        plog_info("\t\ttask_lb_qinq flags = 0x%x\n", tbase->flags);
 }
 
@@ -275,7 +275,7 @@ struct cpe_packet {
 static inline uint8_t get_worker(struct task_lb_qinq *task, struct cpe_packet *packet)
 {
        uint8_t worker = 0;
-       if (((struct task_base *)task)->flags & BASE_FLAG_LUT_QINQ_HASH) {
+       if (((struct task_base *)task)->flags & TBASE_FLAG_LUT_QINQ_HASH) {
                // Load Balance on Hash of combination of cvlan and svlan
                uint64_t qinq_net = packet->qd.qinq;
                qinq_net = qinq_net & 0xFF0F0000FF0F0000;       // Mask Proto and QoS bits
@@ -286,7 +286,7 @@ static inline uint8_t get_worker(struct task_lb_qinq *task, struct cpe_packet *p
                        worker = rte_hash_crc(&qinq_net,8,0) % task->nb_worker_threads;
                }
                plogx_dbg("Sending packet svlan=%x, cvlan=%x, pseudo_qinq=%lx to worker %d\n", rte_bswap16(0xFF0F & packet->qp.qinq_hdr.svlan.vlan_tci), rte_bswap16(0xFF0F & packet->qp.qinq_hdr.cvlan.vlan_tci), qinq_net, worker);
-       } else if (((struct task_base *)task)->flags & BASE_FLAG_LUT_QINQ_RSS){
+       } else if (((struct task_base *)task)->flags & TBASE_FLAG_LUT_QINQ_RSS){
                // Load Balance on rss of combination of cvlan and svlan
                uint32_t qinq = (packet->qp.qinq_hdr.cvlan.vlan_tci & 0xFF0F) << 16;
                uint32_t rss = toeplitz_hash((uint8_t *)&qinq, 4);
index 09f59cd..897e6b3 100644 (file)
@@ -105,8 +105,8 @@ static inline void lconf_flush_all_queues(struct lcore_cfg *lconf)
 
        for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) {
                task = lconf->tasks_all[task_id];
-               if (!(task->flags & FLAG_TX_FLUSH) || (task->flags & FLAG_NEVER_FLUSH)) {
-                       task->flags |= FLAG_TX_FLUSH;
+               if (!(task->flags & TBASE_FLAG_TX_FLUSH) || (task->flags & TBASE_FLAG_NEVER_FLUSH)) {
+                       task->flags |= TBASE_FLAG_TX_FLUSH;
                        continue;
                }
                lconf->flush_queues[task_id](task);
index e0c87b0..7e231fc 100644 (file)
 #define TASK_FEATURE_RX_ALL                    0x8000
 #define TASK_FEATURE_TXQ_FLAGS_MULTIPLE_MEMPOOL        0x20000
 
-#define FLAG_TX_FLUSH                  0x01
-#define FLAG_NEVER_FLUSH               0x02
+#define TBASE_FLAG_TX_FLUSH                  0x01
+#define TBASE_FLAG_NEVER_FLUSH               0x02
 // Task specific flags
-#define BASE_FLAG_LUT_QINQ_HASH        0x08
-#define BASE_FLAG_LUT_QINQ_RSS         0x10
+#define TBASE_FLAG_LUT_QINQ_HASH               0x08
+#define TBASE_FLAG_LUT_QINQ_RSS        0x10
 
 #define OUT_DISCARD 0xFF
 #define OUT_HANDLED 0xFE
index 9fc0562..97f7188 100644 (file)
@@ -302,7 +302,7 @@ static size_t init_rx_tx_rings_ports(struct task_args *targ, struct task_base *t
                                        tbase->tx_pkt = targ->nb_txrings ? tx_pkt_no_drop_never_discard_sw1 : tx_pkt_no_drop_never_discard_hw1_lat_opt;
                        }
                        if ((targ->nb_txrings) || ((targ->task_init->flag_features & TASK_FEATURE_THROUGHPUT_OPT) == 0))
-                               tbase->flags |= FLAG_NEVER_FLUSH;
+                               tbase->flags |= TBASE_FLAG_NEVER_FLUSH;
                        else
                                targ->lconf->flush_queues[targ->task] = flush_function(targ);
                }
@@ -316,7 +316,7 @@ static size_t init_rx_tx_rings_ports(struct task_args *targ, struct task_base *t
                        else {
                                tbase->tx_pkt = targ->nb_txrings ? tx_pkt_no_drop_sw1 : tx_pkt_no_drop_hw1;
                        }
-                       tbase->flags |= FLAG_NEVER_FLUSH;
+                       tbase->flags |= TBASE_FLAG_NEVER_FLUSH;
                }
        }
        else {
@@ -352,7 +352,7 @@ struct task_base *init_task_struct(struct task_args *targ)
        offset += t->size;
 
        if (targ->nb_txrings == 0 && targ->nb_txports == 0)
-               tbase->flags |= FLAG_NEVER_FLUSH;
+               tbase->flags |= TBASE_FLAG_NEVER_FLUSH;
 
        offset = init_rx_tx_rings_ports(targ, tbase, offset);
        tbase->aux = (struct task_base_aux *)(((uint8_t *)tbase) + offset);
index 551056a..cd62cc5 100644 (file)
@@ -286,7 +286,7 @@ void flush_queues_hw(struct task_base *tbase)
                }
        }
 
-       tbase->flags &= ~FLAG_TX_FLUSH;
+       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
 }
 
 void flush_queues_sw(struct task_base *tbase)
@@ -303,7 +303,7 @@ void flush_queues_sw(struct task_base *tbase)
                        ring_enq_drop(tbase->tx_params_sw.tx_rings[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), prod - cons, tbase);
                }
        }
-       tbase->flags &= ~FLAG_TX_FLUSH;
+       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
 }
 
 void flush_queues_no_drop_hw(struct task_base *tbase)
@@ -321,7 +321,7 @@ void flush_queues_no_drop_hw(struct task_base *tbase)
                }
        }
 
-       tbase->flags &= ~FLAG_TX_FLUSH;
+       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
 }
 
 void flush_queues_no_drop_sw(struct task_base *tbase)
@@ -338,7 +338,7 @@ void flush_queues_no_drop_sw(struct task_base *tbase)
                        ring_enq_no_drop(tbase->tx_params_sw.tx_rings[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), prod - cons, tbase);
                }
        }
-       tbase->flags &= ~FLAG_TX_FLUSH;
+       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
 }
 
 /* "try" functions try to send packets to sw/hw w/o failing or blocking;
@@ -427,7 +427,7 @@ int tx_pkt_no_drop_never_discard_hw1_thrpt_opt(struct task_base *tbase, struct r
                        cons = tbase->ws_mbuf->idx[0].cons;
 
                if ((uint16_t)(prod - cons)){
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[0].prod = 0;
                        tbase->ws_mbuf->idx[0].cons = 0;
                        ret+= txhw_no_drop(&tbase->tx_params_hw.tx_port_queue[0], tbase->ws_mbuf->mbuf[0] + (cons & WS_MBUF_MASK), (uint16_t)(prod - cons), tbase);
@@ -456,7 +456,7 @@ int tx_pkt_never_discard_hw1_thrpt_opt(struct task_base *tbase, struct rte_mbuf
                        cons = tbase->ws_mbuf->idx[0].cons;
 
                if ((uint16_t)(prod - cons)){
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[0].prod = 0;
                        tbase->ws_mbuf->idx[0].cons = 0;
                        ret+= txhw_drop(&tbase->tx_params_hw.tx_port_queue[0], tbase->ws_mbuf->mbuf[0] + (cons & WS_MBUF_MASK), (uint16_t)(prod - cons), tbase);
@@ -595,7 +595,7 @@ int tx_pkt_no_drop_hw(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t
                cons = tbase->ws_mbuf->idx[i].cons;
 
                if (((uint16_t)(prod - cons)) >= MAX_PKT_BURST) {
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[i].cons = cons + MAX_PKT_BURST;
                        ret+= txhw_no_drop(&tbase->tx_params_hw.tx_port_queue[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), MAX_PKT_BURST, tbase);
                }
@@ -616,7 +616,7 @@ int tx_pkt_no_drop_sw(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t
                cons = tbase->ws_mbuf->idx[i].cons;
 
                if (((uint16_t)(prod - cons)) >= MAX_PKT_BURST) {
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[i].cons = cons + MAX_PKT_BURST;
                        ret += ring_enq_no_drop(tbase->tx_params_sw.tx_rings[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), MAX_PKT_BURST, tbase);
                }
@@ -637,7 +637,7 @@ int tx_pkt_hw(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts,
                cons = tbase->ws_mbuf->idx[i].cons;
 
                if (((uint16_t)(prod - cons)) >= MAX_PKT_BURST) {
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[i].cons = cons + MAX_PKT_BURST;
                        ret += txhw_drop(&tbase->tx_params_hw.tx_port_queue[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), MAX_PKT_BURST, tbase);
                }
@@ -657,7 +657,7 @@ int tx_pkt_sw(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts,
                cons = tbase->ws_mbuf->idx[i].cons;
 
                if (((uint16_t)(prod - cons)) >= MAX_PKT_BURST) {
-                       tbase->flags &= ~FLAG_TX_FLUSH;
+                       tbase->flags &= ~TBASE_FLAG_TX_FLUSH;
                        tbase->ws_mbuf->idx[i].cons = cons + MAX_PKT_BURST;
                        ret+= ring_enq_drop(tbase->tx_params_sw.tx_rings[i], tbase->ws_mbuf->mbuf[i] + (cons & WS_MBUF_MASK), MAX_PKT_BURST, tbase);
                }