Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/cdac1f572e1d
branches:  trunk
changeset: 450724:cdac1f572e1d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Apr 24 07:46:55 2019 +0000

description:
KNF. No functional change.

diffstat:

 sys/dev/ic/pdq_ifsubr.c |  859 +++++++++++++++++++++++------------------------
 1 files changed, 416 insertions(+), 443 deletions(-)

diffs (truncated from 1074 to 300 lines):

diff -r 5e2d4ed352d6 -r cdac1f572e1d sys/dev/ic/pdq_ifsubr.c
--- a/sys/dev/ic/pdq_ifsubr.c   Wed Apr 24 07:32:50 2019 +0000
+++ b/sys/dev/ic/pdq_ifsubr.c   Wed Apr 24 07:46:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pdq_ifsubr.c,v 1.62 2019/02/05 06:17:02 msaitoh Exp $  */
+/*     $NetBSD: pdq_ifsubr.c,v 1.63 2019/04/24 07:46:55 msaitoh Exp $  */
 
 /*-
  * Copyright (c) 1995, 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.62 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.63 2019/04/24 07:46:55 msaitoh Exp $");
 
 #ifdef __NetBSD__
 #include "opt_inet.h"
@@ -101,125 +101,119 @@
 #endif
 
 void
-pdq_ifinit(
-    pdq_softc_t *sc)
+pdq_ifinit(pdq_softc_t *sc)
 {
-    if (sc->sc_if.if_flags & IFF_UP) {
-       sc->sc_if.if_flags |= IFF_RUNNING;
-       if (sc->sc_if.if_flags & IFF_PROMISC) {
-           sc->sc_pdq->pdq_flags |= PDQ_PROMISC;
+       if (sc->sc_if.if_flags & IFF_UP) {
+               sc->sc_if.if_flags |= IFF_RUNNING;
+               if (sc->sc_if.if_flags & IFF_PROMISC)
+                       sc->sc_pdq->pdq_flags |= PDQ_PROMISC;
+               else
+                       sc->sc_pdq->pdq_flags &= ~PDQ_PROMISC;
+
+               if (sc->sc_if.if_flags & IFF_LINK1)
+                       sc->sc_pdq->pdq_flags |= PDQ_PASS_SMT;
+               else
+                       sc->sc_pdq->pdq_flags &= ~PDQ_PASS_SMT;
+
+               sc->sc_pdq->pdq_flags |= PDQ_RUNNING;
+               pdq_run(sc->sc_pdq);
        } else {
-           sc->sc_pdq->pdq_flags &= ~PDQ_PROMISC;
+               sc->sc_if.if_flags &= ~IFF_RUNNING;
+               sc->sc_pdq->pdq_flags &= ~PDQ_RUNNING;
+               pdq_stop(sc->sc_pdq);
        }
-       if (sc->sc_if.if_flags & IFF_LINK1) {
-           sc->sc_pdq->pdq_flags |= PDQ_PASS_SMT;
-       } else {
-           sc->sc_pdq->pdq_flags &= ~PDQ_PASS_SMT;
-       }
-       sc->sc_pdq->pdq_flags |= PDQ_RUNNING;
-       pdq_run(sc->sc_pdq);
-    } else {
-       sc->sc_if.if_flags &= ~IFF_RUNNING;
-       sc->sc_pdq->pdq_flags &= ~PDQ_RUNNING;
-       pdq_stop(sc->sc_pdq);
-    }
 }
 
 void
-pdq_ifwatchdog(
-    struct ifnet *ifp)
+pdq_ifwatchdog(struct ifnet *ifp)
 {
-    /*
-     * No progress was made on the transmit queue for PDQ_OS_TX_TRANSMIT
-     * seconds.  Remove all queued packets.
-     */
+       /*
+        * No progress was made on the transmit queue for PDQ_OS_TX_TRANSMIT
+        * seconds.  Remove all queued packets.
+        */
 
-    ifp->if_flags &= ~IFF_OACTIVE;
-    ifp->if_timer = 0;
-    for (;;) {
-       struct mbuf *m;
-       IFQ_DEQUEUE(&ifp->if_snd, m);
-       if (m == NULL)
-           return;
-       PDQ_OS_DATABUF_FREE(PDQ_OS_IFP_TO_SOFTC(ifp)->sc_pdq, m);
-    }
+       ifp->if_flags &= ~IFF_OACTIVE;
+       ifp->if_timer = 0;
+       for (;;) {
+               struct mbuf *m;
+               IFQ_DEQUEUE(&ifp->if_snd, m);
+               if (m == NULL)
+                       return;
+               PDQ_OS_DATABUF_FREE(PDQ_OS_IFP_TO_SOFTC(ifp)->sc_pdq, m);
+       }
 }
 
 ifnet_ret_t
-pdq_ifstart(
-    struct ifnet *ifp)
+pdq_ifstart(struct ifnet *ifp)
 {
-    pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
-    struct mbuf *m;
-    int tx = 0;
+       pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
+       struct mbuf *m;
+       int tx = 0;
 
-    if ((ifp->if_flags & IFF_RUNNING) == 0)
-       return;
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
+               return;
 
-    if (sc->sc_if.if_timer == 0)
-       sc->sc_if.if_timer = PDQ_OS_TX_TIMEOUT;
+       if (sc->sc_if.if_timer == 0)
+               sc->sc_if.if_timer = PDQ_OS_TX_TIMEOUT;
 
-    if ((sc->sc_pdq->pdq_flags & PDQ_TXOK) == 0) {
-       sc->sc_if.if_flags |= IFF_OACTIVE;
-       return;
-    }
-    sc->sc_flags |= PDQIF_DOWNCALL;
-    for (;; tx = 1) {
-       IFQ_POLL(&ifp->if_snd, m);
-       if (m == NULL)
-           break;
+       if ((sc->sc_pdq->pdq_flags & PDQ_TXOK) == 0) {
+               sc->sc_if.if_flags |= IFF_OACTIVE;
+               return;
+       }
+       sc->sc_flags |= PDQIF_DOWNCALL;
+       for (;; tx = 1) {
+               IFQ_POLL(&ifp->if_snd, m);
+               if (m == NULL)
+                       break;
 #if defined(PDQ_BUS_DMA) && !defined(PDQ_BUS_DMA_NOTX)
-       if ((m->m_flags & M_HASTXDMAMAP) == 0) {
-           bus_dmamap_t map;
-           if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
-               m->m_data[0] = PDQ_FDDI_PH0;
-               m->m_data[1] = PDQ_FDDI_PH1;
-               m->m_data[2] = PDQ_FDDI_PH2;
-           }
-           if (!bus_dmamap_create(sc->sc_dmatag, m->m_pkthdr.len, 255,
-                                  m->m_pkthdr.len, 0, BUS_DMA_NOWAIT, &map)) {
-               if (!bus_dmamap_load_mbuf(sc->sc_dmatag, map, m,
-                                         BUS_DMA_WRITE|BUS_DMA_NOWAIT)) {
-                   bus_dmamap_sync(sc->sc_dmatag, map, 0, m->m_pkthdr.len,
-                                   BUS_DMASYNC_PREWRITE);
-                   M_SETCTX(m, map);
-                   m->m_flags |= M_HASTXDMAMAP;
+               if ((m->m_flags & M_HASTXDMAMAP) == 0) {
+                       bus_dmamap_t map;
+                       if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
+                               m->m_data[0] = PDQ_FDDI_PH0;
+                               m->m_data[1] = PDQ_FDDI_PH1;
+                               m->m_data[2] = PDQ_FDDI_PH2;
+                       }
+                       if (!bus_dmamap_create(sc->sc_dmatag, m->m_pkthdr.len,
+                           255, m->m_pkthdr.len, 0, BUS_DMA_NOWAIT, &map)) {
+                               if (!bus_dmamap_load_mbuf(sc->sc_dmatag, map,
+                                   m, BUS_DMA_WRITE|BUS_DMA_NOWAIT)) {
+                                       bus_dmamap_sync(sc->sc_dmatag, map, 0,
+                                           m->m_pkthdr.len,
+                                           BUS_DMASYNC_PREWRITE);
+                                       M_SETCTX(m, map);
+                                       m->m_flags |= M_HASTXDMAMAP;
+                               }
+                       }
+                       if ((m->m_flags & M_HASTXDMAMAP) == 0)
+                               break;
                }
-           }
-           if ((m->m_flags & M_HASTXDMAMAP) == 0)
-               break;
-       }
 #else
-       if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
-           m->m_data[0] = PDQ_FDDI_PH0;
-           m->m_data[1] = PDQ_FDDI_PH1;
-           m->m_data[2] = PDQ_FDDI_PH2;
-       }
+               if (PDQ_OS_HDR_OFFSET != PDQ_RX_FC_OFFSET) {
+                       m->m_data[0] = PDQ_FDDI_PH0;
+                       m->m_data[1] = PDQ_FDDI_PH1;
+                       m->m_data[2] = PDQ_FDDI_PH2;
+               }
 #endif
 
-       if (pdq_queue_transmit_data(sc->sc_pdq, m) == PDQ_FALSE)
-           break;
-       IFQ_DEQUEUE(&ifp->if_snd, m);
-    }
-    if (m != NULL)
-       ifp->if_flags |= IFF_OACTIVE;
-    if (tx)
-       PDQ_DO_TYPE2_PRODUCER(sc->sc_pdq);
-    sc->sc_flags &= ~PDQIF_DOWNCALL;
+               if (pdq_queue_transmit_data(sc->sc_pdq, m) == PDQ_FALSE)
+                       break;
+               IFQ_DEQUEUE(&ifp->if_snd, m);
+       }
+       if (m != NULL)
+               ifp->if_flags |= IFF_OACTIVE;
+       if (tx)
+               PDQ_DO_TYPE2_PRODUCER(sc->sc_pdq);
+       sc->sc_flags &= ~PDQIF_DOWNCALL;
 }
 
 void
-pdq_os_receive_pdu(
-    pdq_t *pdq,
-    struct mbuf *m,
-    size_t pktlen,
-    int drop)
+pdq_os_receive_pdu(pdq_t *pdq, struct mbuf *m, size_t pktlen, int drop)
 {
-    pdq_softc_t *sc = pdq->pdq_os_ctx;
-    struct fddi_header *fh;
+       pdq_softc_t *sc = pdq->pdq_os_ctx;
+       struct fddi_header *fh;
 
 #if defined(PDQ_BUS_DMA)
-    {
+       {
        /*
         * Even though the first mbuf start at the first fddi header octet,
         * the dmamap starts PDQ_OS_HDR_OFFSET octets earlier.  Any additional
@@ -228,208 +222,195 @@
        int offset = PDQ_OS_HDR_OFFSET;
        struct mbuf *m0;
        for (m0 = m; m0 != NULL; m0 = m0->m_next, offset = 0) {
-           pdq_os_databuf_sync(sc, m0, offset, m0->m_len, BUS_DMASYNC_POSTREAD);
-           bus_dmamap_unload(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
-           bus_dmamap_destroy(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
-           m0->m_flags &= ~M_HASRXDMAMAP;
-           M_SETCTX(m0, NULL);
+               pdq_os_databuf_sync(sc, m0, offset, m0->m_len,
+                   BUS_DMASYNC_POSTREAD);
+               bus_dmamap_unload(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
+               bus_dmamap_destroy(sc->sc_dmatag, M_GETCTX(m0, bus_dmamap_t));
+               m0->m_flags &= ~M_HASRXDMAMAP;
+               M_SETCTX(m0, NULL);
        }
-    }
+       }
 #endif
-    m->m_pkthdr.len = pktlen;
-    fh = mtod(m, struct fddi_header *);
-    if (drop || (fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) {
-       PDQ_OS_DATABUF_FREE(pdq, m);
-       return;
-    }
+       m->m_pkthdr.len = pktlen;
+       fh = mtod(m, struct fddi_header *);
+       if (drop || (fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) {
+               PDQ_OS_DATABUF_FREE(pdq, m);
+               return;
+       }
 
-    m_set_rcvif(m, &sc->sc_if);
-    if_percpuq_enqueue((&sc->sc_if)->if_percpuq, m);
+       m_set_rcvif(m, &sc->sc_if);
+       if_percpuq_enqueue((&sc->sc_if)->if_percpuq, m);
 }
 
 void
-pdq_os_restart_transmitter(
-    pdq_t *pdq)
+pdq_os_restart_transmitter(pdq_t *pdq)
 {
-    pdq_softc_t *sc = pdq->pdq_os_ctx;
-    sc->sc_if.if_flags &= ~IFF_OACTIVE;
-    if (IFQ_IS_EMPTY(&sc->sc_if.if_snd) == 0) {
-       sc->sc_if.if_timer = PDQ_OS_TX_TIMEOUT;
-       if ((sc->sc_flags & PDQIF_DOWNCALL) == 0)
-           pdq_ifstart(&sc->sc_if);
-    } else {
-       sc->sc_if.if_timer = 0;
-    }
+       pdq_softc_t *sc = pdq->pdq_os_ctx;
+       sc->sc_if.if_flags &= ~IFF_OACTIVE;
+       if (IFQ_IS_EMPTY(&sc->sc_if.if_snd) == 0) {
+               sc->sc_if.if_timer = PDQ_OS_TX_TIMEOUT;
+               if ((sc->sc_flags & PDQIF_DOWNCALL) == 0)
+                       pdq_ifstart(&sc->sc_if);
+       } else
+               sc->sc_if.if_timer = 0;
 }
 
 void
-pdq_os_transmit_done(
-    pdq_t *pdq,
-    struct mbuf *m)
+pdq_os_transmit_done(pdq_t *pdq, struct mbuf *m)
 {
-    pdq_softc_t *sc = pdq->pdq_os_ctx;



Home | Main Index | Thread Index | Old Index