[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452352052-27574-11-git-send-email-hannes@stressinduktion.org>
Date: Sat, 9 Jan 2016 16:07:32 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: netdev@...r.kernel.org
Cc: jesse@...nel.org
Subject: [PATCH net-next v4 10/10] netdev: update comments and explain idempotency and rtnl locking
Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
---
include/linux/netdevice.h | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4d93d474f1cd44..0dc3e4617db6ef 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1006,31 +1006,36 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
* not implement this, it is assumed that the hw is not able to have
* multiple net devices on single physical port.
*
+ * *** Offloading callbacks: ***
+ *
+ * Notify drivers about a new type of offloading being requested
+ * or removed from the driver. The type is based on the function
+ * name, sa_family distinguishes between ipv4 and ipv6 and the
+ * corresponding port number (for now only being UDP tunnel
+ * protocol numbers) is signaled down to the driver.
+ *
+ * Calls into the offloading callback functions are always done
+ * with rtnl_lock held.
+ *
+ * Further more, the callbacks can happen multiple times for the
+ * same primitive to be installed, so it is forbidden to use
+ * reference counting on the {offload_type, sa_family, port}
+ * tuple because the driver might see multiple calls to those
+ * functions for one installed primitive.
+ *
+ * If the driver wants to get the current ports reprogrammed it
+ * can simply call netdev_refresh_offloads with rtnl_lock held.
+ *
* void (*ndo_add_vxlan_port)(struct net_device *dev,
* sa_family_t sa_family, __be16 port);
- * Called by vxlan to notiy a driver about the UDP port and socket
- * address family that vxlan is listnening to. It is called only when
- * a new port starts listening. The operation is protected by the
- * vxlan_net->sock_lock.
- *
* void (*ndo_add_geneve_port)(struct net_device *dev,
* sa_family_t sa_family, __be16 port);
- * Called by geneve to notify a driver about the UDP port and socket
- * address family that geneve is listnening to. It is called only when
- * a new port starts listening. The operation is protected by the
- * geneve_net->sock_lock.
- *
* void (*ndo_del_geneve_port)(struct net_device *dev,
* sa_family_t sa_family, __be16 port);
- * Called by geneve to notify the driver about a UDP port and socket
- * address family that geneve is not listening to anymore. The operation
- * is protected by the geneve_net->sock_lock.
- *
* void (*ndo_del_vxlan_port)(struct net_device *dev,
* sa_family_t sa_family, __be16 port);
- * Called by vxlan to notify the driver about a UDP port and socket
- * address family that vxlan is not listening to anymore. The operation
- * is protected by the vxlan_net->sock_lock.
+ *
+ *
*
* void* (*ndo_dfwd_add_station)(struct net_device *pdev,
* struct net_device *dev)
@@ -2224,6 +2229,7 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
+/* Obviously the driver needs to hold rtnl_lock while calling this function. */
static inline void netdev_refresh_offloads(struct net_device *netdev)
{
call_netdevice_notifiers(NETDEV_REFRESH_OFFLOADS, netdev);
--
2.5.0
Powered by blists - more mailing lists