Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,10 @@ static int brcmf_pcie_ring_mb_update_rptr(void *ctx)
if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
return -EIO;

/* Flowrings are allocated before their depth is configured. */
if (!commonring->depth)
return -EIO;

/* The dongle's index is only used inside the ring; keep the last good one */
ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
if (ptr >= commonring->depth) {
Expand Down Expand Up @@ -1530,6 +1534,10 @@ static int brcmf_pcie_ring_mb_update_wptr(void *ctx)
if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
return -EIO;

/* Flowrings are allocated before their depth is configured. */
if (!commonring->depth)
return -EIO;

/* The dongle's index is only used inside the ring; keep the last good one */
ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
if (ptr >= commonring->depth) {
Expand Down
13 changes: 12 additions & 1 deletion tools/asahi/brcmf-shared-tcm-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,17 @@ def define(source, name):
assert(rb->commonring.r_ptr == 63 && rb->commonring.w_ptr == 10);
put16(rb->r_idx_addr, 64); put16(rb->w_idx_addr, 0xffff);
assert(brcmf_pcie_ring_mb_update_rptr(rb) == -EIO && brcmf_pcie_ring_mb_update_wptr(rb) == -EIO);
assert(rb->commonring.r_ptr == 63 && rb->commonring.w_ptr == 10); cases++;
assert(rb->commonring.r_ptr == 63 && rb->commonring.w_ptr == 10 && errs == 2); cases++;
/* Allocated flowrings have no depth until configured: do not read or log their indices. */
reset(); devinfo.state = BRCMFMAC_PCIE_STATE_UP; assert(!init() && !rings());
rb = &devinfo.shared.flowrings[0]; assert(!rb->commonring.depth);
const u16 unconfigured_ptrs[] = { 0, 0xffff };
for (unsigned i = 0; i < sizeof(unconfigured_ptrs) / sizeof(unconfigured_ptrs[0]); i++) {
put16(rb->r_idx_addr, unconfigured_ptrs[i]); put16(rb->w_idx_addr, unconfigured_ptrs[i]);
unsigned long before = reads;
assert(brcmf_pcie_ring_mb_update_rptr(rb) == -EIO && brcmf_pcie_ring_mb_update_wptr(rb) == -EIO);
assert(!rb->commonring.r_ptr && !rb->commonring.w_ptr && !errs && reads == before); cases++;
}
/* A console descriptor or buffer outside the TCM leaves the console off; setup goes on. */
reset(); put32(SHARED + BRCMF_SHARED_CONSOLE_ADDR_OFFSET, TCM_SIZE - 4);
assert(!init() && !devinfo.shared.console.base_addr); cases++;
Expand Down Expand Up @@ -254,6 +264,7 @@ def define(source, name):
'\tptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);\n\tif (false) {'),
'wptr-depth': ('\tptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);\n\tif (ptr >= commonring->depth) {',
'\tptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);\n\tif (false) {'),
'unconfigured-depth': ('\tif (!commonring->depth)\n', '\tif (false)\n'),
'console-desc': ('\t !brcmf_pcie_tcm_range_valid(devinfo->tcm_size, console->base_addr,\n'
'\t\t\t\t\tBRCMF_CONSOLE_WRITEIDX_OFFSET + 4)) {', '\t false) {'),
'console-none': ('\tif (!console->base_addr ||\n', '\tif (false ||\n'),
Expand Down
2 changes: 1 addition & 1 deletion tools/asahi/run-host-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def mutations(flag, names, base, expect=KILL):
'brcmf-roam-tests.py': [(out(), PASS)],
'brcmf-shared-tcm-tests.py': [(out(), PASS)]
+ mutations('--mutation', ('shared', 'htod-mb', 'dtoh-mb', 'ring-info', 'ring-mem', 'ring-idx',
'flowring-idx', 'dma-counts', 'rptr-depth', 'wptr-depth',
'flowring-idx', 'dma-counts', 'rptr-depth', 'wptr-depth', 'unconfigured-depth',
'console-desc', 'console-none',
'console-buf', 'console-widx', 'console-reinit'), out()),
'brcmf-sae-vendor-tests.py': [(out(), PASS)]
Expand Down
Loading