Added support for DPDK 19.11
[samplevnf.git] / VNFs / DPPD-PROX / prox_args.c
index b99796b..5d33957 100644 (file)
@@ -242,7 +242,7 @@ const char *get_cfg_dir(void)
        while (end > 0 && cfg_file[end] != '/')
                end--;
 
-       prox_strncpy(dir, cfg_file, end);
+       strncpy(dir, cfg_file, end);
        return dir;
 }
 
@@ -534,6 +534,17 @@ static int get_port_cfg(unsigned sindex, char *str, void *data)
                }
                cfg->promiscuous = val;
        }
+       else if (STR_EQ(str, "multicast")) {
+               uint32_t val;
+               if (cfg->nb_mc_addr >= NB_MCAST_ADDR) {
+                       plog_err("too many multicast addresses\n");
+                       return -1;
+               }
+               if (parse_mac(&cfg->mc_addr[cfg->nb_mc_addr], pkey)) {
+                       return -1;
+               }
+               cfg->nb_mc_addr++ ;
+       }
        else if (STR_EQ(str, "lsc")) {
                cfg->lsc_set_explicitely = 1;
                uint32_t val;
@@ -557,10 +568,20 @@ static int get_port_cfg(unsigned sindex, char *str, void *data)
                if (parse_bool(&val, pkey)) {
                        return -1;
                }
+#if defined(DEV_RX_OFFLOAD_CRC_STRIP)
                if (val)
                        cfg->requested_rx_offload |= DEV_RX_OFFLOAD_CRC_STRIP;
                else
                        cfg->requested_rx_offload &= ~DEV_RX_OFFLOAD_CRC_STRIP;
+#else
+#if defined (DEV_RX_OFFLOAD_KEEP_CRC)
+               if (val)
+                       cfg->requested_rx_offload &= ~DEV_RX_OFFLOAD_KEEP_CRC;
+               else
+#endif
+                       cfg->requested_rx_offload |= DEV_RX_OFFLOAD_KEEP_CRC;
+#endif
+
        }
        else if (STR_EQ(str, "vlan")) {
 #if RTE_VERSION >= RTE_VERSION_NUM(18,8,0,1)
@@ -589,8 +610,8 @@ static int get_port_cfg(unsigned sindex, char *str, void *data)
                        // A frame of 1526 bytes (1500 bytes mtu, 14 bytes hdr, 4 bytes crc and 8 bytes vlan)
                        // should not be considered as a jumbo frame. However rte_ethdev.c considers that
                        // the max_rx_pkt_len for a non jumbo frame is 1518
-                       cfg->port_conf.rxmode.max_rx_pkt_len = cfg->mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
-                       if (cfg->port_conf.rxmode.max_rx_pkt_len > ETHER_MAX_LEN) {
+                       cfg->port_conf.rxmode.max_rx_pkt_len = cfg->mtu + PROX_RTE_ETHER_HDR_LEN + PROX_RTE_ETHER_CRC_LEN;
+                       if (cfg->port_conf.rxmode.max_rx_pkt_len > PROX_RTE_ETHER_MAX_LEN) {
                                cfg->requested_rx_offload |= DEV_RX_OFFLOAD_JUMBO_FRAME;
                        }
                }
@@ -856,9 +877,6 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
        if (STR_EQ(str, "fast path handle arp")) {
                return parse_flag(&targ->runtime_flags, TASK_FP_HANDLE_ARP, pkey);
        }
-       if (STR_EQ(str, "multiple arp")) {
-               return parse_flag(&targ->flags, TASK_MULTIPLE_MAC, pkey);
-       }
 
        /* Using tx port name, only a _single_ port can be assigned to a task. */
        if (STR_EQ(str, "tx port")) {
@@ -1356,6 +1374,9 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
                targ->flags |= TASK_ARG_SRC_MAC_SET;
                return 0;
        }
+       if (STR_EQ(str, "igmp ipv4")) { /* IGMP Group */
+               return parse_ip(&targ->igmp_address, pkey);
+       }
        if (STR_EQ(str, "gateway ipv4")) { /* Gateway IP address used when generating */
                if ((targ->flags & TASK_ARG_L3) == 0)
                        plog_warn("gateway ipv4 configured but L3 sub mode not enabled\n");
@@ -1395,30 +1416,60 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
                if (err) {
                        return -1;
                }
-
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               targ->qos_conf.subport_params[0].qsize[0] = val;
+               targ->qos_conf.subport_params[0].qsize[1] = val;
+               targ->qos_conf.subport_params[0].qsize[2] = val;
+               targ->qos_conf.subport_params[0].qsize[3] = val;
+#else
                targ->qos_conf.port_params.qsize[0] = val;
                targ->qos_conf.port_params.qsize[1] = val;
                targ->qos_conf.port_params.qsize[2] = val;
                targ->qos_conf.port_params.qsize[3] = val;
+#endif
                return 0;
        }
        if (STR_EQ(str, "subport tb rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tb_rate, pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tb_rate, pkey);
+#endif
        }
        if (STR_EQ(str, "subport tb size")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tb_size, pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tb_size, pkey);
+#endif
        }
        if (STR_EQ(str, "subport tc 0 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tc_rate[0], pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tc_rate[0], pkey);
+#endif
        }
        if (STR_EQ(str, "subport tc 1 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tc_rate[1], pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tc_rate[1], pkey);
+#endif
        }
        if (STR_EQ(str, "subport tc 2 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tc_rate[2], pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tc_rate[2], pkey);
+#endif
        }
        if (STR_EQ(str, "subport tc 3 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tc_rate[3], pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tc_rate[3], pkey);
+#endif
        }
 
        if (STR_EQ(str, "subport tc rate")) {
@@ -1436,13 +1487,25 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
                return 0;
        }
        if (STR_EQ(str, "subport tc period")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.subport_params[0].tc_period, pkey);
+#else
                return parse_int(&targ->qos_conf.subport_params[0].tc_period, pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tb rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tb_rate, pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tb_rate, pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tb size")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tb_size, pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tb_size, pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tc rate")) {
                uint32_t val;
@@ -1458,19 +1521,39 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
                return 0;
        }
        if (STR_EQ(str, "pipe tc 0 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tc_rate[0], pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tc_rate[0], pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tc 1 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tc_rate[1], pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tc_rate[1], pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tc 2 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tc_rate[2], pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tc_rate[2], pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tc 3 rate")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tc_rate[3], pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tc_rate[3], pkey);
+#endif
        }
        if (STR_EQ(str, "pipe tc period")) {
+#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0)
+               return parse_u64(&targ->qos_conf.pipe_params[0].tc_period, pkey);
+#else
                return parse_int(&targ->qos_conf.pipe_params[0].tc_period, pkey);
+#endif
        }
        if (STR_EQ(str, "police action")) {
                char *in = strstr(pkey, " io=");
@@ -1533,6 +1616,10 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
                if (err) {
                        return -1;
                }
+               if (queue_id >= RTE_SCHED_BE_QUEUES_PER_PIPE) {
+                       set_errf("queue_id must be < %d", RTE_SCHED_BE_QUEUES_PER_PIPE);
+                       return -1;
+               }
                targ->qos_conf.pipe_params[0].wrr_weights[queue_id] = val;
                return 0;
        }