From patchwork Thu Dec 10 14:22:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84945 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77EFCA04DB; Thu, 10 Dec 2020 15:23:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 277E6C950; Thu, 10 Dec 2020 15:22:44 +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 D9B2EBE75 for ; Thu, 10 Dec 2020 15:22:42 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id f9so4201091pfc.11 for ; Thu, 10 Dec 2020 06:22:42 -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=lhzpwiWMk45NcgJJyb6v9gU53GDy4s3mlu7Hoo2zPMk=; b=ML7aw/dLhQ7kiJj3Mu0SDoEjGOFpBJAqvmnfYuSoWjEKAxNQ4nzfByE+dId779wKzo jgNUZUH/a1nthzirNNtiVKGYp4WvMwb8xMCtM4WoE3JslcOANa2B1ZVbWRXyhM5a0BWu jhVrlPoKZ6oSCK5J3C3ydZsr1TaYAIVVP4rhZ9fzksK5a2RtllqY62L4hh3donPyxt9L oCCaw9F/KkvaaRlJV5tW0jpg63kmU+5ZvBKr93VR8YDNXgTJTmaRoqequJ4AJ71DS9oe v6sXGyppbESulOfVUHTajoHZeP7JDv33mjC0K7cnaPc1hhxVNi5zWiQtLWVo6TNQO9Oi iPfA== 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=lhzpwiWMk45NcgJJyb6v9gU53GDy4s3mlu7Hoo2zPMk=; b=bjj5zV/N/w2J3KG2tyiIUDILbaaERuLk8zS1cRtvOs0Y0O+Pyv5sjbZi39ajcHU4Pq q+GssByUHdAMOqVKF5j9USm4CnLYHhK1rAfJoKveGVB7cZDXCYJpICafK6wS1no5R56W fgC40VOS4JWQ43MRHEZR2+BMTY/GjQ27Jz8LZtZziuTjIxUFmrv8pkeQTmyAb5IZyLyL mglk9qKu+Q/CnhCIhZ/7gaA0775HTk79P5+DNb1ud0ezLq14HPnKKqomnyrIHJAZJCK9 2dRwWEgUGTyUSPo7zKgkt1aVftZNEjSwsSJQiNl/fXOOkDBpZhi+h70V0XijRJnmJoDu W4Zw== X-Gm-Message-State: AOAM5320c8TYShq2x0HKFCXbo6cfy1c2gpfoT8VMZZnuPJNeT/SAiT78 b8RNe9a5iILg5b6gCk7BZzuEaZnuvyrnJw== X-Google-Smtp-Source: ABdhPJwn5GRohg99OPT1gXgOTTNIUGt5RgB90xwMM7AmvIzOtXEwUk5nOLWIlvLOUC+QGI8+9YCgJA== X-Received: by 2002:a17:90a:b38d:: with SMTP id e13mr8051226pjr.214.1607610160812; Thu, 10 Dec 2020 06:22:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:40 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:26 -0800 Message-Id: <20201210142231.63209-2-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 1/6] net/ionic: preserve RSS state unless RETA size changes 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 preserves settings across a stop/start. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 44 ++++++++++++++++------------------- drivers/net/ionic/ionic_lif.h | 1 + 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 28ae9dc8a..646c921b2 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -962,8 +962,6 @@ ionic_lif_rss_config(struct ionic_lif *lif, static int ionic_lif_rss_setup(struct ionic_lif *lif) { - size_t tbl_size = sizeof(*lif->rss_ind_tbl) * - lif->adapter->ident.lif.eth.rss_ind_tbl_sz; static const uint8_t toeplitz_symmetric_key[] = { 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, @@ -971,34 +969,35 @@ ionic_lif_rss_setup(struct ionic_lif *lif) 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, }; - uint32_t socket_id = rte_socket_id(); uint32_t i; - int err; + uint16_t tbl_sz = lif->adapter->ident.lif.eth.rss_ind_tbl_sz; IONIC_PRINT_CALL(); - lif->rss_ind_tbl_z = rte_eth_dma_zone_reserve(lif->eth_dev, - "rss_ind_tbl", - 0 /* queue_idx*/, tbl_size, IONIC_ALIGN, socket_id); - if (!lif->rss_ind_tbl_z) { - IONIC_PRINT(ERR, "OOM"); - return -ENOMEM; - } + lif->rss_ind_tbl_z = rte_eth_dma_zone_reserve(lif->eth_dev, + "rss_ind_tbl", 0 /* queue_idx */, + sizeof(*lif->rss_ind_tbl) * tbl_sz, + IONIC_ALIGN, rte_socket_id()); + if (!lif->rss_ind_tbl_z) { + IONIC_PRINT(ERR, "OOM"); + return -ENOMEM; + } - lif->rss_ind_tbl = lif->rss_ind_tbl_z->addr; - lif->rss_ind_tbl_pa = lif->rss_ind_tbl_z->iova; + lif->rss_ind_tbl = lif->rss_ind_tbl_z->addr; + lif->rss_ind_tbl_pa = lif->rss_ind_tbl_z->iova; + } - /* Fill indirection table with 'default' values */ - for (i = 0; i < lif->adapter->ident.lif.eth.rss_ind_tbl_sz; i++) - lif->rss_ind_tbl[i] = i % lif->nrxqcqs; + if (lif->rss_ind_tbl_nrxqcqs != lif->nrxqcqs) { + lif->rss_ind_tbl_nrxqcqs = lif->nrxqcqs; - err = ionic_lif_rss_config(lif, IONIC_RSS_OFFLOAD_ALL, - toeplitz_symmetric_key, NULL); - if (err) - return err; + /* Fill indirection table with 'default' values */ + for (i = 0; i < tbl_sz; i++) + lif->rss_ind_tbl[i] = i % lif->nrxqcqs; + } - return 0; + return ionic_lif_rss_config(lif, IONIC_RSS_OFFLOAD_ALL, + toeplitz_symmetric_key, NULL); } static void @@ -1578,9 +1577,6 @@ ionic_lif_start(struct ionic_lif *lif) uint32_t i; int err; - IONIC_PRINT(DEBUG, "Setting RSS configuration on port %u", - lif->port_id); - err = ionic_lif_rss_setup(lif); if (err) return err; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 8e2b42443..b80931c61 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -108,6 +108,7 @@ struct ionic_lif { uint8_t *rss_ind_tbl; rte_iova_t rss_ind_tbl_pa; const struct rte_memzone *rss_ind_tbl_z; + uint32_t rss_ind_tbl_nrxqcqs; uint32_t info_sz; struct ionic_lif_info *info; rte_iova_t info_pa; From patchwork Thu Dec 10 14:22:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84946 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CAFD4A04DB; Thu, 10 Dec 2020 15:23:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90F45C96E; Thu, 10 Dec 2020 15:22:47 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id E0CF3C96A for ; Thu, 10 Dec 2020 15:22:44 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id n7so4364716pgg.2 for ; Thu, 10 Dec 2020 06:22:44 -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=g06wwYqmRVK2Em5LTinFCFJ/u7QltAGordzsSAQRCRQ=; b=a71GkQkZ8AEgaWC0RlNNxm8AP6ymztmk1tYVkRop7AugLvwyuCDiFkTmT3ffxDRaFS 2uh/Qmm1fBI7pjiPbbPXCVBegU6Jz72/pXGpRca/EA/x3pYzK9ZFIcyKaBW0TmjRouRo 41SqiR0uPEngDhMcnkEDkkCAn4r1cx35fE7YXAhutSHd3YiufuoqE2w/DdGKDkaPh3bk krVtSvkVA4j+O0E4DOk188CSG3Z/fIuSW1WoGNtwz9Ha+ciiHzjZi1pv3HIMvXBu2F3U o3acIMtrmUzX0pxvsgi6ETkjv2kH9MVXw0M6HRgvdpa+5ZgB+jRhE0aeNpbZLV1jHPaD jNrQ== 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=g06wwYqmRVK2Em5LTinFCFJ/u7QltAGordzsSAQRCRQ=; b=lgJQFJtfTgfPYu37YcO4igSJosqcZCPchdwsCNJ1N0RVP8c6QHeoWJXSF9IPufk21m Fel1ylgfJevqZIL4/PEc1hGK5Gg+2BYS/KkWZHDEWCFPG1+6mH6HgaxLggy1yMQR2hsg 12OzuVgZEo+Lv8e4K919N+nhvgKdTeBjRfJAxX433sHuWjML/+pRqcH8JyPHA8ZvTwJh Dqbh8AwPc6CnxOqRCY1F0+sehsagPs4lz7GpwYeswwEEIfc2jAIRcSGyZWreFr6WXVcE vMljG5y9N9CoXhUYi8lew4FAKlnVS9He9+DV3bGRS4RF6LH6f6O4guk6585svwISVKsm yzwg== X-Gm-Message-State: AOAM5311hDoWqSvWEeJEmXirMJpBZVIaEAPOXZ4UI2OB8By/M4DYARHj Czrttt5ccgZn5zqCqSF8vviPjceiDR1GhA== X-Google-Smtp-Source: ABdhPJz9hET5l7pV0uPdYSrdtOuiP7BavTnkVbu39edVvwpvkmFF39MyLLIsXy1CirVZe+j3G9DlLQ== X-Received: by 2002:a17:90a:ca93:: with SMTP id y19mr7972767pjt.71.1607610164040; Thu, 10 Dec 2020 06:22:44 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:43 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:27 -0800 Message-Id: <20201210142231.63209-3-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 2/6] net/ionic: preserve RX mode across LIF stop/start 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" Otherwise, non-default settings (like PROMISC) get reset. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 646c921b2..875c7e585 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1573,7 +1573,7 @@ ionic_lif_configure(struct ionic_lif *lif) int ionic_lif_start(struct ionic_lif *lif) { - uint32_t rx_mode = 0; + uint32_t rx_mode; uint32_t i; int err; @@ -1581,16 +1581,16 @@ ionic_lif_start(struct ionic_lif *lif) if (err) return err; - IONIC_PRINT(DEBUG, "Setting RX mode on port %u", - lif->port_id); - - rx_mode |= IONIC_RX_MODE_F_UNICAST; - rx_mode |= IONIC_RX_MODE_F_MULTICAST; - rx_mode |= IONIC_RX_MODE_F_BROADCAST; + if (!lif->rx_mode) { + IONIC_PRINT(DEBUG, "Setting RX mode on %s", + lif->name); - lif->rx_mode = 0; /* set by ionic_set_rx_mode */ + rx_mode = IONIC_RX_MODE_F_UNICAST; + rx_mode |= IONIC_RX_MODE_F_MULTICAST; + rx_mode |= IONIC_RX_MODE_F_BROADCAST; - ionic_set_rx_mode(lif, rx_mode); + ionic_set_rx_mode(lif, rx_mode); + } IONIC_PRINT(DEBUG, "Starting %u RX queues and %u TX queues " "on port %u", From patchwork Thu Dec 10 14:22:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84947 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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); From patchwork Thu Dec 10 14:22:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84948 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF761A04DB; Thu, 10 Dec 2020 15:23:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC955C9A0; Thu, 10 Dec 2020 15:22:52 +0100 (CET) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by dpdk.org (Postfix) with ESMTP id CE489C9A0 for ; Thu, 10 Dec 2020 15:22:50 +0100 (CET) Received: by mail-pl1-f176.google.com with SMTP id u4so2826366plr.12 for ; Thu, 10 Dec 2020 06:22:50 -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=CwQGXSTehIsse3YEyWnmTvpdxKSJEqLKv3i0TuxIEvo=; b=GDGQCWezoNRMcKbbetbil0fLHlJxPLT2rJQAE19dbxuzHrCoti2nLR43TPTTWCkRDt XTMHXBM+Wii+r3ZvoFX+gsqs9j0CpJHMwOFwifHu2Re8RwZFC0HoXovShM5uucOSwser CJilQe0zCl0q9VuBLTtMxvoP3YBg2rrxKaO/ArxWdfPHmp6oWvZPNJDuF5+zr7LB5o7J 5EpXzv1NnUqc1adH/b0My1GfdEYC/rkWCpfo6JlwstgF9FElZJxbKzHxAr7eOJGpPk0H k3hen4XGZBKG375cIsBdeIqMvsFAn190/wbSn3m50WbplJXoigXDphn5Qb9MuJ+6W/cs 5i4Q== 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=CwQGXSTehIsse3YEyWnmTvpdxKSJEqLKv3i0TuxIEvo=; b=A6KVjOm2rzAqceTdLELlWAd0JChkgc4NZUP+ATxPKmHRK943zQ0sGfGpXHCJBnQZR9 +BVt6oYKhM4IDf3CGdPD7x9AtxT9KPnKbJadiK1oqFzhYts2xQX604h8/ngxfFKgZdvb pV4Y/vr/wUCFhKS09BNWG87bQ9obtWmj0WRShiQ7RMF1vbTxTd4XNTPlJip13EpLGqZu f9H8gYjFiq0eAYtraN6drl5tukZfmWH8Mt4xsA/pKElXWjQV6v3xRjgECl3HQpItKYr9 lXomN7P45Arr5IQlUswafXvrRw8yhj5/0bOFvfqmVB21D/DLI3pJlpM5XFPitWXloAlm I5kg== X-Gm-Message-State: AOAM533V7qjBlGi6gM7hT7vDEajm5Evn7f8RVpexNSJOfIZetNzcaFrw 3rKpAxM7btwq/osNnz5SN2y9ogOtG5VWeQ== X-Google-Smtp-Source: ABdhPJyifVvLpRjeS0Dnyx3ISlkp+UNQ5ugXBxmsEkKvdMtBxCKqyu4NY/ci5Us2UM79Peaovdt25w== X-Received: by 2002:a17:902:b693:b029:da:e92c:fc23 with SMTP id c19-20020a170902b693b02900dae92cfc23mr6489649pls.55.1607610168734; Thu, 10 Dec 2020 06:22:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:47 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:29 -0800 Message-Id: <20201210142231.63209-5-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 4/6] net/ionic: improve link state handling 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" Add UP and FW_RESET state flags. Update the stack info when the link state changes. Convert set_link_up/set_link_down to lif_start/lif_stop. Condition reported link state on UP flag. Change lif_stop to return void. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 49 ++++++++++--------------------- drivers/net/ionic/ionic_ethdev.h | 4 +++ drivers/net/ionic/ionic_lif.c | 50 ++++++++++++++++++++++++++------ drivers/net/ionic/ionic_lif.h | 4 ++- 4 files changed, 64 insertions(+), 43 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 629d7068b..973c03a8d 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -28,8 +28,6 @@ static int ionic_dev_stop(struct rte_eth_dev *dev); static int ionic_dev_close(struct rte_eth_dev *dev); static int ionic_dev_set_link_up(struct rte_eth_dev *dev); static int ionic_dev_set_link_down(struct rte_eth_dev *dev); -static int ionic_dev_link_update(struct rte_eth_dev *eth_dev, - int wait_to_complete); static int ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev, struct rte_eth_fc_conf *fc_conf); static int ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev, @@ -236,21 +234,17 @@ static int ionic_dev_set_link_up(struct rte_eth_dev *eth_dev) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - struct ionic_adapter *adapter = lif->adapter; - struct ionic_dev *idev = &adapter->idev; int err; IONIC_PRINT_CALL(); - ionic_dev_cmd_port_state(idev, IONIC_PORT_ADMIN_STATE_UP); + err = ionic_lif_start(lif); + if (err) + IONIC_PRINT(ERR, "Could not start lif to set link up"); - err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - if (err) { - IONIC_PRINT(WARNING, "Failed to bring port UP"); - return err; - } + ionic_dev_link_update(lif->eth_dev, 0); - return 0; + return err; } /* @@ -260,24 +254,17 @@ static int ionic_dev_set_link_down(struct rte_eth_dev *eth_dev) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - struct ionic_adapter *adapter = lif->adapter; - struct ionic_dev *idev = &adapter->idev; - int err; IONIC_PRINT_CALL(); - ionic_dev_cmd_port_state(idev, IONIC_PORT_ADMIN_STATE_DOWN); + ionic_lif_stop(lif); - err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - if (err) { - IONIC_PRINT(WARNING, "Failed to bring port DOWN"); - return err; - } + ionic_dev_link_update(lif->eth_dev, 0); return 0; } -static int +int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete __rte_unused) { @@ -291,7 +278,8 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, memset(&link, 0, sizeof(link)); link.link_autoneg = ETH_LINK_AUTONEG; - if (!adapter->link_up) { + if (!adapter->link_up || + !(lif->state & IONIC_LIF_F_UP)) { /* Interface is down */ link.link_status = ETH_LINK_DOWN; link.link_duplex = ETH_LINK_HALF_DUPLEX; @@ -947,15 +935,12 @@ static int ionic_dev_stop(struct rte_eth_dev *eth_dev) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - int err; IONIC_PRINT_CALL(); - err = ionic_lif_stop(lif); - if (err) - IONIC_PRINT(ERR, "Cannot stop LIF: %d", err); + ionic_lif_stop(lif); - return err; + return 0; } static void ionic_unconfigure_intr(struct ionic_adapter *adapter); @@ -969,17 +954,12 @@ 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(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - err = ionic_lif_stop(lif); - if (err) { - IONIC_PRINT(ERR, "Cannot stop LIF: %d", err); - return -1; - } + ionic_lif_stop(lif); ionic_lif_free_queues(lif); @@ -1084,6 +1064,9 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) ionic_lif_deinit(lif); ionic_lif_free(lif); + if (!(lif->state & IONIC_LIF_F_FW_RESET)) + ionic_lif_reset(lif); + return 0; } diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index 578e2301f..6cbcd0f82 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -5,6 +5,8 @@ #ifndef _IONIC_ETHDEV_H_ #define _IONIC_ETHDEV_H_ +#include + #define IONIC_ETH_RSS_OFFLOAD_ALL ( \ ETH_RSS_IPV4 | \ ETH_RSS_NONFRAG_IPV4_TCP | \ @@ -18,5 +20,7 @@ #define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \ (IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter) +int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); + #endif /* _IONIC_ETHDEV_H_ */ diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index e213597ee..2452451be 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -65,12 +65,12 @@ ionic_qcq_disable(struct ionic_qcq *qcq) return ionic_adminq_post_wait(lif, &ctx); } -int -ionic_lif_stop(struct ionic_lif *lif __rte_unused) +void +ionic_lif_stop(struct ionic_lif *lif) { - /* Carrier OFF here */ + IONIC_PRINT_CALL(); - return 0; + lif->state &= ~IONIC_LIF_F_UP; } void @@ -1105,14 +1105,32 @@ ionic_link_status_check(struct ionic_lif *lif) return; if (link_up) { - IONIC_PRINT(DEBUG, "Link up - %d Gbps", - lif->info->status.link_speed); adapter->link_speed = lif->info->status.link_speed; + IONIC_PRINT(DEBUG, "Link up - %d Gbps", + adapter->link_speed); } else { IONIC_PRINT(DEBUG, "Link down"); } adapter->link_up = link_up; + ionic_dev_link_update(lif->eth_dev, 0); +} + +static void +ionic_lif_handle_fw_down(struct ionic_lif *lif) +{ + if (lif->state & IONIC_LIF_F_FW_RESET) + return; + + lif->state |= IONIC_LIF_F_FW_RESET; + + if (lif->state & IONIC_LIF_F_UP) { + IONIC_PRINT(NOTICE, + "Surprise FW stop, stopping %s\n", lif->name); + ionic_lif_stop(lif); + } + + IONIC_PRINT(NOTICE, "FW down, %s stopped", lif->name); } static bool @@ -1134,14 +1152,27 @@ ionic_notifyq_cb(struct ionic_cq *cq, uint32_t cq_desc_index, void *cb_arg) switch (cq_desc->event.ecode) { case IONIC_EVENT_LINK_CHANGE: IONIC_PRINT(DEBUG, - "Notifyq IONIC_EVENT_LINK_CHANGE eid=%jd link_status=%d link_speed=%d", + "Notifyq IONIC_EVENT_LINK_CHANGE %s " + "eid=%jd link_status=%d link_speed=%d", + lif->name, cq_desc->event.eid, cq_desc->link_change.link_status, cq_desc->link_change.link_speed); lif->state |= IONIC_LIF_F_LINK_CHECK_NEEDED; + break; + case IONIC_EVENT_RESET: + IONIC_PRINT(NOTICE, + "Notifyq IONIC_EVENT_RESET %s " + "eid=%jd, reset_code=%d state=%d", + lif->name, + cq_desc->event.eid, + cq_desc->reset.reset_code, + cq_desc->reset.state); + ionic_lif_handle_fw_down(lif); break; + default: IONIC_PRINT(WARNING, "Notifyq bad event ecode=%d eid=%jd", cq_desc->event.ecode, cq_desc->event.eid); @@ -1631,9 +1662,10 @@ ionic_lif_start(struct ionic_lif *lif) } } - ionic_link_status_check(lif); - /* Carrier ON here */ + lif->state |= IONIC_LIF_F_UP; + + ionic_link_status_check(lif); return 0; } diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index bf010716e..d11909746 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -77,6 +77,8 @@ struct ionic_qcq { #define IONIC_LIF_F_INITED BIT(0) #define IONIC_LIF_F_LINK_CHECK_NEEDED BIT(1) +#define IONIC_LIF_F_UP BIT(2) +#define IONIC_LIF_F_FW_RESET BIT(3) #define IONIC_LIF_NAME_MAX_SZ (32) @@ -128,7 +130,7 @@ int ionic_lif_init(struct ionic_lif *lif); void ionic_lif_deinit(struct ionic_lif *lif); int ionic_lif_start(struct ionic_lif *lif); -int ionic_lif_stop(struct ionic_lif *lif); +void ionic_lif_stop(struct ionic_lif *lif); int ionic_lif_configure(struct ionic_lif *lif); void ionic_lif_reset(struct ionic_lif *lif); From patchwork Thu Dec 10 14:22:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84949 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C538EA04DB; Thu, 10 Dec 2020 15:24:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F413EC9B6; Thu, 10 Dec 2020 15:22:55 +0100 (CET) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id BDA13C9A8 for ; Thu, 10 Dec 2020 15:22:52 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id e2so4358733pgi.5 for ; Thu, 10 Dec 2020 06:22:52 -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=BNvMlG6hvt/wHqDM4ng6uSSXIhmPdhANFyidDN2NeQU=; b=lgqQ8974VyhsvdXu5uc5sWWtgFfmChFHIxQrFwQDDtGUi/BKe2UV64eALczzTxvfzR a40vb2iGEZ4FwDjmH6Ty5B5a3nfg3Ab/VM8q7x5VTQYjGoBs8tioupmH6vCny3JIR25k +alWBFyRMmHH+6hZH5AO8O0qOAeDW4a/X3F6XvwZ6sqgtwRCXYtksV/dGrAW248Mk9Sd XJbsIwDrraviaJhpiq9MAR2O15fV+cvGdOBxeBvz9dkp+4iQfux6cjvnLUFGZbTpvl27 nJVs4CEmaiVvkZWKbiTUy114hUKW4ubbu/6dv4UlBmofr++Gu9bjILE5YoKsDMYoPRu+ 1IqA== 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=BNvMlG6hvt/wHqDM4ng6uSSXIhmPdhANFyidDN2NeQU=; b=r7rU/AjqFZXqefpnr+QpIWb7wttxJ2pJjdxsJI+QElb7/JkW66rK12QHCXlAX1/m1K oQ9QK+pNkHnldf98NHXdMi/MptzBbcNjA0KNQUpofekwBOEZBKS3/4vWJgFtR5WEmg7E 2NXvuhcWRAwrHfe1P9w1mtkRXbg39RlSuaM9TX+irgLyW+iOChyPTxOJtYChFR0e6LBI e+/euRLOsS8PDAKxnWY0VcbZs9mdDmdMxj76bW3NBK/ZY8limCVUPy8A07yqB25RZ6HX NEj8OgpM3vxHI9dRgHFVeVb0lxASKuETdOupMhjq7JYcD7QVUnes9GZmi2WnsLl+tNWS au+Q== X-Gm-Message-State: AOAM530JmRke+JqB7AgXQArq1OEuyi4cwOiMOqCDJe/JTCqwv34s9SPu 3XZWw4BmeZ9SxD4XdQVTF/iQQcIsBOQpig== X-Google-Smtp-Source: ABdhPJwWPP5SgVeb8CheG6+v8JyAgh/0schZg7gSibtsLVcSxcaj08xn5zVWYVBytfIkTp/ljthaMA== X-Received: by 2002:a63:5466:: with SMTP id e38mr6808968pgm.114.1607610170808; Thu, 10 Dec 2020 06:22:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:50 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:30 -0800 Message-Id: <20201210142231.63209-6-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 5/6] net/ionic: improve queue state handling 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" Skip ionic_lif_[rxq|txq]_init() in queue start if it's already done. Move ionic_lif_[rxq|txq]_deinit() from queue stop to queue release. This allows the queues to be restarted. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 62 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index b689c8381..d06f1246c 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -125,6 +125,8 @@ ionic_dev_tx_queue_release(void *tx_queue) IONIC_PRINT_CALL(); + ionic_lif_txq_deinit(txq); + ionic_qcq_free(txq); } @@ -137,6 +139,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) txq = eth_dev->data->tx_queues[tx_queue_id]; + eth_dev->data->tx_queue_state[tx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + /* * Note: we should better post NOP Tx desc and wait for its completion * before disabling Tx queue @@ -146,11 +151,6 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) ionic_tx_flush(&txq->cq); - ionic_lif_txq_deinit(txq); - - eth_dev->data->tx_queue_state[tx_queue_id] = - RTE_ETH_QUEUE_STATE_STOPPED; - return 0; } @@ -187,6 +187,9 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, eth_dev->data->tx_queues[tx_queue_id] = NULL; } + eth_dev->data->tx_queue_state[tx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + err = ionic_tx_qcq_alloc(lif, tx_queue_id, nb_desc, &txq); if (err) { IONIC_PRINT(DEBUG, "Queue allocation failure"); @@ -210,22 +213,30 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, int __rte_cold ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) { + uint8_t *tx_queue_state = eth_dev->data->tx_queue_state; struct ionic_qcq *txq; int err; + if (tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { + IONIC_PRINT(DEBUG, "TX queue %u already started", + tx_queue_id); + return 0; + } + txq = eth_dev->data->tx_queues[tx_queue_id]; IONIC_PRINT(DEBUG, "Starting TX queue %u, %u descs", tx_queue_id, txq->q.num_descs); - err = ionic_lif_txq_init(txq); - if (err) - return err; + if (!(txq->flags & IONIC_QCQ_F_INITED)) { + err = ionic_lif_txq_init(txq); + if (err) + return err; + } ionic_qcq_enable(txq); - eth_dev->data->tx_queue_state[tx_queue_id] = - RTE_ETH_QUEUE_STATE_STARTED; + tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -634,6 +645,8 @@ ionic_dev_rx_queue_release(void *rx_queue) ionic_rx_empty(&rxq->q); + ionic_lif_rxq_deinit(rxq); + ionic_qcq_free(rxq); } @@ -682,6 +695,9 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queues[rx_queue_id] = NULL; } + eth_dev->data->rx_queue_state[rx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, &rxq); if (err) { IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); @@ -953,17 +969,26 @@ int __rte_cold ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { uint32_t frame_size = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; struct ionic_qcq *rxq; int err; + if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { + IONIC_PRINT(DEBUG, "RX queue %u already started", + rx_queue_id); + return 0; + } + rxq = eth_dev->data->rx_queues[rx_queue_id]; IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)", rx_queue_id, rxq->q.num_descs, frame_size); - err = ionic_lif_rxq_init(rxq); - if (err) - return err; + if (!(rxq->flags & IONIC_QCQ_F_INITED)) { + err = ionic_lif_rxq_init(rxq); + if (err) + return err; + } /* Allocate buffers for descriptor rings */ if (ionic_rx_fill(rxq, frame_size) != 0) { @@ -974,8 +999,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) ionic_qcq_enable(rxq); - eth_dev->data->rx_queue_state[rx_queue_id] = - RTE_ETH_QUEUE_STATE_STARTED; + rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -1044,16 +1068,14 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) rxq = eth_dev->data->rx_queues[rx_queue_id]; + eth_dev->data->rx_queue_state[rx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + ionic_qcq_disable(rxq); /* Flush */ ionic_rxq_service(&rxq->cq, -1, NULL); - ionic_lif_rxq_deinit(rxq); - - eth_dev->data->rx_queue_state[rx_queue_id] = - RTE_ETH_QUEUE_STATE_STOPPED; - return 0; } From patchwork Thu Dec 10 14:22:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 84950 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BCFCA04DB; Thu, 10 Dec 2020 15:24:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9AAD0C9C2; Thu, 10 Dec 2020 15:22:57 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id D4E45C9A8 for ; Thu, 10 Dec 2020 15:22:54 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id w16so4340115pga.9 for ; Thu, 10 Dec 2020 06:22:54 -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=8Ny+tWwosX/t4KeXkMep5gGR92PZGMqlLzIZ1COugzw=; b=vt7eT9sPZ8AW6n4tuZc8iWxwxJLsniyx4ZGzvhHNMzRQgJrY0UuWgYkdhD6KRiw/OR cfJzRqSCUjksT7HqVJ9mtEDVrMkhZ8ktpfFhAoWvlFjkPpFM5bF3oxeJXHebyWRl+ZY1 DOwYvay7G0VBJZKiY1Li+xebFam5HHZA1OZT4tcdmOkeiDWTmHmr+RTH+rIzY7KLTC2j ejuPQgGlLGVvJsYHnPP5U49ikgZsWAjzJCCrCHk7nIpZERWM8JHy6HokEO1hBFeleqct 1NWR76wdsMTWKI3+fvso7FzctcXLS3DShu/8DYXlmJLbq+dJo+GE9CjGA58usGwixz6s +JjA== 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=8Ny+tWwosX/t4KeXkMep5gGR92PZGMqlLzIZ1COugzw=; b=S54KRE/eh4bD4DnMtVBfw31WVNOdQ3nIydcLnXjVYJXbmkGuF1R4Z/gCj1yX/bMf2f TI5aZjSYYw9g9Iyx/+wJBfcdeT++rr6XC+Pd6u6s3wCPB3UTMr8U6wGsDJsvVxA8v1HO qPrdJnPaU8JKPiiUvWHLcMLhSFt2FYOWVh+RJKUaUuMdMyU+svnWhheZo3q7ZsF9v3L+ 4A5Zk7AHWTVeT5ykbw2ImsDFbQDsZKfvisPjrKssQvnHzF8zyb7oMYWiKCEntj0OSkAD /7UfgeEXildCGN1eWLSy+BjiCLihyH6hHFXS8bXOwvT/s+dYzxfo2+AA4idV7LMh0yGq 6cEQ== X-Gm-Message-State: AOAM531c6ioOxEwJ70lKHJ/7gF0aBiKi1B/EtBnJSe5v7eC4UoMjgR6S iLvFAEaeOG1Lri6A+AnLdmGZBf8UHw+IaA== X-Google-Smtp-Source: ABdhPJzj87OM1EsjNNM7EZvHPCkLePiSwGsenq8KHAb9jPD2pPYqYT7avojnfDywKjbHXoReQXflHA== X-Received: by 2002:a63:4e4c:: with SMTP id o12mr6842028pgl.348.1607610172933; Thu, 10 Dec 2020 06:22:52 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 06:22:52 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Thu, 10 Dec 2020 06:22:31 -0800 Message-Id: <20201210142231.63209-7-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 6/6] net/ionic: stop queues when LIF is stopped 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" Otherwise they can not be restarted. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 2452451be..98797b22b 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -68,9 +68,23 @@ ionic_qcq_disable(struct ionic_qcq *qcq) void ionic_lif_stop(struct ionic_lif *lif) { + uint32_t i; + IONIC_PRINT_CALL(); lif->state &= ~IONIC_LIF_F_UP; + + for (i = 0; i < lif->nrxqcqs; i++) { + struct ionic_qcq *rxq = lif->rxqcqs[i]; + if (rxq->flags & IONIC_QCQ_F_INITED) + (void)ionic_dev_rx_queue_stop(lif->eth_dev, i); + } + + for (i = 0; i < lif->ntxqcqs; i++) { + struct ionic_qcq *txq = lif->txqcqs[i]; + if (txq->flags & IONIC_QCQ_F_INITED) + (void)ionic_dev_tx_queue_stop(lif->eth_dev, i); + } } void