From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
To: Eyal Birger <eyal.birger@gmail.com>
Cc: David Miller <davem@davemloft.net>,
Willem de Bruijn <willemb@google.com>,
Eric Dumazet <edumazet@google.com>,
Marcel Holtmann <marcel@holtmann.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 7/7] net: move skb->dropcount to skb->cb[]
Date: Thu, 26 Feb 2015 17:32:18 +0200 [thread overview]
Message-ID: <20150226173218.7c6bb2d6@halley> (raw)
In-Reply-To: <CAHsH6Gs5JwRXgWGuC4fKaqPU3yb219z1q1K-cvn5Z6qjFOgo8A@mail.gmail.com>
On Thu, 26 Feb 2015 12:48:14 +0200 Eyal Birger <eyal.birger@gmail.com> wrote:
> After giving it some additional thought and research, I don't think
> this is necessary.
>
> The sizeof operator on struct sock_skb_cb would give a padded result
> which would take care of the structure alignment.
>
> This is under the assumption that skb->cb[] size is of a proper multiple (which
> I think is rather safe).
Yes, you are correct.
With the assumption that skb->cb and 'cb' size are properly aligned and
sized (compile time asserted, btw?), you can simply:
struct your_thing { // name it
u32 dropcount;
};
struct sock_skb_cb {
/* protocol families specifc CBs */
u8 pf_reserved[PAD];
struct your_thing sock_cb;
};
where:
#define PAD (FIELD_SIZEOF(struct sk_buff, cb) - sizeof(struct your_thing))
next prev parent reply other threads:[~2015-02-26 15:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 2:10 [PATCH net-next 0/7] net: move skb->dropcount to skb->cb[] Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 1/7] net: bluetooth: compact struct bt_skb_cb by inlining struct hci_req_ctrl Eyal Birger
2015-02-26 7:02 ` Shmulik Ladkani
2015-02-26 16:15 ` Marcel Holtmann
2015-02-26 21:22 ` Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 2/7] net: bluetooth: compact struct bt_skb_cb by converting boolean fields to bit fields Eyal Birger
2015-02-26 7:30 ` Shmulik Ladkani
2015-02-26 13:22 ` Eyal Birger
2015-02-26 11:31 ` David Laight
2015-02-26 13:21 ` Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 3/7] net: rxrpc: change call to sock_recv_ts_and_drops() on rxrpc recvmsg to sock_recv_timestamp() Eyal Birger
2015-02-26 4:40 ` Eric Dumazet
2015-02-26 7:30 ` Eyal Birger
2015-02-26 14:31 ` Eric Dumazet
2015-02-26 14:55 ` Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 4/7] net: packet: use skb->dev as storage for skb orig len instead of skb->cb[] Eyal Birger
2015-02-26 4:03 ` Eyal Birger
2015-02-26 17:26 ` Willem de Bruijn
2015-02-26 18:38 ` Eyal Birger
2015-02-26 18:51 ` Willem de Bruijn
2015-02-26 18:55 ` Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 5/7] net: use common macro for assering skb->cb[] available size in protocol families Eyal Birger
2015-02-26 2:10 ` [PATCH net-next 6/7] net: add common accessor for setting dropcount on packets Eyal Birger
2015-02-26 4:43 ` Eric Dumazet
2015-02-26 2:10 ` [PATCH net-next 7/7] net: move skb->dropcount to skb->cb[] Eyal Birger
2015-02-26 8:49 ` Shmulik Ladkani
2015-02-26 10:17 ` Eyal Birger
2015-02-26 10:48 ` Eyal Birger
2015-02-26 15:32 ` Shmulik Ladkani [this message]
2015-02-26 18:52 ` 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=20150226173218.7c6bb2d6@halley \
--to=shmulik.ladkani@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eyal.birger@gmail.com \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.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 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).