From patchwork Sun Sep 27 22:36:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasesh Mody X-Patchwork-Id: 78923 X-Patchwork-Delegate: jerinj@marvell.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 0D524A04BC; Mon, 28 Sep 2020 00:37:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2B5261D3F0; Mon, 28 Sep 2020 00:37:26 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C854A1D381 for ; Mon, 28 Sep 2020 00:37:24 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08RMUeZ7030241; Sun, 27 Sep 2020 15:37:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=nu8vTvGG1CjnG26wG63QQm+1nlnEZbkqgRxMcykYzyI=; b=FFKxdf/uXPV0sWOhsZanjldz9QVUGA1L7ALtbn/6oi/OLCRMjBTmkYZJxRPpD6Z9lZhx Azs1mBXyI01Wn4D5xqeB5Q9UGkvyrnd5WSOEE1A1TPzH9quaFNeHEPFMR2z01XCd5kyf GwEUltpD6FviUPzthG4Ys0YXQF0Oswz4WoJtnxNbTtvMI1RaqzJjnvsKcx2XwDZy9eht N0GRQ1POD9m877q8U5bJwA/8zDCbi8ANW56JtzfEdK/01Ywz0hi1n8sIatxmMrwQzcUH ZdrTVyNwGIN9ack4yUL60B1MIgJUxC37tK88x54gnu4k/tG9d/mCHE/YHfvynX1cngvg Cg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 33teem4mhf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 27 Sep 2020 15:37:22 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 27 Sep 2020 15:37:21 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 27 Sep 2020 15:37:21 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 6BA8B3F703F; Sun, 27 Sep 2020 15:37:21 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id 08RMbK2N011259; Sun, 27 Sep 2020 15:37:20 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: , , CC: , , , "Rasesh Mody" Date: Sun, 27 Sep 2020 15:36:28 -0700 Message-ID: <20200927223629.11156-1-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-27_18:2020-09-24, 2020-09-27 signatures=0 Subject: [dpdk-dev] [PATCH] net/bnx2x: release port upon 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" Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources for the port can be freed by rte_eth_dev_close(). With this change the private port resources are released in the .dev_close callback. Signed-off-by: Rasesh Mody --- drivers/net/bnx2x/bnx2x_ethdev.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index b2ea5fafa..d0268fcd5 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -287,6 +287,10 @@ bnx2x_dev_close(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(sc); + /* only close in case of the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + if (IS_VF(sc)) bnx2x_vf_close(sc); @@ -295,6 +299,9 @@ bnx2x_dev_close(struct rte_eth_dev *dev) /* free ilt */ bnx2x_free_ilt_mem(sc); + + /* mac_addrs must not be freed alone because part of dev_private */ + dev->data->mac_addrs = NULL; } static int @@ -726,6 +733,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) goto out; } + /* Pass the information to the rte_eth_dev_close() that it should also + * release the private port resources. + */ + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + return 0; out: @@ -753,8 +765,9 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev) static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev) { - /* mac_addrs must not be freed alone because part of dev_private */ - eth_dev->data->mac_addrs = NULL; + struct bnx2x_softc *sc = eth_dev->data->dev_private; + PMD_INIT_FUNC_TRACE(sc); + bnx2x_dev_close(eth_dev); return 0; }