OSDN Git Service

IB/hfi1: Handle port down properly in pio
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Fri, 14 Jun 2019 16:33:06 +0000 (12:33 -0400)
committerDoug Ledford <dledford@redhat.com>
Tue, 18 Jun 2019 01:15:40 +0000 (21:15 -0400)
commit942a899335707fc9cfc97cb382a60734b2ff4e03
tree1e2df0fe0cfc90f4cc58fa94350b8942054cf9fb
parent099a884ba4c00145cef283d36e050726311c2e95
IB/hfi1: Handle port down properly in pio

The call to sc_buffer_alloc currently returns NULL (no buffer) or
a buffer descriptor.

There is a third case when the port is down.  Currently that
returns NULL and this prevents the caller from properly handling the
sc_buffer_alloc() failure.  A verbs code link test after the call is
racy so the indication needs to come from the state check inside the allocation
routine to be valid.

Fix by encoding the ECOMM failure like SDMA.   IS_ERR_OR_NULL() tests
are added at all call sites.  For verbs send, this needs to treat any
error by returning a completion without any MMIO copy.

Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/pio.c
drivers/infiniband/hw/hfi1/rc.c
drivers/infiniband/hw/hfi1/ud.c
drivers/infiniband/hw/hfi1/verbs.c