From nobody Fri Mar 25 07:47:47 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 BFA101A3DE10; Fri, 25 Mar 2022 07:47:47 +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 4KPvMR53lRz3D2X; Fri, 25 Mar 2022 07:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648194467; 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=fGCu+AhEHBldFxwDW8u+IOrMXbuzuFzSWn19FLL6VrA=; b=nXABvGSvXsJyZMreO6nPTNGrBqTxVCxJDHJiL3WvH0ggxDqSsruM1gqGXxTFu2XubPUtxo DrxMfZzOLJGemrzJCSVRsStrsg+Fs3LS7HSACqqm5rknswcl/9x7CHZq1hWPIKeTaqBDiQ LhE5ySVHDB7+UKB9n0rvqtw8Cvc9ys2/44dda4MGLhya/mMW70kceKFKvbUs8/rGGimp4n gZnV3xRFFxUtldmE/9PxG6YyPGwgCYoAxuzUNt4F67IaOwDQ/5MqWH1iMu5EEgwOtne/Og kSrDZn+sX1mSJAJ1RNwBGYkSNo/qj1bmKSP/qiPUoiLvxpzAX9FjDNZvyFQWQA== 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 89FB448E; Fri, 25 Mar 2022 07:47:47 +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 22P7llZP030685; Fri, 25 Mar 2022 07:47:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22P7llWf030684; Fri, 25 Mar 2022 07:47:47 GMT (envelope-from git) Date: Fri, 25 Mar 2022 07:47:47 GMT Message-Id: <202203250747.22P7llWf030684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 231f21124032 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 231f2112403229a1382be3f5f6ed50bffe3497e8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648194467; 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=fGCu+AhEHBldFxwDW8u+IOrMXbuzuFzSWn19FLL6VrA=; b=YrV27NAAvgbVRZkaQWeSD2QrtkawfxxDPE+cGzD6Xmj98J+//6l1u1voqsOnXUrHjwngw3 Xv/RLEZl/qVRdOKi6HxAotP/z6vf6Umh/sgKv7u8zDPqs4TOoBkRQW/26kAKbFP9bEpBGk EZShjaF0E7OOVj/NZtcCOSbrCnIITz3FfYLGN9H/TgNWGOOZxzRDbhaNUZT4DqxI45MoxO B4rvm/+t1tWeymKFNLbMKa7xhj8llT3oI/AqNXbweUgrx3tUe4gq610VpPTMvM0FFclm/w AAkuZQ/9l5BtNXC2thIi3DbOkDhM8CpO/loG2C852h0BtkPsJYJnErjxKEzTog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648194467; a=rsa-sha256; cv=none; b=JYwvA63fzk+VPCbvxvvDh7Oiexn25UT4iPfKdG6uQuQoSXuPcKwt0bMhp0+oGzcTYeaOIp aC9wwg0xfXuwMVFh9hpm2t/Q3OfPvywPgAIn9B211HtV3CzTbVNa8NWjXt4MZ9/+p0cXV1 A0TZgiyblf3RgnXoQTgwFyNe1v2zb8q6qiDKoH2lZc0YQjASC46U1PjOoHKDVM618b7pmV uPzHSLPTy5bfRYc3qFhy0mr5uh65a9DPwp5/TLN6yJZh1ktVRINN5DGci86rZ1XJEAmBXt vzxo7yFMnydtuQzTvP7NBLbOiE3x07D9UX35w5654/CrrPFiZGsb/ddLFDkrgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=231f2112403229a1382be3f5f6ed50bffe3497e8 commit 231f2112403229a1382be3f5f6ed50bffe3497e8 Author: Navdeep Parhar AuthorDate: 2022-03-25 07:34:54 +0000 Commit: Navdeep Parhar CommitDate: 2022-03-25 07:39:00 +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. MFC after: 1 week Sponsored by: Chelsio Communications --- 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 f367ebc60c14..56ceae56a700 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5789,7 +5789,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; @@ -5815,13 +5814,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; } /*