Bluetooth: controller: Fix memory alignment of PDU buffer reference

Align the PDU buffer reference in struct node_rx_pdu so that
node rx type specific parameters, like, terminate and sync
lost reason can be accessed without any memory alignment
issues.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-11-10 18:12:58 +05:30 committed by Carles Cufí
commit 701d524143
3 changed files with 25 additions and 3 deletions

View file

@ -290,9 +290,16 @@ struct node_rx_hdr {
};
};
/* Template node rx type with memory aligned offset to PDU buffer.
* NOTE: offset to memory aligned pdu buffer location is used to reference
* node rx type specific information, like, terminate or sync lost reason
* from a dedicated node rx structure storage location.
*/
struct node_rx_pdu {
struct node_rx_hdr hdr;
uint8_t pdu[0];
union {
uint8_t pdu[0] __aligned(4);
};
};
enum {

View file

@ -159,9 +159,17 @@ struct ll_conn {
uint8_t ack;
uint8_t reason_own;
uint8_t reason_peer;
/* node rx type with memory aligned storage for terminate
* reason.
* HCI will reference the value using the pdu member of
* struct node_rx_pdu.
*/
struct {
struct node_rx_hdr hdr;
uint8_t reason;
union {
uint8_t pdu[0] __aligned(4);
uint8_t reason;
};
} node_rx;
} llcp_terminate;

View file

@ -18,9 +18,16 @@ struct ll_sync_set {
uint16_t volatile timeout_reload; /* Non-zero when sync established */
uint16_t timeout_expire;
/* node rx type with memory aligned storage for sync lost reason.
* HCI will reference the value using the pdu member of
* struct node_rx_pdu.
*/
struct {
struct node_rx_hdr hdr;
uint8_t reason;
union {
uint8_t pdu[0] __aligned(4);
uint8_t reason;
};
} node_rx_lost;
};