DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chenxu Di <chenxux.di@intel.com>
To: dev@dpdk.org
Cc: junyux.jiang@intel.com, shougangx.wang@intel.com,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Chenxu Di <chenxux.di@intel.com>
Subject: [dpdk-dev] [RFC 5/5] app/testpmd: add support for ixgbe FDIR configuration
Date: Tue, 29 Sep 2020 07:53:30 +0000	[thread overview]
Message-ID: <20200929075330.40201-1-chenxux.di@intel.com> (raw)

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(-)

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.
-- 
2.17.1


                 reply	other threads:[~2020-09-29  8:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200929075330.40201-1-chenxux.di@intel.com \
    --to=chenxux.di@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=junyux.jiang@intel.com \
    --cc=shougangx.wang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).