netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Robert Olsson <Robert.Olsson@data.slu.se>
Cc: NetDev <netdev@vger.kernel.org>
Subject: Re: pktgen patch available for perusal.
Date: Fri, 03 Nov 2006 12:41:59 -0800	[thread overview]
Message-ID: <454BA997.1060401@candelatech.com> (raw)
In-Reply-To: <17739.42375.80475.907057@robur.slu.se>

Robert Olsson wrote:
> Ben Greear writes:
> 
>  > It requires a hook in dev.c, or at least that is the only way I can 
>  > think to implement it.
> 
> Well the hook be placed along the packet path even in drivers. In tulip I didn't 
> even take packet of the ring in some experiments. 
> 
> And there plenty of existing hooks already i.e PRE_ROUTE?

For my particular application the hook needs to be right
after the bridge hook.  My dev.c hook looks like this:

#if defined(CONFIG_NET_PKTGEN) || defined(CONFIG_NET_PKTGEN_MODULE)
#include "pktgen.h"

#warning "Compiling dev.c for pktgen.";

int (*handle_pktgen_hook)(struct sk_buff *skb) = NULL;
EXPORT_SYMBOL(handle_pktgen_hook);

static __inline__ int handle_pktgen_rcv(struct sk_buff* skb) {
	if (handle_pktgen_hook) {
		return handle_pktgen_hook(skb);
	}
	return -1;
}
#endif

.....

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


If the rx-hook logic is already in pktgen module, and it's symbol
exported, perhaps a second hook module could be written that
would just be the bridge between a driver or a PRE-ROUTE hook
and pktgen?  The hook module would probably not be much larger
than the code above...


Thanks,
Ben

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


  reply	other threads:[~2006-11-03 20:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 23:47 pktgen patch available for perusal Ben Greear
2006-11-01 17:14 ` Robert Olsson
2006-11-01 19:11   ` Ben Greear
2006-11-03 11:13     ` Robert Olsson
2006-11-03 16:34       ` Ben Greear
2006-11-03 20:24         ` Robert Olsson
2006-11-03 20:41           ` Ben Greear [this message]
2006-11-04 12:32     ` jamal
2006-11-04 17:29       ` Ben Greear
2006-11-04 18:10         ` jamal
2006-11-04 19:12           ` Ben Greear
2006-11-06 14:06           ` Robert Olsson
2006-11-06 14:14     ` Robert Olsson

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=454BA997.1060401@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=Robert.Olsson@data.slu.se \
    --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;
as well as URLs for NNTP newsgroup(s).