All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: Eyal Birger <eyal.birger@gmail.com>,
	davem@davemloft.net, edumazet@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3 3/4] net: use skb->priority for overloading skb->dropcount and skb->reserved_tailroom instead of skb->mark
Date: Mon, 23 Feb 2015 11:10:36 -0800	[thread overview]
Message-ID: <1424718636.5565.58.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20150223205633.7fbd08d4@halley>

On Mon, 2015-02-23 at 20:56 +0200, Shmulik Ladkani wrote:
> Hi,
> 
> On Mon, 23 Feb 2015 19:52:03 +0200 Eyal Birger <eyal.birger@gmail.com> wrote:
> > Commit 977750076d98 ("af_packet: add interframe drop cmsg (v6)")
> > unionized skb->mark and skb->dropcount in order to allow recording
> > of the socket drop count while maintaining struct sk_buff size.
> > 
> > In order to allow for the skb->mark to be fetched by user-space code
> > it needs to be detached from this union; skb->priority is used
> > instead.
> > 
> > The purpose of overloading skb->priority is solely for retaining
> > struct sk_buff size; skb->priority is not used after the skb is
> > queued to the socket.
> > 
> > Use of aliased fields, skb->dropcount and skb->reserved_tailroom,
> > is either done after the skb is cloned (e.g. in packet_rcv()) or
> > before skb->priority is used (e.g. in IGMPv3/MLD/TCP).
> 
> Preserving a small skb size is an important cause.
> 
> In this case however, it seems that aliasing 'priority' sacrifices
> maintainability: 'priority' does not seem "naturally orthogonal" to
> 'drop_count' or 'reserved_tailroom'.
> 
> One might arm 'priority' in various code flows (future and existing),
> which may accidentally clash with the aliases. It is unexpected, hard to
> remember (especially since 'priority' wasn't formerly aliased), and
> sometimes it's simply not trivial to assure there's no clash.
> 
> May I suggest to unalias 'mark' out of the union?

My suggestion would be to move dropcount in skb->cb[] instead.

mark & reserved_tailroom can stay in the union.

  reply	other threads:[~2015-02-23 19:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 17:52 [PATCH net-next v3 1/4] net: Rename sock_recv_ts_and_drops() to sock_cmsg_recv() Eyal Birger
2015-02-23 17:52 ` [PATCH net-next v3 2/4] ipv4,v6: avoid setting skb->priority when skb->reserved_tailroom is in use in igmpv3/mld Eyal Birger
2015-02-23 17:52 ` [PATCH net-next v3 3/4] net: use skb->priority for overloading skb->dropcount and skb->reserved_tailroom instead of skb->mark Eyal Birger
2015-02-23 18:56   ` Shmulik Ladkani
2015-02-23 19:10     ` Eric Dumazet [this message]
2015-02-23 19:25       ` Eyal Birger
2015-02-23 19:51         ` Eric Dumazet
2015-02-23 21:48     ` David Miller
2015-02-24  6:58       ` Eyal Birger
2015-02-24 10:10         ` Eyal Birger
2015-02-24 13:18           ` Eric Dumazet
2015-02-24 14:07             ` Eyal Birger
2015-02-24 14:25               ` Eric Dumazet
2015-02-24 14:41                 ` Eyal Birger
2015-02-24 14:41               ` Eric Dumazet
2015-02-24 15:24                 ` Eyal Birger
2015-02-25 20:49                   ` Willem de Bruijn
2015-02-25 21:15                     ` Eyal Birger
2015-02-25 14:10               ` Eyal Birger
2015-02-25 16:50                 ` Eric Dumazet
2015-02-23 17:52 ` [PATCH net-next v3 4/4] net: Introducing socket mark receive socket option Eyal Birger

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=1424718636.5565.58.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eyal.birger@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shmulik.ladkani@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.