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 6B26EA0532; Wed, 29 Jan 2020 10:17:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D79F41BFAF; Wed, 29 Jan 2020 10:17:13 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 465FF1BFAD; Wed, 29 Jan 2020 10:17:12 +0100 (CET) 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 00T9EuWf020196; Wed, 29 Jan 2020 01:17:11 -0800 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=pfpt0818; bh=IgPPhfScw0sRPlGmL+K/6Q8W2NQvVFDdH9i0v90chsY=; b=dtbhX7kNzSAGZUn4YAEus55x6sveKN1lAIYpTeZBs5NBQxesQy3mwpFO7cOfQcR1H3Ro nX/8L8f+FBQvM6tNDK5Cq9Nbzx6J2nmodvM1DsLBQOULxSmVspDQD7VFe2UtX8cKJVwk Xu8+FYbyanzHYbF+r0znGzJwvRArBqUDT4RHjEwxslJ4Vp3mW/AZ87d0QmsTJi9fshqN mmmEKkBaXDbxRXXLbHSnnZaTx4z1KC7UQEcPswFBxpjt8KMjWdkH+leYhNY/pmyHSAMC aZSGqg/eatHnYjIn8hya79ti4AIZsa5UPbvUDLRpdlkxpX0kokLcHShVjA5WNK8UDmY+ Mw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2xrp2t8gdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 29 Jan 2020 01:17:11 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 29 Jan 2020 01:17:09 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 29 Jan 2020 01:17:09 -0800 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id 57BC53F7053; Wed, 29 Jan 2020 01:17:08 -0800 (PST) From: Sunil Kumar Kori To: Harman Kalra CC: , , Sunil Kumar Kori Date: Wed, 29 Jan 2020 14:47:04 +0530 Message-ID: <20200129091704.18217-1-skori@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-29_01:2020-01-28, 2020-01-29 signatures=0 Subject: [dpdk-dev] [PATCH] net/octeontx: fix memory leak of MAC address table 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" MAC address table is allocated during octeontx device create and same is used to maintain list of MAC address associated to port. This table is not getting freed niether in case of error nor during graceful shutdown of port. Patch fixes memory required memory for both the cases as mentioned. Fixes: f18b146c498d ("net/octeontx: create ethdev ports") Signed-off-by: Sunil Kumar Kori --- drivers/net/octeontx/octeontx_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index e23162d8a..40d9d67da 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -351,6 +351,10 @@ octeontx_dev_close(struct rte_eth_dev *dev) rte_free(txq); } + /* Free MAC address table */ + rte_free(dev->data->mac_addrs); + dev->data->mac_addrs = NULL; + dev->tx_pkt_burst = NULL; dev->rx_pkt_burst = NULL; } @@ -1143,7 +1147,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, octeontx_log_err("eth_dev->port_id (%d) is diff to orig (%d)", data->port_id, nic->port_id); res = -EINVAL; - goto err; + goto free_mac_addrs; } /* Update port_id mac to eth_dev */ @@ -1162,6 +1166,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, rte_eth_dev_probing_finish(eth_dev); return data->port_id; +free_mac_addrs: + rte_free(data->mac_addrs); err: if (nic) octeontx_port_close(nic); -- 2.17.1