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)
263 vif->dev->stats.tx_dropped++;
270 struct xenvif *vif = netdev_priv(dev);
280 num_queues = READ_ONCE(vif->num_queues);
284 queue = &vif->queues[index];
293 vif->dev->stats.rx_bytes = rx_bytes;
294 vif->dev->stats.rx_packets = rx_packets;
295 vif->dev->stats.tx_bytes = tx_bytes;
296 vif->dev->stats.tx_packets = tx_packets;
298 return &vif->dev->stats;
301 static void xenvif_up(struct xenvif *vif)
304 unsigned int num_queues = vif->num_queues;
308 queue = &vif->queues[queue_index];
317 static void xenvif_down(struct xenvif *vif)
320 unsigned int num_queues = vif->num_queues;
324 queue = &vif->queues[queue_index];
335 struct xenvif *vif = netdev_priv(dev);
336 if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
337 xenvif_up(vif);
344 struct xenvif *vif = netdev_priv(dev);
345 if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
346 xenvif_down(vif);
353 struct xenvif *vif = netdev_priv(dev);
354 int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN;
365 struct xenvif *vif = netdev_priv(dev);
367 if (!vif->can_sg)
369 if (~(vif->gso_mask) & GSO_BIT(TCPV4))
371 if (~(vif->gso_mask) & GSO_BIT(TCPV6))
373 if (!vif->ip_csum)
375 if (!vif->ipv6_csum)
426 struct xenvif *vif = netdev_priv(dev);
432 num_queues = READ_ONCE(vif->num_queues);
437 void *vif_stats = &vif->queues[queue_index].stats;
487 struct xenvif *vif;
490 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle);
504 vif = netdev_priv(dev);
506 vif->domid = domid;
507 vif->handle = handle;
508 vif->can_sg = 1;
509 vif->ip_csum = 1;
510 vif->dev = dev;
511 vif->disabled = false;
512 vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs);
513 vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs);
516 vif->queues = NULL;
517 vif->num_queues = 0;
519 vif->xdp_headroom = 0;
521 spin_lock_init(&vif->lock);
522 INIT_LIST_HEAD(&vif->fe_mcast_addr);
555 return vif;
587 netdev_err(queue->vif->dev, "Could not reserve mmap_pages\n");
602 void xenvif_carrier_on(struct xenvif *vif)
605 if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN)
606 dev_set_mtu(vif->dev, ETH_DATA_LEN);
607 netdev_update_features(vif->dev);
608 set_bit(VIF_STATUS_CONNECTED, &vif->status);
609 if (netif_running(vif->dev))
610 xenvif_up(vif);
614 int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
617 struct net_device *dev = vif->dev;
618 struct xenbus_device *xendev = xenvif_to_xenbus_device(vif);
632 BACK_RING_ATTACH(&vif->ctrl, shared, rsp_prod, XEN_PAGE_SIZE);
635 if (req_prod - rsp_prod > RING_SIZE(&vif->ctrl))
642 vif->ctrl_irq = err;
644 xenvif_init_hash(vif);
646 err = request_threaded_irq(vif->ctrl_irq, NULL, xenvif_ctrl_irq_fn,
647 IRQF_ONESHOT, "xen-netback-ctrl", vif);
656 xenvif_deinit_hash(vif);
657 unbind_from_irqhandler(vif->ctrl_irq, vif);
658 vif->ctrl_irq = 0;
661 xenbus_unmap_ring_vfree(xendev, vif->ctrl.sring);
662 vif->ctrl.sring = NULL;
707 struct xenbus_device *dev = xenvif_to_xenbus_device(queue->vif);
724 netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll);
787 void xenvif_carrier_off(struct xenvif *vif)
789 struct net_device *dev = vif->dev;
792 if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) {
795 xenvif_down(vif);
800 void xenvif_disconnect_data(struct xenvif *vif)
803 unsigned int num_queues = vif->num_queues;
806 xenvif_carrier_off(vif);
809 queue = &vif->queues[queue_index];
814 xenvif_mcast_addr_list_free(vif);
817 void xenvif_disconnect_ctrl(struct xenvif *vif)
819 if (vif->ctrl_irq) {
820 xenvif_deinit_hash(vif);
821 unbind_from_irqhandler(vif->ctrl_irq, vif);
822 vif->ctrl_irq = 0;
825 if (vif->ctrl.sring) {
826 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif),
827 vif->ctrl.sring);
828 vif->ctrl.sring = NULL;
841 void xenvif_free(struct xenvif *vif)
843 struct xenvif_queue *queues = vif->queues;
844 unsigned int num_queues = vif->num_queues;
847 unregister_netdev(vif->dev);
848 free_netdev(vif->dev);