]> www.infradead.org Git - users/jedix/linux-maple.git/commit
e1000: Do not overestimate descriptor counts in Tx pre-check
authorAlexander Duyck <aduyck@mirantis.com>
Wed, 2 Mar 2016 21:16:01 +0000 (16:16 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 22 Jun 2017 06:24:39 +0000 (23:24 -0700)
commit64f524b65fefe160983ab4618f08253b6fd07380
tree6dbc3564c0c7296e2a94f8ae0090a24b0fd208ee
parent66e8b877b2dae1a9acab2208bbeb956ccb3a6e1e
e1000: Do not overestimate descriptor counts in Tx pre-check

The current code path is capable of grossly overestimating the number of
descriptors needed to transmit a new frame.  This specifically occurs if
the skb contains a number of 4K pages.  The issue is that the logic for
determining the descriptors needed is ((S) >> (X)) + 1.  When X is 12 it
means that we were indicating that we required 2 descriptors for each 4K
page when we only needed one.

This change corrects this by instead adding (1 << (X)) - 1 to the S value
instead of adding 1 after the fact.  This way we get an accurate descriptor
needed count as we are essentially doing a DIV_ROUNDUP().

Reported-by: Ivan Suzdal <isuzdal@mirantis.com>
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26243014
(cherry picked from commit 847a1d6796c767f8b697ead60997b847a84b897b)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/e1000/e1000_main.c