DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: Marcin Wojtas <mw@semihalf.com>,
	Michal Krawczyk <mk@semihalf.com>,
	Guy Tzalik <gtzalik@amazon.com>,
	Evgeny Schemeilin <evgenys@amazon.com>
Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik <rk@semihalf.com>
Subject: [dpdk-dev] [PATCH v1 06/24] net/ena: handle ENA notification
Date: Wed,  9 May 2018 14:45:50 +0200	[thread overview]
Message-ID: <20180509124552.22854-6-mk@semihalf.com> (raw)
In-Reply-To: <20180509124552.22854-1-mk@semihalf.com>

From: Rafal Kozik <rk@semihalf.com>

When ENA notifications are provided ena_notification handler is called.
It checks if received value is not corrupted and if necessary it
reports proper warnings.

Data received from NIC is parsed in ena_update_hints. Fields for
storing those information was added to ena_adapter structure.

ENA notification are enabled by setting ENA_ADMIN_NOTIFICATION flag in
aenq_groups.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index e9011e721..09a5ee6c8 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1305,7 +1305,8 @@ static int ena_device_init(struct ena_com_dev *ena_dev,
 		goto err_admin_init;
 	}

-	aenq_groups = BIT(ENA_ADMIN_LINK_CHANGE);
+	aenq_groups = BIT(ENA_ADMIN_LINK_CHANGE) |
+		      BIT(ENA_ADMIN_NOTIFICATION);

 	aenq_groups &= get_feat_ctx->aenq.supported_groups;
 	rc = ena_com_set_aenq_config(ena_dev, aenq_groups);
@@ -1781,6 +1782,19 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return i;
 }

+static void ena_update_hints(struct ena_adapter *adapter,
+			     struct ena_admin_ena_hw_hints *hints)
+{
+	if (hints->admin_completion_tx_timeout)
+		adapter->ena_dev.admin_queue.completion_timeout =
+			hints->admin_completion_tx_timeout * 1000;
+
+	if (hints->mmio_read_timeout)
+		/* convert to usec */
+		adapter->ena_dev.mmio_read.reg_read_to =
+			hints->mmio_read_timeout * 1000;
+}
+
 static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				  uint16_t nb_pkts)
 {
@@ -1976,6 +1990,29 @@ static void ena_update_on_link_change(void *adapter_data,
 	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

+static void ena_notification(void *data,
+			     struct ena_admin_aenq_entry *aenq_e)
+{
+	struct ena_adapter *adapter = (struct ena_adapter *)data;
+	struct ena_admin_ena_hw_hints *hints;
+
+	if (aenq_e->aenq_common_desc.group != ENA_ADMIN_NOTIFICATION)
+		RTE_LOG(WARNING, PMD, "Invalid group(%x) expected %x\n",
+			aenq_e->aenq_common_desc.group,
+			ENA_ADMIN_NOTIFICATION);
+
+	switch (aenq_e->aenq_common_desc.syndrom) {
+	case ENA_ADMIN_UPDATE_HINTS:
+		hints = (struct ena_admin_ena_hw_hints *)
+			(&aenq_e->inline_data_w4);
+		ena_update_hints(adapter, hints);
+		break;
+	default:
+		RTE_LOG(ERR, PMD, "Invalid aenq notification link state %d\n",
+			aenq_e->aenq_common_desc.syndrom);
+	}
+}
+
 /**
  * This handler will called for unknown event group or unimplemented handlers
  **/
@@ -1988,7 +2025,7 @@ static void unimplemented_aenq_handler(__rte_unused void *data,
 static struct ena_aenq_handlers aenq_handlers = {
 	.handlers = {
 		[ENA_ADMIN_LINK_CHANGE] = ena_update_on_link_change,
-		[ENA_ADMIN_NOTIFICATION] = unimplemented_aenq_handler,
+		[ENA_ADMIN_NOTIFICATION] = ena_notification,
 		[ENA_ADMIN_KEEP_ALIVE] = unimplemented_aenq_handler
 	},
 	.unimplemented_handler = unimplemented_aenq_handler
--
2.14.1

  parent reply	other threads:[~2018-05-09 12:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 12:45 [dpdk-dev] [PATCH v1 01/24] net/ena: update ena_com to the newer version Michal Krawczyk
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 02/24] net/ena: remove support of legacy LLQ Michal Krawczyk
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 03/24] net/ena: add interrupt handler for admin queue Michal Krawczyk
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 04/24] net/ena: add stop and uninit routines Michal Krawczyk
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 05/24] net/ena: add LSC intr support and AENQ handling Michal Krawczyk
2018-05-09 12:45 ` Michal Krawczyk [this message]
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 07/24] net/ena: restart only initialized queues instead of all Michal Krawczyk
2018-05-09 12:45 ` [dpdk-dev] [PATCH v1 08/24] net/ena: add reset routine Michal Krawczyk
2018-05-31 15:12 ` [dpdk-dev] [PATCH v1 01/24] net/ena: update ena_com to the newer version Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180509124552.22854-6-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=gtzalik@amazon.com \
    --cc=matua@amazon.com \
    --cc=mw@semihalf.com \
    --cc=rk@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).