Skip to content

Commit ae2dcb2

Browse files
Sudarsana Reddy Kallurudavem330
authored andcommitted
bnx2x: Fix invalid memory access in rss hash config path.
Rx hash/filter table configuration uses rss_conf_obj to configure filters in the hardware. This object is initialized only when the interface is brought up. This patch adds driver changes to configure rss params only when the device is in opened state. In port disabled case, the config will be cached in the driver structure which will be applied in the successive load path. Please consider applying it to 'net' branch. Signed-off-by: Sudarsana Reddy Kalluru <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 958c696 commit ae2dcb2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,14 +3388,18 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
33883388
DP(BNX2X_MSG_ETHTOOL,
33893389
"rss re-configured, UDP 4-tupple %s\n",
33903390
udp_rss_requested ? "enabled" : "disabled");
3391-
return bnx2x_rss(bp, &bp->rss_conf_obj, false, true);
3391+
if (bp->state == BNX2X_STATE_OPEN)
3392+
return bnx2x_rss(bp, &bp->rss_conf_obj, false,
3393+
true);
33923394
} else if ((info->flow_type == UDP_V6_FLOW) &&
33933395
(bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) {
33943396
bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested;
33953397
DP(BNX2X_MSG_ETHTOOL,
33963398
"rss re-configured, UDP 4-tupple %s\n",
33973399
udp_rss_requested ? "enabled" : "disabled");
3398-
return bnx2x_rss(bp, &bp->rss_conf_obj, false, true);
3400+
if (bp->state == BNX2X_STATE_OPEN)
3401+
return bnx2x_rss(bp, &bp->rss_conf_obj, false,
3402+
true);
33993403
}
34003404
return 0;
34013405

@@ -3509,7 +3513,10 @@ static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir,
35093513
bp->rss_conf_obj.ind_table[i] = indir[i] + bp->fp->cl_id;
35103514
}
35113515

3512-
return bnx2x_config_rss_eth(bp, false);
3516+
if (bp->state == BNX2X_STATE_OPEN)
3517+
return bnx2x_config_rss_eth(bp, false);
3518+
3519+
return 0;
35133520
}
35143521

35153522
/**

0 commit comments

Comments
 (0)