summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2019-06-28 16:56:26 +0200
committerPatrice Buriez <patrice.buriez@intel.com>2019-10-10 11:55:44 +0000
commitae43633b258e3cf53013cfac4643146761f03b9d (patch)
treea241771c2609ea8656041d50a37322069ff89da2 /VNFs
parentda4e41a67cca12cc4160a66ca46a37889137fa1e (diff)
Update PROX to CRC STRIP default bahavior change in DPDK
Change-Id: I7c3e2981692d823c86787b77d61190327d6448e4 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/defaults.c5
-rw-r--r--VNFs/DPPD-PROX/display_ports.c23
-rw-r--r--VNFs/DPPD-PROX/prox_args.c10
-rw-r--r--VNFs/DPPD-PROX/prox_compat.h3
-rw-r--r--VNFs/DPPD-PROX/prox_port_cfg.c11
-rw-r--r--VNFs/DPPD-PROX/stats_port.c11
6 files changed, 60 insertions, 3 deletions
diff --git a/VNFs/DPPD-PROX/defaults.c b/VNFs/DPPD-PROX/defaults.c
index fce5c5c1..61b44199 100644
--- a/VNFs/DPPD-PROX/defaults.c
+++ b/VNFs/DPPD-PROX/defaults.c
@@ -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;
}
}
diff --git a/VNFs/DPPD-PROX/display_ports.c b/VNFs/DPPD-PROX/display_ports.c
index e7ffb1ef..54755106 100644
--- a/VNFs/DPPD-PROX/display_ports.c
+++ b/VNFs/DPPD-PROX/display_ports.c
@@ -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);
diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c
index df69f979..17b3298d 100644
--- a/VNFs/DPPD-PROX/prox_args.c
+++ b/VNFs/DPPD-PROX/prox_args.c
@@ -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)
diff --git a/VNFs/DPPD-PROX/prox_compat.h b/VNFs/DPPD-PROX/prox_compat.h
index 5191b859..1ebacd4a 100644
--- a/VNFs/DPPD-PROX/prox_compat.h
+++ b/VNFs/DPPD-PROX/prox_compat.h
@@ -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
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c
index ac0ba0f3..a0530c4f 100644
--- a/VNFs/DPPD-PROX/prox_port_cfg.c
+++ b/VNFs/DPPD-PROX/prox_port_cfg.c
@@ -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
diff --git a/VNFs/DPPD-PROX/stats_port.c b/VNFs/DPPD-PROX/stats_port.c
index 7cc36fce..e6210c33 100644
--- a/VNFs/DPPD-PROX/stats_port.c
+++ b/VNFs/DPPD-PROX/stats_port.c
@@ -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