[RFC,5/5] app/testpmd: add support for ixgbe FDIR configuration

Message ID 20200929075330.40201-1-chenxux.di@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [RFC,1/5] net/i40e: decouple dependency from superseded structures |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Chenxu Di Sept. 29, 2020, 7:53 a.m. UTC
  As annouced in deprecation.rst, the "rte_eth_conf.fdir_conf" field
will be removed, but IXGBE generic flow still needs to depend on these
configurations. This patch adds setting FDIR configuration for IXGBE PMD
by calling private API.

Signed-off-by: Chenxu Di <chenxux.di@intel.com>
---
 app/test-pmd/parameters.c | 63 ++++++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.c    | 28 +++++++++++++++++
 app/test-pmd/testpmd.h    |  3 ++
 3 files changed, 93 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 8c2aa13dd..f9547a4d2 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -42,6 +42,9 @@ 
 #ifdef RTE_LIBRTE_PMD_BOND
 #include <rte_eth_bond.h>
 #endif
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include <rte_pmd_ixgbe.h>
+#endif
 #include <rte_flow.h>
 
 #include "testpmd.h"
@@ -935,6 +938,29 @@  launch_args_parse(int argc, char** argv)
 						 "none, signature, perfect, perfect-mac-vlan"
 						 " or perfect-tunnel\n",
 						 optarg);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+				if (!strcmp(optarg, "signature"))
+					ixgbe_fdir_conf.mode =
+						RTE_PMD_IXGBE_FDIR_MODE_SIGNATURE;
+				else if (!strcmp(optarg, "perfect"))
+					ixgbe_fdir_conf.mode =
+						RTE_PMD_IXGBE_FDIR_MODE_PERFECT;
+				else if (!strcmp(optarg, "perfect-mac-vlan"))
+					ixgbe_fdir_conf.mode =
+						RTE_PMD_IXGBE_FDIR_MODE_PERFECT_MAC_VLAN;
+				else if (!strcmp(optarg, "perfect-tunnel"))
+					ixgbe_fdir_conf.mode =
+						RTE_PMD_IXGBE_FDIR_MODE_PERFECT_TUNNEL;
+				else if (!strcmp(optarg, "none"))
+					ixgbe_fdir_conf.mode =
+						RTE_PMD_IXGBE_FDIR_MODE_NONE;
+				else
+					rte_exit(EXIT_FAILURE,
+						 "pkt-mode-invalid %s invalid - must be: "
+						 "none, signature, perfect, perfect-mac-vlan"
+						 " or perfect-tunnel\n",
+						 optarg);
+#endif
 			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "pkt-filter-report-hash")) {
@@ -952,6 +978,22 @@  launch_args_parse(int argc, char** argv)
 						 "pkt-filter-report-hash %s invalid "
 						 "- must be: none or match or always\n",
 						 optarg);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+				if (!strcmp(optarg, "none"))
+					ixgbe_fdir_conf.status =
+						RTE_PMD_IXGBE_FDIR_NO_REPORT_STATUS;
+				else if (!strcmp(optarg, "match"))
+					ixgbe_fdir_conf.status =
+						RTE_PMD_IXGBE_FDIR_REPORT_STATUS;
+				else if (!strcmp(optarg, "always"))
+					ixgbe_fdir_conf.status =
+						RTE_PMD_IXGBE_FDIR_REPORT_STATUS_ALWAYS;
+				else
+					rte_exit(EXIT_FAILURE,
+						 "pkt-filter-report-hash %s invalid "
+						 "- must be: none or match or always\n",
+						 optarg);
+#endif
 			}
 			if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
 				if (!strcmp(optarg, "64K"))
@@ -967,12 +1009,31 @@  launch_args_parse(int argc, char** argv)
 					rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
 						 " must be: 64K or 128K or 256K\n",
 						 optarg);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+				if (!strcmp(optarg, "64K"))
+					ixgbe_fdir_conf.pballoc =
+						RTE_PMD_IXGBE_FDIR_PBALLOC_64K;
+				else if (!strcmp(optarg, "128K"))
+					ixgbe_fdir_conf.pballoc =
+						RTE_PMD_IXGBE_FDIR_PBALLOC_128K;
+				else if (!strcmp(optarg, "256K"))
+					ixgbe_fdir_conf.pballoc =
+						RTE_PMD_IXGBE_FDIR_PBALLOC_256K;
+				else
+					rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
+						 " must be: 64K or 128K or 256K\n",
+						 optarg);
+#endif
 			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "pkt-filter-drop-queue")) {
 				n = atoi(optarg);
-				if (n >= 0)
+				if (n >= 0) {
 					fdir_conf.drop_queue = (uint8_t) n;
+#ifdef RTE_LIBRTE_IXGBE_PMD
+					ixgbe_fdir_conf.drop_queue = (uint8_t) n;
+#endif
+				}
 				else
 					rte_exit(EXIT_FAILURE,
 						 "drop queue %d invalid - must"
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ee3dd27d8..155063dbc 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -459,6 +459,31 @@  struct rte_fdir_conf fdir_conf = {
 	.drop_queue = 127,
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
+struct rte_pmd_ixgbe_fdir_conf ixgbe_fdir_conf = {
+	.mode = RTE_PMD_IXGBE_FDIR_MODE_NONE,
+	.pballoc = RTE_PMD_IXGBE_FDIR_PBALLOC_64K,
+	.status = RTE_PMD_IXGBE_FDIR_REPORT_STATUS,
+	.mask = {
+		.vlan_tci_mask = 0xFFEF,
+		.ipv4_mask     = {
+			.src_ip = 0xFFFFFFFF,
+			.dst_ip = 0xFFFFFFFF,
+		},
+		.ipv6_mask     = {
+			.src_ip = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+			.dst_ip = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+		},
+		.src_port_mask = 0xFFFF,
+		.dst_port_mask = 0xFFFF,
+		.mac_addr_byte_mask = 0xFF,
+		.tunnel_type_mask = 1,
+		.tunnel_id_mask = 0xFFFFFFFF,
+	},
+	.drop_queue = 127,
+};
+#endif
+
 volatile int test_done = 1; /* stop packet forwarding when set to 1. */
 
 struct queue_stats_mappings tx_queue_stats_mappings_array[MAX_TX_QUEUE_STATS_MAPPINGS];
@@ -3342,6 +3367,9 @@  init_port_config(void)
 	RTE_ETH_FOREACH_DEV(pid) {
 		port = &ports[pid];
 		port->dev_conf.fdir_conf = fdir_conf;
+#ifdef RTE_LIBRTE_IXGBE_PMD
+		rte_pmd_ixgbe_update_fdir_conf(pid, ixgbe_fdir_conf);
+#endif
 
 		ret = eth_dev_info_get_print_err(pid, &port->dev_info);
 		if (ret != 0)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f139fe7a0..8adb31b4f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -409,6 +409,9 @@  extern uint8_t bitrate_enabled;
 #endif
 
 extern struct rte_fdir_conf fdir_conf;
+#ifdef RTE_LIBRTE_IXGBE_PMD
+extern struct rte_pmd_ixgbe_fdir_conf ixgbe_fdir_conf;
+#endif
 
 /*
  * Configuration of packet segments used by the "txonly" processing engine.