Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/xen/netfront/netfront.c
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||||||||
| static void xn_release_rx_bufs(struct netfront_rxq *); | static void xn_release_rx_bufs(struct netfront_rxq *); | ||||||||||
| static void xn_release_tx_bufs(struct netfront_txq *); | static void xn_release_tx_bufs(struct netfront_txq *); | ||||||||||
| static void xn_rxq_intr(struct netfront_rxq *); | static void xn_rxq_intr(struct netfront_rxq *); | ||||||||||
| static void xn_txq_intr(struct netfront_txq *); | static void xn_txq_intr(struct netfront_txq *); | ||||||||||
| static void xn_intr(void *); | static void xn_intr(void *); | ||||||||||
| static int xn_assemble_tx_request(struct netfront_txq *, struct mbuf *); | static int xn_assemble_tx_request(struct netfront_txq *, struct mbuf *); | ||||||||||
| static int xn_ioctl(struct ifnet *, u_long, caddr_t); | static int xn_ioctl(if_t, u_long, caddr_t); | ||||||||||
| static void xn_ifinit_locked(struct netfront_info *); | static void xn_ifinit_locked(struct netfront_info *); | ||||||||||
| static void xn_ifinit(void *); | static void xn_ifinit(void *); | ||||||||||
| static void xn_stop(struct netfront_info *); | static void xn_stop(struct netfront_info *); | ||||||||||
| static void xn_query_features(struct netfront_info *np); | static void xn_query_features(struct netfront_info *np); | ||||||||||
| static int xn_configure_features(struct netfront_info *np); | static int xn_configure_features(struct netfront_info *np); | ||||||||||
| static void netif_free(struct netfront_info *info); | static void netif_free(struct netfront_info *info); | ||||||||||
| static int netfront_detach(device_t dev); | static int netfront_detach(device_t dev); | ||||||||||
| static int xn_txq_mq_start_locked(struct netfront_txq *, struct mbuf *); | static int xn_txq_mq_start_locked(struct netfront_txq *, struct mbuf *); | ||||||||||
| static int xn_txq_mq_start(struct ifnet *, struct mbuf *); | static int xn_txq_mq_start(if_t, struct mbuf *); | ||||||||||
| static int talk_to_backend(device_t dev, struct netfront_info *info); | static int talk_to_backend(device_t dev, struct netfront_info *info); | ||||||||||
| static int create_netdev(device_t dev); | static int create_netdev(device_t dev); | ||||||||||
| static void netif_disconnect_backend(struct netfront_info *info); | static void netif_disconnect_backend(struct netfront_info *info); | ||||||||||
| static int setup_device(device_t dev, struct netfront_info *info, | static int setup_device(device_t dev, struct netfront_info *info, | ||||||||||
| unsigned long); | unsigned long); | ||||||||||
| static int xn_ifmedia_upd(struct ifnet *ifp); | static int xn_ifmedia_upd(if_t ifp); | ||||||||||
| static void xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); | static void xn_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr); | ||||||||||
| static int xn_connect(struct netfront_info *); | static int xn_connect(struct netfront_info *); | ||||||||||
| static void xn_kick_rings(struct netfront_info *); | static void xn_kick_rings(struct netfront_info *); | ||||||||||
| static int xn_get_responses(struct netfront_rxq *, | static int xn_get_responses(struct netfront_rxq *, | ||||||||||
| struct netfront_rx_info *, RING_IDX, RING_IDX *, | struct netfront_rx_info *, RING_IDX, RING_IDX *, | ||||||||||
| struct mbuf **); | struct mbuf **); | ||||||||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | struct mbuf_xennet { | ||||||||||
| u_int count; | u_int count; | ||||||||||
| } xennet_tag[NET_TX_RING_SIZE + 1]; | } xennet_tag[NET_TX_RING_SIZE + 1]; | ||||||||||
| SLIST_HEAD(, mbuf_xennet) tags; | SLIST_HEAD(, mbuf_xennet) tags; | ||||||||||
| bool full; | bool full; | ||||||||||
| }; | }; | ||||||||||
| struct netfront_info { | struct netfront_info { | ||||||||||
| struct ifnet *xn_ifp; | if_t xn_ifp; | ||||||||||
ehem_freebsd_m5p.com: Another spacing change. | |||||||||||
| struct mtx sc_lock; | struct mtx sc_lock; | ||||||||||
| u_int num_queues; | u_int num_queues; | ||||||||||
| struct netfront_rxq *rxq; | struct netfront_rxq *rxq; | ||||||||||
| struct netfront_txq *txq; | struct netfront_txq *txq; | ||||||||||
| u_int carrier; | u_int carrier; | ||||||||||
| ▲ Show 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | if (err != 0) { | ||||||||||
| message = "writing feature-rx-notify"; | message = "writing feature-rx-notify"; | ||||||||||
| goto abort_transaction; | goto abort_transaction; | ||||||||||
| } | } | ||||||||||
| err = xs_printf(xst, node, "feature-sg", "%d", 1); | err = xs_printf(xst, node, "feature-sg", "%d", 1); | ||||||||||
| if (err != 0) { | if (err != 0) { | ||||||||||
| message = "writing feature-sg"; | message = "writing feature-sg"; | ||||||||||
| goto abort_transaction; | goto abort_transaction; | ||||||||||
| } | } | ||||||||||
| if ((info->xn_ifp->if_capenable & IFCAP_LRO) != 0) { | if ((if_getcapenable(info->xn_ifp) & IFCAP_LRO) != 0) { | ||||||||||
| err = xs_printf(xst, node, "feature-gso-tcpv4", "%d", 1); | err = xs_printf(xst, node, "feature-gso-tcpv4", "%d", 1); | ||||||||||
| if (err != 0) { | if (err != 0) { | ||||||||||
| message = "writing feature-gso-tcpv4"; | message = "writing feature-gso-tcpv4"; | ||||||||||
| goto abort_transaction; | goto abort_transaction; | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| if ((info->xn_ifp->if_capenable & IFCAP_RXCSUM) == 0) { | if ((if_getcapenable(info->xn_ifp) & IFCAP_RXCSUM) == 0) { | ||||||||||
| err = xs_printf(xst, node, "feature-no-csum-offload", "%d", 1); | err = xs_printf(xst, node, "feature-no-csum-offload", "%d", 1); | ||||||||||
| if (err != 0) { | if (err != 0) { | ||||||||||
| message = "writing feature-no-csum-offload"; | message = "writing feature-no-csum-offload"; | ||||||||||
| goto abort_transaction; | goto abort_transaction; | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| err = xs_transaction_end(xst, 0); | err = xs_transaction_end(xst, 0); | ||||||||||
| Show All 24 Lines | xn_rxq_intr(struct netfront_rxq *rxq) | ||||||||||
| xn_rxeof(rxq); | xn_rxeof(rxq); | ||||||||||
| XN_RX_UNLOCK(rxq); | XN_RX_UNLOCK(rxq); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_txq_start(struct netfront_txq *txq) | xn_txq_start(struct netfront_txq *txq) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np = txq->info; | struct netfront_info *np = txq->info; | ||||||||||
| struct ifnet *ifp = np->xn_ifp; | if_t ifp = np->xn_ifp; | ||||||||||
| XN_TX_LOCK_ASSERT(txq); | XN_TX_LOCK_ASSERT(txq); | ||||||||||
| if (!drbr_empty(ifp, txq->br)) | if (!drbr_empty(ifp, txq->br)) | ||||||||||
| xn_txq_mq_start_locked(txq, NULL); | xn_txq_mq_start_locked(txq, NULL); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_txq_intr(struct netfront_txq *txq) | xn_txq_intr(struct netfront_txq *txq) | ||||||||||
| ▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | setup_device(device_t dev, struct netfront_info *info, | ||||||||||
| return (0); | return (0); | ||||||||||
| out: | out: | ||||||||||
| KASSERT(error != 0, ("Error path taken without providing an error code")); | KASSERT(error != 0, ("Error path taken without providing an error code")); | ||||||||||
| return (error); | return (error); | ||||||||||
| } | } | ||||||||||
| #ifdef INET | #ifdef INET | ||||||||||
| static u_int | |||||||||||
| netfront_addr_cb(void *arg, struct ifaddr *a, u_int count) | |||||||||||
| { | |||||||||||
| arp_ifinit((if_t)arg, a); | |||||||||||
| return (1); | |||||||||||
| } | |||||||||||
| /** | /** | ||||||||||
| * If this interface has an ipv4 address, send an arp for it. This | * If this interface has an ipv4 address, send an arp for it. This | ||||||||||
| * helps to get the network going again after migrating hosts. | * helps to get the network going again after migrating hosts. | ||||||||||
| */ | */ | ||||||||||
| static void | static void | ||||||||||
| netfront_send_fake_arp(device_t dev, struct netfront_info *info) | netfront_send_fake_arp(device_t dev, struct netfront_info *info) | ||||||||||
| { | { | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| struct ifaddr *ifa; | |||||||||||
| ifp = info->xn_ifp; | ifp = info->xn_ifp; | ||||||||||
| CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { | if_foreach_addr_type(ifp, AF_INET, netfront_addr_cb, ifp); | ||||||||||
| if (ifa->ifa_addr->sa_family == AF_INET) { | |||||||||||
| arp_ifinit(ifp, ifa); | |||||||||||
| } | } | ||||||||||
| } | |||||||||||
| } | |||||||||||
| #endif | #endif | ||||||||||
| /** | /** | ||||||||||
| * Callback received when the backend's state changes. | * Callback received when the backend's state changes. | ||||||||||
| */ | */ | ||||||||||
| static void | static void | ||||||||||
| netfront_backend_changed(device_t dev, XenbusState newstate) | netfront_backend_changed(device_t dev, XenbusState newstate) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *sc = device_get_softc(dev); | struct netfront_info *sc = device_get_softc(dev); | ||||||||||
| DPRINTK("newstate=%d\n", newstate); | DPRINTK("newstate=%d\n", newstate); | ||||||||||
| CURVNET_SET(sc->xn_ifp->if_vnet); | CURVNET_SET(if_getvnet(sc->xn_ifp)); | ||||||||||
Done Inline Actions
zlei: | |||||||||||
| switch (newstate) { | switch (newstate) { | ||||||||||
| case XenbusStateInitialising: | case XenbusStateInitialising: | ||||||||||
| case XenbusStateInitialised: | case XenbusStateInitialised: | ||||||||||
| case XenbusStateUnknown: | case XenbusStateUnknown: | ||||||||||
| case XenbusStateReconfigured: | case XenbusStateReconfigured: | ||||||||||
| case XenbusStateReconfiguring: | case XenbusStateReconfiguring: | ||||||||||
| break; | break; | ||||||||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | for (i = 0; i < NET_RX_RING_SIZE; i++) { | ||||||||||
| rxq->grant_ref[i] = GRANT_REF_INVALID; | rxq->grant_ref[i] = GRANT_REF_INVALID; | ||||||||||
| m_freem(m); | m_freem(m); | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_rxeof(struct netfront_rxq *rxq) | xn_rxeof(struct netfront_rxq *rxq) | ||||||||||
| { | { | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| struct netfront_info *np = rxq->info; | struct netfront_info *np = rxq->info; | ||||||||||
| #if (defined(INET) || defined(INET6)) | #if (defined(INET) || defined(INET6)) | ||||||||||
| struct lro_ctrl *lro = &rxq->lro; | struct lro_ctrl *lro = &rxq->lro; | ||||||||||
| #endif | #endif | ||||||||||
| struct netfront_rx_info rinfo; | struct netfront_rx_info rinfo; | ||||||||||
| struct netif_rx_response *rx = &rinfo.rx; | struct netif_rx_response *rx = &rinfo.rx; | ||||||||||
| struct netif_extra_info *extras = rinfo.extras; | struct netif_extra_info *extras = rinfo.extras; | ||||||||||
| RING_IDX i, rp; | RING_IDX i, rp; | ||||||||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | #endif | ||||||||||
| /* | /* | ||||||||||
| * Process all the mbufs after the remapping is complete. | * Process all the mbufs after the remapping is complete. | ||||||||||
| * Break the mbuf chain first though. | * Break the mbuf chain first though. | ||||||||||
| */ | */ | ||||||||||
| while ((m = mbufq_dequeue(&mbufq_rxq)) != NULL) { | while ((m = mbufq_dequeue(&mbufq_rxq)) != NULL) { | ||||||||||
| if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); | if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); | ||||||||||
| #if (defined(INET) || defined(INET6)) | #if (defined(INET) || defined(INET6)) | ||||||||||
| /* Use LRO if possible */ | /* Use LRO if possible */ | ||||||||||
| if ((ifp->if_capenable & IFCAP_LRO) == 0 || | if ((if_getcapenable(ifp) & IFCAP_LRO) == 0 || | ||||||||||
| lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { | lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { | ||||||||||
| /* | /* | ||||||||||
| * If LRO fails, pass up to the stack | * If LRO fails, pass up to the stack | ||||||||||
| * directly. | * directly. | ||||||||||
| */ | */ | ||||||||||
| (*ifp->if_input)(ifp, m); | if_input(ifp, m); | ||||||||||
| } | } | ||||||||||
| #else | #else | ||||||||||
| (*ifp->if_input)(ifp, m); | if_input(ifp, m); | ||||||||||
| #endif | #endif | ||||||||||
| } | } | ||||||||||
| #if (defined(INET) || defined(INET6)) | #if (defined(INET) || defined(INET6)) | ||||||||||
| /* | /* | ||||||||||
| * Flush any outstanding LRO work | * Flush any outstanding LRO work | ||||||||||
| */ | */ | ||||||||||
| tcp_lro_flush_all(lro); | tcp_lro_flush_all(lro); | ||||||||||
| #endif | #endif | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_txeof(struct netfront_txq *txq) | xn_txeof(struct netfront_txq *txq) | ||||||||||
| { | { | ||||||||||
| RING_IDX i, prod; | RING_IDX i, prod; | ||||||||||
| unsigned short id; | unsigned short id; | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| netif_tx_response_t *txr; | netif_tx_response_t *txr; | ||||||||||
| struct mbuf *m; | struct mbuf *m; | ||||||||||
| struct netfront_info *np = txq->info; | struct netfront_info *np = txq->info; | ||||||||||
| XN_TX_LOCK_ASSERT(txq); | XN_TX_LOCK_ASSERT(txq); | ||||||||||
| if (!netfront_carrier_ok(np)) | if (!netfront_carrier_ok(np)) | ||||||||||
| return; | return; | ||||||||||
| Show All 31 Lines | for (i = txq->ring.rsp_cons; i != prod; i++) { | ||||||||||
| &txq->gref_head, txq->grant_ref[id]); | &txq->gref_head, txq->grant_ref[id]); | ||||||||||
| txq->grant_ref[id] = GRANT_REF_INVALID; | txq->grant_ref[id] = GRANT_REF_INVALID; | ||||||||||
| txq->mbufs[id] = NULL; | txq->mbufs[id] = NULL; | ||||||||||
| add_id_to_freelist(txq->mbufs, id); | add_id_to_freelist(txq->mbufs, id); | ||||||||||
| txq->mbufs_cnt--; | txq->mbufs_cnt--; | ||||||||||
| mbuf_release(m); | mbuf_release(m); | ||||||||||
| /* Only mark the txq active if we've freed up at least one slot to try */ | /* Only mark the txq active if we've freed up at least one slot to try */ | ||||||||||
| ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; | if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); | ||||||||||
| } | } | ||||||||||
| txq->ring.rsp_cons = prod; | txq->ring.rsp_cons = prod; | ||||||||||
| /* | /* | ||||||||||
| * Set a new event, then check for race with update of | * Set a new event, then check for race with update of | ||||||||||
| * tx_cons. Note that it is essential to schedule a | * tx_cons. Note that it is essential to schedule a | ||||||||||
| * callback, no matter how few buffers are pending. Even if | * callback, no matter how few buffers are pending. Even if | ||||||||||
| * there is space in the transmit ring, higher layers may | * there is space in the transmit ring, higher layers may | ||||||||||
| ▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | |||||||||||
| /** | /** | ||||||||||
| * Given an mbuf chain, make sure we have enough room and then push | * Given an mbuf chain, make sure we have enough room and then push | ||||||||||
| * it onto the transmit ring. | * it onto the transmit ring. | ||||||||||
| */ | */ | ||||||||||
| static int | static int | ||||||||||
| xn_assemble_tx_request(struct netfront_txq *txq, struct mbuf *m_head) | xn_assemble_tx_request(struct netfront_txq *txq, struct mbuf *m_head) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np = txq->info; | struct netfront_info *np = txq->info; | ||||||||||
| struct ifnet *ifp = np->xn_ifp; | if_t ifp = np->xn_ifp; | ||||||||||
| int otherend_id, error, nfrags; | int otherend_id, error, nfrags; | ||||||||||
| bus_dma_segment_t *segs = txq->segs; | bus_dma_segment_t *segs = txq->segs; | ||||||||||
| struct mbuf_xennet *tag; | struct mbuf_xennet *tag; | ||||||||||
| bus_dmamap_t map; | bus_dmamap_t map; | ||||||||||
| unsigned int i; | unsigned int i; | ||||||||||
| KASSERT(!SLIST_EMPTY(&txq->tags), ("no tags available")); | KASSERT(!SLIST_EMPTY(&txq->tags), ("no tags available")); | ||||||||||
| tag = SLIST_FIRST(&txq->tags); | tag = SLIST_FIRST(&txq->tags); | ||||||||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | #endif | ||||||||||
| return (0); | return (0); | ||||||||||
| } | } | ||||||||||
| /* equivalent of network_open() in Linux */ | /* equivalent of network_open() in Linux */ | ||||||||||
| static void | static void | ||||||||||
| xn_ifinit_locked(struct netfront_info *np) | xn_ifinit_locked(struct netfront_info *np) | ||||||||||
| { | { | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| int i; | int i; | ||||||||||
| struct netfront_rxq *rxq; | struct netfront_rxq *rxq; | ||||||||||
| XN_LOCK_ASSERT(np); | XN_LOCK_ASSERT(np); | ||||||||||
| ifp = np->xn_ifp; | ifp = np->xn_ifp; | ||||||||||
| if (ifp->if_drv_flags & IFF_DRV_RUNNING || !netfront_carrier_ok(np)) | if (if_getdrvflags(ifp) & IFF_DRV_RUNNING || !netfront_carrier_ok(np)) | ||||||||||
| return; | return; | ||||||||||
| xn_stop(np); | xn_stop(np); | ||||||||||
| for (i = 0; i < np->num_queues; i++) { | for (i = 0; i < np->num_queues; i++) { | ||||||||||
| rxq = &np->rxq[i]; | rxq = &np->rxq[i]; | ||||||||||
| XN_RX_LOCK(rxq); | XN_RX_LOCK(rxq); | ||||||||||
| xn_alloc_rx_buffers(rxq); | xn_alloc_rx_buffers(rxq); | ||||||||||
| rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1; | rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1; | ||||||||||
| if (RING_HAS_UNCONSUMED_RESPONSES(&rxq->ring)) | if (RING_HAS_UNCONSUMED_RESPONSES(&rxq->ring)) | ||||||||||
| xn_rxeof(rxq); | xn_rxeof(rxq); | ||||||||||
| XN_RX_UNLOCK(rxq); | XN_RX_UNLOCK(rxq); | ||||||||||
| } | } | ||||||||||
| ifp->if_drv_flags |= IFF_DRV_RUNNING; | if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0); | ||||||||||
| ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; | if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); | ||||||||||
| if_link_state_change(ifp, LINK_STATE_UP); | if_link_state_change(ifp, LINK_STATE_UP); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_ifinit(void *xsc) | xn_ifinit(void *xsc) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *sc = xsc; | struct netfront_info *sc = xsc; | ||||||||||
| XN_LOCK(sc); | XN_LOCK(sc); | ||||||||||
| xn_ifinit_locked(sc); | xn_ifinit_locked(sc); | ||||||||||
| XN_UNLOCK(sc); | XN_UNLOCK(sc); | ||||||||||
| } | } | ||||||||||
| static int | static int | ||||||||||
| xn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) | xn_ioctl(if_t ifp, u_long cmd, caddr_t data) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *sc = ifp->if_softc; | struct netfront_info *sc = if_getsoftc(ifp); | ||||||||||
| struct ifreq *ifr = (struct ifreq *) data; | struct ifreq *ifr = (struct ifreq *) data; | ||||||||||
| device_t dev; | device_t dev; | ||||||||||
| #ifdef INET | #ifdef INET | ||||||||||
| struct ifaddr *ifa = (struct ifaddr *)data; | struct ifaddr *ifa = (struct ifaddr *)data; | ||||||||||
| #endif | #endif | ||||||||||
| int mask, error = 0, reinit; | int mask, error = 0, reinit; | ||||||||||
| dev = sc->xbdev; | dev = sc->xbdev; | ||||||||||
| switch(cmd) { | switch(cmd) { | ||||||||||
| case SIOCSIFADDR: | case SIOCSIFADDR: | ||||||||||
| #ifdef INET | #ifdef INET | ||||||||||
| XN_LOCK(sc); | XN_LOCK(sc); | ||||||||||
| if (ifa->ifa_addr->sa_family == AF_INET) { | if (ifa->ifa_addr->sa_family == AF_INET) { | ||||||||||
| ifp->if_flags |= IFF_UP; | if_setflagbits(ifp, IFF_UP, 0); | ||||||||||
| if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) | if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) | ||||||||||
| xn_ifinit_locked(sc); | xn_ifinit_locked(sc); | ||||||||||
| arp_ifinit(ifp, ifa); | arp_ifinit(ifp, ifa); | ||||||||||
| XN_UNLOCK(sc); | XN_UNLOCK(sc); | ||||||||||
| } else { | } else { | ||||||||||
| XN_UNLOCK(sc); | XN_UNLOCK(sc); | ||||||||||
| #endif | #endif | ||||||||||
| error = ether_ioctl(ifp, cmd, data); | error = ether_ioctl(ifp, cmd, data); | ||||||||||
| #ifdef INET | #ifdef INET | ||||||||||
| } | } | ||||||||||
| #endif | #endif | ||||||||||
| break; | break; | ||||||||||
| case SIOCSIFMTU: | case SIOCSIFMTU: | ||||||||||
| if (ifp->if_mtu == ifr->ifr_mtu) | if (if_getmtu(ifp) == ifr->ifr_mtu) | ||||||||||
| break; | break; | ||||||||||
| ifp->if_mtu = ifr->ifr_mtu; | if_setmtu(ifp, ifr->ifr_mtu); | ||||||||||
| ifp->if_drv_flags &= ~IFF_DRV_RUNNING; | if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING); | ||||||||||
| xn_ifinit(sc); | xn_ifinit(sc); | ||||||||||
| break; | break; | ||||||||||
| case SIOCSIFFLAGS: | case SIOCSIFFLAGS: | ||||||||||
| XN_LOCK(sc); | XN_LOCK(sc); | ||||||||||
| if (ifp->if_flags & IFF_UP) { | if (if_getflags(ifp) & IFF_UP) { | ||||||||||
| /* | /* | ||||||||||
| * If only the state of the PROMISC flag changed, | * If only the state of the PROMISC flag changed, | ||||||||||
| * then just use the 'set promisc mode' command | * then just use the 'set promisc mode' command | ||||||||||
| * instead of reinitializing the entire NIC. Doing | * instead of reinitializing the entire NIC. Doing | ||||||||||
| * a full re-init means reloading the firmware and | * a full re-init means reloading the firmware and | ||||||||||
| * waiting for it to start up, which may take a | * waiting for it to start up, which may take a | ||||||||||
| * second or two. | * second or two. | ||||||||||
| */ | */ | ||||||||||
| xn_ifinit_locked(sc); | xn_ifinit_locked(sc); | ||||||||||
| } else { | } else { | ||||||||||
| if (ifp->if_drv_flags & IFF_DRV_RUNNING) { | if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { | ||||||||||
| xn_stop(sc); | xn_stop(sc); | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| sc->xn_if_flags = ifp->if_flags; | sc->xn_if_flags = if_getflags(ifp); | ||||||||||
| XN_UNLOCK(sc); | XN_UNLOCK(sc); | ||||||||||
| break; | break; | ||||||||||
| case SIOCSIFCAP: | case SIOCSIFCAP: | ||||||||||
| mask = ifr->ifr_reqcap ^ ifp->if_capenable; | mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); | ||||||||||
| reinit = 0; | reinit = 0; | ||||||||||
| if (mask & IFCAP_TXCSUM) { | if (mask & IFCAP_TXCSUM) { | ||||||||||
| ifp->if_capenable ^= IFCAP_TXCSUM; | if_togglecapenable(ifp, IFCAP_TXCSUM); | ||||||||||
| ifp->if_hwassist ^= XN_CSUM_FEATURES; | if_togglehwassist(ifp, XN_CSUM_FEATURES); | ||||||||||
| } | } | ||||||||||
| if (mask & IFCAP_TSO4) { | if (mask & IFCAP_TSO4) { | ||||||||||
| ifp->if_capenable ^= IFCAP_TSO4; | if_togglecapenable(ifp, IFCAP_TSO4); | ||||||||||
| ifp->if_hwassist ^= CSUM_TSO; | if_togglehwassist(ifp, CSUM_TSO); | ||||||||||
| } | } | ||||||||||
| if (mask & (IFCAP_RXCSUM | IFCAP_LRO)) { | if (mask & (IFCAP_RXCSUM | IFCAP_LRO)) { | ||||||||||
| /* These Rx features require us to renegotiate. */ | /* These Rx features require us to renegotiate. */ | ||||||||||
| reinit = 1; | reinit = 1; | ||||||||||
| if (mask & IFCAP_RXCSUM) | if (mask & IFCAP_RXCSUM) | ||||||||||
| ifp->if_capenable ^= IFCAP_RXCSUM; | if_togglecapenable(ifp, IFCAP_RXCSUM); | ||||||||||
| if (mask & IFCAP_LRO) | if (mask & IFCAP_LRO) | ||||||||||
| ifp->if_capenable ^= IFCAP_LRO; | if_togglecapenable(ifp, IFCAP_LRO); | ||||||||||
| } | } | ||||||||||
| if (reinit == 0) | if (reinit == 0) | ||||||||||
| break; | break; | ||||||||||
| /* | /* | ||||||||||
| * We must reset the interface so the backend picks up the | * We must reset the interface so the backend picks up the | ||||||||||
| * new features. | * new features. | ||||||||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | #endif | ||||||||||
| } | } | ||||||||||
| return (error); | return (error); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_stop(struct netfront_info *sc) | xn_stop(struct netfront_info *sc) | ||||||||||
| { | { | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| XN_LOCK_ASSERT(sc); | XN_LOCK_ASSERT(sc); | ||||||||||
| ifp = sc->xn_ifp; | ifp = sc->xn_ifp; | ||||||||||
| ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); | if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE); | ||||||||||
| if_link_state_change(ifp, LINK_STATE_DOWN); | if_link_state_change(ifp, LINK_STATE_DOWN); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_rebuild_rx_bufs(struct netfront_rxq *rxq) | xn_rebuild_rx_bufs(struct netfront_rxq *rxq) | ||||||||||
| { | { | ||||||||||
| int requeue_idx, i; | int requeue_idx, i; | ||||||||||
| grant_ref_t ref; | grant_ref_t ref; | ||||||||||
| ▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | if (val) { | ||||||||||
| np->maxfrags = MAX_TX_REQ_FRAGS; | np->maxfrags = MAX_TX_REQ_FRAGS; | ||||||||||
| printf(" feature-sg"); | printf(" feature-sg"); | ||||||||||
| } | } | ||||||||||
| if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), | if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), | ||||||||||
| "feature-gso-tcpv4", NULL, "%d", &val) != 0) | "feature-gso-tcpv4", NULL, "%d", &val) != 0) | ||||||||||
| val = 0; | val = 0; | ||||||||||
| np->xn_ifp->if_capabilities &= ~(IFCAP_TSO4|IFCAP_LRO); | if_setcapabilitiesbit(np->xn_ifp, 0, IFCAP_TSO4 | IFCAP_LRO); | ||||||||||
| if (val) { | if (val) { | ||||||||||
| np->xn_ifp->if_capabilities |= IFCAP_TSO4|IFCAP_LRO; | if_setcapabilitiesbit(np->xn_ifp, IFCAP_TSO4 | IFCAP_LRO, 0); | ||||||||||
| printf(" feature-gso-tcp4"); | printf(" feature-gso-tcp4"); | ||||||||||
| } | } | ||||||||||
| /* | /* | ||||||||||
| * HW CSUM offload is assumed to be available unless | * HW CSUM offload is assumed to be available unless | ||||||||||
| * feature-no-csum-offload is set in xenstore. | * feature-no-csum-offload is set in xenstore. | ||||||||||
| */ | */ | ||||||||||
| if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), | if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), | ||||||||||
| "feature-no-csum-offload", NULL, "%d", &val) != 0) | "feature-no-csum-offload", NULL, "%d", &val) != 0) | ||||||||||
| val = 0; | val = 0; | ||||||||||
| np->xn_ifp->if_capabilities |= IFCAP_HWCSUM; | if_setcapabilitiesbit(np->xn_ifp, IFCAP_HWCSUM, 0); | ||||||||||
| if (val) { | if (val) { | ||||||||||
| np->xn_ifp->if_capabilities &= ~(IFCAP_HWCSUM); | if_setcapabilitiesbit(np->xn_ifp, 0, IFCAP_HWCSUM); | ||||||||||
Done Inline Actions
No need for parenthesis zlei: No need for parenthesis | |||||||||||
| printf(" feature-no-csum-offload"); | printf(" feature-no-csum-offload"); | ||||||||||
| } | } | ||||||||||
| printf("\n"); | printf("\n"); | ||||||||||
| } | } | ||||||||||
| static int | static int | ||||||||||
| xn_configure_features(struct netfront_info *np) | xn_configure_features(struct netfront_info *np) | ||||||||||
| { | { | ||||||||||
| int err, cap_enabled; | int err, cap_enabled; | ||||||||||
| #if (defined(INET) || defined(INET6)) | #if (defined(INET) || defined(INET6)) | ||||||||||
| int i; | int i; | ||||||||||
| #endif | #endif | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| ifp = np->xn_ifp; | ifp = np->xn_ifp; | ||||||||||
| err = 0; | err = 0; | ||||||||||
| if ((ifp->if_capenable & ifp->if_capabilities) == ifp->if_capenable) { | if ((if_getcapenable(ifp) & if_getcapabilities(ifp)) == if_getcapenable(ifp)) { | ||||||||||
| /* Current options are available, no need to do anything. */ | /* Current options are available, no need to do anything. */ | ||||||||||
| return (0); | return (0); | ||||||||||
| } | } | ||||||||||
| /* Try to preserve as many options as possible. */ | /* Try to preserve as many options as possible. */ | ||||||||||
| cap_enabled = ifp->if_capenable; | cap_enabled = if_getcapenable(ifp); | ||||||||||
| ifp->if_capenable = ifp->if_hwassist = 0; | if_setcapenable(ifp, 0); | ||||||||||
Done Inline Actions
This is wrong. zlei: This is wrong. | |||||||||||
Done Inline ActionsI concur. Though this looks weird, "Try to preserve as many options as possible." yet it appears to be clearing everything. ehem_freebsd_m5p.com: I concur. Though this looks weird, "Try to preserve as many options as possible." yet it… | |||||||||||
Done Inline ActionsYeah, this is very obviously wrong. It looks like the awk script got confused. @ehem_freebsd_m5p.com the "Try to preserve" comment relates to the cap_enabled saving, before it clears everything. The wrong bit is the if_gethwassist() bit, which, that line needs deleted. jhibbits: Yeah, this is very obviously wrong. It looks like the awk script got confused. | |||||||||||
| if_sethwassist(ifp, 0); | |||||||||||
| #if (defined(INET) || defined(INET6)) | #if (defined(INET) || defined(INET6)) | ||||||||||
| if ((cap_enabled & IFCAP_LRO) != 0) | if ((cap_enabled & IFCAP_LRO) != 0) | ||||||||||
| for (i = 0; i < np->num_queues; i++) | for (i = 0; i < np->num_queues; i++) | ||||||||||
| tcp_lro_free(&np->rxq[i].lro); | tcp_lro_free(&np->rxq[i].lro); | ||||||||||
| if (xn_enable_lro && | if (xn_enable_lro && | ||||||||||
| (ifp->if_capabilities & cap_enabled & IFCAP_LRO) != 0) { | (if_getcapabilities(ifp) & cap_enabled & IFCAP_LRO) != 0) { | ||||||||||
| ifp->if_capenable |= IFCAP_LRO; | if_setcapenablebit(ifp, IFCAP_LRO, 0); | ||||||||||
| for (i = 0; i < np->num_queues; i++) { | for (i = 0; i < np->num_queues; i++) { | ||||||||||
| err = tcp_lro_init(&np->rxq[i].lro); | err = tcp_lro_init(&np->rxq[i].lro); | ||||||||||
| if (err != 0) { | if (err != 0) { | ||||||||||
| device_printf(np->xbdev, | device_printf(np->xbdev, | ||||||||||
| "LRO initialization failed\n"); | "LRO initialization failed\n"); | ||||||||||
| ifp->if_capenable &= ~IFCAP_LRO; | if_setcapenablebit(ifp, 0, IFCAP_LRO); | ||||||||||
| break; | break; | ||||||||||
| } | } | ||||||||||
| np->rxq[i].lro.ifp = ifp; | np->rxq[i].lro.ifp = ifp; | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| if ((ifp->if_capabilities & cap_enabled & IFCAP_TSO4) != 0) { | if ((if_getcapabilities(ifp) & cap_enabled & IFCAP_TSO4) != 0) { | ||||||||||
| ifp->if_capenable |= IFCAP_TSO4; | if_setcapenablebit(ifp, IFCAP_TSO4, 0); | ||||||||||
| ifp->if_hwassist |= CSUM_TSO; | if_sethwassistbits(ifp, CSUM_TSO, 0); | ||||||||||
| } | } | ||||||||||
| #endif | #endif | ||||||||||
| if ((ifp->if_capabilities & cap_enabled & IFCAP_TXCSUM) != 0) { | if ((if_getcapabilities(ifp) & cap_enabled & IFCAP_TXCSUM) != 0) { | ||||||||||
| ifp->if_capenable |= IFCAP_TXCSUM; | if_setcapenablebit(ifp, IFCAP_TXCSUM, 0); | ||||||||||
| ifp->if_hwassist |= XN_CSUM_FEATURES; | if_sethwassistbits(ifp, XN_CSUM_FEATURES, 0); | ||||||||||
| } | } | ||||||||||
| if ((ifp->if_capabilities & cap_enabled & IFCAP_RXCSUM) != 0) | if ((if_getcapabilities(ifp) & cap_enabled & IFCAP_RXCSUM) != 0) | ||||||||||
| ifp->if_capenable |= IFCAP_RXCSUM; | if_setcapenablebit(ifp, IFCAP_RXCSUM, 0); | ||||||||||
| return (err); | return (err); | ||||||||||
| } | } | ||||||||||
| static int | static int | ||||||||||
| xn_txq_mq_start_locked(struct netfront_txq *txq, struct mbuf *m) | xn_txq_mq_start_locked(struct netfront_txq *txq, struct mbuf *m) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np; | struct netfront_info *np; | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| struct buf_ring *br; | struct buf_ring *br; | ||||||||||
| int error, notify; | int error, notify; | ||||||||||
| np = txq->info; | np = txq->info; | ||||||||||
| br = txq->br; | br = txq->br; | ||||||||||
| ifp = np->xn_ifp; | ifp = np->xn_ifp; | ||||||||||
| error = 0; | error = 0; | ||||||||||
| XN_TX_LOCK_ASSERT(txq); | XN_TX_LOCK_ASSERT(txq); | ||||||||||
| if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || | ||||||||||
| !netfront_carrier_ok(np)) { | !netfront_carrier_ok(np)) { | ||||||||||
| if (m != NULL) | if (m != NULL) | ||||||||||
| error = drbr_enqueue(ifp, br, m); | error = drbr_enqueue(ifp, br, m); | ||||||||||
| return (error); | return (error); | ||||||||||
| } | } | ||||||||||
| if (m != NULL) { | if (m != NULL) { | ||||||||||
| error = drbr_enqueue(ifp, br, m); | error = drbr_enqueue(ifp, br, m); | ||||||||||
| Show All 23 Lines | xn_txq_mq_start_locked(struct netfront_txq *txq, struct mbuf *m) | ||||||||||
| if (RING_FULL(&txq->ring)) | if (RING_FULL(&txq->ring)) | ||||||||||
| txq->full = true; | txq->full = true; | ||||||||||
| return (0); | return (0); | ||||||||||
| } | } | ||||||||||
| static int | static int | ||||||||||
| xn_txq_mq_start(struct ifnet *ifp, struct mbuf *m) | xn_txq_mq_start(if_t ifp, struct mbuf *m) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np; | struct netfront_info *np; | ||||||||||
| struct netfront_txq *txq; | struct netfront_txq *txq; | ||||||||||
| int i, npairs, error; | int i, npairs, error; | ||||||||||
| np = ifp->if_softc; | np = if_getsoftc(ifp); | ||||||||||
| npairs = np->num_queues; | npairs = np->num_queues; | ||||||||||
| if (!netfront_carrier_ok(np)) | if (!netfront_carrier_ok(np)) | ||||||||||
| return (ENOBUFS); | return (ENOBUFS); | ||||||||||
| KASSERT(npairs != 0, ("called with 0 available queues")); | KASSERT(npairs != 0, ("called with 0 available queues")); | ||||||||||
| /* check if flowid is set */ | /* check if flowid is set */ | ||||||||||
| Show All 11 Lines | if (XN_TX_TRYLOCK(txq) != 0) { | ||||||||||
| error = drbr_enqueue(ifp, txq->br, m); | error = drbr_enqueue(ifp, txq->br, m); | ||||||||||
| taskqueue_enqueue(txq->tq, &txq->defrtask); | taskqueue_enqueue(txq->tq, &txq->defrtask); | ||||||||||
| } | } | ||||||||||
| return (error); | return (error); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_qflush(struct ifnet *ifp) | xn_qflush(if_t ifp) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np; | struct netfront_info *np; | ||||||||||
| struct netfront_txq *txq; | struct netfront_txq *txq; | ||||||||||
| struct mbuf *m; | struct mbuf *m; | ||||||||||
| int i; | int i; | ||||||||||
| np = ifp->if_softc; | np = if_getsoftc(ifp); | ||||||||||
| for (i = 0; i < np->num_queues; i++) { | for (i = 0; i < np->num_queues; i++) { | ||||||||||
| txq = &np->txq[i]; | txq = &np->txq[i]; | ||||||||||
| XN_TX_LOCK(txq); | XN_TX_LOCK(txq); | ||||||||||
| while ((m = buf_ring_dequeue_sc(txq->br)) != NULL) | while ((m = buf_ring_dequeue_sc(txq->br)) != NULL) | ||||||||||
| m_freem(m); | m_freem(m); | ||||||||||
| XN_TX_UNLOCK(txq); | XN_TX_UNLOCK(txq); | ||||||||||
| } | } | ||||||||||
| if_qflush(ifp); | if_qflush(ifp); | ||||||||||
| } | } | ||||||||||
| /** | /** | ||||||||||
| * Create a network device. | * Create a network device. | ||||||||||
| * @param dev Newbus device representing this virtual NIC. | * @param dev Newbus device representing this virtual NIC. | ||||||||||
| */ | */ | ||||||||||
| int | int | ||||||||||
| create_netdev(device_t dev) | create_netdev(device_t dev) | ||||||||||
| { | { | ||||||||||
| struct netfront_info *np; | struct netfront_info *np; | ||||||||||
| int err; | int err; | ||||||||||
| struct ifnet *ifp; | if_t ifp; | ||||||||||
| np = device_get_softc(dev); | np = device_get_softc(dev); | ||||||||||
| np->xbdev = dev; | np->xbdev = dev; | ||||||||||
| mtx_init(&np->sc_lock, "xnsc", "netfront softc lock", MTX_DEF); | mtx_init(&np->sc_lock, "xnsc", "netfront softc lock", MTX_DEF); | ||||||||||
| ifmedia_init(&np->sc_media, 0, xn_ifmedia_upd, xn_ifmedia_sts); | ifmedia_init(&np->sc_media, 0, xn_ifmedia_upd, xn_ifmedia_sts); | ||||||||||
| ifmedia_add(&np->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); | ifmedia_add(&np->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); | ||||||||||
| ifmedia_set(&np->sc_media, IFM_ETHER|IFM_MANUAL); | ifmedia_set(&np->sc_media, IFM_ETHER|IFM_MANUAL); | ||||||||||
| err = xen_net_read_mac(dev, np->mac); | err = xen_net_read_mac(dev, np->mac); | ||||||||||
| if (err != 0) | if (err != 0) | ||||||||||
| goto error; | goto error; | ||||||||||
| /* Set up ifnet structure */ | /* Set up ifnet structure */ | ||||||||||
| ifp = np->xn_ifp = if_alloc(IFT_ETHER); | ifp = np->xn_ifp = if_alloc(IFT_ETHER); | ||||||||||
| ifp->if_softc = np; | if_setsoftc(ifp, np); | ||||||||||
| if_initname(ifp, "xn", device_get_unit(dev)); | if_initname(ifp, "xn", device_get_unit(dev)); | ||||||||||
| ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); | ||||||||||
| ifp->if_ioctl = xn_ioctl; | if_setioctlfn(ifp, xn_ioctl); | ||||||||||
| ifp->if_transmit = xn_txq_mq_start; | if_settransmitfn(ifp, xn_txq_mq_start); | ||||||||||
| ifp->if_qflush = xn_qflush; | if_setqflushfn(ifp, xn_qflush); | ||||||||||
| ifp->if_init = xn_ifinit; | if_setinitfn(ifp, xn_ifinit); | ||||||||||
| ifp->if_hwassist = XN_CSUM_FEATURES; | if_sethwassist(ifp, XN_CSUM_FEATURES); | ||||||||||
| /* Enable all supported features at device creation. */ | /* Enable all supported features at device creation. */ | ||||||||||
| ifp->if_capenable = ifp->if_capabilities = | if_setcapabilities(ifp, IFCAP_HWCSUM|IFCAP_TSO4|IFCAP_LRO); | ||||||||||
| IFCAP_HWCSUM|IFCAP_TSO4|IFCAP_LRO; | if_setcapenable(ifp, if_getcapabilities(ifp)); | ||||||||||
| ifp->if_hw_tsomax = 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); | |||||||||||
| ifp->if_hw_tsomaxsegcount = MAX_TX_REQ_FRAGS; | |||||||||||
| ifp->if_hw_tsomaxsegsize = PAGE_SIZE; | |||||||||||
| if_sethwtsomax(ifp, 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); | |||||||||||
| if_sethwtsomaxsegcount(ifp, MAX_TX_REQ_FRAGS); | |||||||||||
| if_sethwtsomaxsegsize(ifp, PAGE_SIZE); | |||||||||||
| ether_ifattach(ifp, np->mac); | ether_ifattach(ifp, np->mac); | ||||||||||
| netfront_carrier_off(np); | netfront_carrier_off(np); | ||||||||||
| err = bus_dma_tag_create( | err = bus_dma_tag_create( | ||||||||||
| bus_get_dma_tag(dev), /* parent */ | bus_get_dma_tag(dev), /* parent */ | ||||||||||
| 1, PAGE_SIZE, /* algnmnt, boundary */ | 1, PAGE_SIZE, /* algnmnt, boundary */ | ||||||||||
| BUS_SPACE_MAXADDR, /* lowaddr */ | BUS_SPACE_MAXADDR, /* lowaddr */ | ||||||||||
| BUS_SPACE_MAXADDR, /* highaddr */ | BUS_SPACE_MAXADDR, /* highaddr */ | ||||||||||
| NULL, NULL, /* filter, filterarg */ | NULL, NULL, /* filter, filterarg */ | ||||||||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | netif_disconnect_backend(struct netfront_info *np) | ||||||||||
| for (i = 0; i < np->num_queues; i++) { | for (i = 0; i < np->num_queues; i++) { | ||||||||||
| disconnect_rxq(&np->rxq[i]); | disconnect_rxq(&np->rxq[i]); | ||||||||||
| disconnect_txq(&np->txq[i]); | disconnect_txq(&np->txq[i]); | ||||||||||
| } | } | ||||||||||
| } | } | ||||||||||
| static int | static int | ||||||||||
| xn_ifmedia_upd(struct ifnet *ifp) | xn_ifmedia_upd(if_t ifp) | ||||||||||
| { | { | ||||||||||
| return (0); | return (0); | ||||||||||
| } | } | ||||||||||
| static void | static void | ||||||||||
| xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) | xn_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr) | ||||||||||
| { | { | ||||||||||
| ifmr->ifm_status = IFM_AVALID|IFM_ACTIVE; | ifmr->ifm_status = IFM_AVALID|IFM_ACTIVE; | ||||||||||
| ifmr->ifm_active = IFM_ETHER|IFM_MANUAL; | ifmr->ifm_active = IFM_ETHER|IFM_MANUAL; | ||||||||||
| } | } | ||||||||||
| /* ** Driver registration ** */ | /* ** Driver registration ** */ | ||||||||||
| static device_method_t netfront_methods[] = { | static device_method_t netfront_methods[] = { | ||||||||||
| Show All 21 Lines | |||||||||||
Another spacing change.