1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-21 15:45:02 +00:00
freebsd/sys
Eric Joyner 088a0b27ad intel iflib drivers: correct initialization of tx_cidx_processed
From Jake:

In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work
around a delta calculation determining how many descriptors were used
was added to ixl_isc_tx_credits_update_dwb.

The same fix was also applied to the em and igb drivers in r340310, and
to ix in r341156.

The hack checked the case where prev and cur were equal, and then added
one. This works, because by the time we do the delta check, we already
know there is at least one packet available, so the delta should be at
least one.

However, it's not a complete fix, and as indicated by the comment is
really a hack to work around the real bug.

The real problem is that the first time that we transmit a packet,
tx_cidx_processed will be set to point to the start of the ring.
Ultimately, the credits_update function expects it to point to the
*last* descriptor that was processed. Since we haven't yet processed any
descriptors, pointing it to 0 results in this incorrect calculation.

Fix the initialization code to have it point to the end of the ring
instead. One way to think about this, is that we are setting the value
to be one prior to the first available descriptor.

Doing so, corrects the delta calculation in all cases. The original fix
only works if the first packet has exactly one descriptor. Otherwise, we
will report 1 less than the correct value.

As part of this fix, also update the MPASS assertions to match the real
expectations. First, ensure that prev is not equal to cur, since this
should never happen. Second, remove the assertion about prev==0 || delta
!= 0. It looks like that originated from when the em driver was
converted to iflib. It seems like it was supposed to ensure that delta
was non-zero. However, because we originally returned 0 delta for the
first calculation, the "prev == 0" was tacked on.

Instead, replace this with a check that delta is greater than zero,
after the correction necessary when the ring pointers wrap around.

This new solution should fix the same bug as r341156 did, but in a more
robust way.

Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
Reviewed by:	shurd@
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D18545
2019-01-24 01:03:00 +00:00
..
amd64 linuxulator: fix stack memory disclosure in linux_sigaltstack 2019-01-21 16:25:40 +00:00
arm awg: fix soft reset failure with no link 2019-01-21 14:35:36 +00:00
arm64 [rpi] Reorganize spigen(4) overlays for Raspberry Pi 2019-01-16 01:08:34 +00:00
bsm Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
cam [ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command 2019-01-18 04:23:52 +00:00
cddl
compat [ndis] Fix unregistered use of FPU by NDIS in kernel on amd64 2019-01-22 03:53:42 +00:00
conf Remove IEEE80211_AMPDU_AGE config option. 2019-01-20 15:17:56 +00:00
contrib dpaa: fix 32-bit build 2019-01-19 05:20:31 +00:00
crypto
ddb
dev intel iflib drivers: correct initialization of tx_cidx_processed 2019-01-24 01:03:00 +00:00
dts [rpi] Reorganize spigen(4) overlays for Raspberry Pi 2019-01-16 01:08:34 +00:00
fs nfs: Zero the buffers exported by NFSSVC_DUMPCLIENTS and DUMPLOCKS. 2019-01-21 23:54:33 +00:00
gdb
geom gmirror: Relocate DEVICE_FLAGS to adjacent lines 2019-01-23 16:44:21 +00:00
gnu
i386 Remove IEEE80211_AMPDU_AGE config option. 2019-01-20 15:17:56 +00:00
isa
kern Re-wrap long line after r341827. 2019-01-17 04:51:05 +00:00
kgssapi
libkern
mips Remove IEEE80211_AMPDU_AGE config option. 2019-01-20 15:17:56 +00:00
modules Add missing dependency to vmxnet3 Makefile and clean it up a bit otherwise. 2019-01-22 04:36:19 +00:00
net netmap: improvements to the netmap kloop (CSB mode) 2019-01-23 14:51:36 +00:00
net80211 net80211: turn channel mode check into assertion. 2019-01-23 13:17:03 +00:00
netgraph
netinet Style. 2019-01-23 22:19:49 +00:00
netinet6 Style. 2019-01-23 22:19:49 +00:00
netipsec
netpfil pf: Validate psn_len in DIOCGETSRCNODES 2019-01-22 02:13:33 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed
opencrypto
powerpc powerpc: Fix opaque irq data initialization 2019-01-19 04:47:19 +00:00
riscv Optimize RISC-V copyin(9)/copyout(9) routines. 2019-01-21 19:38:53 +00:00
rpc
security Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
sparc64 Remove IEEE80211_AMPDU_AGE config option. 2019-01-20 15:17:56 +00:00
sys Remove unused *_sysinit_flags() declarations. 2019-01-22 12:56:49 +00:00
teken
tests
tools
ufs Allocate pager bufs from UMA instead of 80-ish mutex protected linked list. 2019-01-15 01:02:16 +00:00
vm Correct uma_prealloc()'s use of domainset iterators after r339925. 2019-01-23 18:58:15 +00:00
x86 i386/PAE busdma: allow more bounce pages. 2019-01-18 13:43:11 +00:00
xdr
xen
Makefile