Source-Changes-HG archive

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

src: KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/48fc8282783c
branches:  trunk
changeset: 318226:48fc8282783c
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Apr 16 08:31:06 2018 +0000
description:
KNF. No functional change.

diffstat:

 sys/dev/pci/if_wm.c |  112 +++++++++++++++++++++++++++++----------------------
 1 files changed, 64 insertions(+), 48 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r a08bd5e4a3a6 -r 48fc8282783c sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Mon Apr 16 08:17:18 2018 +0000
+++ b/sys/dev/pci/if_wm.c       Mon Apr 16 08:31:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.572 2018/04/13 09:35:10 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.573 2018/04/16 08:31:06 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.572 2018/04/13 09:35:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.573 2018/04/16 08:31:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -384,7 +384,7 @@
                                                /* XXX not used? */
 
        WM_Q_EVCNT_DEFINE(txq, txipsum)         /* IP checksums comp. out-bound */
-       WM_Q_EVCNT_DEFINE(txq,txtusum)          /* TCP/UDP cksums comp. out-bound */
+       WM_Q_EVCNT_DEFINE(txq, txtusum)         /* TCP/UDP cksums comp. out-bound */
        WM_Q_EVCNT_DEFINE(txq, txtusum6)        /* TCP/UDP v6 cksums comp. out-bound */
        WM_Q_EVCNT_DEFINE(txq, txtso)           /* TCP seg offload out-bound (IPv4) */
        WM_Q_EVCNT_DEFINE(txq, txtso6)          /* TCP seg offload out-bound (IPv6) */
@@ -442,7 +442,7 @@
 };
 
 struct wm_queue {
-       int wmq_id;                     /* index of transmit and receive queues */
+       int wmq_id;                     /* index of TX/RX queues */
        int wmq_intr_idx;               /* index of MSI-X tables */
 
        uint32_t wmq_itr;               /* interrupt interval per queue. */
@@ -690,8 +690,10 @@
 static bool    wm_suspend(device_t, const pmf_qual_t *);
 static bool    wm_resume(device_t, const pmf_qual_t *);
 static void    wm_watchdog(struct ifnet *);
-static void    wm_watchdog_txq(struct ifnet *, struct wm_txqueue *, uint16_t *);
-static void    wm_watchdog_txq_locked(struct ifnet *, struct wm_txqueue *, uint16_t *);
+static void    wm_watchdog_txq(struct ifnet *, struct wm_txqueue *,
+    uint16_t *);
+static void    wm_watchdog_txq_locked(struct ifnet *, struct wm_txqueue *,
+    uint16_t *);
 static void    wm_tick(void *);
 static int     wm_ifflags_cb(struct ethercom *);
 static int     wm_ioctl(struct ifnet *, u_long, void *);
@@ -765,14 +767,16 @@
 static void    wm_start_locked(struct ifnet *);
 static int     wm_transmit(struct ifnet *, struct mbuf *);
 static void    wm_transmit_locked(struct ifnet *, struct wm_txqueue *);
-static void    wm_send_common_locked(struct ifnet *, struct wm_txqueue *, bool);
+static void    wm_send_common_locked(struct ifnet *, struct wm_txqueue *,
+    bool);
 static int     wm_nq_tx_offload(struct wm_softc *, struct wm_txqueue *,
     struct wm_txsoft *, uint32_t *, uint32_t *, bool *);
 static void    wm_nq_start(struct ifnet *);
 static void    wm_nq_start_locked(struct ifnet *);
 static int     wm_nq_transmit(struct ifnet *, struct mbuf *);
 static void    wm_nq_transmit_locked(struct ifnet *, struct wm_txqueue *);
-static void    wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *, bool);
+static void    wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *,
+    bool);
 static void    wm_deferred_start_locked(struct wm_txqueue *);
 static void    wm_handle_queue(void *);
 /* Interrupt */
@@ -797,7 +801,7 @@
 static void    wm_tbi_serdes_set_linkled(struct wm_softc *);
 /* GMII related */
 static void    wm_gmii_reset(struct wm_softc *);
-static void    wm_gmii_setup_phytype(struct wm_softc *sc, uint32_t, uint16_t);
+static void    wm_gmii_setup_phytype(struct wm_softc *, uint32_t, uint16_t);
 static int     wm_get_phy_id_82575(struct wm_softc *);
 static void    wm_gmii_mediainit(struct wm_softc *, pci_product_id_t);
 static int     wm_gmii_mediachange(struct ifnet *);
@@ -3014,7 +3018,8 @@
 }
 
 static void
-wm_watchdog_txq_locked(struct ifnet *ifp, struct wm_txqueue *txq, uint16_t *hang)
+wm_watchdog_txq_locked(struct ifnet *ifp, struct wm_txqueue *txq,
+    uint16_t *hang)
 {
        struct wm_softc *sc = ifp->if_softc;
        struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
@@ -4324,7 +4329,7 @@
        nexttx = txq->txq_next;
        txd = &txq->txq_descs[nexttx];
        wm_set_dma_addr(&txd->wtx_addr, WM_CDTXADDR(txq, nexttx));
-       txd->wtx_cmdlen = htole32(WTX_CMD_IFCS| 512);
+       txd->wtx_cmdlen = htole32(WTX_CMD_IFCS | 512);
        txd->wtx_fields.wtxu_status = 0;
        txd->wtx_fields.wtxu_options = 0;
        txd->wtx_fields.wtxu_vlan = 0;
@@ -4839,8 +4844,7 @@
        if (error) {
                /* XXX XXX XXX */
                aprint_error_dev(sc->sc_dev,
-                   "unable to load rx DMA map %d, error = %d\n",
-                   idx, error);
+                   "unable to load rx DMA map %d, error = %d\n", idx, error);
                panic("wm_add_rxbuf");
        }
 
@@ -5010,11 +5014,10 @@
         * As queues more than MSI-X vectors cannot improve scaling, we limit
         * the number of queues used actually.
         */
-       if (nvectors < hw_nqueues + 1) {
+       if (nvectors < hw_nqueues + 1)
                sc->sc_nqueues = nvectors - 1;
-       } else {
+       else
                sc->sc_nqueues = hw_nqueues;
-       }
 
        /*
         * As queues more then cpus cannot improve scaling, we limit
@@ -6730,7 +6733,8 @@
 
                CSR_WRITE(sc, WMREG_RDBAH(qid), WM_CDRXADDR_HI(rxq, 0));
                CSR_WRITE(sc, WMREG_RDBAL(qid), WM_CDRXADDR_LO(rxq, 0));
-               CSR_WRITE(sc, WMREG_RDLEN(qid), rxq->rxq_descsize * rxq->rxq_ndesc);
+               CSR_WRITE(sc, WMREG_RDLEN(qid),
+                   rxq->rxq_descsize * rxq->rxq_ndesc);
 
                if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
                        if (MCLBYTES & ((1 << SRRCTL_BSIZEPKT_SHIFT) - 1))
@@ -6748,7 +6752,8 @@
                        CSR_WRITE(sc, WMREG_RDH(qid), 0);
                        CSR_WRITE(sc, WMREG_RDT(qid), 0);
                        /* XXX should update with AIM? */
-                       CSR_WRITE(sc, WMREG_RDTR, (wmq->wmq_itr / 4) | RDTR_FPD);
+                       CSR_WRITE(sc, WMREG_RDTR,
+                           (wmq->wmq_itr / 4) | RDTR_FPD);
                        /* MUST be same */
                        CSR_WRITE(sc, WMREG_RADV, wmq->wmq_itr / 4);
                        CSR_WRITE(sc, WMREG_RXDCTL(qid), RXDCTL_PTHRESH(0) |
@@ -7073,7 +7078,7 @@
         * TODO:
         * distribute by flowid(RSS has value).
         */
-        return (cpuid + ncpu - sc->sc_affinity_offset) % sc->sc_nqueues;                                                          
+        return (cpuid + ncpu - sc->sc_affinity_offset) % sc->sc_nqueues;
 }
 
 /*
@@ -7733,8 +7738,9 @@
         *     (2) contention with deferred if_start softint(wm_handle_queue())
         * In the case of (1), the last packet enqueued to txq->txq_interq is
         * dequeued by wm_deferred_start_locked(). So, it does not get stuck.
-        * In the case of (2), the last packet enqueued to txq->txq_interq is also
-        * dequeued by wm_deferred_start_locked(). So, it does not get stuck, either.
+        * In the case of (2), the last packet enqueued to txq->txq_interq is
+        * also dequeued by wm_deferred_start_locked(). So, it does not get
+        * stuck, either.
         */
        if (mutex_tryenter(txq->txq_lock)) {
                if (!txq->txq_stopping)
@@ -8308,16 +8314,20 @@
 
        /* XXXX missing error bit for newqueue? */
        if (wm_rxdesc_is_set_error(sc, errors,
-               WRX_ER_CE|WRX_ER_SE|WRX_ER_SEQ|WRX_ER_CXE|WRX_ER_RXE,
-               EXTRXC_ERROR_CE|EXTRXC_ERROR_SE|EXTRXC_ERROR_SEQ|EXTRXC_ERROR_CXE|EXTRXC_ERROR_RXE,
+               WRX_ER_CE | WRX_ER_SE | WRX_ER_SEQ | WRX_ER_CXE | WRX_ER_RXE,
+               EXTRXC_ERROR_CE | EXTRXC_ERROR_SE | EXTRXC_ERROR_SEQ
+               | EXTRXC_ERROR_CXE | EXTRXC_ERROR_RXE,
                NQRXC_ERROR_RXE)) {
-               if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_SE, EXTRXC_ERROR_SE, 0))
+               if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_SE,
+                   EXTRXC_ERROR_SE, 0))
                        log(LOG_WARNING, "%s: symbol error\n",
                            device_xname(sc->sc_dev));
-               else if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_SEQ, EXTRXC_ERROR_SEQ, 0))
+               else if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_SEQ,
+                   EXTRXC_ERROR_SEQ, 0))
                        log(LOG_WARNING, "%s: receive sequence error\n",
                            device_xname(sc->sc_dev));
-               else if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_CE, EXTRXC_ERROR_CE, 0))
+               else if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_CE,
+                   EXTRXC_ERROR_CE, 0))
                        log(LOG_WARNING, "%s: CRC error\n",
                            device_xname(sc->sc_dev));
                return true;
@@ -8342,8 +8352,8 @@
 }
 
 static inline bool
-wm_rxdesc_input_vlantag(struct wm_rxqueue *rxq, uint32_t status, uint16_t vlantag,
-    struct mbuf *m)
+wm_rxdesc_input_vlantag(struct wm_rxqueue *rxq, uint32_t status,
+    uint16_t vlantag, struct mbuf *m)
 {
 
        if (wm_rxdesc_is_set_status(rxq->rxq_sc, status,
@@ -8381,8 +8391,8 @@
                        m->m_pkthdr.csum_flags |=
                                M_CSUM_TCPv4 | M_CSUM_UDPv4 |
                                M_CSUM_TCPv6 | M_CSUM_UDPv6;
-                       if (wm_rxdesc_is_set_error(sc, errors,
-                               WRX_ER_TCPE, EXTRXC_ERROR_TCPE, NQRXC_ERROR_L4E))
+                       if (wm_rxdesc_is_set_error(sc, errors, WRX_ER_TCPE,
+                           EXTRXC_ERROR_TCPE, NQRXC_ERROR_L4E))
                                m->m_pkthdr.csum_flags |=
                                        M_CSUM_TCP_UDP_BAD;
                }
@@ -8424,7 +8434,8 @@
                DPRINTF(WM_DEBUG_RX,
                    ("%s: RX: checking descriptor %d\n",
                    device_xname(sc->sc_dev), i));
-               wm_cdrxsync(rxq, i,BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+               wm_cdrxsync(rxq, i,
+                   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
                status = wm_rxdesc_get_status(rxq, i);
                errors = wm_rxdesc_get_errors(rxq, i);
@@ -8990,9 +9001,11 @@
        struct wm_softc *sc = wmq->wmq_txq.txq_sc;
 
        if (sc->sc_type == WM_T_82574)
-               CSR_WRITE(sc, WMREG_IMC, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
+               CSR_WRITE(sc, WMREG_IMC,
+                   ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
        else if (sc->sc_type == WM_T_82575)
-               CSR_WRITE(sc, WMREG_EIMC, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
+               CSR_WRITE(sc, WMREG_EIMC,
+                   EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
        else
                CSR_WRITE(sc, WMREG_EIMC, 1 << wmq->wmq_intr_idx);
 }
@@ -9011,9 +9024,11 @@
         * while each wm_handle_queue(wmq) is runnig.
         */
        if (sc->sc_type == WM_T_82574)
-               CSR_WRITE(sc, WMREG_IMS, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id) | ICR_OTHER);
+               CSR_WRITE(sc, WMREG_IMS,
+                   ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id) | ICR_OTHER);
        else if (sc->sc_type == WM_T_82575)
-               CSR_WRITE(sc, WMREG_EIMS, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
+               CSR_WRITE(sc, WMREG_EIMS,
+                   EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
        else
                CSR_WRITE(sc, WMREG_EIMS, 1 << wmq->wmq_intr_idx);
 }
@@ -10098,7 +10113,8 @@
                case WMPHY_IGP:
                case WMPHY_IGP_2:
                case WMPHY_IGP_3:
-                       wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT, reg);
+                       wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT,
+                           reg);
                        break;
                default:
 #ifdef WM_DEBUG
@@ -10135,7 +10151,8 @@
                case WMPHY_IGP:
                case WMPHY_IGP_2:
                case WMPHY_IGP_3:
-                       wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT, reg);
+                       wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT,
+                           reg);
                        break;
                default:
 #ifdef WM_DEBUG
@@ -10885,8 +10902,7 @@
        }
 
        i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT)
-           | (phy << I2CCMD_PHY_ADDR_SHIFT)
-           | I2CCMD_OPCODE_READ;
+           | (phy << I2CCMD_PHY_ADDR_SHIFT) | I2CCMD_OPCODE_READ;
        CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd);
 
        /* Poll the ready bit */
@@ -10920,17 +10936,16 @@
        struct wm_softc *sc = device_private(dev);
        uint32_t i2ccmd;
        int i;
-       int val_swapped;
+       int swapdata;
 
        if (sc->phy.acquire(sc) != 0) {
                device_printf(dev, "%s: failed to get semaphore\n", __func__);
                return;
        }
        /* Swap the data bytes for the I2C interface */
-       val_swapped = ((val >> 8) & 0x00FF) | ((val << 8) & 0xFF00);
+       swapdata = ((val >> 8) & 0x00FF) | ((val << 8) & 0xFF00);
        i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT)
-           | (phy << I2CCMD_PHY_ADDR_SHIFT)
-           | I2CCMD_OPCODE_WRITE | val_swapped;
+           | (phy << I2CCMD_PHY_ADDR_SHIFT) | I2CCMD_OPCODE_WRITE | swapdata;
        CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd);
 
        /* Poll the ready bit */
@@ -11935,8 +11950,7 @@
 }



Home | Main Index | Thread Index | Old Index