Update PROX to CRC STRIP default bahavior change in DPDK 76/68176/5
authorXavier Simonart <xavier.simonart@intel.com>
Fri, 28 Jun 2019 14:56:26 +0000 (16:56 +0200)
committerPatrice Buriez <patrice.buriez@intel.com>
Thu, 10 Oct 2019 11:55:44 +0000 (11:55 +0000)
Change-Id: I7c3e2981692d823c86787b77d61190327d6448e4
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/defaults.c
VNFs/DPPD-PROX/display_ports.c
VNFs/DPPD-PROX/prox_args.c
VNFs/DPPD-PROX/prox_compat.h
VNFs/DPPD-PROX/prox_port_cfg.c
VNFs/DPPD-PROX/stats_port.c

index fce5c5c..61b4419 100644 (file)
@@ -178,7 +178,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;
        }
 }
index e7ffb1e..5475510 100644 (file)
@@ -180,6 +180,7 @@ static void display_ports_draw_per_sec_stats(void)
                struct percent rx_percent;
                struct percent tx_percent;
                if (strcmp(prox_port_cfg[port_id].short_name, "i40e") == 0) {
+#if defined (DEV_RX_OFFLOAD_CRC_STRIP)
                        if (prox_port_cfg[port_id].requested_rx_offload & DEV_RX_OFFLOAD_CRC_STRIP) {
                                rx_percent = calc_percent(last->rx_bytes - prev->rx_bytes + 24 * (last->rx_tot - prev->rx_tot), delta_t);
                                tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 24 * (last->tx_tot - prev->tx_tot), delta_t);
@@ -196,6 +197,28 @@ static void display_ports_draw_per_sec_stats(void)
                                tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 20 * (last->tx_tot - prev->tx_tot), delta_t);
                        }
                }
+#else
+#if defined DEV_RX_OFFLOAD_KEEP_CRC
+                       if (prox_port_cfg[port_id].requested_rx_offload & DEV_RX_OFFLOAD_KEEP_CRC ) {
+                               rx_percent = calc_percent(last->rx_bytes - prev->rx_bytes + 20 * (last->rx_tot - prev->rx_tot), delta_t);
+                               tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 20 * (last->tx_tot - prev->tx_tot), delta_t);
+                       } else {
+                               rx_percent = calc_percent(last->rx_bytes - prev->rx_bytes + 24 * (last->rx_tot - prev->rx_tot), delta_t);
+                               tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 24 * (last->tx_tot - prev->tx_tot), delta_t);
+                       }
+               } else {
+                       if (prox_port_cfg[port_id].requested_rx_offload & DEV_RX_OFFLOAD_KEEP_CRC ) {
+                               rx_percent = calc_percent(last->rx_bytes - prev->rx_bytes + 20 * (last->rx_tot - prev->rx_tot), delta_t);
+                               tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 20 * (last->tx_tot - prev->tx_tot), delta_t);
+                       } else {
+                               rx_percent = calc_percent(last->rx_bytes - prev->rx_bytes + 24 * (last->rx_tot - prev->rx_tot), delta_t);
+                               tx_percent = calc_percent(last->tx_bytes - prev->tx_bytes + 24 * (last->tx_tot - prev->tx_tot), delta_t);
+                       }
+               }
+#else
+#error neither DEV_RX_OFFLOAD_CRC_STRIP or DEV_RX_OFFLOAD_KEEP_CRC is defined
+#endif
+#endif
 
                display_column_print(no_mbufs_col, i, "%lu", no_mbufs_rate);
                display_column_print(ierrors_col, i, "%lu", ierrors_rate);
index df69f97..17b3298 100644 (file)
@@ -568,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)
index 5191b85..1ebacd4 100644 (file)
@@ -126,9 +126,6 @@ static void *prox_rte_table_create(struct prox_rte_table_params *params, int soc
 #define rte_cryptodev_sym_get_private_session_size rte_cryptodev_get_private_session_size
 #endif
 
-#ifndef DEV_RX_OFFLOAD_CRC_STRIP
-#define DEV_RX_OFFLOAD_CRC_STRIP 0x00001000
-#endif
 #ifndef DEV_RX_OFFLOAD_JUMBO_FRAME
 #define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800
 #endif
index ac0ba0f..a0530c4 100644 (file)
@@ -352,8 +352,14 @@ static void print_port_capa(struct prox_port_cfg *port_cfg)
                plog_info("VLAN EXTEND | ");
        if (port_cfg->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME)
                plog_info("JUMBO FRAME | ");
+#if defined(DEV_RX_OFFLOAD_CRC_STRIP)
        if (port_cfg->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_CRC_STRIP)
                plog_info("CRC STRIP | ");
+#endif
+#if defined(DEV_RX_OFFLOAD_KEEP_CRC)
+       if (port_cfg->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_KEEP_CRC)
+               plog_info("KEEP CRC | ");
+#endif
        if (port_cfg->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SCATTER)
                plog_info("SCATTER | ");
        if (port_cfg->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)
@@ -523,7 +529,12 @@ static void init_port(struct prox_port_cfg *port_cfg)
 
        // rxmode such as hw src strip
 #if RTE_VERSION >= RTE_VERSION_NUM(18,8,0,1)
+#if defined (DEV_RX_OFFLOAD_CRC_STRIP)
        CONFIGURE_RX_OFFLOAD(DEV_RX_OFFLOAD_CRC_STRIP);
+#endif
+#if defined (DEV_RX_OFFLOAD_KEEP_CRC)
+       CONFIGURE_RX_OFFLOAD(DEV_RX_OFFLOAD_KEEP_CRC);
+#endif
        CONFIGURE_RX_OFFLOAD(DEV_RX_OFFLOAD_JUMBO_FRAME);
        CONFIGURE_RX_OFFLOAD(DEV_RX_OFFLOAD_VLAN_STRIP);
 #else
index 7cc36fc..e6210c3 100644 (file)
@@ -286,12 +286,23 @@ static void nic_read_stats(uint8_t port_id)
                           dropped by the nic". Note that in case CRC
                           is stripped on ixgbe, the CRC bytes are not
                           counted. */
+#if defined (DEV_RX_OFFLOAD_CRC_STRIP)
                        if (prox_port_cfg[port_id].requested_rx_offload & DEV_RX_OFFLOAD_CRC_STRIP)
                                stats->rx_bytes = eth_stat.ibytes +
                                        (24 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
                        else
                                stats->rx_bytes = eth_stat.ibytes +
                                        (20 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+#else
+#if defined (DEV_RX_OFFLOAD_KEEP_CRC)
+                       if (prox_port_cfg[port_id].requested_rx_offload & DEV_RX_OFFLOAD_KEEP_CRC)
+                               stats->rx_bytes = eth_stat.ibytes +
+                                       (20 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+                       else
+                               stats->rx_bytes = eth_stat.ibytes +
+                                       (24 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+#endif
+#endif
                }
        } else if (strcmp(prox_port_cfg[port_id].short_name, "i40e_vf") == 0) {
                // For I40E VF, imissed already part of received packets