Mechanically convert to if_inc_counter().

This commit is contained in:
Gleb Smirnoff 2014-09-19 09:20:55 +00:00
parent e2efa70e1c
commit dea4512157
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271861
10 changed files with 33 additions and 32 deletions

View File

@ -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? */
}

View File

@ -653,7 +653,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
break;
}
err:
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
out:
if (m != NULL) {
if (need_tap && ieee80211_radiotap_active_vap(vap))

View File

@ -368,7 +368,7 @@ hostap_deliver_data(struct ieee80211vap *vap,
/*
* 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 *vap,
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 *vap,
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, struct mbuf *m, int rssi, int nf)
break;
}
err:
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
out:
if (m != NULL) {
if (need_tap && ieee80211_radiotap_active_vap(vap))

View File

@ -261,7 +261,7 @@ ieee80211_deliver_data(struct ieee80211vap *vap,
/*
* 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)) {

View File

@ -1047,7 +1047,7 @@ mesh_transmit_to_gate(struct ieee80211vap *vap, struct mbuf *m,
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, struct mbuf *m,
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, struct mbuf *m,
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, struct mbuf *m,
/* 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, struct mbuf *m, int rssi, int nf)
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 *ni)
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));

View File

@ -130,7 +130,7 @@ monitor_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
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);

View File

@ -157,7 +157,7 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m,
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 ieee80211vap *vap, struct mbuf *m,
/* 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 *vap, struct mbuf *m)
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 *vap, struct mbuf *m)
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 *vap, struct mbuf *m)
"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 *vap, struct mbuf *m)
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 *vap, struct mbuf *m)
* 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, struct mbuf *m,
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 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m,
m_freem(m);
if (ni != NULL)
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return error;
#undef senderr
}

View File

@ -938,7 +938,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
break;
}
err:
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
out:
if (m != NULL) {
if (need_tap && ieee80211_radiotap_active_vap(vap))

View File

@ -480,7 +480,7 @@ ff_transmit(struct ieee80211_node *ni, struct mbuf *m)
/* 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);

View File

@ -258,14 +258,14 @@ ieee80211_dwds_mcast(struct ieee80211vap *vap0, struct mbuf *m)
*/
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 *vap0, struct mbuf *m)
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 *vap0, struct mbuf *m)
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, struct mbuf *m, int rssi, int nf)
break;
}
err:
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
out:
if (m != NULL) {
if (need_tap && ieee80211_radiotap_active_vap(vap))