From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH 6/6] net/ionic: correctly set link speed and autonegotiation
Date: Mon, 11 Jan 2021 11:02:09 -0800 [thread overview]
Message-ID: <20210111190209.70928-7-aboyer@pensando.io> (raw)
In-Reply-To: <20210111190209.70928-1-aboyer@pensando.io>
Don't assume autoneg in link_update().
Always call ionic_dev_cmd_port_autoneg() in start().
This allows the client to specify the link settings.
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
drivers/net/ionic/ionic_ethdev.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 838e93ef7..2face7c63 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -276,7 +276,10 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev,
/* Initialize */
memset(&link, 0, sizeof(link));
- link.link_autoneg = ETH_LINK_AUTONEG;
+
+ if (adapter->idev.port_info->config.an_enable) {
+ link.link_autoneg = ETH_LINK_AUTONEG;
+ }
if (!adapter->link_up ||
!(lif->state & IONIC_LIF_F_UP)) {
@@ -869,7 +872,8 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
struct ionic_adapter *adapter = lif->adapter;
struct ionic_dev *idev = &adapter->idev;
- uint32_t allowed_speeds;
+ uint32_t speed = 0, allowed_speeds;
+ uint8_t an_enable;
int err;
IONIC_PRINT_CALL();
@@ -896,11 +900,23 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
return err;
}
- if (eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
- uint32_t speed = ionic_parse_link_speeds(dev_conf->link_speeds);
+ /* Configure link */
+ an_enable = (dev_conf->link_speeds & ETH_LINK_SPEED_FIXED) == 0;
- if (speed)
- ionic_dev_cmd_port_speed(idev, speed);
+ ionic_dev_cmd_port_autoneg(idev, an_enable);
+ err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ if (err)
+ IONIC_PRINT(WARNING, "Failed to %s autonegotiation",
+ an_enable ? "enable" : "disable");
+
+ if (!an_enable)
+ speed = ionic_parse_link_speeds(dev_conf->link_speeds);
+ if (speed) {
+ ionic_dev_cmd_port_speed(idev, speed);
+ err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ if (err)
+ IONIC_PRINT(WARNING, "Failed to set link speed %u",
+ speed);
}
ionic_dev_link_update(eth_dev, 0);
--
2.17.1
next prev parent reply other threads:[~2021-01-11 19:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 19:02 [dpdk-dev] [PATCH 0/6] net/ionic: fix device configuration and init Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 1/6] net/ionic: revise configuration flag handling Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 2/6] net/ionic: combine queue init and enable commands Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 3/6] net/ionic: set port admin state to up in port init Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 4/6] net/ionic: don't add station MAC filter on init Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 5/6] net/ionic: clear up confusion around FC autoneg Andrew Boyer
2021-01-11 19:02 ` Andrew Boyer [this message]
2021-01-18 17:10 ` [dpdk-dev] [PATCH 6/6] net/ionic: correctly set link speed and autonegotiation Ferruh Yigit
2021-01-18 17:09 ` [dpdk-dev] [PATCH 0/6] net/ionic: fix device configuration and init Ferruh Yigit
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=20210111190209.70928-7-aboyer@pensando.io \
--to=aboyer@pensando.io \
--cc=cardigliano@ntop.org \
--cc=dev@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).