nfp: abm: size threshold table to account for bands
authorJakub Kicinski <jakub.kicinski@netronome.com>
Mon, 19 Nov 2018 23:21:39 +0000 (15:21 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Nov 2018 02:53:45 +0000 (18:53 -0800)
Make sure the threshold table is large enough to hold information
for all bands.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/abm/main.c

index a5732d3bd1b7613639de466131d301d1febc22c1..b21250b95475501a1a7093d9c4a44055bc81a7ae 100644 (file)
@@ -422,7 +422,7 @@ static int nfp_abm_init(struct nfp_app *app)
                goto err_free_abm;
 
        err = -ENOMEM;
-       abm->num_thresholds = NFP_NET_MAX_RX_RINGS;
+       abm->num_thresholds = array_size(abm->num_bands, NFP_NET_MAX_RX_RINGS);
        abm->threshold_undef = bitmap_zalloc(abm->num_thresholds, GFP_KERNEL);
        if (!abm->threshold_undef)
                goto err_free_abm;
@@ -431,7 +431,7 @@ static int nfp_abm_init(struct nfp_app *app)
                                   sizeof(*abm->thresholds), GFP_KERNEL);
        if (!abm->thresholds)
                goto err_free_thresh_umap;
-       for (i = 0; i < NFP_NET_MAX_RX_RINGS; i++)
+       for (i = 0; i < abm->num_bands * NFP_NET_MAX_RX_RINGS; i++)
                __nfp_abm_ctrl_set_q_lvl(abm, i, NFP_ABM_LVL_INFINITY);
 
        /* We start in legacy mode, make sure advanced queuing is disabled */