]> git.ipfire.org Git - people/ms/linux.git/commit
IB/hfi1: Correct -EBUSY handling in tx code
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 23 Jun 2020 20:43:22 +0000 (16:43 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 24 Jun 2020 19:13:38 +0000 (16:13 -0300)
commit82172b765530f84b4b9da929f2dcf46f2b7b232b
tree0cad4abea1e1cf9a132ab10dbe2457e42207fdb2
parent822fbd37410639acdae368ea55477ddd3498651d
IB/hfi1: Correct -EBUSY handling in tx code

The current code mishandles -EBUSY in two ways:
- The flow change doesn't test the return from the flush and runs on to
  process the current packet racing with the wakeup processing
- The -EBUSY handling for a single packet inserts the tx into the txlist
  after the submit call, racing with the same wakeup processing

Fix the first by dropping the skb and returning NETDEV_TX_OK.

Fix the second by insuring the the list entry within the txreq is inited
when allocated.  This enables the sleep routine to detect that the txreq
has used the non-list api and queue the packet to the txlist.

Both flaws can lead to having the flushing thread executing in causing two
threads to manipulate the txlist.

Fixes: d99dc602e2a5 ("IB/hfi1: Add functions to transmit datagram ipoib packets")
Link: https://lore.kernel.org/r/20200623204321.108092.83898.stgit@awfm-01.aw.intel.com
Reviewed-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/ipoib_tx.c