ibmvnic: Improve TX buffer accounting
authorThomas Falcon <tlfalcon@linux.vnet.ibm.com>
Sat, 17 Mar 2018 01:00:29 +0000 (20:00 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Mar 2018 00:12:39 +0000 (20:12 -0400)
commit86b61a5f2e39bbee254aa4d2c5445059c7656f98
tree3b30dd206b66a9d533ab19473afc46378a2f2c3d
parent06b3e35788a4c6f0afa931b6251ecfe20ce4787b
ibmvnic: Improve TX buffer accounting

Improve TX pool buffer accounting to prevent the producer
index from overruning the consumer. First, set the next free
index to an invalid value if it is in use. If next buffer
to be consumed is in use, drop the packet.

Finally, if the transmit fails for some other reason, roll
back the consumer index and set the free map entry to its original
value. This should also be done if the DMA map fails.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c