netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pktgen receive hook in dev.c?
@ 2005-04-29 23:30 Ben Greear
  2005-04-30  0:14 ` jamal
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Greear @ 2005-04-29 23:30 UTC (permalink / raw)
  To: 'netdev@oss.sgi.com'

I am curious if there is any interest in adding a hook in the netif_receive_skb
method to allow receiving (and consuming) pktgen packets.  This gives the ability
to get some good packet receive & latency stats using pktgen.

I asked this a year or so ago and was told no, but since then the netpoll and
TC_NCLS hooks have been added.... so maybe hooks are OK again?

The hook would look something like:

#if defined(CONFIG_NET_PKTGEN) || defined(CONFIG_NET_PKTGEN_MODULE)
         if ((skb->dev->priv_flags & IFF_PKTGEN_RCV) &&
             (handle_pktgen_rcv(skb) >= 0)) {
                 /* Pktgen may consume the packet, no need to send
                  * to further protocols.
                  */
                 goto out;
         }
#endif

         type = skb->protocol;
         list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
....


Take it easy,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pktgen receive hook in dev.c?
  2005-04-29 23:30 Pktgen receive hook in dev.c? Ben Greear
@ 2005-04-30  0:14 ` jamal
  2005-04-30  0:28   ` Ben Greear
  0 siblings, 1 reply; 4+ messages in thread
From: jamal @ 2005-04-30  0:14 UTC (permalink / raw)
  To: Ben Greear; +Cc: 'netdev@oss.sgi.com'

On Fri, 2005-29-04 at 16:30 -0700, Ben Greear wrote:
> I am curious if there is any interest in adding a hook in the netif_receive_skb
> method to allow receiving (and consuming) pktgen packets.  This gives the ability
> to get some good packet receive & latency stats using pktgen.
> 
> I asked this a year or so ago and was told no, but since then the netpoll and
> TC_NCLS hooks have been added.... so maybe hooks are OK again?
> 

Write an action. It should be trivial to consume pktgen. Infact if all
you wanted was to count, use the gact action.

cheers,
jamal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pktgen receive hook in dev.c?
  2005-04-30  0:14 ` jamal
@ 2005-04-30  0:28   ` Ben Greear
  2005-04-30  0:41     ` jamal
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Greear @ 2005-04-30  0:28 UTC (permalink / raw)
  To: hadi; +Cc: 'netdev@oss.sgi.com'

jamal wrote:
> On Fri, 2005-29-04 at 16:30 -0700, Ben Greear wrote:
> 
>>I am curious if there is any interest in adding a hook in the netif_receive_skb
>>method to allow receiving (and consuming) pktgen packets.  This gives the ability
>>to get some good packet receive & latency stats using pktgen.
>>
>>I asked this a year or so ago and was told no, but since then the netpoll and
>>TC_NCLS hooks have been added.... so maybe hooks are OK again?
>>
> 
> 
> Write an action. It should be trivial to consume pktgen. Infact if all
> you wanted was to count, use the gact action.

I want a lot more than count, including timestamp, sequence number, etc.

In order to know it's a pktgen packet, I check for a magic value at the beginning
of the UDP header.  Since this could potentially collide with some 'real' packet,
I also check a flag to see if the net_device has a particular flag set indicating
it is actively accepting pktgen packets...

I assume this means I'd need a custom match function in the kernel.  Is there
an example of how to do something like this using your framework?

Thanks,
Ben

> 
> cheers,
> jamal
> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pktgen receive hook in dev.c?
  2005-04-30  0:28   ` Ben Greear
@ 2005-04-30  0:41     ` jamal
  0 siblings, 0 replies; 4+ messages in thread
From: jamal @ 2005-04-30  0:41 UTC (permalink / raw)
  To: Ben Greear; +Cc: 'netdev@oss.sgi.com'

On Fri, 2005-29-04 at 17:28 -0700, Ben Greear wrote:
> jamal wrote:

> > Write an action. It should be trivial to consume pktgen. Infact if all
> > you wanted was to count, use the gact action.
> 
> I want a lot more than count, including timestamp, sequence number, etc.
> 

Sure you can do all that good stuff in your own action.

> In order to know it's a pktgen packet, I check for a magic value at the beginning
> of the UDP header.

Use the u32 classifier like so:

on dev eth0, if you see some magic signature on udp described as ...
then action my pktgen action.

>   Since this could potentially collide with some 'real' packet,

The classifier allows you to discriminate

> I also check a flag to see if the net_device has a particular flag set indicating
> it is actively accepting pktgen packets...
> 

Thats not needed. You should be able to attach a u32 classifier to any
device of your choice.

> I assume this means I'd need a custom match function in the kernel.

Refer to above - i dont think you do need to put any flag in a device.

>   Is there
> an example of how to do something like this using your framework?

I explained a few things to you last time you showed up and tried to put
hooks. Start there then ask questions. Its pretty simple.

cheers,
jamal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-30  0:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-29 23:30 Pktgen receive hook in dev.c? Ben Greear
2005-04-30  0:14 ` jamal
2005-04-30  0:28   ` Ben Greear
2005-04-30  0:41     ` jamal

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).