Thread (30 messages) 30 messages, 6 authors, 2015-02-26

RE: [PATCH net-next 2/7] net: bluetooth: compact struct bt_skb_cb by converting boolean fields to bit fields

From: David Laight <hidden>
Date: 2015-02-26 11:32:04

From: Eyal Birger
On 64 bit systems, struct bt_skb_cb size is padded by 6 bytes in order
to reach 8 byte alignment.
Convert boolean fields force_active, incoming and req_start to bit fields
in order to eliminate the padding.
...
quoted hunk ↗ jump to hunk
+++ b/include/net/bluetooth/bluetooth.h
...
 struct bt_skb_cb {
 	__u8 pkt_type;
-	__u8 incoming;
 	__u16 opcode;
 	__u16 expect;
-	__u8 force_active;
-	bool req_start;
+	__u8 force_active:1;
+	__u8 incoming:1;
+	__u8 req_start:1;
 	u8 req_event;
 	hci_req_complete_t req_complete;
 	struct l2cap_chan *chan;
You've generated some pad bytes, best to put everything on its natural alignment.
The old version had req_complete at offset 9, the new one at offset 8.
Not sure how this removes 6 bytes of pad.

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help