All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Wei Liu" <wei.liu2@citrix.com>,
	ian.jackson@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org,
	jbeulich@suse.com, keir@xen.org,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH DOCDAY] netif.h: describe request/response structures in terms of binary layout
Date: Wed, 25 Feb 2015 12:37:38 +0000	[thread overview]
Message-ID: <1424867858.20243.89.camel@citrix.com> (raw)
In-Reply-To: <54EDBECC.5040106@citrix.com>

On Wed, 2015-02-25 at 12:23 +0000, Andrew Cooper wrote:
> On 25/02/15 12:16, Ian Campbell wrote:
> > I have also confirmed, using the Python gdb extension technique in
> > [0], that the struct offsets (in a Linux binary at least) are the same
> > as described here.
[...]
> > [] http://stackoverflow.com/questions/9788679/how-to-get-the-relative-adress-of-a-field-in-a-structure-dump-c,

> `pahole` from the dwarves package is your friend.

Indeed, I always forget it.

For reference here is the output, which matches the new docs too (phew!
).

$ pahole \
	-C xen_netif_rx_request,xen_netif_rx_response,xen_netif_tx_request,xen_netif_tx_response,xen_netif_extra_info \
	../linux-build-master-arm-native/drivers/net/xen-netback/netback.o
struct xen_netif_extra_info {
	uint8_t                    type;                 /*     0     1 */
	uint8_t                    flags;                /*     1     1 */
	union {
		struct {
			uint16_t   size;                 /*     2     2 */
			uint8_t    type;                 /*     4     1 */
			uint8_t    pad;                  /*     5     1 */
			uint16_t   features;             /*     6     2 */
		} gso;                                   /*           6 */
		uint16_t           pad[3];               /*           6 */
	} u;                                             /*     2     6 */

	/* size: 8, cachelines: 1, members: 3 */
	/* last cacheline: 8 bytes */
};
struct xen_netif_rx_request {
	uint16_t                   id;                   /*     0     2 */
	uint16_t                   pad;                  /*     2     2 */
	grant_ref_t                gref;                 /*     4     4 */

	/* size: 8, cachelines: 1, members: 3 */
	/* last cacheline: 8 bytes */
};
struct xen_netif_rx_response {
	uint16_t                   id;                   /*     0     2 */
	uint16_t                   offset;               /*     2     2 */
	uint16_t                   flags;                /*     4     2 */
	int16_t                    status;               /*     6     2 */

	/* size: 8, cachelines: 1, members: 4 */
	/* last cacheline: 8 bytes */
};
struct xen_netif_tx_request {
	grant_ref_t                gref;                 /*     0     4 */
	uint16_t                   offset;               /*     4     2 */
	uint16_t                   flags;                /*     6     2 */
	uint16_t                   id;                   /*     8     2 */
	uint16_t                   size;                 /*    10     2 */

	/* size: 12, cachelines: 1, members: 5 */
	/* last cacheline: 12 bytes */
};
struct xen_netif_tx_response {
	uint16_t                   id;                   /*     0     2 */
	int16_t                    status;               /*     2     2 */

	/* size: 4, cachelines: 1, members: 2 */
	/* last cacheline: 4 bytes */
};

  reply	other threads:[~2015-02-25 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 12:16 [PATCH DOCDAY] netif.h: describe request/response structures in terms of binary layout Ian Campbell
2015-02-25 12:23 ` Andrew Cooper
2015-02-25 12:37   ` Ian Campbell [this message]
2015-02-25 12:34 ` Ian Campbell
2015-02-25 12:48 ` Jürgen Groß
2015-02-25 12:56   ` Ian Campbell
2015-02-25 12:59 ` Andrew Cooper
2015-02-25 13:19   ` Ian Campbell
2015-02-25 13:17 ` Wei Liu

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=1424867858.20243.89.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 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.