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 C134A1B1DB for ; Thu, 7 Jun 2018 11:43:46 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id v135-v6so13648944lfa.9 for ; Thu, 07 Jun 2018 02:43:46 -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=3Vitdk7ctM7aZRDSswk6hosriHw7EHcK/VUdY6MZGtM=; b=LPsWSDR3uZ6BVUSQBeXE+E+/KyCU5tiCT7GdcAVx/6LVgKDlCfhWaf/sU9iEXcjX04 3po4q4Be+T6GwUOZtUz//UBJ3MCTxnySKKquYLkCkw/GMlJI7bHv5/yi0g4sosWaCjnH WRIl+wKTzPO6En8f89pbwPTDurjQrmKl47ncFsdghkFj/2D2WCO382Zs1ZC+/D3eo2dk FKR4dkBMdi/DjTSxz1tq1d1atc9xNfmrQkPrqZvLDBrV9mkdM2raOF2aZqEyjqYJGJ8a /WsJ0fMJjCYDLyj+QhgBLedUUNH1lpYDycXFB41VOJuePYRy93Zfx8A4P41XqIx6Nov8 Teew== 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=3Vitdk7ctM7aZRDSswk6hosriHw7EHcK/VUdY6MZGtM=; b=AwxdQQnvNtnEw34MXyUReuFPSLposhZ6JAaLnVvJg6XN3j+83BT4PXUElqS/oPG9kz 8iKlWCCAObTuqFQdzxh/6Si0633Rh2kPD5rKBfdUy/fVmfD4hsur65iu6CyfxlqXlCNq Qhp1lN37q8k+pf1o2Tn5JuPsL2UNRg0iZC5oJJtQLr2LRrQdK1LgAtuJOPPNFS2xZmi3 VRqF9fY/e1TVk/qC3DGdmqS01dPNXjHWdNWNzyda+4UloXE2iFPNFZHGeyGygLWOZ6sz hf6UzUVg06v1wfzB6JE96yBBi2ms8MtbluPJCMwEY+peteDFCuQaw6v4KEr1deGlrtsw 5/CA== X-Gm-Message-State: APt69E3W+uRuBRysvOrX7TvkeCd6blut7FZDjTEYAk4rbjGvejjDpsFD CBM7ypeotK1I9jgg/cV12vn7TQ== X-Google-Smtp-Source: ADUXVKLjmky1PVbKxSTNgHjEi4r42i4Gp20yW9uH8dGf5Q2EYiL8gL69LZmHPQOFyxy2ihF0SXOsCg== X-Received: by 2002:a2e:401b:: with SMTP id n27-v6mr1008282lja.6.1528364626433; Thu, 07 Jun 2018 02:43:46 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:43:44 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com Date: Thu, 7 Jun 2018 11:43:07 +0200 Message-Id: <20180607094322.14312-12-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 12/27] net/ena: add checking for admin queue state 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:47 -0000 The admin queue can stop responding or became inactive due to unexpected behaviour of the device. In that case, the whole device should be restarted. Signed-off-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 37 +++++++++++++++++++++++++++++-------- drivers/net/ena/ena_ethdev.h | 2 ++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 796b6fc0a..dc253c384 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -527,6 +527,8 @@ ena_dev_reset(struct rte_eth_dev *dev) for (i = 0; i < nb_queues; ++i) ena_tx_queue_setup(eth_dev, i, adapter->tx_ring_size, 0, NULL); + adapter->trigger_reset = false; + return 0; } @@ -1400,21 +1402,40 @@ static void ena_interrupt_handler_rte(void *cb_arg) ena_com_aenq_intr_handler(ena_dev, adapter); } +static void check_for_missing_keep_alive(struct ena_adapter *adapter) +{ + if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT) + return; + + if (unlikely((rte_get_timer_cycles() - adapter->timestamp_wd) >= + adapter->keep_alive_timeout)) { + RTE_LOG(ERR, PMD, "Keep alive timeout\n"); + adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO; + adapter->trigger_reset = true; + } +} + +/* Check if admin queue is enabled */ +static void check_for_admin_com_state(struct ena_adapter *adapter) +{ + if (unlikely(!ena_com_get_admin_running_state(&adapter->ena_dev))) { + RTE_LOG(ERR, PMD, "ENA admin queue is not in running state!\n"); + adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO; + adapter->trigger_reset = true; + } +} + static void ena_timer_wd_callback(__rte_unused struct rte_timer *timer, void *arg) { struct ena_adapter *adapter = (struct ena_adapter *)arg; struct rte_eth_dev *dev = adapter->rte_dev; - if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT) - return; + check_for_missing_keep_alive(adapter); + check_for_admin_com_state(adapter); - /* Within reasonable timing range no memory barriers are needed */ - if ((rte_get_timer_cycles() - adapter->timestamp_wd) >= - adapter->keep_alive_timeout) { - RTE_LOG(ERR, PMD, "The ENA device is not responding - " - "performing device reset..."); - adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO; + if (unlikely(adapter->trigger_reset)) { + RTE_LOG(ERR, PMD, "Trigger reset is on\n"); _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); } diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index b44cca23e..1f6a7062f 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -194,6 +194,8 @@ struct ena_adapter { struct rte_timer timer_wd; uint64_t timestamp_wd; uint64_t keep_alive_timeout; + + bool trigger_reset; }; #endif /* _ENA_ETHDEV_H_ */ -- 2.14.1