Thread (7 messages) flat view 7 messages, 5 authors, 2016-03-29

Re: [PATCH] net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)

From: Matt Wilson <hidden>
Date: 2016-03-15 17:41:44
Also in: lkml

On Tue, Mar 15, 2016 at 12:50:06PM +0200, Netanel Belgazal wrote:
[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/amazon/Kconfig b/drivers/net/ethernet/amazon/Kconfig
new file mode 100644
index 0000000..bc4f240d
--- /dev/null
+++ b/drivers/net/ethernet/amazon/Kconfig
@@ -0,0 +1,27 @@
+#
+# Amazon network device configuration
+#
+
+config NET_VENDOR_AMAZON
+	bool "Amazon Devices"
+	default y
+	---help---
+	  If you have a network (Ethernet) device belonging to this class, say Y.
+
+	  Note that the answer to this question doesn't directly affect the
+	  kernel: saying N will just cause the configurator to skip all
+	  the questions about amazon devices. If you say Y, you will be asked
+	  for your specific device in the following questions.
+
+if NET_VENDOR_AMAZON
+
+config ENA_ETHERNET
+	tristate "Elastic Network Adapter (ENA) support"
+	depends on (PCI_MSI && X86) || COMPILE_TEST
Remove COMPILE_TEST so that the kbuild-all robot won't complain. I
imagine that the drier should work on other systems that have MSI-X...
+	---help---
+	  This driver supports Elastic Network Adapter (ENA) adapter"
+
+	  To compile this driver as a module, choose M here.
+	  The module will be called ena.
+
+endif #NET_VENDOR_AMAZON
[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
new file mode 100644
index 0000000..41d7265
--- /dev/null
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
[...]
+static int ena_init_rx_cpu_rmap(struct ena_adapter *adapter)
+{
+	u32 i;
+	int rc;
+
+	adapter->netdev->rx_cpu_rmap = alloc_irq_cpu_rmap(adapter->num_queues);
+	if (!adapter->netdev->rx_cpu_rmap)
+		return -ENOMEM;
+	for (i = 0; i < adapter->num_queues; i++) {
+		int irq_idx = ENA_IO_IRQ_IDX(i);
+
+		rc = irq_cpu_rmap_add(adapter->netdev->rx_cpu_rmap,
+				      adapter->msix_entries[irq_idx].vector);
+		if (rc) {
+			free_irq_cpu_rmap(adapter->netdev->rx_cpu_rmap);
+			adapter->netdev->rx_cpu_rmap = NULL;
+			return rc;
+		}
+	}
+	return 0;
+}
This should be in #ifdef CONFIG_RSS_ACCEL (and elsewhere where
netdev->rx_cpu_rmap is touched).

--msw
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help