Skip to content

Commit 249168a

Browse files
tlfalcondavem330
authored andcommitted
ibmvnic: Make CRQ interrupt tasklet wait for all capabilities crqs
After sending device capability queries and requests to the vNIC Server, an interrupt is triggered and the responses are written to the driver's CRQ response buffer. Since the interrupt can be triggered before all responses are written and visible to the partition, there is a danger that the interrupt handler or tasklet can terminate before all responses are read, resulting in a failure to initialize the device. To avoid this scenario, when capability commands are sent, we set a flag that will be checked in the following interrupt tasklet that will handle the capability responses from the server. Once all responses have been handled, the flag is disabled; and the tasklet is allowed to terminate. Signed-off-by: Thomas Falcon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 901e040 commit 249168a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,7 @@ static void handle_request_cap_rsp(union ibmvnic_crq *crq,
24182418
struct ibmvnic_query_ip_offload_buffer *ip_offload_buf =
24192419
&adapter->ip_offload_buf;
24202420

2421+
adapter->wait_capability = false;
24212422
adapter->ip_offload_tok = dma_map_single(dev, ip_offload_buf,
24222423
buf_sz,
24232424
DMA_FROM_DEVICE);
@@ -2713,9 +2714,11 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq,
27132714
}
27142715

27152716
out:
2716-
if (atomic_read(&adapter->running_cap_crqs) == 0)
2717+
if (atomic_read(&adapter->running_cap_crqs) == 0) {
2718+
adapter->wait_capability = false;
27172719
init_sub_crqs(adapter, 0);
27182720
/* We're done querying the capabilities, initialize sub-crqs */
2721+
}
27192722
}
27202723

27212724
static void handle_control_ras_rsp(union ibmvnic_crq *crq,
@@ -3458,9 +3461,18 @@ static void ibmvnic_tasklet(void *data)
34583461
ibmvnic_handle_crq(crq, adapter);
34593462
crq->generic.first = 0;
34603463
} else {
3461-
done = true;
3464+
/* remain in tasklet until all
3465+
* capabilities responses are received
3466+
*/
3467+
if (!adapter->wait_capability)
3468+
done = true;
34623469
}
34633470
}
3471+
/* if capabilities CRQ's were sent in this tasklet, the following
3472+
* tasklet must wait until all responses are received
3473+
*/
3474+
if (atomic_read(&adapter->running_cap_crqs) != 0)
3475+
adapter->wait_capability = true;
34643476
spin_unlock_irqrestore(&queue->lock, flags);
34653477
}
34663478

drivers/net/ethernet/ibm/ibmvnic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ struct ibmvnic_adapter {
977977
int login_rsp_buf_sz;
978978

979979
atomic_t running_cap_crqs;
980+
bool wait_capability;
980981

981982
struct ibmvnic_sub_crq_queue **tx_scrq;
982983
struct ibmvnic_sub_crq_queue **rx_scrq;

0 commit comments

Comments
 (0)