Lines Matching refs:vif

70 static int xenvif_schedulable(struct xenvif *vif)  in xenvif_schedulable()  argument
72 return netif_running(vif->dev) && in xenvif_schedulable()
73 test_bit(VIF_STATUS_CONNECTED, &vif->status) && in xenvif_schedulable()
74 !vif->disabled; in xenvif_schedulable()
113 if (unlikely(queue->vif->disabled)) { in xenvif_poll()
181 struct xenvif *vif = netdev_priv(dev); in xenvif_select_queue() local
182 unsigned int size = vif->hash.size; in xenvif_select_queue()
187 num_queues = READ_ONCE(vif->num_queues); in xenvif_select_queue()
191 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_select_queue()
195 xenvif_set_skb_hash(vif, skb); in xenvif_select_queue()
200 return vif->hash.mapping[vif->hash.mapping_sel] in xenvif_select_queue()
207 struct xenvif *vif = netdev_priv(dev); in xenvif_start_xmit() local
219 num_queues = READ_ONCE(vif->num_queues); in xenvif_start_xmit()
227 index, vif->dev->name); in xenvif_start_xmit()
230 queue = &vif->queues[index]; in xenvif_start_xmit()
235 !xenvif_schedulable(vif)) in xenvif_start_xmit()
238 if (vif->multicast_control && skb->pkt_type == PACKET_MULTICAST) { in xenvif_start_xmit()
241 if (!xenvif_mcast_match(vif, eth->h_dest)) in xenvif_start_xmit()
246 cb->expires = jiffies + vif->drain_timeout; in xenvif_start_xmit()
252 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_start_xmit()
263 vif->dev->stats.tx_dropped++; in xenvif_start_xmit()
270 struct xenvif *vif = netdev_priv(dev); in xenvif_get_stats() local
280 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_stats()
284 queue = &vif->queues[index]; in xenvif_get_stats()
293 vif->dev->stats.rx_bytes = rx_bytes; in xenvif_get_stats()
294 vif->dev->stats.rx_packets = rx_packets; in xenvif_get_stats()
295 vif->dev->stats.tx_bytes = tx_bytes; in xenvif_get_stats()
296 vif->dev->stats.tx_packets = tx_packets; in xenvif_get_stats()
298 return &vif->dev->stats; in xenvif_get_stats()
301 static void xenvif_up(struct xenvif *vif) in xenvif_up() argument
304 unsigned int num_queues = vif->num_queues; in xenvif_up()
308 queue = &vif->queues[queue_index]; in xenvif_up()
317 static void xenvif_down(struct xenvif *vif) in xenvif_down() argument
320 unsigned int num_queues = vif->num_queues; in xenvif_down()
324 queue = &vif->queues[queue_index]; in xenvif_down()
335 struct xenvif *vif = netdev_priv(dev); in xenvif_open() local
336 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_open()
337 xenvif_up(vif); in xenvif_open()
344 struct xenvif *vif = netdev_priv(dev); in xenvif_close() local
345 if (test_bit(VIF_STATUS_CONNECTED, &vif->status)) in xenvif_close()
346 xenvif_down(vif); in xenvif_close()
353 struct xenvif *vif = netdev_priv(dev); in xenvif_change_mtu() local
354 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN; in xenvif_change_mtu()
365 struct xenvif *vif = netdev_priv(dev); in xenvif_fix_features() local
367 if (!vif->can_sg) in xenvif_fix_features()
369 if (~(vif->gso_mask) & GSO_BIT(TCPV4)) in xenvif_fix_features()
371 if (~(vif->gso_mask) & GSO_BIT(TCPV6)) in xenvif_fix_features()
373 if (!vif->ip_csum) in xenvif_fix_features()
375 if (!vif->ipv6_csum) in xenvif_fix_features()
426 struct xenvif *vif = netdev_priv(dev); in xenvif_get_ethtool_stats() local
432 num_queues = READ_ONCE(vif->num_queues); in xenvif_get_ethtool_stats()
437 void *vif_stats = &vif->queues[queue_index].stats; in xenvif_get_ethtool_stats()
487 struct xenvif *vif; in xenvif_alloc() local
504 vif = netdev_priv(dev); in xenvif_alloc()
506 vif->domid = domid; in xenvif_alloc()
507 vif->handle = handle; in xenvif_alloc()
508 vif->can_sg = 1; in xenvif_alloc()
509 vif->ip_csum = 1; in xenvif_alloc()
510 vif->dev = dev; in xenvif_alloc()
511 vif->disabled = false; in xenvif_alloc()
512 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs); in xenvif_alloc()
513 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs); in xenvif_alloc()
516 vif->queues = NULL; in xenvif_alloc()
517 vif->num_queues = 0; in xenvif_alloc()
519 vif->xdp_headroom = 0; in xenvif_alloc()
521 spin_lock_init(&vif->lock); in xenvif_alloc()
522 INIT_LIST_HEAD(&vif->fe_mcast_addr); in xenvif_alloc()
555 return vif; in xenvif_alloc()
587 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n"); in xenvif_init_queue()
602 void xenvif_carrier_on(struct xenvif *vif) in xenvif_carrier_on() argument
605 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) in xenvif_carrier_on()
606 dev_set_mtu(vif->dev, ETH_DATA_LEN); in xenvif_carrier_on()
607 netdev_update_features(vif->dev); in xenvif_carrier_on()
608 set_bit(VIF_STATUS_CONNECTED, &vif->status); in xenvif_carrier_on()
609 if (netif_running(vif->dev)) in xenvif_carrier_on()
610 xenvif_up(vif); in xenvif_carrier_on()
614 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref, in xenvif_connect_ctrl() argument
617 struct net_device *dev = vif->dev; in xenvif_connect_ctrl()
618 struct xenbus_device *xendev = xenvif_to_xenbus_device(vif); in xenvif_connect_ctrl()
632 BACK_RING_ATTACH(&vif->ctrl, shared, rsp_prod, XEN_PAGE_SIZE); in xenvif_connect_ctrl()
635 if (req_prod - rsp_prod > RING_SIZE(&vif->ctrl)) in xenvif_connect_ctrl()
642 vif->ctrl_irq = err; in xenvif_connect_ctrl()
644 xenvif_init_hash(vif); in xenvif_connect_ctrl()
646 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn, in xenvif_connect_ctrl()
647 IRQF_ONESHOT, "xen-netback-ctrl", vif); in xenvif_connect_ctrl()
656 xenvif_deinit_hash(vif); in xenvif_connect_ctrl()
657 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_connect_ctrl()
658 vif->ctrl_irq = 0; in xenvif_connect_ctrl()
661 xenbus_unmap_ring_vfree(xendev, vif->ctrl.sring); in xenvif_connect_ctrl()
662 vif->ctrl.sring = NULL; in xenvif_connect_ctrl()
707 struct xenbus_device *dev = xenvif_to_xenbus_device(queue->vif); in xenvif_connect_data()
724 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll); in xenvif_connect_data()
787 void xenvif_carrier_off(struct xenvif *vif) in xenvif_carrier_off() argument
789 struct net_device *dev = vif->dev; in xenvif_carrier_off()
792 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) { in xenvif_carrier_off()
795 xenvif_down(vif); in xenvif_carrier_off()
800 void xenvif_disconnect_data(struct xenvif *vif) in xenvif_disconnect_data() argument
803 unsigned int num_queues = vif->num_queues; in xenvif_disconnect_data()
806 xenvif_carrier_off(vif); in xenvif_disconnect_data()
809 queue = &vif->queues[queue_index]; in xenvif_disconnect_data()
814 xenvif_mcast_addr_list_free(vif); in xenvif_disconnect_data()
817 void xenvif_disconnect_ctrl(struct xenvif *vif) in xenvif_disconnect_ctrl() argument
819 if (vif->ctrl_irq) { in xenvif_disconnect_ctrl()
820 xenvif_deinit_hash(vif); in xenvif_disconnect_ctrl()
821 unbind_from_irqhandler(vif->ctrl_irq, vif); in xenvif_disconnect_ctrl()
822 vif->ctrl_irq = 0; in xenvif_disconnect_ctrl()
825 if (vif->ctrl.sring) { in xenvif_disconnect_ctrl()
826 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), in xenvif_disconnect_ctrl()
827 vif->ctrl.sring); in xenvif_disconnect_ctrl()
828 vif->ctrl.sring = NULL; in xenvif_disconnect_ctrl()
841 void xenvif_free(struct xenvif *vif) in xenvif_free() argument
843 struct xenvif_queue *queues = vif->queues; in xenvif_free()
844 unsigned int num_queues = vif->num_queues; in xenvif_free()
847 unregister_netdev(vif->dev); in xenvif_free()
848 free_netdev(vif->dev); in xenvif_free()