aboutsummaryrefslogtreecommitdiff
path: root/sys/netipx
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2005-06-10 16:49:24 +0000
committerBrooks Davis <brooks@FreeBSD.org>2005-06-10 16:49:24 +0000
commitfc74a9f93a5fbc83262aa12084404ac953c854b5 (patch)
treef65b6d7834b40dfcd48534829a0a1e9529ab87ee /sys/netipx
parent7f1d8b7517a6a93379974243551e0ec0a96cb54e (diff)
downloadsrc-fc74a9f93a5fbc83262aa12084404ac953c854b5.tar.gz
src-fc74a9f93a5fbc83262aa12084404ac953c854b5.zip
Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
Notes
Notes: svn path=/head/; revision=147256
Diffstat (limited to 'sys/netipx')
-rw-r--r--sys/netipx/ipx_ip.c20
-rw-r--r--sys/netipx/ipx_ip.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c
index 4aa432b461cd..e100e5189e7f 100644
--- a/sys/netipx/ipx_ip.c
+++ b/sys/netipx/ipx_ip.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sockio.h>
#include <net/if.h>
+#include <net/if_types.h>
#include <net/netisr.h>
#include <net/route.h>
@@ -108,7 +109,11 @@ ipxipattach()
return (NULL);
m->ifen_next = ipxip_list;
ipxip_list = m;
- ifp = &m->ifen_ifnet;
+ ifp = m->ifen_ifp = if_alloc(IFT_IPXIP);
+ if (ifp == NULL) {
+ FREE(m, M_PCB);
+ return (NULL);
+ }
if_initname(ifp, "ipxip", ipxipif_units++);
ifp->if_mtu = LOMTU;
@@ -116,6 +121,7 @@ ipxipattach()
ifp->if_output = ipxipoutput;
ifp->if_start = ipxipstart;
ifp->if_flags = IFF_POINTOPOINT;
+ ifp->if_softc = m;
if_attach(ifp);
return (m);
@@ -234,14 +240,14 @@ ipxipoutput(ifp, m, dst, rt)
struct sockaddr *dst;
struct rtentry *rt;
{
- register struct ifnet_en *ifn = (struct ifnet_en *)ifp;
+ register struct ifnet_en *ifn = (struct ifnet_en *)ifp->if_softc;
register struct ip *ip;
register struct route *ro = &(ifn->ifen_route);
register int len = 0;
register struct ipx *ipx = mtod(m, struct ipx *);
int error;
- ifn->ifen_ifnet.if_opackets++;
+ ifn->ifen_ifp->if_opackets++;
ipxipif.if_opackets++;
/*
@@ -287,8 +293,8 @@ ipxipoutput(ifp, m, dst, rt)
*/
error = (ip_output(m, (struct mbuf *)NULL, ro, SO_BROADCAST, NULL, NULL));
if (error) {
- ifn->ifen_ifnet.if_oerrors++;
- ifn->ifen_ifnet.if_ierrors = error;
+ ifn->ifen_ifp->if_oerrors++;
+ ifn->ifen_ifp->if_ierrors = error;
}
return (error);
m_freem(m);
@@ -363,7 +369,7 @@ ipxip_route(so, sopt)
* Is there a free (pseudo-)interface or space?
*/
for (ifn = ipxip_list; ifn != NULL; ifn = ifn->ifen_next) {
- if ((ifn->ifen_ifnet.if_flags & IFF_UP) == 0)
+ if ((ifn->ifen_ifp->if_flags & IFF_UP) == 0)
break;
}
if (ifn == NULL)
@@ -396,7 +402,7 @@ static int
ipxip_free(ifp)
struct ifnet *ifp;
{
- register struct ifnet_en *ifn = (struct ifnet_en *)ifp;
+ register struct ifnet_en *ifn = (struct ifnet_en *)ifp->if_softc;
struct route *ro = & ifn->ifen_route;
if (ro->ro_rt != NULL) {
diff --git a/sys/netipx/ipx_ip.h b/sys/netipx/ipx_ip.h
index 23e447062875..150b1ff3b5b4 100644
--- a/sys/netipx/ipx_ip.h
+++ b/sys/netipx/ipx_ip.h
@@ -40,7 +40,7 @@
#define _NETIPX_IPXIP_H_
struct ifnet_en {
- struct ifnet ifen_ifnet;
+ struct ifnet *ifen_ifp;
struct route ifen_route;
struct in_addr ifen_src;
struct in_addr ifen_dst;