[dpdk-dev] [PATCH v2 4/6] net/ngbe: add device init and uninit

Stephen Hemminger stephen at networkplumber.org
Fri Mar 19 18:47:29 CET 2021


On Fri, 19 Mar 2021 15:26:26 +0800
Jiawen Wu <jiawenwu at trustnetic.com> wrote:

> +++ b/drivers/net/ngbe/base/ngbe_osdep.h
> @@ -0,0 +1,172 @@

> +#define false               0
> +#define true                1

These will conflict with normal definitions in <stdbool.h>
Why are you not using that?

> +#define min(a, b)	RTE_MIN(a, b)
> +#define max(a, b)	RTE_MAX(a, b)
> +
> +/* Bunch of defines for shared code bogosity */
> +
> +static inline void UNREFERENCED(const char *a __rte_unused, ...) {}
> +#define UNREFERENCED_PARAMETER(args...) UNREFERENCED("", ##args)
> +

I have seen that before... porting code from Windows? 

> +/* Check whether address is multicast. This is little-endian specific check.*/
> +#define NGBE_IS_MULTICAST(address) \
> +		(bool)(((u8 *)(address))[0] & ((u8)0x01))
> +

Why not rte_ether_is_multicast_ether_addr?


> +/* Check whether an address is broadcast. */
> +#define NGBE_IS_BROADCAST(address) \
> +		({typeof(address)addr = (address); \
> +		(((u8 *)(addr))[0] == ((u8)0xff)) && \
> +		(((u8 *)(addr))[1] == ((u8)0xff)); })
> +

Your code is not correct since it would match ff:ff:01:02:03:04

Why not rte_ether_is_broadcast_ether_addr?


More information about the dev mailing list