[RFT] net/nfb: use dynamic logtype

Martin Spinler spinler at cesnet.cz
Thu Dec 7 11:37:52 CET 2023


Thanks for patch! There are some issues.

On Wed, 2023-12-06 at 09:51 -0800, Stephen Hemminger wrote:
> 
> diff --git a/drivers/net/nfb/nfb_log.h b/drivers/net/nfb/nfb_log.h
> new file mode 100644
> index 000000000000..fac66a38d4b3
> --- /dev/null
> +++ b/drivers/net/nfb/nfb_log.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#ifndef _NFB_STATS_H_
> +#define _NFB_STATS_H_

use the _NFB_LOG_H_ guards

> +
> +extern int nfb_logtype;
> +
> +#define NFB_LOG(level, fmt, args...) \
> +	rte_log(RTE_LOG_ ## level, nfb_logtype, "%s(): " fmt "\n", \
> +		__func__, ## args)
> +
> +#endif /* _NFB_STATS_H_ */

use the _NFB_LOG_H_ guard

> diff --git a/drivers/net/nfb/nfb_rx.c b/drivers/net/nfb/nfb_rx.c
> index 8a9b232305f2..e39592d04737 100644
> --- a/drivers/net/nfb/nfb_rx.c
> +++ b/drivers/net/nfb/nfb_rx.c
>  
> @@ -19,7 +20,7 @@ nfb_eth_rx_queue_start(struct rte_eth_dev *dev, uint16_t rxq_id)
>  	int ret;
>  
>  	if (rxq->queue == NULL) {
> -		RTE_LOG(ERR, PMD, "RX NDP queue is NULL!\n");
> +		NFP_LOG(ERR, "RX NDP queue is NULL");

typo, should be NFB_LOG instead of NFP_LOG

>  		return -EINVAL;
>  	}
>  
>  

Also, the nfb_rx.h and nfb_tx.h files use the macro NFB_LOG inside,
please add '#include "nfb_log.h"' into them (then the include in
nfb_rx.c will be duplicate). Otherwise, all .c sources, which include
main nfb.h, don't compile.

With these changes, the driver works.

Thank you!
Martin


More information about the dev mailing list