[dpdk-dev,v2] E1000: fix for forced speed/duplex config
Commit Message
Fixed the formating/syntax issues reported
From the code, it looks like, hw->mac.autoneg, variable is used to
switch between calling either autoneg function or forcing
speed/duplex function. But this variable is not modified in
eth_em_start/eth_igb_start routines (it is always set to 1)
even while forcing the link speed.
Following discussion thread has some more information on
this
http://dpdk.org/ml/archives/dev/2016-October/049272.html
Signed-off-by: Ananda Sathyanarayana <ananda@versa-networks.com>
---
drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
drivers/net/e1000/igb_ethdev.c | 12 ++++++++++++
2 files changed, 24 insertions(+)
Comments
Hi,
> -----Original Message-----
> From: Ananda Sathyanarayana [mailto:ananda@versa-networks.com]
> Sent: Thursday, November 3, 2016 7:37 AM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Ananda Sathyanarayana
> Subject: [PATCH v2] E1000: fix for forced speed/duplex config
>
> Fixed the formating/syntax issues reported
>
> From the code, it looks like, hw->mac.autoneg, variable is used to switch
> between calling either autoneg function or forcing speed/duplex function. But
> this variable is not modified in eth_em_start/eth_igb_start routines (it is always
> set to 1) even while forcing the link speed.
>
> Following discussion thread has some more information on this
>
> http://dpdk.org/ml/archives/dev/2016-October/049272.html
>
> Signed-off-by: Ananda Sathyanarayana <ananda@versa-networks.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > From the code, it looks like, hw->mac.autoneg, variable is used to switch
> > between calling either autoneg function or forcing speed/duplex function. But
> > this variable is not modified in eth_em_start/eth_igb_start routines (it is always
> > set to 1) even while forcing the link speed.
> >
> > Following discussion thread has some more information on this
> >
> > http://dpdk.org/ml/archives/dev/2016-October/049272.html
> >
> > Signed-off-by: Ananda Sathyanarayana <ananda@versa-networks.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Applied, thanks
@@ -639,6 +639,7 @@ eth_em_start(struct rte_eth_dev *dev)
speeds = &dev->data->dev_conf.link_speeds;
if (*speeds == ETH_LINK_SPEED_AUTONEG) {
hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX;
+ hw->mac.autoneg = 1;
} else {
num_speeds = 0;
autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0;
@@ -674,6 +675,17 @@ eth_em_start(struct rte_eth_dev *dev)
}
if (num_speeds == 0 || (!autoneg && (num_speeds > 1)))
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;
+ }
}
e1000_setup_link(hw);
@@ -1327,6 +1327,7 @@ eth_igb_start(struct rte_eth_dev *dev)
speeds = &dev->data->dev_conf.link_speeds;
if (*speeds == ETH_LINK_SPEED_AUTONEG) {
hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX;
+ hw->mac.autoneg = 1;
} else {
num_speeds = 0;
autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0;
@@ -1362,6 +1363,17 @@ eth_igb_start(struct rte_eth_dev *dev)
}
if (num_speeds == 0 || (!autoneg && (num_speeds > 1)))
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;
+ }
}
e1000_setup_link(hw);