linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac
David S. Miller 4a5a553dde brcmfmac: Use standard SKB list accessors in brcmf_sdiod_sglist_rw.
Instead of direct SKB list pointer accesses.

The loops in this function had to be rewritten to accommodate this
more easily.

The first loop iterates now over the target list in the outer loop,
and triggers an mmc data operation when the per-operation limits are
hit.

Then after the loops, if we have any residue, we trigger the last
and final operation.

For the page aligned workaround, where we have to copy the read data
back into the original list of SKBs, we use a two-tiered loop.  The
outer loop stays the same and iterates over pktlist, and then we have
an inner loop which uses skb_peek_next().  The break logic has been
simplified because we know that the aggregate length of the SKBs in
the source and destination lists are the same.

This change also ends up fixing a bug, having to do with the
maintainance of the seg_sz variable and how it drove the outermost
loop.  It begins as:

	seg_sz = target_list->qlen;

ie. the number of packets in the target_list queue.  The loop
structure was then:

	while (seq_sz) {
		...
		while (not at end of target_list) {
			...
			sg_cnt++
			...
		}
		...
		seg_sz -= sg_cnt;

The assumption built into that last statement is that sg_cnt counts
how many packets from target_list have been fully processed by the
inner loop.  But this not true.

If we hit one of the limits, such as the max segment size or the max
request size, we will break and copy a partial packet then contine
back up to the top of the outermost loop.

With the new loops we don't have this problem as we don't guard the
loop exit with a packet count, but instead use the progression of the
pkt_next SKB through the list to the end.  The general structure is:

	sg_cnt = 0;
	skb_queue_walk(target_list, pkt_next) {
		pkt_offset = 0;
		...
		sg_cnt++;
		...
		while (pkt_offset < pkt_next->len) {
			pkt_offset += sg_data_size;
			if (queued up max per request)
				mmc_submit_one();
		}
	}
	if (sg_cnt)
		mmc_submit_one();

The variables that maintain where we are in the MMC command state such
as req_sz, sg_cnt, and sgl are reset when we emit one of these full
sized requests.

Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-10 16:31:15 -08:00
..
bcdc.c brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
bcdc.h
bcmsdh.c brcmfmac: Use standard SKB list accessors in brcmf_sdiod_sglist_rw. 2018-11-10 16:31:15 -08:00
btcoex.c brcmfmac: allocate struct brcmf_pub instance using wiphy_new() 2018-03-27 12:04:22 +03:00
btcoex.h
bus.h brcmfmac: add support for sysfs initiated coredump 2018-05-23 18:51:48 +03:00
cfg80211.c brcmfmac: add 4-way handshake offload detection for FT-802.1X 2018-08-31 18:44:41 +03:00
cfg80211.h brcmfmac: allocate struct brcmf_pub instance using wiphy_new() 2018-03-27 12:04:22 +03:00
chip.c brcmfmac: add support for BCM4366E chipset 2018-04-25 11:21:58 +03:00
chip.h brcmfmac: use brcmf_chip_name() to store name in revinfo 2018-03-27 12:04:21 +03:00
common.c brcmfmac: fix wrong strnchr usage 2018-08-31 18:48:02 +03:00
common.h brcmfmac: move ALLFFMAC variable in flowring module 2018-05-23 18:51:47 +03:00
commonring.c
commonring.h
core.c brcmfmac: handle msgbuf packets marked with monitor mode flag 2018-07-04 18:05:59 +03:00
core.h brcmfmac: handle msgbuf packets marked with monitor mode flag 2018-07-04 18:05:59 +03:00
debug.c brcmfmac: validate user provided data for memdump before copying 2018-05-23 18:51:56 +03:00
debug.h brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
feature.c brcmfmac: increase buffer for obtaining firmware capabilities 2018-09-20 15:09:31 +03:00
feature.h brcmfmac: detect firmware support for radiotap monitor frames 2018-07-04 18:05:57 +03:00
firmware.c brcmfmac: constify firmware mapping tables 2018-04-30 13:43:15 +03:00
firmware.h brcmfmac: constify firmware mapping tables 2018-04-30 13:43:15 +03:00
flowring.c brcmfmac: move ALLFFMAC variable in flowring module 2018-05-23 18:51:47 +03:00
flowring.h
fweh.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 2017-10-16 17:09:24 +03:00
fweh.h
fwil_types.h brcmfmac: update STA info struct to the v5 2018-07-04 18:08:06 +03:00
fwil.c brcmfmac: do not convert linux error to firmware error string 2018-03-27 12:04:20 +03:00
fwil.h
fwsignal.c brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
fwsignal.h brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
Makefile
msgbuf.c brcmfmac: handle msgbuf packets marked with monitor mode flag 2018-07-04 18:05:59 +03:00
msgbuf.h brcmfmac: coarse support for PCIe shared structure rev7 2018-04-30 13:43:17 +03:00
of.c
of.h
p2p.c brcmfmac: fix full timeout waiting for action frame on-channel tx 2018-10-05 11:29:42 +03:00
p2p.h brcmfmac: fix full timeout waiting for action frame on-channel tx 2018-10-05 11:29:42 +03:00
pcie.c brcmfmac: add CYW89342 mini-PCIe device 2018-08-31 18:44:08 +03:00
pcie.h
pno.c
pno.h
proto.c brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
proto.h brcmfmac: use wiphy debugfs dir entry 2018-03-27 12:04:23 +03:00
sdio.c wireless-drivers-next patches for 4.20 2018-10-02 11:46:29 -07:00
sdio.h brcmfmac: Remove array of functions 2018-01-11 19:34:46 +02:00
tracepoint.c
tracepoint.h
usb.c brcmfmac: constify firmware mapping tables 2018-04-30 13:43:15 +03:00
usb.h
vendor.c
vendor.h