[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181112225819.29823-13-jakub.kicinski@netronome.com>
Date: Mon, 12 Nov 2018 14:58:18 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: davem@...emloft.net
Cc: oss-drivers@...ronome.com, netdev@...r.kernel.org,
jiri@...nulli.us, xiyou.wangcong@...il.com, jhs@...atatu.com,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH net-next 12/13] nfp: abm: save RED's parameters
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@...ronome.com>
Reviewed-by: John Hurley <john.hurley@...ronome.com>
---
drivers/net/ethernet/netronome/nfp/abm/main.h | 14 ++++++++++++++
drivers/net/ethernet/netronome/nfp/abm/qdisc.c | 5 ++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/netronome/nfp/abm/main.h b/drivers/net/ethernet/netronome/nfp/abm/main.h
index daca93e90099..d0d85f82bd1c 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/main.h
+++ b/drivers/net/ethernet/netronome/nfp/abm/main.h
@@ -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;
@@ -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;
+ };
};
/**
diff --git a/drivers/net/ethernet/netronome/nfp/abm/qdisc.c b/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
index 1b3c0b5b52bf..fb68038ec1da 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
@@ -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;
}
--
2.17.1
Powered by blists - more mailing lists