summaryrefslogtreecommitdiff
path: root/sys/dev/firewire/if_fwe.c
diff options
context:
space:
mode:
authorWill Andrews <will@FreeBSD.org>2014-09-18 17:28:21 +0000
committerWill Andrews <will@FreeBSD.org>2014-09-18 17:28:21 +0000
commit138ebd1b6403435182280641ccacf08fe58297d6 (patch)
treeb74b2f86e7c1916debe5f59d9d7850ac969ef47c /sys/dev/firewire/if_fwe.c
parent71d8e97e35bacb6aaeef308f8eca50679d0d8361 (diff)
Notes
Diffstat (limited to 'sys/dev/firewire/if_fwe.c')
-rw-r--r--sys/dev/firewire/if_fwe.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c
index 5797cc795704..d6db477a2973 100644
--- a/sys/dev/firewire/if_fwe.c
+++ b/sys/dev/firewire/if_fwe.c
@@ -57,18 +57,11 @@
#include <net/if_var.h>
#include <net/if_arp.h>
#include <net/if_types.h>
-#ifdef __DragonFly__
-#include <net/vlan/if_vlan_var.h>
-#include <bus/firewire/firewire.h>
-#include <bus/firewire/firewirereg.h>
-#include "if_fwevar.h"
-#else
#include <net/if_vlan_var.h>
#include <dev/firewire/firewire.h>
#include <dev/firewire/firewirereg.h>
#include <dev/firewire/if_fwevar.h>
-#endif
#define FWEDEBUG if (fwedebug) if_printf
#define TX_MAX_QUEUE (FWMAXQUEUE - 1)
@@ -144,11 +137,7 @@ fwe_attach(device_t dev)
struct fwe_softc *fwe;
struct ifnet *ifp;
int unit, s;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- u_char *eaddr;
-#else
u_char eaddr[6];
-#endif
struct fw_eui64 *eui;
fwe = ((struct fwe_softc *)device_get_softc(dev));
@@ -175,10 +164,6 @@ fwe_attach(device_t dev)
/* generate fake MAC address: first and last 3bytes from eui64 */
#define LOCAL (0x02)
#define GROUP (0x01)
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- eaddr = &IFP2ENADDR(fwe->eth_softc.ifp)[0];
-#endif
-
eui = &fwe->fd.fc->eui;
eaddr[0] = (FW_EUI64_BYTE(eui, 0) | LOCAL) & ~GROUP;
@@ -199,36 +184,21 @@ fwe_attach(device_t dev)
}
ifp->if_softc = &fwe->eth_softc;
-#if __FreeBSD_version >= 501113 || defined(__DragonFly__)
if_initname(ifp, device_get_name(dev), unit);
-#else
- ifp->if_unit = unit;
- ifp->if_name = "fwe";
-#endif
ifp->if_init = fwe_init;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- ifp->if_output = ether_output;
-#endif
ifp->if_start = fwe_start;
ifp->if_ioctl = fwe_ioctl;
ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE;
s = splimp();
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- ether_ifattach(ifp, 1);
-#else
ether_ifattach(ifp, eaddr);
-#endif
splx(s);
/* Tell the upper layer(s) we support long frames. */
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_POLLING;
ifp->if_capenable |= IFCAP_VLAN_MTU;
-#endif
-
FWEDEBUG(ifp, "interface created\n");
return 0;
@@ -270,11 +240,7 @@ fwe_stop(struct fwe_softc *fwe)
fwe->dma_ch = -1;
}
-#if defined(__FreeBSD__)
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
-#else
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-#endif
}
static int
@@ -294,12 +260,8 @@ fwe_detach(device_t dev)
s = splimp();
fwe_stop(fwe);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- ether_ifdetach(ifp, 1);
-#else
ether_ifdetach(ifp);
if_free(ifp);
-#endif
splx(s);
mtx_destroy(&fwe->mtx);
@@ -379,13 +341,8 @@ fwe_init(void *arg)
if ((xferq->flag & FWXFERQ_RUNNING) == 0)
fc->irx_enable(fc, fwe->dma_ch);
-#if defined(__FreeBSD__)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-#endif
#if 0
/* attempt to start output */
@@ -405,18 +362,10 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFFLAGS:
s = splimp();
if (ifp->if_flags & IFF_UP) {
-#if defined(__FreeBSD__)
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-#else
- if (!(ifp->if_flags & IFF_RUNNING))
-#endif
fwe_init(&fwe->eth_softc);
} else {
-#if defined(__FreeBSD__)
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-#else
- if (ifp->if_flags & IFF_RUNNING)
-#endif
fwe_stop(fwe);
}
/* XXX keep promiscoud mode */
@@ -463,21 +412,11 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
#endif /* DEVICE_POLLING */
break;
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
default:
-#else
- case SIOCSIFADDR:
- case SIOCGIFADDR:
- case SIOCSIFMTU:
-#endif
s = splimp();
error = ether_ioctl(ifp, cmd, data);
splx(s);
return (error);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- default:
- return (EINVAL);
-#endif
}
return (0);
@@ -537,20 +476,12 @@ fwe_start(struct ifnet *ifp)
}
s = splimp();
-#if defined(__FreeBSD__)
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-#else
- ifp->if_flags |= IFF_OACTIVE;
-#endif
if (ifp->if_snd.ifq_len != 0)
fwe_as_output(fwe, ifp);
-#if defined(__FreeBSD__)
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
- ifp->if_flags &= ~IFF_OACTIVE;
-#endif
splx(s);
}
@@ -591,12 +522,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp)
FWE_UNLOCK(fwe);
break;
}
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- if (ifp->if_bpf != NULL)
- bpf_mtap(ifp, m);
-#else
BPF_MTAP(ifp, m);
-#endif
/* keep ip packet alignment for alpha */
M_PREPEND(m, ETHER_ALIGN, M_NOWAIT);
@@ -634,9 +560,6 @@ fwe_as_input(struct fw_xferq *xferq)
struct fw_bulkxfer *sxfer;
struct fw_pkt *fp;
u_char *c;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- struct ether_header *eh;
-#endif
fwe = (struct fwe_softc *)xferq->sc;
ifp = fwe->eth_softc.ifp;
@@ -666,14 +589,7 @@ fwe_as_input(struct fw_xferq *xferq)
m->m_data += HDR_LEN + ETHER_ALIGN;
c = mtod(m, u_char *);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- eh = (struct ether_header *)c;
- m->m_data += sizeof(struct ether_header);
- m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN
- - sizeof(struct ether_header);
-#else
m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN;
-#endif
m->m_pkthdr.rcvif = ifp;
#if 0
FWEDEBUG(ifp, "%02x %02x %02x %02x %02x %02x\n"
@@ -690,11 +606,7 @@ fwe_as_input(struct fw_xferq *xferq)
c[20], c[21], c[22], c[23]
);
#endif
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
- ether_input(ifp, eh, m);
-#else
(*ifp->if_input)(ifp, m);
-#endif
ifp->if_ipackets ++;
}
if (STAILQ_FIRST(&xferq->stfree) != NULL)
@@ -720,9 +632,6 @@ static driver_t fwe_driver = {
};
-#ifdef __DragonFly__
-DECLARE_DUMMY_MODULE(fwe);
-#endif
DRIVER_MODULE(fwe, firewire, fwe_driver, fwe_devclass, 0, 0);
MODULE_VERSION(fwe, 1);
MODULE_DEPEND(fwe, firewire, 1, 1, 1);