Prepare for DPDK 19.08 support
[samplevnf.git] / VNFs / DPPD-PROX / defaults.c
index a6be0d7..915ee31 100644 (file)
 #include "etypes.h"
 #include "toeplitz.h"
 #include "handle_master.h"
+#include "prox_compat.h"
 
 #define TEN_GIGABIT     1250000000
 #define QUEUE_SIZES     128
 #define NB_PIPES        32768
 #define NB_MBUF         4096
 #define RING_RX_SIZE    256
-#define NB_RX_RING_DESC 256
-#define NB_TX_RING_DESC 256
+#define NB_RX_RING_DESC 2048
+#define NB_TX_RING_DESC 2048
 
 /* 1500000 milliseconds */
 #define DEFAULT_CPE_TIMEOUT_MS    1500000
 
 static const struct rte_eth_conf default_port_conf = {
        .rxmode = {
-               .split_hdr_size = 0,
-               .header_split   = 0, /* Header Split disabled */
-               .hw_ip_checksum = 0, /* IP checksum offload disabled */
-               .hw_vlan_filter = 0, /* VLAN filtering disabled */
-               .hw_vlan_strip = 0, /* VLAN filtering disabled */
-               .jumbo_frame    = 0, /* Jumbo frame support disabled */
-               .hw_strip_crc   = 1, /* CRC stripped by hardware --- always set to 1 in VF */
-               .hw_vlan_extend = 0,
                .mq_mode        = 0,
-               .max_rx_pkt_len = PROX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
+               .max_rx_pkt_len = PROX_MTU + PROX_RTE_ETHER_HDR_LEN + PROX_RTE_ETHER_CRC_LEN
        },
        .rx_adv_conf = {
                .rss_conf = {
@@ -153,19 +146,20 @@ void set_task_defaults(struct prox_cfg* prox_cfg, struct lcore_cfg* lcore_cfg_in
                                targ->mapping[i] = i; // identity
                        }
 
-                       targ->cbs = ETHER_MAX_LEN;
-                       targ->ebs = ETHER_MAX_LEN;
-                       targ->pbs = ETHER_MAX_LEN;
+                       targ->cbs = PROX_RTE_ETHER_MAX_LEN;
+                       targ->ebs = PROX_RTE_ETHER_MAX_LEN;
+                       targ->pbs = PROX_RTE_ETHER_MAX_LEN;
 
                        targ->n_max_rules = 1024;
                        targ->ring_size = RING_RX_SIZE;
                        targ->nb_cache_mbuf = MAX_PKT_BURST * 4;
-                       targ->overhead = ETHER_CRC_LEN + 20;
+                       targ->overhead = PROX_RTE_ETHER_CRC_LEN + 20;
 
                        targ->tunnel_hop_limit = 3;
                        targ->ctrl_freq = 1000;
                        targ->lb_friend_core = 0xFF;
-                       targ->n_pkts = 1024*64;
+                       targ->n_pkts = 0;
+
                        targ->runtime_flags |= TASK_TX_CRC;
                        targ->accuracy_limit_nsec = 5000;
                }
@@ -176,6 +170,7 @@ void set_port_defaults(void)
 {
        for (uint8_t i = 0; i < PROX_MAX_PORTS; ++i ) {
                prox_port_cfg[i].promiscuous = 1;
+               prox_port_cfg[i].nb_mc_addr = 0;
                prox_port_cfg[i].n_rxd = NB_RX_RING_DESC;
                prox_port_cfg[i].n_txd = NB_TX_RING_DESC;
                prox_port_cfg[i].port_conf = default_port_conf;
@@ -184,5 +179,12 @@ void set_port_defaults(void)
                prox_port_cfg[i].rx_ring[0] = '\0';
                prox_port_cfg[i].tx_ring[0] = '\0';
                prox_port_cfg[i].mtu = PROX_MTU;
+
+               // CRC_STRIP becoming the default behavior in DPDK 18.08, and
+               // DEV_RX_OFFLOAD_CRC_STRIP define has been deleted
+#if defined (DEV_RX_OFFLOAD_CRC_STRIP)
+               prox_port_cfg[i].requested_rx_offload = DEV_RX_OFFLOAD_CRC_STRIP;
+#endif
+               prox_port_cfg[i].requested_tx_offload = DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM;
        }
 }