Lines Matching refs:vif
73 int xenvif_schedulable(struct xenvif *vif) in xenvif_schedulable() argument
75 return netif_running(vif->dev) && in xenvif_schedulable()
76 test_bit(VIF_STATUS_CONNECTED, &vif->status) && in xenvif_schedulable()
77 !vif->disabled; in xenvif_schedulable()
100 if (unlikely(queue->vif->disabled)) { in xenvif_poll()
138 struct net_device *dev = queue->vif->dev; in xenvif_queue_stopped()
145 struct net_device *dev = queue->vif->dev; in xenvif_wake_queue()
154 struct xenvif *vif = netdev_priv(dev); in xenvif_select_queue() local
155 unsigned int size = vif->hash.size; in xenvif_select_queue()
157 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_select_queue()
160 xenvif_set_skb_hash(vif, skb); in xenvif_select_queue()
165 return vif->hash.mapping[vif->hash.mapping_sel] in xenvif_select_queue()
171 struct xenvif *vif = netdev_priv(dev); in xenvif_start_xmit() local
183 num_queues = READ_ONCE(vif->num_queues); in xenvif_start_xmit()
191 index, vif->dev->name); in xenvif_start_xmit()
194 queue = &vif->queues[index]; in xenvif_start_xmit()
199 !xenvif_schedulable(vif)) in xenvif_start_xmit()
202 if (vif->multicast_control && skb->pkt_type == PACKET_MULTICAST) { in xenvif_start_xmit()
205 if (!xenvif_mcast_match(vif, eth->h_dest)) in xenvif_start_xmit()
210 cb->expires = jiffies + vif->drain_timeout; in xenvif_start_xmit()
216 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_start_xmit()
225 vif->dev->stats.tx_dropped++; in xenvif_start_xmit()
232 struct xenvif *vif = netdev_priv(dev); in xenvif_get_stats() local
242 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_stats()
246 queue = &vif->queues[index]; in xenvif_get_stats()
255 vif->dev->stats.rx_bytes = rx_bytes; in xenvif_get_stats()
256 vif->dev->stats.rx_packets = rx_packets; in xenvif_get_stats()
257 vif->dev->stats.tx_bytes = tx_bytes; in xenvif_get_stats()
258 vif->dev->stats.tx_packets = tx_packets; in xenvif_get_stats()
260 return &vif->dev->stats; in xenvif_get_stats()
263 static void xenvif_up(struct xenvif *vif) in xenvif_up() argument
266 unsigned int num_queues = vif->num_queues; in xenvif_up()
270 queue = &vif->queues[queue_index]; in xenvif_up()
279 static void xenvif_down(struct xenvif *vif) in xenvif_down() argument
282 unsigned int num_queues = vif->num_queues; in xenvif_down()
286 queue = &vif->queues[queue_index]; in xenvif_down()
297 struct xenvif *vif = netdev_priv(dev); in xenvif_open() local
298 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_open()
299 xenvif_up(vif); in xenvif_open()
306 struct xenvif *vif = netdev_priv(dev); in xenvif_close() local
307 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_close()
308 xenvif_down(vif); in xenvif_close()
315 struct xenvif *vif = netdev_priv(dev); in xenvif_change_mtu() local
316 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN; in xenvif_change_mtu()
327 struct xenvif *vif = netdev_priv(dev); in xenvif_fix_features() local
329 if (!vif->can_sg) in xenvif_fix_features()
331 if (~(vif->gso_mask) & GSO_BIT(TCPV4)) in xenvif_fix_features()
333 if (~(vif->gso_mask) & GSO_BIT(TCPV6)) in xenvif_fix_features()
335 if (!vif->ip_csum) in xenvif_fix_features()
337 if (!vif->ipv6_csum) in xenvif_fix_features()
388 struct xenvif *vif = netdev_priv(dev); in xenvif_get_ethtool_stats() local
394 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_ethtool_stats()
399 void *vif_stats = &vif->queues[queue_index].stats; in xenvif_get_ethtool_stats()
446 struct xenvif *vif; in xenvif_alloc() local
463 vif = netdev_priv(dev); in xenvif_alloc()
465 vif->domid = domid; in xenvif_alloc()
466 vif->handle = handle; in xenvif_alloc()
467 vif->can_sg = 1; in xenvif_alloc()
468 vif->ip_csum = 1; in xenvif_alloc()
469 vif->dev = dev; in xenvif_alloc()
470 vif->disabled = false; in xenvif_alloc()
471 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs); in xenvif_alloc()
472 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs); in xenvif_alloc()
475 vif->queues = NULL; in xenvif_alloc()
476 vif->num_queues = 0; in xenvif_alloc()
478 spin_lock_init(&vif->lock); in xenvif_alloc()
479 INIT_LIST_HEAD(&vif->fe_mcast_addr); in xenvif_alloc()
515 return vif; in xenvif_alloc()
547 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n"); in xenvif_init_queue()
562 void xenvif_carrier_on(struct xenvif *vif) in xenvif_carrier_on() argument
565 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) in xenvif_carrier_on()
566 dev_set_mtu(vif->dev, ETH_DATA_LEN); in xenvif_carrier_on()
567 netdev_update_features(vif->dev); in xenvif_carrier_on()
568 set_bit(VIF_STATUS_CONNECTED, &vif->status); in xenvif_carrier_on()
569 if (netif_running(vif->dev)) in xenvif_carrier_on()
570 xenvif_up(vif); in xenvif_carrier_on()
574 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref, in xenvif_connect_ctrl() argument
577 struct net_device *dev = vif->dev; in xenvif_connect_ctrl()
582 err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif), in xenvif_connect_ctrl()
588 BACK_RING_INIT(&vif->ctrl, shared, XEN_PAGE_SIZE); in xenvif_connect_ctrl()
590 err = bind_interdomain_evtchn_to_irq(vif->domid, evtchn); in xenvif_connect_ctrl()
594 vif->ctrl_irq = err; in xenvif_connect_ctrl()
596 xenvif_init_hash(vif); in xenvif_connect_ctrl()
598 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn, in xenvif_connect_ctrl()
599 IRQF_ONESHOT, "xen-netback-ctrl", vif); in xenvif_connect_ctrl()
608 xenvif_deinit_hash(vif); in xenvif_connect_ctrl()
609 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_connect_ctrl()
610 vif->ctrl_irq = 0; in xenvif_connect_ctrl()
613 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_connect_ctrl()
614 vif->ctrl.sring); in xenvif_connect_ctrl()
615 vif->ctrl.sring = NULL; in xenvif_connect_ctrl()
643 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, in xenvif_connect_data()
649 queue->vif->domid, tx_evtchn, xenvif_interrupt, 0, in xenvif_connect_data()
660 queue->vif->domid, tx_evtchn, xenvif_tx_interrupt, 0, in xenvif_connect_data()
670 queue->vif->domid, rx_evtchn, xenvif_rx_interrupt, 0, in xenvif_connect_data()
718 void xenvif_carrier_off(struct xenvif *vif) in xenvif_carrier_off() argument
720 struct net_device *dev = vif->dev; in xenvif_carrier_off()
723 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) { in xenvif_carrier_off()
726 xenvif_down(vif); in xenvif_carrier_off()
731 void xenvif_disconnect_data(struct xenvif *vif) in xenvif_disconnect_data() argument
734 unsigned int num_queues = vif->num_queues; in xenvif_disconnect_data()
737 xenvif_carrier_off(vif); in xenvif_disconnect_data()
740 queue = &vif->queues[queue_index]; in xenvif_disconnect_data()
768 xenvif_mcast_addr_list_free(vif); in xenvif_disconnect_data()
771 void xenvif_disconnect_ctrl(struct xenvif *vif) in xenvif_disconnect_ctrl() argument
773 if (vif->ctrl_irq) { in xenvif_disconnect_ctrl()
774 xenvif_deinit_hash(vif); in xenvif_disconnect_ctrl()
775 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_disconnect_ctrl()
776 vif->ctrl_irq = 0; in xenvif_disconnect_ctrl()
779 if (vif->ctrl.sring) { in xenvif_disconnect_ctrl()
780 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_disconnect_ctrl()
781 vif->ctrl.sring); in xenvif_disconnect_ctrl()
782 vif->ctrl.sring = NULL; in xenvif_disconnect_ctrl()
795 void xenvif_free(struct xenvif *vif) in xenvif_free() argument
797 struct xenvif_queue *queues = vif->queues; in xenvif_free()
798 unsigned int num_queues = vif->num_queues; in xenvif_free()
801 unregister_netdev(vif->dev); in xenvif_free()
802 free_netdev(vif->dev); in xenvif_free()