diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-09-16 21:48:48 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-09-16 21:48:48 +0000 |
commit | 6667db3130b236ae6c2de05770faec29f9d7d7a6 (patch) | |
tree | 018e76934e0cb502f1e66744d3c9c1014d03cf24 /sys | |
parent | cb8799d06f508f998ea8171037e95ba072adba85 (diff) | |
download | src-6667db3130b236ae6c2de05770faec29f9d7d7a6.tar.gz src-6667db3130b236ae6c2de05770faec29f9d7d7a6.zip |
* Fix if_omcast handling
* Convert if_oerrors to pcpu.
Suggested by: glebius
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=271691
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_vlan.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 5a5e7122139a..94a9ce0ed76d 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -104,14 +104,15 @@ struct vlan_mc_entry { struct ifvlan { struct ifvlantrunk *ifv_trunk; struct ifnet *ifv_ifp; - void *ifv_cookie; counter_u64_t ifv_ipackets; counter_u64_t ifv_ibytes; counter_u64_t ifv_opackets; counter_u64_t ifv_obytes; counter_u64_t ifv_omcasts; + counter_u64_t ifv_oerrors; #define TRUNK(ifv) ((ifv)->ifv_trunk) #define PARENT(ifv) ((ifv)->ifv_trunk->parent) + void *ifv_cookie; int ifv_pflags; /* special flags we have set on parent */ struct ifv_linkmib { int ifvm_encaplen; /* encapsulation length */ @@ -959,6 +960,7 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ifv->ifv_ibytes = counter_u64_alloc(M_WAITOK); ifv->ifv_obytes = counter_u64_alloc(M_WAITOK); ifv->ifv_omcasts = counter_u64_alloc(M_WAITOK); + ifv->ifv_oerrors = counter_u64_alloc(M_WAITOK); ifp->if_softc = ifv; /* @@ -1026,6 +1028,7 @@ vlan_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) counter_u64_free(ifv->ifv_ibytes); counter_u64_free(ifv->ifv_obytes); counter_u64_free(ifv->ifv_omcasts); + counter_u64_free(ifv->ifv_oerrors); free(ifv, M_VLAN); ifc_free_unit(ifc, unit); @@ -1063,7 +1066,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_oerrors++; + counter_u64_add(ifv->ifv_oerrors, 1); return (ENETDOWN); } @@ -1090,7 +1093,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (n > 0) { if_printf(ifp, "cannot pad short frame\n"); - ifp->if_oerrors++; + counter_u64_add(ifv->ifv_oerrors, 1); m_freem(m); return (0); } @@ -1110,7 +1113,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) m = ether_vlanencap(m, ifv->ifv_vid); if (m == NULL) { if_printf(ifp, "unable to prepend VLAN header\n"); - ifp->if_oerrors++; + counter_u64_add(ifv->ifv_oerrors, 1); return (0); } } @@ -1122,9 +1125,9 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (error == 0) { counter_u64_add(ifv->ifv_opackets, 1); counter_u64_add(ifv->ifv_obytes, len); - counter_u64_add(ifv->ifv_omcasts, 1); + counter_u64_add(ifv->ifv_omcasts, mcast); } else - ifp->if_oerrors++; + counter_u64_add(ifv->ifv_oerrors, 1); return (error); } @@ -1146,6 +1149,8 @@ vlan_get_counter(struct ifnet *ifp, ifnet_counter cnt) return (counter_u64_fetch(ifv->ifv_obytes)); case IFCOUNTER_OMCASTS: return (counter_u64_fetch(ifv->ifv_omcasts)); + case IFCOUNTER_OERRORS: + return (counter_u64_fetch(ifv->ifv_oerrors)); default: return (if_get_counter_compat(ifp, cnt)); } |