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 7E735A04C0; Fri, 25 Sep 2020 06:18:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE3881E4AD; Fri, 25 Sep 2020 06:18:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 03B4D1E4AA for ; Fri, 25 Sep 2020 06:18:17 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08P4FYJH016967; Thu, 24 Sep 2020 21:18:17 -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=3XCUkrbZE1zHrs+tbOkX/360uDwuGs9qIQFASu0F6ZA=; b=KaNnL2x+d8iKUbDOat00w6p1fk24E55s/g+iuphpHWYQxMXO0xXdL9NqhsIkgO/3pS8D 5vigjDPd0SJwdVcSz+863JcUCd6DpTEfxjOZFHOK4Rodnh32dY1bKB7l92MosQ4Ws/V8 hvyCupiwMAXmfFCfITOfF4LG1iIwS1m7zVO7l3vvSFypATxlyqbRX/GLR0jHKxDX6g8B 9MlwMtx9HXWv+2p2w8jZp5Gf40hq6+kUnz2BBg+zVcjeFcP/jMD+MdWtvumDUUIXM+EF EPctjz1MBGNcqEBKuGzu02WME32YpHIAf6Kejt6c8a3kyz8nuv33Hv/v4SYzR2SKefXn xg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 33nhgnrc39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2020 21:18:17 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Sep 2020 21:18:15 -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; Thu, 24 Sep 2020 21:18:15 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 6BF553F7040; Thu, 24 Sep 2020 21:18:15 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id 08P4IEiY017769; Thu, 24 Sep 2020 21:18:14 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: , CC: , , , "Rasesh Mody" Date: Thu, 24 Sep 2020 21:17:43 -0700 Message-ID: <20200925041744.17688-1-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-25_01:2020-09-24, 2020-09-25 signatures=0 Subject: [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior 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 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index b2ea5fafa..00d76b9f8 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -295,6 +295,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 +729,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 +761,16 @@ 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); + + /* only uninitialize in the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + bnx2x_dev_close(eth_dev); + return 0; } -- 2.18.1