From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28A8DA054F; Mon, 1 Mar 2021 12:40:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B56022A257; Mon, 1 Mar 2021 12:40:29 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 7598F22A23C for ; Mon, 1 Mar 2021 12:40:27 +0100 (CET) IronPort-SDR: jGH7kjIinAURfc2BRZFPJttW5vHzdgTDR0bScR2KW/rAfjgMBxz52TqiC07/iovmnaj3AA914x uxWSqHFpZ2iw== X-IronPort-AV: E=McAfee;i="6000,8403,9909"; a="186488712" X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="186488712" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 03:40:26 -0800 IronPort-SDR: msr653+PgnWCzvb9iQfauLExQ+BsIYHWsf0QqstUH8QE3nkJel5K5TS/Zk6DI+RE6UtLhECMQK F3Jg/z8kqSOw== X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="397685233" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.216.186]) ([10.213.216.186]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 03:40:25 -0800 To: =?UTF-8?B?5bygIOadqA==?= Cc: "dev@dpdk.org" References: From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Mon, 1 Mar 2021 11:40:21 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] =?utf-8?b?5Zue5aSNOiBbUEFUQ0hdIGRyaXZlci9uZXQvcGNh?= =?utf-8?q?p_fix=3A_pcap_fd_leak?= X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Please do not top post, message moved down. On 2/26/2021 5:47 PM, 张 杨 wrote: >> I think your idea is fine >> >> What do you think just record file path in "pmd_pcap_probe()", >> >> Perform an open operation only in "eth_dev_start()"? >> >> When the secondary process add pcap vdev, >> >> it send the request to primary process, >> >> the primary process probe pcap vdev too , >> >> Both the two process open the same file (in function "pmd_pcap_probe()") >> >> It's not necessary >> >> I prefer "ZhangTengfei " sign (this one) >> >> 发送自Windows 10 版邮件 应用 >> >> *发件人: *Ferruh Yigit >> *发送时间: *2021年2月27日0:46 >> *收件人: *ZhangTengfei >> *抄送: *dev@dpdk.org >> *主题: *Re: [PATCH] driver/net/pcap fix: pcap fd leak >> >> On 2/26/2021 4:20 PM, ZhangTengfei wrote: >>> pcap fd was opend when vdev probed, >>> but not closed when vdev removed. >>> This bug appears in dpdk-pdump >>> >>> Signed-off-by: ZhangTengfei >>> --- >>> drivers/net/pcap/rte_eth_pcap.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c >>> index 90f5d75ea..fb01ea924 100644 >>> --- a/drivers/net/pcap/rte_eth_pcap.c >>> +++ b/drivers/net/pcap/rte_eth_pcap.c >>> @@ -1597,6 +1597,7 @@ pmd_pcap_remove(struct rte_vdev_device *dev) >>> if (eth_dev == NULL) >>> return 0; /* port already released */ >>> >>> + eth_dev_stop(eth_dev); >>> eth_dev_close(eth_dev); >>> rte_eth_dev_release_port(eth_dev); >>> >>> >> >> Thanks for the fix, >> the cleanup seems missing in 'eth_dev_close()' too, what do you think moving >> 'eth_dev_stop(eth_dev);' inside the 'eth_dev_close()'? >> So both 'close' and 'remove' will be covered. >> >> >> Btw, you have same patch with both "ZhangTengfei " sign >> and "ZhangTengfei " sign (this one), can you please >> clarify which one do you prefer? >> > > I think your idea is fine > > What do you think just record file path in "pmd_pcap_probe()", > Perform an open operation only in "eth_dev_start()"? > > When the secondary process add pcap vdev, > it send the request to primary process, > the primary process probe pcap vdev too ,> > Both the two process open the same file (in function "pmd_pcap_probe()") > It's not necessary > Opening pcap helps us fail early in probe() if something is wrong, otherwise the driver probed and the problem detected in the start() when it is too late. start() also opens pcap if it is not already opened. In your usecase, if the pcap added by the secondary with the intention to use only by the secondary, yes primary process also opens the pcap unnecessarily, but that shouldn't be really a concern, this is one time cost in probe(). > I prefer "ZhangTengfei " sign (this one) OK, also can you please use "Name Surname " format, to be consistent, I guess for you it means as following: Tengfei Zhang