* [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll
@ 2013-01-09 20:17 Choi, David
2013-01-09 20:59 ` Ben Hutchings
0 siblings, 1 reply; 2+ messages in thread
From: Choi, David @ 2013-01-09 20:17 UTC (permalink / raw)
To: davem@davemloft.net; +Cc: netdev@vger.kernel.org, Choi, David, Doong, Ping
From: David J. Choi <david.choi@micrel.com>
Summary of changes:
.add codes to collect statistical information(for example rx/tx packets/bytes, error packets)
about Ethernet packets.
Signed-off-by: David J. Choi <david.choi@micrel.com>
---
--- linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c.orig 2013-01-03 09:45:57.830447923 -0800
+++ linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c 2013-01-03 10:05:57.675756568 -0800
@@ -801,7 +801,14 @@ static void ks_rcv(struct ks_net *ks, st
skb_put(skb, frame_hdr->len);
skb->protocol = eth_type_trans(skb, netdev);
netif_rx(skb);
+ netdev->stats.rx_packets++;
+ netdev->stats.rx_bytes += (frame_hdr->len - 4);
} else {
+ netdev->stats.rx_dropped++;
+ if ((frame_hdr->len >= RX_BUF_SIZE) || (frame_hdr->len == 0))
+ netdev->stats.rx_length_errors++;
+ if (frame_hdr->sts & RXFSHR_RXFV)
+ netdev->stats.rx_frame_errors++;
pr_err("%s: err:skb alloc\n", __func__);
ks_wrreg16(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
if (skb)
@@ -876,6 +883,8 @@ static irqreturn_t ks_irq(int irq, void
pmecr &= ~PMECR_WKEVT_MASK;
ks_wrreg16(ks, KS_PMECR, pmecr | PMECR_WKEVT_LINK);
}
+ if (unlikely(status & IRQ_RXOI))
+ ks->netdev->stats.rx_over_errors++;
/* this should be the last in IRQ handler*/
ks_restore_cmd_reg(ks);
@@ -1015,6 +1024,8 @@ static int ks_start_xmit(struct sk_buff
if (likely(ks_tx_fifo_space(ks) >= skb->len + 12)) {
ks_write_qmu(ks, skb->data, skb->len);
+ netdev->stats.tx_bytes += skb->len;
+ netdev->stats.tx_packets++;
dev_kfree_skb(skb);
} else
retv = NETDEV_TX_BUSY;
---
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll
2013-01-09 20:17 [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll Choi, David
@ 2013-01-09 20:59 ` Ben Hutchings
0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2013-01-09 20:59 UTC (permalink / raw)
To: Choi, David; +Cc: davem@davemloft.net, netdev@vger.kernel.org, Doong, Ping
Again this needs a proper subject, like 'ks8851_mll: Implement basic
statistics'.
It should be based on the 'net-next' tree.
On Wed, 2013-01-09 at 20:17 +0000, Choi, David wrote:
> From: David J. Choi <david.choi@micrel.com>
>
> Summary of changes:
> .add codes to collect statistical information(for example rx/tx packets/bytes, error packets)
> about Ethernet packets.
>
> Signed-off-by: David J. Choi <david.choi@micrel.com>
> ---
>
> --- linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c.orig 2013-01-03 09:45:57.830447923 -0800
> +++ linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c 2013-01-03 10:05:57.675756568 -0800
> @@ -801,7 +801,14 @@ static void ks_rcv(struct ks_net *ks, st
> skb_put(skb, frame_hdr->len);
> skb->protocol = eth_type_trans(skb, netdev);
> netif_rx(skb);
> + netdev->stats.rx_packets++;
> + netdev->stats.rx_bytes += (frame_hdr->len - 4);
You're subtracting 4 for the CRC? That really shouldn't be visible to
the kernel (unless the NETIF_F_RXFCS feature is enabled on the device).
So you should also substract 4 from the length passed to skb_put().
(That would be a separate patch, probably suitable for the 'net' tree.)
> } else {
> + netdev->stats.rx_dropped++;
> + if ((frame_hdr->len >= RX_BUF_SIZE) || (frame_hdr->len == 0))
> + netdev->stats.rx_length_errors++;
> + if (frame_hdr->sts & RXFSHR_RXFV)
> + netdev->stats.rx_frame_errors++;
[...]
These two increment statements are indented wrongly.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-09 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09 20:17 [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll Choi, David
2013-01-09 20:59 ` Ben Hutchings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox