svn commit: r271861 - head/sys/net80211

Gleb Smirnoff glebius at FreeBSD.org
Fri Sep 19 09:20:58 UTC 2014


Author: glebius
Date: Fri Sep 19 09:20:55 2014
New Revision: 271861
URL: http://svnweb.freebsd.org/changeset/base/271861

Log:
  Mechanically convert to if_inc_counter().

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_monitor.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -238,7 +238,7 @@ static int
 null_transmit(struct ifnet *ifp, struct mbuf *m)
 {
 	m_freem(m);
-	ifp->if_oerrors++;
+	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	return EACCES;		/* XXX EIO/EPERM? */
 }
 

Modified: head/sys/net80211/ieee80211_adhoc.c
==============================================================================
--- head/sys/net80211/ieee80211_adhoc.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_adhoc.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -653,7 +653,7 @@ adhoc_input(struct ieee80211_node *ni, s
 		break;
 	}
 err:
-	ifp->if_ierrors++;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 out:
 	if (m != NULL) {
 		if (need_tap && ieee80211_radiotap_active_vap(vap))

Modified: head/sys/net80211/ieee80211_hostap.c
==============================================================================
--- head/sys/net80211/ieee80211_hostap.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_hostap.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -368,7 +368,7 @@ hostap_deliver_data(struct ieee80211vap 
 	/*
 	 * Do accounting.
 	 */
-	ifp->if_ipackets++;
+	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 	IEEE80211_NODE_STAT(ni, rx_data);
 	IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
 	if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
@@ -384,7 +384,7 @@ hostap_deliver_data(struct ieee80211vap 
 		if (m->m_flags & M_MCAST) {
 			mcopy = m_dup(m, M_NOWAIT);
 			if (mcopy == NULL)
-				ifp->if_oerrors++;
+				if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			else
 				mcopy->m_flags |= M_MCAST;
 		} else {
@@ -422,7 +422,7 @@ hostap_deliver_data(struct ieee80211vap 
 			if (err) {
 				/* NB: IFQ_HANDOFF reclaims mcopy */
 			} else {
-				ifp->if_opackets++;
+				if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 			}
 		}
 	}
@@ -909,7 +909,7 @@ hostap_input(struct ieee80211_node *ni, 
 		break;
 	}
 err:
-	ifp->if_ierrors++;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 out:
 	if (m != NULL) {
 		if (need_tap && ieee80211_radiotap_active_vap(vap))

Modified: head/sys/net80211/ieee80211_input.c
==============================================================================
--- head/sys/net80211/ieee80211_input.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_input.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -261,7 +261,7 @@ ieee80211_deliver_data(struct ieee80211v
 	/*
 	 * Do accounting.
 	 */
-	ifp->if_ipackets++;
+	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 	IEEE80211_NODE_STAT(ni, rx_data);
 	IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
 	if (ETHER_IS_MULTICAST(eh->ether_dhost)) {

Modified: head/sys/net80211/ieee80211_mesh.c
==============================================================================
--- head/sys/net80211/ieee80211_mesh.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_mesh.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -1047,7 +1047,7 @@ mesh_transmit_to_gate(struct ieee80211va
 
 	ni = ieee80211_mesh_find_txnode(vap, rt_gate->rt_dest);
 	if (ni == NULL) {
-		ifp->if_oerrors++;
+		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 		m_freem(m);
 		return;
 	}
@@ -1183,7 +1183,7 @@ mesh_forward(struct ieee80211vap *vap, s
 		IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh,
 		    "%s", "frame not fwd'd, cannot dup");
 		vap->iv_stats.is_mesh_fwd_nobuf++;
-		ifp->if_oerrors++;
+		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 		return;
 	}
 	mcopy = m_pullup(mcopy, ieee80211_hdrspace(ic, wh) +
@@ -1192,7 +1192,7 @@ mesh_forward(struct ieee80211vap *vap, s
 		IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh,
 		    "%s", "frame not fwd'd, too short");
 		vap->iv_stats.is_mesh_fwd_tooshort++;
-		ifp->if_oerrors++;
+		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 		m_freem(mcopy);
 		return;
 	}
@@ -1250,7 +1250,7 @@ mesh_forward(struct ieee80211vap *vap, s
 		/* NB: IFQ_HANDOFF reclaims mbuf */
 		ieee80211_free_node(ni);
 	} else {
-		ifp->if_opackets++;
+		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	}
 }
 
@@ -1844,7 +1844,7 @@ mesh_input(struct ieee80211_node *ni, st
 		break;
 	}
 err:
-	ifp->if_ierrors++;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 out:
 	if (m != NULL) {
 		if (need_tap && ieee80211_radiotap_active_vap(vap))
@@ -3333,8 +3333,9 @@ mesh_airtime_calc(struct ieee80211_node 
 	    ifp->if_mtu + IEEE80211_MESH_MAXOVERHEAD, rate, 0) << M_BITS;
 	/* Error rate in percentage */
 	/* XXX assuming small failures are ok */
-	errrate = (((ifp->if_oerrors +
-	    ifp->if_ierrors) / 100) << M_BITS) / 100;
+	errrate = (((ifp->if_get_counter(ifp, IFCOUNTER_OERRORS) +
+	    ifp->if_get_counter(ifp, IFCOUNTER_IERRORS)) / 100) << M_BITS)
+	    / 100;
 	res = (overhead + (nbits / rate)) *
 	    ((1 << S_FACTOR) / ((1 << M_BITS) - errrate));
 

Modified: head/sys/net80211/ieee80211_monitor.c
==============================================================================
--- head/sys/net80211/ieee80211_monitor.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_monitor.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -130,7 +130,7 @@ monitor_input(struct ieee80211_node *ni,
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ifnet *ifp = vap->iv_ifp;
 
-	ifp->if_ipackets++;
+	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 
 	if (ieee80211_radiotap_active_vap(vap))
 		ieee80211_radiotap_rx(vap, m);

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_output.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -157,7 +157,7 @@ ieee80211_vap_pkt_send_dest(struct ieee8
 		    ni->ni_macaddr, NULL,
 		    "%s", "classification failure");
 		vap->iv_stats.is_tx_classify++;
-		ifp->if_oerrors++;
+		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 		m_freem(m);
 		ieee80211_free_node(ni);
 
@@ -251,7 +251,7 @@ ieee80211_vap_pkt_send_dest(struct ieee8
 		/* NB: IFQ_HANDOFF reclaims mbuf */
 		ieee80211_free_node(ni);
 	} else {
-		ifp->if_opackets++;
+		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	}
 	ic->ic_lastdata = ticks;
 
@@ -299,7 +299,7 @@ ieee80211_start_pkt(struct ieee80211vap 
 		IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
 		    "discard frame, %s\n", "m_pullup failed");
 		vap->iv_stats.is_tx_nobuf++;	/* XXX */
-		ifp->if_oerrors++;
+		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 		return (ENOBUFS);
 	}
 	eh = mtod(m, struct ether_header *);
@@ -332,7 +332,7 @@ ieee80211_start_pkt(struct ieee80211vap 
 		ni = ieee80211_find_txnode(vap, eh->ether_dhost);
 		if (ni == NULL) {
 			/* NB: ieee80211_find_txnode does stat+msg */
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			m_freem(m);
 			/* XXX better status? */
 			return (ENOBUFS);
@@ -344,7 +344,7 @@ ieee80211_start_pkt(struct ieee80211vap 
 			    "sta not associated (type 0x%04x)",
 			    htons(eh->ether_type));
 			vap->iv_stats.is_tx_notassoc++;
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			m_freem(m);
 			ieee80211_free_node(ni);
 			/* XXX better status? */
@@ -363,7 +363,7 @@ ieee80211_start_pkt(struct ieee80211vap 
 				    eh->ether_dhost, NULL,
 				    "%s", "proxy not enabled");
 				vap->iv_stats.is_mesh_notproxy++;
-				ifp->if_oerrors++;
+				if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 				m_freem(m);
 				/* XXX better status? */
 				return (ENOBUFS);
@@ -380,7 +380,7 @@ ieee80211_start_pkt(struct ieee80211vap 
 			 * NB: ieee80211_mesh_discover holds/disposes
 			 * frame (e.g. queueing on path discovery).
 			 */
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			/* XXX better status? */
 			return (ENOBUFS);
 		}
@@ -608,7 +608,7 @@ ieee80211_output(struct ifnet *ifp, stru
 	if (ieee80211_classify(ni, m))
 		senderr(EIO);		/* XXX */
 
-	ifp->if_opackets++;
+	if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	IEEE80211_NODE_STAT(ni, tx_data);
 	if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		IEEE80211_NODE_STAT(ni, tx_mcast);
@@ -636,7 +636,7 @@ bad:
 		m_freem(m);
 	if (ni != NULL)
 		ieee80211_free_node(ni);
-	ifp->if_oerrors++;
+	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	return error;
 #undef senderr
 }

Modified: head/sys/net80211/ieee80211_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_sta.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_sta.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -938,7 +938,7 @@ sta_input(struct ieee80211_node *ni, str
 		break;
 	}
 err:
-	ifp->if_ierrors++;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 out:
 	if (m != NULL) {
 		if (need_tap && ieee80211_radiotap_active_vap(vap))

Modified: head/sys/net80211/ieee80211_superg.c
==============================================================================
--- head/sys/net80211/ieee80211_superg.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_superg.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -480,7 +480,7 @@ ff_transmit(struct ieee80211_node *ni, s
 			/* NB: IFQ_HANDOFF reclaims mbuf */
 			ieee80211_free_node(ni);
 		} else {
-			ifp->if_opackets++;
+			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 		}
 	} else
 		ieee80211_free_node(ni);

Modified: head/sys/net80211/ieee80211_wds.c
==============================================================================
--- head/sys/net80211/ieee80211_wds.c	Fri Sep 19 09:20:34 2014	(r271860)
+++ head/sys/net80211/ieee80211_wds.c	Fri Sep 19 09:20:55 2014	(r271861)
@@ -258,14 +258,14 @@ ieee80211_dwds_mcast(struct ieee80211vap
 		 */
 		mcopy = m_copypacket(m, M_NOWAIT);
 		if (mcopy == NULL) {
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			/* XXX stat + msg */
 			continue;
 		}
 		ni = ieee80211_find_txnode(vap, eh->ether_dhost);
 		if (ni == NULL) {
 			/* NB: ieee80211_find_txnode does stat+msg */
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			m_freem(mcopy);
 			continue;
 		}
@@ -276,7 +276,7 @@ ieee80211_dwds_mcast(struct ieee80211vap
 			    eh->ether_dhost, NULL,
 			    "%s", "classification failure");
 			vap->iv_stats.is_tx_classify++;
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			m_freem(mcopy);
 			ieee80211_free_node(ni);
 			continue;
@@ -299,10 +299,10 @@ ieee80211_dwds_mcast(struct ieee80211vap
 		err = ieee80211_parent_xmitpkt(ic, mcopy);
 		if (err) {
 			/* NB: IFQ_HANDOFF reclaims mbuf */
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			ieee80211_free_node(ni);
 		} else
-			ifp->if_opackets++;
+			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	}
 }
 
@@ -730,7 +730,7 @@ wds_input(struct ieee80211_node *ni, str
 		break;
 	}
 err:
-	ifp->if_ierrors++;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 out:
 	if (m != NULL) {
 		if (need_tap && ieee80211_radiotap_active_vap(vap))


More information about the svn-src-all mailing list