aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-10 17:26:00 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-10 17:26:00 -0500
commit33175d84ee3fa29991adb80513683e010769e807 (patch)
tree3731f61cf82451b6892cf1368701e57e35d92908 /drivers/net/bnx2x
parentc5908939b2738bafe1b309bc2465cb9f2e6184c5 (diff)
parent6dfbd87a20a737641ef228230c77f4262434fa24 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x/bnx2x_cmn.c
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r--drivers/net/bnx2x/bnx2x.h5
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c22
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.h9
-rw-r--r--drivers/net/bnx2x/bnx2x_ethtool.c18
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c19
5 files changed, 52 insertions, 21 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 50d1e079309..b7ff87b35fb 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1223,6 +1223,7 @@ struct bnx2x {
1223 /* DCBX Negotation results */ 1223 /* DCBX Negotation results */
1224 struct dcbx_features dcbx_local_feat; 1224 struct dcbx_features dcbx_local_feat;
1225 u32 dcbx_error; 1225 u32 dcbx_error;
1226 u32 pending_max;
1226}; 1227};
1227 1228
1228/** 1229/**
@@ -1634,8 +1635,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1634/* CMNG constants, as derived from system spec calculations */ 1635/* CMNG constants, as derived from system spec calculations */
1635/* default MIN rate in case VNIC min rate is configured to zero - 100Mbps */ 1636/* default MIN rate in case VNIC min rate is configured to zero - 100Mbps */
1636#define DEF_MIN_RATE 100 1637#define DEF_MIN_RATE 100
1637/* resolution of the rate shaping timer - 100 usec */ 1638/* resolution of the rate shaping timer - 400 usec */
1638#define RS_PERIODIC_TIMEOUT_USEC 100 1639#define RS_PERIODIC_TIMEOUT_USEC 400
1639/* number of bytes in single QM arbitration cycle - 1640/* number of bytes in single QM arbitration cycle -
1640 * coefficient for calculating the fairness timer */ 1641 * coefficient for calculating the fairness timer */
1641#define QM_ARB_BYTES 160000 1642#define QM_ARB_BYTES 160000
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index b01b622f4e1..e83ac6dd6fc 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -993,6 +993,23 @@ void bnx2x_free_skbs(struct bnx2x *bp)
993 bnx2x_free_rx_skbs(bp); 993 bnx2x_free_rx_skbs(bp);
994} 994}
995 995
996void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value)
997{
998 /* load old values */
999 u32 mf_cfg = bp->mf_config[BP_VN(bp)];
1000
1001 if (value != bnx2x_extract_max_cfg(bp, mf_cfg)) {
1002 /* leave all but MAX value */
1003 mf_cfg &= ~FUNC_MF_CFG_MAX_BW_MASK;
1004
1005 /* set new MAX value */
1006 mf_cfg |= (value << FUNC_MF_CFG_MAX_BW_SHIFT)
1007 & FUNC_MF_CFG_MAX_BW_MASK;
1008
1009 bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, mf_cfg);
1010 }
1011}
1012
996static void bnx2x_free_msix_irqs(struct bnx2x *bp) 1013static void bnx2x_free_msix_irqs(struct bnx2x *bp)
997{ 1014{
998 int i, offset = 1; 1015 int i, offset = 1;
@@ -1498,6 +1515,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1498 /* Clear UC lists configuration */ 1515 /* Clear UC lists configuration */
1499 bnx2x_invalidate_uc_list(bp); 1516 bnx2x_invalidate_uc_list(bp);
1500 1517
1518 if (bp->pending_max) {
1519 bnx2x_update_max_mf_config(bp, bp->pending_max);
1520 bp->pending_max = 0;
1521 }
1522
1501 if (bp->port.pmf) 1523 if (bp->port.pmf)
1502 bnx2x_initial_phy_init(bp, load_mode); 1524 bnx2x_initial_phy_init(bp, load_mode);
1503 1525
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
index 8c401c990bf..ef37b98d614 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 */
342int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state); 342int 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 */
351void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value);
352
344/* dev_close main block */ 353/* dev_close main block */
345int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); 354int 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 85291d8b332..f5050155c6b 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
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 30b21d2f26f..bba21d5f708 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -2092,8 +2092,9 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type)
2092 bnx2x_calc_vn_weight_sum(bp); 2092 bnx2x_calc_vn_weight_sum(bp);
2093 2093
2094 /* calculate and set min-max rate for each vn */ 2094 /* calculate and set min-max rate for each vn */
2095 for (vn = VN_0; vn < E1HVN_MAX; vn++) 2095 if (bp->port.pmf)
2096 bnx2x_init_vn_minmax(bp, vn); 2096 for (vn = VN_0; vn < E1HVN_MAX; vn++)
2097 bnx2x_init_vn_minmax(bp, vn);
2097 2098
2098 /* always enable rate shaping and fairness */ 2099 /* always enable rate shaping and fairness */
2099 bp->cmng.flags.cmng_enables |= 2100 bp->cmng.flags.cmng_enables |=
@@ -2162,13 +2163,6 @@ static void bnx2x_link_attn(struct bnx2x *bp)
2162 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); 2163 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
2163 } 2164 }
2164 2165
2165 /* indicate link status only if link status actually changed */
2166 if (prev_link_status != bp->link_vars.link_status)
2167 bnx2x_link_report(bp);
2168
2169 if (IS_MF(bp))
2170 bnx2x_link_sync_notify(bp);
2171
2172 if (bp->link_vars.link_up && bp->link_vars.line_speed) { 2166 if (bp->link_vars.link_up && bp->link_vars.line_speed) {
2173 int cmng_fns = bnx2x_get_cmng_fns_mode(bp); 2167 int cmng_fns = bnx2x_get_cmng_fns_mode(bp);
2174 2168
@@ -2180,6 +2174,13 @@ static void bnx2x_link_attn(struct bnx2x *bp)
2180 DP(NETIF_MSG_IFUP, 2174 DP(NETIF_MSG_IFUP,
2181 "single function mode without fairness\n"); 2175 "single function mode without fairness\n");
2182 } 2176 }
2177
2178 if (IS_MF(bp))
2179 bnx2x_link_sync_notify(bp);
2180
2181 /* indicate link status only if link status actually changed */
2182 if (prev_link_status != bp->link_vars.link_status)
2183 bnx2x_link_report(bp);
2183} 2184}
2184 2185
2185void bnx2x__link_status_update(struct bnx2x *bp) 2186void bnx2x__link_status_update(struct bnx2x *bp)