From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B97E7A09F0; Wed, 16 Dec 2020 22:14:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E3DECA0E; Wed, 16 Dec 2020 22:13:34 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by dpdk.org (Postfix) with ESMTP id 0B5C0C9CA for ; Wed, 16 Dec 2020 22:13:31 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id x12so13190255plr.10 for ; Wed, 16 Dec 2020 13:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Bgvg/pp9ubxXqJY5qXM2NXJg+EIPe1bg5yUXhpJ88og=; b=xWEZWUyseJ1E9ntB+4bIhti8erETRI2jOhFzZkoN53ZTHYFP1UZStT+jEIYuX2+5Vk FRN2J7DnZoGGdwJl2GRUO/7AebdM5evOA+MIJTQHMkOlo1XRsJFDAf3tCxD8wrSkPA6w LQ6mr9XkpetZFTaTbhCHxPkHF/LAztQJjDytcRL7EpdKWHfnGLgK7NfvRUWzVWW21zuO tI4eKHySmCoIzRIczN3nVrKytWO26KG2y56RVQAauSvXWKbMg0F+LxF75vd+lZvCEC2Z It6DB51chs7pXSK9qVc5/UR4Aq2Nuk4Cc59GP9FOaoW47+aqOmLY7QMK9R67zxKdynKt szHg== 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:in-reply-to:references; bh=Bgvg/pp9ubxXqJY5qXM2NXJg+EIPe1bg5yUXhpJ88og=; b=NJCuKuLeSsAd2sHOw3AtBBkhNZJOBhEHJo8iQFC514L+8b2nDI0zuXMKBn7lNDyROM ud/wRSev5FMdZ9178d0T2adZk4Qyh4gMrZrZhktE6PugW7TuYePNNbUcHTyquwpNQkiT ycBjrsg2AiO0OHwzWs9PgNFinjm3J/FnHtBli9uPnB26dJNUPg1mbouvUQWw/Avl/QjH 6SQ50/zeDJYa5H5u1RIK630zLnV/zK0Fb77WgYZZXB4TesjMMSRAy/Bmu892rLVcAL1i ZPY5WoYDiXKGbk8pHcy7b+MmNNEMCDv/pMrzVhUs287gi/NWmnnIep6qvyHgm5x9thzX HgrA== X-Gm-Message-State: AOAM531rmy3kSU1sddQ3LpI4JP3OEN7TSWcG/STHo4SRqVD17eD5od7l cZTQRvr/LpD6tthNZiuCslCWndZNQDHiGg== X-Google-Smtp-Source: ABdhPJy3kMipxKvtiV2UQ3uQzMs68w9VkE2vHMahPr8oIYPDr3v1cc7k+cNkarRxCQBtf0u586DB/Q== X-Received: by 2002:a17:90a:fb8a:: with SMTP id cp10mr4658297pjb.136.1608153209007; Wed, 16 Dec 2020 13:13:29 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id r67sm3345614pfc.82.2020.12.16.13.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 13:13:28 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Wed, 16 Dec 2020 13:12:54 -0800 Message-Id: <20201216211257.37195-5-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216211257.37195-1-aboyer@pensando.io> References: <20201216211257.37195-1-aboyer@pensando.io> In-Reply-To: <20201210142231.63209-1-aboyer@pensando.io> References: <20201210142231.63209-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 4/7] net/ionic: fully implement remove-on-close 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ionic_dev_close() is responsible for destroying the ethdev, lif, and adapter. eth_ionic_dev_remove() calls ionic_dev_close(). Remove-on-close is now required behavior for a PMD. Remove the UNMAINTAINED flag. Signed-off-by: Andrew Boyer --- MAINTAINERS | 2 +- drivers/net/ionic/ionic_ethdev.c | 40 ++++++++++++++++---------------- drivers/net/ionic/ionic_lif.c | 15 ++++++++++++ drivers/net/ionic/ionic_lif.h | 1 + 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6787b15dc..76ed473e4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -841,7 +841,7 @@ F: doc/guides/nics/pfe.rst F: drivers/net/pfe/ F: doc/guides/nics/features/pfe.ini -Pensando ionic - UNMAINTAINED +Pensando ionic M: Andrew Boyer F: drivers/net/ionic/ F: doc/guides/nics/ionic.rst diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 54d7a6cad..7ab32a0d7 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -955,6 +955,8 @@ ionic_dev_stop(struct rte_eth_dev *eth_dev) return err; } +static void ionic_unconfigure_intr(struct ionic_adapter *adapter); + /* * Reset and stop device. */ @@ -962,6 +964,7 @@ static int ionic_dev_close(struct rte_eth_dev *eth_dev) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); + struct ionic_adapter *adapter = lif->adapter; int err; IONIC_PRINT_CALL(); @@ -974,11 +977,17 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) return -1; } - err = eth_ionic_dev_uninit(eth_dev); - if (err) { - IONIC_PRINT(ERR, "Cannot destroy LIF: %d", err); - return -1; - } + ionic_lif_free_queues(lif); + + IONIC_PRINT(NOTICE, "Removing device %s", eth_dev->device->name); + ionic_unconfigure_intr(adapter); + + rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); + + ionic_port_reset(adapter); + ionic_reset(adapter); + + rte_free(adapter); return 0; } @@ -1270,29 +1279,20 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } static int -eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused) +eth_ionic_pci_remove(struct rte_pci_device *pci_dev) { char name[RTE_ETH_NAME_MAX_LEN]; - struct ionic_adapter *adapter = NULL; struct rte_eth_dev *eth_dev; - struct ionic_lif *lif; /* Adapter lookup is using the eth_dev name */ snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name); eth_dev = rte_eth_dev_allocated(name); - if (eth_dev) { - lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - adapter = lif->adapter; - } - - if (adapter) { - ionic_unconfigure_intr(adapter); - - rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); - - rte_free(adapter); - } + if (eth_dev) + ionic_dev_close(eth_dev); + else + IONIC_PRINT(DEBUG, "Cannot find device %s", + pci_dev->device.name); return 0; } diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 4b5221b83..9b11e6310 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -920,6 +920,21 @@ ionic_lif_free(struct ionic_lif *lif) } } +void +ionic_lif_free_queues(struct ionic_lif *lif) +{ + uint32_t i; + + for (i = 0; i < lif->ntxqcqs; i++) { + ionic_dev_tx_queue_release(lif->eth_dev->data->tx_queues[i]); + lif->eth_dev->data->tx_queues[i] = NULL; + } + for (i = 0; i < lif->nrxqcqs; i++) { + ionic_dev_rx_queue_release(lif->eth_dev->data->rx_queues[i]); + lif->eth_dev->data->rx_queues[i] = NULL; + } +} + int ionic_lif_rss_config(struct ionic_lif *lif, const uint16_t types, const uint8_t *key, const uint32_t *indir) diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index c1d15dca6..cc0e4f04e 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -121,6 +121,7 @@ int ionic_lifs_size(struct ionic_adapter *ionic); int ionic_lif_alloc(struct ionic_lif *lif); void ionic_lif_free(struct ionic_lif *lif); +void ionic_lif_free_queues(struct ionic_lif *lif); int ionic_lif_init(struct ionic_lif *lif); void ionic_lif_deinit(struct ionic_lif *lif); -- 2.17.1