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 06A58A0548; Wed, 15 Jun 2022 16:58:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF69542BB1; Wed, 15 Jun 2022 16:57:55 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp11.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 6F67642BAB for ; Wed, 15 Jun 2022 16:57:54 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id BB6B7C0000F3; Wed, 15 Jun 2022 07:57:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com BB6B7C0000F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1655305073; bh=RGgEN/MdcVYT4q/6Naw47Ixmhdbu6cPEW04qRdS1Dvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7M1NHVwsZkTQiQEyWOMEvQOQt8qhQtcGrOkPkRHvWRwExnCGaPuka5LZjiXXtgFW waUL7P5EB1RrNN6tNT7Uf8HB8/ia415R5dVf/I+wnMDNwPLw2Uhc+PIkgOGHGXJe5a Oy64ZocqN3phVuPV89smY+VRxLvN53UsGsqkMhxk= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@xilinx.com, ajit.khaparde@broadcom.com Subject: [dpdk-dev] [PATCH 8/8] net/bnxt: fix the check for autoneg enablement in the PHY FW Date: Wed, 15 Jun 2022 20:27:03 +0530 Message-Id: <20220615145703.6613-9-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> References: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> 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 From: Somnath Kotur The current combination of checks to determine whether autoneg is enabled in the card is a bit convoluted and may become incorrect as well in the future as one of the fields being used - auto_link_speed might become deprecated. Switch to using the 'auto_mode' field obtained from the response of HWRM_PHY_QCFG cmd as that is always deterministically set by the PHY FW. Fixed a bug in the 40G check to only look for the bit setting and not the actual value. Also, check the forced speeds first before trying to enforce the auto speeds Allow the user to set autoneg speed in all cases except for PAM4 200G as PAM4 200G will come up only in forced mode. Fixes: c23f9ded0391 ("net/bnxt: support 200G PAM4 link") Signed-off-by: Somnath Kotur Reviewed-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 206ac20..9c52573 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3235,9 +3235,11 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) if (!link_up) goto port_phy_cfg; + /* Get user requested autoneg setting */ autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds); + if (BNXT_CHIP_P5(bp) && - dev_conf->link_speeds == RTE_ETH_LINK_SPEED_40G) { + dev_conf->link_speeds & RTE_ETH_LINK_SPEED_40G) { /* 40G is not supported as part of media auto detect. * The speed should be forced and autoneg disabled * to configure 40G speed. @@ -3246,11 +3248,13 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) autoneg = 0; } - /* No auto speeds and no auto_pam4_link. Disable autoneg */ - if (bp->link_info->auto_link_speed == 0 && - bp->link_info->link_signal_mode && - bp->link_info->auto_pam4_link_speed_mask == 0) + /* Override based on current Autoneg setting in PHY for 200G */ + if (autoneg == 1 && BNXT_CHIP_P5(bp) && bp->link_info->auto_mode == 0 && + bp->link_info->force_pam4_link_speed == + HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_200GB) { autoneg = 0; + PMD_DRV_LOG(DEBUG, "Disabling autoneg for 200G\n"); + } speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds, bp->link_info); @@ -3283,14 +3287,14 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) else if (bp->link_info->force_pam4_link_speed) link_req.link_speed = bp->link_info->force_pam4_link_speed; + else if (bp->link_info->force_link_speed) + link_req.link_speed = bp->link_info->force_link_speed; else if (bp->link_info->auto_pam4_link_speed_mask) link_req.link_speed = bp->link_info->auto_pam4_link_speed_mask; else if (bp->link_info->support_pam4_speeds) link_req.link_speed = bp->link_info->support_pam4_speeds; - else if (bp->link_info->force_link_speed) - link_req.link_speed = bp->link_info->force_link_speed; else link_req.link_speed = bp->link_info->auto_link_speed; /* Auto PAM4 link speed is zero, but auto_link_speed is not -- 2.10.1