[PATCH 01/14] net/nfp: change the coding style
Kevin Liu
jin.liu at corigine.com
Tue Jun 14 10:50:43 CEST 2022
Will do, thanks
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit at xilinx.com>
Sent: Friday, June 3, 2022 06:52
To: Kevin Liu <jin.liu at corigine.com>; dev at dpdk.org
Cc: Niklas Soderlund <niklas.soderlund at corigine.com>; Chaoyong He <chaoyong.he at corigine.com>
Subject: Re: [PATCH 01/14] net/nfp: change the coding style
On 6/2/2022 2:52 AM, Jin Liu wrote:
> From: Chaoyong He <chaoyong.he at corigine.com>
>
> Change the coding style of some logics, to make it more compatible
> with the DPDK coding style.
>
> Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
> Signed-off-by: Jin Liu <jin.liu at corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at corigine.com>
<...>
> @@ -404,9 +403,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
>
> /* NFP can not handle DMA addresses requiring more than 40 bits */
> if (rte_mem_check_dma_mask(40)) {
> - RTE_LOG(ERR, PMD, "device %s can not be used:",
> - pci_dev->device.name);
> - RTE_LOG(ERR, PMD, "\trestricted dma mask to 40 bits!\n");
> + RTE_LOG(ERR, PMD, "device %s can not be used: restricted dma "
> + "mask to 40 bits!\n", pci_dev->device.name);
Since you are updating this part, it may be better to not break the string, like:
RTE_LOG(ERR, PMD,
"device %s can not be used: restricted dma mask to 40 bits!\n",
pci_dev->device.name);
<...>
> -static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)
> +static int
> +nfp_init_phyports(struct nfp_pf_dev *pf_dev)
> {
> + int i;
> + int ret = 0;
> struct nfp_net_hw *hw;
> struct rte_eth_dev *eth_dev;
> - struct nfp_eth_table *nfp_eth_table = NULL;
> - int ret = 0;
> - int i;
> + struct nfp_eth_table *nfp_eth_table;
> + char port_name[RTE_ETH_NAME_MAX_LEN];
>
> nfp_eth_table = nfp_eth_read_ports(pf_dev->cpp);
> - if (!nfp_eth_table) {
> + if (nfp_eth_table == NULL) {
> PMD_INIT_LOG(ERR, "Error reading NFP ethernet table");
> - ret = -EIO;
> - goto error;
> + return -EIO;
> }
>
> /* Loop through all physical ports on PF */
> for (i = 0; i < pf_dev->total_phyports; i++) {
> const unsigned int numa_node = rte_socket_id();
> - char port_name[RTE_ETH_NAME_MAX_LEN];
>
No need to increase the scope of the variable 'port_name', above is valid for the coding convention.
<...>
> @@ -989,13 +984,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
> snprintf(port_name, sizeof(port_name), "%s_port%d",
> pci_dev->device.name, i);
>
> - PMD_DRV_LOG(DEBUG, "Secondary attaching to port %s",
> - port_name);
> + PMD_DRV_LOG(DEBUG, "Secondary attaching to port %s", port_name);
> eth_dev = rte_eth_dev_attach_secondary(port_name);
> - if (!eth_dev) {
> - RTE_LOG(ERR, EAL,
> - "secondary process attach failed, "
> - "ethdev doesn't exist");
> + if (eth_dev == NULL) {
> + RTE_LOG(ERR, EAL, "secondary process attach failed, "
> + "ethdev doesn't exist");
Same here.
<...>
> @@ -296,9 +296,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
>
> /* NFP can not handle DMA addresses requiring more than 40 bits */
> if (rte_mem_check_dma_mask(40)) {
> - RTE_LOG(ERR, PMD, "device %s can not be used:",
> - pci_dev->device.name);
> - RTE_LOG(ERR, PMD, "\trestricted dma mask to 40 bits!\n");
> + RTE_LOG(ERR, PMD, "device %s can not be used: restricted dma "
> + "mask to 40 bits!\n", pci_dev->device.name);
ditto
More information about the dev
mailing list