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 9E92B5F4D for ; Mon, 4 Jun 2018 14:10:03 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id i83-v6so12654044lfh.5 for ; Mon, 04 Jun 2018 05:10:03 -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=j52Xxyl9iXf6d+vzXq6rEPzqAEESK8rbsvy6UzJJ714=; b=OpXUg792b+QEw7zJo1i24EWy0nHBE0Cvzr2HPOJ3GjwBDpTQfGA+2YqKPDiH4WvXwU etk9n8Bo8wvEsmgfOKvhnlPRmLSHuRcIpcQy8xpts8W94yGap9DHRrdkxoP4m5rHV2iY hwktL+ree193OYJgcJYBrymThmqqPPx/QW9vNfDDysUa3uVZx/aAloTyJV91tEQpnaFw yWf1CGf//iozsE3lbzEm+Q33wT/GhW+ApzAs4SOLJizXsb+qriex3B5dEUT25hnUhPqF XFofxGJ6+aZrguS59O76egXsR1Og5wUAMdMcl9SnYiZ2LZRAcaivT5EhFmZ91ckKuzIJ +BEQ== 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=j52Xxyl9iXf6d+vzXq6rEPzqAEESK8rbsvy6UzJJ714=; b=pf25V/+8Q3aLeDpIDBYBKpmsIbGH/jYAOWeHCWRVxd8cW4+XHNayabUvikF59jf9af J31bdDNwV9nxapJ6hbZOx3y7OoADSMUt0mXTfDuWple9deO0xXtm/hoQm3RosKomoxxF 0L29j9f9svN6vGFxgqiw6gg1lg/2Ug0skRakNW31eh5cCDErtcaEjVOoCXVdo6TOfagc pw8lzKBM5fJ9xg1yRw9d+lSWuH6SGCgjMx0sQf9LtlvL6zNy+7NF8tCNpnlEVIEe0Uey 9M0ADb2+RjEcFCu1iBNRXdiJWeTc+pOgyuCJShkCau3Lv1hlOvCIi8/+9W0BxmG2L/rL UpuA== X-Gm-Message-State: ALKqPweEfQglYYmqjvzr/wEchXVK0OiL+Pi/GJAoSUUPShhh0w5VMDX2 Hh1hUJHg4Tl5hom2v8EuO7hRbA== X-Google-Smtp-Source: ADUXVKKo4XdUm9/ZVyfokp5oGD6hWiE45ACKiCPTFAnD3PcAACJk8Be7Nqmw6wgUtu9iIhsNAtyB3Q== X-Received: by 2002:a19:4355:: with SMTP id m21-v6mr13277258lfj.121.1528114203292; Mon, 04 Jun 2018 05:10:03 -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 g23-v6sm3817415lfi.49.2018.06.04.05.10.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 05:10:02 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Mon, 4 Jun 2018 14:09:40 +0200 Message-Id: <20180604120955.17319-3-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180604120955.17319-1-mk@semihalf.com> References: <20180604120955.17319-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v2 12/26] net/ena: make watchdog configurable 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: Mon, 04 Jun 2018 12:10:03 -0000 From: Rafal Kozik Add variable wd_state to make driver functional without keep alive AENQ handler. The watchdog will be executed only if the aenq group has keep alive enabled. Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 19 +++++++++++++++---- drivers/net/ena/ena_ethdev.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index d8447215a..3f72272eb 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -204,7 +204,8 @@ static const struct rte_pci_id pci_id_ena_map[] = { static struct ena_aenq_handlers aenq_handlers; static int ena_device_init(struct ena_com_dev *ena_dev, - struct ena_com_dev_get_features_ctx *get_feat_ctx); + struct ena_com_dev_get_features_ctx *get_feat_ctx, + bool *wd_state); static int ena_dev_configure(struct rte_eth_dev *dev); static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); @@ -485,6 +486,7 @@ ena_dev_reset(struct rte_eth_dev *dev) struct ena_adapter *adapter; int nb_queues; int rc, i; + bool wd_state; adapter = (struct ena_adapter *)(dev->data->dev_private); ena_dev = &adapter->ena_dev; @@ -510,11 +512,12 @@ ena_dev_reset(struct rte_eth_dev *dev) ena_com_admin_destroy(ena_dev); ena_com_mmio_reg_read_request_destroy(ena_dev); - rc = ena_device_init(ena_dev, &get_feat_ctx); + rc = ena_device_init(ena_dev, &get_feat_ctx, &wd_state); if (rc) { PMD_INIT_LOG(CRIT, "Cannot initialize device\n"); return rc; } + adapter->wd_state = wd_state; rte_intr_enable(intr_handle); ena_com_set_admin_polling_mode(ena_dev, false); @@ -1309,7 +1312,8 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) } static int ena_device_init(struct ena_com_dev *ena_dev, - struct ena_com_dev_get_features_ctx *get_feat_ctx) + struct ena_com_dev_get_features_ctx *get_feat_ctx, + bool *wd_state) { uint32_t aenq_groups; int rc; @@ -1381,6 +1385,8 @@ static int ena_device_init(struct ena_com_dev *ena_dev, goto err_admin_init; } + *wd_state = !!(aenq_groups & BIT(ENA_ADMIN_KEEP_ALIVE)); + return 0; err_admin_init: @@ -1404,6 +1410,9 @@ static void ena_interrupt_handler_rte(void *cb_arg) static void check_for_missing_keep_alive(struct ena_adapter *adapter) { + if (!adapter->wd_state) + return; + if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT) return; @@ -1452,6 +1461,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) int queue_size, rc; static int adapters_found; + bool wd_state; memset(adapter, 0, sizeof(struct ena_adapter)); ena_dev = &adapter->ena_dev; @@ -1495,11 +1505,12 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) adapter->id_number); /* device specific initialization routine */ - rc = ena_device_init(ena_dev, &get_feat_ctx); + rc = ena_device_init(ena_dev, &get_feat_ctx, &wd_state); if (rc) { PMD_INIT_LOG(CRIT, "Failed to init ENA device"); return -1; } + adapter->wd_state = wd_state; ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST; adapter->num_queues = get_feat_ctx.max_queues.max_sq_num; diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index 1f6a7062f..594e643e2 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -196,6 +196,8 @@ struct ena_adapter { uint64_t keep_alive_timeout; bool trigger_reset; + + bool wd_state; }; #endif /* _ENA_ETHDEV_H_ */ -- 2.14.1