From patchwork Mon Jan 11 12:17:31 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: 565785 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 B09AE1402DE for ; Mon, 11 Jan 2016 23:17:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=stressinduktion.org header.i=@stressinduktion.org header.b=hvQPEoRe; dkim=pass (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=al00V3u6; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759615AbcAKMRy (ORCPT ); Mon, 11 Jan 2016 07:17:54 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43732 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932849AbcAKMRs (ORCPT ); Mon, 11 Jan 2016 07:17:48 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A19DA20915 for ; Mon, 11 Jan 2016 07:17:47 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 11 Jan 2016 07:17:47 -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=M4fwf xXQxW//3uxj3DodHIFqgds=; b=hvQPEoRe7v7/nSHgwNYhkZSueVqpVkCTiIy84 anhDDTC6GUuRvF1y8bec79zyUy4yRsl8njObh1v34B0uYSyK98ddg9Q8WHZpSeKM uvXiM4jOFNVafmPjFduZ9UUQ7N92+rpmzmmdIOiyTV2tVutU8nIYLMHpBR2HkzM1 svf9ro= 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=M4fw fxXQxW//3uxj3DodHIFqgds=; b=al00V3u6obJFpf7eurPxkUmTGA4u0rcbG8OD yBL6RHfTP5bNVpeaqdPBdmYgK/5XAf5ASgdhkC3FR+PRBQqk3ul+hA5sHpiJgJLB AzhZqBTFeYOnxhW6GSANe5ZzhCTH9Z/TApxJgjkMYfFT2OsjjfpxSP8w+sybvy2U urU7yJM= X-Sasl-enc: 0u5cKv7pqXziVeYHcxUejb+GLG+bwGrcf4RZjSVfaFqj 1452514667 Received: from z.localhost.localdomain (unknown [217.192.177.51]) by mail.messagingengine.com (Postfix) with ESMTPA id 16737C00017; Mon, 11 Jan 2016 07:17:46 -0500 (EST) From: Hannes Frederic Sowa To: netdev@vger.kernel.org Cc: jesse@kernel.org Subject: [PATCH net-next v5 10/10] netdev: update comments and explain idempotency and rtnl locking Date: Mon, 11 Jan 2016 13:17:31 +0100 Message-Id: <1452514651-15445-11-git-send-email-hannes@stressinduktion.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452514651-15445-1-git-send-email-hannes@stressinduktion.org> References: <1452514651-15445-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 8a2456498a6c9f..ff8b4795663d33 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) @@ -2226,6 +2231,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);