From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E243B43782; Mon, 25 Dec 2023 04:05:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D12E402E4; Mon, 25 Dec 2023 04:05:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 3E90B402EA for ; Mon, 25 Dec 2023 04:05:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703473550; x=1735009550; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZJ14qm88xda5Gr9ejtWR5dnrMmjXG4j8AzuF2Y3viVg=; b=BDs2hrsGkhrQp2ZjGsTrwTD8l3GVTJtPmrj9vUT0ht6ISGnSuqQxxJEC L8LgZo5bSo4+/44Gb+H0guO9YIvosy5y+IY88jE7LPdFu4vWV7eNBfabD +E4cQsDx91nJIsIf+LnzldM62MV9ebr5gM0YX9Rq4TCNg/YUYFS7gTfk/ TO2VyfTl/Pxqm/7HedXXck29BGfOzP1VKvTrhECmJMwL8wJYMeS+YZw5t lVeNVZ5JR4wnO3ujSdnQ7tz5N9+IAuV1WuDud1p00ntbhyx+2/E+HU2iI jqYMh6g7CIeXgDZorTLAqmYHsSzWcLkS60ZHpIwmFenPMehaLcPoOUPjy w==; X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="482438914" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="482438914" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2023 19:05:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="950887794" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="950887794" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2023 19:05:47 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH v4 3/3] net/iavf: add Tx LLDP command Date: Mon, 25 Dec 2023 11:14:51 +0800 Message-Id: <20231225031451.4002181-4-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231225031451.4002181-1-zhichaox.zeng@intel.com> References: <20231221072827.1808983-1-zhichaox.zeng@intel.com> <20231225031451.4002181-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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 + +#include + +#include +#include + +#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