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 1E654A0A0E; Wed, 12 May 2021 10:28:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C2FF4003F; Wed, 12 May 2021 10:28:37 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 255C94003E; Wed, 12 May 2021 10:28:35 +0200 (CEST) IronPort-SDR: O5jOsPJ5g8yIJwLZYo3fXqYHhrL4lSP5BdqlIhCRraiERHzZuR+H1wxbkp5qtc7ZPqnReST3nX yj1+ytDXv6tQ== X-IronPort-AV: E=McAfee;i="6200,9189,9981"; a="196555682" X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="196555682" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 01:28:33 -0700 IronPort-SDR: CBLA09WvXPtNCFzIrIQo/SPjlSZh3AfhmesmRg+UD8HL4X7tzPlEFe162DqpQrk/gnhl5yGgTw uYPDtKQ4ztAQ== X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="625214889" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 01:28:31 -0700 From: Alvin Zhang To: haiyue.wang@intel.com Cc: dev@dpdk.org, Alvin Zhang , stable@dpdk.org Date: Wed, 12 May 2021 16:28:26 +0800 Message-Id: <20210512082826.39680-1-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [DPDK] net/igc: fix speed configuration 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 Sender: "dev" Fixed speed mode is not supported currently, this patch removes configurations for this mode and adds fault handling for ETH_LINK_SPEED_FIXED. Fixes: 4f09bc55ac3d ("net/igc: implement device base operations") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang --- drivers/net/igc/igc_ethdev.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index b1c58fb..224a095 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -989,15 +989,20 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev, hw->mac.autoneg = 1; } else { int num_speeds = 0; - bool autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0; - /* Reset */ + if (*speeds & ETH_LINK_SPEED_FIXED) { + PMD_DRV_LOG(ERR, + "Force speed mode currently not supported"); + igc_dev_clear_queues(dev); + return -EINVAL; + } + hw->phy.autoneg_advertised = 0; + hw->mac.autoneg = 1; if (*speeds & ~(ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | - ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G | - ETH_LINK_SPEED_FIXED)) { + ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G)) { num_speeds = -1; goto error_invalid_config; } @@ -1025,19 +1030,8 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev, hw->phy.autoneg_advertised |= ADVERTISE_2500_FULL; num_speeds++; } - if (num_speeds == 0 || (!autoneg && num_speeds > 1)) + if (num_speeds == 0) goto error_invalid_config; - - /* Set/reset the mac.autoneg based on the link speed, - * fixed or not - */ - if (!autoneg) { - hw->mac.autoneg = 0; - hw->mac.forced_speed_duplex = - hw->phy.autoneg_advertised; - } else { - hw->mac.autoneg = 1; - } } igc_setup_link(hw); -- 1.8.3.1