[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85wp3col9z.fsf@mojatatu.com>
Date: Mon, 30 Oct 2017 08:47:04 -0400
From: Roman Mashak <mrv@...atatu.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net, nogahf@...lanox.com,
jhs@...atatu.com, xiyou.wangcong@...il.com, mlxsw@...lanox.com,
andrew@...n.ch, vivien.didelot@...oirfairelinux.com,
f.fainelli@...il.com, michael.chan@...adcom.com,
ganeshgr@...lsio.com, saeedm@...lanox.com, matanb@...lanox.com,
leonro@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, simon.horman@...ronome.com,
pieter.jansenvanvuuren@...ronome.com, john.hurley@...ronome.com,
alexander.h.duyck@...el.com, ogerlitz@...lanox.com,
john.fastabend@...il.com
Subject: Re: [patch net-next RFC 1/9] net_sch: red: Add offload ability to RED qdisc
Jiri Pirko <jiri@...nulli.us> writes:
[...]
> +static void red_unoffload(struct Qdisc *sch)
> +{
> + struct net_device *dev = qdisc_dev(sch);
> + struct tc_red_qopt_offload opt = {
> + .handle = sch->handle,
> + .command = TC_RED_DESTROY,
> + .parent = sch->parent,
> + };
> +
> + if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
> + return;
> +
> + dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
> +}
> +
> @@ -162,6 +179,28 @@ static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
> [TCA_RED_MAX_P] = { .type = NLA_U32 },
> };
>
> +static int red_offload(struct Qdisc *sch)
> +{
> + struct red_sched_data *q = qdisc_priv(sch);
> + struct net_device *dev = qdisc_dev(sch);
> + struct tc_red_qopt_offload opt = {
> + .handle = sch->handle,
> + .command = TC_RED_REPLACE,
> + .parent = sch->parent,
> + .set = {
> + .min = q->parms.qth_min >> q->parms.Wlog,
> + .max = q->parms.qth_max >> q->parms.Wlog,
> + .probability = q->parms.max_P,
> + .is_ecn = red_use_ecn(q),
> + },
> + };
> +
> + if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
> + return -EOPNOTSUPP;
> +
> + return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt);
> +}
> +
[...]
Can't red_unoffload() and red_offload() be unified in a single API? For
example, red_offload(struct Qdisc *sch, bool enable) ?
Powered by blists - more mailing lists