Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526195 > unrolled thread

[PATCH net 00/18] Update ENA driver to version 1.1.2

Started byNetanel Belgazal <netanel@annapurnalabs.com>
First post2016-11-20 10:00 +0100
Last post2016-11-20 20:00 +0100
Articles 8 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net 00/18] Update ENA driver to version 1.1.2 Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    [PATCH net 13/18] net/ena: remove redundant logic in napi callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    [PATCH net 01/18] net/ena: remove RFS support from device feature list Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    [PATCH net 15/18] net/ena: remove affinity hint from the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    [PATCH net 14/18] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    [PATCH net 09/18] net/ena: change condition for host attribute configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 10:00 +0100
    Re: [PATCH net 00/18] Update ENA driver to version 1.1.2 David Miller <davem@davemloft.net> - 2016-11-20 16:30 +0100
      Re: [PATCH net 00/18] Update ENA driver to version 1.1.2 Netanel Belgazal <netanel@annapurnalabs.com> - 2016-11-20 20:00 +0100

#1526195 — [PATCH net 00/18] Update ENA driver to version 1.1.2

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 00/18] Update ENA driver to version 1.1.2
Message-ID<sFvZ0-dB-5@gated-at.bofh.it>
Update Amazon's Elastic Network Adapter (ENA) driver version from 1.0.2 to 1.1.2

Netanel Belgazal (18):
  net/ena: remove RFS support from device feature list
  net/ena: fix queues number calculation
  net/ena: use napi_schedule_irqoff when possible
  net/ena: reduce the severity of ena printouts
  net/ena: add hardware hints capability to the driver
  net/ena: fix ethtool RSS flow configuration
  net/ena: refactor ena_get_stats64 to be atomic context safe
  net/ena: change sizeof() argument to be the type pointer
  net/ena: change condition for host attribute configuration
  net/ena: use READ_ONCE to access completion descriptors
  net/ena: fix potential access to freed memory during device reset
  net/ena: refactor skb allocation
  net/ena: remove redundant logic in napi callback for busy poll mode
  net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto
  net/ena: remove affinity hint from the driver
  net/ena: fix error handling when probe fails
  net/ena: fix NULL dereference when removing the driver after device
    reset faild
  net/ena: change driver's default timeouts and increase driver version

 drivers/net/ethernet/amazon/ena/ena_admin_defs.h |  57 +++-
 drivers/net/ethernet/amazon/ena/ena_com.c        |  96 ++++---
 drivers/net/ethernet/amazon/ena/ena_com.h        |   6 +
 drivers/net/ethernet/amazon/ena/ena_eth_com.c    |   8 +-
 drivers/net/ethernet/amazon/ena/ena_ethtool.c    |   1 -
 drivers/net/ethernet/amazon/ena/ena_netdev.c     | 326 ++++++++++++++++-------
 drivers/net/ethernet/amazon/ena/ena_netdev.h     |  30 ++-
 drivers/net/ethernet/amazon/ena/ena_regs_defs.h  |   2 +
 8 files changed, 384 insertions(+), 142 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1526196 — [PATCH net 13/18] net/ena: remove redundant logic in napi callback for busy poll mode

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 13/18] net/ena: remove redundant logic in napi callback for busy poll mode
Message-ID<sFw8F-hr-13@gated-at.bofh.it>
In reply to#1526195
sk_busy_loop can call the napi callback few million times a sec.
For each call there is unmask interrupt.
We want to reduce the number of unmasks.

Add an atomic variable that will tell the napi handler if
it was called from irq context or not.
Unmask the interrupt only from irq context.

A schenario where the driver left with missed unmask isn't feasible.
when ena_intr_msix_io is called the driver have 2 options:
1)Before napi completes and call napi_complete_done
2)After calling napi_complete_done

In the former case the napi will unmask the interrupt as needed.
In the latter case napi_complete_done will remove napi from the schedule
list so napi will be rescheduled (by ena_intr_msix_io) and interrupt
will be unmasked as desire in the 2nd napi call.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 46 +++++++++++++++++++---------
 drivers/net/ethernet/amazon/ena/ena_netdev.h |  1 +
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index b478c61..eda5fb5 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1145,26 +1145,41 @@ static int ena_io_poll(struct napi_struct *napi, int budget)
 	tx_work_done = ena_clean_tx_irq(tx_ring, tx_budget);
 	rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget);
 
-	if ((budget > rx_work_done) && (tx_budget > tx_work_done)) {
+	/* If the device is about to reset or down, avoid unmask
+	 * the interrupt and return 0 so NAPI won't reschedule
+	 */
+	if (unlikely(!test_bit(ENA_FLAG_DEV_UP, &tx_ring->adapter->flags) ||
+		     test_bit(ENA_FLAG_TRIGGER_RESET, &tx_ring->adapter->flags))) {
+		napi_complete_done(napi, 0);
+		ret = 0;
+
+	} else if ((budget > rx_work_done) && (tx_budget > tx_work_done)) {
 		napi_complete_done(napi, rx_work_done);
 
 		napi_comp_call = 1;
-		/* Tx and Rx share the same interrupt vector */
-		if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev))
-			ena_adjust_intr_moderation(rx_ring, tx_ring);
-
-		/* Update intr register: rx intr delay, tx intr delay and
-		 * interrupt unmask
+		/* Update numa and unmask the interrupt only when schedule
+		 * from the interrupt context (vs from sk_busy_loop)
 		 */
-		ena_com_update_intr_reg(&intr_reg,
-					rx_ring->smoothed_interval,
-					tx_ring->smoothed_interval,
-					true);
+		if (atomic_cmpxchg(&ena_napi->unmask_interrupt, 1, 0)) {
+			/* Tx and Rx share the same interrupt vector */
+			if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev))
+				ena_adjust_intr_moderation(rx_ring, tx_ring);
+
+			/* Update intr register: rx intr delay,
+			 * tx intr delay and interrupt unmask
+			 */
+			ena_com_update_intr_reg(&intr_reg,
+						rx_ring->smoothed_interval,
+						tx_ring->smoothed_interval,
+						true);
+
+			/* It is a shared MSI-X.
+			 * Tx and Rx CQ have pointer to it.
+			 * So we use one of them to reach the intr reg
+			 */
+			ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
+		}
 
-		/* It is a shared MSI-X. Tx and Rx CQ have pointer to it.
-		 * So we use one of them to reach the intr reg
-		 */
-		ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
 
 		ena_update_ring_numa_node(tx_ring, rx_ring);
 
@@ -1202,6 +1217,7 @@ static irqreturn_t ena_intr_msix_io(int irq, void *data)
 {
 	struct ena_napi *ena_napi = data;
 
+	atomic_set(&ena_napi->unmask_interrupt, 1);
 	napi_schedule_irqoff(&ena_napi->napi);
 
 	return IRQ_HANDLED;
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
index 2897fab..c081fd3 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
@@ -135,6 +135,7 @@ struct ena_napi {
 	struct napi_struct napi ____cacheline_aligned;
 	struct ena_ring *tx_ring;
 	struct ena_ring *rx_ring;
+	atomic_t unmask_interrupt;
 	u32 qid;
 };
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1526197 — [PATCH net 01/18] net/ena: remove RFS support from device feature list

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 01/18] net/ena: remove RFS support from device feature list
Message-ID<sFw8F-hr-9@gated-at.bofh.it>
In reply to#1526195
Remove NETIF_F_NTUPLE from netdev->features.
The ENA device driver does not support RFS acceleration.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index bfeaec5..33a760e 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2729,7 +2729,6 @@ static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat,
 	netdev->features =
 		dev_features |
 		NETIF_F_SG |
-		NETIF_F_NTUPLE |
 		NETIF_F_RXHASH |
 		NETIF_F_HIGHDMA;
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1526198 — [PATCH net 15/18] net/ena: remove affinity hint from the driver

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 15/18] net/ena: remove affinity hint from the driver
Message-ID<sFw8F-hr-11@gated-at.bofh.it>
In reply to#1526195
To allow irqbalance to better distribute the napi handler,
remove the smp affinity hint from the driver.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index eda5fb5..bff082a 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1331,8 +1331,6 @@ static int ena_request_mgmnt_irq(struct ena_adapter *adapter)
 		  "set affinity hint of mgmnt irq.to 0x%lx (irq vector: %d)\n",
 		  irq->affinity_hint_mask.bits[0], irq->vector);
 
-	irq_set_affinity_hint(irq->vector, &irq->affinity_hint_mask);
-
 	return rc;
 }
 
@@ -1362,8 +1360,6 @@ static int ena_request_io_irq(struct ena_adapter *adapter)
 		netif_dbg(adapter, ifup, adapter->netdev,
 			  "set affinity hint of irq. index %d to 0x%lx (irq vector: %d)\n",
 			  i, irq->affinity_hint_mask.bits[0], irq->vector);
-
-		irq_set_affinity_hint(irq->vector, &irq->affinity_hint_mask);
 	}
 
 	return rc;
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1526199 — [PATCH net 14/18] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 14/18] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto
Message-ID<sFw8F-hr-15@gated-at.bofh.it>
In reply to#1526195
We intend to use those fields in the future.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
index 35ae511..92bba08 100644
--- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
+++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
@@ -627,6 +627,12 @@ enum ena_admin_flow_hash_proto {
 
 	ENA_ADMIN_RSS_NOT_IP	= 7,
 
+	/* TCPv6 with extension header */
+	ENA_ADMIN_RSS_TCP6_EX	= 8,
+
+	/* IPv6 with extension header */
+	ENA_ADMIN_RSS_IP6_EX	= 9,
+
 	ENA_ADMIN_RSS_PROTO_NUM	= 16,
 };
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1526200 — [PATCH net 09/18] net/ena: change condition for host attribute configuration

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 10:00 +0100
Subject[PATCH net 09/18] net/ena: change condition for host attribute configuration
Message-ID<sFw8F-hr-17@gated-at.bofh.it>
In reply to#1526195
Move the host info config to be the first admin command that is executed.
This change require the driver to remove the 'feature check'
from host info configuration flow.
The check is removed since the supported features bitmask field
is retrieved only after calling ENA_ADMIN_DEVICE_ATTRIBUTES admin command.

If set host info is not supported an error will be returned by the device.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_com.c    | 8 +++-----
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 +++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
index edb2e81..b2891f9 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
@@ -2474,11 +2474,9 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
 
 	int ret;
 
-	if (!ena_com_check_supported_feature_id(ena_dev,
-						ENA_ADMIN_HOST_ATTR_CONFIG)) {
-		pr_warn("Set host attribute isn't supported\n");
-		return -EPERM;
-	}
+	/* Host attribute config is called before ena_com_get_dev_attr_feat
+	 * so ena_com can't check if the feature is supported.
+	 */
 
 	memset(&cmd, 0x0, sizeof(cmd));
 	admin_queue = &ena_dev->admin_queue;
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 44dc298..dd7c74b 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2387,6 +2387,8 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
 	 */
 	ena_com_set_admin_polling_mode(ena_dev, true);
 
+	ena_config_host_info(ena_dev);
+
 	/* Get Device Attributes*/
 	rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx);
 	if (rc) {
@@ -2411,11 +2413,10 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
 
 	*wd_state = !!(aenq_groups & BIT(ENA_ADMIN_KEEP_ALIVE));
 
-	ena_config_host_info(ena_dev);
-
 	return 0;
 
 err_admin_init:
+	ena_com_delete_host_info(ena_dev);
 	ena_com_admin_destroy(ena_dev);
 err_mmio_read_less:
 	ena_com_mmio_reg_read_request_destroy(ena_dev);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1526247

FromDavid Miller <davem@davemloft.net>
Date2016-11-20 16:30 +0100
Message-ID<sFCe6-4mQ-23@gated-at.bofh.it>
In reply to#1526195
From: Netanel Belgazal <netanel@annapurnalabs.com>
Date: Sun, 20 Nov 2016 10:45:29 +0200

> Update Amazon's Elastic Network Adapter (ENA) driver version from 1.0.2 to 1.1.2

This is insufficient.

You must explain what this patch series is doing, how it is doing it,
and why it is doing it that way.

This is the message that people will look at to learn what is
contained in this series of patches, and they might be looking for
keywords or explanations as to why a decision was made to add a
feature, turn a feature off, or make some other important high level
change to the driver.

[toc] | [prev] | [next] | [standalone]


#1526269

FromNetanel Belgazal <netanel@annapurnalabs.com>
Date2016-11-20 20:00 +0100
Message-ID<sFFvj-7fq-1@gated-at.bofh.it>
In reply to#1526247
Hi David,

Sorry for not being clear on my first patch set.

Those changes introduce some bug fixes, new features and some cleanups that matching the driver to the upstream standard.

Bug Fixes:
*net/ena: remove RFS support from device feature list
*net/ena: fix queues number calculation
*net/ena: fix ethtool RSS flow configuration
*net/ena: refactor ena_get_stats64 to be atomic context safe
*net/ena: fix potential access to freed memory during device reset
*net/ena: remove redundant logic in napi callback for busy poll mode
*net/ena: fix error handling when probe fails
*net/ena: fix NULL dereference when removing the driver after device
    reset faild
*net/ena: change driver's default timeouts and increase driver version

New Features:
*net/ena: add hardware hints capability to the driver
*net/ena: change condition for host attribute configuration
*net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto
*net/ena: remove affinity hint from the driver

Clean ups:
*net/ena: use napi_schedule_irqoff when possible
*net/ena: reduce the severity of ena printouts
*net/ena: change sizeof() argument to be the type pointer
*net/ena: use READ_ONCE to access completion descriptors
*net/ena: refactor skb allocation

I'll add the above description in V2 (I would like to wait a couple of days to collect more feedback about those patches).

Regards,
Netanel

On 11/20/2016 05:24 PM, David Miller wrote:
> From: Netanel Belgazal <netanel@annapurnalabs.com>
> Date: Sun, 20 Nov 2016 10:45:29 +0200
>
>> Update Amazon's Elastic Network Adapter (ENA) driver version from 1.0.2 to 1.1.2
> This is insufficient.
>
> You must explain what this patch series is doing, how it is doing it,
> and why it is doing it that way.
>
> This is the message that people will look at to learn what is
> contained in this series of patches, and they might be looking for
> keywords or explanations as to why a decision was made to add a
> feature, turn a feature off, or make some other important high level
> change to the driver.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web