linux/drivers/net/ethernet/intel
Jacob Keller 11f29003d6 i40e/i40evf: bump tail only in multiples of 8
Hardware only fetches descriptors on cachelines of 8, essentially
ignoring the lower 3 bits of the tail register. Thus, it is pointless to
bump tail by an unaligned access as the hardware will ignore some of the
new descriptors we allocated. Thus, it's ideal if we can ensure tail
writes are always aligned to 8.

At first, it seems like we'd already do this, since we allocate
descriptors in batches which are a multiple of 8. Since we'd always
increment by a multiple of 8, it seems like the value should always be
aligned.

However, this ignores allocation failures. If we fail to allocate
a buffer, our tail register will become unaligned. Once it has become
unaligned it will essentially be stuck unaligned until a buffer
allocation happens to fail at the exact amount necessary to re-align it.

We can do better, by simply rounding down the number of buffers we're
about to allocate (cleaned_count) such that "next_to_clean
+ cleaned_count" is rounded to the nearest multiple of 8.

We do this by calculating how far off that value is and subtracting it
from the cleaned_count. This essentially defers allocation of buffers if
they're going to be ignored by hardware anyways, and re-aligns our
next_to_use and tail values after a failure to allocate a descriptor.

This calculation ensures that we always align the tail writes in a way
the hardware expects and don't unnecessarily allocate buffers which
won't be fetched immediately.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2017-10-09 14:26:29 -07:00
..
e1000 networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
e1000e drivers: net: e1000e: use setup_timer() helper. 2017-09-21 11:44:41 -07:00
fm10k fm10k: fix mis-ordered parameters in declaration for .ndo_set_vf_bw 2017-10-03 09:00:04 -07:00
i40e i40e/i40evf: bump tail only in multiples of 8 2017-10-09 14:26:29 -07:00
i40evf i40e/i40evf: bump tail only in multiples of 8 2017-10-09 14:26:29 -07:00
igb igb: support BCM54616 PHY 2017-08-08 18:09:12 -07:00
igbvf igbvf: convert msleep to mdelay in atomic context 2017-08-08 18:08:00 -07:00
ixgb drivers: net: ixgb: use setup_timer() helper. 2017-09-21 11:44:40 -07:00
ixgbe bpf, ixgbe: add meta data support 2017-09-26 13:36:44 -07:00
ixgbevf ixgbe: Initialize 64-bit stats seqcounts 2017-08-01 20:06:07 -07:00
e100.c e100: Cocci spatch "pool_zalloc-simple" 2017-09-21 15:26:59 -07:00
Kconfig i40evf: Add support for Adaptive Virtual Function 2017-06-01 14:30:02 -07:00
Makefile