Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev sun4v: vnet - cleanup of debug code (no...



details:   https://anonhg.NetBSD.org/src/rev/e86fbe208d45
branches:  trunk
changeset: 960356:e86fbe208d45
user:      palle <palle%NetBSD.org@localhost>
date:      Mon Mar 15 18:44:04 2021 +0000

description:
sun4v: vnet - cleanup of debug code (no functional changes)

diffstat:

 sys/arch/sparc64/dev/vnet.c |  724 +------------------------------------------
 1 files changed, 19 insertions(+), 705 deletions(-)

diffs (truncated from 1585 to 300 lines):

diff -r b9b2f47c2f7c -r e86fbe208d45 sys/arch/sparc64/dev/vnet.c
--- a/sys/arch/sparc64/dev/vnet.c       Mon Mar 15 18:38:56 2021 +0000
+++ b/sys/arch/sparc64/dev/vnet.c       Mon Mar 15 18:44:04 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnet.c,v 1.4 2021/03/13 20:21:37 palle Exp $   */
+/*     $NetBSD: vnet.c,v 1.5 2021/03/15 18:44:04 palle Exp $   */
 /*     $OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $       */
 /*
  * Copyright (c) 2009, 2015 Mark Kettenis
@@ -16,14 +16,10 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#if 0
-FIXME openbsd
-#include "bpfilter.h"
-#endif
-
 #include <sys/kmem.h>
 #include <sys/param.h>
 #include <sys/atomic.h>
+#include <sys/callout.h>
 #include <sys/device.h>
 #include <sys/malloc.h>
 #include <sys/pool.h>
@@ -31,12 +27,6 @@
 #include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/systm.h>
-#if 0
-FIXME openbsd
-#include <sys/timeout.h>
-#else
-#include <sys/callout.h>
-#endif
 
 #include <machine/autoconf.h>
 #include <machine/hypervisor.h>
@@ -58,9 +48,6 @@
 #include <sparc64/dev/ldcvar.h>
 #include <sparc64/dev/viovar.h>
 
-#if 1
-#define VNET_DEBUG
-#endif
 #ifdef VNET_DEBUG
 #define DPRINTF(x)     printf x
 #else
@@ -137,12 +124,7 @@
 
 struct vnet_soft_desc {
        int             vsd_map_idx;
-#if 0
-FIXME openbsd          
-       caddr_t         vsd_buf;
-#else          
        unsigned char *vsd_buf;
-#endif         
 };
 
 struct vnet_softc {
@@ -171,12 +153,7 @@
 #define VIO_ACK_RDX            0x0400
 #define VIO_RCV_RDX            0x0800
 
-#if 0
-FIXME openbsd          
-       struct timeout  sc_handshake_to;
-#else
        struct callout  sc_handshake_co;
-#endif         
 
        uint8_t         sc_xfer_mode;
 
@@ -284,19 +261,6 @@
        hv_ldc_tx_qconf(ca->ca_id, 0, 0);
        hv_ldc_rx_qconf(ca->ca_id, 0, 0);
 
-#if 0
-FIXME openbsd  
-       sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino,
-           IPL_NET, BUS_INTR_ESTABLISH_MPSAFE, vnet_tx_intr,
-           sc, sc->sc_dv.dv_xname);
-       sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino,
-           IPL_NET, BUS_INTR_ESTABLISH_MPSAFE, vnet_rx_intr,
-           sc, sc->sc_dv.dv_xname);
-       if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) {
-               printf(", can't establish interrupt\n");
-               return;
-       }
-#else
        sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino,
            IPL_NET, vnet_tx_intr, sc);
        sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino,
@@ -305,7 +269,6 @@
                printf(", can't establish interrupts\n");
                return;
        }
-#endif 
 
        lc = &sc->sc_lc;
        lc->lc_id = ca->ca_id;
@@ -314,28 +277,10 @@
        lc->lc_start = vnet_ldc_start;
        lc->lc_rx_data = vio_rx_data;
 
-#if 0
-FIXME openbsd  
-       timeout_set(&sc->sc_handshake_to, vnet_handshake, sc);
-#else
        callout_init(&sc->sc_handshake_co, 0);
-/* netbsd callout do silmilar function...*/
-#endif 
+
        sc->sc_peer_state = VIO_DP_STOPPED;
 
-#if OPENBSD_BUSDMA
-       lc->lc_txq = ldc_queue_alloc(sc->sc_dmatag, VNET_TX_ENTRIES);
-       if (lc->lc_txq == NULL) {
-               printf(", can't allocate tx queue\n");
-               return;
-       }
-
-       lc->lc_rxq = ldc_queue_alloc(sc->sc_dmatag, VNET_RX_ENTRIES);
-       if (lc->lc_rxq == NULL) {
-               printf(", can't allocate rx queue\n");
-               goto free_txqueue;
-       }
-#else  
        lc->lc_txq = ldc_queue_alloc(VNET_TX_ENTRIES);
        if (lc->lc_txq == NULL) {
                printf(", can't allocate tx queue\n");
@@ -347,7 +292,6 @@
                printf(", can't allocate rx queue\n");
                goto free_txqueue;
        }
-#endif
        
        if (OF_getprop(ca->ca_node, "local-mac-address",
                                   sc->sc_macaddr, ETHER_ADDR_LEN) > 0) {
@@ -360,63 +304,35 @@
        /*
         * Each interface gets its own pool.
         */
-#if 0
-FIXME openbsd  
-       pool_init(&sc->sc_pool, 2048, 0, IPL_NET, 0, sc->sc_dv.dv_xname, NULL);
-#else
        pool_init(&sc->sc_pool, 2048, 0, 0, 0, sc->sc_dv.dv_xname, NULL, IPL_NET);
-#endif
  
        ifp = &sc->sc_ethercom.ec_if;
        ifp->if_softc = sc;
        ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-#if 0  
-       ifp->if_link_state = LINK_STATE_DOWN;
-#endif 
        ifp->if_init = vnet_init;
        ifp->if_ioctl = vnet_ioctl;
        ifp->if_start = vnet_start;
        ifp->if_stop = vnet_stop;
        ifp->if_watchdog = vnet_watchdog;
        strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
-#if 0
-FIXME openbsd  
-       ifq_set_maxlen(&ifp->if_snd, 31); /* XXX */
-#else 
- IFQ_SET_MAXLEN(&ifp->if_snd, 31); /* XXX */
-#endif 
+       IFQ_SET_MAXLEN(&ifp->if_snd, 31); /* XXX */
 
        ifmedia_init(&sc->sc_media, 0, vnet_media_change, vnet_media_status);
        ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
        ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
 
-#if 0  
-       int error = if_initialize(ifp);
-       if (error != 0) {
-               printf(", if_initialize() failed\n");
-               return;
-       }
-       ether_ifattach(ifp, sc->sc_macaddr);
-       if_register(ifp);
-#else
        if_attach(ifp);
        ether_ifattach(ifp, sc->sc_macaddr);
-#endif 
+
        printf("\n");
        return;
 free_txqueue:
-#if OPENBSD_BUSDMA
-       ldc_queue_free(sc->sc_dmatag, lc->lc_txq);
-#else  
        ldc_queue_free(lc->lc_txq);
-#endif 
 }
 
 int
 vnet_tx_intr(void *arg)
 {
-       DPRINTF(("%s: entry\n", __func__));
-
        struct vnet_softc *sc = arg;
        struct ldc_conn *lc = &sc->sc_lc;
        uint64_t tx_head, tx_tail, tx_state;
@@ -437,17 +353,12 @@
                lc->lc_tx_state = tx_state;
        }
 
-       DPRINTF(("%s: exit\n", __func__));
        return (1);
 }
  
 int
 vnet_rx_intr(void *arg)
 {
-#if 0          
-       DPRINTF(("%s: entry\n", __func__));
-#endif 
-
        struct vnet_softc *sc = arg;
        struct ldc_conn *lc = &sc->sc_lc;
        uint64_t rx_head, rx_tail, rx_state;
@@ -463,16 +374,8 @@
                printf("hv_ldc_rx_get_state %d\n", err);
                return (0);
        }
-#if 0  
-       DPRINTF(("%s: rx_state %" PRId64 "  head %" PRId64 "  tail %" PRId64 "\n",
-                        __func__, rx_state, rx_head, rx_tail));
-#endif 
 
        if (rx_state != lc->lc_rx_state) {
-#if 0                  
-               DPRINTF(("%s: rx_state %" PRId64 " != lc__rx_state %" PRId64 "\n",
-                                __func__, rx_state, lc->lc_rx_state));
-#endif         
                switch (rx_state) {
                case LDC_CHANNEL_DOWN:
                        lc->lc_tx_seqid = 0;
@@ -488,31 +391,15 @@
                        printf("%s: hv_ldc_rx_set_qhead %d\n", __func__, err);
                        break;
                case LDC_CHANNEL_UP:
-#if 0                          
-                       DPRINTF(("%s: Rx link up\n", __func__));
-#endif                 
-#if 0
-FIXME openbsd                  
-                       timeout_add_msec(&sc->sc_handshake_to, 500);
-#else 
                        callout_reset(&sc->sc_handshake_co, hz / 2, vnet_handshake, sc);
-#endif 
                        break;
                case LDC_CHANNEL_RESET:
                        DPRINTF(("%s: Rx link reset\n", __func__));
                        lc->lc_tx_seqid = 0;
                        lc->lc_state = 0;
                        lc->lc_reset(lc);
-#if 0
-FIXME openbsd                  
-                       timeout_add_msec(&sc->sc_handshake_to, 500);
-#else 
                        callout_reset(&sc->sc_handshake_co, hz / 2, vnet_handshake, sc);
-#endif 
                        if (rx_head == rx_tail) {
-#if 0                                  
-                               DPRINTF(("%s: rx_head == rx_head\n", __func__));
-#endif                         
                                break;
                        }
                        /* Discard and ack pending I/O. */
@@ -527,16 +414,8 @@
                        break;
                }
                lc->lc_rx_state = rx_state;
-#if 0          
-               DPRINTF(("%s: setting rx_state %" PRId64 " = lc__rx_state %" PRId64 "\n",
-                                __func__, rx_state, lc->lc_rx_state));
-#endif         
                return (1);
        } else {
-#if 0                  
-               DPRINTF(("%s: rx_state %" PRId64 " == lc__rx_state %" PRId64 "\n",
-                                __func__, rx_state, lc->lc_rx_state));
-#endif         
        }
 
        if (rx_head == rx_tail)
@@ -545,27 +424,14 @@
                return (0);
        }
        lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_rxq->lq_va + rx_head);
-#if 0  
-       DPRINTF(("%s: lp->type %" PRId8 "\n", __func__, lp->type));
-       DPRINTF(("%s: lp->stype %" PRId8 "\n", __func__, lp->stype));
-       DPRINTF(("%s: lp->ctrl %" PRId8 "\n", __func__, lp->ctrl));
-       DPRINTF(("%s: lp->env %" PRId8 "\n", __func__, lp->env));
-       DPRINTF(("%s: lp->seqid %" PRId32 "\n", __func__, lp->seqid));



Home | Main Index | Thread Index | Old Index