From patchwork Mon May 8 11:47:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pryazhennikov X-Patchwork-Id: 126764 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E5EF42A94; Mon, 8 May 2023 13:47:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC66042BDA; Mon, 8 May 2023 13:47:13 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id B357C40685 for ; Mon, 8 May 2023 13:47:11 +0200 (CEST) Received: from localhost.localdomain (unknown [37.252.88.48]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA512) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id ED3A0E1246; Mon, 8 May 2023 15:47:10 +0400 (+04) From: Denis Pryazhennikov To: dev@dpdk.org Cc: Ivan Malov , Viacheslav Galaktionov , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [RFC PATCH v2 1/3] ethdev: update documentation for API to set FEC Date: Mon, 8 May 2023 15:47:05 +0400 Message-Id: <20230508114707.89629-2-denis.pryazhennikov@arknetworks.am> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> References: <20230428102728.51956-1-denis.pryazhennikov@arknetworks.am> <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> MIME-Version: 1.0 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 The documentation for the rte_eth_fec_set() is updated to provide more detailed information about how FEC modes are handled. It also includes a description of the case when only the AUTO bit is set. Signed-off-by: Denis Pryazhennikov Acked-by: Ivan Malov Acked-by: Viacheslav Galaktionov --- lib/ethdev/rte_ethdev.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 99fe9e238b20..777dc521494c 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4227,10 +4227,13 @@ int rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa); * @param port_id * The port identifier of the Ethernet device. * @param fec_capa - * A bitmask of allowed FEC modes. If AUTO bit is set, other - * bits specify FEC modes which may be negotiated. If AUTO - * bit is clear, specify FEC modes to be used (only one valid - * mode per speed may be set). + * A bitmask of allowed FEC modes. + * If only the AUTO bit is set, the decision on which FEC + * mode to use will be made by HW/FW or driver. + * If the AUTO bit is set with some FEC modes, only specified + * FEC modes can be set. + * If AUTO bit is clear, specify FEC mode to be used + * (only one valid mode per speed may be set). * @return * - (0) if successful. * - (-EINVAL) if the FEC mode is not valid. From patchwork Mon May 8 11:47:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pryazhennikov X-Patchwork-Id: 126765 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3245342A94; Mon, 8 May 2023 13:47:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F31DA42D29; Mon, 8 May 2023 13:47:14 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 4A9F840685 for ; Mon, 8 May 2023 13:47:12 +0200 (CEST) Received: from localhost.localdomain (unknown [37.252.88.48]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA512) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id A5DE7E127E; Mon, 8 May 2023 15:47:11 +0400 (+04) From: Denis Pryazhennikov To: dev@dpdk.org Cc: Ivan Malov , Viacheslav Galaktionov , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [RFC PATCH v2 2/3] ethdev: check that at least one FEC mode is specified Date: Mon, 8 May 2023 15:47:06 +0400 Message-Id: <20230508114707.89629-3-denis.pryazhennikov@arknetworks.am> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> References: <20230428102728.51956-1-denis.pryazhennikov@arknetworks.am> <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> MIME-Version: 1.0 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 The behaviour is undefined in the rte_eth_fec_set() function when the fec_capa parameter is equal to zero. Add a check to handle this case. Signed-off-by: Denis Pryazhennikov Acked-by: Ivan Malov Acked-by: Viacheslav Galaktionov --- lib/ethdev/rte_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 4d0325568322..d02ee161cf6d 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -4751,6 +4751,11 @@ rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + if (fec_capa == 0) { + RTE_ETHDEV_LOG(ERR, "At least one FEC mode should be specified\n"); + return -EINVAL; + } + if (*dev->dev_ops->fec_set == NULL) return -ENOTSUP; ret = eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa)); From patchwork Mon May 8 11:47:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pryazhennikov X-Patchwork-Id: 126766 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 490BC42A94; Mon, 8 May 2023 13:47:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36A6042D35; Mon, 8 May 2023 13:47:16 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 2511541101 for ; Mon, 8 May 2023 13:47:13 +0200 (CEST) Received: from localhost.localdomain (unknown [37.252.88.48]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA512) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id 57827E1283; Mon, 8 May 2023 15:47:12 +0400 (+04) From: Denis Pryazhennikov To: dev@dpdk.org Cc: Ivan Malov , Viacheslav Galaktionov , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [RFC PATCH v2 3/3] ethdev: update documentation for API to get FEC Date: Mon, 8 May 2023 15:47:07 +0400 Message-Id: <20230508114707.89629-4-denis.pryazhennikov@arknetworks.am> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> References: <20230428102728.51956-1-denis.pryazhennikov@arknetworks.am> <20230508114707.89629-1-denis.pryazhennikov@arknetworks.am> MIME-Version: 1.0 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 The documentation for the rte_eth_fec_get() is updated to clarify the description for the fec_capa parameter. The previous description implied that more than one FEC mode can be obtained. Signed-off-by: Denis Pryazhennikov --- lib/ethdev/rte_ethdev.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 777dc521494c..ab9732f21bdf 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4204,10 +4204,7 @@ int rte_eth_fec_get_capability(uint16_t port_id, * @param port_id * The port identifier of the Ethernet device. * @param fec_capa - * A bitmask of enabled FEC modes. If AUTO bit is set, other - * bits specify FEC modes which may be negotiated. If AUTO - * bit is clear, specify FEC modes to be used (only one valid - * mode per speed may be set). + * A bitmask with the current FEC mode. * @return * - (0) if successful. * - (-ENOTSUP) if underlying hardware OR driver doesn't support.