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 1789FA04DB; Thu, 10 Dec 2020 15:23:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 294CFC988; Thu, 10 Dec 2020 15:22:49 +0100 (CET) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id EB210C97A for ; Thu, 10 Dec 2020 15:22:47 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id t8so4211923pfg.8 for ; Thu, 10 Dec 2020 06:22:47 -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; bh=1RXgRrCcDtqB5l5mSduqMSgDlCbq9jzjJshWMYAU770=; b=Jhibdpb2ChH5wQypL66fGQCcUCh9wqXCro3nmbIK71vbsuXy0vWXoUqahE//NEJ7Te JCI5HnXspEL+HMLeb1+v1cUinBk5rkYxtOeG0dvZkHLIO/utZ5BRdi55PRA37esbRjDz Jg2ePoQpkbfJS1Qbh704zj74Z2HgZ1ULCKQpGE4iVF4wjKrt8wvKhx1V1GcCOf7NUxAH eLEdAm0asNi3B41rUAuHXYR/tp/Ucs3MU7DBFQPyBwijdTkN/pUNTWz2w5BSoaKOUCeU WK5Et8GjXMjh0+26U6SaDUJUDAyTcmoBWDpS2nXDaESlly2lOHZ7L7FOnhLwsPfetO3V f2YQ== 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=1RXgRrCcDtqB5l5mSduqMSgDlCbq9jzjJshWMYAU770=; b=Yell5PiWcqOKKFmKpfTyEXkaZsZFG+v10gZkv0Ado0tT3mcuwsj71ipm372vEgIxgf /IrxhcbCEbY6WZAXU8NE3PcYndqTeUNFjA50mKd9pTZGFxzCEoKldhabrxQxGf/KTtI2 IAb2jaNAGBcXJy1b0iEABHRX61hX9mscdchtOsMEuYOG/VadjykBLmEd1TLDrOFScu/9 /Y1MgfBlLgHkF26/pvEly5XiG4/VH6D+lmC2B4OvZDBy3ZL4cy4v/grJ5hQ/4P6hUDqe 5juZq//4UJE00t7HD7J7MwVekV2WwFjP+ZGs425dvbq4uXN1yg6LS4ARBZbBh67blq8d /Ktw== X-Gm-Message-State: AOAM531KSs37nFyjIeZCUKNHnoZWrZY0TmFlPw22L9d0fxjxxvwudmaH x/hErJnu4W+nMdu4W7KeuoRUPsnO8SuHpA== X-Google-Smtp-Source: ABdhPJzgHO32GfJdY0gGLbKMGIUWHDoqBdrbI1AwFFQ/KDfD/8R0+tz8wHsecQYV+rFaEO4ITxv23g== X-Received: by 2002:a17:90a:7844:: with SMTP id y4mr7967184pjl.68.1607610166028; Thu, 10 Dec 2020 06:22:46 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id n10sm6296983pge.92.2020.12.10.06.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:45 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:28 -0800 Message-Id: <20201210142231.63209-4-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201210142231.63209-1-aboyer@pensando.io> References: <20201210142231.63209-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH 3/6] 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" This is now required behavior for a PMD. Remove the UNMAINTAINED flag. Signed-off-by: Andrew Boyer --- MAINTAINERS | 2 +- drivers/net/ionic/ionic_ethdev.c | 41 ++++++++++++++++---------------- drivers/net/ionic/ionic_lif.c | 15 ++++++++++++ drivers/net/ionic/ionic_lif.h | 1 + 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7bc0010f2..fc1b09923 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -840,7 +840,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 5a360ac08..629d7068b 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -958,6 +958,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. */ @@ -965,6 +967,8 @@ 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; + uint32_t i; int err; IONIC_PRINT_CALL(); @@ -977,12 +981,21 @@ 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); + + for (i = 0; i < adapter->nlifs; i++) { + lif = adapter->lifs[i]; + rte_eth_dev_destroy(lif->eth_dev, eth_ionic_dev_uninit); } + ionic_port_reset(adapter); + ionic_reset(adapter); + + rte_free(adapter); + return 0; } @@ -1280,10 +1293,7 @@ static int eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused) { char name[RTE_ETH_NAME_MAX_LEN]; - struct ionic_adapter *adapter = NULL; struct rte_eth_dev *eth_dev; - struct ionic_lif *lif; - uint32_t i; /* Adapter lookup is using (the first) eth_dev name */ snprintf(name, sizeof(name), "net_%s_lif_0", @@ -1291,19 +1301,10 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused) 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); - - for (i = 0; i < adapter->nlifs; i++) { - lif = adapter->lifs[i]; - rte_eth_dev_destroy(lif->eth_dev, eth_ionic_dev_uninit); - } - - rte_free(adapter); + ionic_dev_close(eth_dev); + } else { + IONIC_PRINT(WARNING, "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 875c7e585..e213597ee 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -927,6 +927,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 b80931c61..bf010716e 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -122,6 +122,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