Commit f0c5bcf2 authored by David S. Miller's avatar David S. Miller

Merge branch 'ena-fixes'

Sameeh Jubran says:

====================
Bug fixes for ENA Ethernet driver

Sameeh Jubran (8):
  net: ena: fix swapped parameters when calling
    ena_com_indirect_table_fill_entry
  net: ena: fix: set freed objects to NULL to avoid failing future
    allocations
  net: ena: fix: Free napi resources when ena_up() fails
  net: ena: fix incorrect test of supported hash function
  net: ena: fix return value of ena_com_config_llq_info()
  net: ena: improve latency by disabling adaptive interrupt moderation
    by default
  net: ena: fix ena_com_fill_hash_function() implementation
  net: ena: gcc 8: fix compilation warning
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 93aa4792 f9133088
...@@ -731,7 +731,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev, ...@@ -731,7 +731,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
if (rc) if (rc)
pr_err("Cannot set LLQ configuration: %d\n", rc); pr_err("Cannot set LLQ configuration: %d\n", rc);
return 0; return rc;
} }
static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *comp_ctx, static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *comp_ctx,
...@@ -2195,7 +2195,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev) ...@@ -2195,7 +2195,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) { if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) {
pr_err("Func hash %d isn't supported by device, abort\n", pr_err("Func hash %d isn't supported by device, abort\n",
rss->hash_func); rss->hash_func);
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -2280,6 +2280,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, ...@@ -2280,6 +2280,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
return -EINVAL; return -EINVAL;
} }
rss->hash_func = func;
rc = ena_com_set_hash_function(ena_dev); rc = ena_com_set_hash_function(ena_dev);
/* Restore the old function */ /* Restore the old function */
...@@ -2802,7 +2803,11 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev) ...@@ -2802,7 +2803,11 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
/* if moderation is supported by device we set adaptive moderation */ /* if moderation is supported by device we set adaptive moderation */
delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution; delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution;
ena_com_update_intr_delay_resolution(ena_dev, delay_resolution); ena_com_update_intr_delay_resolution(ena_dev, delay_resolution);
ena_com_enable_adaptive_moderation(ena_dev);
/* Disable adaptive moderation by default - can be enabled from
* ethtool
*/
ena_com_disable_adaptive_moderation(ena_dev);
return 0; return 0;
err: err:
......
...@@ -697,8 +697,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir, ...@@ -697,8 +697,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
if (indir) { if (indir) {
for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) { for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) {
rc = ena_com_indirect_table_fill_entry(ena_dev, rc = ena_com_indirect_table_fill_entry(ena_dev,
ENA_IO_RXQ_IDX(indir[i]), i,
i); ENA_IO_RXQ_IDX(indir[i]));
if (unlikely(rc)) { if (unlikely(rc)) {
netif_err(adapter, drv, netdev, netif_err(adapter, drv, netdev,
"Cannot fill indirect table (index is too large)\n"); "Cannot fill indirect table (index is too large)\n");
......
...@@ -224,28 +224,23 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) ...@@ -224,28 +224,23 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid)
if (!tx_ring->tx_buffer_info) { if (!tx_ring->tx_buffer_info) {
tx_ring->tx_buffer_info = vzalloc(size); tx_ring->tx_buffer_info = vzalloc(size);
if (!tx_ring->tx_buffer_info) if (!tx_ring->tx_buffer_info)
return -ENOMEM; goto err_tx_buffer_info;
} }
size = sizeof(u16) * tx_ring->ring_size; size = sizeof(u16) * tx_ring->ring_size;
tx_ring->free_tx_ids = vzalloc_node(size, node); tx_ring->free_tx_ids = vzalloc_node(size, node);
if (!tx_ring->free_tx_ids) { if (!tx_ring->free_tx_ids) {
tx_ring->free_tx_ids = vzalloc(size); tx_ring->free_tx_ids = vzalloc(size);
if (!tx_ring->free_tx_ids) { if (!tx_ring->free_tx_ids)
vfree(tx_ring->tx_buffer_info); goto err_free_tx_ids;
return -ENOMEM;
}
} }
size = tx_ring->tx_max_header_size; size = tx_ring->tx_max_header_size;
tx_ring->push_buf_intermediate_buf = vzalloc_node(size, node); tx_ring->push_buf_intermediate_buf = vzalloc_node(size, node);
if (!tx_ring->push_buf_intermediate_buf) { if (!tx_ring->push_buf_intermediate_buf) {
tx_ring->push_buf_intermediate_buf = vzalloc(size); tx_ring->push_buf_intermediate_buf = vzalloc(size);
if (!tx_ring->push_buf_intermediate_buf) { if (!tx_ring->push_buf_intermediate_buf)
vfree(tx_ring->tx_buffer_info); goto err_push_buf_intermediate_buf;
vfree(tx_ring->free_tx_ids);
return -ENOMEM;
}
} }
/* Req id ring for TX out of order completions */ /* Req id ring for TX out of order completions */
...@@ -259,6 +254,15 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) ...@@ -259,6 +254,15 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid)
tx_ring->next_to_clean = 0; tx_ring->next_to_clean = 0;
tx_ring->cpu = ena_irq->cpu; tx_ring->cpu = ena_irq->cpu;
return 0; return 0;
err_push_buf_intermediate_buf:
vfree(tx_ring->free_tx_ids);
tx_ring->free_tx_ids = NULL;
err_free_tx_ids:
vfree(tx_ring->tx_buffer_info);
tx_ring->tx_buffer_info = NULL;
err_tx_buffer_info:
return -ENOMEM;
} }
/* ena_free_tx_resources - Free I/O Tx Resources per Queue /* ena_free_tx_resources - Free I/O Tx Resources per Queue
...@@ -378,6 +382,7 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter, ...@@ -378,6 +382,7 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter,
rx_ring->free_rx_ids = vzalloc(size); rx_ring->free_rx_ids = vzalloc(size);
if (!rx_ring->free_rx_ids) { if (!rx_ring->free_rx_ids) {
vfree(rx_ring->rx_buffer_info); vfree(rx_ring->rx_buffer_info);
rx_ring->rx_buffer_info = NULL;
return -ENOMEM; return -ENOMEM;
} }
} }
...@@ -1820,6 +1825,7 @@ static int ena_up(struct ena_adapter *adapter) ...@@ -1820,6 +1825,7 @@ static int ena_up(struct ena_adapter *adapter)
err_setup_tx: err_setup_tx:
ena_free_io_irq(adapter); ena_free_io_irq(adapter);
err_req_irq: err_req_irq:
ena_del_napi(adapter);
return rc; return rc;
} }
...@@ -2292,7 +2298,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, ...@@ -2292,7 +2298,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev,
host_info->bdf = (pdev->bus->number << 8) | pdev->devfn; host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
host_info->os_type = ENA_ADMIN_OS_LINUX; host_info->os_type = ENA_ADMIN_OS_LINUX;
host_info->kernel_ver = LINUX_VERSION_CODE; host_info->kernel_ver = LINUX_VERSION_CODE;
strncpy(host_info->kernel_ver_str, utsname()->version, strlcpy(host_info->kernel_ver_str, utsname()->version,
sizeof(host_info->kernel_ver_str) - 1); sizeof(host_info->kernel_ver_str) - 1);
host_info->os_dist = 0; host_info->os_dist = 0;
strncpy(host_info->os_dist_str, utsname()->release, strncpy(host_info->os_dist_str, utsname()->release,
......
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