From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, horms@kernel.org,
kuba@kernel.org, jiri@resnulli.us, pabeni@redhat.com,
hfdevel@gmx.net, naveenm@marvell.com, jdamato@fastly.com
Subject: Re: [PATCH net-next v9 4/6] net: tn40xx: add basic Rx handling
Date: Mon, 10 Jun 2024 10:59:08 +0100 [thread overview]
Message-ID: <ZmbObG9lRO8w0FkJ@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240605232608.65471-5-fujita.tomonori@gmail.com>
On Thu, Jun 06, 2024 at 08:26:06AM +0900, FUJITA Tomonori wrote:
> +static int tn40_rxdb_alloc_elem(struct tn40_rxdb *db)
> +{
> + return db->stack[--(db->top)];
Parens are unnecessary here.
> +static void tn40_rxdb_free_elem(struct tn40_rxdb *db, unsigned int n)
> +{
> + db->stack[(db->top)++] = n;
Same here.
> + dno = tn40_rxdb_available(db) - 1;
> + i = dno;
> + while (i > 0) {
> + page = page_pool_dev_alloc_pages(priv->page_pool);
> + if (!page)
> + break;
> +
> + idx = tn40_rxdb_alloc_elem(db);
> + tn40_set_rx_desc(priv, idx, page_pool_get_dma_addr(page));
> + dm = tn40_rxdb_addr_elem(db, idx);
> + dm->page = page;
> +
> + i--;
> + }
While reviewing the rxdb stack, I came across this - this while() loop
is an open-coded for() loop:
for (i = dno; i > 0; i--) {
page = page_pool_dev_alloc_pages(priv->page_pool);
...
dm->page = page;
}
Is there any reason not to use a for() loop here?
> + if (i != dno)
> + tn40_write_reg(priv, f->m.reg_wptr,
> + f->m.wptr & TN40_TXF_WPTR_WR_PTR);
...
>+struct tn40_rxdb {
> + int *stack;
> + struct tn40_rx_map *elems;
> + int nelem;
> + int top;
I assume neither of these should ever be negative, so should these be
"unsigned int" ?
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-06-10 9:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 23:26 [PATCH net-next v9 0/6] add ethernet driver for Tehuti Networks TN40xx chips FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 1/6] net: tn40xx: add pci " FUJITA Tomonori
2024-06-09 11:17 ` Hans-Frieder Vogt
2024-06-09 12:13 ` FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 2/6] net: tn40xx: add register defines FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 3/6] net: tn40xx: add basic Tx handling FUJITA Tomonori
2024-06-09 11:41 ` Hans-Frieder Vogt
2024-06-10 6:48 ` FUJITA Tomonori
2024-06-10 21:02 ` FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 4/6] net: tn40xx: add basic Rx handling FUJITA Tomonori
2024-06-10 9:59 ` Russell King (Oracle) [this message]
2024-06-10 12:28 ` FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 5/6] net: tn40xx: add mdio bus support FUJITA Tomonori
2024-06-09 11:22 ` Hans-Frieder Vogt
2024-06-10 7:35 ` FUJITA Tomonori
2024-06-10 10:04 ` Russell King (Oracle)
2024-06-10 12:05 ` FUJITA Tomonori
2024-06-05 23:26 ` [PATCH net-next v9 6/6] net: tn40xx: add phylink support FUJITA Tomonori
2024-06-09 10:34 ` Russell King (Oracle)
2024-06-10 6:10 ` FUJITA Tomonori
2024-06-10 15:42 ` Andrew Lunn
2024-06-10 20:57 ` FUJITA Tomonori
2024-06-09 9:10 ` [PATCH net-next v9 0/6] add ethernet driver for Tehuti Networks TN40xx chips Hans-Frieder Vogt
2024-06-09 10:42 ` Russell King (Oracle)
2024-06-09 12:40 ` Hans-Frieder Vogt
2024-06-09 13:48 ` Russell King (Oracle)
2024-06-09 18:42 ` Hans-Frieder Vogt
[not found] ` <c3f29b80-0085-4dd2-8d78-f2ac2a004474@gmx.net>
2024-06-09 19:12 ` Russell King (Oracle)
2024-06-10 15:37 ` Andrew Lunn
2024-06-09 11:53 ` FUJITA Tomonori
2024-06-11 4:54 ` FUJITA Tomonori
2024-06-11 5:30 ` FUJITA Tomonori
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=ZmbObG9lRO8w0FkJ@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=fujita.tomonori@gmail.com \
--cc=hfdevel@gmx.net \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.