if_ef.c (97220) | if_ef.c (106939) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000 Boris Popov 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999, 2000 Boris Popov 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/net/if_ef.c 97220 2002-05-24 06:10:25Z peter $ | 26 * $FreeBSD: head/sys/net/if_ef.c 106939 2002-11-15 00:00:15Z sam $ |
27 */ 28 29#include "opt_inet.h" 30#include "opt_ipx.h" 31#include "opt_ef.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 76 unchanged lines hidden (view full) --- 111 112/* 113 * Install the interface, most of structure initialization done in ef_clone() 114 */ 115static int 116ef_attach(struct efnet *sc) 117{ 118 struct ifnet *ifp = (struct ifnet*)&sc->ef_ac.ac_if; | 27 */ 28 29#include "opt_inet.h" 30#include "opt_ipx.h" 31#include "opt_ef.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 76 unchanged lines hidden (view full) --- 111 112/* 113 * Install the interface, most of structure initialization done in ef_clone() 114 */ 115static int 116ef_attach(struct efnet *sc) 117{ 118 struct ifnet *ifp = (struct ifnet*)&sc->ef_ac.ac_if; |
119 struct ifaddr *ifa1, *ifa2; 120 struct sockaddr_dl *sdl1, *sdl2; | 119 struct ifaddr *ifa2; 120 struct sockaddr_dl *sdl2; |
121 122 ifp->if_output = ether_output; 123 ifp->if_start = ef_start; 124 ifp->if_watchdog = NULL; 125 ifp->if_init = ef_init; 126 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 127 ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); 128 /* 129 * Attach the interface 130 */ | 121 122 ifp->if_output = ether_output; 123 ifp->if_start = ef_start; 124 ifp->if_watchdog = NULL; 125 ifp->if_init = ef_init; 126 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 127 ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); 128 /* 129 * Attach the interface 130 */ |
131 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); | 131 ifa2 = ifaddr_byindex(sc->ef_ifp->if_index); 132 sdl2 = (struct sockaddr_dl *)ifa2->ifa_addr; 133 ether_ifattach(ifp, LLADDR(sdl2)); |
132 133 ifp->if_resolvemulti = 0; 134 ifp->if_type = IFT_XETHER; 135 ifp->if_flags |= IFF_RUNNING; 136 | 134 135 ifp->if_resolvemulti = 0; 136 ifp->if_type = IFT_XETHER; 137 ifp->if_flags |= IFF_RUNNING; 138 |
137 ifa1 = ifaddr_byindex(ifp->if_index); 138 ifa2 = ifaddr_byindex(sc->ef_ifp->if_index); 139 sdl1 = (struct sockaddr_dl *)ifa1->ifa_addr; 140 sdl2 = (struct sockaddr_dl *)ifa2->ifa_addr; 141 sdl1->sdl_type = IFT_ETHER; 142 sdl1->sdl_alen = ETHER_ADDR_LEN; 143 bcopy(LLADDR(sdl2), LLADDR(sdl1), ETHER_ADDR_LEN); | |
144 bcopy(LLADDR(sdl2), sc->ef_ac.ac_enaddr, ETHER_ADDR_LEN); 145 146 EFDEBUG("%s%d: attached\n", ifp->if_name, ifp->if_unit); 147 return 1; 148} 149 150/* 151 * This is for _testing_only_, just removes interface from interfaces list --- 33 unchanged lines hidden (view full) --- 185/* struct ef_link *sc = (struct ef_link*)ifp->if_softc;*/ 186 struct ifaddr *ifa = (struct ifaddr*)data; 187 int s, error; 188 189 EFDEBUG("IOCTL %ld for %s%d\n", cmd, ifp->if_name, ifp->if_unit); 190 error = 0; 191 s = splimp(); 192 switch (cmd) { | 139 bcopy(LLADDR(sdl2), sc->ef_ac.ac_enaddr, ETHER_ADDR_LEN); 140 141 EFDEBUG("%s%d: attached\n", ifp->if_name, ifp->if_unit); 142 return 1; 143} 144 145/* 146 * This is for _testing_only_, just removes interface from interfaces list --- 33 unchanged lines hidden (view full) --- 180/* struct ef_link *sc = (struct ef_link*)ifp->if_softc;*/ 181 struct ifaddr *ifa = (struct ifaddr*)data; 182 int s, error; 183 184 EFDEBUG("IOCTL %ld for %s%d\n", cmd, ifp->if_name, ifp->if_unit); 185 error = 0; 186 s = splimp(); 187 switch (cmd) { |
188 case SIOCSIFFLAGS: 189 error = 0; 190 break; |
|
193 case SIOCSIFADDR: 194 if (ifp->if_unit == ETHER_FT_8023 && 195 ifa->ifa_addr->sa_family != AF_IPX) { 196 error = EAFNOSUPPORT; 197 break; 198 } 199 ifp->if_flags |= IFF_UP; 200 /* FALL THROUGH */ | 191 case SIOCSIFADDR: 192 if (ifp->if_unit == ETHER_FT_8023 && 193 ifa->ifa_addr->sa_family != AF_IPX) { 194 error = EAFNOSUPPORT; 195 break; 196 } 197 ifp->if_flags |= IFF_UP; 198 /* FALL THROUGH */ |
201 case SIOCGIFADDR: 202 case SIOCSIFMTU: | 199 default: |
203 error = ether_ioctl(ifp, cmd, data); 204 break; | 200 error = ether_ioctl(ifp, cmd, data); 201 break; |
205 case SIOCSIFFLAGS: 206 error = 0; 207 break; 208 default: 209 error = EINVAL; | |
210 } 211 splx(s); 212 return error; 213} 214 215/* 216 * Currently packet prepared in the ether_output(), but this can be a better 217 * place. --- 8 unchanged lines hidden (view full) --- 226 ifp->if_flags |= IFF_OACTIVE; 227 p = sc->ef_ifp; 228 229 EFDEBUG("\n"); 230 for (;;) { 231 IF_DEQUEUE(&ifp->if_snd, m); 232 if (m == 0) 233 break; | 202 } 203 splx(s); 204 return error; 205} 206 207/* 208 * Currently packet prepared in the ether_output(), but this can be a better 209 * place. --- 8 unchanged lines hidden (view full) --- 218 ifp->if_flags |= IFF_OACTIVE; 219 p = sc->ef_ifp; 220 221 EFDEBUG("\n"); 222 for (;;) { 223 IF_DEQUEUE(&ifp->if_snd, m); 224 if (m == 0) 225 break; |
234 if (ifp->if_bpf) 235 bpf_mtap(ifp, m); | 226 BPF_MTAP(ifp, m); |
236 if (! IF_HANDOFF(&p->if_snd, m, p)) { 237 ifp->if_oerrors++; 238 continue; 239 } 240 ifp->if_opackets++; 241 } 242 ifp->if_flags &= ~IFF_OACTIVE; 243 return; --- 131 unchanged lines hidden (view full) --- 375 eifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); 376 m->m_pkthdr.rcvif = eifp; 377 378 if (eifp->if_bpf) { 379 struct mbuf m0; 380 m0.m_next = m; 381 m0.m_len = sizeof(struct ether_header); 382 m0.m_data = (char *)eh; | 227 if (! IF_HANDOFF(&p->if_snd, m, p)) { 228 ifp->if_oerrors++; 229 continue; 230 } 231 ifp->if_opackets++; 232 } 233 ifp->if_flags &= ~IFF_OACTIVE; 234 return; --- 131 unchanged lines hidden (view full) --- 366 eifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); 367 m->m_pkthdr.rcvif = eifp; 368 369 if (eifp->if_bpf) { 370 struct mbuf m0; 371 m0.m_next = m; 372 m0.m_len = sizeof(struct ether_header); 373 m0.m_data = (char *)eh; |
383 bpf_mtap(eifp, &m0); | 374 BPF_MTAP(eifp, &m0); |
384 } 385 /* 386 * Now we ready to adjust mbufs and pass them to protocol intr's 387 */ 388 inq = NULL; 389 switch(ft) { 390 case ETHER_FT_EII: 391 if (ef_inputEII(m, eh, ether_type, &inq) != 0) --- 222 unchanged lines hidden --- | 375 } 376 /* 377 * Now we ready to adjust mbufs and pass them to protocol intr's 378 */ 379 inq = NULL; 380 switch(ft) { 381 case ETHER_FT_EII: 382 if (ef_inputEII(m, eh, ether_type, &inq) != 0) --- 222 unchanged lines hidden --- |