From: Arnd Bergmann <arnd@arndb.de>
To: Zhangfei Gao <zhangfei.gao@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
netdev <netdev@vger.kernel.org>,
Zhangfei Gao <zhangfei.gao@linaro.org>,
"David S. Miller" <davem@davemloft.net>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] net: hisilicon: new hip04 ethernet driver
Date: Tue, 25 Mar 2014 09:12:38 +0100 [thread overview]
Message-ID: <17142825.cN9DfpvuLc@wuerfel> (raw)
In-Reply-To: <CAMj5BkjbrHevQhf4kbFhN5THHLw4nQwdpt2h6WJH02mKhdq8oQ@mail.gmail.com>
On Tuesday 25 March 2014 12:06:31 Zhangfei Gao wrote:
> Dear Arnd
>
> On Mon, Mar 24, 2014 at 11:18 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Monday 24 March 2014 22:14:56 Zhangfei Gao wrote:
> >
> >> +
> >> +static void hip04_tx_reclaim(struct net_device *ndev, bool force)
> >> +{
> >> + struct hip04_priv *priv = netdev_priv(ndev);
> >> + unsigned tx_head = priv->tx_head;
> >> + unsigned tx_tail = priv->tx_tail;
> >> + struct tx_desc *desc = &priv->tx_desc[priv->tx_tail];
> >> +
> >> + while (tx_tail != tx_head) {
> >> + if (desc->send_addr != 0) {
> >> + if (force)
> >> + desc->send_addr = 0;
> >> + else
> >> + break;
> >> + }
> >> + if (priv->tx_phys[tx_tail]) {
> >> + dma_unmap_single(&ndev->dev, priv->tx_phys[tx_tail],
> >> + priv->tx_skb[tx_tail]->len, DMA_TO_DEVICE);
> >> + priv->tx_phys[tx_tail] = 0;
> >> + }
> >> + dev_kfree_skb_irq(priv->tx_skb[tx_tail]);
> >> + priv->tx_skb[tx_tail] = NULL;
> >> + tx_tail = TX_NEXT(tx_tail);
> >> + priv->tx_count--;
> >> + }
> >> + priv->tx_tail = tx_tail;
> >> +}
> >
> > I think you still need to find a solution to ensure that the tx reclaim is
> > called eventually through a method other than start_xmit.
>
> In the iperf stress test, if move reclaim to poll, there is some
> error, sometimes sending zero packets.
> While keep reclaim in the xmit to reclaim transmitted packets looks
> stable in the test,
> There TX_DESC_NUM desc can be used.
What I meant is that you need a correct implementation, presumably
you added a bug when you moved the function to poll(), and also you
forgot to add a timer.
> >> + priv->map = syscon_regmap_lookup_by_compatible("hisilicon,hip04-ppe");
> >> + if (IS_ERR(priv->map)) {
> >> + dev_warn(d, "no hisilicon,hip04-ppe\n");
> >> + ret = PTR_ERR(priv->map);
> >> + goto init_fail;
> >> + }
> >> +
> >> + n = of_parse_phandle(node, "port-handle", 0);
> >> + if (n) {
> >> + ret = of_property_read_u32(n, "reg", &priv->port);
> >> + if (ret) {
> >> + dev_warn(d, "no reg info\n");
> >> + goto init_fail;
> >> + }
> >> +
> >> + ret = of_property_read_u32(n, "channel", &priv->chan);
> >> + if (ret) {
> >> + dev_warn(d, "no channel info\n");
> >> + goto init_fail;
> >> + }
> >> + } else {
> >> + dev_warn(d, "no port-handle\n");
> >> + ret = -EINVAL;
> >> + goto init_fail;
> >> + }
> >
> > Doing the lookup by "compatible" string doesn't really help you
> > at solve the problem of single-instance ppe at all, because that
> > function will only ever look at the first one. Use
> > syscon_regmap_lookup_by_phandle instead and pass the phandle
> > you get from the "port-handle" property.
>
> Did some experiment, the only ppe base is got from syscon probe.
> And looking up by "compatible" did work for three controllers at the same time.
The point is that it won't work for more than one ppe instance.
> > Also, since you decided to treat the ppe as a dump regmap, I would
> > recommend moving the 'reg' and 'channel' properties into arguments
> > of the port-handle link, and retting rid of the child nodes of
> > the ppe, like:
> >
> > + ppe: ppe@28c0000 {
> > + compatible = "hisilicon,hip04-ppe", "syscon";
> > + reg = <0x28c0000 0x10000>;
> > + };
> > +
> > + fe: ethernet@28b0000 {
> > + compatible = "hisilicon,hip04-mac";
> > + reg = <0x28b0000 0x10000>;
> > + interrupts = <0 413 4>;
> > + phy-mode = "mii";
> > + port-handle = <&ppe 0xf1 0>;
> > + };
> >
>
> Would you mind giving more hints about how to parse the args.
> I am thinking of using of_parse_phandle_with_args, is that correct method?
I would just use of_property_read_u32_array() to read all three cells,
then pass the first cell entry into syscon_regmap_lookup_by_phandle.
of_parse_phandle_with_args() is what you would use if you were registering
a higher-level driver for the ppe rather than using syscon.
Arnd
next prev parent reply other threads:[~2014-03-25 8:12 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 14:14 [PATCH v3 0/3] add hisilicon hip04 ethernet driver Zhangfei Gao
2014-03-24 14:14 ` [PATCH 1/3] Documentation: add Device tree bindings for Hisilicon hip04 ethernet Zhangfei Gao
[not found] ` <1395670496-17381-1-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-03-24 14:14 ` [PATCH 2/3] net: hisilicon: new hip04 MDIO driver Zhangfei Gao
2014-03-24 14:14 ` [PATCH 3/3] net: hisilicon: new hip04 ethernet driver 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 [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2014-04-05 4:35 [PATCH v7 0/3] add hisilicon " Zhangfei Gao
2014-04-05 4:35 ` [PATCH 3/3] net: hisilicon: new " Zhangfei Gao
2014-04-07 18:53 ` David Miller
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
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-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=17142825.cN9DfpvuLc@wuerfel \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--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@gmail.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).