Commit cadef5a6 authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Fabio Baltieri
Browse files

Bluetooth: Controller: Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX

Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX Kconfig option so
that disabling this option will use minimum time reservation
and exercise the peripheral connection event continuation
using is_abort_cb mechanism.

Signed-off-by: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
parent c344cca8
Loading
Loading
Loading
Loading
+2 −0
Changes for samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ CONFIG_BT_CTLR_SCAN_AUX_SET=1

CONFIG_BT_CTLR_ADV_RESERVE_MAX=n
CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n
CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n
CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y
CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n
CONFIG_BT_CTLR_SCAN_UNRESERVED=y
CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y
+13 −0
Changes for subsys/bluetooth/controller/Kconfig.ll_sw_split: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -754,6 +754,19 @@ config BT_CTLR_CENTRAL_RESERVE_MAX
	  Note, currently this value is only used to space multiple central
	  connections and not for actual ticker time reservations.

config BT_CTLR_PERIPHERAL_RESERVE_MAX
	bool "Use maximum data PDU size time reservation for Peripheral"
	depends on BT_PERIPHERAL
	default y
	help
	  Use the maximum data PDU size time reservation considering the Data
	  length could be updated from default 27 bytes to maximum support size.

	  If maximum time reservation is disabled then time reservation required
	  for empty PDU transmission is used. Overlapping radio events will use
	  the is_abort_cb mechanism to decide on continuation of the connection
	  event.

config BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX
	bool "Reserve maximum event overhead in time reservations"
	default y
+1 −0
Changes for subsys/bluetooth/controller/ll_sw/lll.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -509,6 +509,7 @@ struct event_done_extra {
				struct {
					uint16_t trx_cnt;
					uint8_t  crc_valid:1;
					uint8_t  is_aborted:1;
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
					uint8_t  estab_failed:1;
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
+10 −0
Changes for subsys/bluetooth/controller/ll_sw/lll_conn.h: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -69,11 +69,20 @@ struct lll_conn {
		struct {
			uint8_t initiated:1;
			uint8_t cancelled:1;
			uint8_t forced:1;
		};

		struct {
			uint8_t initiated:1;
			uint8_t cancelled:1;
			uint8_t forced:1;
		} central;

#if defined(CONFIG_BT_PERIPHERAL)
		struct {
			uint8_t  initiated:1;
			uint8_t  cancelled:1;
			uint8_t  forced:1;
			uint8_t  latency_enabled:1;

			uint32_t window_widening_periodic_us;
@@ -160,6 +169,7 @@ int lll_conn_reset(void);
void lll_conn_flush(uint16_t handle, struct lll_conn *lll);

void lll_conn_prepare_reset(void);
int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb);
void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param);
void lll_conn_isr_rx(void *param);
void lll_conn_isr_tx(void *param);
+29 −1
Changes for subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c: 29 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ static struct pdu_data *get_last_tx_pdu(struct lll_conn *lll);

static uint8_t crc_expire;
static uint8_t crc_valid;
static uint8_t is_aborted;
static uint16_t trx_cnt;

#if defined(CONFIG_BT_CTLR_LE_ENC)
@@ -142,12 +143,25 @@ void lll_conn_prepare_reset(void)
	trx_cnt = 0U;
	crc_valid = 0U;
	crc_expire = 0U;
	is_aborted = 0U;

#if defined(CONFIG_BT_CTLR_LE_ENC)
	mic_state = LLL_CONN_MIC_NONE;
#endif /* CONFIG_BT_CTLR_LE_ENC */
}

int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb)
{
	struct lll_conn *lll = curr;

	/* Do not abort if near supervision timeout */
	if (lll->forced) {
		return 0;
	}

	return -ECANCELED;
}

void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param)
{
	struct event_done_extra *e;
@@ -156,6 +170,17 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param)

	/* NOTE: This is not a prepare being cancelled */
	if (!prepare_param) {
		/* Get reference to LLL connection context */
		lll = param;

		/* For a peripheral role, ensure at least one PDU is tx-ed
		 * back to central, otherwise let the supervision timeout
		 * countdown be started.
		 */
		if ((lll->role == BT_HCI_ROLE_PERIPHERAL) && (trx_cnt <= 1U)) {
			is_aborted = 1U;
		}

		/* Perform event abort here.
		 * After event has been cleanly aborted, clean up resources
		 * and dispatch event done.
@@ -171,8 +196,10 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param)
	err = lll_hfclock_off();
	LL_ASSERT(err >= 0);

	/* Accumulate the latency as event is aborted while being in pipeline */
	/* Get reference to LLL connection context */
	lll = prepare_param->param;

	/* Accumulate the latency as event is aborted while being in pipeline */
	lll->latency_prepare += (prepare_param->lazy + 1);

	/* Extra done event, to check supervision timeout */
@@ -867,6 +894,7 @@ static void isr_done(void *param)
	e->type = EVENT_DONE_EXTRA_TYPE_CONN;
	e->trx_cnt = trx_cnt;
	e->crc_valid = crc_valid;
	e->is_aborted = is_aborted;

#if defined(CONFIG_BT_CTLR_LE_ENC)
	e->mic_state = mic_state;
Loading