From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965845AbcHDTg5 (ORCPT ); Thu, 4 Aug 2016 15:36:57 -0400 Received: from mga09.intel.com ([134.134.136.24]:57313 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965745AbcHDTgx (ORCPT ); Thu, 4 Aug 2016 15:36:53 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,471,1464678000"; d="scan'208";a="1019815815" From: kan.liang@intel.com To: davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, akpm@linux-foundation.org, keescook@chromium.org, viro@zeniv.linux.org.uk, gorcunov@openvz.org, john.stultz@linaro.org, aduyck@mirantis.com, ben@decadent.org.uk, decot@googlers.com, fw@strlen.de, alexander.duyck@gmail.com, daniel@iogearbox.net, tom@herbertland.com, rdunlap@infradead.org, xiyou.wangcong@gmail.com, hannes@stressinduktion.org, jesse.brandeburg@intel.com, andi@firstfloor.org, Kan Liang Subject: [RFC V2 PATCH 14/25] net/netpolicy: handle channel changes Date: Thu, 4 Aug 2016 15:36:18 -0400 Message-Id: <1470339389-8542-15-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1470339389-8542-1-git-send-email-kan.liang@intel.com> References: <1470339389-8542-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang User can uses ethtool to set the channel number. This patch handles the channel changes by rebuilding the object list. Signed-off-by: Kan Liang --- include/linux/netpolicy.h | 8 ++++++++ net/core/ethtool.c | 8 +++++++- net/core/netpolicy.c | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/linux/netpolicy.h b/include/linux/netpolicy.h index 579ff98..cc75e3c 100644 --- a/include/linux/netpolicy.h +++ b/include/linux/netpolicy.h @@ -79,4 +79,12 @@ struct netpolicy_info { struct list_head obj_list[NETPOLICY_RXTX][NET_POLICY_MAX]; }; +#ifdef CONFIG_NETPOLICY +extern void update_netpolicy_sys_map(void); +#else +static inline void update_netpolicy_sys_map(void) +{ +} +#endif + #endif /*__LINUX_NETPOLICY_H*/ diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 9774898..e1f8bd0 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -1703,6 +1703,7 @@ static noinline_for_stack int ethtool_set_channels(struct net_device *dev, { struct ethtool_channels channels, max; u32 max_rx_in_use = 0; + int ret; if (!dev->ethtool_ops->set_channels || !dev->ethtool_ops->get_channels) return -EOPNOTSUPP; @@ -1726,7 +1727,12 @@ static noinline_for_stack int ethtool_set_channels(struct net_device *dev, (channels.combined_count + channels.rx_count) <= max_rx_in_use) return -EINVAL; - return dev->ethtool_ops->set_channels(dev, &channels); + ret = dev->ethtool_ops->set_channels(dev, &channels); +#ifdef CONFIG_NETPOLICY + if (!ret) + update_netpolicy_sys_map(); +#endif + return ret; } static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) diff --git a/net/core/netpolicy.c b/net/core/netpolicy.c index 3b523fc..7579685 100644 --- a/net/core/netpolicy.c +++ b/net/core/netpolicy.c @@ -885,6 +885,7 @@ unlock: } } } +EXPORT_SYMBOL(update_netpolicy_sys_map); static int netpolicy_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) -- 2.5.5