Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions drivers/bluetooth/btcentauri.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ static bool arm_le_data_rings = true;
module_param(arm_le_data_rings, bool, 0444);
MODULE_PARM_DESC(arm_le_data_rings, "Arm native Beta LE rings for radio bring-up");

static bool arm_auxiliary_rings;
static bool arm_auxiliary_rings = true;
module_param(arm_auxiliary_rings, bool, 0444);
MODULE_PARM_DESC(arm_auxiliary_rings, "Diagnostic: arm remaining native Beta resources and capture received frames privately");
MODULE_PARM_DESC(arm_auxiliary_rings, "Arm Beta's ACL data rings");

static bool diagnostic_capture;
module_param(diagnostic_capture, bool, 0444);
MODULE_PARM_DESC(diagnostic_capture, "Diagnostic: arm every auxiliary ring and capture received frames privately; requires the auxiliary rings");

static bool native_startup;
module_param(native_startup, bool, 0444);
Expand All @@ -73,7 +77,7 @@ static bool accept_list;
module_param(accept_list, bool, 0444);
MODULE_PARM_DESC(accept_list, "Let the controller filter LE scans by its accept list (off: report its size as 0, the host filters)");

static bool enable_acl;
static bool enable_acl = true;
module_param(enable_acl, bool, 0444);
MODULE_PARM_DESC(enable_acl, "Experimental ACL data delivery; requires LE and auxiliary rings");

Expand All @@ -90,8 +94,8 @@ struct cen_aux_spec {
bool receive;
};

/* Host native Beta inventory; each resource is opt-in until target-qualified.
* HCI and LE rings remain in their existing, separately qualified arenas.
/* Beta's auxiliary rings. Only the ACL rings (2 and 8) are armed by default; the
* others only with diagnostic_capture. HCI and LE rings have their own arenas.
*/
static const struct cen_aux_spec cen_aux_specs[] = {
{ 2, 9, 2592, false }, /* ACL TX */
Expand All @@ -110,6 +114,7 @@ static const struct cen_aux_spec cen_aux_specs[] = {
struct cen_aux_state {
u32 offset, packets;
u16 head, post;
bool opened;
};

struct cen_bt {
Expand Down Expand Up @@ -318,11 +323,14 @@ static int cen_aux_start(struct cen_bt *bt)
return -ENOSPC;
state->offset = offset;
offset = ALIGN(offset + length, SZ_4K);
if (!diagnostic_capture && spec->id != 2 && spec->id != 8)
continue;
ret = cen_open_ring(bt, spec->id, spec->slots, state->offset, spec->footer);
if (ret) {
dev_err(&bt->pdev->dev, "Auxiliary ring %u open failed: %d\n", spec->id, ret);
return ret;
}
state->opened = true;
if (!spec->receive)
continue;
for (slot = 0; slot < spec->slots - 1; slot++)
Expand All @@ -343,7 +351,7 @@ static int cen_aux_drain(struct cen_bt *bt, bool repost)
u16 tail;
int budget = spec->slots;

if (!spec->receive)
if (!state->opened || !spec->receive)
continue;
tail = cen_tail(bt, spec->id);
if (tail >= spec->slots)
Expand Down Expand Up @@ -951,7 +959,7 @@ static int cen_status_show(struct seq_file *s, void *unused)
bt->capture_used, bt->capture_records, bt->capture_dropped);
if (arm_auxiliary_rings)
for (i = 0; i < ARRAY_SIZE(cen_aux_specs); i++)
if (cen_aux_specs[i].receive)
if (cen_aux_specs[i].receive && bt->aux[i].opened)
seq_printf(s, "aux_rx ring=%u packets=%u consumed=%u device_tail=%u\n",
cen_aux_specs[i].id, bt->aux[i].packets,
bt->aux[i].head, cen_tail(bt, cen_aux_specs[i].id));
Expand Down Expand Up @@ -1028,6 +1036,8 @@ static int cen_probe(struct pci_dev *pdev, const struct pci_device_id *id)
skb_queue_head_init(&bt->le_txq);
if (enable_acl && (!arm_le_data_rings || !arm_auxiliary_rings))
return -EINVAL;
if (diagnostic_capture && !arm_auxiliary_rings)
return -EINVAL;
if (native_hrb && (!native_startup || !enable_acl))
return -EINVAL;
INIT_DELAYED_WORK(&bt->poll, cen_poll);
Expand All @@ -1051,7 +1061,7 @@ static int cen_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!bt->arena)
return -ENOMEM;
memset(bt->arena, 0, CEN_ARENA_SIZE);
if (arm_auxiliary_rings) {
if (diagnostic_capture) {
bt->capture = kvzalloc(CEN_CAPTURE_SIZE, GFP_KERNEL);
if (!bt->capture) {
ret = -ENOMEM;
Expand Down
Loading