aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-10-30 22:01:43 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-10-30 22:01:43 +0000
commitfa859363fe689e394f0b4f283060b0e1a55e25d2 (patch)
treed8f0f4067b26a7e85431b270bfd7969d0046155d
parent63f872fa99ee1ad73fac013680a74ad2a1f8b8a0 (diff)
downloadsrc-fa859363fe689e394f0b4f283060b0e1a55e25d2.tar.gz
src-fa859363fe689e394f0b4f283060b0e1a55e25d2.zip
Merge if.c:.211 and if_var.h:1.88 from HEAD to RELENG_5_3:
date: 2004/10/30 09:39:13; author: rwatson; state: Exp; lines: +25 -0 Move if_handoff() from an inline in if_var.h to a function to if.c in orden to harden the ABI for 5.x; this will permit us to modify the locking in the ifnet packet dispatch without requiring drivers to be recompiled. MFC after: 3 days Discussed at: EuroBSDCon Developer's Summit Approved by: re (kensmith)
Notes
Notes: svn path=/releng/5.3/; revision=137088
-rw-r--r--sys/net/if.c25
-rw-r--r--sys/net/if_var.h26
2 files changed, 27 insertions, 24 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ef1a68158d6a..b93e81b113c6 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1947,5 +1947,30 @@ if_start_deferred(void *context, int pending)
(ifp->if_start)(ifp);
}
+int
+if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
+{
+ int active = 0;
+
+ IF_LOCK(ifq);
+ if (_IF_QFULL(ifq)) {
+ _IF_DROP(ifq);
+ IF_UNLOCK(ifq);
+ m_freem(m);
+ return (0);
+ }
+ if (ifp != NULL) {
+ ifp->if_obytes += m->m_pkthdr.len + adjust;
+ if (m->m_flags & (M_BCAST|M_MCAST))
+ ifp->if_omcasts++;
+ active = ifp->if_flags & IFF_OACTIVE;
+ }
+ _IF_ENQUEUE(ifq, m);
+ IF_UNLOCK(ifq);
+ if (ifp != NULL && !active)
+ if_start(ifp);
+ return (1);
+}
+
SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers");
SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management");
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 958f6432ac51..860435956684 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -342,6 +342,8 @@ EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t);
mtx_unlock(&Giant); \
} while (0)
+int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp,
+ int adjust);
#define IF_HANDOFF(ifq, m, ifp) \
if_handoff((struct ifqueue *)ifq, m, ifp, 0)
#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \
@@ -349,30 +351,6 @@ EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t);
void if_start(struct ifnet *);
-static __inline int
-if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
-{
- int active = 0;
-
- IF_LOCK(ifq);
- if (_IF_QFULL(ifq)) {
- _IF_DROP(ifq);
- IF_UNLOCK(ifq);
- m_freem(m);
- return (0);
- }
- if (ifp != NULL) {
- ifp->if_obytes += m->m_pkthdr.len + adjust;
- if (m->m_flags & (M_BCAST|M_MCAST))
- ifp->if_omcasts++;
- active = ifp->if_flags & IFF_OACTIVE;
- }
- _IF_ENQUEUE(ifq, m);
- IF_UNLOCK(ifq);
- if (ifp != NULL && !active)
- if_start(ifp);
- return (1);
-}
#if 1 /* ALTQ */
#define IFQ_ENQUEUE(ifq, m, err) \
do { \