* [PATCH][NET_SCHED] Make HTB scheduler work with TSO.
@ 2007-06-12 23:53 Ranjit Manomohan
2007-07-09 22:15 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Ranjit Manomohan @ 2007-06-12 23:53 UTC (permalink / raw)
To: netdev; +Cc: ranjitm
Currently the HTB scheduler does not correctly account for TSO packets
which causes large inaccuracies in the bandwidth control when using TSO.
This patch allows the HTB scheduler to work with TSO enabled devices.
Signed-off-by: Ranjit Manomohan <ranjitm@google.com>
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 035788c..e872724 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -153,15 +153,12 @@ #endif
/* of un.leaf originals should be done. */
};
-/* TODO: maybe compute rate when size is too large .. or drop ? */
static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate,
int size)
{
int slot = size >> rate->rate.cell_log;
- if (slot > 255) {
- cl->xstats.giants++;
- slot = 255;
- }
+ if (slot > 255)
+ return (rate->data[255]*(slot >> 8) + rate->data[slot & 0xFF]);
return rate->data[slot];
}
@@ -634,13 +631,14 @@ #endif
cl->qstats.drops++;
return NET_XMIT_DROP;
} else {
- cl->bstats.packets++;
+ cl->bstats.packets +=
+ skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
cl->bstats.bytes += skb->len;
htb_activate(q, cl);
}
sch->q.qlen++;
- sch->bstats.packets++;
+ sch->bstats.packets += skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
sch->bstats.bytes += skb->len;
return NET_XMIT_SUCCESS;
}
@@ -717,8 +715,9 @@ #endif
* In such case we remove class from event queue first.
*/
static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
- int level, int bytes)
+ int level, struct sk_buff *skb)
{
+ int bytes = skb->len;
long toks, diff;
enum htb_cmode old_mode;
@@ -753,13 +752,15 @@ #define HTB_ACCNT(T,B,R) toks = diff + c
#ifdef HTB_RATECM
/* update rate counters */
cl->sum_bytes += bytes;
- cl->sum_packets++;
+ cl->sum_packets += skb_is_gso(skb)?
+ skb_shinfo(skb)->gso_segs:1;
#endif
/* update byte stats except for leaves which are already updated */
if (cl->level) {
cl->bstats.bytes += bytes;
- cl->bstats.packets++;
+ cl->bstats.packets += skb_is_gso(skb)?
+ skb_shinfo(skb)->gso_segs:1;
}
cl = cl->parent;
}
@@ -943,7 +944,7 @@ next:
gives us slightly better performance */
if (!cl->un.leaf.q->q.qlen)
htb_deactivate(q, cl);
- htb_charge_class(q, cl, level, skb->len);
+ htb_charge_class(q, cl, level, skb);
}
return skb;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][NET_SCHED] Make HTB scheduler work with TSO.
2007-06-12 23:53 [PATCH][NET_SCHED] Make HTB scheduler work with TSO Ranjit Manomohan
@ 2007-07-09 22:15 ` David Miller
2007-07-10 22:02 ` Ranjit Manomohan
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2007-07-09 22:15 UTC (permalink / raw)
To: ranjitm; +Cc: netdev
From: Ranjit Manomohan <ranjitm@google.com>
Date: Tue, 12 Jun 2007 16:53:21 -0700 (PDT)
> Currently the HTB scheduler does not correctly account for TSO packets
> which causes large inaccuracies in the bandwidth control when using TSO.
> This patch allows the HTB scheduler to work with TSO enabled devices.
>
> Signed-off-by: Ranjit Manomohan <ranjitm@google.com>
Your patch has much white-space damage and therefore won't apply,
please fix this up and resubmit, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][NET_SCHED] Make HTB scheduler work with TSO.
2007-07-09 22:15 ` David Miller
@ 2007-07-10 22:02 ` Ranjit Manomohan
2007-07-11 5:43 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Ranjit Manomohan @ 2007-07-10 22:02 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
On 7/9/07, David Miller <davem@davemloft.net> wrote:
> From: Ranjit Manomohan <ranjitm@google.com>
> Date: Tue, 12 Jun 2007 16:53:21 -0700 (PDT)
>
> > Currently the HTB scheduler does not correctly account for TSO packets
> > which causes large inaccuracies in the bandwidth control when using TSO.
> > This patch allows the HTB scheduler to work with TSO enabled devices.
> >
> > Signed-off-by: Ranjit Manomohan <ranjitm@google.com>
>
> Your patch has much white-space damage and therefore won't apply,
> please fix this up and resubmit, thanks.
>
patch based on net-2.6.23 attached.
-Thanks,
Ranjit
[-- Attachment #2: htbtso.diff --]
[-- Type: text/x-patch, Size: 2208 bytes --]
Currently the HTB scheduler does not correctly account for TSO packets
which causes large inaccuracies in the bandwidth control when using TSO.
This patch allows the HTB scheduler to work with TSO enabled devices.
Signed-off-by: Ranjit Manomohan <ranjitm@google.com>
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index c031486..b417a95 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -129,15 +129,12 @@ struct htb_class {
/* of un.leaf originals should be done. */
};
-/* TODO: maybe compute rate when size is too large .. or drop ? */
static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate,
int size)
{
int slot = size >> rate->rate.cell_log;
- if (slot > 255) {
- cl->xstats.giants++;
- slot = 255;
- }
+ if (slot > 255)
+ return (rate->data[255]*(slot >> 8) + rate->data[slot & 0xFF]);
return rate->data[slot];
}
@@ -606,13 +603,14 @@ #endif
cl->qstats.drops++;
return NET_XMIT_DROP;
} else {
- cl->bstats.packets++;
+ cl->bstats.packets +=
+ skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
cl->bstats.bytes += skb->len;
htb_activate(q, cl);
}
sch->q.qlen++;
- sch->bstats.packets++;
+ sch->bstats.packets += skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
sch->bstats.bytes += skb->len;
return NET_XMIT_SUCCESS;
}
@@ -661,8 +659,9 @@ static int htb_requeue(struct sk_buff *s
* In such case we remove class from event queue first.
*/
static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
- int level, int bytes)
+ int level, struct sk_buff *skb)
{
+ int bytes = skb->len;
long toks, diff;
enum htb_cmode old_mode;
@@ -698,7 +697,8 @@ #define HTB_ACCNT(T,B,R) toks = diff + c
/* update byte stats except for leaves which are already updated */
if (cl->level) {
cl->bstats.bytes += bytes;
- cl->bstats.packets++;
+ cl->bstats.packets += skb_is_gso(skb)?
+ skb_shinfo(skb)->gso_segs:1;
}
cl = cl->parent;
}
@@ -882,7 +882,7 @@ next:
gives us slightly better performance */
if (!cl->un.leaf.q->q.qlen)
htb_deactivate(q, cl);
- htb_charge_class(q, cl, level, skb->len);
+ htb_charge_class(q, cl, level, skb);
}
return skb;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][NET_SCHED] Make HTB scheduler work with TSO.
2007-07-10 22:02 ` Ranjit Manomohan
@ 2007-07-11 5:43 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-07-11 5:43 UTC (permalink / raw)
To: ranjitm; +Cc: netdev
From: "Ranjit Manomohan" <ranjitm@google.com>
Date: Tue, 10 Jul 2007 15:02:16 -0700
> On 7/9/07, David Miller <davem@davemloft.net> wrote:
> > From: Ranjit Manomohan <ranjitm@google.com>
> > Date: Tue, 12 Jun 2007 16:53:21 -0700 (PDT)
> >
> > > Currently the HTB scheduler does not correctly account for TSO packets
> > > which causes large inaccuracies in the bandwidth control when using TSO.
> > > This patch allows the HTB scheduler to work with TSO enabled devices.
> > >
> > > Signed-off-by: Ranjit Manomohan <ranjitm@google.com>
> >
> > Your patch has much white-space damage and therefore won't apply,
> > please fix this up and resubmit, thanks.
> >
>
> patch based on net-2.6.23 attached.
Patch applied, thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-11 5:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 23:53 [PATCH][NET_SCHED] Make HTB scheduler work with TSO Ranjit Manomohan
2007-07-09 22:15 ` David Miller
2007-07-10 22:02 ` Ranjit Manomohan
2007-07-11 5:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).