* changing the qdisc class speed rate
@ 2009-05-28 5:12 Piotr Duszyński
2009-05-28 5:21 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Piotr Duszyński @ 2009-05-28 5:12 UTC (permalink / raw)
To: netdev
Hi everyone,
I am trying to change the rate parameter of HTB class by using this
code from within one of my functions :
struct htb_class *cl;
cl=htb_find(number,q);
cl->rate->rate.rate = NEW_RATE_VALUE;
TC shows the correct values, but the traffic rate doesn't change a
bit.
Does anyone have any idea what am I doing wrong ? Maybe there would
be a faster way by sending a netlink message ?
Piotrek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: changing the qdisc class speed rate
2009-05-28 5:12 changing the qdisc class speed rate Piotr Duszyński
@ 2009-05-28 5:21 ` Stephen Hemminger
2009-05-29 19:03 ` Piotrek D
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2009-05-28 5:21 UTC (permalink / raw)
To: Piotr Duszyński; +Cc: netdev
On Thu, 28 May 2009 07:12:33 +0200
Piotr Duszyński <regis44@gmail.com> wrote:
> Hi everyone,
>
> I am trying to change the rate parameter of HTB class by using this
> code from within one of my functions :
>
> struct htb_class *cl;
> cl=htb_find(number,q);
>
> cl->rate->rate.rate = NEW_RATE_VALUE;
>
> TC shows the correct values, but the traffic rate doesn't change a
> bit.
> Does anyone have any idea what am I doing wrong ? Maybe there would
> be a faster way by sending a netlink message ?
>
> Piotrek
HTB uses a rate table, so if you want the rate to change, you will need to change the
table as well.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: changing the qdisc class speed rate
2009-05-28 5:21 ` Stephen Hemminger
@ 2009-05-29 19:03 ` Piotrek D
2009-05-29 20:34 ` Jarek Poplawski
0 siblings, 1 reply; 5+ messages in thread
From: Piotrek D @ 2009-05-29 19:03 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
This is what I have done, the cl->rate->rate.rate refers to the __u32
rate in htb_class -> qdisc_rate_table -> tc_ratespec .
What else should I modify to make this work ?
Piotrek
W dniu 28 maja 2009 07:21 użytkownik Stephen Hemminger
<shemminger@vyatta.com> napisał:
> On Thu, 28 May 2009 07:12:33 +0200
> Piotr Duszyński <regis44@gmail.com> wrote:
>
>> Hi everyone,
>>
>> I am trying to change the rate parameter of HTB class by using this
>> code from within one of my functions :
>>
>> struct htb_class *cl;
>> cl=htb_find(number,q);
>>
>> cl->rate->rate.rate = NEW_RATE_VALUE;
>>
>> TC shows the correct values, but the traffic rate doesn't change a
>> bit.
>> Does anyone have any idea what am I doing wrong ? Maybe there would
>> be a faster way by sending a netlink message ?
>>
>> Piotrek
>
> HTB uses a rate table, so if you want the rate to change, you will need to change the
> table as well.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: changing the qdisc class speed rate
2009-05-29 19:03 ` Piotrek D
@ 2009-05-29 20:34 ` Jarek Poplawski
2009-05-30 8:19 ` Piotrek D
0 siblings, 1 reply; 5+ messages in thread
From: Jarek Poplawski @ 2009-05-29 20:34 UTC (permalink / raw)
To: Piotrek D; +Cc: Stephen Hemminger, netdev
Piotrek D wrote, On 05/29/2009 09:03 PM:
> This is what I have done, the cl->rate->rate.rate refers to the __u32
> rate in htb_class -> qdisc_rate_table -> tc_ratespec .
> What else should I modify to make this work ?
>
From include/net/sch_generic.h:
/* Length to Time (L2T) lookup in a qdisc_rate_table, to determine how
long it will take to send a packet given its size.
*/
static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
{
int slot = pktlen + rtab->rate.cell_align + rtab->rate.overhead;
if (slot < 0)
slot = 0;
slot >>= rtab->rate.cell_log;
if (slot > 255)
return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]);
return rtab->data[slot];
}
This function controls rates and these rtab values matter here.
Jarek P.
>
>
> W dniu 28 maja 2009 07:21 użytkownik Stephen Hemminger
> <shemminger@vyatta.com> napisał:
>> On Thu, 28 May 2009 07:12:33 +0200
>> Piotr Duszyński <regis44@gmail.com> wrote:
>>
>>> Hi everyone,
>>>
>>> I am trying to change the rate parameter of HTB class by using this
>>> code from within one of my functions :
>>>
>>> struct htb_class *cl;
>>> cl=htb_find(number,q);
>>>
>>> cl->rate->rate.rate = NEW_RATE_VALUE;
>>>
>>> TC shows the correct values, but the traffic rate doesn't change a
>>> bit.
>>> Does anyone have any idea what am I doing wrong ? Maybe there would
>>> be a faster way by sending a netlink message ?
>>>
>>> Piotrek
>> HTB uses a rate table, so if you want the rate to change, you will need to change the
>> table as well.
>>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: changing the qdisc class speed rate
2009-05-29 20:34 ` Jarek Poplawski
@ 2009-05-30 8:19 ` Piotrek D
0 siblings, 0 replies; 5+ messages in thread
From: Piotrek D @ 2009-05-30 8:19 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: Stephen Hemminger, netdev
Thanks, this was exactly what I was looking for :)
After multiplying all of the values in the rtab->data array I have
been able to change the traffic rate for that queue.
Piotrek D.
> /* Length to Time (L2T) lookup in a qdisc_rate_table, to determine how
> long it will take to send a packet given its size.
> */
> static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
> {
> int slot = pktlen + rtab->rate.cell_align + rtab->rate.overhead;
> if (slot < 0)
> slot = 0;
> slot >>= rtab->rate.cell_log;
> if (slot > 255)
> return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]);
> return rtab->data[slot];
> }
>
> This function controls rates and these rtab values matter here.
>
> Jarek P.
>
>> --
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-30 8:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 5:12 changing the qdisc class speed rate Piotr Duszyński
2009-05-28 5:21 ` Stephen Hemminger
2009-05-29 19:03 ` Piotrek D
2009-05-29 20:34 ` Jarek Poplawski
2009-05-30 8:19 ` Piotrek D
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).