linux-stable/drivers/net
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
..
appletalk
arcnet mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
bonding bonding/802.3ad: fix link_failure_count tracking 2018-11-04 16:44:44 -08:00
caif
can net: Add extack argument to rtnl_create_link 2018-11-06 15:00:45 -08:00
dsa net: dsa: bcm_sf2: fix semicolon.cocci warnings 2018-11-07 22:14:05 -08:00
ethernet dpaa2-ptp: defer probe when portal allocation failed 2018-11-09 20:08:58 -08:00
fddi
fjes
hamradio Merge branch 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-24 14:43:41 +01:00
hippi
hyperv hv_netvsc: fix vf serial matching with pci slot info 2018-10-15 22:58:11 -07:00
ieee802154
ipvlan
netdevsim
phy net: phy: leds: Don't make our own link speed names 2018-11-09 20:13:51 -08:00
plip
ppp Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-10-25 16:43:35 -07:00
slip
team netpoll: allow cleanup to be synchronous 2018-10-19 17:01:43 -07:00
usb usbnet: smsc95xx: disable carrier check while suspending 2018-11-02 23:49:15 -07:00
vmxnet3
wan net/wan/fsl_ucc_hdlc: add BQL support 2018-11-07 22:21:25 -08:00
wimax
wireless brcmfmac: Use standard SKB list accessors in brcmf_sdiod_sglist_rw. 2018-11-10 16:31:15 -08:00
xen-netback
dummy.c
eql.c
geneve.c geneve: Allow configuration of DF behaviour 2018-11-08 17:13:08 -08:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c net: loopback: clear skb->tstamp before netif_rx() 2018-10-20 01:01:28 -07:00
macsec.c macsec: let the administrator set UP state even if lowerdev is down 2018-10-28 19:26:42 -07:00
macvlan.c netpoll: allow cleanup to be synchronous 2018-10-19 17:01:43 -07:00
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c ntb_netdev: Simplify remove with client device drvdata 2018-10-31 21:20:05 -04:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c tun: compute the RFS hash only if needed. 2018-11-07 22:22:16 -08:00
veth.c net: Add extack argument to rtnl_create_link 2018-11-06 15:00:45 -08:00
virtio_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-19 11:03:06 -07:00
vrf.c vrf: mark skb for multicast or link-local as enslaved to VRF 2018-11-07 16:12:39 -08:00
vsockmon.c
vxlan.c vxlan: Allow configuration of DF behaviour 2018-11-08 17:13:08 -08:00
xen-netfront.c xen/netfront: remove unnecessary wmb 2018-11-09 15:15:17 -08:00