net/ena: update version to v2.3.0
[dpdk.git] / drivers / net / ena / base / ena_com.c
index 38a474b..5ca36ab 100644 (file)
@@ -34,7 +34,9 @@
 
 #define ENA_REGS_ADMIN_INTR_MASK 1
 
-#define ENA_POLL_MS    5
+#define ENA_MIN_ADMIN_POLL_US 100
+
+#define ENA_MAX_ADMIN_POLL_US 5000
 
 /*****************************************************************************/
 /*****************************************************************************/
@@ -68,26 +70,27 @@ static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
                                       dma_addr_t addr)
 {
        if ((addr & GENMASK_ULL(ena_dev->dma_addr_bits - 1, 0)) != addr) {
-               ena_trc_err("dma address has more bits that the device supports\n");
+               ena_trc_err(ena_dev, "DMA address has more bits than the device supports\n");
                return ENA_COM_INVAL;
        }
 
        ena_addr->mem_addr_low = lower_32_bits(addr);
-       ena_addr->mem_addr_high = upper_32_bits(addr);
+       ena_addr->mem_addr_high = (u16)upper_32_bits(addr);
 
        return 0;
 }
 
-static int ena_com_admin_init_sq(struct ena_com_admin_queue *queue)
+static int ena_com_admin_init_sq(struct ena_com_admin_queue *admin_queue)
 {
-       struct ena_com_admin_sq *sq = &queue->sq;
-       u16 size = ADMIN_SQ_SIZE(queue->q_depth);
+       struct ena_com_dev *ena_dev = admin_queue->ena_dev;
+       struct ena_com_admin_sq *sq = &admin_queue->sq;
+       u16 size = ADMIN_SQ_SIZE(admin_queue->q_depth);
 
-       ENA_MEM_ALLOC_COHERENT(queue->q_dmadev, size, sq->entries, sq->dma_addr,
+       ENA_MEM_ALLOC_COHERENT(admin_queue->q_dmadev, size, sq->entries, sq->dma_addr,
                               sq->mem_handle);
 
        if (!sq->entries) {
-               ena_trc_err("memory allocation failed\n");
+               ena_trc_err(ena_dev, "Memory allocation failed\n");
                return ENA_COM_NO_MEM;
        }
 
@@ -100,16 +103,17 @@ static int ena_com_admin_init_sq(struct ena_com_admin_queue *queue)
        return 0;
 }
 
-static int ena_com_admin_init_cq(struct ena_com_admin_queue *queue)
+static int ena_com_admin_init_cq(struct ena_com_admin_queue *admin_queue)
 {
-       struct ena_com_admin_cq *cq = &queue->cq;
-       u16 size = ADMIN_CQ_SIZE(queue->q_depth);
+       struct ena_com_dev *ena_dev = admin_queue->ena_dev;
+       struct ena_com_admin_cq *cq = &admin_queue->cq;
+       u16 size = ADMIN_CQ_SIZE(admin_queue->q_depth);
 
-       ENA_MEM_ALLOC_COHERENT(queue->q_dmadev, size, cq->entries, cq->dma_addr,
+       ENA_MEM_ALLOC_COHERENT(admin_queue->q_dmadev, size, cq->entries, cq->dma_addr,
                               cq->mem_handle);
 
        if (!cq->entries)  {
-               ena_trc_err("memory allocation failed\n");
+               ena_trc_err(ena_dev, "Memory allocation failed\n");
                return ENA_COM_NO_MEM;
        }
 
@@ -119,22 +123,22 @@ static int ena_com_admin_init_cq(struct ena_com_admin_queue *queue)
        return 0;
 }
 
-static int ena_com_admin_init_aenq(struct ena_com_dev *dev,
+static int ena_com_admin_init_aenq(struct ena_com_dev *ena_dev,
                                   struct ena_aenq_handlers *aenq_handlers)
 {
-       struct ena_com_aenq *aenq = &dev->aenq;
+       struct ena_com_aenq *aenq = &ena_dev->aenq;
        u32 addr_low, addr_high, aenq_caps;
        u16 size;
 
-       dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH;
+       ena_dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH;
        size = ADMIN_AENQ_SIZE(ENA_ASYNC_QUEUE_DEPTH);
-       ENA_MEM_ALLOC_COHERENT(dev->dmadev, size,
+       ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev, size,
                        aenq->entries,
                        aenq->dma_addr,
                        aenq->mem_handle);
 
        if (!aenq->entries) {
-               ena_trc_err("memory allocation failed\n");
+               ena_trc_err(ena_dev, "Memory allocation failed\n");
                return ENA_COM_NO_MEM;
        }
 
@@ -144,18 +148,18 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *dev,
        addr_low = ENA_DMA_ADDR_TO_UINT32_LOW(aenq->dma_addr);
        addr_high = ENA_DMA_ADDR_TO_UINT32_HIGH(aenq->dma_addr);
 
-       ENA_REG_WRITE32(dev->bus, addr_low, dev->reg_bar + ENA_REGS_AENQ_BASE_LO_OFF);
-       ENA_REG_WRITE32(dev->bus, addr_high, dev->reg_bar + ENA_REGS_AENQ_BASE_HI_OFF);
+       ENA_REG_WRITE32(ena_dev->bus, addr_low, ena_dev->reg_bar + ENA_REGS_AENQ_BASE_LO_OFF);
+       ENA_REG_WRITE32(ena_dev->bus, addr_high, ena_dev->reg_bar + ENA_REGS_AENQ_BASE_HI_OFF);
 
        aenq_caps = 0;
-       aenq_caps |= dev->aenq.q_depth & ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK;
+       aenq_caps |= ena_dev->aenq.q_depth & ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK;
        aenq_caps |= (sizeof(struct ena_admin_aenq_entry) <<
                ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT) &
                ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK;
-       ENA_REG_WRITE32(dev->bus, aenq_caps, dev->reg_bar + ENA_REGS_AENQ_CAPS_OFF);
+       ENA_REG_WRITE32(ena_dev->bus, aenq_caps, ena_dev->reg_bar + ENA_REGS_AENQ_CAPS_OFF);
 
        if (unlikely(!aenq_handlers)) {
-               ena_trc_err("aenq handlers pointer is NULL\n");
+               ena_trc_err(ena_dev, "AENQ handlers pointer is NULL\n");
                return ENA_COM_INVAL;
        }
 
@@ -171,31 +175,34 @@ static void comp_ctxt_release(struct ena_com_admin_queue *queue,
        ATOMIC32_DEC(&queue->outstanding_cmds);
 }
 
-static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue,
+static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *admin_queue,
                                          u16 command_id, bool capture)
 {
-       if (unlikely(command_id >= queue->q_depth)) {
-               ena_trc_err("command id is larger than the queue size. cmd_id: %u queue size %d\n",
-                           command_id, queue->q_depth);
+       if (unlikely(command_id >= admin_queue->q_depth)) {
+               ena_trc_err(admin_queue->ena_dev,
+                           "Command id is larger than the queue size. cmd_id: %u queue size %d\n",
+                           command_id, admin_queue->q_depth);
                return NULL;
        }
 
-       if (unlikely(!queue->comp_ctx)) {
-               ena_trc_err("Completion context is NULL\n");
+       if (unlikely(!admin_queue->comp_ctx)) {
+               ena_trc_err(admin_queue->ena_dev,
+                           "Completion context is NULL\n");
                return NULL;
        }
 
-       if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
-               ena_trc_err("Completion context is occupied\n");
+       if (unlikely(admin_queue->comp_ctx[command_id].occupied && capture)) {
+               ena_trc_err(admin_queue->ena_dev,
+                           "Completion context is occupied\n");
                return NULL;
        }
 
        if (capture) {
-               ATOMIC32_INC(&queue->outstanding_cmds);
-               queue->comp_ctx[command_id].occupied = true;
+               ATOMIC32_INC(&admin_queue->outstanding_cmds);
+               admin_queue->comp_ctx[command_id].occupied = true;
        }
 
-       return &queue->comp_ctx[command_id];
+       return &admin_queue->comp_ctx[command_id];
 }
 
 static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queue *admin_queue,
@@ -216,7 +223,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu
        /* In case of queue FULL */
        cnt = (u16)ATOMIC32_READ(&admin_queue->outstanding_cmds);
        if (cnt >= admin_queue->q_depth) {
-               ena_trc_dbg("admin queue is full.\n");
+               ena_trc_dbg(admin_queue->ena_dev, "Admin queue is full.\n");
                admin_queue->stats.out_of_space++;
                return ERR_PTR(ENA_COM_NO_SPACE);
        }
@@ -258,20 +265,21 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu
        return comp_ctx;
 }
 
-static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
+static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *admin_queue)
 {
-       size_t size = queue->q_depth * sizeof(struct ena_comp_ctx);
+       struct ena_com_dev *ena_dev = admin_queue->ena_dev;
+       size_t size = admin_queue->q_depth * sizeof(struct ena_comp_ctx);
        struct ena_comp_ctx *comp_ctx;
        u16 i;
 
-       queue->comp_ctx = ENA_MEM_ALLOC(queue->q_dmadev, size);
-       if (unlikely(!queue->comp_ctx)) {
-               ena_trc_err("memory allocation failed\n");
+       admin_queue->comp_ctx = ENA_MEM_ALLOC(admin_queue->q_dmadev, size);
+       if (unlikely(!admin_queue->comp_ctx)) {
+               ena_trc_err(ena_dev, "Memory allocation failed\n");
                return ENA_COM_NO_MEM;
        }
 
-       for (i = 0; i < queue->q_depth; i++) {
-               comp_ctx = get_comp_ctxt(queue, i, false);
+       for (i = 0; i < admin_queue->q_depth; i++) {
+               comp_ctx = get_comp_ctxt(admin_queue, i, false);
                if (comp_ctx)
                        ENA_WAIT_EVENT_INIT(comp_ctx->wait_event);
        }
@@ -339,7 +347,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
                }
 
                if (!io_sq->desc_addr.virt_addr) {
-                       ena_trc_err("memory allocation failed\n");
+                       ena_trc_err(ena_dev, "Memory allocation failed\n");
                        return ENA_COM_NO_MEM;
                }
        }
@@ -364,7 +372,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
                        io_sq->bounce_buf_ctrl.base_buffer = ENA_MEM_ALLOC(ena_dev->dmadev, size);
 
                if (!io_sq->bounce_buf_ctrl.base_buffer) {
-                       ena_trc_err("bounce buffer memory allocation failed\n");
+                       ena_trc_err(ena_dev, "Bounce buffer memory allocation failed\n");
                        return ENA_COM_NO_MEM;
                }
 
@@ -378,6 +386,8 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
                       0x0, io_sq->llq_info.desc_list_entry_size);
                io_sq->llq_buf_ctrl.descs_left_in_line =
                        io_sq->llq_info.descs_num_before_header;
+               io_sq->disable_meta_caching =
+                       io_sq->llq_info.disable_meta_caching;
 
                if (io_sq->llq_info.max_entries_in_tx_burst > 0)
                        io_sq->entries_in_tx_burst_left =
@@ -409,23 +419,25 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
        size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth;
        io_cq->bus = ena_dev->bus;
 
-       ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
-                       size,
-                       io_cq->cdesc_addr.virt_addr,
-                       io_cq->cdesc_addr.phys_addr,
-                       io_cq->cdesc_addr.mem_handle,
-                       ctx->numa_node,
-                       prev_node);
+       ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED(ena_dev->dmadev,
+                                           size,
+                                           io_cq->cdesc_addr.virt_addr,
+                                           io_cq->cdesc_addr.phys_addr,
+                                           io_cq->cdesc_addr.mem_handle,
+                                           ctx->numa_node,
+                                           prev_node,
+                                           ENA_CDESC_RING_SIZE_ALIGNMENT);
        if (!io_cq->cdesc_addr.virt_addr) {
-               ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev,
-                                      size,
-                                      io_cq->cdesc_addr.virt_addr,
-                                      io_cq->cdesc_addr.phys_addr,
-                                      io_cq->cdesc_addr.mem_handle);
+               ENA_MEM_ALLOC_COHERENT_ALIGNED(ena_dev->dmadev,
+                                              size,
+                                              io_cq->cdesc_addr.virt_addr,
+                                              io_cq->cdesc_addr.phys_addr,
+                                              io_cq->cdesc_addr.mem_handle,
+                                              ENA_CDESC_RING_SIZE_ALIGNMENT);
        }
 
        if (!io_cq->cdesc_addr.virt_addr) {
-               ena_trc_err("memory allocation failed\n");
+               ena_trc_err(ena_dev, "Memory allocation failed\n");
                return ENA_COM_NO_MEM;
        }
 
@@ -446,7 +458,8 @@ static void ena_com_handle_single_admin_completion(struct ena_com_admin_queue *a
 
        comp_ctx = get_comp_ctxt(admin_queue, cmd_id, false);
        if (unlikely(!comp_ctx)) {
-               ena_trc_err("comp_ctx is NULL. Changing the admin queue running state\n");
+               ena_trc_err(admin_queue->ena_dev,
+                           "comp_ctx is NULL. Changing the admin queue running state\n");
                admin_queue->running_state = false;
                return;
        }
@@ -498,10 +511,12 @@ static void ena_com_handle_admin_completion(struct ena_com_admin_queue *admin_qu
        admin_queue->stats.completed_cmd += comp_num;
 }
 
-static int ena_com_comp_status_to_errno(u8 comp_status)
+static int ena_com_comp_status_to_errno(struct ena_com_admin_queue *admin_queue,
+                                       u8 comp_status)
 {
        if (unlikely(comp_status != 0))
-               ena_trc_err("admin command failed[%u]\n", comp_status);
+               ena_trc_err(admin_queue->ena_dev,
+                           "Admin command failed[%u]\n", comp_status);
 
        switch (comp_status) {
        case ENA_ADMIN_SUCCESS:
@@ -515,30 +530,41 @@ static int ena_com_comp_status_to_errno(u8 comp_status)
        case ENA_ADMIN_ILLEGAL_PARAMETER:
        case ENA_ADMIN_UNKNOWN_ERROR:
                return ENA_COM_INVAL;
+       case ENA_ADMIN_RESOURCE_BUSY:
+               return ENA_COM_TRY_AGAIN;
        }
 
        return ENA_COM_INVAL;
 }
 
+static void ena_delay_exponential_backoff_us(u32 exp, u32 delay_us)
+{
+       delay_us = ENA_MAX32(ENA_MIN_ADMIN_POLL_US, delay_us);
+       delay_us = ENA_MIN32(delay_us * (1U << exp), ENA_MAX_ADMIN_POLL_US);
+       ENA_USLEEP(delay_us);
+}
+
 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,
                                                     struct ena_com_admin_queue *admin_queue)
 {
        unsigned long flags = 0;
        ena_time_t timeout;
        int ret;
+       u32 exp = 0;
 
        timeout = ENA_GET_SYSTEM_TIMEOUT(admin_queue->completion_timeout);
 
        while (1) {
-                ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
-                ena_com_handle_admin_completion(admin_queue);
-                ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
+               ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
+               ena_com_handle_admin_completion(admin_queue);
+               ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
 
-                if (comp_ctx->status != ENA_CMD_SUBMITTED)
+               if (comp_ctx->status != ENA_CMD_SUBMITTED)
                        break;
 
                if (ENA_TIME_EXPIRE(timeout)) {
-                       ena_trc_err("Wait for completion (polling) timeout\n");
+                       ena_trc_err(admin_queue->ena_dev,
+                                   "Wait for completion (polling) timeout\n");
                        /* ENA didn't have any completion */
                        ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
                        admin_queue->stats.no_completion++;
@@ -549,11 +575,12 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
                        goto err;
                }
 
-               ENA_MSLEEP(ENA_POLL_MS);
+               ena_delay_exponential_backoff_us(exp++,
+                                                admin_queue->ena_dev->ena_min_poll_delay_us);
        }
 
        if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) {
-               ena_trc_err("Command was aborted\n");
+               ena_trc_err(admin_queue->ena_dev, "Command was aborted\n");
                ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
                admin_queue->stats.aborted_cmd++;
                ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
@@ -562,15 +589,16 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
        }
 
        ENA_WARN(comp_ctx->status != ENA_CMD_COMPLETED,
-                "Invalid comp status %d\n", comp_ctx->status);
+                admin_queue->ena_dev, "Invalid comp status %d\n",
+                comp_ctx->status);
 
-       ret = ena_com_comp_status_to_errno(comp_ctx->comp_status);
+       ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status);
 err:
        comp_ctxt_release(admin_queue, comp_ctx);
        return ret;
 }
 
-/**
+/*
  * Set the LLQ configurations of the firmware
  *
  * The driver provides only the enabled feature values to the device,
@@ -595,6 +623,10 @@ static int ena_com_set_llq(struct ena_com_dev *ena_dev)
        cmd.u.llq.desc_num_before_header_enabled = llq_info->descs_num_before_header;
        cmd.u.llq.descriptors_stride_ctrl_enabled = llq_info->desc_stride_ctrl;
 
+       cmd.u.llq.accel_mode.u.set.enabled_flags =
+               BIT(ENA_ADMIN_DISABLE_META_CACHING) |
+               BIT(ENA_ADMIN_LIMIT_TX_BURST);
+
        ret = ena_com_execute_admin_command(admin_queue,
                                            (struct ena_admin_aq_entry *)&cmd,
                                            sizeof(cmd),
@@ -602,7 +634,7 @@ static int ena_com_set_llq(struct ena_com_dev *ena_dev)
                                            sizeof(resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to set LLQ configurations: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to set LLQ configurations: %d\n", ret);
 
        return ret;
 }
@@ -612,6 +644,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                                   struct ena_llq_configurations *llq_default_cfg)
 {
        struct ena_com_llq_info *llq_info = &ena_dev->llq_info;
+       struct ena_admin_accel_mode_get llq_accel_mode_get;
        u16 supported_feat;
        int rc;
 
@@ -623,7 +656,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                llq_info->header_location_ctrl =
                        llq_default_cfg->llq_header_location;
        } else {
-               ena_trc_err("Invalid header location control, supported: 0x%x\n",
+               ena_trc_err(ena_dev, "Invalid header location control, supported: 0x%x\n",
                            supported_feat);
                return -EINVAL;
        }
@@ -638,12 +671,12 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                        } else if (supported_feat & ENA_ADMIN_SINGLE_DESC_PER_ENTRY) {
                                llq_info->desc_stride_ctrl = ENA_ADMIN_SINGLE_DESC_PER_ENTRY;
                        } else {
-                               ena_trc_err("Invalid desc_stride_ctrl, supported: 0x%x\n",
+                               ena_trc_err(ena_dev, "Invalid desc_stride_ctrl, supported: 0x%x\n",
                                            supported_feat);
                                return -EINVAL;
                        }
 
-                       ena_trc_err("Default llq stride ctrl is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
+                       ena_trc_err(ena_dev, "Default llq stride ctrl is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
                                    llq_default_cfg->llq_stride_ctrl,
                                    supported_feat,
                                    llq_info->desc_stride_ctrl);
@@ -667,11 +700,12 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                        llq_info->desc_list_entry_size_ctrl = ENA_ADMIN_LIST_ENTRY_SIZE_256B;
                        llq_info->desc_list_entry_size = 256;
                } else {
-                       ena_trc_err("Invalid entry_size_ctrl, supported: 0x%x\n", supported_feat);
+                       ena_trc_err(ena_dev, "Invalid entry_size_ctrl, supported: 0x%x\n",
+                                   supported_feat);
                        return -EINVAL;
                }
 
-               ena_trc_err("Default llq ring entry size is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
+               ena_trc_err(ena_dev, "Default llq ring entry size is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
                            llq_default_cfg->llq_ring_entry_size,
                            supported_feat,
                            llq_info->desc_list_entry_size);
@@ -680,7 +714,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                /* The desc list entry size should be whole multiply of 8
                 * This requirement comes from __iowrite64_copy()
                 */
-               ena_trc_err("illegal entry size %d\n",
+               ena_trc_err(ena_dev, "Illegal entry size %d\n",
                            llq_info->desc_list_entry_size);
                return -EINVAL;
        }
@@ -704,23 +738,31 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
                } else if (supported_feat & ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_8) {
                        llq_info->descs_num_before_header = ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_8;
                } else {
-                       ena_trc_err("Invalid descs_num_before_header, supported: 0x%x\n",
+                       ena_trc_err(ena_dev, "Invalid descs_num_before_header, supported: 0x%x\n",
                                    supported_feat);
                        return -EINVAL;
                }
 
-               ena_trc_err("Default llq num descs before header is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
+               ena_trc_err(ena_dev, "Default llq num descs before header is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
                            llq_default_cfg->llq_num_decs_before_header,
                            supported_feat,
                            llq_info->descs_num_before_header);
        }
+       /* Check for accelerated queue supported */
+       llq_accel_mode_get = llq_features->accel_mode.u.get;
 
-       llq_info->max_entries_in_tx_burst =
-               (u16)(llq_features->max_tx_burst_size / llq_default_cfg->llq_ring_entry_size_value);
+       llq_info->disable_meta_caching =
+               !!(llq_accel_mode_get.supported_flags &
+                  BIT(ENA_ADMIN_DISABLE_META_CACHING));
+
+       if (llq_accel_mode_get.supported_flags & BIT(ENA_ADMIN_LIMIT_TX_BURST))
+               llq_info->max_entries_in_tx_burst =
+                       llq_accel_mode_get.max_tx_burst_size /
+                       llq_default_cfg->llq_ring_entry_size_value;
 
        rc = ena_com_set_llq(ena_dev);
        if (rc)
-               ena_trc_err("Cannot set LLQ configuration: %d\n", rc);
+               ena_trc_err(ena_dev, "Cannot set LLQ configuration: %d\n", rc);
 
        return rc;
 }
@@ -746,13 +788,15 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
                ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
 
                if (comp_ctx->status == ENA_CMD_COMPLETED) {
-                       ena_trc_err("The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n",
+                       ena_trc_err(admin_queue->ena_dev,
+                                   "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, admin_queue->auto_polling ? "ON" : "OFF");
                        /* Check if fallback to polling is enabled */
                        if (admin_queue->auto_polling)
                                admin_queue->polling = true;
                } else {
-                       ena_trc_err("The ena device didn't send a completion for the admin cmd %d status %d\n",
+                       ena_trc_err(admin_queue->ena_dev,
+                                   "The ena device didn't send a completion for the admin cmd %d status %d\n",
                                    comp_ctx->cmd_opcode, comp_ctx->status);
                }
                /* Check if shifted to polling mode.
@@ -766,7 +810,7 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
                }
        }
 
-       ret = ena_com_comp_status_to_errno(comp_ctx->comp_status);
+       ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status);
 err:
        comp_ctxt_release(admin_queue, comp_ctx);
        return ret;
@@ -814,7 +858,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
        }
 
        if (unlikely(i == timeout)) {
-               ena_trc_err("reading reg failed for timeout. expected: req id[%hu] offset[%hu] actual: req id[%hu] offset[%hu]\n",
+               ena_trc_err(ena_dev, "Reading reg failed for timeout. expected: req id[%hu] offset[%hu] actual: req id[%hu] offset[%hu]\n",
                            mmio_read->seq_num,
                            offset,
                            read_resp->req_id,
@@ -824,7 +868,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
        }
 
        if (read_resp->reg_off != offset) {
-               ena_trc_err("Read failure: wrong offset provided\n");
+               ena_trc_err(ena_dev, "Read failure: wrong offset provided\n");
                ret = ENA_MMIO_READ_TIMEOUT;
        } else {
                ret = read_resp->reg_val;
@@ -883,7 +927,7 @@ static int ena_com_destroy_io_sq(struct ena_com_dev *ena_dev,
                                            sizeof(destroy_resp));
 
        if (unlikely(ret && (ret != ENA_COM_NO_DEVICE)))
-               ena_trc_err("failed to destroy io sq error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to destroy io sq error: %d\n", ret);
 
        return ret;
 }
@@ -929,16 +973,17 @@ static void ena_com_io_queue_free(struct ena_com_dev *ena_dev,
 static int wait_for_reset_state(struct ena_com_dev *ena_dev, u32 timeout,
                                u16 exp_state)
 {
-       u32 val, i;
+       u32 val, exp = 0;
+       ena_time_t timeout_stamp;
 
-       /* Convert timeout from resolution of 100ms to ENA_POLL_MS */
-       timeout = (timeout * 100) / ENA_POLL_MS;
+       /* Convert timeout from resolution of 100ms to us resolution. */
+       timeout_stamp = ENA_GET_SYSTEM_TIMEOUT(100 * 1000 * timeout);
 
-       for (i = 0; i < timeout; i++) {
+       while (1) {
                val = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);
 
                if (unlikely(val == ENA_MMIO_READ_TIMEOUT)) {
-                       ena_trc_err("Reg read timeout occurred\n");
+                       ena_trc_err(ena_dev, "Reg read timeout occurred\n");
                        return ENA_COM_TIMER_EXPIRED;
                }
 
@@ -946,10 +991,11 @@ static int wait_for_reset_state(struct ena_com_dev *ena_dev, u32 timeout,
                        exp_state)
                        return 0;
 
-               ENA_MSLEEP(ENA_POLL_MS);
-       }
+               if (ENA_TIME_EXPIRE(timeout_stamp))
+                       return ENA_COM_TIMER_EXPIRED;
 
-       return ENA_COM_TIMER_EXPIRED;
+               ena_delay_exponential_backoff_us(exp++, ena_dev->ena_min_poll_delay_us);
+       }
 }
 
 static bool ena_com_check_supported_feature_id(struct ena_com_dev *ena_dev,
@@ -977,7 +1023,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
        int ret;
 
        if (!ena_com_check_supported_feature_id(ena_dev, feature_id)) {
-               ena_trc_dbg("Feature %d isn't supported\n", feature_id);
+               ena_trc_dbg(ena_dev, "Feature %d isn't supported\n", feature_id);
                return ENA_COM_UNSUPPORTED;
        }
 
@@ -996,7 +1042,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
                                   &get_cmd.control_buffer.address,
                                   control_buf_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
@@ -1013,7 +1059,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
                                            sizeof(*get_resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to submit get_feature command %d error: %d\n",
+               ena_trc_err(ena_dev, "Failed to submit get_feature command %d error: %d\n",
                            feature_id, ret);
 
        return ret;
@@ -1032,23 +1078,30 @@ static int ena_com_get_feature(struct ena_com_dev *ena_dev,
                                      feature_ver);
 }
 
+int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev)
+{
+       return ena_dev->rss.hash_func;
+}
+
 static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev)
 {
        struct ena_admin_feature_rss_flow_hash_control *hash_key =
                (ena_dev->rss).hash_key;
 
        ENA_RSS_FILL_KEY(&hash_key->key, sizeof(hash_key->key));
-       /* The key is stored in the device in uint32_t array
-        * as well as the API requires the key to be passed in this
-        * format. Thus the size of our array should be divided by 4
+       /* The key buffer is stored in the device in an array of
+        * uint32 elements.
         */
-       hash_key->keys_num = sizeof(hash_key->key) / sizeof(uint32_t);
+       hash_key->key_parts = ENA_ADMIN_RSS_KEY_PARTS;
 }
 
 static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
 {
        struct ena_rss *rss = &ena_dev->rss;
 
+       if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_RSS_HASH_FUNCTION))
+               return ENA_COM_UNSUPPORTED;
+
        ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev,
                               sizeof(*rss->hash_key),
                               rss->hash_key,
@@ -1112,13 +1165,13 @@ static int ena_com_indirect_table_allocate(struct ena_com_dev *ena_dev,
        int ret;
 
        ret = ena_com_get_feature(ena_dev, &get_resp,
-                                 ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG, 0);
+                                 ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG, 0);
        if (unlikely(ret))
                return ret;
 
        if ((get_resp.u.ind_table.min_size > log_size) ||
            (get_resp.u.ind_table.max_size < log_size)) {
-               ena_trc_err("indirect table size doesn't fit. requested size: %d while min is:%d and max %d\n",
+               ena_trc_err(ena_dev, "Indirect table size doesn't fit. requested size: %d while min is:%d and max %d\n",
                            1 << log_size,
                            1 << get_resp.u.ind_table.min_size,
                            1 << get_resp.u.ind_table.max_size);
@@ -1222,7 +1275,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
                                           &create_cmd.sq_ba,
                                           io_sq->desc_addr.phys_addr);
                if (unlikely(ret)) {
-                       ena_trc_err("memory address set failed\n");
+                       ena_trc_err(ena_dev, "Memory address set failed\n");
                        return ret;
                }
        }
@@ -1233,7 +1286,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
                                            (struct ena_admin_acq_entry *)&cmd_completion,
                                            sizeof(cmd_completion));
        if (unlikely(ret)) {
-               ena_trc_err("Failed to create IO SQ. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to create IO SQ. error: %d\n", ret);
                return ret;
        }
 
@@ -1251,7 +1304,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
                        cmd_completion.llq_descriptors_offset);
        }
 
-       ena_trc_dbg("created sq[%u], depth[%u]\n", io_sq->idx, io_sq->q_depth);
+       ena_trc_dbg(ena_dev, "Created sq[%u], depth[%u]\n", io_sq->idx, io_sq->q_depth);
 
        return ret;
 }
@@ -1279,63 +1332,29 @@ static int ena_com_ind_tbl_convert_to_device(struct ena_com_dev *ena_dev)
        return 0;
 }
 
-static int ena_com_ind_tbl_convert_from_device(struct ena_com_dev *ena_dev)
-{
-       u16 dev_idx_to_host_tbl[ENA_TOTAL_NUM_QUEUES] = { (u16)-1 };
-       struct ena_rss *rss = &ena_dev->rss;
-       u8 idx;
-       u16 i;
-
-       for (i = 0; i < ENA_TOTAL_NUM_QUEUES; i++)
-               dev_idx_to_host_tbl[ena_dev->io_sq_queues[i].idx] = i;
-
-       for (i = 0; i < 1 << rss->tbl_log_size; i++) {
-               if (rss->rss_ind_tbl[i].cq_idx > ENA_TOTAL_NUM_QUEUES)
-                       return ENA_COM_INVAL;
-               idx = (u8)rss->rss_ind_tbl[i].cq_idx;
-
-               if (dev_idx_to_host_tbl[idx] > ENA_TOTAL_NUM_QUEUES)
-                       return ENA_COM_INVAL;
-
-               rss->host_rss_ind_tbl[i] = dev_idx_to_host_tbl[idx];
-       }
-
-       return 0;
-}
-
-static int ena_com_init_interrupt_moderation_table(struct ena_com_dev *ena_dev)
-{
-       size_t size;
-
-       size = sizeof(struct ena_intr_moder_entry) * ENA_INTR_MAX_NUM_OF_LEVELS;
-
-       ena_dev->intr_moder_tbl = ENA_MEM_ALLOC(ena_dev->dmadev, size);
-       if (!ena_dev->intr_moder_tbl)
-               return ENA_COM_NO_MEM;
-
-       ena_com_config_default_interrupt_moderation_table(ena_dev);
-
-       return 0;
-}
-
 static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev,
                                                 u16 intr_delay_resolution)
 {
-       struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
-       unsigned int i;
+       u16 prev_intr_delay_resolution = ena_dev->intr_delay_resolution;
 
-       if (!intr_delay_resolution) {
-               ena_trc_err("Illegal intr_delay_resolution provided. Going to use default 1 usec resolution\n");
-               intr_delay_resolution = 1;
+       if (unlikely(!intr_delay_resolution)) {
+               ena_trc_err(ena_dev, "Illegal intr_delay_resolution provided. Going to use default 1 usec resolution\n");
+               intr_delay_resolution = ENA_DEFAULT_INTR_DELAY_RESOLUTION;
        }
-       ena_dev->intr_delay_resolution = intr_delay_resolution;
 
        /* update Rx */
-       for (i = 0; i < ENA_INTR_MAX_NUM_OF_LEVELS; i++)
-               intr_moder_tbl[i].intr_moder_interval /= intr_delay_resolution;
+       ena_dev->intr_moder_rx_interval =
+               ena_dev->intr_moder_rx_interval *
+               prev_intr_delay_resolution /
+               intr_delay_resolution;
 
        /* update Tx */
-       ena_dev->intr_moder_tx_interval /= intr_delay_resolution;
+       ena_dev->intr_moder_tx_interval =
+               ena_dev->intr_moder_tx_interval *
+               prev_intr_delay_resolution /
+               intr_delay_resolution;
+
+       ena_dev->intr_delay_resolution = intr_delay_resolution;
 }
 
 /*****************************************************************************/
@@ -1355,23 +1374,25 @@ int ena_com_execute_admin_command(struct ena_com_admin_queue *admin_queue,
                                            comp, comp_size);
        if (IS_ERR(comp_ctx)) {
                if (comp_ctx == ERR_PTR(ENA_COM_NO_DEVICE))
-                       ena_trc_dbg("Failed to submit command [%ld]\n",
+                       ena_trc_dbg(admin_queue->ena_dev,
+                                   "Failed to submit command [%ld]\n",
                                    PTR_ERR(comp_ctx));
                else
-                       ena_trc_err("Failed to submit command [%ld]\n",
+                       ena_trc_err(admin_queue->ena_dev,
+                                   "Failed to submit command [%ld]\n",
                                    PTR_ERR(comp_ctx));
 
-               return PTR_ERR(comp_ctx);
+               return (int)PTR_ERR(comp_ctx);
        }
 
        ret = ena_com_wait_and_process_admin_cq(comp_ctx, admin_queue);
        if (unlikely(ret)) {
                if (admin_queue->running_state)
-                       ena_trc_err("Failed to process command. ret = %d\n",
-                                   ret);
+                       ena_trc_err(admin_queue->ena_dev,
+                                   "Failed to process command. ret = %d\n", ret);
                else
-                       ena_trc_dbg("Failed to process command. ret = %d\n",
-                                   ret);
+                       ena_trc_dbg(admin_queue->ena_dev,
+                                   "Failed to process command. ret = %d\n", ret);
        }
        return ret;
 }
@@ -1400,7 +1421,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
                                   &create_cmd.cq_ba,
                                   io_cq->cdesc_addr.phys_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
@@ -1410,7 +1431,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
                                            (struct ena_admin_acq_entry *)&cmd_completion,
                                            sizeof(cmd_completion));
        if (unlikely(ret)) {
-               ena_trc_err("Failed to create IO CQ. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to create IO CQ. error: %d\n", ret);
                return ret;
        }
 
@@ -1429,7 +1450,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
                        (u32 __iomem *)((uintptr_t)ena_dev->reg_bar +
                        cmd_completion.numa_node_register_offset);
 
-       ena_trc_dbg("created cq[%u], depth[%u]\n", io_cq->idx, io_cq->q_depth);
+       ena_trc_dbg(ena_dev, "Created cq[%u], depth[%u]\n", io_cq->idx, io_cq->q_depth);
 
        return ret;
 }
@@ -1439,7 +1460,7 @@ int ena_com_get_io_handlers(struct ena_com_dev *ena_dev, u16 qid,
                            struct ena_com_io_cq **io_cq)
 {
        if (qid >= ENA_TOTAL_NUM_QUEUES) {
-               ena_trc_err("Invalid queue number %d but the max is %d\n",
+               ena_trc_err(ena_dev, "Invalid queue number %d but the max is %d\n",
                            qid, ENA_TOTAL_NUM_QUEUES);
                return ENA_COM_INVAL;
        }
@@ -1474,11 +1495,12 @@ void ena_com_wait_for_abort_completion(struct ena_com_dev *ena_dev)
 {
        struct ena_com_admin_queue *admin_queue = &ena_dev->admin_queue;
        unsigned long flags = 0;
+       u32 exp = 0;
 
        ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
        while (ATOMIC32_READ(&admin_queue->outstanding_cmds) != 0) {
                ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
-               ENA_MSLEEP(ENA_POLL_MS);
+               ena_delay_exponential_backoff_us(exp++, ena_dev->ena_min_poll_delay_us);
                ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
        }
        ENA_SPINLOCK_UNLOCK(admin_queue->q_lock, flags);
@@ -1504,7 +1526,7 @@ int ena_com_destroy_io_cq(struct ena_com_dev *ena_dev,
                                            sizeof(destroy_resp));
 
        if (unlikely(ret && (ret != ENA_COM_NO_DEVICE)))
-               ena_trc_err("Failed to destroy IO CQ. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to destroy IO CQ. error: %d\n", ret);
 
        return ret;
 }
@@ -1528,7 +1550,7 @@ void ena_com_admin_aenq_enable(struct ena_com_dev *ena_dev)
 {
        u16 depth = ena_dev->aenq.q_depth;
 
-       ENA_WARN(ena_dev->aenq.head != depth, "Invalid AENQ state\n");
+       ENA_WARN(ena_dev->aenq.head != depth, ena_dev, "Invalid AENQ state\n");
 
        /* Init head_db to mark that all entries in the queue
         * are initially available
@@ -1546,12 +1568,12 @@ int ena_com_set_aenq_config(struct ena_com_dev *ena_dev, u32 groups_flag)
 
        ret = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_AENQ_CONFIG, 0);
        if (ret) {
-               ena_trc_info("Can't get aenq configuration\n");
+               ena_trc_info(ena_dev, "Can't get aenq configuration\n");
                return ret;
        }
 
        if ((get_resp.u.aenq.supported_groups & groups_flag) != groups_flag) {
-               ena_trc_warn("Trying to set unsupported aenq events. supported flag: 0x%x asked flag: 0x%x\n",
+               ena_trc_warn(ena_dev, "Trying to set unsupported aenq events. supported flag: 0x%x asked flag: 0x%x\n",
                             get_resp.u.aenq.supported_groups,
                             groups_flag);
                return ENA_COM_UNSUPPORTED;
@@ -1572,7 +1594,7 @@ int ena_com_set_aenq_config(struct ena_com_dev *ena_dev, u32 groups_flag)
                                            sizeof(resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to config AENQ ret: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to config AENQ ret: %d\n", ret);
 
        return ret;
 }
@@ -1580,20 +1602,20 @@ int ena_com_set_aenq_config(struct ena_com_dev *ena_dev, u32 groups_flag)
 int ena_com_get_dma_width(struct ena_com_dev *ena_dev)
 {
        u32 caps = ena_com_reg_bar_read32(ena_dev, ENA_REGS_CAPS_OFF);
-       int width;
+       u32 width;
 
        if (unlikely(caps == ENA_MMIO_READ_TIMEOUT)) {
-               ena_trc_err("Reg read timeout occurred\n");
+               ena_trc_err(ena_dev, "Reg read timeout occurred\n");
                return ENA_COM_TIMER_EXPIRED;
        }
 
        width = (caps & ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK) >>
                ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT;
 
-       ena_trc_dbg("ENA dma width: %d\n", width);
+       ena_trc_dbg(ena_dev, "ENA dma width: %d\n", width);
 
        if ((width < 32) || width > ENA_MAX_PHYS_ADDR_SIZE_BITS) {
-               ena_trc_err("DMA width illegal value: %d\n", width);
+               ena_trc_err(ena_dev, "DMA width illegal value: %d\n", width);
                return ENA_COM_INVAL;
        }
 
@@ -1617,16 +1639,16 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev)
 
        if (unlikely((ver == ENA_MMIO_READ_TIMEOUT) ||
                     (ctrl_ver == ENA_MMIO_READ_TIMEOUT))) {
-               ena_trc_err("Reg read timeout occurred\n");
+               ena_trc_err(ena_dev, "Reg read timeout occurred\n");
                return ENA_COM_TIMER_EXPIRED;
        }
 
-       ena_trc_info("ena device version: %d.%d\n",
+       ena_trc_info(ena_dev, "ENA device version: %d.%d\n",
                     (ver & ENA_REGS_VERSION_MAJOR_VERSION_MASK) >>
                     ENA_REGS_VERSION_MAJOR_VERSION_SHIFT,
                     ver & ENA_REGS_VERSION_MINOR_VERSION_MASK);
 
-       ena_trc_info("ena controller version: %d.%d.%d implementation version %d\n",
+       ena_trc_info(ena_dev, "ENA controller version: %d.%d.%d implementation version %d\n",
                     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK)
                     >> ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT,
                     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK)
@@ -1642,13 +1664,29 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev)
 
        /* Validate the ctrl version without the implementation ID */
        if (ctrl_ver_masked < MIN_ENA_CTRL_VER) {
-               ena_trc_err("ENA ctrl version is lower than the minimal ctrl version the driver supports\n");
+               ena_trc_err(ena_dev, "ENA ctrl version is lower than the minimal ctrl version the driver supports\n");
                return -1;
        }
 
        return 0;
 }
 
+static void
+ena_com_free_ena_admin_queue_comp_ctx(struct ena_com_dev *ena_dev,
+                                     struct ena_com_admin_queue *admin_queue)
+
+{
+       if (!admin_queue->comp_ctx)
+               return;
+
+       ENA_WAIT_EVENTS_DESTROY(admin_queue);
+       ENA_MEM_FREE(ena_dev->dmadev,
+                    admin_queue->comp_ctx,
+                    (admin_queue->q_depth * sizeof(struct ena_comp_ctx)));
+
+       admin_queue->comp_ctx = NULL;
+}
+
 void ena_com_admin_destroy(struct ena_com_dev *ena_dev)
 {
        struct ena_com_admin_queue *admin_queue = &ena_dev->admin_queue;
@@ -1657,12 +1695,8 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev)
        struct ena_com_aenq *aenq = &ena_dev->aenq;
        u16 size;
 
-       ENA_WAIT_EVENT_DESTROY(admin_queue->comp_ctx->wait_event);
-       if (admin_queue->comp_ctx)
-               ENA_MEM_FREE(ena_dev->dmadev,
-                            admin_queue->comp_ctx,
-                            (admin_queue->q_depth * sizeof(struct ena_comp_ctx)));
-       admin_queue->comp_ctx = NULL;
+       ena_com_free_ena_admin_queue_comp_ctx(ena_dev, admin_queue);
+
        size = ADMIN_SQ_SIZE(admin_queue->q_depth);
        if (sq->entries)
                ENA_MEM_FREE_COHERENT(ena_dev->dmadev, size, sq->entries,
@@ -1695,7 +1729,7 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling)
        ena_dev->admin_queue.polling = polling;
 }
 
-bool ena_com_get_admin_polling_mode(struct ena_com_dev * ena_dev)
+bool ena_com_get_admin_polling_mode(struct ena_com_dev *ena_dev)
 {
        return ena_dev->admin_queue.polling;
 }
@@ -1778,12 +1812,12 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,
        dev_sts = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);
 
        if (unlikely(dev_sts == ENA_MMIO_READ_TIMEOUT)) {
-               ena_trc_err("Reg read timeout occurred\n");
+               ena_trc_err(ena_dev, "Reg read timeout occurred\n");
                return ENA_COM_TIMER_EXPIRED;
        }
 
        if (!(dev_sts & ENA_REGS_DEV_STS_READY_MASK)) {
-               ena_trc_err("Device isn't ready, abort com init\n");
+               ena_trc_err(ena_dev, "Device isn't ready, abort com init\n");
                return ENA_COM_NO_DEVICE;
        }
 
@@ -1843,6 +1877,7 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,
        if (ret)
                goto error;
 
+       admin_queue->ena_dev = ena_dev;
        admin_queue->running_state = true;
 
        return 0;
@@ -1860,7 +1895,7 @@ int ena_com_create_io_queue(struct ena_com_dev *ena_dev,
        int ret;
 
        if (ctx->qid >= ENA_TOTAL_NUM_QUEUES) {
-               ena_trc_err("Qid (%d) is bigger than max num of queues (%d)\n",
+               ena_trc_err(ena_dev, "Qid (%d) is bigger than max num of queues (%d)\n",
                            ctx->qid, ENA_TOTAL_NUM_QUEUES);
                return ENA_COM_INVAL;
        }
@@ -1919,7 +1954,7 @@ void ena_com_destroy_io_queue(struct ena_com_dev *ena_dev, u16 qid)
        struct ena_com_io_cq *io_cq;
 
        if (qid >= ENA_TOTAL_NUM_QUEUES) {
-               ena_trc_err("Qid (%d) is bigger than max num of queues (%d)\n",
+               ena_trc_err(ena_dev, "Qid (%d) is bigger than max num of queues (%d)\n",
                            qid, ENA_TOTAL_NUM_QUEUES);
                return;
        }
@@ -1939,62 +1974,6 @@ int ena_com_get_link_params(struct ena_com_dev *ena_dev,
        return ena_com_get_feature(ena_dev, resp, ENA_ADMIN_LINK_CONFIG, 0);
 }
 
-int ena_com_extra_properties_strings_init(struct ena_com_dev *ena_dev)
-{
-       struct ena_admin_get_feat_resp resp;
-       struct ena_extra_properties_strings *extra_properties_strings =
-                       &ena_dev->extra_properties_strings;
-       u32 rc;
-       extra_properties_strings->size = ENA_ADMIN_EXTRA_PROPERTIES_COUNT *
-               ENA_ADMIN_EXTRA_PROPERTIES_STRING_LEN;
-
-       ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev,
-                              extra_properties_strings->size,
-                              extra_properties_strings->virt_addr,
-                              extra_properties_strings->dma_addr,
-                              extra_properties_strings->dma_handle);
-       if (unlikely(!extra_properties_strings->virt_addr)) {
-               ena_trc_err("Failed to allocate extra properties strings\n");
-               return 0;
-       }
-
-       rc = ena_com_get_feature_ex(ena_dev, &resp,
-                                   ENA_ADMIN_EXTRA_PROPERTIES_STRINGS,
-                                   extra_properties_strings->dma_addr,
-                                   extra_properties_strings->size, 0);
-       if (rc) {
-               ena_trc_dbg("Failed to get extra properties strings\n");
-               goto err;
-       }
-
-       return resp.u.extra_properties_strings.count;
-err:
-       ena_com_delete_extra_properties_strings(ena_dev);
-       return 0;
-}
-
-void ena_com_delete_extra_properties_strings(struct ena_com_dev *ena_dev)
-{
-       struct ena_extra_properties_strings *extra_properties_strings =
-                               &ena_dev->extra_properties_strings;
-
-       if (extra_properties_strings->virt_addr) {
-               ENA_MEM_FREE_COHERENT(ena_dev->dmadev,
-                                     extra_properties_strings->size,
-                                     extra_properties_strings->virt_addr,
-                                     extra_properties_strings->dma_addr,
-                                     extra_properties_strings->dma_handle);
-               extra_properties_strings->virt_addr = NULL;
-       }
-}
-
-int ena_com_get_extra_properties_flags(struct ena_com_dev *ena_dev,
-                                      struct ena_admin_get_feat_resp *resp)
-{
-       return ena_com_get_feature(ena_dev, resp,
-                                  ENA_ADMIN_EXTRA_PROPERTIES_FLAGS, 0);
-}
-
 int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
                              struct ena_com_dev_get_features_ctx *get_feat_ctx)
 {
@@ -2008,6 +1987,7 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
 
        memcpy(&get_feat_ctx->dev_attr, &get_resp.u.dev_attr,
               sizeof(get_resp.u.dev_attr));
+
        ena_dev->supported_features = get_resp.u.dev_attr.supported_features;
 
        if (ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) {
@@ -2074,17 +2054,6 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
        else
                return rc;
 
-       rc = ena_com_get_feature(ena_dev, &get_resp,
-                                ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG, 0);
-       if (!rc)
-               memcpy(&get_feat_ctx->ind_table, &get_resp.u.ind_table,
-                      sizeof(get_resp.u.ind_table));
-       else if (rc == ENA_COM_UNSUPPORTED)
-               memset(&get_feat_ctx->ind_table, 0x0,
-                      sizeof(get_feat_ctx->ind_table));
-       else
-               return rc;
-
        return 0;
 }
 
@@ -2096,10 +2065,10 @@ void ena_com_admin_q_comp_intr_handler(struct ena_com_dev *ena_dev)
 /* ena_handle_specific_aenq_event:
  * return the handler that is relevant to the specific event group
  */
-static ena_aenq_handler ena_com_get_specific_aenq_cb(struct ena_com_dev *dev,
+static ena_aenq_handler ena_com_get_specific_aenq_cb(struct ena_com_dev *ena_dev,
                                                     u16 group)
 {
-       struct ena_aenq_handlers *aenq_handlers = dev->aenq.aenq_handlers;
+       struct ena_aenq_handlers *aenq_handlers = ena_dev->aenq.aenq_handlers;
 
        if ((group < ENA_MAX_HANDLERS) && aenq_handlers->handlers[group])
                return aenq_handlers->handlers[group];
@@ -2111,11 +2080,11 @@ static ena_aenq_handler ena_com_get_specific_aenq_cb(struct ena_com_dev *dev,
  * handles the aenq incoming events.
  * pop events from the queue and apply the specific handler
  */
-void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
+void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
 {
        struct ena_admin_aenq_entry *aenq_e;
        struct ena_admin_aenq_common_desc *aenq_common;
-       struct ena_com_aenq *aenq  = &dev->aenq;
+       struct ena_com_aenq *aenq  = &ena_dev->aenq;
        u64 timestamp;
        ena_aenq_handler handler_cb;
        u16 masked_head, processed = 0;
@@ -2137,13 +2106,13 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
                timestamp = (u64)aenq_common->timestamp_low |
                        ((u64)aenq_common->timestamp_high << 32);
                ENA_TOUCH(timestamp); /* In case debug is disabled */
-               ena_trc_dbg("AENQ! Group[%x] Syndrom[%x] timestamp: [%"PRIu64"]\n",
+               ena_trc_dbg(ena_dev, "AENQ! Group[%x] Syndrome[%x] timestamp: [%" ENA_PRIu64 "s]\n",
                            aenq_common->group,
-                           aenq_common->syndrom,
+                           aenq_common->syndrome,
                            timestamp);
 
                /* Handle specific event*/
-               handler_cb = ena_com_get_specific_aenq_cb(dev,
+               handler_cb = ena_com_get_specific_aenq_cb(ena_dev,
                                                          aenq_common->group);
                handler_cb(data, aenq_e); /* call the actual event handler*/
 
@@ -2168,11 +2137,9 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
 
        /* write the aenq doorbell after all AENQ descriptors were read */
        mb();
-       ENA_REG_WRITE32_RELAXED(dev->bus, (u32)aenq->head,
-                               dev->reg_bar + ENA_REGS_AENQ_HEAD_DB_OFF);
-#ifndef MMIOWB_NOT_DEFINED
+       ENA_REG_WRITE32_RELAXED(ena_dev->bus, (u32)aenq->head,
+                               ena_dev->reg_bar + ENA_REGS_AENQ_HEAD_DB_OFF);
        mmiowb();
-#endif
 }
 
 int ena_com_dev_reset(struct ena_com_dev *ena_dev,
@@ -2186,19 +2153,19 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
 
        if (unlikely((stat == ENA_MMIO_READ_TIMEOUT) ||
                     (cap == ENA_MMIO_READ_TIMEOUT))) {
-               ena_trc_err("Reg read32 timeout occurred\n");
+               ena_trc_err(ena_dev, "Reg read32 timeout occurred\n");
                return ENA_COM_TIMER_EXPIRED;
        }
 
        if ((stat & ENA_REGS_DEV_STS_READY_MASK) == 0) {
-               ena_trc_err("Device isn't ready, can't reset device\n");
+               ena_trc_err(ena_dev, "Device isn't ready, can't reset device\n");
                return ENA_COM_INVAL;
        }
 
        timeout = (cap & ENA_REGS_CAPS_RESET_TIMEOUT_MASK) >>
                        ENA_REGS_CAPS_RESET_TIMEOUT_SHIFT;
        if (timeout == 0) {
-               ena_trc_err("Invalid timeout value\n");
+               ena_trc_err(ena_dev, "Invalid timeout value\n");
                return ENA_COM_INVAL;
        }
 
@@ -2214,7 +2181,7 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
        rc = wait_for_reset_state(ena_dev, timeout,
                                  ENA_REGS_DEV_STS_RESET_IN_PROGRESS_MASK);
        if (rc != 0) {
-               ena_trc_err("Reset indication didn't turn on\n");
+               ena_trc_err(ena_dev, "Reset indication didn't turn on\n");
                return rc;
        }
 
@@ -2222,7 +2189,7 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
        ENA_REG_WRITE32(ena_dev->bus, 0, ena_dev->reg_bar + ENA_REGS_DEV_CTL_OFF);
        rc = wait_for_reset_state(ena_dev, timeout, 0);
        if (rc != 0) {
-               ena_trc_err("Reset indication didn't turn off\n");
+               ena_trc_err(ena_dev, "Reset indication didn't turn off\n");
                return rc;
        }
 
@@ -2259,7 +2226,22 @@ static int ena_get_dev_stats(struct ena_com_dev *ena_dev,
                                             sizeof(*get_resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to get stats. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to get stats. error: %d\n", ret);
+
+       return ret;
+}
+
+int ena_com_get_eni_stats(struct ena_com_dev *ena_dev,
+                         struct ena_admin_eni_stats *stats)
+{
+       struct ena_com_stats_ctx ctx;
+       int ret;
+
+       memset(&ctx, 0x0, sizeof(ctx));
+       ret = ena_get_dev_stats(ena_dev, &ctx, ENA_ADMIN_GET_STATS_TYPE_ENI);
+       if (likely(ret == 0))
+               memcpy(stats, &ctx.get_resp.u.eni_stats,
+                      sizeof(ctx.get_resp.u.eni_stats));
 
        return ret;
 }
@@ -2273,8 +2255,8 @@ int ena_com_get_dev_basic_stats(struct ena_com_dev *ena_dev,
        memset(&ctx, 0x0, sizeof(ctx));
        ret = ena_get_dev_stats(ena_dev, &ctx, ENA_ADMIN_GET_STATS_TYPE_BASIC);
        if (likely(ret == 0))
-               memcpy(stats, &ctx.get_resp.basic_stats,
-                      sizeof(ctx.get_resp.basic_stats));
+               memcpy(stats, &ctx.get_resp.u.basic_stats,
+                      sizeof(ctx.get_resp.u.basic_stats));
 
        return ret;
 }
@@ -2287,7 +2269,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, int mtu)
        int ret;
 
        if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_MTU)) {
-               ena_trc_dbg("Feature %d isn't supported\n", ENA_ADMIN_MTU);
+               ena_trc_dbg(ena_dev, "Feature %d isn't supported\n", ENA_ADMIN_MTU);
                return ENA_COM_UNSUPPORTED;
        }
 
@@ -2297,7 +2279,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, int mtu)
        cmd.aq_common_descriptor.opcode = ENA_ADMIN_SET_FEATURE;
        cmd.aq_common_descriptor.flags = 0;
        cmd.feat_common.feature_id = ENA_ADMIN_MTU;
-       cmd.u.mtu.mtu = mtu;
+       cmd.u.mtu.mtu = (u32)mtu;
 
        ret = ena_com_execute_admin_command(admin_queue,
                                            (struct ena_admin_aq_entry *)&cmd,
@@ -2306,7 +2288,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, int mtu)
                                            sizeof(resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to set mtu %d. error: %d\n", mtu, ret);
+               ena_trc_err(ena_dev, "Failed to set mtu %d. error: %d\n", mtu, ret);
 
        return ret;
 }
@@ -2320,7 +2302,7 @@ int ena_com_get_offload_settings(struct ena_com_dev *ena_dev,
        ret = ena_com_get_feature(ena_dev, &resp,
                                  ENA_ADMIN_STATELESS_OFFLOAD_CONFIG, 0);
        if (unlikely(ret)) {
-               ena_trc_err("Failed to get offload capabilities %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to get offload capabilities %d\n", ret);
                return ret;
        }
 
@@ -2340,7 +2322,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
 
        if (!ena_com_check_supported_feature_id(ena_dev,
                                                ENA_ADMIN_RSS_HASH_FUNCTION)) {
-               ena_trc_dbg("Feature %d isn't supported\n",
+               ena_trc_dbg(ena_dev, "Feature %d isn't supported\n",
                            ENA_ADMIN_RSS_HASH_FUNCTION);
                return ENA_COM_UNSUPPORTED;
        }
@@ -2352,7 +2334,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
                return ret;
 
        if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) {
-               ena_trc_err("Func hash %d isn't supported by device, abort\n",
+               ena_trc_err(ena_dev, "Func hash %d isn't supported by device, abort\n",
                            rss->hash_func);
                return ENA_COM_UNSUPPORTED;
        }
@@ -2370,7 +2352,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
                                   &cmd.control_buffer.address,
                                   rss->hash_key_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
@@ -2382,7 +2364,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
                                            (struct ena_admin_acq_entry *)&resp,
                                            sizeof(resp));
        if (unlikely(ret)) {
-               ena_trc_err("Failed to set hash function %d. error: %d\n",
+               ena_trc_err(ena_dev, "Failed to set hash function %d. error: %d\n",
                            rss->hash_func, ret);
                return ENA_COM_INVAL;
        }
@@ -2394,12 +2376,14 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
                               enum ena_admin_hash_functions func,
                               const u8 *key, u16 key_len, u32 init_val)
 {
-       struct ena_rss *rss = &ena_dev->rss;
+       struct ena_admin_feature_rss_flow_hash_control *hash_key;
        struct ena_admin_get_feat_resp get_resp;
-       struct ena_admin_feature_rss_flow_hash_control *hash_key =
-               rss->hash_key;
+       enum ena_admin_hash_functions old_func;
+       struct ena_rss *rss = &ena_dev->rss;
        int rc;
 
+       hash_key = rss->hash_key;
+
        /* Make sure size is a mult of DWs */
        if (unlikely(key_len & 0x3))
                return ENA_COM_INVAL;
@@ -2411,8 +2395,8 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
        if (unlikely(rc))
                return rc;
 
-       if (!((1 << func) & get_resp.u.flow_hash_func.supported_func)) {
-               ena_trc_err("Flow hash function %d isn't supported\n", func);
+       if (!(BIT(func) & get_resp.u.flow_hash_func.supported_func)) {
+               ena_trc_err(ena_dev, "Flow hash function %d isn't supported\n", func);
                return ENA_COM_UNSUPPORTED;
        }
 
@@ -2420,43 +2404,44 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
        case ENA_ADMIN_TOEPLITZ:
                if (key) {
                        if (key_len != sizeof(hash_key->key)) {
-                               ena_trc_err("key len (%hu) doesn't equal the supported size (%zu)\n",
+                               ena_trc_err(ena_dev, "key len (%hu) doesn't equal the supported size (%zu)\n",
                                             key_len, sizeof(hash_key->key));
                                return ENA_COM_INVAL;
                        }
                        memcpy(hash_key->key, key, key_len);
                        rss->hash_init_val = init_val;
-                       hash_key->keys_num = key_len / sizeof(u32);
+                       hash_key->key_parts = key_len / sizeof(hash_key->key[0]);
                }
                break;
        case ENA_ADMIN_CRC32:
                rss->hash_init_val = init_val;
                break;
        default:
-               ena_trc_err("Invalid hash function (%d)\n", func);
+               ena_trc_err(ena_dev, "Invalid hash function (%d)\n", func);
                return ENA_COM_INVAL;
        }
 
+       old_func = rss->hash_func;
        rss->hash_func = func;
        rc = ena_com_set_hash_function(ena_dev);
 
        /* Restore the old function */
        if (unlikely(rc))
-               ena_com_get_hash_function(ena_dev, NULL, NULL);
+               rss->hash_func = old_func;
 
        return rc;
 }
 
 int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
-                             enum ena_admin_hash_functions *func,
-                             u8 *key)
+                             enum ena_admin_hash_functions *func)
 {
        struct ena_rss *rss = &ena_dev->rss;
        struct ena_admin_get_feat_resp get_resp;
-       struct ena_admin_feature_rss_flow_hash_control *hash_key =
-               rss->hash_key;
        int rc;
 
+       if (unlikely(!func))
+               return ENA_COM_INVAL;
+
        rc = ena_com_get_feature_ex(ena_dev, &get_resp,
                                    ENA_ADMIN_RSS_HASH_FUNCTION,
                                    rss->hash_key_dma_addr,
@@ -2464,12 +2449,24 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
        if (unlikely(rc))
                return rc;
 
-       rss->hash_func = get_resp.u.flow_hash_func.selected_func;
-       if (func)
-               *func = rss->hash_func;
+       /* ENA_FFS() returns 1 in case the lsb is set */
+       rss->hash_func = ENA_FFS(get_resp.u.flow_hash_func.selected_func);
+       if (rss->hash_func)
+               rss->hash_func--;
+
+       *func = rss->hash_func;
+
+       return 0;
+}
+
+int ena_com_get_hash_key(struct ena_com_dev *ena_dev, u8 *key)
+{
+       struct ena_admin_feature_rss_flow_hash_control *hash_key =
+               ena_dev->rss.hash_key;
 
        if (key)
-               memcpy(key, hash_key->key, (size_t)(hash_key->keys_num) << 2);
+               memcpy(key, hash_key->key,
+                      (size_t)(hash_key->key_parts) * sizeof(hash_key->key[0]));
 
        return 0;
 }
@@ -2506,7 +2503,7 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
 
        if (!ena_com_check_supported_feature_id(ena_dev,
                                                ENA_ADMIN_RSS_HASH_INPUT)) {
-               ena_trc_dbg("Feature %d isn't supported\n",
+               ena_trc_dbg(ena_dev, "Feature %d isn't supported\n",
                            ENA_ADMIN_RSS_HASH_INPUT);
                return ENA_COM_UNSUPPORTED;
        }
@@ -2525,7 +2522,7 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
                                   &cmd.control_buffer.address,
                                   rss->hash_ctrl_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
        cmd.control_buffer.length = sizeof(*hash_ctrl);
@@ -2536,7 +2533,7 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
                                            (struct ena_admin_acq_entry *)&resp,
                                            sizeof(resp));
        if (unlikely(ret))
-               ena_trc_err("Failed to set hash input. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to set hash input. error: %d\n", ret);
 
        return ret;
 }
@@ -2586,7 +2583,7 @@ int ena_com_set_default_hash_ctrl(struct ena_com_dev *ena_dev)
                available_fields = hash_ctrl->selected_fields[i].fields &
                                hash_ctrl->supported_fields[i].fields;
                if (available_fields != hash_ctrl->selected_fields[i].fields) {
-                       ena_trc_err("hash control doesn't support all the desire configuration. proto %x supported %x selected %x\n",
+                       ena_trc_err(ena_dev, "Hash control doesn't support all the desire configuration. proto %x supported %x selected %x\n",
                                    i, hash_ctrl->supported_fields[i].fields,
                                    hash_ctrl->selected_fields[i].fields);
                        return ENA_COM_UNSUPPORTED;
@@ -2612,7 +2609,7 @@ int ena_com_fill_hash_ctrl(struct ena_com_dev *ena_dev,
        int rc;
 
        if (proto >= ENA_ADMIN_RSS_PROTO_NUM) {
-               ena_trc_err("Invalid proto num (%u)\n", proto);
+               ena_trc_err(ena_dev, "Invalid proto num (%u)\n", proto);
                return ENA_COM_INVAL;
        }
 
@@ -2624,7 +2621,7 @@ int ena_com_fill_hash_ctrl(struct ena_com_dev *ena_dev,
        /* Make sure all the fields are supported */
        supported_fields = hash_ctrl->supported_fields[proto].fields;
        if ((hash_fields & supported_fields) != hash_fields) {
-               ena_trc_err("proto %d doesn't support the required fields %x. supports only: %x\n",
+               ena_trc_err(ena_dev, "Proto %d doesn't support the required fields %x. supports only: %x\n",
                            proto, hash_fields, supported_fields);
        }
 
@@ -2664,15 +2661,15 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
        int ret;
 
        if (!ena_com_check_supported_feature_id(ena_dev,
-                                               ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG)) {
-               ena_trc_dbg("Feature %d isn't supported\n",
-                           ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG);
+                                               ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG)) {
+               ena_trc_dbg(ena_dev, "Feature %d isn't supported\n",
+                           ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG);
                return ENA_COM_UNSUPPORTED;
        }
 
        ret = ena_com_ind_tbl_convert_to_device(ena_dev);
        if (ret) {
-               ena_trc_err("Failed to convert host indirection table to device table\n");
+               ena_trc_err(ena_dev, "Failed to convert host indirection table to device table\n");
                return ret;
        }
 
@@ -2681,7 +2678,7 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
        cmd.aq_common_descriptor.opcode = ENA_ADMIN_SET_FEATURE;
        cmd.aq_common_descriptor.flags =
                ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK;
-       cmd.feat_common.feature_id = ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG;
+       cmd.feat_common.feature_id = ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG;
        cmd.u.ind_table.size = rss->tbl_log_size;
        cmd.u.ind_table.inline_index = 0xFFFFFFFF;
 
@@ -2689,11 +2686,11 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
                                   &cmd.control_buffer.address,
                                   rss->rss_ind_tbl_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
-       cmd.control_buffer.length = (1ULL << rss->tbl_log_size) *
+       cmd.control_buffer.length = (u32)(1ULL << rss->tbl_log_size) *
                sizeof(struct ena_admin_rss_ind_table_entry);
 
        ret = ena_com_execute_admin_command(admin_queue,
@@ -2703,7 +2700,7 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
                                            sizeof(resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to set indirect table. error: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to set indirect table. error: %d\n", ret);
 
        return ret;
 }
@@ -2715,11 +2712,11 @@ int ena_com_indirect_table_get(struct ena_com_dev *ena_dev, u32 *ind_tbl)
        u32 tbl_size;
        int i, rc;
 
-       tbl_size = (1ULL << rss->tbl_log_size) *
+       tbl_size = (u32)(1ULL << rss->tbl_log_size) *
                sizeof(struct ena_admin_rss_ind_table_entry);
 
        rc = ena_com_get_feature_ex(ena_dev, &get_resp,
-                                   ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG,
+                                   ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG,
                                    rss->rss_ind_tbl_dma_addr,
                                    tbl_size, 0);
        if (unlikely(rc))
@@ -2728,10 +2725,6 @@ int ena_com_indirect_table_get(struct ena_com_dev *ena_dev, u32 *ind_tbl)
        if (!ind_tbl)
                return 0;
 
-       rc = ena_com_ind_tbl_convert_from_device(ena_dev);
-       if (unlikely(rc))
-               return rc;
-
        for (i = 0; i < (1 << rss->tbl_log_size); i++)
                ind_tbl[i] = rss->host_rss_ind_tbl[i];
 
@@ -2748,12 +2741,16 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size)
        if (unlikely(rc))
                goto err_indr_tbl;
 
+       /* The following function might return unsupported in case the
+        * device doesn't support setting the key / hash function. We can safely
+        * ignore this error and have indirection table support only.
+        */
        rc = ena_com_hash_key_allocate(ena_dev);
-       if (unlikely(rc))
+       if (likely(!rc))
+               ena_com_hash_key_fill_default_key(ena_dev);
+       else if (rc != ENA_COM_UNSUPPORTED)
                goto err_hash_key;
 
-       ena_com_hash_key_fill_default_key(ena_dev);
-
        rc = ena_com_hash_ctrl_init(ena_dev);
        if (unlikely(rc))
                goto err_hash_ctrl;
@@ -2868,7 +2865,7 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
                                   &cmd.u.host_attr.debug_ba,
                                   host_attr->debug_area_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
@@ -2876,7 +2873,7 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
                                   &cmd.u.host_attr.os_info_ba,
                                   host_attr->host_info_dma_addr);
        if (unlikely(ret)) {
-               ena_trc_err("memory address set failed\n");
+               ena_trc_err(ena_dev, "Memory address set failed\n");
                return ret;
        }
 
@@ -2889,7 +2886,7 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
                                            sizeof(resp));
 
        if (unlikely(ret))
-               ena_trc_err("Failed to set host attributes: %d\n", ret);
+               ena_trc_err(ena_dev, "Failed to set host attributes: %d\n", ret);
 
        return ret;
 }
@@ -2901,44 +2898,37 @@ bool ena_com_interrupt_moderation_supported(struct ena_com_dev *ena_dev)
                                                  ENA_ADMIN_INTERRUPT_MODERATION);
 }
 
-int ena_com_update_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev,
-                                                     u32 tx_coalesce_usecs)
+static int ena_com_update_nonadaptive_moderation_interval(struct ena_com_dev *ena_dev,
+                                                         u32 coalesce_usecs,
+                                                         u32 intr_delay_resolution,
+                                                         u32 *intr_moder_interval)
 {
-       if (!ena_dev->intr_delay_resolution) {
-               ena_trc_err("Illegal interrupt delay granularity value\n");
+       if (!intr_delay_resolution) {
+               ena_trc_err(ena_dev, "Illegal interrupt delay granularity value\n");
                return ENA_COM_FAULT;
        }
 
-       ena_dev->intr_moder_tx_interval = tx_coalesce_usecs /
-               ena_dev->intr_delay_resolution;
+       *intr_moder_interval = coalesce_usecs / intr_delay_resolution;
 
        return 0;
 }
 
-int ena_com_update_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev,
-                                                     u32 rx_coalesce_usecs)
+int ena_com_update_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev,
+                                                     u32 tx_coalesce_usecs)
 {
-       if (!ena_dev->intr_delay_resolution) {
-               ena_trc_err("Illegal interrupt delay granularity value\n");
-               return ENA_COM_FAULT;
-       }
-
-       /* We use LOWEST entry of moderation table for storing
-        * nonadaptive interrupt coalescing values
-        */
-       ena_dev->intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval =
-               rx_coalesce_usecs / ena_dev->intr_delay_resolution;
-
-       return 0;
+       return ena_com_update_nonadaptive_moderation_interval(ena_dev,
+                                                             tx_coalesce_usecs,
+                                                             ena_dev->intr_delay_resolution,
+                                                             &ena_dev->intr_moder_tx_interval);
 }
 
-void ena_com_destroy_interrupt_moderation(struct ena_com_dev *ena_dev)
+int ena_com_update_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev,
+                                                     u32 rx_coalesce_usecs)
 {
-       if (ena_dev->intr_moder_tbl)
-               ENA_MEM_FREE(ena_dev->dmadev,
-                            ena_dev->intr_moder_tbl,
-                            (sizeof(struct ena_intr_moder_entry) * ENA_INTR_MAX_NUM_OF_LEVELS));
-       ena_dev->intr_moder_tbl = NULL;
+       return ena_com_update_nonadaptive_moderation_interval(ena_dev,
+                                                             rx_coalesce_usecs,
+                                                             ena_dev->intr_delay_resolution,
+                                                             &ena_dev->intr_moder_rx_interval);
 }
 
 int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
@@ -2952,12 +2942,12 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
 
        if (rc) {
                if (rc == ENA_COM_UNSUPPORTED) {
-                       ena_trc_dbg("Feature %d isn't supported\n",
+                       ena_trc_dbg(ena_dev, "Feature %d isn't supported\n",
                                    ENA_ADMIN_INTERRUPT_MODERATION);
                        rc = 0;
                } else {
-                       ena_trc_err("Failed to get interrupt moderation admin cmd. rc: %d\n",
-                                   rc);
+                       ena_trc_err(ena_dev,
+                                   "Failed to get interrupt moderation admin cmd. rc: %d\n", rc);
                }
 
                /* no moderation supported, disable adaptive support */
@@ -2965,10 +2955,6 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
                return rc;
        }
 
-       rc = ena_com_init_interrupt_moderation_table(ena_dev);
-       if (rc)
-               goto err;
-
        /* if moderation is supported by device we set adaptive moderation */
        delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution;
        ena_com_update_intr_delay_resolution(ena_dev, delay_resolution);
@@ -2977,52 +2963,6 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
        ena_com_disable_adaptive_moderation(ena_dev);
 
        return 0;
-err:
-       ena_com_destroy_interrupt_moderation(ena_dev);
-       return rc;
-}
-
-void ena_com_config_default_interrupt_moderation_table(struct ena_com_dev *ena_dev)
-{
-       struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
-
-       if (!intr_moder_tbl)
-               return;
-
-       intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval =
-               ENA_INTR_LOWEST_USECS;
-       intr_moder_tbl[ENA_INTR_MODER_LOWEST].pkts_per_interval =
-               ENA_INTR_LOWEST_PKTS;
-       intr_moder_tbl[ENA_INTR_MODER_LOWEST].bytes_per_interval =
-               ENA_INTR_LOWEST_BYTES;
-
-       intr_moder_tbl[ENA_INTR_MODER_LOW].intr_moder_interval =
-               ENA_INTR_LOW_USECS;
-       intr_moder_tbl[ENA_INTR_MODER_LOW].pkts_per_interval =
-               ENA_INTR_LOW_PKTS;
-       intr_moder_tbl[ENA_INTR_MODER_LOW].bytes_per_interval =
-               ENA_INTR_LOW_BYTES;
-
-       intr_moder_tbl[ENA_INTR_MODER_MID].intr_moder_interval =
-               ENA_INTR_MID_USECS;
-       intr_moder_tbl[ENA_INTR_MODER_MID].pkts_per_interval =
-               ENA_INTR_MID_PKTS;
-       intr_moder_tbl[ENA_INTR_MODER_MID].bytes_per_interval =
-               ENA_INTR_MID_BYTES;
-
-       intr_moder_tbl[ENA_INTR_MODER_HIGH].intr_moder_interval =
-               ENA_INTR_HIGH_USECS;
-       intr_moder_tbl[ENA_INTR_MODER_HIGH].pkts_per_interval =
-               ENA_INTR_HIGH_PKTS;
-       intr_moder_tbl[ENA_INTR_MODER_HIGH].bytes_per_interval =
-               ENA_INTR_HIGH_BYTES;
-
-       intr_moder_tbl[ENA_INTR_MODER_HIGHEST].intr_moder_interval =
-               ENA_INTR_HIGHEST_USECS;
-       intr_moder_tbl[ENA_INTR_MODER_HIGHEST].pkts_per_interval =
-               ENA_INTR_HIGHEST_PKTS;
-       intr_moder_tbl[ENA_INTR_MODER_HIGHEST].bytes_per_interval =
-               ENA_INTR_HIGHEST_BYTES;
 }
 
 unsigned int ena_com_get_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev)
@@ -3032,57 +2972,15 @@ unsigned int ena_com_get_nonadaptive_moderation_interval_tx(struct ena_com_dev *
 
 unsigned int ena_com_get_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev)
 {
-       struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
-
-       if (intr_moder_tbl)
-               return intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval;
-
-       return 0;
-}
-
-void ena_com_init_intr_moderation_entry(struct ena_com_dev *ena_dev,
-                                       enum ena_intr_moder_level level,
-                                       struct ena_intr_moder_entry *entry)
-{
-       struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
-
-       if (level >= ENA_INTR_MAX_NUM_OF_LEVELS)
-               return;
-
-       intr_moder_tbl[level].intr_moder_interval = entry->intr_moder_interval;
-       if (ena_dev->intr_delay_resolution)
-               intr_moder_tbl[level].intr_moder_interval /=
-                       ena_dev->intr_delay_resolution;
-       intr_moder_tbl[level].pkts_per_interval = entry->pkts_per_interval;
-
-       /* use hardcoded value until ethtool supports bytecount parameter */
-       if (entry->bytes_per_interval != ENA_INTR_BYTE_COUNT_NOT_SUPPORTED)
-               intr_moder_tbl[level].bytes_per_interval = entry->bytes_per_interval;
-}
-
-void ena_com_get_intr_moderation_entry(struct ena_com_dev *ena_dev,
-                                      enum ena_intr_moder_level level,
-                                      struct ena_intr_moder_entry *entry)
-{
-       struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
-
-       if (level >= ENA_INTR_MAX_NUM_OF_LEVELS)
-               return;
-
-       entry->intr_moder_interval = intr_moder_tbl[level].intr_moder_interval;
-       if (ena_dev->intr_delay_resolution)
-               entry->intr_moder_interval *= ena_dev->intr_delay_resolution;
-       entry->pkts_per_interval =
-       intr_moder_tbl[level].pkts_per_interval;
-       entry->bytes_per_interval = intr_moder_tbl[level].bytes_per_interval;
+       return ena_dev->intr_moder_rx_interval;
 }
 
 int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,
                            struct ena_admin_feature_llq_desc *llq_features,
                            struct ena_llq_configurations *llq_default_cfg)
 {
+       struct ena_com_llq_info *llq_info = &ena_dev->llq_info;
        int rc;
-       struct ena_com_llq_info *llq_info = &(ena_dev->llq_info);;
 
        if (!llq_features->max_llq_num) {
                ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
@@ -3096,8 +2994,8 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,
        ena_dev->tx_max_header_size = llq_info->desc_list_entry_size -
                (llq_info->descs_num_before_header * sizeof(struct ena_eth_io_tx_desc));
 
-       if (ena_dev->tx_max_header_size == 0) {
-               ena_trc_err("the size of the LLQ entry is smaller than needed\n");
+       if (unlikely(ena_dev->tx_max_header_size == 0)) {
+               ena_trc_err(ena_dev, "The size of the LLQ entry is smaller than needed\n");
                return -EINVAL;
        }