[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1452184195.8255.215.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 07 Jan 2016 08:29:55 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: davem@...emloft.net, alexei.starovoitov@...il.com,
jhs@...atatu.com, john.fastabend@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net, sched: add clsact qdisc
On Wed, 2016-01-06 at 02:00 +0100, Daniel Borkmann wrote:
> This work adds a generalization of the ingress qdisc as a qdisc holding
> only classifiers. The clsact qdisc works on ingress, but also on egress.
> In both cases, it's execution happens without taking the qdisc lock, and
> the main difference for the egress part compared to prior version of [1]
> is that this can be applied with _any_ underlying real egress qdisc (also
> classless ones).
> +void net_dec_egress_queue(void)
> +{
> + static_key_slow_dec(&egress_needed);
> +}
> +EXPORT_SYMBOL_GPL(net_dec_egress_queue);
> +#endif
> +
> static struct static_key netstamp_needed __read_mostly;
> #ifdef HAVE_JUMP_LABEL
> /* We are not allowed to call static_key_slow_dec() from irq context
> @@ -3100,6 +3116,48 @@ int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
> }
> EXPORT_SYMBOL(dev_loopback_xmit);
>
> +#ifdef CONFIG_NET_EGRESS
> +static struct sk_buff *
> +sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
> +{
> + struct tcf_proto *cl = rcu_dereference_bh(dev->egress_cl_list);
> + struct tcf_result cl_res;
> +
> + if (!cl)
> + return skb;
> +
> + qdisc_skb_cb(skb)->pkt_len = skb->len;
You probably should move qdisc_pkt_len_init() out of __dev_xmit_skb()
and call it earlier. Then this pkt_len partial init is no longer needed.
> + /* skb->tc_verd was already set earlier by the caller. */
> + qdisc_bstats_cpu_update(cl->q, skb);
> +
> + switch (tc_classify(skb, cl, &cl_res, false)) {
> + case TC_ACT_OK:
> + case TC_ACT_RECLASSIFY:
> + skb->tc_index = TC_H_MIN(cl_res.classid);
> + break;
> + case TC_ACT_SHOT:
> + qdisc_qstats_cpu_drop(cl->q);
> + *ret = NET_XMIT_DROP;
> + goto drop;
> + case TC_ACT_STOLEN:
> + case TC_ACT_QUEUED:
> + *ret = NET_XMIT_SUCCESS;
> +drop:
> + kfree_skb(skb);
> + return NULL;
> + case TC_ACT_REDIRECT:
> + /* No need to push/pop skb's mac_header here on egress! */
> + skb_do_redirect(skb);
> + *ret = NET_XMIT_SUCCESS;
> + return NULL;
> + default:
> + break;
> + }
> +
> + return skb;
> +}
> +#endif /* CONFIG_NET_EGRESS */
> +
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists