From patchwork Mon Feb 1 22:32:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salam Noureddine X-Patchwork-Id: 576731 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 178FC140BCB for ; Tue, 2 Feb 2016 09:33:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=arista.com header.i=@arista.com header.b=LOqshqLe; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932118AbcBAWdN (ORCPT ); Mon, 1 Feb 2016 17:33:13 -0500 Received: from prod-mx.aristanetworks.com ([162.210.130.12]:14835 "EHLO prod-mx.aristanetworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752203AbcBAWdM (ORCPT ); Mon, 1 Feb 2016 17:33:12 -0500 Received: from bs341.sjc.aristanetworks.com (bs341.sjc.aristanetworks.com [172.20.10.4]) by prod-mx.aristanetworks.com (Postfix) with ESMTP id E5D26A5B; Mon, 1 Feb 2016 14:33:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=AristaCom; t=1454365991; bh=N8FZTVhtvDak8FvRUScNu4am3Zq/hoNo9w6WUGqIXTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LOqshqLeni9iybLmn4b5spSA15VRn/LqmAFIcOw6UVE3/o7YsNPUHWvZ/uAHbWZDk bMiDljPUrfLOMZ4FQXOJk92XwsAW3y3whmNCDv68Mx1LOtpsIornpZPQtAOOtkhyys bWH0EygnSkWYSYEECB7qT5UXz49FYkpGbZm7AtCE= Received: by bs341.sjc.aristanetworks.com (Postfix, from userid 10510) id D72812AE0003; Mon, 1 Feb 2016 14:33:11 -0800 (PST) From: Salam Noureddine To: "David S. Miller" , Eric Dumazet , Jiri Pirko , Alexei Starovoitov , Daniel Borkmann , "Eric W. Biederman" , netdev@vger.kernel.org Cc: Salam Noureddine Subject: [PATCH net-next 1/4] net: add event_list to struct net and provide utility functions Date: Mon, 1 Feb 2016 14:32:29 -0800 Message-Id: <1454365952-10324-2-git-send-email-noureddine@arista.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1454365952-10324-1-git-send-email-noureddine@arista.com> References: <1454365952-10324-1-git-send-email-noureddine@arista.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Salam Noureddine --- include/net/net_namespace.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 4089abc..4cf47de 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -58,6 +58,7 @@ struct net { struct list_head list; /* list of network namespaces */ struct list_head cleanup_list; /* namespaces on death row */ struct list_head exit_list; /* Use only net_mutex */ + struct list_head event_list; /* net_device notifier list */ struct user_namespace *user_ns; /* Owning user namespace */ spinlock_t nsid_lock; @@ -380,4 +381,25 @@ static inline void fnhe_genid_bump(struct net *net) atomic_inc(&net->fnhe_genid); } +#ifdef CONFIG_NET_NS +static inline void net_add_event_list(struct list_head *head, struct net *net) +{ + if (!list_empty(&net->event_list)) + list_add_tail(&net->event_list, head); +} + +static inline void net_del_event_list(struct net *net) +{ + list_del_init(&net->event_list); +} +#else +static inline void net_add_event_list(struct list_head *head, struct net *net) +{ +} + +static inline void net_del_event_list(struct net *net) +{ +} +#endif + #endif /* __NET_NET_NAMESPACE_H */