From: David Miller <davem@davemloft.net>
To: zhangfei.gao@linaro.org
Cc: linux@arm.linux.org.uk, arnd@arndb.de, f.fainelli@gmail.com,
sergei.shtylyov@cogentembedded.com, mark.rutland@arm.com,
David.Laight@ACULAB.COM, eric.dumazet@gmail.com,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] net: hisilicon: new hip04 ethernet driver
Date: Mon, 07 Apr 2014 14:53:56 -0400 (EDT) [thread overview]
Message-ID: <20140407.145356.928382660541891827.davem@davemloft.net> (raw)
In-Reply-To: <1396672506-9296-4-git-send-email-zhangfei.gao@linaro.org>
From: Zhangfei Gao <zhangfei.gao@linaro.org>
Date: Sat, 5 Apr 2014 12:35:06 +0800
> +struct tx_desc {
> + u32 send_addr;
> + u16 reserved_16;
> + u16 send_size;
> + u32 reserved_32;
> + u32 cfg;
> + u32 wb_addr;
> +} ____cacheline_aligned;
I do not think that ____cacheline_aligned is appropriate at all here.
First of all, this is a hardware descriptor, so it has a fixed layout
and therefore size.
Secondly, unless you declare this object statically in the data section
of the object file, the alignment doesn't matter. These descriptors
are always dynamically allocated, rather than instantiated in the
kernel/driver image.
> + val = (duplex) ? BIT(0) : 0;
Parenthesis around duplex is not necessary, please remove.
> +static void hip04_reset_ppe(struct hip04_priv *priv)
> +{
> + u32 val, tmp;
> +
> + do {
> + regmap_read(priv->map, priv->port * 4 + PPE_CURR_BUF_CNT, &val);
> + regmap_read(priv->map, priv->port * 4 + PPE_CFG_RX_ADDR, &tmp);
> + } while (val & 0xfff);
> +}
This polling loop can loop forever, if the condition never triggers it will
loop forever. You must add some kind of limit or timeout, and subsequent
error handing up the call chain to handle this.
> + val = readl_relaxed(priv->base + PPE_CFG_STS_MODE);
> + val |= BIT(12); /* PPE_HIS_RX_PKT_CNT read clear */
> + writel_relaxed(val, priv->base + PPE_CFG_STS_MODE);
...
> + /* set bus ctrl */
> + val = BIT(14); /* buffer locally release */
> + val |= BIT(0); /* big endian */
> + writel_relaxed(val, priv->base + PPE_CFG_BUS_CTRL_REG);
Instead of having to set only one bit at a time in every register and
adding comments here, just define these register values using macros
properly in a header file or similar.
Then you can go val |= PPE_CFG_BUS_CTRL_VAL_THIS | PPE_CFG_BUS_CTRL_VAL_THAT
on one line.
Document the registers where you define the macros, that way people can learn
what other bits are in these register and what they mean, even if you don't
currently use them in the driver itself.
> +static void hip04_tx_reclaim(struct net_device *ndev, bool force)
...
> +static void hip04_xmit_timer(unsigned long data)
> +{
> + struct net_device *ndev = (void *) data;
> +
> + hip04_tx_reclaim(ndev, false);
> +}
...
> + mod_timer(&priv->txtimer, jiffies + RECLAIM_PERIOD);
And this is where I stop reading your driver, I've stated already that this
kind of reclaim scheme is unacceptable.
The kernel timers lack the granularity necessary to service TX reclaim
with a reasonable amount of latency.
You must use some kind of hardware notification of TX slots becomming
available, I find it totally impossible that a modern ethernet controller
was created without a TX done interrupt.
next prev parent reply other threads:[~2014-04-07 18:53 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-05 4:35 [PATCH v7 0/3] add hisilicon hip04 ethernet driver Zhangfei Gao
2014-04-05 4:35 ` [PATCH 1/3] Documentation: add Device tree bindings for Hisilicon hip04 ethernet Zhangfei Gao
2014-04-05 4:35 ` [PATCH 2/3] net: hisilicon: new hip04 MDIO driver Zhangfei Gao
2014-04-07 18:47 ` David Miller
2014-04-05 4:35 ` [PATCH 3/3] net: hisilicon: new hip04 ethernet driver Zhangfei Gao
2014-04-07 18:53 ` David Miller [this message]
2014-04-08 8:07 ` zhangfei
2014-04-08 8:30 ` David Laight
[not found] ` <063D6719AE5E284EB5DD2968C1650D6D0F6F1434-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2014-04-08 9:42 ` Arnd Bergmann
2014-04-08 14:47 ` zhangfei
2014-04-18 13:17 ` zhangfei
2014-04-07 18:56 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2014-04-04 15:16 [PATCH v6 0/3] add hisilicon " Zhangfei Gao
[not found] ` <1396624597-390-1-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-04-04 15:16 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
2014-04-01 13:27 [PATCH v5 0/3] add hisilicon " Zhangfei Gao
2014-04-01 13:27 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
[not found] ` <1396358832-15828-4-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-04-02 9:21 ` Arnd Bergmann
2014-04-02 9:51 ` zhangfei
2014-04-02 15:24 ` Arnd Bergmann
2014-04-02 10:04 ` David Laight
2014-04-02 15:49 ` Arnd Bergmann
2014-04-03 6:24 ` Zhangfei Gao
[not found] ` <CAMj5BkgfwE1hHpVeqH9WRitwCB30x3c4w0qw7sXT3PiOV-QcPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-03 8:35 ` Arnd Bergmann
2014-04-03 15:22 ` David Miller
2014-04-03 15:38 ` zhangfei
2014-04-03 15:27 ` Russell King - ARM Linux
2014-04-03 15:42 ` David Laight
2014-04-03 15:50 ` Russell King - ARM Linux
2014-04-03 17:57 ` Arnd Bergmann
2014-04-04 6:52 ` Zhangfei Gao
2014-03-28 15:35 [PATCH v4 0/3] add hisilicon " Zhangfei Gao
2014-03-28 15:36 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
2014-03-24 14:14 [PATCH v3 0/3] add hisilicon " Zhangfei Gao
2014-03-24 14:14 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
[not found] ` <1395670496-17381-4-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-03-24 15:18 ` Arnd Bergmann
2014-03-25 4:06 ` Zhangfei Gao
2014-03-25 8:12 ` Arnd Bergmann
2014-03-25 17:00 ` Florian Fainelli
2014-03-25 17:05 ` Arnd Bergmann
2014-03-25 17:16 ` Florian Fainelli
2014-03-25 17:57 ` Arnd Bergmann
2014-03-26 9:55 ` David Laight
2014-03-25 17:17 ` David Laight
2014-03-25 17:21 ` Eric Dumazet
2014-03-25 17:54 ` Arnd Bergmann
2014-03-27 12:53 ` zhangfei
2014-03-24 16:32 ` Florian Fainelli
2014-03-24 17:23 ` Arnd Bergmann
2014-03-24 17:35 ` Florian Fainelli
2014-03-27 6:27 ` Zhangfei Gao
2014-03-21 15:09 [PATCH v2 0/3] add hisilicon " Zhangfei Gao
2014-03-21 15:09 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
2014-03-21 15:27 ` Arnd Bergmann
2014-03-22 1:18 ` zhangfei
2014-03-22 8:08 ` Arnd Bergmann
2014-03-18 8:40 [PATCH 0/3] add hisilicon " Zhangfei Gao
[not found] ` <1395132017-15928-1-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-03-18 8:40 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
[not found] ` <1395132017-15928-4-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-03-18 10:46 ` Russell King - ARM Linux
2014-03-20 9:51 ` Zhangfei Gao
2014-03-24 14:17 ` Rob Herring
2014-03-26 14:22 ` Zhangfei Gao
2014-03-18 11:25 ` Arnd Bergmann
2014-03-20 14:00 ` Zhangfei Gao
2014-03-20 14:31 ` Arnd Bergmann
[not found] ` <201403201531.20416.arnd-r2nGTMty4D4@public.gmane.org>
2014-03-21 5:19 ` Zhangfei Gao
2014-03-21 7:37 ` Arnd Bergmann
2014-03-21 7:56 ` Zhangfei Gao
2014-03-24 8:17 ` Zhangfei Gao
2014-03-24 10:02 ` Arnd Bergmann
2014-03-24 13:23 ` Zhangfei Gao
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=20140407.145356.928382660541891827.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=David.Laight@ACULAB.COM \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=eric.dumazet@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=zhangfei.gao@linaro.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).