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()
153 struct xenvif *vif = netdev_priv(dev); in xenvif_select_queue() local
154 unsigned int size = vif->hash.size; in xenvif_select_queue()
159 num_queues = READ_ONCE(vif->num_queues); in xenvif_select_queue()
163 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_select_queue()
167 xenvif_set_skb_hash(vif, skb); in xenvif_select_queue()
172 return vif->hash.mapping[vif->hash.mapping_sel] in xenvif_select_queue()
179 struct xenvif *vif = netdev_priv(dev); in xenvif_start_xmit() local
191 num_queues = READ_ONCE(vif->num_queues); in xenvif_start_xmit()
199 index, vif->dev->name); in xenvif_start_xmit()
202 queue = &vif->queues[index]; in xenvif_start_xmit()
207 !xenvif_schedulable(vif)) in xenvif_start_xmit()
210 if (vif->multicast_control && skb->pkt_type == PACKET_MULTICAST) { in xenvif_start_xmit()
213 if (!xenvif_mcast_match(vif, eth->h_dest)) in xenvif_start_xmit()
218 cb->expires = jiffies + vif->drain_timeout; in xenvif_start_xmit()
224 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_start_xmit()
233 vif->dev->stats.tx_dropped++; in xenvif_start_xmit()
240 struct xenvif *vif = netdev_priv(dev); in xenvif_get_stats() local
250 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_stats()
254 queue = &vif->queues[index]; in xenvif_get_stats()
263 vif->dev->stats.rx_bytes = rx_bytes; in xenvif_get_stats()
264 vif->dev->stats.rx_packets = rx_packets; in xenvif_get_stats()
265 vif->dev->stats.tx_bytes = tx_bytes; in xenvif_get_stats()
266 vif->dev->stats.tx_packets = tx_packets; in xenvif_get_stats()
268 return &vif->dev->stats; in xenvif_get_stats()
271 static void xenvif_up(struct xenvif *vif) in xenvif_up() argument
274 unsigned int num_queues = vif->num_queues; in xenvif_up()
278 queue = &vif->queues[queue_index]; in xenvif_up()
287 static void xenvif_down(struct xenvif *vif) in xenvif_down() argument
290 unsigned int num_queues = vif->num_queues; in xenvif_down()
294 queue = &vif->queues[queue_index]; in xenvif_down()
305 struct xenvif *vif = netdev_priv(dev); in xenvif_open() local
306 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_open()
307 xenvif_up(vif); in xenvif_open()
314 struct xenvif *vif = netdev_priv(dev); in xenvif_close() local
315 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_close()
316 xenvif_down(vif); in xenvif_close()
323 struct xenvif *vif = netdev_priv(dev); in xenvif_change_mtu() local
324 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN; in xenvif_change_mtu()
335 struct xenvif *vif = netdev_priv(dev); in xenvif_fix_features() local
337 if (!vif->can_sg) in xenvif_fix_features()
339 if (~(vif->gso_mask) & GSO_BIT(TCPV4)) in xenvif_fix_features()
341 if (~(vif->gso_mask) & GSO_BIT(TCPV6)) in xenvif_fix_features()
343 if (!vif->ip_csum) in xenvif_fix_features()
345 if (!vif->ipv6_csum) in xenvif_fix_features()
396 struct xenvif *vif = netdev_priv(dev); in xenvif_get_ethtool_stats() local
402 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_ethtool_stats()
407 void *vif_stats = &vif->queues[queue_index].stats; in xenvif_get_ethtool_stats()
454 struct xenvif *vif; in xenvif_alloc() local
471 vif = netdev_priv(dev); in xenvif_alloc()
473 vif->domid = domid; in xenvif_alloc()
474 vif->handle = handle; in xenvif_alloc()
475 vif->can_sg = 1; in xenvif_alloc()
476 vif->ip_csum = 1; in xenvif_alloc()
477 vif->dev = dev; in xenvif_alloc()
478 vif->disabled = false; in xenvif_alloc()
479 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs); in xenvif_alloc()
480 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs); in xenvif_alloc()
483 vif->queues = NULL; in xenvif_alloc()
484 vif->num_queues = 0; in xenvif_alloc()
486 spin_lock_init(&vif->lock); in xenvif_alloc()
487 INIT_LIST_HEAD(&vif->fe_mcast_addr); in xenvif_alloc()
523 return vif; in xenvif_alloc()
555 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n"); in xenvif_init_queue()
570 void xenvif_carrier_on(struct xenvif *vif) in xenvif_carrier_on() argument
573 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) in xenvif_carrier_on()
574 dev_set_mtu(vif->dev, ETH_DATA_LEN); in xenvif_carrier_on()
575 netdev_update_features(vif->dev); in xenvif_carrier_on()
576 set_bit(VIF_STATUS_CONNECTED, &vif->status); in xenvif_carrier_on()
577 if (netif_running(vif->dev)) in xenvif_carrier_on()
578 xenvif_up(vif); in xenvif_carrier_on()
582 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref, in xenvif_connect_ctrl() argument
585 struct net_device *dev = vif->dev; in xenvif_connect_ctrl()
590 err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif), in xenvif_connect_ctrl()
596 BACK_RING_INIT(&vif->ctrl, shared, XEN_PAGE_SIZE); in xenvif_connect_ctrl()
598 err = bind_interdomain_evtchn_to_irq(vif->domid, evtchn); in xenvif_connect_ctrl()
602 vif->ctrl_irq = err; in xenvif_connect_ctrl()
604 xenvif_init_hash(vif); in xenvif_connect_ctrl()
606 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn, in xenvif_connect_ctrl()
607 IRQF_ONESHOT, "xen-netback-ctrl", vif); in xenvif_connect_ctrl()
616 xenvif_deinit_hash(vif); in xenvif_connect_ctrl()
617 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_connect_ctrl()
618 vif->ctrl_irq = 0; in xenvif_connect_ctrl()
621 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_connect_ctrl()
622 vif->ctrl.sring); in xenvif_connect_ctrl()
623 vif->ctrl.sring = NULL; in xenvif_connect_ctrl()
651 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, in xenvif_connect_data()
657 queue->vif->domid, tx_evtchn, xenvif_interrupt, 0, in xenvif_connect_data()
668 queue->vif->domid, tx_evtchn, xenvif_tx_interrupt, 0, in xenvif_connect_data()
678 queue->vif->domid, rx_evtchn, xenvif_rx_interrupt, 0, in xenvif_connect_data()
725 void xenvif_carrier_off(struct xenvif *vif) in xenvif_carrier_off() argument
727 struct net_device *dev = vif->dev; in xenvif_carrier_off()
730 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) { in xenvif_carrier_off()
733 xenvif_down(vif); in xenvif_carrier_off()
738 void xenvif_disconnect_data(struct xenvif *vif) in xenvif_disconnect_data() argument
741 unsigned int num_queues = vif->num_queues; in xenvif_disconnect_data()
744 xenvif_carrier_off(vif); in xenvif_disconnect_data()
747 queue = &vif->queues[queue_index]; in xenvif_disconnect_data()
775 xenvif_mcast_addr_list_free(vif); in xenvif_disconnect_data()
778 void xenvif_disconnect_ctrl(struct xenvif *vif) in xenvif_disconnect_ctrl() argument
780 if (vif->ctrl_irq) { in xenvif_disconnect_ctrl()
781 xenvif_deinit_hash(vif); in xenvif_disconnect_ctrl()
782 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_disconnect_ctrl()
783 vif->ctrl_irq = 0; in xenvif_disconnect_ctrl()
786 if (vif->ctrl.sring) { in xenvif_disconnect_ctrl()
787 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_disconnect_ctrl()
788 vif->ctrl.sring); in xenvif_disconnect_ctrl()
789 vif->ctrl.sring = NULL; in xenvif_disconnect_ctrl()
802 void xenvif_free(struct xenvif *vif) in xenvif_free() argument
804 struct xenvif_queue *queues = vif->queues; in xenvif_free()
805 unsigned int num_queues = vif->num_queues; in xenvif_free()
808 unregister_netdev(vif->dev); in xenvif_free()
809 free_netdev(vif->dev); in xenvif_free()