Skip to content

Instantly share code, notes, and snippets.

@bturrubiates
Created October 10, 2016 21:02
Show Gist options
  • Save bturrubiates/304f262e0588309add3a03d0b1c40cf6 to your computer and use it in GitHub Desktop.
Save bturrubiates/304f262e0588309add3a03d0b1c40cf6 to your computer and use it in GitHub Desktop.
alignments for the various versions of libfabric

Release 1.2

struct fi_usnic_info {
	uint32_t                   ui_version;           /*     0     4 */
	union {
		struct fi_usnic_info_v1 v1;              /*          36 */
	} ui;                                            /*     4    36 */

	/* size: 40, cachelines: 1, members: 2 */
	/* last cacheline: 40 bytes */
};
struct fi_usnic_info_v1 {
	uint32_t                   ui_link_speed;        /*     0     4 */
	uint32_t                   ui_netmask_be;        /*     4     4 */
	char                       ui_ifname[16];        /*     8    16 */
	uint32_t                   ui_num_vf;            /*    24     4 */
	uint32_t                   ui_qp_per_vf;         /*    28     4 */
	uint32_t                   ui_cq_per_vf;         /*    32     4 */

	/* size: 36, cachelines: 1, members: 6 */
	/* last cacheline: 36 bytes */
};

Release 1.3

struct fi_usnic_info {
	uint32_t                   ui_version;           /*     0     4 */

	/* XXX 4 bytes hole, try to pack */

	union {
		struct fi_usnic_info_v1 v1;              /*          36 */
		struct fi_usnic_info_v2 v2;              /*         200 */
	} ui;                                            /*     8   200 */
	/* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */

	/* size: 208, cachelines: 4, members: 2 */
	/* sum members: 204, holes: 1, sum holes: 4 */
	/* last cacheline: 16 bytes */
};
struct fi_usnic_info_v1 {
	uint32_t                   ui_link_speed;        /*     0     4 */
	uint32_t                   ui_netmask_be;        /*     4     4 */
	char                       ui_ifname[16];        /*     8    16 */
	uint32_t                   ui_num_vf;            /*    24     4 */
	uint32_t                   ui_qp_per_vf;         /*    28     4 */
	uint32_t                   ui_cq_per_vf;         /*    32     4 */

	/* size: 36, cachelines: 1, members: 6 */
	/* last cacheline: 36 bytes */
};
struct fi_usnic_info_v2 {
	uint32_t                   ui_link_speed;        /*     0     4 */
	uint32_t                   ui_netmask_be;        /*     4     4 */
	char                       ui_ifname[16];        /*     8    16 */
	unsigned int               ui_num_vf;            /*    24     4 */
	unsigned int               ui_qp_per_vf;         /*    28     4 */
	unsigned int               ui_cq_per_vf;         /*    32     4 */
	char                       ui_devname[16];       /*    36    16 */
	uint8_t                    ui_mac_addr[6];       /*    52     6 */

	/* XXX 2 bytes hole, try to pack */

	uint32_t                   ui_ipaddr_be;         /*    60     4 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	uint32_t                   ui_prefixlen;         /*    64     4 */
	uint32_t                   ui_mtu;               /*    68     4 */
	uint8_t                    ui_link_up;           /*    72     1 */

	/* XXX 3 bytes hole, try to pack */

	uint32_t                   ui_vendor_id;         /*    76     4 */
	uint32_t                   ui_vendor_part_id;    /*    80     4 */
	uint32_t                   ui_device_id;         /*    84     4 */
	char                       ui_firmware[64];      /*    88    64 */
	/* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
	unsigned int               ui_intr_per_vf;       /*   152     4 */
	unsigned int               ui_max_cq;            /*   156     4 */
	unsigned int               ui_max_qp;            /*   160     4 */
	unsigned int               ui_max_cqe;           /*   164     4 */
	unsigned int               ui_max_send_credits;  /*   168     4 */
	unsigned int               ui_max_recv_credits;  /*   172     4 */
	const char  *              ui_nicname;           /*   176     8 */
	const char  *              ui_pid;               /*   184     8 */
	/* --- cacheline 3 boundary (192 bytes) --- */
	struct fi_usnic_cap * *    ui_caps;              /*   192     8 */

	/* size: 200, cachelines: 4, members: 25 */
	/* sum members: 195, holes: 2, sum holes: 5 */
	/* last cacheline: 8 bytes */
};

Release 1.4 (padded)

struct fi_usnic_info {
	uint32_t                   ui_version;           /*     0     4 */
	uint32_t                   padding;              /*     4     4 */
	union {
		struct fi_usnic_info_v1 v1;              /*          36 */
		struct fi_usnic_info_v2 v2;              /*         200 */
	} ui;                                            /*     8   200 */
	/* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */

	/* size: 208, cachelines: 4, members: 3 */
	/* last cacheline: 16 bytes */
};
struct fi_usnic_info_v1 {
	uint32_t                   ui_link_speed;        /*     0     4 */
	uint32_t                   ui_netmask_be;        /*     4     4 */
	char                       ui_ifname[16];        /*     8    16 */
	uint32_t                   ui_num_vf;            /*    24     4 */
	uint32_t                   ui_qp_per_vf;         /*    28     4 */
	uint32_t                   ui_cq_per_vf;         /*    32     4 */

	/* size: 36, cachelines: 1, members: 6 */
	/* last cacheline: 36 bytes */
};
struct fi_usnic_info_v2 {
	uint32_t                   ui_link_speed;        /*     0     4 */
	uint32_t                   ui_netmask_be;        /*     4     4 */
	char                       ui_ifname[16];        /*     8    16 */
	unsigned int               ui_num_vf;            /*    24     4 */
	unsigned int               ui_qp_per_vf;         /*    28     4 */
	unsigned int               ui_cq_per_vf;         /*    32     4 */
	char                       ui_devname[16];       /*    36    16 */
	uint8_t                    ui_mac_addr[6];       /*    52     6 */

	/* XXX 2 bytes hole, try to pack */

	uint32_t                   ui_ipaddr_be;         /*    60     4 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	uint32_t                   ui_prefixlen;         /*    64     4 */
	uint32_t                   ui_mtu;               /*    68     4 */
	uint8_t                    ui_link_up;           /*    72     1 */

	/* XXX 3 bytes hole, try to pack */

	uint32_t                   ui_vendor_id;         /*    76     4 */
	uint32_t                   ui_vendor_part_id;    /*    80     4 */
	uint32_t                   ui_device_id;         /*    84     4 */
	char                       ui_firmware[64];      /*    88    64 */
	/* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
	unsigned int               ui_intr_per_vf;       /*   152     4 */
	unsigned int               ui_max_cq;            /*   156     4 */
	unsigned int               ui_max_qp;            /*   160     4 */
	unsigned int               ui_max_cqe;           /*   164     4 */
	unsigned int               ui_max_send_credits;  /*   168     4 */
	unsigned int               ui_max_recv_credits;  /*   172     4 */
	const char  *              ui_nicname;           /*   176     8 */
	const char  *              ui_pid;               /*   184     8 */
	/* --- cacheline 3 boundary (192 bytes) --- */
	struct fi_usnic_cap * *    ui_caps;              /*   192     8 */

	/* size: 200, cachelines: 4, members: 25 */
	/* sum members: 195, holes: 2, sum holes: 5 */
	/* last cacheline: 8 bytes */
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment