Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107731
b: refs/heads/master
c: 378a2f0
h: refs/heads/master
i:
  107729: 7d2eb18
  107727: f8c5395
v: v3
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Aug 5, 2008
1 parent 927c414 commit b67824d
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e583ce5242f32e925dcb198f7123256d0798370
refs/heads/master: 378a2f090f7a478704a372a4869b8a9ac206234e
1 change: 1 addition & 0 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct wireless_dev;
#define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue;
(TC use only - dev_queue_xmit
returns this as NET_XMIT_SUCCESS) */
#define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */

/* Backlog congestion levels */
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
Expand Down
14 changes: 13 additions & 1 deletion trunk/include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
return qdisc_skb_cb(skb)->pkt_len;
}

#ifdef CONFIG_NET_CLS_ACT
/* additional qdisc xmit flags */
enum net_xmit_qdisc_t {
__NET_XMIT_STOLEN = 0x00010000,
};

#define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1)

#else
#define net_xmit_drop_count(e) (1)
#endif

static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
#ifdef CONFIG_NET_SCHED
Expand All @@ -355,7 +367,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
{
qdisc_skb_cb(skb)->pkt_len = skb->len;
return qdisc_enqueue(skb, sch);
return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
}

static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
Expand Down
12 changes: 7 additions & 5 deletions trunk/net/sched/sch_atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
kfree_skb(skb);
return NET_XMIT_SUCCESS;
return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
kfree_skb(skb);
goto drop;
Expand All @@ -432,9 +432,11 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, flow->q);
if (ret != 0) {
drop: __maybe_unused
sch->qstats.drops++;
if (flow)
flow->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
if (flow)
flow->qstats.drops++;
}
return ret;
}
sch->bstats.bytes += qdisc_pkt_len(skb);
Expand Down Expand Up @@ -530,7 +532,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch)
if (!ret) {
sch->q.qlen++;
sch->qstats.requeues++;
} else {
} else if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
p->link.qstats.drops++;
}
Expand Down
23 changes: 15 additions & 8 deletions trunk/net/sched/sch_cbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
switch (result) {
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
case TC_ACT_RECLASSIFY:
Expand Down Expand Up @@ -397,9 +397,11 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
return ret;
}

sch->qstats.drops++;
cbq_mark_toplevel(q, cl);
cl->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cbq_mark_toplevel(q, cl);
cl->qstats.drops++;
}
return ret;
}

Expand Down Expand Up @@ -430,8 +432,10 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
cbq_activate_class(cl);
return 0;
}
sch->qstats.drops++;
cl->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cl->qstats.drops++;
}
return ret;
}

Expand Down Expand Up @@ -664,21 +668,24 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
q->rx_class = NULL;

if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) {
int ret;

cbq_mark_toplevel(q, cl);

q->rx_class = cl;
cl->q->__parent = sch;

if (qdisc_enqueue(skb, cl->q) == 0) {
ret = qdisc_enqueue(skb, cl->q);
if (ret == NET_XMIT_SUCCESS) {
sch->q.qlen++;
sch->bstats.packets++;
sch->bstats.bytes += qdisc_pkt_len(skb);
if (!cl->next_alive)
cbq_activate_class(cl);
return 0;
}
sch->qstats.drops++;
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return 0;
}

Expand Down
8 changes: 5 additions & 3 deletions trunk/net/sched/sch_dsmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
kfree_skb(skb);
return NET_XMIT_SUCCESS;
return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;

case TC_ACT_SHOT:
goto drop;
Expand All @@ -254,7 +254,8 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)

err = qdisc_enqueue(skb, p->q);
if (err != NET_XMIT_SUCCESS) {
sch->qstats.drops++;
if (net_xmit_drop_count(err))
sch->qstats.drops++;
return err;
}

Expand Down Expand Up @@ -321,7 +322,8 @@ static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch)

err = p->q->ops->requeue(skb, p->q);
if (err != NET_XMIT_SUCCESS) {
sch->qstats.drops++;
if (net_xmit_drop_count(err))
sch->qstats.drops++;
return err;
}

Expand Down
8 changes: 5 additions & 3 deletions trunk/net/sched/sch_hfsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
switch (result) {
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
}
Expand Down Expand Up @@ -1586,8 +1586,10 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)

err = qdisc_enqueue(skb, cl->qdisc);
if (unlikely(err != NET_XMIT_SUCCESS)) {
cl->qstats.drops++;
sch->qstats.drops++;
if (net_xmit_drop_count(err)) {
cl->qstats.drops++;
sch->qstats.drops++;
}
return err;
}

Expand Down
18 changes: 11 additions & 7 deletions trunk/net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
switch (result) {
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
}
Expand Down Expand Up @@ -572,9 +572,11 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
kfree_skb(skb);
return ret;
#endif
} else if (qdisc_enqueue(skb, cl->un.leaf.q) != NET_XMIT_SUCCESS) {
sch->qstats.drops++;
cl->qstats.drops++;
} else if ((ret = qdisc_enqueue(skb, cl->un.leaf.q)) != NET_XMIT_SUCCESS) {
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cl->qstats.drops++;
}
return NET_XMIT_DROP;
} else {
cl->bstats.packets +=
Expand Down Expand Up @@ -615,10 +617,12 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
kfree_skb(skb);
return ret;
#endif
} else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) !=
} else if ((ret = cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q)) !=
NET_XMIT_SUCCESS) {
sch->qstats.drops++;
cl->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cl->qstats.drops++;
}
return NET_XMIT_DROP;
} else
htb_activate(q, cl);
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
sch->q.qlen++;
sch->bstats.bytes += qdisc_pkt_len(skb);
sch->bstats.packets++;
} else
} else if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
}

pr_debug("netem: enqueue ret %d\n", ret);
return ret;
Expand Down
8 changes: 5 additions & 3 deletions trunk/net/sched/sch_prio.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
switch (err) {
case TC_ACT_STOLEN:
case TC_ACT_QUEUED:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
}
Expand Down Expand Up @@ -88,7 +88,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
sch->q.qlen++;
return NET_XMIT_SUCCESS;
}
sch->qstats.drops++;
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return ret;
}

Expand All @@ -114,7 +115,8 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
sch->qstats.requeues++;
return 0;
}
sch->qstats.drops++;
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return NET_XMIT_DROP;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/sched/sch_red.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
sch->bstats.bytes += qdisc_pkt_len(skb);
sch->bstats.packets++;
sch->q.qlen++;
} else {
} else if (net_xmit_drop_count(ret)) {
q->stats.pdrop++;
sch->qstats.drops++;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/sched/sch_sfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
switch (result) {
case TC_ACT_STOLEN:
case TC_ACT_QUEUED:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sched/sch_tbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)

ret = qdisc_enqueue(skb, q->qdisc);
if (ret != 0) {
sch->qstats.drops++;
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return ret;
}

Expand Down

0 comments on commit b67824d

Please sign in to comment.