bnxt_en: Fix ring arithmetic in bnxt_setup_tc().
The logic is missing the check on whether the tx and rx rings are sharing completion rings or not. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7b5b74efcc
commit
3ffb6a39b7
@@ -6309,6 +6309,7 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
|
|||||||
struct tc_to_netdev *ntc)
|
struct tc_to_netdev *ntc)
|
||||||
{
|
{
|
||||||
struct bnxt *bp = netdev_priv(dev);
|
struct bnxt *bp = netdev_priv(dev);
|
||||||
|
bool sh = false;
|
||||||
u8 tc;
|
u8 tc;
|
||||||
|
|
||||||
if (ntc->type != TC_SETUP_MQPRIO)
|
if (ntc->type != TC_SETUP_MQPRIO)
|
||||||
@@ -6325,13 +6326,12 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
|
|||||||
if (netdev_get_num_tc(dev) == tc)
|
if (netdev_get_num_tc(dev) == tc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (tc) {
|
|
||||||
int max_rx_rings, max_tx_rings, rc;
|
|
||||||
bool sh = false;
|
|
||||||
|
|
||||||
if (bp->flags & BNXT_FLAG_SHARED_RINGS)
|
if (bp->flags & BNXT_FLAG_SHARED_RINGS)
|
||||||
sh = true;
|
sh = true;
|
||||||
|
|
||||||
|
if (tc) {
|
||||||
|
int max_rx_rings, max_tx_rings, rc;
|
||||||
|
|
||||||
rc = bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, sh);
|
rc = bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, sh);
|
||||||
if (rc || bp->tx_nr_rings_per_tc * tc > max_tx_rings)
|
if (rc || bp->tx_nr_rings_per_tc * tc > max_tx_rings)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -6348,7 +6348,8 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
|
|||||||
bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
|
bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
|
||||||
netdev_reset_tc(dev);
|
netdev_reset_tc(dev);
|
||||||
}
|
}
|
||||||
bp->cp_nr_rings = max_t(int, bp->tx_nr_rings, bp->rx_nr_rings);
|
bp->cp_nr_rings = sh ? max_t(int, bp->tx_nr_rings, bp->rx_nr_rings) :
|
||||||
|
bp->tx_nr_rings + bp->rx_nr_rings;
|
||||||
bp->num_stat_ctxs = bp->cp_nr_rings;
|
bp->num_stat_ctxs = bp->cp_nr_rings;
|
||||||
|
|
||||||
if (netif_running(bp->dev))
|
if (netif_running(bp->dev))
|
||||||
|
|||||||
Reference in New Issue
Block a user