From nobody Sat Apr 02 01:50:09 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 90B0C1A57DA3; Sat, 2 Apr 2022 01:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KVg353SQ1z3PcV; Sat, 2 Apr 2022 01:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648864209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8vC0xwVPOgQ6EZ34h/Wv8qjz6jgKYvGSmD5F+e4SYYY=; b=n5v5hlCoGTmVm/kfuShvSpAY5OIl6VKacz52/4CE+qsPdFMEJaQBJ0uc6NkKhFoGWDRS/k BNFjuVv5SNvtCyQcjgQh2sx2NMJmw7CHYkwRKiRuZPEtw3eYMoC2/gZeR6KXWjdkSgXEVH 7lBjXvdUNe9RsBmFNTlflmZhgAeF3WD8pdhhb23v/9Kq9rIjDBvnzyjhHVVZNmFF6brGgV OZlBcSRi9ZgOkReOJNwg/rtZ2BBmf5LG6HnJqDQihHwYvAD5lAZTrd1HGsRieTzZdkFPNR t/75WszUdEl61wAXT2ZxZA7SEWdmBa6ih1iGB5WzN9QiGOx3w3kMAntXfOvl3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E9BF1F8E0; Sat, 2 Apr 2022 01:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2321o9du029797; Sat, 2 Apr 2022 01:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2321o9Wi029791; Sat, 2 Apr 2022 01:50:09 GMT (envelope-from git) Date: Sat, 2 Apr 2022 01:50:09 GMT Message-Id: <202204020150.2321o9Wi029791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 8c711d0aa2d9 - stable/13 - cxgbe(4): Handle FORCE_FEC in pcaps correctly. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c711d0aa2d9d3369bb2cfdd5b7a27e2cd521ccc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648864209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8vC0xwVPOgQ6EZ34h/Wv8qjz6jgKYvGSmD5F+e4SYYY=; b=ypVQKcLRvKEhDSCcNYbSaB9CUOSHxNZXeXQ95XyCaMaurauq+bbznaTiHkzoEubAI07U/N aSKC4n43JJQLG4R7cu656dPhlfovtxjFxTCbeAfSjKpzilpkyvHAShfq/NJsvgy8ZniKuZ KlMJHF6ackNU7mRMwZgSV/Cq75ZNnU10TVKr0QSUqAeHwuUK40yZEooPEu/HaZgmaXoaQT 8n1oCjlaD8JP4lTUPC4ZAD0LtSx4+EnyqPFGJQvlL84yLph6ANO8QGLSTLcl9vtK/osxf0 CcBtGaD6NyoPrHriRvUKU081w10lFJMJZmY9MXQoycb3sR4yAJNpAkvotJz+ZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648864209; a=rsa-sha256; cv=none; b=pWPKjoJ6KIRz0XmAWpJpqpHtxnIzIyZcw8PpC9akgCAO/aeiEHGF5TJVat+PDkWUQKR3Wh pQYJdPWpkrANp5h8brCdVtmD6LqVQ8yskuwcHChNkOGrZGvSThMHzi8s54Fi2o9fKvhb5J hSFV3YmyoQedtLUJC1vEVpLOSAJsEvxFofYp82yO8Hk4HlKayHXDTrBEambwiJvs/tcriP VJPL3OT8QEVh/Cc97FEZVF8pkg+VQOLneMeUAVq72oz5P5KYnN3mAWrLRTQOOKAbFktoV2 pcXZTXnOzZQS1OxA/BBWjeumt0SvithCQTDi5cc9KRrsEC1tVRAfU5tQHCkiOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=8c711d0aa2d9d3369bb2cfdd5b7a27e2cd521ccc commit 8c711d0aa2d9d3369bb2cfdd5b7a27e2cd521ccc Author: Navdeep Parhar AuthorDate: 2022-03-25 07:34:54 +0000 Commit: Navdeep Parhar CommitDate: 2022-04-02 01:49:43 +0000 cxgbe(4): Handle FORCE_FEC in pcaps correctly. The firmware doesn't report FORCE_FEC in pcaps if the transceiver plugged in at that time does not support a speed that may use FEC. It is incorrect for the driver to assume that the FORCE_FEC value it read during attach (in init_link_config) is permanent. Instead, it should check pcaps just before issuing the L1CFG command. Sponsored by: Chelsio Communications (cherry picked from commit 231f2112403229a1382be3f5f6ed50bffe3497e8) --- sys/dev/cxgbe/common/t4_hw.c | 15 +++++++++------ sys/dev/cxgbe/t4_main.c | 14 ++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index c32dab915ee6..0176eb3e2b0d 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -3908,13 +3908,16 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, speed = fwcap_top_speed(lc->pcaps); fec = 0; -#ifdef INVARIANTS - if (lc->force_fec != 0) - MPASS(lc->pcaps & FW_PORT_CAP32_FORCE_FEC); -#endif if (fec_supported(speed)) { + int force_fec; + + if (lc->pcaps & FW_PORT_CAP32_FORCE_FEC) + force_fec = lc->force_fec; + else + force_fec = 0; + if (lc->requested_fec == FEC_AUTO) { - if (lc->force_fec > 0) { + if (force_fec > 0) { /* * Must use FORCE_FEC even though requested FEC * is AUTO. Set all the FEC bits valid for the @@ -3960,7 +3963,7 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, * User has explicitly requested some FEC(s). Set * FORCE_FEC unless prohibited from using it. */ - if (lc->force_fec != 0) + if (force_fec != 0) fec |= FW_PORT_CAP32_FORCE_FEC; fec |= fec_to_fwcap(lc->requested_fec & M_FW_PORT_CAP32_FEC); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 703335d9bc87..a113a1c662c8 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5848,7 +5848,6 @@ init_link_config(struct port_info *pi) struct link_config *lc = &pi->link_cfg; PORT_LOCK_ASSERT_OWNED(pi); - MPASS(lc->pcaps != 0); lc->requested_caps = 0; lc->requested_speed = 0; @@ -5874,13 +5873,12 @@ init_link_config(struct port_info *pi) if (lc->requested_fec == 0) lc->requested_fec = FEC_AUTO; } - lc->force_fec = 0; - if (lc->pcaps & FW_PORT_CAP32_FORCE_FEC) { - if (t4_force_fec < 0) - lc->force_fec = -1; - else if (t4_force_fec > 0) - lc->force_fec = 1; - } + if (t4_force_fec < 0) + lc->force_fec = -1; + else if (t4_force_fec > 0) + lc->force_fec = 1; + else + lc->force_fec = 0; } /*