DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] rte_mbuf structure size in Windows
@ 2020-05-13  7:55 Tal Shnaiderman
  2020-05-13  8:04 ` Omar Cardona
  2020-05-13  8:35 ` Dmitry Kozlyuk
  0 siblings, 2 replies; 7+ messages in thread
From: Tal Shnaiderman @ 2020-05-13  7:55 UTC (permalink / raw)
  To: Dmitry Kozlyuk, Thomas Monjalon, pallavi.kadam, navasile,
	ranjit.menon, harini.ramakrishnan, ocardona,
	Dmitry Malloy (MESHCHANINOV),
	Yohad Tor
  Cc: dev

Hi,

I've noticed that there is a difference between the size of rte_mbuf in a Unix build comparing to Windows.

The requirements is for rte_mbuf is to be RTE_CACHE_LINE_MIN_SIZE * 2 bytes however when I'm building it in Windows the size is RTE_CACHE_LINE_MIN_SIZE * 3.

Looks like the diff results from the usage of bit fields inside rte_mbuf, from my testing it looks to me like the usage of 2 different bit fielded types inside rte_mbuf causes additional padding in Windows.

For example from rte_mbuf, the following unions have the same size in Windows and Linux:

	union {
		uint32_t packet_type; 
		// bit fields of type uint32_t will follow
		...
	};...

4 bytes both in Unix and Windows.

	union {
		uint64_t tx_offload;
		// bit fields of type uint64_t will follow
		...
	};

8 bytes both in Unix and Windows.

However when creating a struct containing both unions I'm getting sizeof 16 bytes in Unix and 24 bytes in Windows.

Did someone faced this issue before? Is this a result of different alignment between gcc and clang when bit fields are used? 

Thanks,

Tal

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-13  9:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13  7:55 [dpdk-dev] rte_mbuf structure size in Windows Tal Shnaiderman
2020-05-13  8:04 ` Omar Cardona
2020-05-13  8:07   ` Omar Cardona
2020-05-13  8:50     ` Tal Shnaiderman
2020-05-13  8:35 ` Dmitry Kozlyuk
2020-05-13  8:55   ` Tal Shnaiderman
2020-05-13  9:34     ` Dmitry Kozlyuk

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).