FreeBSD kernel /amd64 XEN device code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/sockio.h>
#include <sys/limits.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_media.h>
#include <net/bpf.h>
#include <net/if_types.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/if_ether.h>
#include <netinet/tcp.h>
#include <netinet/tcp_lro.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <sys/bus.h>
#include <xen/xen-os.h>
#include <xen/hypervisor.h>
#include <xen/xen_intr.h>
#include <xen/gnttab.h>
#include <contrib/xen/memory.h>
#include <contrib/xen/io/netif.h>
#include <xen/xenbus/xenbusvar.h>
#include "xenbus_if.h"
Go to the source code of this file.
Data Structures | |
struct | netfront_rxq |
struct | netfront_txq |
struct | netfront_info |
struct | netfront_rx_info |
Macros | |
#define | XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) |
#define | NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE) |
#define | NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE) |
#define | NET_RX_SLOTS_MIN (XEN_NETIF_NR_SLOTS_MIN + 1) |
#define | MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) |
The maximum allowed data fragments in a single transmit request. More... | |
#define | RX_COPY_THRESHOLD 256 |
#define | net_ratelimit() 0 |
#define | virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) |
#define | INVALID_P2M_ENTRY (~0UL) |
#define | XN_QUEUE_NAME_LEN 8 /* xn{t,r}x_%u, allow for two digits */ |
#define | XN_RX_LOCK(_q) mtx_lock(&(_q)->lock) |
#define | XN_RX_UNLOCK(_q) mtx_unlock(&(_q)->lock) |
#define | XN_TX_LOCK(_q) mtx_lock(&(_q)->lock) |
#define | XN_TX_TRYLOCK(_q) mtx_trylock(&(_q)->lock) |
#define | XN_TX_UNLOCK(_q) mtx_unlock(&(_q)->lock) |
#define | XN_LOCK(_sc) mtx_lock(&(_sc)->sc_lock); |
#define | XN_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_lock); |
#define | XN_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_lock, MA_OWNED); |
#define | XN_RX_LOCK_ASSERT(_q) mtx_assert(&(_q)->lock, MA_OWNED); |
#define | XN_TX_LOCK_ASSERT(_q) mtx_assert(&(_q)->lock, MA_OWNED); |
#define | netfront_carrier_on(netif) ((netif)->carrier = 1) |
#define | netfront_carrier_off(netif) ((netif)->carrier = 0) |
#define | netfront_carrier_ok(netif) ((netif)->carrier) |
#define | IPRINTK(fmt, args...) printf("[XEN] " fmt, ##args) |
#define | WPRINTK(fmt, args...) |
#define | DPRINTK(fmt, args...) |
Functions | |
__FBSDID ("$FreeBSD$") | |
TUNABLE_INT ("hw.xn.enable_lro", &xn_enable_lro) | |
TUNABLE_ULONG ("hw.xn.num_queues", &xn_num_queues) | |
static void | xn_txeof (struct netfront_txq *) |
static void | xn_rxeof (struct netfront_rxq *) |
static void | xn_alloc_rx_buffers (struct netfront_rxq *) |
static void | xn_alloc_rx_buffers_callout (void *arg) |
static void | xn_release_rx_bufs (struct netfront_rxq *) |
static void | xn_release_tx_bufs (struct netfront_txq *) |
static void | xn_rxq_intr (struct netfront_rxq *) |
static void | xn_txq_intr (struct netfront_txq *) |
static void | xn_intr (void *) |
static int | xn_count_frags (struct mbuf *m) |
Count the number of fragments in an mbuf chain. More... | |
static int | xn_assemble_tx_request (struct netfront_txq *, struct mbuf *) |
static int | xn_ioctl (struct ifnet *, u_long, caddr_t) |
static void | xn_ifinit_locked (struct netfront_info *) |
static void | xn_ifinit (void *) |
static void | xn_stop (struct netfront_info *) |
static void | xn_query_features (struct netfront_info *np) |
static int | xn_configure_features (struct netfront_info *np) |
static void | netif_free (struct netfront_info *info) |
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 (struct ifnet *, struct mbuf *) |
static int | talk_to_backend (device_t dev, struct netfront_info *info) |
static int | create_netdev (device_t dev) |
static void | netif_disconnect_backend (struct netfront_info *info) |
static int | setup_device (device_t dev, struct netfront_info *info, unsigned long) |
static int | xn_ifmedia_upd (struct ifnet *ifp) |
static void | xn_ifmedia_sts (struct ifnet *ifp, struct ifmediareq *ifmr) |
static int | xn_connect (struct netfront_info *) |
static void | xn_kick_rings (struct netfront_info *) |
static int | xn_get_responses (struct netfront_rxq *, struct netfront_rx_info *, RING_IDX, RING_IDX *, struct mbuf **) |
static void | add_id_to_freelist (struct mbuf **list, uintptr_t id) |
static unsigned short | get_id_from_freelist (struct mbuf **list) |
static int | xn_rxidx (RING_IDX idx) |
static struct mbuf * | xn_get_rx_mbuf (struct netfront_rxq *rxq, RING_IDX ri) |
static grant_ref_t | xn_get_rx_ref (struct netfront_rxq *rxq, RING_IDX ri) |
static int | xen_net_read_mac (device_t dev, uint8_t mac[]) |
static int | netfront_probe (device_t dev) |
static int | netfront_attach (device_t dev) |
static int | netfront_suspend (device_t dev) |
static int | netfront_resume (device_t dev) |
static int | write_queue_xenstore_keys (device_t dev, struct netfront_rxq *rxq, struct netfront_txq *txq, struct xs_transaction *xst, bool hierarchy) |
static void | xn_txq_start (struct netfront_txq *txq) |
static void | xn_txq_tq_deferred (void *xtxq, int pending) |
static void | disconnect_rxq (struct netfront_rxq *rxq) |
static void | destroy_rxq (struct netfront_rxq *rxq) |
static void | destroy_rxqs (struct netfront_info *np) |
static int | setup_rxqs (device_t dev, struct netfront_info *info, unsigned long num_queues) |
static void | disconnect_txq (struct netfront_txq *txq) |
static void | destroy_txq (struct netfront_txq *txq) |
static void | destroy_txqs (struct netfront_info *np) |
static int | setup_txqs (device_t dev, struct netfront_info *info, unsigned long num_queues) |
static void | netfront_backend_changed (device_t dev, XenbusState newstate) |
static int | xn_tx_slot_available (struct netfront_txq *txq) |
Verify that there is sufficient space in the Tx ring buffer for a maximally sized request to be enqueued. More... | |
static struct mbuf * | xn_alloc_one_rx_buffer (struct netfront_rxq *rxq) |
static void | xn_move_rx_slot (struct netfront_rxq *rxq, struct mbuf *m, grant_ref_t ref) |
static int | xn_get_extras (struct netfront_rxq *rxq, struct netif_extra_info *extras, RING_IDX rp, RING_IDX *cons) |
static void | xn_rebuild_rx_bufs (struct netfront_rxq *rxq) |
static void | xn_qflush (struct ifnet *ifp) |
DRIVER_MODULE (xe, xenbusb_front, netfront_driver, netfront_devclass, NULL, NULL) | |
Variables | |
static int | xn_enable_lro = 1 |
static unsigned long | xn_num_queues = 4 |
static device_method_t | netfront_methods [] |
static driver_t | netfront_driver |
devclass_t | netfront_devclass |
#define DPRINTK | ( | fmt, | |
args... | |||
) |
Definition at line 316 of file netfront.c.
#define INVALID_P2M_ENTRY (~0UL) |
Definition at line 160 of file netfront.c.
#define IPRINTK | ( | fmt, | |
args... | |||
) | printf("[XEN] " fmt, ##args) |
Definition at line 304 of file netfront.c.
#define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) |
The maximum allowed data fragments in a single transmit request.
This limit is imposed by the backend driver. We assume here that we are dealing with a Linux driver domain and have set our limit to mirror the Linux MAX_SKB_FRAGS constant.
Definition at line 107 of file netfront.c.
#define net_ratelimit | ( | ) | 0 |
Definition at line 111 of file netfront.c.
#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE) |
Definition at line 80 of file netfront.c.
#define NET_RX_SLOTS_MIN (XEN_NETIF_NR_SLOTS_MIN + 1) |
Definition at line 82 of file netfront.c.
#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE) |
Definition at line 79 of file netfront.c.
#define netfront_carrier_off | ( | netif | ) | ((netif)->carrier = 0) |
Definition at line 247 of file netfront.c.
#define netfront_carrier_ok | ( | netif | ) | ((netif)->carrier) |
Definition at line 248 of file netfront.c.
#define netfront_carrier_on | ( | netif | ) | ((netif)->carrier = 1) |
Definition at line 246 of file netfront.c.
#define RX_COPY_THRESHOLD 256 |
Definition at line 109 of file netfront.c.
#define virt_to_mfn | ( | x | ) | (vtophys(x) >> PAGE_SHIFT) |
Definition at line 158 of file netfront.c.
#define WPRINTK | ( | fmt, | |
args... | |||
) |
Definition at line 310 of file netfront.c.
#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) |
Definition at line 77 of file netfront.c.
#define XN_LOCK | ( | _sc | ) | mtx_lock(&(_sc)->sc_lock); |
Definition at line 239 of file netfront.c.
#define XN_LOCK_ASSERT | ( | _sc | ) | mtx_assert(&(_sc)->sc_lock, MA_OWNED); |
Definition at line 242 of file netfront.c.
#define XN_QUEUE_NAME_LEN 8 /* xn{t,r}x_%u, allow for two digits */ |
Definition at line 161 of file netfront.c.
#define XN_RX_LOCK | ( | _q | ) | mtx_lock(&(_q)->lock) |
Definition at line 232 of file netfront.c.
#define XN_RX_LOCK_ASSERT | ( | _q | ) | mtx_assert(&(_q)->lock, MA_OWNED); |
Definition at line 243 of file netfront.c.
#define XN_RX_UNLOCK | ( | _q | ) | mtx_unlock(&(_q)->lock) |
Definition at line 233 of file netfront.c.
#define XN_TX_LOCK | ( | _q | ) | mtx_lock(&(_q)->lock) |
Definition at line 235 of file netfront.c.
#define XN_TX_LOCK_ASSERT | ( | _q | ) | mtx_assert(&(_q)->lock, MA_OWNED); |
Definition at line 244 of file netfront.c.
#define XN_TX_TRYLOCK | ( | _q | ) | mtx_trylock(&(_q)->lock) |
Definition at line 236 of file netfront.c.
#define XN_TX_UNLOCK | ( | _q | ) | mtx_unlock(&(_q)->lock) |
Definition at line 237 of file netfront.c.
#define XN_UNLOCK | ( | _sc | ) | mtx_unlock(&(_sc)->sc_lock); |
Definition at line 240 of file netfront.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
inlinestatic |
Definition at line 253 of file netfront.c.
Referenced by xn_release_tx_bufs(), and xn_txeof().
|
static |
Create a network device.
dev | Newbus device representing this virtual NIC. |
Definition at line 2204 of file netfront.c.
References ifp, netfront_info::mac, MAX_TX_REQ_FRAGS, netfront_carrier_off, netfront_info::sc_lock, netfront_info::sc_media, netfront_info::xbdev, xen_net_read_mac(), XN_CSUM_FEATURES, xn_ifinit(), xn_ifmedia_sts(), xn_ifmedia_upd(), netfront_info::xn_ifp, xn_ioctl(), xn_qflush(), and xn_txq_mq_start().
Referenced by netfront_attach().
|
static |
Definition at line 682 of file netfront.c.
References netfront_rxq::ring, and netfront_rxq::rx_refill.
Referenced by destroy_rxqs(), and setup_rxqs().
|
static |
Definition at line 690 of file netfront.c.
References destroy_rxq(), netfront_info::num_queues, and netfront_info::rxq.
Referenced by setup_device().
|
static |
Definition at line 779 of file netfront.c.
References netfront_txq::br, netfront_txq::ring, and netfront_txq::tq.
Referenced by destroy_txqs(), and setup_txqs().
|
static |
Definition at line 789 of file netfront.c.
References destroy_txq(), netfront_info::num_queues, and netfront_info::txq.
Referenced by setup_device().
|
static |
Definition at line 667 of file netfront.c.
References gnttab_end_foreign_access(), gnttab_free_grant_references(), netfront_rxq::gref_head, netfront_rxq::ring_ref, netfront_rxq::xen_intr_handle, and xn_release_rx_bufs().
Referenced by netif_disconnect_backend(), and setup_rxqs().
|
static |
Definition at line 769 of file netfront.c.
References gnttab_end_foreign_access(), gnttab_free_grant_references(), netfront_txq::gref_head, netfront_txq::ring_ref, netfront_txq::xen_intr_handle, and xn_release_tx_bufs().
Referenced by netif_disconnect_backend(), and setup_txqs().
DRIVER_MODULE | ( | xe | , |
xenbusb_front | , | ||
netfront_driver | , | ||
netfront_devclass | , | ||
NULL | , | ||
NULL | |||
) |
|
inlinestatic |
Definition at line 263 of file netfront.c.
Referenced by xn_assemble_tx_request().
|
static |
Definition at line 393 of file netfront.c.
References create_netdev(), xn_enable_lro, and xn_num_queues.
|
static |
Callback received when the backend's state changes.
Definition at line 959 of file netfront.c.
References DPRINTK, netif_disconnect_backend(), netfront_info::xbdev, xn_connect(), netfront_info::xn_ifp, xn_kick_rings(), and netfront_info::xn_reset.
|
static |
Definition at line 2255 of file netfront.c.
References DPRINTK, and netif_free().
|
static |
Entry point to this code when a new device is created. Allocate the basic structures and the ring buffers for communication with the backend, and inform the backend of the appropriate details for those. Switch to Connected state.
Definition at line 378 of file netfront.c.
|
static |
We are reconnecting to the backend, due to a suspend/resume, or a backend driver restart. We tear down our netif structure and recreate it, but leave the device-layer structures intact so that this is transparent to the rest of the kernel.
Definition at line 441 of file netfront.c.
References netfront_carrier_on, netif_disconnect_backend(), netfront_info::num_queues, netfront_info::rxq, netfront_info::txq, xen_suspend_cancelled, XN_RX_LOCK, XN_RX_UNLOCK, XN_TX_LOCK, and XN_TX_UNLOCK.
|
static |
Definition at line 417 of file netfront.c.
References netfront_carrier_off, netfront_info::num_queues, netfront_info::rxq, netfront_info::txq, XN_RX_LOCK, XN_RX_UNLOCK, XN_TX_LOCK, and XN_TX_UNLOCK.
|
static |
Definition at line 2283 of file netfront.c.
References disconnect_rxq(), disconnect_txq(), netfront_carrier_off, netfront_info::num_queues, netfront_info::rxq, netfront_info::txq, XN_RX_LOCK, XN_RX_UNLOCK, XN_TX_LOCK, and XN_TX_UNLOCK.
Referenced by netfront_backend_changed(), netfront_resume(), and netif_free().
|
static |
Definition at line 2267 of file netfront.c.
References netif_disconnect_backend(), netfront_info::rxq, netfront_info::sc_media, netfront_info::txq, netfront_info::xn_ifp, XN_LOCK, xn_stop(), and XN_UNLOCK.
Referenced by netfront_detach(), and talk_to_backend().
|
static |
Definition at line 901 of file netfront.c.
References destroy_rxqs(), destroy_txqs(), netfront_txq::info, netfront_info::num_queues, netfront_info::rxq, setup_rxqs(), setup_txqs(), netfront_info::txq, netfront_rxq::xen_intr_handle, and netfront_txq::xen_intr_handle.
Referenced by talk_to_backend().
|
static |
Definition at line 702 of file netfront.c.
References destroy_rxq(), disconnect_rxq(), gnttab_alloc_grant_references(), gnttab_free_grant_references(), netfront_rxq::grant_ref, netfront_rxq::gref_head, netfront_rxq::id, netfront_rxq::info, netfront_rxq::lock, netfront_rxq::mbufs, netfront_rxq::name, NET_RX_RING_SIZE, netfront_rxq::ring, netfront_rxq::ring_ref, netfront_rxq::rx_refill, netfront_info::rxq, rxs, virt_to_mfn, and XN_QUEUE_NAME_LEN.
Referenced by setup_device().
|
static |
Definition at line 801 of file netfront.c.
References netfront_txq::br, netfront_txq::defrtask, destroy_txq(), disconnect_txq(), gnttab_alloc_grant_references(), gnttab_end_foreign_access(), gnttab_free_grant_references(), netfront_txq::grant_ref, netfront_txq::gref_head, netfront_txq::id, netfront_txq::info, netfront_txq::lock, netfront_txq::mbufs, netfront_txq::name, NET_TX_RING_SIZE, netfront_txq::ring, netfront_txq::ring_ref, netfront_txq::tq, netfront_info::txq, txs, virt_to_mfn, netfront_txq::xen_intr_handle, xn_intr(), XN_QUEUE_NAME_LEN, and xn_txq_tq_deferred().
Referenced by setup_device().
|
static |
Definition at line 520 of file netfront.c.
References netfront_info::mac, netif_free(), netfront_info::num_queues, netfront_info::rxq, setup_device(), netfront_info::txq, write_queue_xenstore_keys(), netfront_info::xbdev, xen_net_read_mac(), netfront_info::xn_ifp, xn_num_queues, xs_printf(), xs_scanf(), xs_transaction_end(), and xs_transaction_start().
Referenced by xn_connect().
TUNABLE_INT | ( | "hw.xn.enable_lro" | , |
& | xn_enable_lro | ||
) |
TUNABLE_ULONG | ( | "hw.xn.num_queues" | , |
& | xn_num_queues | ||
) |
|
static |
Definition at line 464 of file netfront.c.
References netfront_rxq::id, netfront_txq::id, netfront_rxq::ring_ref, netfront_txq::ring_ref, netfront_info::rxq, netfront_info::txq, netfront_rxq::xen_intr_handle, netfront_txq::xen_intr_handle, and xs_printf().
Referenced by talk_to_backend().
|
static |
Read the 'mac' node at the given device's node in the store, and parse that as colon-separated octets, placing result the given mac array. mac must be a preallocated array of length ETH_ALEN (as declared in linux/if_ether.h). Return 0 on success, or errno on error.
Definition at line 326 of file netfront.c.
References xs_read().
Referenced by create_netdev(), and talk_to_backend().
|
static |
Definition at line 1049 of file netfront.c.
Referenced by xn_alloc_rx_buffers().
|
static |
Definition at line 1062 of file netfront.c.
References netfront_info::carrier, gnttab_claim_grant_reference(), gnttab_grant_foreign_access_ref(), netfront_rxq::grant_ref, netfront_rxq::gref_head, netfront_rxq::info, netfront_rxq::mbufs, NET_RX_RING_SIZE, NET_RX_SLOTS_MIN, notify(), netfront_rxq::ring, netfront_rxq::rx_refill, netfront_info::xbdev, netfront_rxq::xen_intr_handle, xn_alloc_one_rx_buffer(), xn_alloc_rx_buffers_callout(), XN_RX_LOCK_ASSERT, and xn_rxidx().
Referenced by xn_alloc_rx_buffers_callout(), xn_ifinit_locked(), xn_kick_rings(), and xn_rxeof().
|
static |
Definition at line 1120 of file netfront.c.
References xn_alloc_rx_buffers(), XN_RX_LOCK, and XN_RX_UNLOCK.
Referenced by xn_alloc_rx_buffers().
|
static |
Given an mbuf chain, make sure we have enough room and then push it onto the transmit ring.
Defragment the mbuf if necessary.
It is a bit lame, but the netback driver in Linux can't deal with nfrags > MAX_TX_REQ_FRAGS, which is a quirk of the Linux network stack.
The FreeBSD TCP stack, with TSO enabled, can produce a chain of mbufs longer than Linux can handle. Make sure we don't pass a too-long chain over to the other side by dropping the packet. It doesn't look like there is currently a way to tell the TCP stack to generate a shorter chain of packets.
CSUM_TSO requires checksum offloading. Some versions of FreeBSD fail to set CSUM_TCP in the CSUM_TSO case, so we have to test for CSUM_TSO explicitly.
Definition at line 1531 of file netfront.c.
References get_id_from_freelist(), gnttab_claim_grant_reference(), gnttab_grant_foreign_access_ref(), netfront_txq::grant_ref, netfront_txq::gref_head, ifp, netfront_txq::info, MAX_TX_REQ_FRAGS, netfront_info::maxfrags, netfront_txq::mbufs, netfront_txq::mbufs_cnt, NET_TX_RING_SIZE, netfront_txq::ring, netfront_info::txq, virt_to_mfn, netfront_info::xbdev, xn_count_frags(), netfront_info::xn_ifp, and xn_txeof().
Referenced by xn_txq_mq_start_locked().
|
static |
Definition at line 2036 of file netfront.c.
References ifp, netfront_rxq::lro, netfront_info::num_queues, netfront_info::rxq, netfront_info::xbdev, XN_CSUM_FEATURES, xn_enable_lro, and netfront_info::xn_ifp.
Referenced by xn_connect().
|
static |
Definition at line 1923 of file netfront.c.
References netfront_carrier_on, netfront_info::num_queues, netfront_info::rxq, talk_to_backend(), netfront_info::txq, netfront_info::xbdev, xn_configure_features(), xn_query_features(), xn_rebuild_rx_bufs(), xn_release_tx_bufs(), and xs_scanf().
Referenced by netfront_backend_changed().
|
inlinestatic |
Count the number of fragments in an mbuf chain.
Surprisingly, there isn't an M* macro for this.
Definition at line 1516 of file netfront.c.
Referenced by xn_assemble_tx_request().
|
static |
Definition at line 1369 of file netfront.c.
References netfront_rxq::ring, xn_get_rx_mbuf(), xn_get_rx_ref(), and xn_move_rx_slot().
Referenced by xn_get_responses().
|
static |
Definition at line 1404 of file netfront.c.
References DPRINTK, netfront_rx_info::extras, gnttab_end_foreign_access_ref(), gnttab_release_grant_reference(), netfront_rxq::gref_head, net_ratelimit, netfront_rxq::ring, netfront_rx_info::rx, WPRINTK, xn_get_extras(), xn_get_rx_mbuf(), xn_get_rx_ref(), and xn_move_rx_slot().
Referenced by xn_rxeof().
|
inlinestatic |
Definition at line 282 of file netfront.c.
References netfront_rxq::mbufs, and xn_rxidx().
Referenced by xn_get_extras(), xn_get_responses(), and xn_rebuild_rx_bufs().
|
inlinestatic |
Definition at line 294 of file netfront.c.
References netfront_rxq::grant_ref, and xn_rxidx().
Referenced by xn_get_extras(), xn_get_responses(), and xn_rebuild_rx_bufs().
|
static |
Definition at line 1732 of file netfront.c.
References xn_ifinit_locked(), XN_LOCK, and XN_UNLOCK.
Referenced by create_netdev(), and xn_ioctl().
|
static |
Definition at line 1701 of file netfront.c.
References ifp, netfront_carrier_ok, netfront_info::num_queues, netfront_rxq::ring, netfront_info::rxq, xn_alloc_rx_buffers(), netfront_info::xn_ifp, XN_LOCK_ASSERT, XN_RX_LOCK, XN_RX_UNLOCK, xn_rxeof(), and xn_stop().
Referenced by xn_ifinit(), and xn_ioctl().
|
static |
Definition at line 2311 of file netfront.c.
Referenced by create_netdev().
|
static |
Definition at line 2304 of file netfront.c.
Referenced by create_netdev().
|
static |
Definition at line 1343 of file netfront.c.
References netfront_txq::id, netfront_txq::info, netfront_info::rxq, netfront_info::txq, xn_rxq_intr(), and xn_txq_intr().
Referenced by setup_txqs().
|
static |
Definition at line 1742 of file netfront.c.
References ifp, netfront_carrier_off, netfront_info::sc_media, netfront_info::xbdev, XN_CSUM_FEATURES, netfront_info::xn_if_flags, xn_ifinit(), xn_ifinit_locked(), XN_LOCK, netfront_info::xn_reset, xn_stop(), XN_UNLOCK, and xs_rm().
Referenced by create_netdev().
|
static |
Definition at line 1972 of file netfront.c.
References netfront_info::num_queues, netfront_info::rxq, netfront_info::txq, netfront_txq::xen_intr_handle, xn_alloc_rx_buffers(), XN_RX_LOCK, XN_RX_UNLOCK, XN_TX_LOCK, XN_TX_UNLOCK, and xn_txeof().
Referenced by netfront_backend_changed().
|
static |
Definition at line 1355 of file netfront.c.
References netfront_rxq::grant_ref, netfront_rxq::mbufs, netfront_rxq::ring, and xn_rxidx().
Referenced by xn_get_extras(), and xn_get_responses().
|
static |
Definition at line 2178 of file netfront.c.
References netfront_txq::br, ifp, netfront_info::num_queues, netfront_info::txq, XN_TX_LOCK, and XN_TX_UNLOCK.
Referenced by create_netdev().
|
static |
Definition at line 1992 of file netfront.c.
References MAX_TX_REQ_FRAGS, netfront_info::maxfrags, netfront_info::xbdev, netfront_info::xn_ifp, and xs_scanf().
Referenced by xn_connect().
|
static |
Definition at line 1889 of file netfront.c.
References gnttab_grant_foreign_access_ref(), netfront_rxq::grant_ref, netfront_rxq::info, netfront_rxq::mbufs, NET_RX_RING_SIZE, netfront_rxq::ring, netfront_info::xbdev, xn_get_rx_mbuf(), and xn_get_rx_ref().
Referenced by xn_connect().
|
static |
Definition at line 1131 of file netfront.c.
References gnttab_end_foreign_access_ref(), gnttab_release_grant_reference(), netfront_rxq::grant_ref, netfront_rxq::gref_head, netfront_rxq::mbufs, and NET_RX_RING_SIZE.
Referenced by disconnect_rxq().
|
static |
Definition at line 1018 of file netfront.c.
References add_id_to_freelist(), gnttab_end_foreign_access_ref(), gnttab_release_grant_reference(), netfront_txq::grant_ref, netfront_txq::gref_head, netfront_txq::mbufs, netfront_txq::mbufs_cnt, and NET_TX_RING_SIZE.
Referenced by disconnect_txq(), and xn_connect().
|
static |
Definition at line 1155 of file netfront.c.
References netfront_rx_info::extras, ifp, netfront_rxq::info, netfront_rxq::lro, netfront_carrier_ok, netfront_rxq::ring, netfront_rx_info::rx, netfront_info::rxq, xn_alloc_rx_buffers(), xn_get_responses(), netfront_info::xn_ifp, and XN_RX_LOCK_ASSERT.
Referenced by xn_ifinit_locked(), and xn_rxq_intr().
|
inlinestatic |
Definition at line 275 of file netfront.c.
References NET_RX_RING_SIZE.
Referenced by xn_alloc_rx_buffers(), xn_get_rx_mbuf(), xn_get_rx_ref(), and xn_move_rx_slot().
|
static |
Definition at line 626 of file netfront.c.
References XN_RX_LOCK, XN_RX_UNLOCK, and xn_rxeof().
Referenced by xn_intr().
|
static |
Definition at line 1876 of file netfront.c.
References ifp, netfront_info::xn_ifp, and XN_LOCK_ASSERT.
Referenced by netif_free(), xn_ifinit_locked(), and xn_ioctl().
|
inlinestatic |
Verify that there is sufficient space in the Tx ring buffer for a maximally sized request to be enqueued.
A transmit request requires a transmit descriptor for each packet fragment, plus up to 2 entries for "options" (e.g. TSO).
Definition at line 1011 of file netfront.c.
References MAX_TX_REQ_FRAGS, netfront_txq::ring, and netfront_info::txq.
Referenced by xn_txq_mq_start_locked().
|
static |
Definition at line 1264 of file netfront.c.
References add_id_to_freelist(), netfront_txq::full, gnttab_end_foreign_access_ref(), gnttab_query_foreign_access(), gnttab_release_grant_reference(), netfront_txq::grant_ref, netfront_txq::gref_head, ifp, netfront_txq::info, netfront_txq::mbufs, netfront_txq::mbufs_cnt, NET_TX_RING_SIZE, netfront_carrier_ok, netfront_txq::ring, netfront_info::txq, netfront_info::xn_ifp, XN_TX_LOCK_ASSERT, and xn_txq_start().
Referenced by xn_assemble_tx_request(), xn_kick_rings(), and xn_txq_intr().
|
static |
Definition at line 646 of file netfront.c.
References netfront_txq::ring, XN_TX_LOCK, XN_TX_UNLOCK, xn_txeof(), and xn_txq_start().
Referenced by xn_intr().
|
static |
Definition at line 2144 of file netfront.c.
References netfront_txq::br, netfront_txq::defrtask, ifp, netfront_carrier_ok, netfront_info::num_queues, netfront_txq::tq, netfront_info::txq, XN_TX_TRYLOCK, XN_TX_UNLOCK, and xn_txq_mq_start_locked().
Referenced by create_netdev().
|
static |
Definition at line 2090 of file netfront.c.
References netfront_txq::br, netfront_txq::full, ifp, netfront_txq::info, netfront_carrier_ok, notify(), netfront_txq::ring, netfront_txq::xen_intr_handle, xn_assemble_tx_request(), netfront_info::xn_ifp, XN_TX_LOCK_ASSERT, and xn_tx_slot_available().
Referenced by xn_txq_mq_start(), and xn_txq_start().
|
static |
Definition at line 635 of file netfront.c.
References netfront_txq::br, ifp, netfront_txq::info, netfront_info::txq, netfront_info::xn_ifp, XN_TX_LOCK_ASSERT, and xn_txq_mq_start_locked().
Referenced by xn_txeof(), xn_txq_intr(), and xn_txq_tq_deferred().
|
static |
Definition at line 657 of file netfront.c.
References XN_TX_LOCK, XN_TX_UNLOCK, and xn_txq_start().
Referenced by setup_txqs().
devclass_t netfront_devclass |
Definition at line 2339 of file netfront.c.
|
static |
Definition at line 2334 of file netfront.c.
|
static |
Definition at line 2319 of file netfront.c.
|
static |
Definition at line 90 of file netfront.c.
Referenced by netfront_attach(), and xn_configure_features().
|
static |
Definition at line 96 of file netfront.c.
Referenced by netfront_attach(), and talk_to_backend().