DPDK patches and discussions
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Jie Hai <haijie1@huawei.com>, <lihuisong@huawei.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>,
	Keith Wiles <keith.wiles@intel.com>,
	Billy McFall <bmcfall@redhat.com>
Subject: Re: [PATCH 1/4] ethdev: verify queue ID when Tx done cleanup
Date: Sat, 12 Oct 2024 17:14:34 +0800	[thread overview]
Message-ID: <f9b5fa39-1353-4039-b373-c689804c3368@huawei.com> (raw)
In-Reply-To: <78d72ce0-88b7-4e0b-8acc-4da7b7a527d8@amd.com>

On 2024/10/12 10:27, Ferruh Yigit wrote:
> On 9/5/2024 8:33 AM, Andrew Rybchenko wrote:
>> On 9/5/24 09:46, Jie Hai wrote:
>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>
>>> Verify queue_id for rte_eth_tx_done_cleanup API.
>>
>> If I'm not mistaken the function is considered data path API (fast).
>> If so, it should not validate it's parameters as in rte_eth_tx_burst().
>> It may be done under RTE_ETHDEV_DEBUG_TX only.
>>
>> May be documentation should be fixed to highlight it.
>>
>> And yes, current implementation looks inconsistent from this point of
>> view since port_id and presence of callback are checked.
>>
>> Anyway motivation in the patch description is insufficient.
>>
> 
> Hi Chengwen,
> 
> I agree with Andrew, to not add checks to the datapath function.
> 
> Can you please explain more why this check is needed at first place?
> Is it for a specific usecase?

Hi Ferruh,

It was triggered by our internal security review.
I think it's okay to add the check under RTE_ETHDEV_DEBUG_TX. and Haijie will send v2.

Thanks

> 
>>>
>>> Fixes: 44a718c457b5 ("ethdev: add API to free consumed buffers in Tx
>>> ring")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>> ---
>>>   lib/ethdev/rte_ethdev.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
>>> index f1c658f49e80..998deb5ab101 100644
>>> --- a/lib/ethdev/rte_ethdev.c
>>> +++ b/lib/ethdev/rte_ethdev.c
>>> @@ -2823,6 +2823,10 @@ rte_eth_tx_done_cleanup(uint16_t port_id,
>>> uint16_t queue_id, uint32_t free_cnt)
>>>       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>       dev = &rte_eth_devices[port_id];
>>>   +    ret = eth_dev_validate_tx_queue(dev, queue_id);
>>> +    if (ret != 0)
>>> +        return ret;
>>> +
>>>       if (*dev->dev_ops->tx_done_cleanup == NULL)
>>>           return -ENOTSUP;
>>>   
>>
> 


  reply	other threads:[~2024-10-12  9:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  6:46 [PATCH 0/4] clean code for dmadev and hns3 Jie Hai
2024-09-05  6:46 ` [PATCH 1/4] ethdev: verify queue ID when Tx done cleanup Jie Hai
2024-09-05  7:33   ` Andrew Rybchenko
2024-10-12  2:27     ` Ferruh Yigit
2024-10-12  9:14       ` fengchengwen [this message]
2024-09-05  6:46 ` [PATCH 2/4] net/hns3: verify reset type from firmware Jie Hai
2024-09-05  6:46 ` [PATCH 3/4] dmadev: fix potential null pointer access Jie Hai
2024-09-05  6:46 ` [PATCH 4/4] dmadev: clean code for verify parameter Jie Hai
2024-10-12  9:31 ` [PATCH 0/4] clean code for dmadev and hns3 Jie Hai

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=f9b5fa39-1353-4039-b373-c689804c3368@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bmcfall@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=haijie1@huawei.com \
    --cc=keith.wiles@intel.com \
    --cc=lihuisong@huawei.com \
    --cc=thomas@monjalon.net \
    /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).