Lines Matching defs:dev
31 * @dev: netdev pointer
43 struct net_device *dev;
133 udp_tunnel_nic_is_empty(struct net_device *dev, struct udp_tunnel_nic *utn)
135 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
146 udp_tunnel_nic_should_replay(struct net_device *dev, struct udp_tunnel_nic *utn)
155 table = &dev->udp_tunnel_nic_info->tables[i];
168 __udp_tunnel_nic_get_port(struct net_device *dev, unsigned int table,
174 utn = dev->udp_tunnel_nic;
182 __udp_tunnel_nic_set_port_priv(struct net_device *dev, unsigned int table,
185 dev->udp_tunnel_nic->entries[table][idx].hw_priv = priv;
212 udp_tunnel_nic_device_sync_one(struct net_device *dev,
226 err = dev->udp_tunnel_nic_info->set_port(dev, table, idx, &ti);
228 err = dev->udp_tunnel_nic_info->unset_port(dev, table, idx,
233 netdev_warn(dev,
241 udp_tunnel_nic_device_sync_by_port(struct net_device *dev,
244 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
249 udp_tunnel_nic_device_sync_one(dev, utn, i, j);
253 udp_tunnel_nic_device_sync_by_table(struct net_device *dev,
256 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
268 err = info->sync_table(dev, i);
270 netdev_warn(dev, "UDP tunnel port sync failed for table %d: %d\n",
284 __udp_tunnel_nic_device_sync(struct net_device *dev, struct udp_tunnel_nic *utn)
289 if (dev->udp_tunnel_nic_info->sync_table)
290 udp_tunnel_nic_device_sync_by_table(dev, utn);
292 udp_tunnel_nic_device_sync_by_port(dev, utn);
298 utn->need_replay = udp_tunnel_nic_should_replay(dev, utn);
302 udp_tunnel_nic_device_sync(struct net_device *dev, struct udp_tunnel_nic *utn)
319 udp_tunnel_nic_is_capable(struct net_device *dev, struct udp_tunnel_nic *utn,
322 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
337 udp_tunnel_nic_has_collision(struct net_device *dev, struct udp_tunnel_nic *utn,
340 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
421 udp_tunnel_nic_try_existing(struct net_device *dev, struct udp_tunnel_nic *utn,
428 table = &dev->udp_tunnel_nic_info->tables[i];
442 udp_tunnel_nic_add_existing(struct net_device *dev, struct udp_tunnel_nic *utn,
445 return udp_tunnel_nic_try_existing(dev, utn, ti, +1);
449 udp_tunnel_nic_del_existing(struct net_device *dev, struct udp_tunnel_nic *utn,
452 return udp_tunnel_nic_try_existing(dev, utn, ti, -1);
456 udp_tunnel_nic_add_new(struct net_device *dev, struct udp_tunnel_nic *utn,
463 table = &dev->udp_tunnel_nic_info->tables[i];
493 __udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti)
495 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
498 utn = dev->udp_tunnel_nic;
501 if (!netif_running(dev) && info->flags & UDP_TUNNEL_NIC_INFO_OPEN_ONLY)
506 netdev_warn(dev, "device assumes port 4789 will be used by vxlan tunnels\n");
510 if (!udp_tunnel_nic_is_capable(dev, utn, ti))
517 if (udp_tunnel_nic_has_collision(dev, utn, ti))
520 if (!udp_tunnel_nic_add_existing(dev, utn, ti))
521 udp_tunnel_nic_add_new(dev, utn, ti);
523 udp_tunnel_nic_device_sync(dev, utn);
527 __udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti)
531 utn = dev->udp_tunnel_nic;
535 if (!udp_tunnel_nic_is_capable(dev, utn, ti))
538 udp_tunnel_nic_del_existing(dev, utn, ti);
540 udp_tunnel_nic_device_sync(dev, utn);
543 static void __udp_tunnel_nic_reset_ntf(struct net_device *dev)
545 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
549 utn = dev->udp_tunnel_nic;
573 __udp_tunnel_nic_device_sync(dev, utn);
579 __udp_tunnel_nic_dump_size(struct net_device *dev, unsigned int table)
581 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
586 utn = dev->udp_tunnel_nic;
604 __udp_tunnel_nic_dump_write(struct net_device *dev, unsigned int table,
607 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
612 utn = dev->udp_tunnel_nic;
640 static void __udp_tunnel_nic_assert_locked(struct net_device *dev)
644 utn = dev->udp_tunnel_nic;
649 static void __udp_tunnel_nic_lock(struct net_device *dev)
653 utn = dev->udp_tunnel_nic;
658 static void __udp_tunnel_nic_unlock(struct net_device *dev)
662 utn = dev->udp_tunnel_nic;
681 udp_tunnel_nic_flush(struct net_device *dev, struct udp_tunnel_nic *utn)
683 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
694 __udp_tunnel_nic_device_sync(dev, utn);
704 udp_tunnel_nic_replay(struct net_device *dev, struct udp_tunnel_nic *utn)
706 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
720 udp_tunnel_get_rx_info(dev);
723 udp_tunnel_get_rx_info(node->dev);
740 __udp_tunnel_nic_device_sync(utn->dev, utn);
743 udp_tunnel_nic_replay(utn->dev, utn);
788 static int udp_tunnel_nic_register(struct net_device *dev)
790 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
827 node->dev = dev;
849 utn->dev = dev;
850 dev_hold(dev);
851 dev->udp_tunnel_nic = utn;
854 udp_tunnel_nic_lock(dev);
855 udp_tunnel_get_rx_info(dev);
856 udp_tunnel_nic_unlock(dev);
863 udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn)
865 const struct udp_tunnel_nic_info *info = dev->udp_tunnel_nic_info;
867 udp_tunnel_nic_lock(dev);
869 /* For a shared table remove this dev from the list of sharing devices
876 if (node->dev == dev)
879 udp_tunnel_nic_unlock(dev);
889 udp_tunnel_drop_rx_info(dev);
890 utn->dev = first->dev;
891 udp_tunnel_nic_unlock(dev);
901 udp_tunnel_nic_flush(dev, utn);
902 udp_tunnel_nic_unlock(dev);
912 dev->udp_tunnel_nic = NULL;
913 dev_put(dev);
920 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
924 info = dev->udp_tunnel_nic_info;
931 err = udp_tunnel_nic_register(dev);
933 netdev_warn(dev, "failed to register for UDP tunnel offloads: %d", err);
937 utn = dev->udp_tunnel_nic;
942 udp_tunnel_nic_unregister(dev, utn);
951 udp_tunnel_nic_lock(dev);
952 WARN_ON(!udp_tunnel_nic_is_empty(dev, utn));
953 udp_tunnel_get_rx_info(dev);
954 udp_tunnel_nic_unlock(dev);
958 udp_tunnel_nic_lock(dev);
959 udp_tunnel_nic_flush(dev, utn);
960 udp_tunnel_nic_unlock(dev);