From: "Choi, David" <David.Choi@Micrel.Com>
To: "davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Choi, David" <David.Choi@Micrel.Com>,
"Doong, Ping" <Ping.Doong@Micrel.Com>
Subject: [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll
Date: Wed, 9 Jan 2013 20:17:29 +0000 [thread overview]
Message-ID: <FD9AD8C5375B924CABC56D982DB3A802079D2520@EXMB1.micrel.com> (raw)
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;
---
next reply other threads:[~2013-01-09 20:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 20:17 Choi, David [this message]
2013-01-09 20:59 ` [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll Ben Hutchings
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=FD9AD8C5375B924CABC56D982DB3A802079D2520@EXMB1.micrel.com \
--to=david.choi@micrel.com \
--cc=Ping.Doong@Micrel.Com \
--cc=davem@davemloft.net \
--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: 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