From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
jiri@resnulli.us, xiyou.wangcong@gmail.com, jhs@mojatatu.com,
Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next 11/13] nfp: abm: reset RED's child based on limit
Date: Mon, 12 Nov 2018 14:58:17 -0800 [thread overview]
Message-ID: <20181112225819.29823-12-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20181112225819.29823-1-jakub.kicinski@netronome.com>
RED qdisc will replace its child Qdisc with a new FIFO queue if
it is reconfigured and the limit parameter is not 0.
This means that when it's created with limit of 0 it will have no FIFO,
and all packets will be dropped. If it's changed and limit is specified
it will loose its existing child (implicit graft). Make sure we mark
RED Qdisc child as NFP_QDISC_UNTRACKED if its not the expected FIFO.
nfp_abm_qdisc_replace() will return 1 if Qdisc already existed.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
---
.../net/ethernet/netronome/nfp/abm/qdisc.c | 27 +++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/abm/qdisc.c b/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
index 151d2dafbc76..1b3c0b5b52bf 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/qdisc.c
@@ -196,7 +196,7 @@ nfp_abm_qdisc_replace(struct net_device *netdev, struct nfp_abm_link *alink,
if (*qdisc) {
if (WARN_ON((*qdisc)->type != type))
return -EINVAL;
- return 0;
+ return 1;
}
*qdisc = nfp_abm_qdisc_alloc(netdev, alink, type, parent_handle, handle,
@@ -357,11 +357,24 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
i = nfp_abm_red_find(alink, opt);
existing = i >= 0;
- if (ret) {
+ if (ret < 0) {
err = ret;
goto err_destroy;
}
+ /* If limit != 0 child gets reset */
+ if (opt->set.limit) {
+ if (nfp_abm_qdisc_child_valid(qdisc, 0))
+ qdisc->children[0]->use_cnt--;
+ qdisc->children[0] = NULL;
+ } else {
+ /* Qdisc was just allocated without a limit will use noop_qdisc,
+ * i.e. a block hole.
+ */
+ if (!ret)
+ qdisc->children[0] = NFP_QDISC_UNTRACKED;
+ }
+
if (!nfp_abm_red_check_params(alink, opt)) {
err = -EINVAL;
goto err_destroy;
@@ -533,10 +546,14 @@ nfp_abm_mq_create(struct net_device *netdev, struct nfp_abm_link *alink,
struct tc_mq_qopt_offload *opt)
{
struct nfp_qdisc *qdisc;
+ int ret;
- return nfp_abm_qdisc_replace(netdev, alink, NFP_QDISC_MQ,
- TC_H_ROOT, opt->handle,
- alink->total_queues, &qdisc);
+ ret = nfp_abm_qdisc_replace(netdev, alink, NFP_QDISC_MQ,
+ TC_H_ROOT, opt->handle, alink->total_queues,
+ &qdisc);
+ if (ret < 0)
+ return ret;
+ return 0;
}
int nfp_abm_setup_tc_mq(struct net_device *netdev, struct nfp_abm_link *alink,
--
2.17.1
next prev parent reply other threads:[~2018-11-13 8:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 22:58 [PATCH net-next 00/13] nfp: abm: track all Qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 01/13] nfp: abm: rename qdiscs -> red_qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 02/13] nfp: abm: keep track of all RED thresholds Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 03/13] nfp: abm: track all offload-enabled qdiscs Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 04/13] net: sched: provide notification for graft on root Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 05/13] nfp: abm: remember which Qdisc is root Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 06/13] nfp: abm: allocate Qdisc child table Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 07/13] net: sched: red: offload a graft notification Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 08/13] net: sched: mq: " Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 09/13] nfp: abm: build full Qdisc hierarchy based on graft notifications Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 10/13] net: sched: red: notify drivers about RED's limit parameter Jakub Kicinski
2018-11-12 22:58 ` Jakub Kicinski [this message]
2018-11-12 22:58 ` [PATCH net-next 12/13] nfp: abm: save RED's parameters Jakub Kicinski
2018-11-12 22:58 ` [PATCH net-next 13/13] nfp: abm: restructure Qdisc handling Jakub Kicinski
2018-11-14 16:53 ` [PATCH net-next 00/13] nfp: abm: track all Qdiscs David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181112225819.29823-12-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).