android_kernel_xiaomi_sm7250/drivers
Michael Chan 2f8af120a1 [BNX2]: Fix tx race condition.
Fix a subtle race condition between bnx2_start_xmit() and bnx2_tx_int()
similar to the one in tg3 discovered by Herbert Xu:

CPU0					CPU1
bnx2_start_xmit()
	if (tx_ring_full) {
		tx_lock
					bnx2_tx()
						if (!netif_queue_stopped)
		netif_stop_queue()
		if (!tx_ring_full)
						update_tx_ring
			netif_wake_queue()
		tx_unlock
	}

Even though tx_ring is updated before the if statement in bnx2_tx_int() in
program order, it can be re-ordered by the CPU as shown above.  This
scenario can cause the tx queue to be stopped forever if bnx2_tx_int() has
just freed up the entire tx_ring.  The possibility of this happening
should be very rare though.

The following changes are made, very much identical to the tg3 fix:

1. Add memory barrier to fix the above race condition.

2. Eliminate the private tx_lock altogether and rely solely on
netif_tx_lock.  This eliminates one spinlock in bnx2_start_xmit()
when the ring is full.

3. Because of 2, use netif_tx_lock in bnx2_tx_int() before calling
netif_wake_queue().

4. Add memory barrier to bnx2_tx_avail().

5. Add bp->tx_wake_thresh which is set to half the tx ring size.

6. Check for the full wake queue condition before getting
netif_tx_lock in tg3_tx().  This reduces the number of unnecessary
spinlocks when the tx ring is full in a steady-state condition.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-08-17 16:29:51 -07:00
..
acorn
acpi [PATCH] memory hotadd fixes: avoid registering res twice 2006-08-06 08:57:49 -07:00
amba
atm [ATM]: Typo in drivers/atm/Kconfig... 2006-07-08 13:30:09 -07:00
base [PATCH] cpu hotplug: use hotplug version of registration in late inits 2006-07-31 13:28:39 -07:00
block [PATCH] nbd: Abort request on data reception failure 2006-07-31 13:28:39 -07:00
bluetooth [Bluetooth] Enable SCO support for Broadcom HID proxy dongle 2006-07-24 12:44:34 -07:00
cdrom [PATCH] cdrom: fix bad cgc.buflen assignment 2006-07-10 13:24:15 -07:00
char [WATCHDOG] Kconfig typos fix. 2006-08-15 11:17:22 +02:00
clocksource
connector [PATCH] Process Events: Fix biarch compatibility issue. use __u64 timestamp 2006-07-31 13:28:36 -07:00
cpufreq [CPUFREQ] [2/2] demand load governor modules. 2006-07-31 18:37:06 -04:00
crypto [CRYPTO] padlock: Fix alignment after aes_ctx rearrange 2006-07-15 11:08:50 +10:00
dio
dma [I/OAT]: Remove pci_module_init() from Intel I/OAT DMA engine 2006-07-21 14:50:13 -07:00
edac [PATCH] drivers/edac/edac_mc.h must #include <linux/platform_device.h> 2006-08-06 08:57:46 -07:00
eisa
fc4 [SCSI] More buffer->request_buffer changes 2006-07-14 09:41:13 -05:00
firmware
hwmon [PATCH] hwmon: Fix for first generation Abit uGuru chips 2006-07-12 15:43:07 -07:00
i2c [PATCH] SCX200_ACB: eliminate spurious timeout errors 2006-08-06 08:57:49 -07:00
ide [PATCH] PATCH: 2.6.18 oops on boot fix for IDE 2006-08-09 15:43:27 -07:00
ieee1394 [PATCH] ieee1394: sbp2: enable auto spin-up for Maxtor disks 2006-08-06 08:57:48 -07:00
infiniband IB/uverbs: Avoid a crash on device hot remove 2006-08-03 10:56:42 -07:00
input Input: atkbd - restore repeat rate when resuming 2006-08-04 22:52:46 -04:00
isdn [PATCH] eicon: fix define conflict with ptrace 2006-08-06 08:57:48 -07:00
leds [PATCH] net48xx LED cleanups 2006-07-14 21:53:54 -07:00
macintosh Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-07-31 13:39:52 -07:00
mca
md [PATCH] dm: BUG/OOPS fix 2006-08-14 12:54:29 -07:00
media V4L/DVB (4431): Add several error checks to dst 2006-08-08 15:53:04 -03:00
message Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2006-07-21 12:04:53 -07:00
mfd [ARM] 3727/1: fix ucb initialization on collie 2006-07-11 22:54:15 +01:00
misc
mmc [MMC] Another stray 'io' reference 2006-08-07 14:47:54 +01:00
mtd Merge git://git.infradead.org/mtd-2.6 2006-07-03 21:29:08 -07:00
net [BNX2]: Fix tx race condition. 2006-08-17 16:29:51 -07:00
nubus
oprofile
parisc
parport
pci PCI: remove dead HOTPLUG_PCI_SHPC_PHPRM_LEGACY option. 2006-08-11 14:06:05 -07:00
pcmcia [PATCH] pcmcia: fix ioctl GET_CONFIGURATION_INFO for pcmcia_cards 2006-07-31 13:28:41 -07:00
pnp [PATCH] pnpacpi: reject ACPI_PRODUCER resources 2006-08-06 08:57:49 -07:00
rapidio
rtc [PATCH] RTC subsystem, Add ISL1208 support 2006-07-14 21:53:53 -07:00
s390 [S390] inaccessible PAV alias devices on LPAR. 2006-08-16 13:49:33 +02:00
sbus [SPARC] sbus: Make sure sbus nodes are named uniquely. 2006-07-21 14:18:06 -07:00
scsi Merge gregkh@master.kernel.org:/home/rmk/linux-2.6-arm 2006-08-10 15:07:17 -07:00
serial [SERIAL] sunzilog: Fix instance enumeration. 2006-07-21 14:18:25 -07:00
sh
sn
spi
tc
telephony
usb USB: usbtest.c: unsigned retval makes ctrl_out return 0 in case of error 2006-08-11 14:06:06 -07:00
video [PATCH] add imacfb documentation and detection 2006-08-14 12:54:28 -07:00
w1 [PATCH] w1: remove drivers/w1/w1.h 2006-07-12 15:38:28 -07:00
zorro
Kconfig
Makefile