aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-03-27 18:36:38 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-29 17:58:37 -0400
commita8779ec1c5e60548b7b661a8d74a8cecf7775690 (patch)
tree26c3e8d991b42c16f48c99e4f9fd117233ae8b21 /net/bridge
parent3f705f73a0ab345321ef6e5a293c04bf7e9df818 (diff)
netpoll: Remove gfp parameter from __netpoll_setup
The gfp parameter was added in: commit 47be03a28cc6c80e3aa2b3e8ed6d960ff0c5c0af Author: Amerigo Wang <amwang@redhat.com> Date: Fri Aug 10 01:24:37 2012 +0000 netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup() slave_enable_netpoll() and __netpoll_setup() may be called with read_lock() held, so should use GFP_ATOMIC to allocate memory. Eric suggested to pass gfp flags to __netpoll_setup(). Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> The reason for the gfp parameter was removed in: commit c4cdef9b7183159c23c7302aaf270d64c549f557 Author: dingtianhong <dingtianhong@huawei.com> Date: Tue Jul 23 15:25:27 2013 +0800 bonding: don't call slave_xxx_netpoll under spinlocks The slave_xxx_netpoll will call synchronize_rcu_bh(), so the function may schedule and sleep, it should't be called under spinlocks. bond_netpoll_setup() and bond_netpoll_cleanup() are always protected by rtnl lock, it is no need to take the read lock, as the slave list couldn't be changed outside rtnl lock. Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Cc: Jay Vosburgh <fubar@us.ibm.com> Cc: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@davemloft.net> Nothing else that calls __netpoll_setup or ndo_netpoll_setup requires a gfp paramter, so remove the gfp parameter from both of these functions making the code clearer. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_device.c15
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/bridge/br_private.h4
3 files changed, 10 insertions, 11 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f2a08477e0f5..0dd01a05bd59 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -218,16 +218,16 @@ static void br_netpoll_cleanup(struct net_device *dev)
218 br_netpoll_disable(p); 218 br_netpoll_disable(p);
219} 219}
220 220
221static int __br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) 221static int __br_netpoll_enable(struct net_bridge_port *p)
222{ 222{
223 struct netpoll *np; 223 struct netpoll *np;
224 int err; 224 int err;
225 225
226 np = kzalloc(sizeof(*p->np), gfp); 226 np = kzalloc(sizeof(*p->np), GFP_KERNEL);
227 if (!np) 227 if (!np)
228 return -ENOMEM; 228 return -ENOMEM;
229 229
230 err = __netpoll_setup(np, p->dev, gfp); 230 err = __netpoll_setup(np, p->dev);
231 if (err) { 231 if (err) {
232 kfree(np); 232 kfree(np);
233 return err; 233 return err;
@@ -237,16 +237,15 @@ static int __br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
237 return err; 237 return err;
238} 238}
239 239
240int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) 240int br_netpoll_enable(struct net_bridge_port *p)
241{ 241{
242 if (!p->br->dev->npinfo) 242 if (!p->br->dev->npinfo)
243 return 0; 243 return 0;
244 244
245 return __br_netpoll_enable(p, gfp); 245 return __br_netpoll_enable(p);
246} 246}
247 247
248static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, 248static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
249 gfp_t gfp)
250{ 249{
251 struct net_bridge *br = netdev_priv(dev); 250 struct net_bridge *br = netdev_priv(dev);
252 struct net_bridge_port *p; 251 struct net_bridge_port *p;
@@ -255,7 +254,7 @@ static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni,
255 list_for_each_entry(p, &br->port_list, list) { 254 list_for_each_entry(p, &br->port_list, list) {
256 if (!p->dev) 255 if (!p->dev)
257 continue; 256 continue;
258 err = __br_netpoll_enable(p, gfp); 257 err = __br_netpoll_enable(p);
259 if (err) 258 if (err)
260 goto fail; 259 goto fail;
261 } 260 }
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 54d207d3a31c..5262b8617eb9 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,7 +366,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 if (err) 366 if (err)
367 goto err2; 367 goto err2;
368 368
369 err = br_netpoll_enable(p, GFP_KERNEL); 369 err = br_netpoll_enable(p);
370 if (err) 370 if (err)
371 goto err3; 371 goto err3;
372 372
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index e1ca1dc916a4..06811d79f89f 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -349,7 +349,7 @@ static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
349 netpoll_send_skb(np, skb); 349 netpoll_send_skb(np, skb);
350} 350}
351 351
352int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp); 352int br_netpoll_enable(struct net_bridge_port *p);
353void br_netpoll_disable(struct net_bridge_port *p); 353void br_netpoll_disable(struct net_bridge_port *p);
354#else 354#else
355static inline void br_netpoll_send_skb(const struct net_bridge_port *p, 355static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
@@ -357,7 +357,7 @@ static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
357{ 357{
358} 358}
359 359
360static inline int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) 360static inline int br_netpoll_enable(struct net_bridge_port *p)
361{ 361{
362 return 0; 362 return 0;
363} 363}