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 769171B20E for ; Thu, 7 Jun 2018 11:43:49 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id d24-v6so13633669lfa.8 for ; Thu, 07 Jun 2018 02:43:49 -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=wk7JyfEThpLElCOf4/NtjEdXAxO31339W9r8YjTmMtw=; b=EwnAyNNiPsTlF/vJS3fhbly6nZ6Vv6aWyyKfvHwx8ERsSIVV0CD5+GsbASpEllWoYe pnKA51LnlaOlEySXd3lbLdSOT6i0FNW1nCDDg+HVBrpvNS1YXbspfCVHihrHeTks32Fq 8py2oNT1KkX1rUOO4V/V906VBTm0VjQmQdqvRlrb/x0kUavPAEW1dgIo/hxFoBU87rEU CJkHqfYUjmL2HvClmfwCtmpkDBWsFfla8fTUyHorn4H1RUL+8LCiIz0BR+lbENYAZfIn fahZHMYRWPlYVNaSqGuMymKE13Lx4hrFwvA0bpUYSGGlE2F23IAlFNbN/HwI9Z1oN28S ogeA== 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=wk7JyfEThpLElCOf4/NtjEdXAxO31339W9r8YjTmMtw=; b=OmaugPEyhIsFHVrD8JRoNQhcCA4fGcZLv0vXKgu/itZveYFYLUPTI3AnnfZA6JQr3Q DYd1o4bGrkpXphDemAo5cr3EkYrpPnTofwsp7yfEoAXlyqGMXAPuQpvksAMGdK2BCgt1 xPENWCUstqmeG7RnPDuPkseiuoZBewZQuQqF6UgYIOiRcUsNTus3hI/HDtnpWKsCoMyu zmdCp1SRcx07qE5EUMrES7Rfu8Xhw8aAUMgT5B9OQsjGBTwJm+MFr8CwOSv4+QTCpeiJ W/RzK2NpUVoGXyAjcJnQCFH+MLvLjrRisZo73bNzCQavUOxr6VeQkaYhXV98utHsLhBy qy/g== X-Gm-Message-State: APt69E0RF5ksUkDyJUj3xsSS8rkPt58xMYOWF8W4IORLPegdGt0Nt63U gAl0gTfH0HHhXhUMIOXIOG5qpg== X-Google-Smtp-Source: ADUXVKI2VnoXY4MzTEqX5fsSJytnMKDBTSRnmavml9KlHt7OXODghRGVeBECAIhZVEZif1LCYpeINQ== X-Received: by 2002:a2e:5047:: with SMTP id v7-v6mr1033188ljd.122.1528364629144; Thu, 07 Jun 2018 02:43:49 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:43:47 -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:08 +0200 Message-Id: <20180607094322.14312-13-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 13/27] 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: Thu, 07 Jun 2018 09:43:49 -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 dc253c384..1a15c184a 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