diff options
author | Dmitry Kravkov <dmitry@broadcom.com> | 2011-03-06 05:50:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-06 21:06:03 -0500 |
commit | e3835b99333eb3ac7222f6fc0af5cae46074ac49 (patch) | |
tree | b68e45eda6bbf47f52cdd4fd2f58ec0dc1602ef9 /drivers/net/bnx2x | |
parent | 9fdc3e9566b3ae691aefc3aa7b8dca6cac32c95e (diff) |
bnx2x: (NPAR) prevent HW access in D3 state
Changing speed setting in NPAR requires HW access, this patch
delays the access to D0 state when performed in D3.
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r-- | drivers/net/bnx2x/bnx2x.h | 1 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 22 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.h | 9 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 18 |
4 files changed, 40 insertions, 10 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 7897d114b290..2ac4e3c597fa 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -1211,6 +1211,7 @@ struct bnx2x { | |||
1211 | /* DCBX Negotation results */ | 1211 | /* DCBX Negotation results */ |
1212 | struct dcbx_features dcbx_local_feat; | 1212 | struct dcbx_features dcbx_local_feat; |
1213 | u32 dcbx_error; | 1213 | u32 dcbx_error; |
1214 | u32 pending_max; | ||
1214 | }; | 1215 | }; |
1215 | 1216 | ||
1216 | /** | 1217 | /** |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 93798129061b..a71b32940533 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -996,6 +996,23 @@ void bnx2x_free_skbs(struct bnx2x *bp) | |||
996 | bnx2x_free_rx_skbs(bp); | 996 | bnx2x_free_rx_skbs(bp); |
997 | } | 997 | } |
998 | 998 | ||
999 | void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value) | ||
1000 | { | ||
1001 | /* load old values */ | ||
1002 | u32 mf_cfg = bp->mf_config[BP_VN(bp)]; | ||
1003 | |||
1004 | if (value != bnx2x_extract_max_cfg(bp, mf_cfg)) { | ||
1005 | /* leave all but MAX value */ | ||
1006 | mf_cfg &= ~FUNC_MF_CFG_MAX_BW_MASK; | ||
1007 | |||
1008 | /* set new MAX value */ | ||
1009 | mf_cfg |= (value << FUNC_MF_CFG_MAX_BW_SHIFT) | ||
1010 | & FUNC_MF_CFG_MAX_BW_MASK; | ||
1011 | |||
1012 | bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, mf_cfg); | ||
1013 | } | ||
1014 | } | ||
1015 | |||
999 | static void bnx2x_free_msix_irqs(struct bnx2x *bp) | 1016 | static void bnx2x_free_msix_irqs(struct bnx2x *bp) |
1000 | { | 1017 | { |
1001 | int i, offset = 1; | 1018 | int i, offset = 1; |
@@ -1464,6 +1481,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1464 | 1481 | ||
1465 | bnx2x_set_eth_mac(bp, 1); | 1482 | bnx2x_set_eth_mac(bp, 1); |
1466 | 1483 | ||
1484 | if (bp->pending_max) { | ||
1485 | bnx2x_update_max_mf_config(bp, bp->pending_max); | ||
1486 | bp->pending_max = 0; | ||
1487 | } | ||
1488 | |||
1467 | if (bp->port.pmf) | 1489 | if (bp->port.pmf) |
1468 | bnx2x_initial_phy_init(bp, load_mode); | 1490 | bnx2x_initial_phy_init(bp, load_mode); |
1469 | 1491 | ||
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index 326ba44b3ded..85ea7f26b51f 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -341,6 +341,15 @@ void bnx2x_dcbx_init(struct bnx2x *bp); | |||
341 | */ | 341 | */ |
342 | int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state); | 342 | int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state); |
343 | 343 | ||
344 | /** | ||
345 | * Updates MAX part of MF configuration in HW | ||
346 | * (if required) | ||
347 | * | ||
348 | * @param bp | ||
349 | * @param value | ||
350 | */ | ||
351 | void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value); | ||
352 | |||
344 | /* dev_close main block */ | 353 | /* dev_close main block */ |
345 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); | 354 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); |
346 | 355 | ||
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index ef2919987a10..7e92f9d0dcfd 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 | ||