[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131023102848.GB1535@neomailbox.net>
Date: Wed, 23 Oct 2013 12:28:48 +0200
From: Antonio Quartulli <antonio@...hcoding.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
On Wed, Oct 23, 2013 at 09:33:49AM +0100, David Laight wrote:
> ...
> > > I can't remember which value you passed as 'offset' (and my mailer makes
> > > it hard to find), but to ease the code changes the offset of the udp data
> > > would make sense.
> > > In that case you still need to pass the source port.
> >
> > I decided not to pass the source port because if the user is really interested
> > in it, it is still possible to get the udp_hdr from the skb and read its value.
>
> It just seemed that there was no need to require that the hook re-parse
> the ip header just to find the source port.
> (ok it could assume that the udp header is just before the data)
Also David (M.) pointed out the same. I will keep the port as argument for
rx_hook.
>
> > > If you do rx_hook(np, source_port, skb, offset) then if anyone manages to
> > > load an old module (or code that casts the assignement to rx_poll)
> > > at least it won't go 'bang'.
> > > Renaming the structure member will guarantee to generate compile errors.
> >
> > so you suggest to rename rx_hook to something else to warn people about the
> > change?
>
> Yes.
>
mh..what about rx_skb_hook ? this way we also make it easy to notice the
difference (both in arguments and behaviour).
> > If we go for the "no udp port" approach they will get an error any way because
> > of the mismatching arguments.
>
> No - you only get a warning when you assign a function pointer of the wrong type.
> And that is true even if you just change the type of the pointer.
> However code might already have a cast on the function pointer (eg because the
> hook has 'unsigned char *') - so you won't even get a warning.
> You then get an OOPS when the hook tries to read the buffer.
>
> It is a really bad interface...
> There isn't even a flags/options (etc) word that can be used
> to detect enhancements.
>
agreed. But I am not sure about what I could do to fix that.
My idea is to use the following API:
rx_skb_hook(struct netpoll *np, int source, struct sk_buff *skb, int len);
Any suggestion or objection?
Regards,
--
Antonio Quartulli
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists