diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2012-09-28 18:28:27 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2012-09-28 18:28:27 +0000 |
| commit | 063efed28c45a81e9f92c69b2fbe1f4f278c8f1a (patch) | |
| tree | 66a3fa6f2f977c6c8d808397e65fc31995eab050 /sys | |
| parent | a1c9ec3ce0c44db02394c132fb073aba62565da3 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/bxe/if_bxe.c | 5 | ||||
| -rw-r--r-- | sys/dev/e1000/if_em.c | 4 | ||||
| -rw-r--r-- | sys/dev/e1000/if_igb.c | 4 | ||||
| -rw-r--r-- | sys/dev/ixgbe/ixgbe.c | 2 | ||||
| -rw-r--r-- | sys/dev/ixgbe/ixv.c | 4 | ||||
| -rw-r--r-- | sys/dev/mxge/if_mxge.c | 2 | ||||
| -rw-r--r-- | sys/dev/oce/oce_if.c | 4 | ||||
| -rw-r--r-- | sys/dev/vxge/vxge.c | 4 | ||||
| -rw-r--r-- | sys/net/if_var.h | 20 | ||||
| -rw-r--r-- | sys/ofed/drivers/net/mlx4/en_tx.c | 4 | ||||
| -rw-r--r-- | sys/sys/buf_ring.h | 12 |
11 files changed, 29 insertions, 36 deletions
diff --git a/sys/dev/bxe/if_bxe.c b/sys/dev/bxe/if_bxe.c index c51480c06fa79..fe6bd8bcad9bb 100644 --- a/sys/dev/bxe/if_bxe.c +++ b/sys/dev/bxe/if_bxe.c @@ -9557,6 +9557,11 @@ bxe_tx_mq_start_locked(struct ifnet *ifp, /* The transmit frame was enqueued successfully. */ tx_count++; + /* Update stats */ + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; + /* Send a copy of the frame to any BPF listeners. */ BPF_MTAP(ifp, next); diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 63f399f130e9a..112b538f5585e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -922,7 +922,9 @@ em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) break; } enq++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index cd91ad4e1ade4..13189108c0606 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -1014,7 +1014,9 @@ igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) break; } enq++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index acf4ba2546e90..19e3c407d7ac2 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -853,7 +853,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) break; } enqueued++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -5335,6 +5334,7 @@ ixgbe_update_stats_counters(struct adapter *adapter) ifp->if_ibytes = adapter->stats.gorc; ifp->if_obytes = adapter->stats.gotc; ifp->if_imcasts = adapter->stats.mprc; + ifp->if_omcasts = adapter->stats.mptc; ifp->if_collisions = 0; /* Rx Errors */ diff --git a/sys/dev/ixgbe/ixv.c b/sys/dev/ixgbe/ixv.c index b429560e640ba..1acb3f0bf9600 100644 --- a/sys/dev/ixgbe/ixv.c +++ b/sys/dev/ixgbe/ixv.c @@ -641,7 +641,9 @@ ixv_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) break; } enqueued++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index c61d360141483..1e51d1bc3bb8f 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include <sys/sx.h> #include <sys/taskqueue.h> -/* count xmits ourselves, rather than via drbr */ -#define NO_SLOW_STATS #include <net/if.h> #include <net/if_arp.h> #include <net/ethernet.h> diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index fdeb339eea280..5a47424257af3 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -1183,7 +1183,9 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) } break; } - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); next = drbr_dequeue(ifp, br); } diff --git a/sys/dev/vxge/vxge.c b/sys/dev/vxge/vxge.c index 0750e3594b472..9948801a54432 100644 --- a/sys/dev/vxge/vxge.c +++ b/sys/dev/vxge/vxge.c @@ -709,7 +709,9 @@ vxge_mq_send_locked(ifnet_t ifp, vxge_vpath_t *vpath, mbuf_t m_head) VXGE_DRV_STATS(vpath, tx_again); break; } - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 01ec2b602ddea..8a1d5cc560f31 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -590,22 +590,10 @@ do { \ } while (0) #ifdef _KERNEL -static __inline void -drbr_stats_update(struct ifnet *ifp, int len, int mflags) -{ -#ifndef NO_SLOW_STATS - ifp->if_obytes += len; - if (mflags & M_MCAST) - ifp->if_omcasts++; -#endif -} - static __inline int drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) { int error = 0; - int len = m->m_pkthdr.len; - int mflags = m->m_flags; #ifdef ALTQ if (ALTQ_IS_ENABLED(&ifp->if_snd)) { @@ -613,12 +601,10 @@ drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) return (error); } #endif - if ((error = buf_ring_enqueue_bytes(br, m, len)) == ENOBUFS) { - br->br_drops++; + error = buf_ring_enqueue(br, m); + if (error) m_freem(m); - } else - drbr_stats_update(ifp, len, mflags); - + return (error); } diff --git a/sys/ofed/drivers/net/mlx4/en_tx.c b/sys/ofed/drivers/net/mlx4/en_tx.c index cd45f9dc0ac7f..4d1690f8da0ea 100644 --- a/sys/ofed/drivers/net/mlx4/en_tx.c +++ b/sys/ofed/drivers/net/mlx4/en_tx.c @@ -948,7 +948,9 @@ mlx4_en_transmit_locked(struct ifnet *dev, int tx_ind, struct mbuf *m) break; } enqueued++; - drbr_stats_update(dev, next->m_pkthdr.len, next->m_flags); + dev->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + dev->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(dev, next); if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) diff --git a/sys/sys/buf_ring.h b/sys/sys/buf_ring.h index 57e42e5c18901..9f99fa20a66ef 100644 --- a/sys/sys/buf_ring.h +++ b/sys/sys/buf_ring.h @@ -48,7 +48,6 @@ struct buf_ring { int br_prod_mask; uint64_t br_drops; uint64_t br_prod_bufs; - uint64_t br_prod_bytes; /* * Pad out to next L2 cache line */ @@ -74,7 +73,7 @@ struct buf_ring { * */ static __inline int -buf_ring_enqueue_bytes(struct buf_ring *br, void *buf, int nbytes) +buf_ring_enqueue(struct buf_ring *br, void *buf) { uint32_t prod_head, prod_next; uint32_t cons_tail; @@ -95,6 +94,7 @@ buf_ring_enqueue_bytes(struct buf_ring *br, void *buf, int nbytes) prod_next = (prod_head + 1) & br->br_prod_mask; if (prod_next == cons_tail) { + br->br_drops++; critical_exit(); return (ENOBUFS); } @@ -117,19 +117,11 @@ buf_ring_enqueue_bytes(struct buf_ring *br, void *buf, int nbytes) while (br->br_prod_tail != prod_head) cpu_spinwait(); br->br_prod_bufs++; - br->br_prod_bytes += nbytes; br->br_prod_tail = prod_next; critical_exit(); return (0); } -static __inline int -buf_ring_enqueue(struct buf_ring *br, void *buf) -{ - - return (buf_ring_enqueue_bytes(br, buf, 0)); -} - /* * multi-consumer safe dequeue * |
