From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH DOCDAY] netif.h: describe request/response structures in terms of binary layout Date: Wed, 25 Feb 2015 12:37:38 +0000 Message-ID: <1424867858.20243.89.camel@citrix.com> References: <1424866610-27163-1-git-send-email-ian.campbell@citrix.com> <54EDBECC.5040106@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54EDBECC.5040106@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Wei Liu , ian.jackson@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org, jbeulich@suse.com, keir@xen.org, Roger Pau =?ISO-8859-1?Q?Monn=E9?= List-Id: xen-devel@lists.xenproject.org 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 */ };