aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_ethtool.c')
-rw-r--r--drivers/net/bnx2x/bnx2x_ethtool.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c
index 85291d8b3329..f5050155c6b5 100644
--- a/drivers/net/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/bnx2x/bnx2x_ethtool.c
@@ -238,7 +238,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
238 speed |= (cmd->speed_hi << 16); 238 speed |= (cmd->speed_hi << 16);
239 239
240 if (IS_MF_SI(bp)) { 240 if (IS_MF_SI(bp)) {
241 u32 param = 0, part; 241 u32 part;
242 u32 line_speed = bp->link_vars.line_speed; 242 u32 line_speed = bp->link_vars.line_speed;
243 243
244 /* use 10G if no link detected */ 244 /* use 10G if no link detected */
@@ -251,24 +251,22 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
251 REQ_BC_VER_4_SET_MF_BW); 251 REQ_BC_VER_4_SET_MF_BW);
252 return -EINVAL; 252 return -EINVAL;
253 } 253 }
254
254 part = (speed * 100) / line_speed; 255 part = (speed * 100) / line_speed;
256
255 if (line_speed < speed || !part) { 257 if (line_speed < speed || !part) {
256 BNX2X_DEV_INFO("Speed setting should be in a range " 258 BNX2X_DEV_INFO("Speed setting should be in a range "
257 "from 1%% to 100%% " 259 "from 1%% to 100%% "
258 "of actual line speed\n"); 260 "of actual line speed\n");
259 return -EINVAL; 261 return -EINVAL;
260 } 262 }
261 /* load old values */
262 param = bp->mf_config[BP_VN(bp)];
263 263
264 /* leave only MIN value */ 264 if (bp->state != BNX2X_STATE_OPEN)
265 param &= FUNC_MF_CFG_MIN_BW_MASK; 265 /* store value for following "load" */
266 266 bp->pending_max = part;
267 /* set new MAX value */ 267 else
268 param |= (part << FUNC_MF_CFG_MAX_BW_SHIFT) 268 bnx2x_update_max_mf_config(bp, part);
269 & FUNC_MF_CFG_MAX_BW_MASK;
270 269
271 bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, param);
272 return 0; 270 return 0;
273 } 271 }
274 272