From: Ferruh Yigit <ferruh.yigit@intel.com>
To: wangyunjian <wangyunjian@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
"Lilijun (Jerry)" <jerry.lilijun@huawei.com>,
xudingke <xudingke@huawei.com>
Subject: Re: [dpdk-dev] [PATCH] net/tap: release port upon close
Date: Wed, 16 Sep 2020 16:48:19 +0100 [thread overview]
Message-ID: <5b26d986-ffc3-9bac-ed4d-cbc1f0dd342b@intel.com> (raw)
In-Reply-To: <34EFBCA9F01B0748BEB6B629CE643AE60DA4D4A1@DGGEMM533-MBX.china.huawei.com>
On 9/16/2020 8:20 AM, wangyunjian wrote:
>> -----Original Message-----
>> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
>> Sent: Tuesday, September 15, 2020 10:53 PM
>> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
>> Cc: thomas@monjalon.net; Lilijun (Jerry) <jerry.lilijun@huawei.com>; xudingke
>> <xudingke@huawei.com>
>> Subject: Re: [dpdk-dev] [PATCH] net/tap: release port upon close
>>
>> On 8/28/2020 1:37 PM, wangyunjian wrote:
>>> From: Yunjian Wang <wangyunjian@huawei.com>
>>>
>>> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
>>> for the port can be freed by rte_eth_dev_close().
>>>
>>> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
>>
>> <...>
>>
>>> @@ -1040,6 +1044,9 @@ tap_dev_close(struct rte_eth_dev *dev)
>>> struct pmd_process_private *process_private = dev->process_private;
>>> struct rx_queue *rxq;
>>>
>>> + if (process_private == NULL)
>>> + return;
>>
>> Why this check is required?
>
> When user first call 'close()' and later call 'remove()' the tap PMD, in this case,
> the tap_dev_close() will be called twice. The second call of tap_dev_close()
> shouldn't do any process, we can use this check to return immediately.
>
When first call is 'close()', it memset the 'eth_dev->data', so the in
the later 'remove()' call, 'rte_eth_dev_allocated()' will always return
NULL and 'remove()' will exit without calling 'close()'.
Also multiple 'close()' calls look safe, because of
'RTE_ETH_VALID_PORTID_OR_RET()' checks is 'rte_eth_dev_close()'.
So, as far as I can see this additional check is not needed, but please
double check.
next prev parent reply other threads:[~2020-09-16 15:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 12:37 wangyunjian
2020-09-01 10:59 ` Thomas Monjalon
2020-09-13 9:16 ` Thomas Monjalon
2020-09-13 22:27 ` Thomas Monjalon
2020-09-17 12:35 ` wangyunjian
2020-09-15 14:52 ` Ferruh Yigit
2020-09-16 7:20 ` wangyunjian
2020-09-16 15:48 ` Ferruh Yigit [this message]
2020-09-17 9:18 ` wangyunjian
2020-09-17 11:47 ` [dpdk-dev] [PATCH v2] " wangyunjian
2020-09-29 16:56 ` Ferruh Yigit
2020-09-30 0:58 ` wangyunjian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b26d986-ffc3-9bac-ed4d-cbc1f0dd342b@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=jerry.lilijun@huawei.com \
--cc=thomas@monjalon.net \
--cc=wangyunjian@huawei.com \
--cc=xudingke@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).