Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2015 19:05:16 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r277260 - projects/ifnet/sys/net
Message-ID:  <201501161905.t0GJ5G6a031007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Jan 16 19:05:15 2015
New Revision: 277260
URL: https://svnweb.freebsd.org/changeset/base/277260

Log:
  Most drivers need to call if_input() and some if_transmit(). Allow
  that providing non-inline versions of the functions. The code that
  includes if_var.h will continue to use inline functions.
  
  Sponsored by:	Nginx, Inc.

Modified:
  projects/ifnet/sys/net/if.c
  projects/ifnet/sys/net/if.h
  projects/ifnet/sys/net/if_var.h

Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c	Fri Jan 16 18:59:15 2015	(r277259)
+++ projects/ifnet/sys/net/if.c	Fri Jan 16 19:05:15 2015	(r277260)
@@ -3720,8 +3720,15 @@ if_snd_prepend(if_t ifp, struct mbuf *m)
  * Implementation of if ops, that can be called from drivers.
  */
 void
-if_input(if_t ifp, struct mbuf *m)
+if_input_noinline(if_t ifp, struct mbuf *m)
 {
 
-	return (ifp->if_ops->ifop_input(ifp, m));
+	return (if_input(ifp, m));
+}
+
+int
+if_transmit_noinline(if_t ifp, struct mbuf *m)
+{
+
+	return (if_transmit(ifp, m));
 }

Modified: projects/ifnet/sys/net/if.h
==============================================================================
--- projects/ifnet/sys/net/if.h	Fri Jan 16 18:59:15 2015	(r277259)
+++ projects/ifnet/sys/net/if.h	Fri Jan 16 19:05:15 2015	(r277260)
@@ -708,7 +708,6 @@ struct if_attach_args {
  */
 if_t	if_attach(struct if_attach_args *);
 void	if_detach(if_t);
-void	if_input(if_t, struct mbuf *);
 void	if_mtap(if_t, struct mbuf *, void *, u_int);
 void	if_inc_counter(if_t, ift_counter, int64_t);
 void	if_inc_txcounters(if_t, struct mbuf *);
@@ -722,6 +721,14 @@ uint64_t if_flagbits(if_t, ift_feature, 
 uint64_t if_get_counter_default(if_t, ift_counter);
 
 /*
+ * Interface if_ops that are available for drivers.
+ */
+void	if_input_noinline(if_t, struct mbuf *);
+#define	if_input(ifp, m)	if_input_noinline(ifp, m)
+int	if_transmit_noinline(if_t, struct mbuf *);
+#define	if_transmit(ifp, m)	if_transmit_noinline(ifp, m)
+
+/*
  * Traversing through interface address lists.
  */
 typedef	void	ifaddr_cb_t(void *, struct sockaddr *, struct sockaddr *,

Modified: projects/ifnet/sys/net/if_var.h
==============================================================================
--- projects/ifnet/sys/net/if_var.h	Fri Jan 16 18:59:15 2015	(r277259)
+++ projects/ifnet/sys/net/if_var.h	Fri Jan 16 19:05:15 2015	(r277260)
@@ -444,6 +444,15 @@ if_init(if_t ifp, void *sc)
 		return (ifp->if_ops->ifop_init(sc));
 }
 
+#undef if_input
+static inline void
+if_input(if_t ifp, struct mbuf *m)
+{
+
+	return (ifp->if_ops->ifop_input(ifp, m));
+}
+
+#undef if_transmit
 static inline int
 if_transmit(if_t ifp, struct mbuf *m)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501161905.t0GJ5G6a031007>