mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
Mechanically convert fwe(4) and fwip(4) to IfAPI
Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37850
This commit is contained in:
parent
3fba06ad13
commit
61c05f13d2
@ -69,12 +69,12 @@
|
||||
#define TX_MAX_QUEUE (FWMAXQUEUE - 1)
|
||||
|
||||
/* network interface */
|
||||
static void fwe_start (struct ifnet *);
|
||||
static int fwe_ioctl (struct ifnet *, u_long, caddr_t);
|
||||
static void fwe_start (if_t);
|
||||
static int fwe_ioctl (if_t, u_long, caddr_t);
|
||||
static void fwe_init (void *);
|
||||
|
||||
static void fwe_output_callback (struct fw_xfer *);
|
||||
static void fwe_as_output (struct fwe_softc *, struct ifnet *);
|
||||
static void fwe_as_output (struct fwe_softc *, if_t);
|
||||
static void fwe_as_input (struct fw_xferq *);
|
||||
|
||||
static int fwedebug = 0;
|
||||
@ -98,15 +98,15 @@ SYSCTL_INT(_hw_firewire_fwe, OID_AUTO, rx_queue_len, CTLFLAG_RWTUN, &rx_queue_le
|
||||
static poll_handler_t fwe_poll;
|
||||
|
||||
static int
|
||||
fwe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
|
||||
fwe_poll(if_t ifp, enum poll_cmd cmd, int count)
|
||||
{
|
||||
struct fwe_softc *fwe;
|
||||
struct firewire_comm *fc;
|
||||
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||
return (0);
|
||||
|
||||
fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
|
||||
fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe;
|
||||
fc = fwe->fd.fc;
|
||||
fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count);
|
||||
return (0);
|
||||
@ -137,7 +137,7 @@ static int
|
||||
fwe_attach(device_t dev)
|
||||
{
|
||||
struct fwe_softc *fwe;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int unit, s;
|
||||
u_char eaddr[6];
|
||||
struct fw_eui64 *eui;
|
||||
@ -184,23 +184,23 @@ fwe_attach(device_t dev)
|
||||
device_printf(dev, "can not if_alloc()\n");
|
||||
return (ENOSPC);
|
||||
}
|
||||
ifp->if_softc = &fwe->eth_softc;
|
||||
if_setsoftc(ifp, &fwe->eth_softc);
|
||||
|
||||
if_initname(ifp, device_get_name(dev), unit);
|
||||
ifp->if_init = fwe_init;
|
||||
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;
|
||||
if_setinitfn(ifp, fwe_init);
|
||||
if_setstartfn(ifp, fwe_start);
|
||||
if_setioctlfn(ifp, fwe_ioctl);
|
||||
if_setflags(ifp, (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST));
|
||||
if_setsendqlen(ifp, TX_MAX_QUEUE);
|
||||
|
||||
s = splimp();
|
||||
ether_ifattach(ifp, eaddr);
|
||||
splx(s);
|
||||
|
||||
/* Tell the upper layer(s) we support long frames. */
|
||||
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
|
||||
ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_POLLING;
|
||||
ifp->if_capenable |= IFCAP_VLAN_MTU;
|
||||
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
|
||||
if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU | IFCAP_POLLING, 0);
|
||||
if_setcapenablebit(ifp, IFCAP_VLAN_MTU, 0);
|
||||
|
||||
FWEDEBUG(ifp, "interface created\n");
|
||||
return 0;
|
||||
@ -211,7 +211,7 @@ fwe_stop(struct fwe_softc *fwe)
|
||||
{
|
||||
struct firewire_comm *fc;
|
||||
struct fw_xferq *xferq;
|
||||
struct ifnet *ifp = fwe->eth_softc.ifp;
|
||||
if_t ifp = fwe->eth_softc.ifp;
|
||||
struct fw_xfer *xfer, *next;
|
||||
int i;
|
||||
|
||||
@ -242,21 +242,21 @@ fwe_stop(struct fwe_softc *fwe)
|
||||
fwe->dma_ch = -1;
|
||||
}
|
||||
|
||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
|
||||
}
|
||||
|
||||
static int
|
||||
fwe_detach(device_t dev)
|
||||
{
|
||||
struct fwe_softc *fwe;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int s;
|
||||
|
||||
fwe = device_get_softc(dev);
|
||||
ifp = fwe->eth_softc.ifp;
|
||||
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_capenable & IFCAP_POLLING)
|
||||
if (if_getcapenable(ifp) & IFCAP_POLLING)
|
||||
ether_poll_deregister(ifp);
|
||||
#endif
|
||||
s = splimp();
|
||||
@ -275,7 +275,7 @@ fwe_init(void *arg)
|
||||
{
|
||||
struct fwe_softc *fwe = ((struct fwe_eth_softc *)arg)->fwe;
|
||||
struct firewire_comm *fc;
|
||||
struct ifnet *ifp = fwe->eth_softc.ifp;
|
||||
if_t ifp = fwe->eth_softc.ifp;
|
||||
struct fw_xferq *xferq;
|
||||
struct fw_xfer *xfer;
|
||||
struct mbuf *m;
|
||||
@ -284,7 +284,7 @@ fwe_init(void *arg)
|
||||
FWEDEBUG(ifp, "initializing\n");
|
||||
|
||||
/* XXX keep promiscoud mode */
|
||||
ifp->if_flags |= IFF_PROMISC;
|
||||
if_setflagbits(ifp, IFF_PROMISC, 0);
|
||||
|
||||
fc = fwe->fd.fc;
|
||||
if (fwe->dma_ch < 0) {
|
||||
@ -339,8 +339,8 @@ fwe_init(void *arg)
|
||||
if ((xferq->flag & FWXFERQ_RUNNING) == 0)
|
||||
fc->irx_enable(fc, fwe->dma_ch);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
|
||||
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
|
||||
#if 0
|
||||
/* attempt to start output */
|
||||
@ -350,24 +350,24 @@ fwe_init(void *arg)
|
||||
|
||||
|
||||
static int
|
||||
fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
fwe_ioctl(if_t ifp, u_long cmd, caddr_t data)
|
||||
{
|
||||
struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
|
||||
struct fwe_softc *fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe;
|
||||
struct ifstat *ifs = NULL;
|
||||
int s, error;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFFLAGS:
|
||||
s = splimp();
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
if (if_getflags(ifp) & IFF_UP) {
|
||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||
fwe_init(&fwe->eth_softc);
|
||||
} else {
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
||||
fwe_stop(fwe);
|
||||
}
|
||||
/* XXX keep promiscoud mode */
|
||||
ifp->if_flags |= IFF_PROMISC;
|
||||
if_setflagbits(ifp, IFF_PROMISC, 0);
|
||||
splx(s);
|
||||
break;
|
||||
case SIOCADDMULTI:
|
||||
@ -388,21 +388,21 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
struct firewire_comm *fc = fwe->fd.fc;
|
||||
|
||||
if (ifr->ifr_reqcap & IFCAP_POLLING &&
|
||||
!(ifp->if_capenable & IFCAP_POLLING)) {
|
||||
!(if_getcapenable(ifp) & IFCAP_POLLING)) {
|
||||
error = ether_poll_register(fwe_poll, ifp);
|
||||
if (error)
|
||||
return (error);
|
||||
/* Disable interrupts */
|
||||
fc->set_intr(fc, 0);
|
||||
ifp->if_capenable |= IFCAP_POLLING;
|
||||
if_setcapenablebit(ifp, IFCAP_POLLING, 0);
|
||||
return (error);
|
||||
}
|
||||
if (!(ifr->ifr_reqcap & IFCAP_POLLING) &&
|
||||
ifp->if_capenable & IFCAP_POLLING) {
|
||||
if_getcapenable(ifp) & IFCAP_POLLING) {
|
||||
error = ether_poll_deregister(ifp);
|
||||
/* Enable interrupts. */
|
||||
fc->set_intr(fc, 1);
|
||||
ifp->if_capenable &= ~IFCAP_POLLING;
|
||||
if_setcapenablebit(ifp, 0, IFCAP_POLLING);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -422,7 +422,7 @@ static void
|
||||
fwe_output_callback(struct fw_xfer *xfer)
|
||||
{
|
||||
struct fwe_softc *fwe;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int s;
|
||||
|
||||
fwe = (struct fwe_softc *)xfer->sc;
|
||||
@ -441,14 +441,14 @@ fwe_output_callback(struct fw_xfer *xfer)
|
||||
splx(s);
|
||||
|
||||
/* for queue full */
|
||||
if (ifp->if_snd.ifq_head != NULL)
|
||||
if (!if_sendq_empty(ifp))
|
||||
fwe_start(ifp);
|
||||
}
|
||||
|
||||
static void
|
||||
fwe_start(struct ifnet *ifp)
|
||||
fwe_start(if_t ifp)
|
||||
{
|
||||
struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
|
||||
struct fwe_softc *fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe;
|
||||
int s;
|
||||
|
||||
FWEDEBUG(ifp, "starting\n");
|
||||
@ -460,7 +460,7 @@ fwe_start(struct ifnet *ifp)
|
||||
|
||||
s = splimp();
|
||||
do {
|
||||
IF_DEQUEUE(&ifp->if_snd, m);
|
||||
m = if_dequeue(ifp);
|
||||
if (m != NULL)
|
||||
m_freem(m);
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
@ -471,12 +471,12 @@ fwe_start(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
s = splimp();
|
||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
|
||||
if (ifp->if_snd.ifq_len != 0)
|
||||
if (!if_sendq_empty(ifp))
|
||||
fwe_as_output(fwe, ifp);
|
||||
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ fwe_start(struct ifnet *ifp)
|
||||
#endif
|
||||
/* Async. stream output */
|
||||
static void
|
||||
fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp)
|
||||
fwe_as_output(struct fwe_softc *fwe, if_t ifp)
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct fw_xfer *xfer;
|
||||
@ -497,7 +497,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp)
|
||||
xfer = NULL;
|
||||
xferq = fwe->fd.fc->atq;
|
||||
while ((xferq->queued < xferq->maxq - 1) &&
|
||||
(ifp->if_snd.ifq_head != NULL)) {
|
||||
!if_sendq_empty(ifp)) {
|
||||
FWE_LOCK(fwe);
|
||||
xfer = STAILQ_FIRST(&fwe->xferlist);
|
||||
if (xfer == NULL) {
|
||||
@ -510,7 +510,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp)
|
||||
STAILQ_REMOVE_HEAD(&fwe->xferlist, link);
|
||||
FWE_UNLOCK(fwe);
|
||||
|
||||
IF_DEQUEUE(&ifp->if_snd, m);
|
||||
m = if_dequeue(ifp);
|
||||
if (m == NULL) {
|
||||
FWE_LOCK(fwe);
|
||||
STAILQ_INSERT_HEAD(&fwe->xferlist, xfer, link);
|
||||
@ -550,7 +550,7 @@ static void
|
||||
fwe_as_input(struct fw_xferq *xferq)
|
||||
{
|
||||
struct mbuf *m, *m0;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
struct fwe_softc *fwe;
|
||||
struct fw_bulkxfer *sxfer;
|
||||
struct fw_pkt *fp;
|
||||
@ -605,7 +605,7 @@ fwe_as_input(struct fw_xferq *xferq)
|
||||
c[20], c[21], c[22], c[23]
|
||||
);
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, m);
|
||||
if_input(ifp, m);
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
}
|
||||
if (STAILQ_FIRST(&xferq->stfree) != NULL)
|
||||
|
@ -47,7 +47,7 @@ struct fwe_softc {
|
||||
struct fw_pkt pkt_hdr;
|
||||
STAILQ_HEAD(, fw_xfer) xferlist;
|
||||
struct fwe_eth_softc {
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
struct fwe_softc *fwe;
|
||||
} eth_softc;
|
||||
struct mtx mtx;
|
||||
|
@ -80,13 +80,13 @@
|
||||
#define TX_MAX_QUEUE (FWMAXQUEUE - 1)
|
||||
|
||||
/* network interface */
|
||||
static void fwip_start (struct ifnet *);
|
||||
static int fwip_ioctl (struct ifnet *, u_long, caddr_t);
|
||||
static void fwip_start (if_t);
|
||||
static int fwip_ioctl (if_t, u_long, caddr_t);
|
||||
static void fwip_init (void *);
|
||||
|
||||
static void fwip_post_busreset (void *);
|
||||
static void fwip_output_callback (struct fw_xfer *);
|
||||
static void fwip_async_output (struct fwip_softc *, struct ifnet *);
|
||||
static void fwip_async_output (struct fwip_softc *, if_t);
|
||||
static void fwip_start_send (void *, int);
|
||||
static void fwip_stream_input (struct fw_xferq *);
|
||||
static void fwip_unicast_input(struct fw_xfer *);
|
||||
@ -108,15 +108,15 @@ SYSCTL_INT(_hw_firewire_fwip, OID_AUTO, rx_queue_len, CTLFLAG_RWTUN, &rx_queue_l
|
||||
static poll_handler_t fwip_poll;
|
||||
|
||||
static int
|
||||
fwip_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
|
||||
fwip_poll(if_t ifp, enum poll_cmd cmd, int count)
|
||||
{
|
||||
struct fwip_softc *fwip;
|
||||
struct firewire_comm *fc;
|
||||
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||
return (0);
|
||||
|
||||
fwip = ((struct fwip_eth_softc *)ifp->if_softc)->fwip;
|
||||
fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip;
|
||||
fc = fwip->fd.fc;
|
||||
fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count);
|
||||
return (0);
|
||||
@ -147,7 +147,7 @@ static int
|
||||
fwip_attach(device_t dev)
|
||||
{
|
||||
struct fwip_softc *fwip;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int unit, s;
|
||||
struct fw_hwaddr *hwaddr;
|
||||
|
||||
@ -183,16 +183,16 @@ fwip_attach(device_t dev)
|
||||
hwaddr->sender_unicast_FIFO_lo = htonl((uint32_t)INET_FIFO);
|
||||
|
||||
/* fill the rest and attach interface */
|
||||
ifp->if_softc = &fwip->fw_softc;
|
||||
if_setsoftc(ifp, &fwip->fw_softc);
|
||||
|
||||
if_initname(ifp, device_get_name(dev), unit);
|
||||
ifp->if_init = fwip_init;
|
||||
ifp->if_start = fwip_start;
|
||||
ifp->if_ioctl = fwip_ioctl;
|
||||
ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
|
||||
ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE;
|
||||
if_setinitfn(ifp, fwip_init);
|
||||
if_setstartfn(ifp, fwip_start);
|
||||
if_setioctlfn(ifp, fwip_ioctl);
|
||||
if_setflags(ifp, (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST));
|
||||
if_setsendqlen(ifp, TX_MAX_QUEUE);
|
||||
#ifdef DEVICE_POLLING
|
||||
ifp->if_capabilities |= IFCAP_POLLING;
|
||||
if_setcapabilitiesbit(ifp, IFCAP_POLLING, 0);
|
||||
#endif
|
||||
|
||||
s = splimp();
|
||||
@ -208,7 +208,7 @@ fwip_stop(struct fwip_softc *fwip)
|
||||
{
|
||||
struct firewire_comm *fc;
|
||||
struct fw_xferq *xferq;
|
||||
struct ifnet *ifp = fwip->fw_softc.fwip_ifp;
|
||||
if_t ifp = fwip->fw_softc.fwip_ifp;
|
||||
struct fw_xfer *xfer, *next;
|
||||
int i;
|
||||
|
||||
@ -246,21 +246,21 @@ fwip_stop(struct fwip_softc *fwip)
|
||||
fwip->dma_ch = -1;
|
||||
}
|
||||
|
||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
|
||||
}
|
||||
|
||||
static int
|
||||
fwip_detach(device_t dev)
|
||||
{
|
||||
struct fwip_softc *fwip;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int s;
|
||||
|
||||
fwip = (struct fwip_softc *)device_get_softc(dev);
|
||||
ifp = fwip->fw_softc.fwip_ifp;
|
||||
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_capenable & IFCAP_POLLING)
|
||||
if (if_getcapenable(ifp) & IFCAP_POLLING)
|
||||
ether_poll_deregister(ifp);
|
||||
#endif
|
||||
|
||||
@ -280,7 +280,7 @@ fwip_init(void *arg)
|
||||
{
|
||||
struct fwip_softc *fwip = ((struct fwip_eth_softc *)arg)->fwip;
|
||||
struct firewire_comm *fc;
|
||||
struct ifnet *ifp = fwip->fw_softc.fwip_ifp;
|
||||
if_t ifp = fwip->fw_softc.fwip_ifp;
|
||||
struct fw_xferq *xferq;
|
||||
struct fw_xfer *xfer;
|
||||
struct mbuf *m;
|
||||
@ -367,8 +367,8 @@ fwip_init(void *arg)
|
||||
if ((xferq->flag & FWXFERQ_RUNNING) == 0)
|
||||
fc->irx_enable(fc, fwip->dma_ch);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
|
||||
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
|
||||
#if 0
|
||||
/* attempt to start output */
|
||||
@ -377,19 +377,19 @@ fwip_init(void *arg)
|
||||
}
|
||||
|
||||
static int
|
||||
fwip_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
fwip_ioctl(if_t ifp, u_long cmd, caddr_t data)
|
||||
{
|
||||
struct fwip_softc *fwip = ((struct fwip_eth_softc *)ifp->if_softc)->fwip;
|
||||
struct fwip_softc *fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip;
|
||||
int s, error;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFFLAGS:
|
||||
s = splimp();
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
if (if_getflags(ifp) & IFF_UP) {
|
||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||
fwip_init(&fwip->fw_softc);
|
||||
} else {
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
||||
fwip_stop(fwip);
|
||||
}
|
||||
splx(s);
|
||||
@ -404,21 +404,21 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
struct firewire_comm *fc = fwip->fd.fc;
|
||||
|
||||
if (ifr->ifr_reqcap & IFCAP_POLLING &&
|
||||
!(ifp->if_capenable & IFCAP_POLLING)) {
|
||||
!(if_getcapenable(ifp) & IFCAP_POLLING)) {
|
||||
error = ether_poll_register(fwip_poll, ifp);
|
||||
if (error)
|
||||
return (error);
|
||||
/* Disable interrupts */
|
||||
fc->set_intr(fc, 0);
|
||||
ifp->if_capenable |= IFCAP_POLLING;
|
||||
if_setcapenablebit(ifp, IFCAP_POLLING, 0);
|
||||
return (error);
|
||||
}
|
||||
if (!(ifr->ifr_reqcap & IFCAP_POLLING) &&
|
||||
ifp->if_capenable & IFCAP_POLLING) {
|
||||
if_getcapenable(ifp) & IFCAP_POLLING) {
|
||||
error = ether_poll_deregister(ifp);
|
||||
/* Enable interrupts. */
|
||||
fc->set_intr(fc, 1);
|
||||
ifp->if_capenable &= ~IFCAP_POLLING;
|
||||
if_setcapenablebit(ifp, 0, IFCAP_POLLING);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
@ -469,7 +469,7 @@ static void
|
||||
fwip_output_callback(struct fw_xfer *xfer)
|
||||
{
|
||||
struct fwip_softc *fwip;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
int s;
|
||||
|
||||
fwip = (struct fwip_softc *)xfer->sc;
|
||||
@ -488,15 +488,15 @@ fwip_output_callback(struct fw_xfer *xfer)
|
||||
splx(s);
|
||||
|
||||
/* for queue full */
|
||||
if (ifp->if_snd.ifq_head != NULL) {
|
||||
if (!if_sendq_empty(ifp)) {
|
||||
fwip_start(ifp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fwip_start(struct ifnet *ifp)
|
||||
fwip_start(if_t ifp)
|
||||
{
|
||||
struct fwip_softc *fwip = ((struct fwip_eth_softc *)ifp->if_softc)->fwip;
|
||||
struct fwip_softc *fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip;
|
||||
int s;
|
||||
|
||||
FWIPDEBUG(ifp, "starting\n");
|
||||
@ -508,7 +508,7 @@ fwip_start(struct ifnet *ifp)
|
||||
|
||||
s = splimp();
|
||||
do {
|
||||
IF_DEQUEUE(&ifp->if_snd, m);
|
||||
m = if_dequeue(ifp);
|
||||
if (m != NULL)
|
||||
m_freem(m);
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
@ -519,18 +519,18 @@ fwip_start(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
s = splimp();
|
||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
|
||||
if (ifp->if_snd.ifq_len != 0)
|
||||
if (!if_sendq_empty(ifp))
|
||||
fwip_async_output(fwip, ifp);
|
||||
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/* Async. stream output */
|
||||
static void
|
||||
fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp)
|
||||
fwip_async_output(struct fwip_softc *fwip, if_t ifp)
|
||||
{
|
||||
struct firewire_comm *fc = fwip->fd.fc;
|
||||
struct mbuf *m;
|
||||
@ -546,7 +546,7 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp)
|
||||
xfer = NULL;
|
||||
xferq = fc->atq;
|
||||
while ((xferq->queued < xferq->maxq - 1) &&
|
||||
(ifp->if_snd.ifq_head != NULL)) {
|
||||
!if_sendq_empty(ifp)) {
|
||||
FWIP_LOCK(fwip);
|
||||
xfer = STAILQ_FIRST(&fwip->xferlist);
|
||||
if (xfer == NULL) {
|
||||
@ -559,7 +559,7 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp)
|
||||
STAILQ_REMOVE_HEAD(&fwip->xferlist, link);
|
||||
FWIP_UNLOCK(fwip);
|
||||
|
||||
IF_DEQUEUE(&ifp->if_snd, m);
|
||||
m = if_dequeue(ifp);
|
||||
if (m == NULL) {
|
||||
FWIP_LOCK(fwip);
|
||||
STAILQ_INSERT_HEAD(&fwip->xferlist, xfer, link);
|
||||
@ -674,7 +674,7 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp)
|
||||
FWIP_LOCK(fwip);
|
||||
STAILQ_INSERT_TAIL(&fwip->xferlist, xfer, link);
|
||||
FWIP_UNLOCK(fwip);
|
||||
IF_PREPEND(&ifp->if_snd, m);
|
||||
if_sendq_prepend(ifp, m);
|
||||
break;
|
||||
}
|
||||
if (error) {
|
||||
@ -711,7 +711,7 @@ fwip_stream_input(struct fw_xferq *xferq)
|
||||
struct epoch_tracker et;
|
||||
struct mbuf *m, *m0;
|
||||
struct m_tag *mtag;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
struct fwip_softc *fwip;
|
||||
struct fw_bulkxfer *sxfer;
|
||||
struct fw_pkt *fp;
|
||||
@ -781,7 +781,7 @@ fwip_stream_input(struct fw_xferq *xferq)
|
||||
* Record the sender ID for possible BPF usage.
|
||||
*/
|
||||
src = ntohl(p[1]) >> 16;
|
||||
if (bpf_peers_present(ifp->if_bpf)) {
|
||||
if (bpf_peers_present(if_getbpf(ifp))) {
|
||||
mtag = m_tag_alloc(MTAG_FIREWIRE,
|
||||
MTAG_FIREWIRE_SENDER_EUID,
|
||||
2*sizeof(uint32_t), M_NOWAIT);
|
||||
@ -839,7 +839,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
|
||||
struct mbuf *m;
|
||||
struct m_tag *mtag;
|
||||
struct epoch_tracker et;
|
||||
struct ifnet *ifp;
|
||||
if_t ifp;
|
||||
struct fwip_softc *fwip;
|
||||
struct fw_pkt *fp;
|
||||
//struct fw_pkt *sfp;
|
||||
@ -881,7 +881,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (bpf_peers_present(ifp->if_bpf)) {
|
||||
if (bpf_peers_present(if_getbpf(ifp))) {
|
||||
/*
|
||||
* Record the sender ID for possible BPF usage.
|
||||
*/
|
||||
@ -906,7 +906,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
|
||||
|
||||
/*
|
||||
* Hand off to the generic encapsulation code. We don't use
|
||||
* ifp->if_input so that we can pass the source nodeid as an
|
||||
* ifp->if_input so that we can pass the source nodeid as an
|
||||
* argument to facilitate link-level fragment reassembly.
|
||||
*/
|
||||
m->m_len = m->m_pkthdr.len = fp->mode.wreqb.len;
|
||||
|
@ -57,7 +57,7 @@ struct fwip_softc {
|
||||
struct crom_chunk spec6; /* specifier description IPv6 */
|
||||
struct crom_chunk ver6; /* version description IPv6 */
|
||||
struct fwip_eth_softc {
|
||||
struct ifnet *fwip_ifp;
|
||||
if_t fwip_ifp;
|
||||
struct fwip_softc *fwip;
|
||||
} fw_softc;
|
||||
struct mtx mtx;
|
||||
|
Loading…
Reference in New Issue
Block a user