netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
Date: Tue, 22 Oct 2013 19:13:14 +0200	[thread overview]
Message-ID: <20131022171314.GL1544@neomailbox.net> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B739F@saturn3.aculab.com>

[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]

On Tue, Oct 22, 2013 at 01:46:22PM +0100, David Laight wrote:
> > Subject: Re: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
> > 
> > On Tue, Oct 22, 2013 at 10:09:00AM +0100, David Laight wrote:
> > > > Subject: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
> > > >
> > > > Right now skb->data is passed to rx_hook() even if the skb
> > > > has not been linearised and without giving rx_hook() a way
> > > > to linearise it.
> > > >
> > > > Change the rx_hook() interface and make it accept the skb
> > > > as argument. In this way users implementing rx_hook() can
> > > > perform all the needed operations to properly (and safely)
> > > > access the skb data.
> > > ...
> > > > -	void (*rx_hook)(struct netpoll *, int, char *, int);
> > > > +	void (*rx_hook)(struct netpoll *np, struct sk_buff *skb, int offset);
> > >
> > > You can't do that change without changing the way that hooks are registered
> > > so that any existing modules will fail to register their hooks.
> > 
> > There is no hook registration in the kernel tree. All the users are outside.
> 
> Looking at __netpoll_rx() I notice that there isn't an skb_pull for the
> udp header.
> 
> Actually, I think the alignment rules effectively imply that iph->ihl
> (the second byte) will always be in the first skb fragment so the
> code could sensible do a single skb_pull() that includes the udp header.
> 
> 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.

> 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?

If we go for the "no udp port" approach they will get an error any way because
of the mismatching arguments.

Regards,

-- 
Antonio Quartulli

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-10-22 17:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 21:31 [PATCH net] netpoll: linearize skb before accessing its data Antonio Quartulli
2013-10-21 22:23 ` David Miller
2013-10-22  6:06   ` Antonio Quartulli
2013-10-22  6:25     ` David Miller
2013-10-22  6:37       ` Antonio Quartulli
2013-10-22  6:50         ` David Miller
2013-10-22  8:48           ` [PATCH net] netpoll: fix rx_hook() interface by passing the skb Antonio Quartulli
2013-10-22  9:09             ` David Laight
2013-10-22 10:11               ` Antonio Quartulli
2013-10-22 12:46                 ` David Laight
2013-10-22 17:13                   ` Antonio Quartulli [this message]
2013-10-22 19:40                     ` David Miller
2013-10-23  8:33                     ` David Laight
2013-10-23 10:28                       ` Antonio Quartulli
2013-10-23 11:18                         ` David Laight
2013-10-23 12:44                           ` Antonio Quartulli
2013-10-23 20:16                             ` David Miller
2013-10-23 21:36                               ` [PATCHv2 " Antonio Quartulli
2013-10-24  8:43                                 ` David Laight
2013-10-24 12:01                                   ` Antonio Quartulli
2013-10-24 17:53                                   ` David Miller
2013-10-25 23:27                                 ` David Miller
2013-10-21 22:25 ` [PATCH net] netpoll: linearize skb before accessing its data Eric Dumazet
2013-10-21 22:33   ` David Miller

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=20131022171314.GL1544@neomailbox.net \
    --to=antonio@meshcoding.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --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).