提交 5acbf7f1 编写于 作者: C Changli Gao 提交者: David S. Miller

act_mirred: combine duplicate code

act_mirred: combine duplicate code

tcf_bstats is updated in any way, so we can do it earlier to reduce the size of
the code.
Signed-off-by: NChangli Gao <xiaosuo@gmail.com>
Signed-off-by: NJamal Hadi Salim <hadi@cyberus.ca>
----
 net/sched/act_mirred.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 787a3445
...@@ -160,6 +160,8 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, ...@@ -160,6 +160,8 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
spin_lock(&m->tcf_lock); spin_lock(&m->tcf_lock);
m->tcf_tm.lastuse = jiffies; m->tcf_tm.lastuse = jiffies;
m->tcf_bstats.bytes += qdisc_pkt_len(skb);
m->tcf_bstats.packets++;
dev = m->tcfm_dev; dev = m->tcfm_dev;
if (!(dev->flags & IFF_UP)) { if (!(dev->flags & IFF_UP)) {
...@@ -174,8 +176,6 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, ...@@ -174,8 +176,6 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
if (skb2 == NULL) if (skb2 == NULL)
goto out; goto out;
m->tcf_bstats.bytes += qdisc_pkt_len(skb2);
m->tcf_bstats.packets++;
if (!(at & AT_EGRESS)) { if (!(at & AT_EGRESS)) {
if (m->tcfm_ok_push) if (m->tcfm_ok_push)
skb_push(skb2, skb2->dev->hard_header_len); skb_push(skb2, skb2->dev->hard_header_len);
...@@ -193,8 +193,6 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, ...@@ -193,8 +193,6 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
out: out:
if (err) { if (err) {
m->tcf_qstats.overlimits++; m->tcf_qstats.overlimits++;
m->tcf_bstats.bytes += qdisc_pkt_len(skb);
m->tcf_bstats.packets++;
/* should we be asking for packet to be dropped? /* should we be asking for packet to be dropped?
* may make sense for redirect case only * may make sense for redirect case only
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册