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

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
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -731,7 +731,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
	if (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,
@@ -2195,7 +2195,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
	if (unlikely(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",
		       rss->hash_func);
		return -EOPNOTSUPP;
@@ -2280,6 +2280,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
		return -EINVAL;
	}

	rss->hash_func = func;
	rc = ena_com_set_hash_function(ena_dev);

	/* Restore the old function */
@@ -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 */
	delay_resolution = get_resp.u.intr_moderation.intr_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;
err:
+2 −2
Original line number Diff line number Diff line
@@ -697,8 +697,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
	if (indir) {
		for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) {
			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)) {
				netif_err(adapter, drv, netdev,
					  "Cannot fill indirect table (index is too large)\n");
+17 −11
Original line number Diff line number Diff line
@@ -224,28 +224,23 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid)
	if (!tx_ring->tx_buffer_info) {
		tx_ring->tx_buffer_info = vzalloc(size);
		if (!tx_ring->tx_buffer_info)
			return -ENOMEM;
			goto err_tx_buffer_info;
	}

	size = sizeof(u16) * tx_ring->ring_size;
	tx_ring->free_tx_ids = vzalloc_node(size, node);
	if (!tx_ring->free_tx_ids) {
		tx_ring->free_tx_ids = vzalloc(size);
		if (!tx_ring->free_tx_ids) {
			vfree(tx_ring->tx_buffer_info);
			return -ENOMEM;
		}
		if (!tx_ring->free_tx_ids)
			goto err_free_tx_ids;
	}

	size = tx_ring->tx_max_header_size;
	tx_ring->push_buf_intermediate_buf = vzalloc_node(size, node);
	if (!tx_ring->push_buf_intermediate_buf) {
		tx_ring->push_buf_intermediate_buf = vzalloc(size);
		if (!tx_ring->push_buf_intermediate_buf) {
			vfree(tx_ring->tx_buffer_info);
			vfree(tx_ring->free_tx_ids);
			return -ENOMEM;
		}
		if (!tx_ring->push_buf_intermediate_buf)
			goto err_push_buf_intermediate_buf;
	}

	/* 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)
	tx_ring->next_to_clean = 0;
	tx_ring->cpu = ena_irq->cpu;
	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
@@ -378,6 +382,7 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter,
		rx_ring->free_rx_ids = vzalloc(size);
		if (!rx_ring->free_rx_ids) {
			vfree(rx_ring->rx_buffer_info);
			rx_ring->rx_buffer_info = NULL;
			return -ENOMEM;
		}
	}
@@ -1820,6 +1825,7 @@ err_setup_rx:
err_setup_tx:
	ena_free_io_irq(adapter);
err_req_irq:
	ena_del_napi(adapter);

	return rc;
}
@@ -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->os_type = ENA_ADMIN_OS_LINUX;
	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);
	host_info->os_dist = 0;
	strncpy(host_info->os_dist_str, utsname()->release,