DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@arknetworks.am>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <andy.moreton@amd.com>,
	Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren@amd.com>,
	Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>,
	stable@dpdk.org
Subject: [PATCH 2/9] common/sfc_efx/base: fix flow control setting on legacy MCDI
Date: Tue, 30 Dec 2025 01:35:20 +0400	[thread overview]
Message-ID: <20251229213527.37907-3-ivan.malov@arknetworks.am> (raw)
In-Reply-To: <20251229213527.37907-1-ivan.malov@arknetworks.am>

On X2 adaptors, tests have shown a mismatch between the mode the user asks
for and the resulting one, given the partner is set to use autonegotiation.
For example, asking for 'RX_PAUSE' results in 'FULL' being actually in use.

As per 'SET_MAC' MCDI documentation (in 'efx_regs_mcdi.h'), it is wrong to
set 'FCNTL' field to 'AUTO' when the user wants a fixed mode. Correct this.

Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <andy.moreton@amd.com>
---
 drivers/common/sfc_efx/base/ef10_mac.c | 35 ++++++++++++++++++++------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/common/sfc_efx/base/ef10_mac.c b/drivers/common/sfc_efx/base/ef10_mac.c
index bfc82b80c7..016bd88774 100644
--- a/drivers/common/sfc_efx/base/ef10_mac.c
+++ b/drivers/common/sfc_efx/base/ef10_mac.c
@@ -273,6 +273,7 @@ ef10_mac_reconfigure(
 	efx_mcdi_req_t req;
 	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_MAC_IN_LEN,
 		MC_CMD_SET_MAC_OUT_LEN);
+	uint32_t fcntl;
 	efx_rc_t rc;
 
 	req.emr_cmd = MC_CMD_SET_MAC;
@@ -299,13 +300,29 @@ ef10_mac_reconfigure(
 				    SET_MAC_IN_REJECT_UNCST, 0,
 				    SET_MAC_IN_REJECT_BRDCST, 0);
 
-	/*
-	 * Flow control, whether it is auto-negotiated or not,
-	 * is set via the PHY advertised capabilities.  When set to
-	 * automatic the MAC will use the PHY settings to determine
-	 * the flow control settings.
-	 */
-	MCDI_IN_SET_DWORD(req, SET_MAC_IN_FCNTL, MC_CMD_FCNTL_AUTO);
+	if (epp->ep_fcntl_autoneg != B_FALSE) {
+		fcntl = MC_CMD_FCNTL_AUTO;
+	} else {
+		switch (epp->ep_fcntl) {
+		case 0:
+			fcntl = MC_CMD_FCNTL_OFF;
+			break;
+		case EFX_FCNTL_RESPOND:
+			fcntl = MC_CMD_FCNTL_RESPOND;
+			break;
+		case EFX_FCNTL_GENERATE:
+			fcntl = MC_CMD_FCNTL_GENERATE;
+			break;
+		case EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE:
+			fcntl = MC_CMD_FCNTL_BIDIR;
+			break;
+		default:
+			rc = EINVAL;
+			goto fail1;
+		}
+	}
+
+	MCDI_IN_SET_DWORD(req, SET_MAC_IN_FCNTL, fcntl);
 
 	/* Include the Ethernet frame checksum in RX packets if it's required */
 	MCDI_IN_POPULATE_DWORD_1(req, SET_MAC_IN_FLAGS,
@@ -321,7 +338,7 @@ ef10_mac_reconfigure(
 		 */
 		if (req.emr_rc != EACCES) {
 			rc = req.emr_rc;
-			goto fail1;
+			goto fail2;
 		}
 	}
 
@@ -338,6 +355,8 @@ ef10_mac_reconfigure(
 
 	return (0);
 
+fail2:
+	EFSYS_PROBE(fail2);
 fail1:
 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
-- 
2.47.3


  parent reply	other threads:[~2025-12-29 21:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29 21:35 [PATCH 0/9] net/sfc: SFN7xxx deprecation and Medford fixes Ivan Malov
2025-12-29 21:35 ` [PATCH 1/9] doc: remove support for AMD Solarflare SFN7xxx family boards Ivan Malov
2025-12-29 21:35 ` Ivan Malov [this message]
2025-12-29 21:35 ` [PATCH 3/9] common/sfc_efx/base: fix indication of requestable FEC flags Ivan Malov
2025-12-29 21:35 ` [PATCH 4/9] common/sfc_efx/base: define mask for pause mode capabilities Ivan Malov
2025-12-29 21:35 ` [PATCH 5/9] common/sfc_efx/base: count Rx TRUNC ERR as CRC errors on X4 Ivan Malov
2025-12-29 21:35 ` [PATCH 6/9] net/sfc: avoid speed reset when setting FEC in started state Ivan Malov
2025-12-29 21:35 ` [PATCH 7/9] net/sfc: rework the capability check that is done on FEC set Ivan Malov
2025-12-29 21:35 ` [PATCH 8/9] net/sfc: drop AUTO from FEC capabilities and fix the comment Ivan Malov
2025-12-29 21:35 ` [PATCH 9/9] net/sfc: fix reporting status of autonegotiation to the user Ivan Malov
2025-12-31 19:13 ` [PATCH 0/9] net/sfc: SFN7xxx deprecation and Medford fixes Stephen Hemminger

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=20251229213527.37907-3-ivan.malov@arknetworks.am \
    --to=ivan.malov@arknetworks.am \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=andy.moreton@amd.com \
    --cc=dev@dpdk.org \
    --cc=pieter.jansen-van-vuuren@amd.com \
    --cc=stable@dpdk.org \
    --cc=viacheslav.galaktionov@arknetworks.am \
    /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).