Commit 6c5dbda0 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: abm: reset RED's child based on limit

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: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0b7490b
...@@ -196,7 +196,7 @@ nfp_abm_qdisc_replace(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -196,7 +196,7 @@ nfp_abm_qdisc_replace(struct net_device *netdev, struct nfp_abm_link *alink,
if (*qdisc) { if (*qdisc) {
if (WARN_ON((*qdisc)->type != type)) if (WARN_ON((*qdisc)->type != type))
return -EINVAL; return -EINVAL;
return 0; return 1;
} }
*qdisc = nfp_abm_qdisc_alloc(netdev, alink, type, parent_handle, handle, *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, ...@@ -357,11 +357,24 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
i = nfp_abm_red_find(alink, opt); i = nfp_abm_red_find(alink, opt);
existing = i >= 0; existing = i >= 0;
if (ret) { if (ret < 0) {
err = ret; err = ret;
goto err_destroy; 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)) { if (!nfp_abm_red_check_params(alink, opt)) {
err = -EINVAL; err = -EINVAL;
goto err_destroy; goto err_destroy;
...@@ -533,10 +546,14 @@ nfp_abm_mq_create(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -533,10 +546,14 @@ nfp_abm_mq_create(struct net_device *netdev, struct nfp_abm_link *alink,
struct tc_mq_qopt_offload *opt) struct tc_mq_qopt_offload *opt)
{ {
struct nfp_qdisc *qdisc; struct nfp_qdisc *qdisc;
int ret;
return nfp_abm_qdisc_replace(netdev, alink, NFP_QDISC_MQ, ret = nfp_abm_qdisc_replace(netdev, alink, NFP_QDISC_MQ,
TC_H_ROOT, opt->handle, TC_H_ROOT, opt->handle, alink->total_queues,
alink->total_queues, &qdisc); &qdisc);
if (ret < 0)
return ret;
return 0;
} }
int nfp_abm_setup_tc_mq(struct net_device *netdev, struct nfp_abm_link *alink, int nfp_abm_setup_tc_mq(struct net_device *netdev, struct nfp_abm_link *alink,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment