Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1481400

[RFC V3 PATCH 14/26] net/netpolicy: handle channel changes

From kan.liang@intel.com
Newsgroups linux.kernel
Subject [RFC V3 PATCH 14/26] net/netpolicy: handle channel changes
Date 2016-09-12 17:10 +0200
Message-ID <sgB1U-4WE-29@gated-at.bofh.it> (permalink)
References <sgASd-4DC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kan Liang <kan.liang@intel.com>

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 <kan.liang@intel.com>
---
 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 f60331d..d6ba9f6 100644
--- a/include/linux/netpolicy.h
+++ b/include/linux/netpolicy.h
@@ -80,4 +80,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 3bf0a44..a739ac7 100644
--- a/net/core/netpolicy.c
+++ b/net/core/netpolicy.c
@@ -893,6 +893,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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC V3 PATCH 00/26] Kernel NET policy kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 26/26] Documentation/networking: Document NET policy kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 05/26] net/netpolicy: create CPU and queue mapping kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 22/26] net/netpolicy: set per task policy by proc kan.liang@intel.com - 2016-09-12 17:00 +0200
    Re: [RFC V3 PATCH 22/26] net/netpolicy: set per task policy by proc Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-09-12 19:10 +0200
  [RFC V3 PATCH 08/26] net/netpolicy: introduce NET policy object kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 21/26] net/netpolicy: introduce per task net policy kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 24/26] net/netpolicy: optimize for queue pair kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 20/26] net/netpolicy: set Rx queues according to policy kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 25/26] net/netpolicy: limit the total record number kan.liang@intel.com - 2016-09-12 17:00 +0200
  [RFC V3 PATCH 10/26] net/netpolicy: add three new NET policies kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 09/26] net/netpolicy: set NET policy by policy name kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 18/26] net/netpolicy: set tx queues according to policy kan.liang@intel.com - 2016-09-12 17:10 +0200
    Re: [RFC V3 PATCH 18/26] net/netpolicy: set tx queues according to policy Tom Herbert <tom@herbertland.com> - 2016-09-12 22:30 +0200
      RE: [RFC V3 PATCH 18/26] net/netpolicy: set tx queues according to  policy "Liang, Kan" <kan.liang@intel.com> - 2016-09-13 14:30 +0200
  [RFC V3 PATCH 02/26] net/netpolicy: init NET policy kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 01/26] net: introduce NET policy kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 14/26] net/netpolicy: handle channel changes kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 13/26] net/netpolicy: support CPU hotplug kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 11/26] net/netpolicy: add MIX policy kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 17/26] net/netpolicy: introduce netpolicy_pick_queue kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 03/26] net/netpolicy: get device queue irq information kan.liang@intel.com - 2016-09-12 17:10 +0200
    Re: [RFC V3 PATCH 03/26] net/netpolicy: get device queue irq  information Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-09-12 18:50 +0200
      RE: [RFC V3 PATCH 03/26] net/netpolicy: get device queue irq  information "Liang, Kan" <kan.liang@intel.com> - 2016-09-13 14:30 +0200
        Re: [RFC V3 PATCH 03/26] net/netpolicy: get device queue irq information Alexander Duyck <alexander.duyck@gmail.com> - 2016-09-13 15:20 +0200
          RE: [RFC V3 PATCH 03/26] net/netpolicy: get device queue irq  information "Liang, Kan" <kan.liang@intel.com> - 2016-09-13 15:30 +0200
  [RFC V3 PATCH 15/26] net/netpolicy: implement netpolicy register kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 19/26] net/netpolicy: tc bpf extension to pick Tx queue kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 12/26] net/netpolicy: NET device hotplug kan.liang@intel.com - 2016-09-12 17:10 +0200
  [RFC V3 PATCH 04/26] net/netpolicy: get CPU information kan.liang@intel.com - 2016-09-12 17:10 +0200
  Re: [RFC V3 PATCH 00/26] Kernel NET policy Florian Westphal <fw@strlen.de> - 2016-09-12 17:40 +0200
    Re: [RFC V3 PATCH 00/26] Kernel NET policy Cong Wang <xiyou.wangcong@gmail.com> - 2016-09-12 19:30 +0200
  Re: [RFC V3 PATCH 00/26] Kernel NET policy Eric Dumazet <eric.dumazet@gmail.com> - 2016-09-12 18:00 +0200
    Re: [RFC V3 PATCH 00/26] Kernel NET policy Stephen Hemminger <stephen@networkplumber.org> - 2016-09-19 22:40 +0200

csiph-web