Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da3cc2da authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller
Browse files

bnx2: Fix bandwidth allocation for some MF modes



Management firmware tells driver in case bandwidth configuration for
a specific function exists, but [regretably] the same field has different
meanings depending on the multi-function mode - it can either be
a percentile value or an actual speed.

For newer multi-function modes current logic is incorrect -
driver understands values as actual speeds instead of percentages,
causing the resulting chip configuration to be incorrect.

Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e313678
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2571,6 +2571,10 @@ void bnx2x_notify_link_changed(struct bnx2x *bp);
			(IS_MF_SD_STORAGE_PERSONALITY_ONLY(bp) ||	\
			 IS_MF_SI_STORAGE_PERSONALITY_ONLY(bp))

/* Determines whether BW configuration arrives in 100Mb units or in
 * percentages from actual physical link speed.
 */
#define IS_MF_PERCENT_BW(bp) (IS_MF_SI(bp) || IS_MF_UFP(bp) || IS_MF_BD(bp))

#define SET_FLAG(value, mask, flag) \
	do {\
+1 −1
Original line number Diff line number Diff line
@@ -1190,7 +1190,7 @@ u16 bnx2x_get_mf_speed(struct bnx2x *bp)
		/* Calculate the current MAX line speed limit for the MF
		 * devices
		 */
		if (IS_MF_SI(bp))
		if (IS_MF_PERCENT_BW(bp))
			line_speed = (line_speed * maxCfg) / 100;
		else { /* SD mode */
			u16 vn_max_rate = maxCfg * 100;
+1 −1
Original line number Diff line number Diff line
@@ -2494,7 +2494,7 @@ static void bnx2x_calc_vn_max(struct bnx2x *bp, int vn,
	else {
		u32 maxCfg = bnx2x_extract_max_cfg(bp, vn_cfg);

		if (IS_MF_SI(bp)) {
		if (IS_MF_PERCENT_BW(bp)) {
			/* maxCfg in percents of linkspeed */
			vn_max_rate = (bp->link_vars.line_speed * maxCfg) / 100;
		} else /* SD modes */