mirror of https://gitee.com/openkylin/linux.git
amd-xgbe: Verify forced speed matches the active speedset
When using ethtool to set the speed for the device, verify that the specified speed is valid within the active speedset. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
793494228f
commit
757e6aa34c
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* License 1: GPLv2
|
* License 1: GPLv2
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Advanced Micro Devices, Inc.
|
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you may copy, redistribute and/or modify
|
* This file is free software; you may copy, redistribute and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
*
|
*
|
||||||
* License 2: Modified BSD
|
* License 2: Modified BSD
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Advanced Micro Devices, Inc.
|
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -318,8 +318,20 @@ static int xgbe_set_settings(struct net_device *netdev,
|
||||||
if (cmd->autoneg == AUTONEG_DISABLE) {
|
if (cmd->autoneg == AUTONEG_DISABLE) {
|
||||||
switch (speed) {
|
switch (speed) {
|
||||||
case SPEED_10000:
|
case SPEED_10000:
|
||||||
|
break;
|
||||||
case SPEED_2500:
|
case SPEED_2500:
|
||||||
|
if (pdata->speed_set != XGBE_SPEEDSET_2500_10000) {
|
||||||
|
netdev_err(netdev, "unsupported speed %u\n",
|
||||||
|
speed);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SPEED_1000:
|
case SPEED_1000:
|
||||||
|
if (pdata->speed_set != XGBE_SPEEDSET_1000_10000) {
|
||||||
|
netdev_err(netdev, "unsupported speed %u\n",
|
||||||
|
speed);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
netdev_err(netdev, "unsupported speed %u\n", speed);
|
netdev_err(netdev, "unsupported speed %u\n", speed);
|
||||||
|
|
Loading…
Reference in New Issue