Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) (requested by msaitoh in ti...



details:   https://anonhg.NetBSD.org/src/rev/39219066469c
branches:  netbsd-8
changeset: 435176:39219066469c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 07 13:02:31 2018 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #950):

        sys/dev/pci/if_lmc.h: revision 1.25
        sys/dev/pci/if_lmc.c: revision 1.65
        doc/TODO.smpnet: revision 1.20

Move txintr_setup() stuff from lmc_interrupt() and do it in ifnet_start().
Now we can use bpf_mtap() in the TX path. Not tested.

diffstat:

 doc/TODO.smpnet      |   4 +-
 sys/dev/pci/if_lmc.c |  55 +++++++++++++++++++++++++++++++++++++++++----------
 sys/dev/pci/if_lmc.h |   3 +-
 3 files changed, 47 insertions(+), 15 deletions(-)

diffs (147 lines):

diff -r 095eaf2b9f96 -r 39219066469c doc/TODO.smpnet
--- a/doc/TODO.smpnet   Tue Jul 31 17:09:45 2018 +0000
+++ b/doc/TODO.smpnet   Tue Aug 07 13:02:31 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: TODO.smpnet,v 1.11.6.1 2017/10/21 19:43:54 snj Exp $
+$NetBSD: TODO.smpnet,v 1.11.6.2 2018/08/07 13:02:31 martin Exp $
 
 MP-safe components
 ==================
@@ -96,7 +96,7 @@
 
  - sca_frame_process() @ sys/dev/ic/hd64570.c
  - en_intr() @ sys/dev/ic/midway.c
- - rxintr_cleanup() and txintr_cleanup() @ sys/dev/pci/if_lmc.c
+ - rxintr_cleanup() @ sys/dev/pci/if_lmc.c
  - ipr_rx_data_rdy() @ sys/netisdn/i4b_ipr.c
 
 Ideally we should make the functions run in softint somehow, but we don't have
diff -r 095eaf2b9f96 -r 39219066469c sys/dev/pci/if_lmc.c
--- a/sys/dev/pci/if_lmc.c      Tue Jul 31 17:09:45 2018 +0000
+++ b/sys/dev/pci/if_lmc.c      Tue Aug 07 13:02:31 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lmc.c,v 1.63 2017/01/24 09:05:28 ozaki-r Exp $ */
+/* $NetBSD: if_lmc.c,v 1.63.6.1 2018/08/07 13:02:31 martin Exp $ */
 
 /*-
  * Copyright (c) 2002-2006 David Boggs. <boggs%boggs.palo-alto.ca.us@localhost>
@@ -74,7 +74,7 @@
  */
 
 # include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.63 2017/01/24 09:05:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.63.6.1 2018/08/07 13:02:31 martin Exp $");
 # include <sys/param.h>        /* OS version */
 # include "opt_inet.h" /* INET6, INET */
 # include "opt_altq_enabled.h" /* ALTQ */
@@ -3388,7 +3388,7 @@
     }
   else
     /* Process tx pkts; do not process rx pkts. */
-    lmc_interrupt(sc, 0, 0);
+    ifnet_start(ifp);
 
   return error;
   }
@@ -3466,9 +3466,43 @@
 ifnet_start(struct ifnet *ifp)
   {
   softc_t *sc = IFP2SC(ifp);
-
-  /* Process tx pkts; do not process rx pkts. */
-  lmc_interrupt(sc, 0, 0);
+  int activity;
+
+  /* Do this FIRST!  Otherwise UPs deadlock and MPs spin. */
+  WRITE_CSR(sc, TLP_STATUS, READ_CSR(sc, TLP_STATUS));
+
+  /* If any CPU is inside this critical section, then */
+  /*  other CPUs should go away without doing anything. */
+  if (BOTTOM_TRYLOCK(sc) == 0)
+    {
+    sc->status.cntrs.lck_intr++;
+    return;
+    }
+
+  /* In Linux, pci_alloc_consistent() means DMA */
+  /*  descriptors do not need explicit syncing? */
+#if BSD
+  {
+  struct desc_ring *ring = &sc->txring;
+  DMA_SYNC(sc->txring.map, sc->txring.size_descs,
+   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+  }
+#endif
+
+  do
+    {
+    activity = txintr_setup(sc);
+    } while (activity);
+
+#if BSD
+  {
+  struct desc_ring *ring = &sc->txring;
+  DMA_SYNC(sc->txring.map, sc->txring.size_descs,
+   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+  }
+#endif
+
+  BOTTOM_UNLOCK(sc);
   }
 
 static void  /* context: softirq */
@@ -4294,7 +4328,7 @@
     sc->status.cntrs.ipackets++;
 
     /* Berkeley Packet Filter */
-    LMC_BPF_MTAP(sc, first_mbuf);
+    bpf_mtap_softint(sc->ifp, first_mbuf);
 
     /* Give this good packet to the network stacks. */
     sc->quota--;
@@ -4444,9 +4478,6 @@
         /* Include CRC and one flag byte in output byte count. */
         sc->status.cntrs.obytes += m->m_pkthdr.len + sc->config.crc_len +1;
         sc->status.cntrs.opackets++;
-
-        /* Berkeley Packet Filter */
-        LMC_BPF_MTAP(sc, m);
        }
 
       m_freem(m);
@@ -4564,6 +4595,9 @@
   /* Enqueue the mbuf; txintr_cleanup will free it. */
   mbuf_enqueue(ring, sc->tx_mbuf);
 
+  /* Berkeley Packet Filter */
+  bpf_mtap(sc->ifp, sc->tx_mbuf);
+
   /* The transmitter has room for another packet. */
   sc->tx_mbuf = NULL;
 
@@ -4969,7 +5003,6 @@
   do
     {
     activity  = txintr_cleanup(sc);
-    activity += txintr_setup(sc);
     activity += rxintr_cleanup(sc);
     activity += rxintr_setup(sc);
     } while (activity);
diff -r 095eaf2b9f96 -r 39219066469c sys/dev/pci/if_lmc.h
--- a/sys/dev/pci/if_lmc.h      Tue Jul 31 17:09:45 2018 +0000
+++ b/sys/dev/pci/if_lmc.h      Tue Aug 07 13:02:31 2018 +0000
@@ -1,5 +1,5 @@
 /*-
- * $NetBSD: if_lmc.h,v 1.24 2017/01/24 09:05:28 ozaki-r Exp $
+ * $NetBSD: if_lmc.h,v 1.24.6.1 2018/08/07 13:02:31 martin Exp $
  *
  * Copyright (c) 2002-2006 David Boggs. (boggs%boggs.palo-alto.ca.us@localhost)
  * All rights reserved.
@@ -984,7 +984,6 @@
 # define SLEEP(usecs)          tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
 # define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
 # define DMA_LOAD(map, addr, size)  bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
-#  define LMC_BPF_MTAP(sc, mbuf)       bpf_mtap_softint((sc)->ifp, mbuf)
 #  define LMC_BPF_ATTACH(sc, dlt, len)                 \
        do {                                            \
                bpf_attach((sc)->ifp, dlt, len);        \



Home | Main Index | Thread Index | Old Index