mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Mechanically convert to if_inc_counter().
This commit is contained in:
parent
f98131f881
commit
ecc70d3f9e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271832
@ -748,10 +748,10 @@ aue_intr_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
usbd_copy_out(pc, 0, &pkt, sizeof(pkt));
|
||||
|
||||
if (pkt.aue_txstat0)
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
if (pkt.aue_txstat0 & (AUE_TXSTAT0_LATECOLL |
|
||||
AUE_TXSTAT0_EXCESSCOLL))
|
||||
ifp->if_collisions++;
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -790,13 +790,13 @@ aue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
if (sc->sc_flags & AUE_FLAG_VER_2) {
|
||||
|
||||
if (actlen == 0) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (actlen <= (int)(sizeof(stat) + ETHER_CRC_LEN)) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
usbd_copy_out(pc, actlen - sizeof(stat), &stat,
|
||||
@ -808,7 +808,7 @@ aue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
*/
|
||||
stat.aue_rxstat &= AUE_RXSTAT_MASK;
|
||||
if (stat.aue_rxstat) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
/* No errors; receive the packet. */
|
||||
@ -853,7 +853,7 @@ aue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer of %d bytes complete\n", actlen);
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -910,7 +910,7 @@ aue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
|
@ -1097,7 +1097,7 @@ axe_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen)
|
||||
axe_rxeof(ue, pc, 0, actlen, NULL);
|
||||
|
||||
if (error != 0)
|
||||
ue->ue_ifp->if_ierrors++;
|
||||
if_inc_counter(ue->ue_ifp, IFCOUNTER_IERRORS, 1);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1109,13 +1109,13 @@ axe_rxeof(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset,
|
||||
struct mbuf *m;
|
||||
|
||||
if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||
if (m == NULL) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
return (ENOMEM);
|
||||
}
|
||||
m->m_len = m->m_pkthdr.len = MCLBYTES;
|
||||
@ -1123,7 +1123,7 @@ axe_rxeof(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset,
|
||||
|
||||
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
|
||||
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
|
||||
@ -1229,7 +1229,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
* multiple writes into single one if there is
|
||||
* room in TX buffer of controller.
|
||||
*/
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/*
|
||||
* if there's a BPF listener, bounce a copy
|
||||
@ -1253,7 +1253,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
|
@ -681,7 +681,7 @@ axge_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
* multiple writes into single one if there is
|
||||
* room in TX buffer of controller.
|
||||
*/
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/*
|
||||
* if there's a BPF listener, bounce a copy
|
||||
@ -702,7 +702,7 @@ axge_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
return;
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
@ -962,7 +962,7 @@ axge_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen)
|
||||
pktlen = (pkt_hdr >> 16) & 0x1fff;
|
||||
if (pkt_hdr & (AXGE_RXHDR_CRC_ERR | AXGE_RXHDR_DROP_ERR)) {
|
||||
DPRINTF("Dropped a packet\n");
|
||||
ue->ue_ifp->if_ierrors++;
|
||||
if_inc_counter(ue->ue_ifp, IFCOUNTER_IERRORS, 1);
|
||||
}
|
||||
if (pktlen >= 6 && (int)(pos + pktlen) <= actlen) {
|
||||
axge_rxeof(ue, pc, pos + 2, pktlen - 6, pkt_hdr);
|
||||
@ -984,13 +984,13 @@ axge_rxeof(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
|
||||
ifp = ue->ue_ifp;
|
||||
if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||
if (m == NULL) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
return;
|
||||
}
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
@ -999,7 +999,7 @@ axge_rxeof(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
|
||||
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
|
||||
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
|
||||
if ((pkt_hdr & (AXGE_RXHDR_L4CSUM_ERR | AXGE_RXHDR_L3CSUM_ERR)) == 0) {
|
||||
if ((pkt_hdr & AXGE_RXHDR_L4_TYPE_MASK) ==
|
||||
|
@ -788,7 +788,7 @@ cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer complete: %u bytes in %u frames\n",
|
||||
actlen, aframes);
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* free all previous TX buffers */
|
||||
cdce_free_queue(sc->sc_tx_buf, CDCE_FRAMES_MAX);
|
||||
@ -814,7 +814,7 @@ cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
if (!m_append(m, 4, (void *)&crc)) {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -822,7 +822,7 @@ cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
mt = m_defrag(m, M_NOWAIT);
|
||||
if (mt == NULL) {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
continue;
|
||||
}
|
||||
m = mt;
|
||||
@ -854,7 +854,7 @@ cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
cdce_free_queue(sc->sc_tx_buf, CDCE_FRAMES_MAX);
|
||||
|
||||
/* count output errors */
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -1169,7 +1169,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer *xfer, uint8_t index)
|
||||
/* The frame won't fit in our buffer */
|
||||
DPRINTFN(1, "Frame too big to be transmitted!\n");
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
n--;
|
||||
continue;
|
||||
}
|
||||
@ -1207,7 +1207,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer *xfer, uint8_t index)
|
||||
|
||||
/* Pre-increment interface counter */
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
@ -1310,7 +1310,7 @@ cdce_ncm_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
usbd_errstr(error));
|
||||
|
||||
/* update error counter */
|
||||
ifp->if_oerrors += 1;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -1454,7 +1454,7 @@ cdce_ncm_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
sumdata += temp;
|
||||
} else {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ cue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
if (actlen <= (int)(2 + sizeof(struct ether_header))) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
@ -506,7 +506,7 @@ cue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer complete\n");
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -544,7 +544,7 @@ cue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -563,12 +563,12 @@ cue_tick(struct usb_ether *ue)
|
||||
|
||||
CUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_SINGLECOLL);
|
||||
ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_MULTICOLL);
|
||||
ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_EXCESSCOLL);
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_SINGLECOLL));
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_MULTICOLL));
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_EXCESSCOLL));
|
||||
|
||||
if (cue_csr_read_2(sc, CUE_RX_FRAMEERR))
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -400,7 +400,7 @@ ipheth_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer complete: %u bytes in %u frames\n",
|
||||
actlen, aframes);
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* free all previous TX buffers */
|
||||
ipheth_free_queue(sc->sc_tx_buf, IPHETH_TX_FRAMES_MAX);
|
||||
@ -455,7 +455,7 @@ ipheth_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
ipheth_free_queue(sc->sc_tx_buf, IPHETH_TX_FRAMES_MAX);
|
||||
|
||||
/* count output errors */
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
|
@ -550,7 +550,7 @@ kue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
if (actlen <= (int)(2 + sizeof(struct ether_header))) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
@ -596,7 +596,7 @@ kue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer complete\n");
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -638,7 +638,7 @@ kue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
|
@ -792,7 +792,7 @@ mos_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
MOS_DPRINTFN("actlen : %d", actlen);
|
||||
if (actlen <= 1) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
/* evaluate status byte at the end */
|
||||
@ -811,7 +811,7 @@ mos_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
MOS_DPRINTFN("CRC error");
|
||||
if (rxstat & MOS_RXSTS_ALIGN_ERROR)
|
||||
MOS_DPRINTFN("alignment error");
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
/* Remember the last byte was used for the status fields */
|
||||
@ -820,7 +820,7 @@ mos_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
MOS_DPRINTFN("error: pktlen %d is smaller "
|
||||
"than ether_header %zd", pktlen,
|
||||
sizeof(struct ether_header));
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
uether_rxbuf(ue, pc, 0, actlen);
|
||||
@ -859,7 +859,7 @@ mos_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
MOS_DPRINTFN("transfer of complete");
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
@ -886,11 +886,11 @@ mos_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
usbd_transfer_submit(xfer);
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
return;
|
||||
default:
|
||||
MOS_DPRINTFN("usb error on tx: %s\n", usbd_errstr(error));
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
usbd_xfer_set_stall(xfer);
|
||||
goto tr_setup;
|
||||
@ -981,7 +981,7 @@ mos_intr_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
uint32_t pkt;
|
||||
int actlen;
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
|
||||
MOS_DPRINTFN("actlen %i", actlen);
|
||||
|
@ -648,9 +648,9 @@ rue_intr_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
usbd_copy_out(pc, 0, &pkt, sizeof(pkt));
|
||||
|
||||
ifp->if_ierrors += pkt.rue_rxlost_cnt;
|
||||
ifp->if_ierrors += pkt.rue_crcerr_cnt;
|
||||
ifp->if_collisions += pkt.rue_col_cnt;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, pkt.rue_rxlost_cnt);
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, pkt.rue_crcerr_cnt);
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, pkt.rue_col_cnt);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -685,7 +685,7 @@ rue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
if (actlen < 4) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
@ -695,7 +695,7 @@ rue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
/* check recieve packet was valid or not */
|
||||
status = le16toh(status);
|
||||
if ((status & RUE_RXSTAT_VALID) == 0) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
uether_rxbuf(ue, pc, 0, actlen);
|
||||
@ -732,7 +732,7 @@ rue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer complete\n");
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -782,7 +782,7 @@ rue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
|
@ -989,9 +989,9 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
if (rxhdr & SMSC_RX_STAT_ERROR) {
|
||||
smsc_dbg_printf(sc, "rx error (hdr 0x%08x)\n", rxhdr);
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
if (rxhdr & SMSC_RX_STAT_COLLISION)
|
||||
ifp->if_collisions++;
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||
} else {
|
||||
|
||||
/* Check if the ethernet frame is too big or too small */
|
||||
@ -1002,7 +1002,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
m = uether_newbuf();
|
||||
if (m == NULL) {
|
||||
smsc_warn_printf(sc, "failed to create new mbuf\n");
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
|
||||
@ -1158,7 +1158,7 @@ smsc_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
usbd_m_copy_in(pc, frm_len, m, 0, m->m_pkthdr.len);
|
||||
frm_len += m->m_pkthdr.len;
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* If there's a BPF listener, bounce a copy of this frame to him */
|
||||
BPF_MTAP(ifp, m);
|
||||
@ -1176,7 +1176,7 @@ smsc_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
return;
|
||||
|
||||
default:
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
|
@ -582,7 +582,7 @@ udav_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer complete\n");
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -638,7 +638,7 @@ udav_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -666,7 +666,7 @@ udav_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
if (actlen < (int)(sizeof(stat) + ETHER_CRC_LEN)) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
@ -676,11 +676,11 @@ udav_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
len -= ETHER_CRC_LEN;
|
||||
|
||||
if (stat.rxstat & UDAV_RSR_LCS) {
|
||||
ifp->if_collisions++;
|
||||
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
if (stat.rxstat & UDAV_RSR_ERR) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
uether_rxbuf(ue, pc, sizeof(stat), len);
|
||||
|
@ -844,12 +844,12 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
rm_dataoffset), actlen);
|
||||
goto tr_setup;
|
||||
} else if (msg.rm_datalen < (uint32_t)sizeof(struct ether_header)) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
DPRINTF("invalid ethernet size "
|
||||
"%u < %u\n", msg.rm_datalen, (unsigned)sizeof(struct ether_header));
|
||||
goto tr_setup;
|
||||
} else if (msg.rm_datalen > (uint32_t)MCLBYTES) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
DPRINTF("invalid ethernet size "
|
||||
"%u > %u\n",
|
||||
msg.rm_datalen, (unsigned)MCLBYTES);
|
||||
@ -871,7 +871,7 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
/* enqueue */
|
||||
uether_rxmbuf(&sc->sc_ue, m, msg.rm_datalen);
|
||||
} else {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
}
|
||||
offset += msg.rm_len;
|
||||
actlen -= msg.rm_len;
|
||||
@ -917,7 +917,7 @@ urndis_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "%u bytes in %u frames\n", actlen, aframes);
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
@ -937,7 +937,7 @@ urndis_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
if ((m->m_pkthdr.len + sizeof(msg)) > RNDIS_TX_MAXLEN) {
|
||||
DPRINTF("Too big packet\n");
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
/* Free buffer */
|
||||
m_freem(m);
|
||||
@ -973,7 +973,7 @@ urndis_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error));
|
||||
|
||||
/* count output errors */
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
|
@ -806,7 +806,7 @@ usie_if_rx_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
}
|
||||
if (sc->sc_rxm == NULL) {
|
||||
DPRINTF("could not allocate Rx mbuf\n");
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
usbd_xfer_set_stall(xfer);
|
||||
usbd_xfer_set_frames(xfer, 0);
|
||||
} else {
|
||||
@ -828,7 +828,7 @@ usie_if_rx_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
usbd_xfer_set_stall(xfer);
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
if (sc->sc_rxm != NULL) {
|
||||
@ -917,8 +917,8 @@ usie_if_rx_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
|
||||
ifp->if_ierrors += err;
|
||||
ifp->if_ipackets += pkt;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, err);
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, pkt);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -934,7 +934,7 @@ usie_if_tx_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTFN(11, "transfer complete\n");
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
/* fall though */
|
||||
case USB_ST_SETUP:
|
||||
@ -974,11 +974,11 @@ usie_if_tx_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
default: /* Error */
|
||||
DPRINTF("USB transfer error, %s\n",
|
||||
usbd_errstr(error));
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
|
||||
if (error != USB_ERR_CANCELLED) {
|
||||
usbd_xfer_set_stall(xfer);
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
goto tr_setup;
|
||||
}
|
||||
break;
|
||||
@ -1214,10 +1214,10 @@ usie_if_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
|
||||
err = (ifp->if_transmit)(ifp, m);
|
||||
if (err) {
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1395,7 +1395,7 @@ usie_cns_req(struct usie_softc *sc, uint32_t id, uint16_t obj)
|
||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||
if (__predict_false(m == NULL)) {
|
||||
DPRINTF("could not allocate mbuf\n");
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
return;
|
||||
}
|
||||
/* to align usie_hip{} on 32 bit */
|
||||
|
@ -1694,7 +1694,7 @@ uhso_if_rxflush(void *arg)
|
||||
|
||||
m = m_pullup(m0, sizeof(struct ip));
|
||||
if (m == NULL) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
UHSO_DPRINTF(0, "m_pullup failed\n");
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
continue;
|
||||
@ -1724,7 +1724,7 @@ uhso_if_rxflush(void *arg)
|
||||
else {
|
||||
UHSO_DPRINTF(0, "got unexpected ip version %d, "
|
||||
"m=%p, len=%d\n", (*cp & 0xf0) >> 4, m, m->m_len);
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
UHSO_HEXDUMP(cp, 4);
|
||||
m_freem(m);
|
||||
m = NULL;
|
||||
@ -1734,7 +1734,7 @@ uhso_if_rxflush(void *arg)
|
||||
|
||||
if (iplen == 0) {
|
||||
UHSO_DPRINTF(0, "Zero IP length\n");
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
m_freem(m);
|
||||
m = NULL;
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
@ -1775,7 +1775,7 @@ uhso_if_rxflush(void *arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
|
||||
/* Dispatch to IP layer */
|
||||
@ -1803,7 +1803,7 @@ uhso_ifnet_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
@ -1898,10 +1898,10 @@ uhso_if_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
|
||||
|
||||
error = (ifp->if_transmit)(ifp, m0);
|
||||
if (error) {
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ uether_rxmbuf(struct usb_ether *ue, struct mbuf *m,
|
||||
UE_LOCK_ASSERT(ue, MA_OWNED);
|
||||
|
||||
/* finalize mbuf */
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
|
||||
@ -603,14 +603,14 @@ uether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
|
||||
m = uether_newbuf();
|
||||
if (m == NULL) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
|
||||
|
||||
/* finalize mbuf */
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user