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 3E2E2A0C40; Fri, 16 Apr 2021 13:00:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29654141D2E; Fri, 16 Apr 2021 13:00:58 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 3FDB0141D1F for ; Fri, 16 Apr 2021 13:00:57 +0200 (CEST) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FMCqD5gvfzPr7x; Fri, 16 Apr 2021 18:58:00 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Fri, 16 Apr 2021 19:00:53 +0800 To: Kevin Traynor , CC: , , References: <1618046334-39857-1-git-send-email-humin29@huawei.com> <1618555931-25858-1-git-send-email-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: Date: Fri, 16 Apr 2021 19:00:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v6] ethdev: add sanity checks in control APIs 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" Hi, Kevin and all fixed in v7, thanks. 在 2021/4/16 18:22, Kevin Traynor 写道: > On 16/04/2021 07:52, Min Hu (Connor) wrote: >> This patch adds more sanity checks in control path APIs. >> >> Fixes: 214ed1acd125 ("ethdev: add iterator to match devargs input") >> Fixes: 3d98f921fbe9 ("ethdev: unify prefix for static functions and variables") >> Fixes: 0366137722a0 ("ethdev: check for invalid device name") >> Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model") >> Fixes: 5b7ba31148a8 ("ethdev: add port ownership") >> Fixes: f8244c6399d9 ("ethdev: increase port id range") >> Cc: stable@dpdk.org >> >> Signed-off-by: Min Hu (Connor) >> Reviewed-by: Andrew Rybchenko > > > >> @@ -1298,9 +1342,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, >> uint16_t old_mtu; >> >> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> - >> dev = &rte_eth_devices[port_id]; >> >> + if (dev_conf == NULL) { >> + RTE_ETHDEV_LOG(ERR, >> + "Cannot configure ethdev port %u to NULL dev_conf\n", > > The others use a natural sounding names instead of argument name. If you > wanted to match that it could be "..to NULL conf" > >> + port_id); >> + return -EINVAL; >> + } >> + >> RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP); >> >> if (dev->data->dev_started) { > > > >> @@ -2609,6 +2680,13 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link) >> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> dev = &rte_eth_devices[port_id]; >> >> + if (eth_link == NULL) { >> + RTE_ETHDEV_LOG(ERR, >> + "Cannot get ethdev port %u link for NULL eth_link\n", > > ^^^ > >> + port_id); >> + return -EINVAL; >> + } >> + >> if (dev->data->dev_conf.intr_conf.lsc && >> dev->data->dev_started) >> rte_eth_linkstatus_get(dev, eth_link); >> @@ -2629,6 +2707,13 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link) >> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> dev = &rte_eth_devices[port_id]; >> >> + if (eth_link == NULL) { >> + RTE_ETHDEV_LOG(ERR, >> + "Cannot get nowait ethdev port %u for NULL link\n", > > ^^^ > I would probably stick with "link" for both these functions, rather than > argument name "eth_link" in one "link" in other. > >> + port_id); >> + return -EINVAL; >> + } >> + >> if (dev->data->dev_conf.intr_conf.lsc && >> dev->data->dev_started) >> rte_eth_linkstatus_get(dev, eth_link); > > Thanks Connor. There are only minor nits, so > Acked-by: Kevin Traynor > > . >