DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alvin Zhang <alvinx.zhang@intel.com>
To: haiyue.wang@intel.com
Cc: dev@dpdk.org, Alvin Zhang <alvinx.zhang@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [DPDK] net/igc: fix speed configuration
Date: Wed, 12 May 2021 16:28:26 +0800	[thread overview]
Message-ID: <20210512082826.39680-1-alvinx.zhang@intel.com> (raw)

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 <alvinx.zhang@intel.com>
---
 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


             reply	other threads:[~2021-05-12  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12  8:28 Alvin Zhang [this message]
     [not found] ` <DM6PR11MB3898E214158AA1508ACAB5ED9F529@DM6PR11MB3898.namprd11.prod.outlook.com>
2021-05-12  9:20   ` Guo, Junfeng
2021-05-12 10:36     ` Zhang, Qi Z

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=20210512082826.39680-1-alvinx.zhang@intel.com \
    --to=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyue.wang@intel.com \
    --cc=stable@dpdk.org \
    /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).