DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Stephen Hemminger'" <stephen@networkplumber.org>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 4/6] net/ngbe: add device init and uninit
Date: Mon, 22 Mar 2021 10:58:57 +0800	[thread overview]
Message-ID: <00a601d71ec7$4dbd0f40$e9372dc0$@trustnetic.com> (raw)
In-Reply-To: <20210319104729.0390e3dc@hermes.local>

On Saturday, March 20, 2021 1:47 AM, Stephen Hemminger wrote:
> On Fri, 19 Mar 2021 15:26:26 +0800
> Jiawen Wu <jiawenwu@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?

I think, "#ifndef false" and "#ifndef true" can be used to avoid adding
<stdbool.h> repeatedly.

> 
> > +#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?

I am not sure if it was ported from Windows.
It is ported from TXGBE, and TXGBE was coding by another workmate several
years before.

> 
> > +/* 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?

Thanks for your review.
Such in the case, rte_is_multicast_ether_addr and
rte_is_broadcast_ether_addr should be used.




  reply	other threads:[~2021-03-22  2:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19  7:26 [dpdk-dev] [PATCH v2 0/6] net: ngbe PMD Jiawen Wu
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 1/6] net/ngbe: add build and doc infrastructure Jiawen Wu
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 2/6] net/ngbe: add device IDs Jiawen Wu
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 3/6] net/ngbe: support probe and remove Jiawen Wu
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 4/6] net/ngbe: add device init and uninit Jiawen Wu
2021-03-19 17:47   ` Stephen Hemminger
2021-03-22  2:58     ` Jiawen Wu [this message]
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 5/6] net/ngbe: add log type and error type Jiawen Wu
2021-03-19  7:26 ` [dpdk-dev] [PATCH v2 6/6] net/ngbe: define registers Jiawen Wu

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='00a601d71ec7$4dbd0f40$e9372dc0$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).