From: jamal <hadi@cyberus.ca>
To: pfer <forgamedev@yahoo.com>
Cc: netdev@vger.kernel.org
Subject: Re: tc actions like pass,drop executed at a given percentage, not every nth
Date: Thu, 13 Apr 2006 09:17:47 -0400 [thread overview]
Message-ID: <1144934267.5262.22.camel@jzny2> (raw)
In-Reply-To: <20060411154259.77190.qmail@web54301.mail.yahoo.com>
On Tue, 2006-11-04 at 08:42 -0700, pfer wrote:
> Hi all!
>
> Can you give me some guideline about how and where
> netrand ... influences an action in the tc sources?
>
> (I've also tried LARTC mailing list, but did not get
> any response)
>
Did you look at the docs included in iproute2?
> When I last checked, iproute2 sources had a tc gact
> module with 2 statistical netrand methods:
>
> - random
> - determ
>
> and both are followed by an integer, saying what to do
> with every n-th packet (if I get it right from docs
> and tc filter show)
>
> Problem is, I would need % of packets to do actions
> on, not on every n-th. This limits me to
> 50,33,25,20,... etc % ratios, because I cannot write
> for. ex.
>
> action drop random determ 1.23 ok
>
right.
> So, basically I believe I would need something like
> this in pseudo:
>
> for every packet
> if(rand()<(percent/100))
> do_action
>
> ,where rand() gives a float of 0..1
>
We dont like floats in the kernel - but i think i understand the
gist of what you want to achieve.
> Or if doing a rand() for every packet is costy,
> then I could decrease granularity by 2 or 5, etc.
> Still,I would get the ratio.
>
> I delved into the sources, but was unable to find
> where
> this conditional (for every n-th packet) tc action
> execution occurs.
>
The control code is in iproute2:
iproute2/tc/m_gact.c
The mechanisms are implemented in the kernel:
net/sched/act_gact.c
Just follow the trail of #ifdef CONFIG_GACT_PROB
both in user space and in the kernel.
You would need to add another method for % in addition to
gact_net_rand() and gact_determ()
You may actually be able to achieve your goal by picking the right
number for determ (we restrict the max to be 10000)
If you cant achieve your goal with determ - I would be more than happy
to ACK a patch that does percentages.
> (If anyone is interested, I need this for a protocol
> that uses a strange congestion signaling method to let
> intra-domain nodes notify edges, based on packet ratio
> having different DSCP. The name is RMD-QoS-NSLP)
>
Cool.
Shoot me private email if you need help since this is really out of
scope of netdev
cheers,
jamal
parent reply other threads:[~2006-04-13 13:17 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20060411154259.77190.qmail@web54301.mail.yahoo.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1144934267.5262.22.camel@jzny2 \
--to=hadi@cyberus.ca \
--cc=forgamedev@yahoo.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox