From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by dpdk.org (Postfix) with ESMTP id 5588F2D13 for ; Thu, 7 Jun 2018 11:43:38 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id n15-v6so13629877lfn.10 for ; Thu, 07 Jun 2018 02:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8mtqtKQGkcLqm9I63xmJC5ipA5m++GQxFaD5s5+Q5+c=; b=JXVlfTsdksTK9Fc3vTqoN7TtUpQ/tXAjysMZ+hQKGbWbNfVasaRI95VQOJWnyHIumz AuHmMoWGZjBB44Z3cuyNKs47UmlXT0k8O6vF1Le9hqHq0J8wLH1rGZww11C6E0Smy8xz CQiXdICeMrAoBDw+AgmoV1nJJl+YLbifvrSsHIDL193WmRnLbl8SCMsLUgpdC0klrMNP +vXbXvsV0Ta49jWVWcBbYsh8FYU0AiGFoG4OLB+Fkohr113J8D2VA1Rhw66z2EzpVGY2 aZ/iMRv32dQBiCq6aYo+UWcwL8bTVSm05VEZ3TOB6BZqUfs4qNSM8yQAyRI7RC9wtebx wXgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8mtqtKQGkcLqm9I63xmJC5ipA5m++GQxFaD5s5+Q5+c=; b=RamPMbN9jYX3xCPG46jrvZv6+2+T4p/mep5ikcrFnvr6zy9TkvnsS2M5p+NIxCeUiy G+O0KocAqGi8sR7jYVMainSPZoLPP7iAOvPq2SRCIaafoNbCa9Eyd+JYBm6UMPC+5xX0 QYbEYDle6BUZuoXXSEPHHCJO+yWdG1Jsv6DfXyrsBS5jju5HE202KKq9uZDRS5R8kwqd YQAiNxT1HCh7/fI1cVK2ecwe3BDY8D6G5DumthCY5Y3o5TjpQHWrH9/cqJ69DHyVXczV /ob3be15sSMrmHoRGtpGMamWezKzlzlY2JozF0ekucAJCLwMMnBkKtrAvzleYlA2Wcr1 i40Q== X-Gm-Message-State: APt69E14XodFVMc07bIqC7BMcg+9ryDYYB12ToDhH6h9Hz0aBDQN1jdC fx/YvbSz67sJrygJHYna1SwYHg== X-Google-Smtp-Source: ADUXVKJNbiVUC/HCLF5/6fAnJDSNBb75tQCZuvVjIRhnaB8U21fvYSb+/cFuOTCLKv2Jl0x0xF4cyw== X-Received: by 2002:a2e:5c89:: with SMTP id q131-v6mr923865ljb.77.1528364617950; Thu, 07 Jun 2018 02:43:37 -0700 (PDT) Received: from mkPC.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p28-v6sm3612368lfh.24.2018.06.07.02.43.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:43:37 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Thu, 7 Jun 2018 11:43:02 +0200 Message-Id: <20180607094322.14312-7-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180607094322.14312-1-mk@semihalf.com> References: <20180607094322.14312-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v3 07/27] net/ena: handle ENA notification X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2018 09:43:39 -0000 From: Rafal Kozik 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 Acked-by: Michal Krawczyk --- 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 a344b2573..1b8fc0f42 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1290,7 +1290,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); @@ -1724,6 +1725,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) { @@ -1918,6 +1932,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 **/ @@ -1930,7 +1967,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