Source-Changes-HG archive

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

[src/bouyer-socketcan]: src/sys/netcan Allow can_bpf_mtap() to call bpf_mtap_...



details:   https://anonhg.NetBSD.org/src/rev/7cd4c9f7cc21
branches:  bouyer-socketcan
changeset: 820909:7cd4c9f7cc21
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu May 25 18:21:00 2017 +0000

description:
Allow can_bpf_mtap() to call bpf_mtap_softint() when needed.

diffstat:

 sys/netcan/can.c        |  11 +++++++----
 sys/netcan/can_var.h    |   4 ++--
 sys/netcan/if_canloop.c |   6 +++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diffs (84 lines):

diff -r f38895404d01 -r 7cd4c9f7cc21 sys/netcan/can.c
--- a/sys/netcan/can.c  Mon May 22 16:11:23 2017 +0000
+++ b/sys/netcan/can.c  Thu May 25 18:21:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: can.c,v 1.1.2.14 2017/05/22 16:11:23 bouyer Exp $      */
+/*     $NetBSD: can.c,v 1.1.2.15 2017/05/25 18:21:00 bouyer Exp $      */
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.1.2.14 2017/05/22 16:11:23 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.1.2.15 2017/05/25 18:21:00 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -416,7 +416,7 @@
 }
 
 void
-can_bpf_mtap(struct ifnet *ifp, struct mbuf *m)
+can_bpf_mtap(struct ifnet *ifp, struct mbuf *m, bool do_softint)
 {
        /* bpf wants the CAN id in network byte order */
        struct can_frame *cf;
@@ -425,7 +425,10 @@
        cf = mtod(m, struct can_frame *);
        oid = cf->can_id;
        cf->can_id = htonl(oid);
-       bpf_mtap(ifp, m);
+       if (do_softint)
+               bpf_mtap_softint(ifp, m);
+       else
+               bpf_mtap(ifp, m);
        cf->can_id = oid;
 }
 
diff -r f38895404d01 -r 7cd4c9f7cc21 sys/netcan/can_var.h
--- a/sys/netcan/can_var.h      Mon May 22 16:11:23 2017 +0000
+++ b/sys/netcan/can_var.h      Thu May 25 18:21:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: can_var.h,v 1.1.2.8 2017/05/22 16:11:23 bouyer Exp $   */
+/*     $NetBSD: can_var.h,v 1.1.2.9 2017/05/25 18:21:00 bouyer Exp $   */
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 int can_ctloutput(int, struct socket *, struct sockopt *);
 void can_init(void);
 void canintr(void);
-void can_bpf_mtap(struct ifnet *, struct mbuf *);
+void can_bpf_mtap(struct ifnet *, struct mbuf *, bool);
 
 #endif
 
diff -r f38895404d01 -r 7cd4c9f7cc21 sys/netcan/if_canloop.c
--- a/sys/netcan/if_canloop.c   Mon May 22 16:11:23 2017 +0000
+++ b/sys/netcan/if_canloop.c   Thu May 25 18:21:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_canloop.c,v 1.1.2.7 2017/05/22 16:11:23 bouyer Exp $        */
+/*     $NetBSD: if_canloop.c,v 1.1.2.8 2017/05/25 18:21:00 bouyer Exp $        */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.1.2.7 2017/05/22 16:11:23 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.1.2.8 2017/05/25 18:21:00 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_can.h"
@@ -162,7 +162,7 @@
                        panic("canloop_output: no header mbuf");
                m_set_rcvif(m, ifp);
                if (ifp->if_flags & IFF_LOOPBACK)
-                       can_bpf_mtap(ifp, m);
+                       can_bpf_mtap(ifp, m, 0);
 
                pktlen = m->m_pkthdr.len;
                ifp->if_opackets++;



Home | Main Index | Thread Index | Old Index