From: David Miller <davem@davemloft.net>
To: mirq-linux@rere.qmqm.pl
Cc: ulli.kroll@googlemail.com, gemini-board-dev@lists.berlios.de,
netdev@vger.kernel.org, linux-kernel.bfrz@manchmal.in-ulm.de
Subject: Re: [PATCH v5] Gemini: Gigabit ethernet driver
Date: Fri, 28 Jan 2011 14:31:59 -0800 (PST) [thread overview]
Message-ID: <20110128.143159.48506419.davem@davemloft.net> (raw)
In-Reply-To: <20110126232419.4794513909@rere.qmqm.pl>
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Thu, 27 Jan 2011 00:24:19 +0100 (CET)
> +#define NETIF_TSO_FEATURES \
> + (NETIF_F_TSO|NETIF_F_TSO_ECN|NETIF_F_TSO6)
> +#define GMAC_TX_OFFLOAD_FEATURES \
> + (NETIF_TSO_FEATURES|NETIF_F_ALL_CSUM)
Please, when definiting macros locally for your driver, do not name
them with prefixes that match those defined generically by the
network stack. Otherwise it is confusing for people reading the
driver.
One should be able to see "NETIF_XXX" somewhere and expect to find
it's definition somewhere in the generic networking driver interfaces,
not in the driver itself.
> +static struct toe_private *netdev_to_toe(struct net_device *dev)
> +{
> + return dev->ml_priv;
> +}
There is no reason to use ->ml_priv just to have a common backpointer
to a structure shared between multiple interfaces.
Simply add a "struct toe_private *" to your "struct gmac_private" and
stick it there.
The cost of the dereference is identical in both cases, so there is not
even a performance incentive to use ->ml_priv.
> +static void __iomem *gmac_ctl_reg(struct net_device *dev, unsigned int reg)
> +{
> + return (void __iomem *)dev->base_addr + reg;
> +}
Please do not abuse dev->base_addr in this way, simply define another
"void __iomem *" pointer in your gmac_private and use that.
> + page = pfn_to_page(dma_to_pfn(toe->dev, rx->word2.buf_adr));
Please do not use non-portable routines such as dma_to_pfn() unless it
is absolutely unavoidable. Instead, use schemes for page struct
lookup like those used by drivers such as drivers/net/niu.c, which uses
a hash table to find pages based upon DMA address.
I'd like you to be able to enable this driver on as many platforms as
possible, not just ARM, so we can be build testing your driver as we
make changes to various network driver APIs, and we can't do that if
you put ARM specific stuff in here.
> + dev_err(&dev->dev, "Unsupported MII interface\n");
Please use "netdev_err(dev, ..."
Please use netdev_*() when possible elsewhere in this driver too.
> + writel(
> + (GMAC0_SWTQ00_EOF_INT_BIT|GMAC0_SWTQ00_FIN_INT_BIT)
> + << (6 * dev->dev_id + txq_num),
> + toe_reg(toe, GLOBAL_INTERRUPT_STATUS_0_REG));
Please format this more reasonably, this looks awful.
> + txq->ring[w].word0.bits32 = skb_headlen(skb);
> + txq->ring[w].word1.bits32 = skb->len | tss_flags;
> + txq->ring[w].word2.bits32 = mapping;
> + txq->ring[w].word3.bits32 = tss_pkt_len(skb) | SOF_BIT;
What is the endinness of the RX and TX descriptors of this chipset?
Please use "__be32", "__le32", and the endianness conversion interfaces
as needed.
next prev parent reply other threads:[~2011-01-28 22:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-29 13:02 [PATCH v3] Gemini: Gigabit ethernet driver Michał Mirosław
2010-12-30 8:39 ` [PATCH v4] " Michał Mirosław
2010-12-30 9:19 ` Joe Perches
2010-12-30 9:48 ` Michał Mirosław
2010-12-30 11:48 ` Hans Ulli Kroll
2011-01-26 23:24 ` [PATCH v5] " Michał Mirosław
2011-01-28 22:31 ` David Miller [this message]
2011-02-02 17:18 ` Michał Mirosław
2011-02-05 13:19 ` Michał Mirosław
-- strict thread matches above, loose matches on Subject: below --
2011-04-10 16:05 Michał Mirosław
2011-04-11 20:38 ` David Miller
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=20110128.143159.48506419.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gemini-board-dev@lists.berlios.de \
--cc=linux-kernel.bfrz@manchmal.in-ulm.de \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
--cc=ulli.kroll@googlemail.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 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).