Commit a4e262cd authored by Sameeh Jubran's avatar Sameeh Jubran Committed by David S. Miller

net: ena: allow automatic fallback to polling mode

Enable fallback to polling mode for Admin queue
when identified a command response arrival
without an accompanying MSI-X interrupt
Signed-off-by: default avatarIgor Chauskin <igorch@amazon.com>
Signed-off-by: default avatarSameeh Jubran <sameehj@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent adf671cc
...@@ -762,16 +762,26 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com ...@@ -762,16 +762,26 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
admin_queue->stats.no_completion++; admin_queue->stats.no_completion++;
spin_unlock_irqrestore(&admin_queue->q_lock, flags); spin_unlock_irqrestore(&admin_queue->q_lock, flags);
if (comp_ctx->status == ENA_CMD_COMPLETED) if (comp_ctx->status == ENA_CMD_COMPLETED) {
pr_err("The ena device have completion but the driver didn't receive any MSI-X interrupt (cmd %d)\n", pr_err("The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n",
comp_ctx->cmd_opcode); comp_ctx->cmd_opcode,
else admin_queue->auto_polling ? "ON" : "OFF");
pr_err("The ena device doesn't send any completion for the admin cmd %d status %d\n", /* Check if fallback to polling is enabled */
if (admin_queue->auto_polling)
admin_queue->polling = true;
} else {
pr_err("The ena device doesn't send a completion for the admin cmd %d status %d\n",
comp_ctx->cmd_opcode, comp_ctx->status); comp_ctx->cmd_opcode, comp_ctx->status);
}
admin_queue->running_state = false; /* Check if shifted to polling mode.
ret = -ETIME; * This will happen if there is a completion without an interrupt
goto err; * and autopolling mode is enabled. Continuing normal execution in such case
*/
if (!admin_queue->polling) {
admin_queue->running_state = false;
ret = -ETIME;
goto err;
}
} }
ret = ena_com_comp_status_to_errno(comp_ctx->comp_status); ret = ena_com_comp_status_to_errno(comp_ctx->comp_status);
...@@ -1650,6 +1660,12 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling) ...@@ -1650,6 +1660,12 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling)
ena_dev->admin_queue.polling = polling; ena_dev->admin_queue.polling = polling;
} }
void ena_com_set_admin_auto_polling_mode(struct ena_com_dev *ena_dev,
bool polling)
{
ena_dev->admin_queue.auto_polling = polling;
}
int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev) int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev)
{ {
struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read; struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read;
......
...@@ -283,6 +283,9 @@ struct ena_com_admin_queue { ...@@ -283,6 +283,9 @@ struct ena_com_admin_queue {
/* Indicate if the admin queue should poll for completion */ /* Indicate if the admin queue should poll for completion */
bool polling; bool polling;
/* Define if fallback to polling mode should occur */
bool auto_polling;
u16 curr_cmd_id; u16 curr_cmd_id;
/* Indicate that the ena was initialized and can /* Indicate that the ena was initialized and can
...@@ -545,6 +548,17 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling); ...@@ -545,6 +548,17 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling);
*/ */
bool ena_com_get_ena_admin_polling_mode(struct ena_com_dev *ena_dev); bool ena_com_get_ena_admin_polling_mode(struct ena_com_dev *ena_dev);
/* ena_com_set_admin_auto_polling_mode - Enable autoswitch to polling mode
* @ena_dev: ENA communication layer struct
* @polling: Enable/Disable polling mode
*
* Set the autopolling mode.
* If autopolling is on:
* In case of missing interrupt when data is available switch to polling.
*/
void ena_com_set_admin_auto_polling_mode(struct ena_com_dev *ena_dev,
bool polling);
/* ena_com_admin_q_comp_intr_handler - admin queue interrupt handler /* ena_com_admin_q_comp_intr_handler - admin queue interrupt handler
* @ena_dev: ENA communication layer struct * @ena_dev: ENA communication layer struct
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment