Lines Matching refs:vif

70 static int xenvif_schedulable(struct xenvif *vif)
72 return netif_running(vif->dev) &&
73 test_bit(VIF_STATUS_CONNECTED, &vif->status) &&
74 !vif->disabled;
109 /* This vif is rogue, we pretend we've there is nothing to do
110 * for this vif to deschedule it from NAPI. But this interface
113 if (unlikely(queue->vif->disabled)) {
181 struct xenvif *vif = netdev_priv(dev);
182 unsigned int size = vif->hash.size;
187 num_queues = READ_ONCE(vif->num_queues);
191 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
195 xenvif_set_skb_hash(vif, skb);
200 return vif->hash.mapping[vif->hash.mapping_sel]
207 struct xenvif *vif = netdev_priv(dev);
219 num_queues = READ_ONCE(vif->num_queues);
227 index, vif->dev->name);
230 queue = &vif->queues[index];
235 !xenvif_schedulable(vif))
238 if (vif->multicast_control && skb->pkt_type == PACKET_MULTICAST) {
241 if (!xenvif_mcast_match(vif, eth->h_dest))
246 cb->expires = jiffies + vif->drain_timeout;
252 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
266 vif->dev->stats.tx_dropped++;
273 struct xenvif *vif = netdev_priv(dev);
283 num_queues = READ_ONCE(vif->num_queues);
287 queue = &vif->queues[index];
296 vif->dev->stats.rx_bytes = rx_bytes;
297 vif->dev->stats.rx_packets = rx_packets;
298 vif->dev->stats.tx_bytes = tx_bytes;
299 vif->dev->stats.tx_packets = tx_packets;
301 return &vif->dev->stats;
304 static void xenvif_up(struct xenvif *vif)
307 unsigned int num_queues = vif->num_queues;
311 queue = &vif->queues[queue_index];
320 static void xenvif_down(struct xenvif *vif)
323 unsigned int num_queues = vif->num_queues;
327 queue = &vif->queues[queue_index];
338 struct xenvif *vif = netdev_priv(dev);
339 if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
340 xenvif_up(vif);
347 struct xenvif *vif = netdev_priv(dev);
348 if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
349 xenvif_down(vif);
356 struct xenvif *vif = netdev_priv(dev);
357 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN;
368 struct xenvif *vif = netdev_priv(dev);
370 if (!vif->can_sg)
372 if (~(vif->gso_mask) & GSO_BIT(TCPV4))
374 if (~(vif->gso_mask) & GSO_BIT(TCPV6))
376 if (!vif->ip_csum)
378 if (!vif->ipv6_csum)
429 struct xenvif *vif = netdev_priv(dev);
435 num_queues = READ_ONCE(vif->num_queues);
440 void *vif_stats = &vif->queues[queue_index].stats;
490 struct xenvif *vif;
493 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle);
507 vif = netdev_priv(dev);
509 vif->domid = domid;
510 vif->handle = handle;
511 vif->can_sg = 1;
512 vif->ip_csum = 1;
513 vif->dev = dev;
514 vif->disabled = false;
515 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs);
516 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs);
519 vif->queues = NULL;
520 vif->num_queues = 0;
522 vif->xdp_headroom = 0;
524 spin_lock_init(&vif->lock);
525 INIT_LIST_HEAD(&vif->fe_mcast_addr);
558 return vif;
590 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n");
605 void xenvif_carrier_on(struct xenvif *vif)
608 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN)
609 dev_set_mtu(vif->dev, ETH_DATA_LEN);
610 netdev_update_features(vif->dev);
611 set_bit(VIF_STATUS_CONNECTED, &vif->status);
612 if (netif_running(vif->dev))
613 xenvif_up(vif);
617 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
620 struct net_device *dev = vif->dev;
621 struct xenbus_device *xendev = xenvif_to_xenbus_device(vif);
635 BACK_RING_ATTACH(&vif->ctrl, shared, rsp_prod, XEN_PAGE_SIZE);
638 if (req_prod - rsp_prod > RING_SIZE(&vif->ctrl))
645 vif->ctrl_irq = err;
647 xenvif_init_hash(vif);
649 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn,
650 IRQF_ONESHOT, "xen-netback-ctrl", vif);
659 xenvif_deinit_hash(vif);
660 unbind_from_irqhandler(vif->ctrl_irq, vif);
661 vif->ctrl_irq = 0;
664 xenbus_unmap_ring_vfree(xendev, vif->ctrl.sring);
665 vif->ctrl.sring = NULL;
709 struct xenbus_device *dev = xenvif_to_xenbus_device(queue->vif);
726 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll);
789 void xenvif_carrier_off(struct xenvif *vif)
791 struct net_device *dev = vif->dev;
794 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) {
797 xenvif_down(vif);
802 void xenvif_disconnect_data(struct xenvif *vif)
805 unsigned int num_queues = vif->num_queues;
808 xenvif_carrier_off(vif);
811 queue = &vif->queues[queue_index];
816 xenvif_mcast_addr_list_free(vif);
819 void xenvif_disconnect_ctrl(struct xenvif *vif)
821 if (vif->ctrl_irq) {
822 xenvif_deinit_hash(vif);
823 unbind_from_irqhandler(vif->ctrl_irq, vif);
824 vif->ctrl_irq = 0;
827 if (vif->ctrl.sring) {
828 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif),
829 vif->ctrl.sring);
830 vif->ctrl.sring = NULL;
843 void xenvif_free(struct xenvif *vif)
845 struct xenvif_queue *queues = vif->queues;
846 unsigned int num_queues = vif->num_queues;
849 unregister_netdev(vif->dev);
850 free_netdev(vif->dev);