Skip to content

Commit

Permalink
nfp: abm: don't set negative threshold
Browse files Browse the repository at this point in the history
Turns out the threshold value is used in signed compares in the FW,
so we should avoid setting the top bit.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Nov 9, 2018
1 parent 032748a commit cae5f48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/netronome/nfp/abm/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#ifndef __NFP_ABM_H__
#define __NFP_ABM_H__ 1

#include <linux/bits.h>
#include <net/devlink.h>
#include <net/pkt_cls.h>

#define NFP_ABM_LVL_INFINITY S32_MAX

struct nfp_app;
struct nfp_net;

Expand Down
10 changes: 8 additions & 2 deletions drivers/net/ethernet/netronome/nfp/abm/qdisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void
nfp_abm_reset_root(struct net_device *netdev, struct nfp_abm_link *alink,
u32 handle, unsigned int qs)
{
__nfp_abm_reset_root(netdev, alink, handle, qs, ~0);
__nfp_abm_reset_root(netdev, alink, handle, qs, NFP_ABM_LVL_INFINITY);
}

static int
Expand Down Expand Up @@ -67,7 +67,7 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink,
if (alink->parent == TC_H_ROOT) {
nfp_abm_reset_root(netdev, alink, TC_H_ROOT, 0);
} else {
nfp_abm_ctrl_set_q_lvl(alink, i, ~0);
nfp_abm_ctrl_set_q_lvl(alink, i, NFP_ABM_LVL_INFINITY);
memset(&alink->qdiscs[i], 0, sizeof(*alink->qdiscs));
}
}
Expand All @@ -88,6 +88,12 @@ nfp_abm_red_check_params(struct nfp_abm_link *alink,
opt->parent, opt->handle);
return false;
}
if (opt->set.min > NFP_ABM_LVL_INFINITY) {
nfp_warn(cpp, "RED offload failed - threshold too large %d > %d (p:%08x h:%08x)\n",
opt->set.min, NFP_ABM_LVL_INFINITY, opt->parent,
opt->handle);
return false;
}

return true;
}
Expand Down

0 comments on commit cae5f48

Please sign in to comment.