aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ixl/ixl_txrx.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2014-09-27 20:54:57 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2014-09-27 20:54:57 +0000
commit4b443922e0d44014207ebc72ef5a16081d0c4fef (patch)
tree729338e838705b1192a679659083bf59b847f73a /sys/dev/ixl/ixl_txrx.c
parent08c95c53d791b5d977ab6ff47c1582a0cc823308 (diff)
downloadsrc-4b443922e0d44014207ebc72ef5a16081d0c4fef.tar.gz
src-4b443922e0d44014207ebc72ef5a16081d0c4fef.zip
Convert driver to if_get_counter method.
Submitted by: rstone Reviewed by: Eric Joyner <ricera10 gmail.com>
Notes
Notes: svn path=/head/; revision=272227
Diffstat (limited to 'sys/dev/ixl/ixl_txrx.c')
-rwxr-xr-xsys/dev/ixl/ixl_txrx.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c
index 306d4ecf02d4..b804c76f9840 100755
--- a/sys/dev/ixl/ixl_txrx.c
+++ b/sys/dev/ixl/ixl_txrx.c
@@ -783,8 +783,6 @@ ixl_get_tx_head(struct ixl_queue *que)
bool
ixl_txeof(struct ixl_queue *que)
{
- struct ixl_vsi *vsi = que->vsi;
- struct ifnet *ifp = vsi->ifp;
struct tx_ring *txr = &que->txr;
u32 first, last, head, done, processed;
struct ixl_tx_buf *buf;
@@ -857,7 +855,6 @@ ixl_txeof(struct ixl_queue *que)
tx_desc = &txr->base[first];
}
++txr->packets;
- ++ifp->if_opackets;
/* See if there is more work now */
last = buf->eop_index;
if (last != -1) {
@@ -1420,7 +1417,6 @@ ixl_rxeof(struct ixl_queue *que, int count)
** error results.
*/
if (eop && (error & (1 << I40E_RX_DESC_ERROR_RXE_SHIFT))) {
- ifp->if_ierrors++;
rxr->discarded++;
ixl_rx_discard(rxr, i);
goto next_desc;
@@ -1529,7 +1525,6 @@ ixl_rxeof(struct ixl_queue *que, int count)
if (eop) {
sendmp->m_pkthdr.rcvif = ifp;
/* gather stats */
- ifp->if_ipackets++;
rxr->rx_packets++;
rxr->rx_bytes += sendmp->m_pkthdr.len;
/* capture data for dynamic ITR adjustment */
@@ -1625,3 +1620,43 @@ ixl_rx_checksum(struct mbuf * mp, u32 status, u32 error, u8 ptype)
}
return;
}
+
+#if __FreeBSD_version >= 1100000
+uint64_t
+ixl_get_counter(if_t ifp, ift_counter cnt)
+{
+ struct ixl_vsi *vsi;
+
+ vsi = if_getsoftc(ifp);
+
+ switch (cnt) {
+ case IFCOUNTER_IPACKETS:
+ return (vsi->ipackets);
+ case IFCOUNTER_IERRORS:
+ return (vsi->ierrors);
+ case IFCOUNTER_OPACKETS:
+ return (vsi->opackets);
+ case IFCOUNTER_OERRORS:
+ return (vsi->oerrors);
+ case IFCOUNTER_COLLISIONS:
+ /* Collisions are by standard impossible in 40G/10G Ethernet */
+ return (0);
+ case IFCOUNTER_IBYTES:
+ return (vsi->ibytes);
+ case IFCOUNTER_OBYTES:
+ return (vsi->obytes);
+ case IFCOUNTER_IMCASTS:
+ return (vsi->imcasts);
+ case IFCOUNTER_OMCASTS:
+ return (vsi->omcasts);
+ case IFCOUNTER_IQDROPS:
+ return (vsi->iqdrops);
+ case IFCOUNTER_OQDROPS:
+ return (vsi->oqdrops);
+ case IFCOUNTER_NOPROTO:
+ return (vsi->noproto);
+ default:
+ return (if_get_counter_default(ifp, cnt));
+ }
+}
+#endif