From patchwork Sat Jan 9 15:07:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Frederic Sowa X-Patchwork-Id: 565177 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F891140779 for ; Sun, 10 Jan 2016 02:08:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=stressinduktion.org header.i=@stressinduktion.org header.b=LD+z0ug3; dkim=pass (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=MXijtVkq; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755376AbcAIPIE (ORCPT ); Sat, 9 Jan 2016 10:08:04 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44937 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754705AbcAIPHy (ORCPT ); Sat, 9 Jan 2016 10:07:54 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A547820A45 for ; Sat, 9 Jan 2016 10:07:53 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 09 Jan 2016 10:07:53 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= stressinduktion.org; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=0Lm9G mjPeFFG26g6w09AFXCcals=; b=LD+z0ug3qnqsqGcGnNapMdazLLR+MgKU3c8Vv ngqVfY5T1eou5t1CcwKCjYQeW03RvQCvOkeYu8Rlh6hAI4we8eJuXy9RmRQOEnik E/yu5YTy4hlBxHiNHsFNGaqGqE7xuAPTttl22dUfGqGOeYrvcu+/bbTaPmJlOHOM Sn1OiY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=0Lm9 GmjPeFFG26g6w09AFXCcals=; b=MXijtVkqBBEpTmLgM7UODetUNl9Tj8hjp+Uc 9hyf9MWkPW00wedeEzXlKDun9POeeJsr/e+Af+FYw+TF26VV8ewQCBc3cHylBdRg e8DREg+hRe2hvuOxfLS1jl+aPd4IlYHYvF08i3xz9CWFi8+YSIjtvldcC2VlLiP8 9NLWsas= X-Sasl-enc: okmi3ShJS+u+RlThAG18moZBYmI9qsKRR9et+SafkomO 1452352073 Received: from z.localhost.localdomain (unknown [213.55.176.146]) by mail.messagingengine.com (Postfix) with ESMTPA id BFF20C016C4; Sat, 9 Jan 2016 10:07:52 -0500 (EST) From: Hannes Frederic Sowa To: netdev@vger.kernel.org Cc: jesse@kernel.org Subject: [PATCH net-next v4 10/10] netdev: update comments and explain idempotency and rtnl locking Date: Sat, 9 Jan 2016 16:07:32 +0100 Message-Id: <1452352052-27574-11-git-send-email-hannes@stressinduktion.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452352052-27574-1-git-send-email-hannes@stressinduktion.org> References: <1452352052-27574-1-git-send-email-hannes@stressinduktion.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Hannes Frederic Sowa --- 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);