[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH DOCDAY] netif.h: describe request/response structures in terms of binary layout



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 */
};



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.