Skip to content

Commit

Permalink
nfp: abm: save RED's parameters
Browse files Browse the repository at this point in the history
Use the new driver Qdisc structure to keep track of parameters
of RED Qdiscs.  This way as the Qdisc moves around in the hierarchy
we will be able to configure the HW appropriately.

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>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Nov 14, 2018
1 parent 6c5dbda commit 52db4ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions drivers/net/ethernet/netronome/nfp/abm/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ enum nfp_qdisc_type {
* @use_cnt: number of attachment points in the hierarchy
* @num_children: current size of the @children array
* @children: pointers to children
*
* @params_ok: parameters of this Qdisc are OK for offload
*
* @red: RED Qdisc specific parameters and state
* @red.threshold: ECN marking threshold
*/
struct nfp_qdisc {
struct net_device *netdev;
Expand All @@ -98,6 +103,15 @@ struct nfp_qdisc {
unsigned int use_cnt;
unsigned int num_children;
struct nfp_qdisc **children;

bool params_ok;

union {
/* TC_SETUP_QDISC_RED */
struct {
u32 threshold;
} red;
};
};

/**
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/netronome/nfp/abm/qdisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
qdisc->children[0] = NFP_QDISC_UNTRACKED;
}

if (!nfp_abm_red_check_params(alink, opt)) {
qdisc->params_ok = nfp_abm_red_check_params(alink, opt);
if (qdisc->params_ok) {
qdisc->red.threshold = opt->set.min;
} else {
err = -EINVAL;
goto err_destroy;
}
Expand Down

0 comments on commit 52db4ea

Please sign in to comment.