Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen remove some unnecessary spl*() calls, and f...



details:   https://anonhg.NetBSD.org/src/rev/5ac56960e7b0
branches:  trunk
changeset: 970905:5ac56960e7b0
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Apr 06 10:33:10 2020 +0000

description:
remove some unnecessary spl*() calls, and fix the rxreq va/pa deallocation
in xennet_xenbus_detach()

diffstat:

 sys/arch/xen/xen/if_xennet_xenbus.c |  19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r b49681689e9c -r 5ac56960e7b0 sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c       Mon Apr 06 10:05:38 2020 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c       Mon Apr 06 10:33:10 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -269,7 +269,6 @@
        netif_rx_sring_t *rx_ring;
        RING_IDX i;
        char *val, *e, *p;
-       int s;
        extern int ifqmaxlen; /* XXX */
 #ifdef XENNET_DEBUG
        char **dir;
@@ -320,9 +319,9 @@
                SLIST_INSERT_HEAD(&sc->sc_txreq_head, &sc->sc_txreqs[i],
                    txreq_next);
        }
+
        mutex_init(&sc->sc_rx_lock, MUTEX_DEFAULT, IPL_NET);
        SLIST_INIT(&sc->sc_rxreq_head);
-       s = splvm(); /* XXXSMP */
        for (i = 0; i < NET_RX_RING_SIZE; i++) {
                struct xennet_rxreq *rxreq = &sc->sc_rxreqs[i];
                rxreq->rxreq_id = i;
@@ -333,7 +332,6 @@
                rxreq->rxreq_gntref = GRANT_INVALID_REF;
                SLIST_INSERT_HEAD(&sc->sc_rxreq_head, rxreq, rxreq_next);
        }
-       splx(s);
        sc->sc_free_rxreql = i;
        if (sc->sc_free_rxreql == 0) {
                aprint_error_dev(self, "failed to allocate rx memory\n");
@@ -422,7 +420,7 @@
 {
        struct xennet_xenbus_softc *sc = device_private(self);
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
-       int s0, s1;
+       int s0;
        RING_IDX i;
 
        DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
@@ -438,13 +436,14 @@
        }
        xennet_free_rx_buffer(sc);
 
-       s1 = splvm(); /* XXXSMP */
        for (i = 0; i < NET_RX_RING_SIZE; i++) {
                struct xennet_rxreq *rxreq = &sc->sc_rxreqs[i];
-               uvm_km_free(kernel_map, rxreq->rxreq_va, PAGE_SIZE,
-                   UVM_KMF_WIRED);
+               if (rxreq->rxreq_va != 0) {
+                       pool_cache_put_paddr(if_xennetrxbuf_cache,
+                           (void *)rxreq->rxreq_va, rxreq->rxreq_pa);
+                       rxreq->rxreq_va = 0;
+               }
        }
-       splx(s1);
 
        ether_ifdetach(ifp);
        if_detach(ifp);



Home | Main Index | Thread Index | Old Index