Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144615209
D37844.1775794404.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D37844.1775794404.diff
View Options
diff --git a/sys/dev/beri/virtio/network/if_vtbe.c b/sys/dev/beri/virtio/network/if_vtbe.c
--- a/sys/dev/beri/virtio/network/if_vtbe.c
+++ b/sys/dev/beri/virtio/network/if_vtbe.c
@@ -114,7 +114,7 @@
bus_space_tag_t bst;
bus_space_handle_t bsh;
device_t dev;
- struct ifnet *ifp;
+ if_t ifp;
int if_flags;
struct mtx mtx;
boolean_t is_attached;
@@ -146,7 +146,7 @@
struct virtio_net_hdr *vnh;
struct vqueue_info *vq;
struct iovec *tiov;
- struct ifnet *ifp;
+ if_t ifp;
struct mbuf *m;
struct uio uio;
int enqueued;
@@ -165,7 +165,7 @@
}
ifp = sc->ifp;
- if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
+ if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) {
return;
}
@@ -178,11 +178,11 @@
for (;;) {
if (!vq_has_descs(vq)) {
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+ if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
break;
}
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ m = if_dequeue(ifp);
if (m == NULL) {
break;
}
@@ -230,9 +230,9 @@
}
static void
-vtbe_txstart(struct ifnet *ifp)
+vtbe_txstart(if_t ifp)
{
- struct vtbe_softc *sc = ifp->if_softc;
+ struct vtbe_softc *sc = if_getsoftc(ifp);
VTBE_LOCK(sc);
vtbe_txstart_locked(sc);
@@ -242,25 +242,25 @@
static void
vtbe_stop_locked(struct vtbe_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
VTBE_ASSERT_LOCKED(sc);
ifp = sc->ifp;
- ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+ if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
}
static void
vtbe_init_locked(struct vtbe_softc *sc)
{
- struct ifnet *ifp = sc->ifp;
+ if_t ifp = sc->ifp;
VTBE_ASSERT_LOCKED(sc);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
return;
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
}
static void
@@ -274,34 +274,34 @@
}
static int
-vtbe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+vtbe_ioctl(if_t ifp, u_long cmd, caddr_t data)
{
struct ifmediareq *ifmr;
struct vtbe_softc *sc;
struct ifreq *ifr;
int mask, error;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
ifr = (struct ifreq *)data;
error = 0;
switch (cmd) {
case SIOCSIFFLAGS:
VTBE_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
+ if (if_getflags(ifp) & IFF_UP) {
pio_enable_irq(sc, 1);
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+ if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
vtbe_init_locked(sc);
}
} else {
pio_enable_irq(sc, 0);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
vtbe_stop_locked(sc);
}
}
- sc->if_flags = ifp->if_flags;
+ sc->if_flags = if_getflags(ifp);
VTBE_UNLOCK(sc);
break;
case SIOCADDMULTI:
@@ -316,9 +316,9 @@
ifmr->ifm_current = ifmr->ifm_active;
break;
case SIOCSIFCAP:
- mask = ifp->if_capenable ^ ifr->ifr_reqcap;
+ mask = if_getcapenable(ifp) ^ ifr->ifr_reqcap;
if (mask & IFCAP_VLAN_MTU) {
- ifp->if_capenable ^= IFCAP_VLAN_MTU;
+ if_togglecapenable(ifp, IFCAP_VLAN_MTU);
}
break;
@@ -335,7 +335,7 @@
static void
vtbe_txfinish_locked(struct vtbe_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
VTBE_ASSERT_LOCKED(sc);
@@ -388,7 +388,7 @@
{
struct iovec iov[DESC_COUNT];
struct iovec *tiov;
- struct ifnet *ifp;
+ if_t ifp;
struct uio uio;
struct mbuf *m;
int iolen;
@@ -426,9 +426,9 @@
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
- CURVNET_SET(ifp->if_vnet);
+ CURVNET_SET(if_getvnet(ifp));
VTBE_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
+ if_input(ifp, m);
VTBE_LOCK(sc);
CURVNET_RESTORE();
@@ -563,7 +563,7 @@
{
uint8_t macaddr[ETHER_ADDR_LEN];
struct vtbe_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int reg;
sc = device_get_softc(dev);
@@ -613,20 +613,19 @@
/* Set up the ethernet interface. */
sc->ifp = ifp = if_alloc(IFT_ETHER);
- ifp->if_baudrate = IF_Gbps(10);
- ifp->if_softc = sc;
+ if_setbaudrate(ifp, IF_Gbps(10));
+ if_setsoftc(ifp, sc);
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX |
+ if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX |
IFF_MULTICAST | IFF_PROMISC);
- ifp->if_capabilities = IFCAP_VLAN_MTU;
- ifp->if_capenable = ifp->if_capabilities;
- ifp->if_start = vtbe_txstart;
- ifp->if_ioctl = vtbe_ioctl;
- ifp->if_init = vtbe_init;
- IFQ_SET_MAXLEN(&ifp->if_snd, DESC_COUNT - 1);
- ifp->if_snd.ifq_drv_maxlen = DESC_COUNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
- ifp->if_hdrlen = sizeof(struct ether_vlan_header);
+ if_setcapabilities(ifp, IFCAP_VLAN_MTU);
+ if_setcapenable(ifp, if_getcapabilities(ifp));
+ if_setstartfn(ifp, vtbe_txstart);
+ if_setioctlfn(ifp, vtbe_ioctl);
+ if_setinitfn(ifp, vtbe_init);
+ if_setsendqlen(ifp, DESC_COUNT - 1);
+ if_setsendqready(ifp);
+ if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
/* All ready to run, attach the ethernet interface. */
ether_ifattach(ifp, macaddr);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 4:13 AM (4 h, 58 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28312398
Default Alt Text
D37844.1775794404.diff (4 KB)
Attached To
Mode
D37844: Mechanically convert vtbe(4) to DrvAPI
Attached
Detach File
Event Timeline
Log In to Comment