When the user requests a fixed speed for a NIC link, the speeds bitmask
passed must have a speed value actually set in it, as well as the
"FIXED" flag. Catch this case and log an error message.

Fixes: 36afbc269081 ("net/ice: support link speed change")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 drivers/net/intel/ice/ice_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/intel/ice/ice_ethdev.c 
b/drivers/net/intel/ice/ice_ethdev.c
index 76b8ff0a72..dc955d130b 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -4936,6 +4936,10 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
                                        RTE_ETH_LINK_SPEED_100M;
        }
        speed = ice_parse_link_speeds(conf->link_speeds);
+       if (speed == ICE_AQ_LINK_SPEED_UNKNOWN) {
+               PMD_DRV_LOG(ERR, "No valid link speed setting specified");
+               return -EINVAL;
+       }
 
        return ice_phy_conf_link(hw, speed, true);
 }
-- 
2.53.0

Reply via email to