Lines Matching full: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()
112 /* This vif is rogue, we pretend we've there is nothing to do in xenvif_poll()
113 * for this vif to deschedule it from NAPI. But this interface in xenvif_poll()
116 if (unlikely(queue->vif->disabled)) { in xenvif_poll()
183 struct net_device *dev = queue->vif->dev; in xenvif_queue_stopped()
190 struct net_device *dev = queue->vif->dev; in xenvif_wake_queue()
198 struct xenvif *vif = netdev_priv(dev); in xenvif_select_queue() local
199 unsigned int size = vif->hash.size; in xenvif_select_queue()
204 num_queues = READ_ONCE(vif->num_queues); in xenvif_select_queue()
208 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_select_queue()
212 xenvif_set_skb_hash(vif, skb); in xenvif_select_queue()
217 return vif->hash.mapping[vif->hash.mapping_sel] in xenvif_select_queue()
224 struct xenvif *vif = netdev_priv(dev); in xenvif_start_xmit() local
236 num_queues = READ_ONCE(vif->num_queues); in xenvif_start_xmit()
244 index, vif->dev->name); in xenvif_start_xmit()
247 queue = &vif->queues[index]; in xenvif_start_xmit()
252 !xenvif_schedulable(vif)) in xenvif_start_xmit()
255 if (vif->multicast_control && skb->pkt_type == PACKET_MULTICAST) { in xenvif_start_xmit()
258 if (!xenvif_mcast_match(vif, eth->h_dest)) in xenvif_start_xmit()
263 cb->expires = jiffies + vif->drain_timeout; in xenvif_start_xmit()
269 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_start_xmit()
278 vif->dev->stats.tx_dropped++; in xenvif_start_xmit()
285 struct xenvif *vif = netdev_priv(dev); in xenvif_get_stats() local
295 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_stats()
299 queue = &vif->queues[index]; in xenvif_get_stats()
308 vif->dev->stats.rx_bytes = rx_bytes; in xenvif_get_stats()
309 vif->dev->stats.rx_packets = rx_packets; in xenvif_get_stats()
310 vif->dev->stats.tx_bytes = tx_bytes; in xenvif_get_stats()
311 vif->dev->stats.tx_packets = tx_packets; in xenvif_get_stats()
313 return &vif->dev->stats; in xenvif_get_stats()
316 static void xenvif_up(struct xenvif *vif) in xenvif_up() argument
319 unsigned int num_queues = vif->num_queues; in xenvif_up()
323 queue = &vif->queues[queue_index]; in xenvif_up()
332 static void xenvif_down(struct xenvif *vif) in xenvif_down() argument
335 unsigned int num_queues = vif->num_queues; in xenvif_down()
339 queue = &vif->queues[queue_index]; in xenvif_down()
350 struct xenvif *vif = netdev_priv(dev); in xenvif_open() local
351 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_open()
352 xenvif_up(vif); in xenvif_open()
359 struct xenvif *vif = netdev_priv(dev); in xenvif_close() local
360 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_close()
361 xenvif_down(vif); in xenvif_close()
368 struct xenvif *vif = netdev_priv(dev); in xenvif_change_mtu() local
369 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN; in xenvif_change_mtu()
380 struct xenvif *vif = netdev_priv(dev); in xenvif_fix_features() local
382 if (!vif->can_sg) in xenvif_fix_features()
384 if (~(vif->gso_mask) & GSO_BIT(TCPV4)) in xenvif_fix_features()
386 if (~(vif->gso_mask) & GSO_BIT(TCPV6)) in xenvif_fix_features()
388 if (!vif->ip_csum) in xenvif_fix_features()
390 if (!vif->ipv6_csum) in xenvif_fix_features()
441 struct xenvif *vif = netdev_priv(dev); in xenvif_get_ethtool_stats() local
447 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_ethtool_stats()
452 void *vif_stats = &vif->queues[queue_index].stats; in xenvif_get_ethtool_stats()
499 struct xenvif *vif; in xenvif_alloc() local
502 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); in xenvif_alloc()
516 vif = netdev_priv(dev); in xenvif_alloc()
518 vif->domid = domid; in xenvif_alloc()
519 vif->handle = handle; in xenvif_alloc()
520 vif->can_sg = 1; in xenvif_alloc()
521 vif->ip_csum = 1; in xenvif_alloc()
522 vif->dev = dev; in xenvif_alloc()
523 vif->disabled = false; in xenvif_alloc()
524 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs); in xenvif_alloc()
525 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs); in xenvif_alloc()
528 vif->queues = NULL; in xenvif_alloc()
529 vif->num_queues = 0; in xenvif_alloc()
531 vif->xdp_headroom = 0; in xenvif_alloc()
533 spin_lock_init(&vif->lock); in xenvif_alloc()
534 INIT_LIST_HEAD(&vif->fe_mcast_addr); in xenvif_alloc()
570 return vif; in xenvif_alloc()
602 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n"); in xenvif_init_queue()
617 void xenvif_carrier_on(struct xenvif *vif) in xenvif_carrier_on() argument
620 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) in xenvif_carrier_on()
621 dev_set_mtu(vif->dev, ETH_DATA_LEN); in xenvif_carrier_on()
622 netdev_update_features(vif->dev); in xenvif_carrier_on()
623 set_bit(VIF_STATUS_CONNECTED, &vif->status); in xenvif_carrier_on()
624 if (netif_running(vif->dev)) in xenvif_carrier_on()
625 xenvif_up(vif); in xenvif_carrier_on()
629 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref, in xenvif_connect_ctrl() argument
632 struct net_device *dev = vif->dev; in xenvif_connect_ctrl()
633 struct xenbus_device *xendev = xenvif_to_xenbus_device(vif); in xenvif_connect_ctrl()
647 BACK_RING_ATTACH(&vif->ctrl, shared, rsp_prod, XEN_PAGE_SIZE); in xenvif_connect_ctrl()
650 if (req_prod - rsp_prod > RING_SIZE(&vif->ctrl)) in xenvif_connect_ctrl()
657 vif->ctrl_irq = err; in xenvif_connect_ctrl()
659 xenvif_init_hash(vif); in xenvif_connect_ctrl()
661 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn, in xenvif_connect_ctrl()
662 IRQF_ONESHOT, "xen-netback-ctrl", vif); in xenvif_connect_ctrl()
671 xenvif_deinit_hash(vif); in xenvif_connect_ctrl()
672 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_connect_ctrl()
673 vif->ctrl_irq = 0; in xenvif_connect_ctrl()
676 xenbus_unmap_ring_vfree(xendev, vif->ctrl.sring); in xenvif_connect_ctrl()
677 vif->ctrl.sring = NULL; in xenvif_connect_ctrl()
722 struct xenbus_device *dev = xenvif_to_xenbus_device(queue->vif); in xenvif_connect_data()
739 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, in xenvif_connect_data()
803 void xenvif_carrier_off(struct xenvif *vif) in xenvif_carrier_off() argument
805 struct net_device *dev = vif->dev; in xenvif_carrier_off()
808 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) { in xenvif_carrier_off()
811 xenvif_down(vif); in xenvif_carrier_off()
816 void xenvif_disconnect_data(struct xenvif *vif) in xenvif_disconnect_data() argument
819 unsigned int num_queues = vif->num_queues; in xenvif_disconnect_data()
822 xenvif_carrier_off(vif); in xenvif_disconnect_data()
825 queue = &vif->queues[queue_index]; in xenvif_disconnect_data()
830 xenvif_mcast_addr_list_free(vif); in xenvif_disconnect_data()
833 void xenvif_disconnect_ctrl(struct xenvif *vif) in xenvif_disconnect_ctrl() argument
835 if (vif->ctrl_irq) { in xenvif_disconnect_ctrl()
836 xenvif_deinit_hash(vif); in xenvif_disconnect_ctrl()
837 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_disconnect_ctrl()
838 vif->ctrl_irq = 0; in xenvif_disconnect_ctrl()
841 if (vif->ctrl.sring) { in xenvif_disconnect_ctrl()
842 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_disconnect_ctrl()
843 vif->ctrl.sring); in xenvif_disconnect_ctrl()
844 vif->ctrl.sring = NULL; in xenvif_disconnect_ctrl()
857 void xenvif_free(struct xenvif *vif) in xenvif_free() argument
859 struct xenvif_queue *queues = vif->queues; in xenvif_free()
860 unsigned int num_queues = vif->num_queues; in xenvif_free()
863 unregister_netdev(vif->dev); in xenvif_free()
864 free_netdev(vif->dev); in xenvif_free()