From: Joe Perches <joe@perches.com> To: Jonas Jensen <jonas.jensen@gmail.com> Cc: netdev@vger.kernel.org, davem@davemloft.net, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arm@kernel.org, florian@openwrt.org Subject: Re: [PATCH v3] net: Add MOXA ART SoCs ethernet driver Date: Wed, 31 Jul 2013 11:56:38 -0700 [thread overview] Message-ID: <1375296998.5729.8.camel@joe-AO722> (raw) In-Reply-To: <1375280401-5564-1-git-send-email-jonas.jensen@gmail.com> On Wed, 2013-07-31 at 16:20 +0200, Jonas Jensen wrote: > The MOXA UC-711X hardware(s) has an ethernet controller that seem to be > developed internally. The IC used is "RTL8201CP". Just some simple comments... > diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c [] > +static int moxart_rx_poll(struct napi_struct *napi, int budget) [] > + while (1) { [] > + if (ui & (RX_ERR | CRC_ERR | FTL | RUNT | RX_ODD_NB)) { > + netdev_err(ndev, "packet error\n"); This is generally a bad idea as it can flood the log. It's probably better to remove it. If you really want logging, then at least use net_ratelimit(). Generally, the stats are enough. > + priv->stats.rx_dropped++; > + priv->stats.rx_errors++; [] > +static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) [] > + if (txdesc->txdes0.ubit.tx_dma_own) { > + netdev_err(ndev, "no TX space for packet\n"); > + priv->stats.tx_dropped++; here too. > +static int moxart_mac_probe(struct platform_device *pdev) [] > + priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, > + GFP_ATOMIC); > + if (!priv->tx_buf_base) { > + netdev_err(ndev, "TX buffer alloc failed\n"); > + goto init_fail; > + } > + > + priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, > + GFP_ATOMIC); > + if (!priv->rx_buf_base) { > + netdev_err(ndev, "RX buffer alloc failed\n"); > + goto init_fail; > + } Extra OOM messages aren't useful, there's a generic OOM and a dump_stack from the kernel. > + netdev_dbg(ndev, "%s: IRQ=%d address=%02x:%02x:%02x:%02x:%02x:%02x\n", > + __func__, ndev->irq, > + ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2], > + ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]); There's a mac address helper you can use: netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n" __func__, ndev->irq, ndev->dev_addr);
WARNING: multiple messages have this Message-ID (diff)
From: joe@perches.com (Joe Perches) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] net: Add MOXA ART SoCs ethernet driver Date: Wed, 31 Jul 2013 11:56:38 -0700 [thread overview] Message-ID: <1375296998.5729.8.camel@joe-AO722> (raw) In-Reply-To: <1375280401-5564-1-git-send-email-jonas.jensen@gmail.com> On Wed, 2013-07-31 at 16:20 +0200, Jonas Jensen wrote: > The MOXA UC-711X hardware(s) has an ethernet controller that seem to be > developed internally. The IC used is "RTL8201CP". Just some simple comments... > diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c [] > +static int moxart_rx_poll(struct napi_struct *napi, int budget) [] > + while (1) { [] > + if (ui & (RX_ERR | CRC_ERR | FTL | RUNT | RX_ODD_NB)) { > + netdev_err(ndev, "packet error\n"); This is generally a bad idea as it can flood the log. It's probably better to remove it. If you really want logging, then at least use net_ratelimit(). Generally, the stats are enough. > + priv->stats.rx_dropped++; > + priv->stats.rx_errors++; [] > +static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) [] > + if (txdesc->txdes0.ubit.tx_dma_own) { > + netdev_err(ndev, "no TX space for packet\n"); > + priv->stats.tx_dropped++; here too. > +static int moxart_mac_probe(struct platform_device *pdev) [] > + priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, > + GFP_ATOMIC); > + if (!priv->tx_buf_base) { > + netdev_err(ndev, "TX buffer alloc failed\n"); > + goto init_fail; > + } > + > + priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, > + GFP_ATOMIC); > + if (!priv->rx_buf_base) { > + netdev_err(ndev, "RX buffer alloc failed\n"); > + goto init_fail; > + } Extra OOM messages aren't useful, there's a generic OOM and a dump_stack from the kernel. > + netdev_dbg(ndev, "%s: IRQ=%d address=%02x:%02x:%02x:%02x:%02x:%02x\n", > + __func__, ndev->irq, > + ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2], > + ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]); There's a mac address helper you can use: netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n" __func__, ndev->irq, ndev->dev_addr);
next prev parent reply other threads:[~2013-07-31 18:56 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-18 9:46 [PATCH] net: Add MOXA ART SoCs ethernet driver Jonas Jensen 2013-07-18 9:46 ` Jonas Jensen 2013-07-20 10:55 ` Jonas Jensen 2013-07-20 10:55 ` Jonas Jensen 2013-07-22 11:09 ` Florian Fainelli 2013-07-22 11:09 ` Florian Fainelli 2013-07-22 11:09 ` Florian Fainelli 2013-07-26 13:12 ` Jonas Jensen 2013-07-26 13:12 ` Jonas Jensen 2013-07-26 13:12 ` Jonas Jensen 2013-07-26 12:48 ` [PATCH v2] " Jonas Jensen 2013-07-26 12:48 ` Jonas Jensen 2013-07-30 23:24 ` David Miller 2013-07-30 23:24 ` David Miller 2013-07-31 14:20 ` [PATCH v3] " Jonas Jensen 2013-07-31 14:20 ` Jonas Jensen 2013-07-31 18:56 ` Joe Perches [this message] 2013-07-31 18:56 ` Joe Perches 2013-08-01 0:04 ` David Miller 2013-08-01 0:04 ` David Miller 2013-08-01 9:39 ` [PATCH v4] " Jonas Jensen 2013-08-01 9:39 ` Jonas Jensen 2013-08-01 22:51 ` David Miller 2013-08-01 22:51 ` David Miller 2013-08-01 22:51 ` David Miller 2013-08-02 10:04 ` Mark Rutland 2013-08-02 10:04 ` Mark Rutland 2013-08-02 10:04 ` Mark Rutland 2013-08-02 10:23 ` Florian Fainelli 2013-08-02 10:23 ` Florian Fainelli 2013-08-02 10:23 ` Florian Fainelli 2013-08-08 11:34 ` [PATCH v5] " Jonas Jensen 2013-08-08 11:34 ` Jonas Jensen 2013-08-12 4:38 ` David Miller 2013-08-12 4: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=1375296998.5729.8.camel@joe-AO722 \ --to=joe@perches.com \ --cc=arm@kernel.org \ --cc=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=florian@openwrt.org \ --cc=jonas.jensen@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-doc@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.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: linkBe 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.