Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0abf77e5 authored by Jussi Kivilinna's avatar Jussi Kivilinna Committed by David S. Miller
Browse files

net_sched: Add accessor function for packet length for qdiscs

parent 5f86173b
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -306,6 +306,11 @@ static inline bool qdisc_tx_is_noop(const struct net_device *dev)
	return true;
}

static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
{
	return skb->len;
}

static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
	return sch->enqueue(skb, sch);
@@ -320,8 +325,8 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
				       struct sk_buff_head *list)
{
	__skb_queue_tail(list, skb);
	sch->qstats.backlog += skb->len;
	sch->bstats.bytes += skb->len;
	sch->qstats.backlog += qdisc_pkt_len(skb);
	sch->bstats.bytes += qdisc_pkt_len(skb);
	sch->bstats.packets++;

	return NET_XMIT_SUCCESS;
@@ -338,7 +343,7 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
	struct sk_buff *skb = __skb_dequeue(list);

	if (likely(skb != NULL))
		sch->qstats.backlog -= skb->len;
		sch->qstats.backlog -= qdisc_pkt_len(skb);

	return skb;
}
@@ -354,7 +359,7 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
	struct sk_buff *skb = __skb_dequeue_tail(list);

	if (likely(skb != NULL))
		sch->qstats.backlog -= skb->len;
		sch->qstats.backlog -= qdisc_pkt_len(skb);

	return skb;
}
@@ -368,7 +373,7 @@ static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,
				  struct sk_buff_head *list)
{
	__skb_queue_head(list, skb);
	sch->qstats.backlog += skb->len;
	sch->qstats.backlog += qdisc_pkt_len(skb);
	sch->qstats.requeues++;

	return NET_XMIT_SUCCESS;
@@ -401,7 +406,7 @@ static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
	struct sk_buff *skb = __qdisc_dequeue_tail(sch, list);

	if (likely(skb != NULL)) {
		unsigned int len = skb->len;
		unsigned int len = qdisc_pkt_len(skb);
		kfree_skb(skb);
		return len;
	}
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result
#else
	action = gact->tcf_action;
#endif
	gact->tcf_bstats.bytes += skb->len;
	gact->tcf_bstats.bytes += qdisc_pkt_len(skb);
	gact->tcf_bstats.packets++;
	if (action == TC_ACT_SHOT)
		gact->tcf_qstats.drops++;
+1 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a,
	spin_lock(&ipt->tcf_lock);

	ipt->tcf_tm.lastuse = jiffies;
	ipt->tcf_bstats.bytes += skb->len;
	ipt->tcf_bstats.bytes += qdisc_pkt_len(skb);
	ipt->tcf_bstats.packets++;

	/* yes, we have to worry about both in and out dev
+2 −2
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
		if (skb2 != NULL)
			kfree_skb(skb2);
		m->tcf_qstats.overlimits++;
		m->tcf_bstats.bytes += skb->len;
		m->tcf_bstats.bytes += qdisc_pkt_len(skb);
		m->tcf_bstats.packets++;
		spin_unlock(&m->tcf_lock);
		/* should we be asking for packet to be dropped?
@@ -184,7 +184,7 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
		goto bad_mirred;
	}

	m->tcf_bstats.bytes += skb2->len;
	m->tcf_bstats.bytes += qdisc_pkt_len(skb2);
	m->tcf_bstats.packets++;
	if (!(at & AT_EGRESS))
		if (m->tcfm_ok_push)
+1 −1
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
	egress = p->flags & TCA_NAT_FLAG_EGRESS;
	action = p->tcf_action;

	p->tcf_bstats.bytes += skb->len;
	p->tcf_bstats.bytes += qdisc_pkt_len(skb);
	p->tcf_bstats.packets++;

	spin_unlock(&p->tcf_lock);
Loading