DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhichao Zeng <zhichaox.zeng@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, Zhichao Zeng <zhichaox.zeng@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH v4 3/3] net/iavf: add Tx LLDP command
Date: Mon, 25 Dec 2023 11:14:51 +0800	[thread overview]
Message-ID: <20231225031451.4002181-4-zhichaox.zeng@intel.com> (raw)
In-Reply-To: <20231225031451.4002181-1-zhichaox.zeng@intel.com>

This patch adds an IAVF testpmd command "set tx lldp on|off" which
will register an mbuf dynfield IAVF_TX_LLDP_DYNFIELD to indicate
the need to send LLDP packet. Currently, it only supports turning on.

For avx512, need to close the Tx port first, then "set tx lldp on",
and reopen the port to select correct Tx path.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 doc/guides/rel_notes/release_24_03.rst |  3 +
 drivers/net/iavf/iavf_testpmd.c        | 84 ++++++++++++++++++++++++++
 drivers/net/iavf/meson.build           |  3 +
 drivers/net/iavf/version.map           |  3 +
 4 files changed, 93 insertions(+)
 create mode 100644 drivers/net/iavf/iavf_testpmd.c

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 6f8ad27808..f94e18c33a 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -55,6 +55,9 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated Intel iavf driver.**
+
+  * Added support for Tx LLDP packet on scalar and avx512.
 
 Removed Items
 -------------
diff --git a/drivers/net/iavf/iavf_testpmd.c b/drivers/net/iavf/iavf_testpmd.c
new file mode 100644
index 0000000000..9d4fbb43ed
--- /dev/null
+++ b/drivers/net/iavf/iavf_testpmd.c
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation.
+ */
+
+#include <stdlib.h>
+
+#include <rte_pmd_iavf.h>
+
+#include <cmdline_parse_num.h>
+#include <cmdline_parse_string.h>
+
+#include "iavf.h"
+#include "testpmd.h"
+#include "iavf_rxtx.h"
+
+struct cmd_enable_tx_lldp_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t tx;
+	cmdline_fixed_string_t lldp;
+	cmdline_fixed_string_t what;
+};
+
+static cmdline_parse_token_string_t cmd_enable_tx_lldp_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result,
+		set, "set");
+static cmdline_parse_token_string_t cmd_enable_tx_lldp_tx =
+	TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result,
+		tx, "tx");
+static cmdline_parse_token_string_t cmd_enable_tx_lldp_lldp =
+	TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result,
+		lldp, "lldp");
+static cmdline_parse_token_string_t cmd_enable_tx_lldp_what =
+	TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result,
+		what, "on#off");
+
+static void
+cmd_enable_tx_lldp_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	struct cmd_enable_tx_lldp_result *res = parsed_result;
+	const struct rte_mbuf_dynfield iavf_tx_lldp_dynfield = {
+		.name = IAVF_TX_LLDP_DYNFIELD,
+		.size = sizeof(uint8_t),
+		.align = __alignof__(uint8_t),
+		.flags = 0
+	};
+	int ret = 0;
+
+	if (strncmp(res->what, "on", 2) == 0) {
+		rte_pmd_iavf_tx_lldp_dynfield_offset =
+			rte_mbuf_dynfield_register(&iavf_tx_lldp_dynfield);
+		printf("rte_pmd_iavf_tx_lldp_dynfield_offset: %d",
+			rte_pmd_iavf_tx_lldp_dynfield_offset);
+		if (ret < 0)
+			fprintf(stderr,
+				"rte mbuf dynfield register failed, offset: %d",
+				rte_pmd_iavf_tx_lldp_dynfield_offset);
+	}
+}
+
+static cmdline_parse_inst_t cmd_enable_tx_lldp = {
+	.f = cmd_enable_tx_lldp_parsed,
+	.data = NULL,
+	.help_str = "set iavf tx lldp on|off",
+	.tokens = {
+		(void *)&cmd_enable_tx_lldp_set,
+		(void *)&cmd_enable_tx_lldp_tx,
+		(void *)&cmd_enable_tx_lldp_lldp,
+		(void *)&cmd_enable_tx_lldp_what,
+		NULL,
+	},
+};
+
+static struct testpmd_driver_commands iavf_cmds = {
+	.commands = {
+	{
+		&cmd_enable_tx_lldp,
+		"set tx lldp (on|off)\n"
+		"    Set iavf Tx lldp packet(currently only supported on)\n\n",
+	},
+	{ NULL, NULL },
+	},
+};
+TESTPMD_ADD_DRIVER_COMMANDS(iavf_cmds)
diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build
index a6ce2725c3..83aebd5596 100644
--- a/drivers/net/iavf/meson.build
+++ b/drivers/net/iavf/meson.build
@@ -8,6 +8,9 @@ endif
 cflags += ['-Wno-strict-aliasing']
 
 includes += include_directories('../../common/iavf')
+
+testpmd_sources = files('iavf_testpmd.c')
+
 deps += ['common_iavf', 'security', 'cryptodev']
 
 sources = files(
diff --git a/drivers/net/iavf/version.map b/drivers/net/iavf/version.map
index 135a4ccd3d..51e94f32fe 100644
--- a/drivers/net/iavf/version.map
+++ b/drivers/net/iavf/version.map
@@ -16,4 +16,7 @@ EXPERIMENTAL {
 
 	# added in 21.11
 	rte_pmd_ifd_dynflag_proto_xtr_ipsec_crypto_said_mask;
+
+	# added in 24.03
+	rte_pmd_iavf_tx_lldp_dynfield_offset;
 };
-- 
2.34.1


  parent reply	other threads:[~2023-12-25  3:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  6:08 [PATCH] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2023-12-14  6:58 ` [PATCH v2 0/3] " Zhichao Zeng
2023-12-14  6:58   ` [PATCH v2 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2023-12-14  6:58   ` [PATCH v2 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2023-12-14  6:58   ` [PATCH v2 3/3] net/iavf: add Tx LLDP command Zhichao Zeng
2023-12-20  9:32   ` [PATCH v3 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2023-12-20  9:32     ` [PATCH v3 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2023-12-21  7:28       ` [PATCH v4 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2023-12-21  7:28         ` [PATCH v4 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2023-12-27  4:34           ` Zhang, Qi Z
2023-12-21  7:28         ` [PATCH v4 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2023-12-21  7:28         ` [PATCH v4 3/3] net/iavf: add Tx LLDP command Zhichao Zeng
2023-12-25  3:14         ` [PATCH v4 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2023-12-25  3:14           ` [PATCH v4 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2023-12-25  3:14           ` [PATCH v4 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2023-12-25  3:14           ` Zhichao Zeng [this message]
2023-12-28  3:22           ` [PATCH v5 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2023-12-28  3:22             ` [PATCH v5 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2023-12-28  3:22             ` [PATCH v5 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2023-12-28  3:22             ` [PATCH v5 3/3] net/iavf: add Tx LLDP command Zhichao Zeng
2024-01-03  7:47             ` [PATCH v6 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhichao Zeng
2024-01-03  7:47               ` [PATCH v6 1/3] net/iavf: support Tx LLDP on scalar Zhichao Zeng
2024-01-03  7:47               ` [PATCH v6 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2024-01-03  7:47               ` [PATCH v6 3/3] net/iavf: add Tx LLDP command Zhichao Zeng
2024-01-04  0:26             ` [PATCH v5 0/3] net/iavf: support Tx LLDP on scalar and AVX512 Zhang, Qi Z
2023-12-20  9:32     ` [PATCH v3 2/3] net/iavf: support Tx LLDP on AVX512 Zhichao Zeng
2023-12-20  9:32     ` [PATCH v3 3/3] net/iavf: add Tx LLDP command Zhichao Zeng

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=20231225031451.4002181-4-zhichaox.zeng@intel.com \
    --to=zhichaox.zeng@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@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).