From: Stephen Hemminger <stephen@networkplumber.org>
To: liwencheng <liwencheng@phytium.com.cn>
Cc: dev@dpdk.org
Subject: Re: [PATCH v1 1/2] net/macb: add new driver
Date: Fri, 1 Nov 2024 09:13:08 -0700 [thread overview]
Message-ID: <20241101091308.28bb4518@hermes.local> (raw)
In-Reply-To: <1730455640-1084345-1-git-send-email-liwencheng@phytium.com.cn>
On Fri, 1 Nov 2024 10:07:19 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:
> add Phytium NIC MACB ethdev PMD driver.
>
> Signed-off-by: liwencheng <liwencheng@phytium.com.cn>
Much better.
When submitting a new version of already submitted patch.
DPDK policy is to use version 2 (v2) and use in-reply-to
so that threads in mail client and patchwork archive stay
organized.
New drivers should be submitted in smaller chunks so that
comments are more organized.
https://doc.dpdk.org/guides/contributing/new_driver.html
A saw a few things.
1. Don't put developer only printf's in under MACB_DEBUG.
If you have to leave debugging around use the existing
log macros with DEBUG as the level.
This applies to all #ifdef's.
Please don't use them because it leads to dead untested code.
2. Looks like driver is keeping per queue stats, but they are not filled
in the get_stats code.
3. Unnecessary casts of void * pointer.
4. The code in interrupt handler is more complex than necessary.
This does the same thing:
static void macb_interrupt_handler(void *param)
{
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
struct macb_priv *priv = dev->data->dev_private;
struct rte_eth_link link;
char status[128];
if (priv->stopped)
return;
if (eth_macb_link_update(dev, 0) < 0)
return;
rte_eth_linkstatus_get(dev, &link);
rte_eth_link_to_str(status, sizeof(status), &link);
MACB_INFO("Port %u: %s", dev->data->port_id, status);
macb_link_change(priv->bp);
rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
}
5. For files, the convention is to use PATH_MAX (you use MAX_FILE_LEN)
6. Use on stack variables where possible (avoids potential memory leaks).
Example of where allocation can be avoided is in macb_get_dev_pclk.
7. lots of extra includes.
For example, why does macb_rxtx_vec_neon need arp, ioctl, socket and stat?
8. Don't use __builtin_ctz, instead use rte_ctz32()
9. Use __rte_cache_aligned not __rte_aligned(RTE_CACHE_LINE_SIZE)
10. Do not disable warnings it hides bugs
11. Take out this line, it bothers checkpatch
meson.build:
#allow_experimental_apis = true
next prev parent reply other threads:[~2024-11-01 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 10:07 liwencheng
2024-11-01 10:07 ` [PATCH v1 2/2] /usertools/dpdk-devbind:add the binding and unbinding of platform device liwencheng
2024-11-01 16:13 ` Stephen Hemminger [this message]
2024-11-01 17:42 ` [PATCH v1 1/2] net/macb: add new driver Stephen Hemminger
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=20241101091308.28bb4518@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=liwencheng@phytium.com.cn \
/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).