* [PATCH 03/12] econet: Reduce switch/case indent
From: Joe Perches @ 2011-07-01 19:43 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev
In-Reply-To: <cover.1309549243.git.joe@perches.com>
Make the case labels the same indent as the switch.
Simplify a default case / return (unreached)
Remove unnecessary break after return.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/econet/af_econet.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index a1d9f37..5afdc8f 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -720,23 +720,20 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
struct sock *sk = sock->sk;
void __user *argp = (void __user *)arg;
- switch(cmd) {
- case SIOCGSTAMP:
- return sock_get_timestamp(sk, argp);
+ switch (cmd) {
+ case SIOCGSTAMP:
+ return sock_get_timestamp(sk, argp);
- case SIOCGSTAMPNS:
- return sock_get_timestampns(sk, argp);
+ case SIOCGSTAMPNS:
+ return sock_get_timestampns(sk, argp);
- case SIOCSIFADDR:
- case SIOCGIFADDR:
- return ec_dev_ioctl(sock, cmd, argp);
- break;
+ case SIOCSIFADDR:
+ case SIOCGIFADDR:
+ return ec_dev_ioctl(sock, cmd, argp);
- default:
- return -ENOIOCTLCMD;
}
- /*NOTREACHED*/
- return 0;
+
+ return -ENOIOCTLCMD;
}
static const struct net_proto_family econet_family_ops = {
--
1.7.6.rc1
^ permalink raw reply related
* [PATCH 01/12] appletalk: Reduce switch/case indent
From: Joe Perches @ 2011-07-01 19:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David S. Miller, netdev, linux-kernel
In-Reply-To: <cover.1309549243.git.joe@perches.com>
Make the case labels the same indent as the switch.
(git diff -w net/appletalk shows no difference)
Signed-off-by: Joe Perches <joe@perches.com>
---
net/appletalk/aarp.c | 138 +++++++++---------
net/appletalk/ddp.c | 398 +++++++++++++++++++++++++-------------------------
2 files changed, 268 insertions(+), 268 deletions(-)
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 50dce79..1acc695 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -779,87 +779,87 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
}
switch (function) {
- case AARP_REPLY:
- if (!unresolved_count) /* Speed up */
- break;
-
- /* Find the entry. */
- a = __aarp_find_entry(unresolved[hash], dev, &sa);
- if (!a || dev != a->dev)
- break;
+ case AARP_REPLY:
+ if (!unresolved_count) /* Speed up */
+ break;
- /* We can fill one in - this is good. */
- memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
- __aarp_resolved(&unresolved[hash], a, hash);
- if (!unresolved_count)
- mod_timer(&aarp_timer,
- jiffies + sysctl_aarp_expiry_time);
+ /* Find the entry. */
+ a = __aarp_find_entry(unresolved[hash], dev, &sa);
+ if (!a || dev != a->dev)
break;
- case AARP_REQUEST:
- case AARP_PROBE:
+ /* We can fill one in - this is good. */
+ memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
+ __aarp_resolved(&unresolved[hash], a, hash);
+ if (!unresolved_count)
+ mod_timer(&aarp_timer,
+ jiffies + sysctl_aarp_expiry_time);
+ break;
+
+ case AARP_REQUEST:
+ case AARP_PROBE:
+
+ /*
+ * If it is my address set ma to my address and reply.
+ * We can treat probe and request the same. Probe
+ * simply means we shouldn't cache the querying host,
+ * as in a probe they are proposing an address not
+ * using one.
+ *
+ * Support for proxy-AARP added. We check if the
+ * address is one of our proxies before we toss the
+ * packet out.
+ */
+
+ sa.s_node = ea->pa_dst_node;
+ sa.s_net = ea->pa_dst_net;
+
+ /* See if we have a matching proxy. */
+ ma = __aarp_proxy_find(dev, &sa);
+ if (!ma)
+ ma = &ifa->address;
+ else { /* We need to make a copy of the entry. */
+ da.s_node = sa.s_node;
+ da.s_net = sa.s_net;
+ ma = &da;
+ }
+ if (function == AARP_PROBE) {
/*
- * If it is my address set ma to my address and reply.
- * We can treat probe and request the same. Probe
- * simply means we shouldn't cache the querying host,
- * as in a probe they are proposing an address not
- * using one.
- *
- * Support for proxy-AARP added. We check if the
- * address is one of our proxies before we toss the
- * packet out.
+ * A probe implies someone trying to get an
+ * address. So as a precaution flush any
+ * entries we have for this address.
*/
+ a = __aarp_find_entry(resolved[sa.s_node %
+ (AARP_HASH_SIZE - 1)],
+ skb->dev, &sa);
- sa.s_node = ea->pa_dst_node;
- sa.s_net = ea->pa_dst_net;
-
- /* See if we have a matching proxy. */
- ma = __aarp_proxy_find(dev, &sa);
- if (!ma)
- ma = &ifa->address;
- else { /* We need to make a copy of the entry. */
- da.s_node = sa.s_node;
- da.s_net = sa.s_net;
- ma = &da;
- }
-
- if (function == AARP_PROBE) {
- /*
- * A probe implies someone trying to get an
- * address. So as a precaution flush any
- * entries we have for this address.
- */
- a = __aarp_find_entry(resolved[sa.s_node %
- (AARP_HASH_SIZE - 1)],
- skb->dev, &sa);
-
- /*
- * Make it expire next tick - that avoids us
- * getting into a probe/flush/learn/probe/
- * flush/learn cycle during probing of a slow
- * to respond host addr.
- */
- if (a) {
- a->expires_at = jiffies - 1;
- mod_timer(&aarp_timer, jiffies +
- sysctl_aarp_tick_time);
- }
+ /*
+ * Make it expire next tick - that avoids us
+ * getting into a probe/flush/learn/probe/
+ * flush/learn cycle during probing of a slow
+ * to respond host addr.
+ */
+ if (a) {
+ a->expires_at = jiffies - 1;
+ mod_timer(&aarp_timer, jiffies +
+ sysctl_aarp_tick_time);
}
+ }
- if (sa.s_node != ma->s_node)
- break;
+ if (sa.s_node != ma->s_node)
+ break;
- if (sa.s_net && ma->s_net && sa.s_net != ma->s_net)
- break;
+ if (sa.s_net && ma->s_net && sa.s_net != ma->s_net)
+ break;
- sa.s_node = ea->pa_src_node;
- sa.s_net = ea->pa_src_net;
+ sa.s_node = ea->pa_src_node;
+ sa.s_net = ea->pa_src_net;
- /* aarp_my_address has found the address to use for us.
- */
- aarp_send_reply(dev, ma, &sa, ea->hw_src);
- break;
+ /* aarp_my_address has found the address to use for us.
+ */
+ aarp_send_reply(dev, ma, &sa, ea->hw_src);
+ break;
}
unlock:
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 956a530..b1fe7c3 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -684,192 +684,192 @@ static int atif_ioctl(int cmd, void __user *arg)
atif = atalk_find_dev(dev);
switch (cmd) {
- case SIOCSIFADDR:
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- if (sa->sat_family != AF_APPLETALK)
- return -EINVAL;
- if (dev->type != ARPHRD_ETHER &&
- dev->type != ARPHRD_LOOPBACK &&
- dev->type != ARPHRD_LOCALTLK &&
- dev->type != ARPHRD_PPP)
- return -EPROTONOSUPPORT;
-
- nr = (struct atalk_netrange *)&sa->sat_zero[0];
- add_route = 1;
-
- /*
- * if this is a point-to-point iface, and we already
- * have an iface for this AppleTalk address, then we
- * should not add a route
- */
- if ((dev->flags & IFF_POINTOPOINT) &&
- atalk_find_interface(sa->sat_addr.s_net,
- sa->sat_addr.s_node)) {
- printk(KERN_DEBUG "AppleTalk: point-to-point "
- "interface added with "
- "existing address\n");
- add_route = 0;
- }
+ case SIOCSIFADDR:
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+ if (sa->sat_family != AF_APPLETALK)
+ return -EINVAL;
+ if (dev->type != ARPHRD_ETHER &&
+ dev->type != ARPHRD_LOOPBACK &&
+ dev->type != ARPHRD_LOCALTLK &&
+ dev->type != ARPHRD_PPP)
+ return -EPROTONOSUPPORT;
+
+ nr = (struct atalk_netrange *)&sa->sat_zero[0];
+ add_route = 1;
- /*
- * Phase 1 is fine on LocalTalk but we don't do
- * EtherTalk phase 1. Anyone wanting to add it go ahead.
- */
- if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
- return -EPROTONOSUPPORT;
- if (sa->sat_addr.s_node == ATADDR_BCAST ||
- sa->sat_addr.s_node == 254)
- return -EINVAL;
- if (atif) {
- /* Already setting address */
- if (atif->status & ATIF_PROBE)
- return -EBUSY;
-
- atif->address.s_net = sa->sat_addr.s_net;
- atif->address.s_node = sa->sat_addr.s_node;
- atrtr_device_down(dev); /* Flush old routes */
- } else {
- atif = atif_add_device(dev, &sa->sat_addr);
- if (!atif)
- return -ENOMEM;
- }
- atif->nets = *nr;
-
- /*
- * Check if the chosen address is used. If so we
- * error and atalkd will try another.
- */
-
- if (!(dev->flags & IFF_LOOPBACK) &&
- !(dev->flags & IFF_POINTOPOINT) &&
- atif_probe_device(atif) < 0) {
- atif_drop_device(dev);
- return -EADDRINUSE;
- }
-
- /* Hey it worked - add the direct routes */
- sa = (struct sockaddr_at *)&rtdef.rt_gateway;
- sa->sat_family = AF_APPLETALK;
- sa->sat_addr.s_net = atif->address.s_net;
- sa->sat_addr.s_node = atif->address.s_node;
- sa = (struct sockaddr_at *)&rtdef.rt_dst;
- rtdef.rt_flags = RTF_UP;
- sa->sat_family = AF_APPLETALK;
- sa->sat_addr.s_node = ATADDR_ANYNODE;
- if (dev->flags & IFF_LOOPBACK ||
- dev->flags & IFF_POINTOPOINT)
- rtdef.rt_flags |= RTF_HOST;
-
- /* Routerless initial state */
- if (nr->nr_firstnet == htons(0) &&
- nr->nr_lastnet == htons(0xFFFE)) {
- sa->sat_addr.s_net = atif->address.s_net;
- atrtr_create(&rtdef, dev);
- atrtr_set_default(dev);
- } else {
- limit = ntohs(nr->nr_lastnet);
- if (limit - ntohs(nr->nr_firstnet) > 4096) {
- printk(KERN_WARNING "Too many routes/"
- "iface.\n");
- return -EINVAL;
- }
- if (add_route)
- for (ct = ntohs(nr->nr_firstnet);
- ct <= limit; ct++) {
- sa->sat_addr.s_net = htons(ct);
- atrtr_create(&rtdef, dev);
- }
- }
- dev_mc_add_global(dev, aarp_mcast);
- return 0;
+ /*
+ * if this is a point-to-point iface, and we already
+ * have an iface for this AppleTalk address, then we
+ * should not add a route
+ */
+ if ((dev->flags & IFF_POINTOPOINT) &&
+ atalk_find_interface(sa->sat_addr.s_net,
+ sa->sat_addr.s_node)) {
+ printk(KERN_DEBUG "AppleTalk: point-to-point "
+ "interface added with "
+ "existing address\n");
+ add_route = 0;
+ }
- case SIOCGIFADDR:
+ /*
+ * Phase 1 is fine on LocalTalk but we don't do
+ * EtherTalk phase 1. Anyone wanting to add it go ahead.
+ */
+ if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
+ return -EPROTONOSUPPORT;
+ if (sa->sat_addr.s_node == ATADDR_BCAST ||
+ sa->sat_addr.s_node == 254)
+ return -EINVAL;
+ if (atif) {
+ /* Already setting address */
+ if (atif->status & ATIF_PROBE)
+ return -EBUSY;
+
+ atif->address.s_net = sa->sat_addr.s_net;
+ atif->address.s_node = sa->sat_addr.s_node;
+ atrtr_device_down(dev); /* Flush old routes */
+ } else {
+ atif = atif_add_device(dev, &sa->sat_addr);
if (!atif)
- return -EADDRNOTAVAIL;
+ return -ENOMEM;
+ }
+ atif->nets = *nr;
- sa->sat_family = AF_APPLETALK;
- sa->sat_addr = atif->address;
- break;
+ /*
+ * Check if the chosen address is used. If so we
+ * error and atalkd will try another.
+ */
- case SIOCGIFBRDADDR:
- if (!atif)
- return -EADDRNOTAVAIL;
+ if (!(dev->flags & IFF_LOOPBACK) &&
+ !(dev->flags & IFF_POINTOPOINT) &&
+ atif_probe_device(atif) < 0) {
+ atif_drop_device(dev);
+ return -EADDRINUSE;
+ }
- sa->sat_family = AF_APPLETALK;
+ /* Hey it worked - add the direct routes */
+ sa = (struct sockaddr_at *)&rtdef.rt_gateway;
+ sa->sat_family = AF_APPLETALK;
+ sa->sat_addr.s_net = atif->address.s_net;
+ sa->sat_addr.s_node = atif->address.s_node;
+ sa = (struct sockaddr_at *)&rtdef.rt_dst;
+ rtdef.rt_flags = RTF_UP;
+ sa->sat_family = AF_APPLETALK;
+ sa->sat_addr.s_node = ATADDR_ANYNODE;
+ if (dev->flags & IFF_LOOPBACK ||
+ dev->flags & IFF_POINTOPOINT)
+ rtdef.rt_flags |= RTF_HOST;
+
+ /* Routerless initial state */
+ if (nr->nr_firstnet == htons(0) &&
+ nr->nr_lastnet == htons(0xFFFE)) {
sa->sat_addr.s_net = atif->address.s_net;
- sa->sat_addr.s_node = ATADDR_BCAST;
- break;
-
- case SIOCATALKDIFADDR:
- case SIOCDIFADDR:
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- if (sa->sat_family != AF_APPLETALK)
+ atrtr_create(&rtdef, dev);
+ atrtr_set_default(dev);
+ } else {
+ limit = ntohs(nr->nr_lastnet);
+ if (limit - ntohs(nr->nr_firstnet) > 4096) {
+ printk(KERN_WARNING "Too many routes/"
+ "iface.\n");
return -EINVAL;
- atalk_dev_down(dev);
- break;
-
- case SIOCSARP:
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- if (sa->sat_family != AF_APPLETALK)
- return -EINVAL;
- /*
- * for now, we only support proxy AARP on ELAP;
- * we should be able to do it for LocalTalk, too.
- */
- if (dev->type != ARPHRD_ETHER)
- return -EPROTONOSUPPORT;
-
- /*
- * atif points to the current interface on this network;
- * we aren't concerned about its current status (at
- * least for now), but it has all the settings about
- * the network we're going to probe. Consequently, it
- * must exist.
- */
- if (!atif)
- return -EADDRNOTAVAIL;
+ }
+ if (add_route)
+ for (ct = ntohs(nr->nr_firstnet);
+ ct <= limit; ct++) {
+ sa->sat_addr.s_net = htons(ct);
+ atrtr_create(&rtdef, dev);
+ }
+ }
+ dev_mc_add_global(dev, aarp_mcast);
+ return 0;
+
+ case SIOCGIFADDR:
+ if (!atif)
+ return -EADDRNOTAVAIL;
+
+ sa->sat_family = AF_APPLETALK;
+ sa->sat_addr = atif->address;
+ break;
+
+ case SIOCGIFBRDADDR:
+ if (!atif)
+ return -EADDRNOTAVAIL;
+
+ sa->sat_family = AF_APPLETALK;
+ sa->sat_addr.s_net = atif->address.s_net;
+ sa->sat_addr.s_node = ATADDR_BCAST;
+ break;
+
+ case SIOCATALKDIFADDR:
+ case SIOCDIFADDR:
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+ if (sa->sat_family != AF_APPLETALK)
+ return -EINVAL;
+ atalk_dev_down(dev);
+ break;
- nr = (struct atalk_netrange *)&(atif->nets);
- /*
- * Phase 1 is fine on Localtalk but we don't do
- * Ethertalk phase 1. Anyone wanting to add it go ahead.
- */
- if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
- return -EPROTONOSUPPORT;
+ case SIOCSARP:
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+ if (sa->sat_family != AF_APPLETALK)
+ return -EINVAL;
+ /*
+ * for now, we only support proxy AARP on ELAP;
+ * we should be able to do it for LocalTalk, too.
+ */
+ if (dev->type != ARPHRD_ETHER)
+ return -EPROTONOSUPPORT;
- if (sa->sat_addr.s_node == ATADDR_BCAST ||
- sa->sat_addr.s_node == 254)
- return -EINVAL;
+ /*
+ * atif points to the current interface on this network;
+ * we aren't concerned about its current status (at
+ * least for now), but it has all the settings about
+ * the network we're going to probe. Consequently, it
+ * must exist.
+ */
+ if (!atif)
+ return -EADDRNOTAVAIL;
- /*
- * Check if the chosen address is used. If so we
- * error and ATCP will try another.
- */
- if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
- return -EADDRINUSE;
+ nr = (struct atalk_netrange *)&(atif->nets);
+ /*
+ * Phase 1 is fine on Localtalk but we don't do
+ * Ethertalk phase 1. Anyone wanting to add it go ahead.
+ */
+ if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
+ return -EPROTONOSUPPORT;
- /*
- * We now have an address on the local network, and
- * the AARP code will defend it for us until we take it
- * down. We don't set up any routes right now, because
- * ATCP will install them manually via SIOCADDRT.
- */
- break;
+ if (sa->sat_addr.s_node == ATADDR_BCAST ||
+ sa->sat_addr.s_node == 254)
+ return -EINVAL;
- case SIOCDARP:
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- if (sa->sat_family != AF_APPLETALK)
- return -EINVAL;
- if (!atif)
- return -EADDRNOTAVAIL;
+ /*
+ * Check if the chosen address is used. If so we
+ * error and ATCP will try another.
+ */
+ if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
+ return -EADDRINUSE;
- /* give to aarp module to remove proxy entry */
- aarp_proxy_remove(atif->dev, &(sa->sat_addr));
- return 0;
+ /*
+ * We now have an address on the local network, and
+ * the AARP code will defend it for us until we take it
+ * down. We don't set up any routes right now, because
+ * ATCP will install them manually via SIOCADDRT.
+ */
+ break;
+
+ case SIOCDARP:
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+ if (sa->sat_family != AF_APPLETALK)
+ return -EINVAL;
+ if (!atif)
+ return -EADDRNOTAVAIL;
+
+ /* give to aarp module to remove proxy entry */
+ aarp_proxy_remove(atif->dev, &(sa->sat_addr));
+ return 0;
}
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0;
@@ -884,25 +884,25 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
return -EFAULT;
switch (cmd) {
- case SIOCDELRT:
- if (rt.rt_dst.sa_family != AF_APPLETALK)
- return -EINVAL;
- return atrtr_delete(&((struct sockaddr_at *)
- &rt.rt_dst)->sat_addr);
-
- case SIOCADDRT: {
- struct net_device *dev = NULL;
- if (rt.rt_dev) {
- char name[IFNAMSIZ];
- if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
- return -EFAULT;
- name[IFNAMSIZ-1] = '\0';
- dev = __dev_get_by_name(&init_net, name);
- if (!dev)
- return -ENODEV;
- }
- return atrtr_create(&rt, dev);
+ case SIOCDELRT:
+ if (rt.rt_dst.sa_family != AF_APPLETALK)
+ return -EINVAL;
+ return atrtr_delete(&((struct sockaddr_at *)
+ &rt.rt_dst)->sat_addr);
+
+ case SIOCADDRT: {
+ struct net_device *dev = NULL;
+ if (rt.rt_dev) {
+ char name[IFNAMSIZ];
+ if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
+ return -EFAULT;
+ name[IFNAMSIZ-1] = '\0';
+ dev = __dev_get_by_name(&init_net, name);
+ if (!dev)
+ return -ENODEV;
}
+ return atrtr_create(&rt, dev);
+ }
}
return -EINVAL;
}
--
1.7.6.rc1
^ permalink raw reply related
* [PATCH 00/12] net switch/case reformatting
From: Joe Perches @ 2011-07-01 19:43 UTC (permalink / raw)
To: linux-decnet-user, netfilter-devel, netfilter, coreteam, netdev,
linux-x25, linux-h
Cc: linux-kernel
Just whitespace cleanups with a couple trivial corrections
Joe Perches (12):
appletalk: Reduce switch/case indent
decnet: Reduce switch/case indent
econet: Reduce switch/case indent
ipconfig: Reduce switch/case indent
netfilter: Reduce switch/case indent
ipv4: Reduce switch/case indent
ipv6: Reduce switch/case indent
lapb: Reduce switch/case indent
netrom: Reduce switch/case indent
sctp: Reduce switch/case indent
sunrpc: Reduce switch/case indent
x25: Reduce switch/case indent
net/appletalk/aarp.c | 138 +++---
net/appletalk/ddp.c | 398 +++++++-------
net/decnet/af_decnet.c | 697 +++++++++++++-------------
net/decnet/dn_dev.c | 70 ++--
net/decnet/dn_fib.c | 77 ++--
net/decnet/dn_neigh.c | 14 +-
net/decnet/dn_nsp_in.c | 182 ++++----
net/decnet/dn_route.c | 102 ++--
net/decnet/dn_table.c | 23 +-
net/decnet/netfilter/dn_rtmsg.c | 18 +-
net/decnet/sysctl_net_decnet.c | 17 +-
net/econet/af_econet.c | 23 +-
net/ipv4/ipconfig.c | 73 ++--
net/ipv4/netfilter/ipt_CLUSTERIP.c | 26 +-
net/ipv4/netfilter/nf_nat_snmp_basic.c | 210 ++++----
net/ipv4/raw.c | 36 +-
net/ipv4/route.c | 28 +-
net/ipv6/raw.c | 145 +++---
net/lapb/lapb_iface.c | 30 +-
net/lapb/lapb_in.c | 881 ++++++++++++++++----------------
net/netfilter/xt_HL.c | 64 ++--
net/netfilter/xt_hl.c | 32 +-
net/netrom/nr_route.c | 22 +-
net/sctp/sm_statefuns.c | 51 +-
net/sctp/socket.c | 10 +-
net/sunrpc/auth_gss/auth_gss.c | 46 +-
net/sunrpc/clnt.c | 25 +-
net/sunrpc/rpc_pipe.c | 14 +-
net/x25/af_x25.c | 473 +++++++++---------
net/x25/x25_dev.c | 44 +-
net/x25/x25_in.c | 118 +++---
net/x25/x25_link.c | 87 ++--
net/x25/x25_subr.c | 78 ++--
33 files changed, 2111 insertions(+), 2141 deletions(-)
--
1.7.6.rc1
^ permalink raw reply
* Re: [PATCH] bluetooth: Add bt_printk
From: Gustavo F. Padovan @ 2011-07-01 19:36 UTC (permalink / raw)
To: Joe Perches
Cc: Marcel Holtmann, David S. Miller, linux-bluetooth, netdev,
linux-kernel
In-Reply-To: <20110701190327.GD23683@joana>
* Gustavo F. Padovan <padovan@profusion.mobi> [2011-07-01 16:03:27 -0300]:
> Hi Joe,
>
> * Joe Perches <joe@perches.com> [2011-06-30 00:19:51 -0700]:
>
> > Add a local logging function to emit bluetooth specific
> > messages. Using vsprintf extension %pV saves code/text
> > space.
> >
> > Convert the current BT_INFO and BT_ERR macros to use bt_printk.
> > Remove __func__ from BT_ERR macro (and the uses).
> > Prefix "Bluetooth: " to BT_ERR
> > Remove __func__ from BT_DBG as function can be prefixed when
> > using dynamic_debug.
> >
> > With allyesconfig:
> >
> > text data bss dec hex filename
> > 129956 8632 36096 174684 2aa5c drivers/bluetooth/built-in.o.new2
> > 134402 8632 36064 179098 2bb9a drivers/bluetooth/built-in.o.old
> > 14778 1012 3408 19198 4afe net/bluetooth/bnep/built-in.o.new2
> > 15067 1012 3408 19487 4c1f net/bluetooth/bnep/built-in.o.old
> > 346595 19163 86080 451838 6e4fe net/bluetooth/built-in.o.new2
> > 353751 19163 86064 458978 700e2 net/bluetooth/built-in.o.old
> > 18483 1172 4264 23919 5d6f net/bluetooth/cmtp/built-in.o.new2
> > 18927 1172 4264 24363 5f2b net/bluetooth/cmtp/built-in.o.old
> > 19237 1172 5152 25561 63d9 net/bluetooth/hidp/built-in.o.new2
> > 19581 1172 5152 25905 6531 net/bluetooth/hidp/built-in.o.old
> > 59461 3884 14464 77809 12ff1 net/bluetooth/rfcomm/built-in.o.new2
> > 61206 3884 14464 79554 136c2 net/bluetooth/rfcomm/built-in.o.old
> >
> > with x86 defconfig (and just bluetooth):
> >
> > $ size net/bluetooth/built-in.o.defconfig.*
> > text data bss dec hex filename
> > 66358 933 100 67391 1073f net/bluetooth/built-in.o.defconfig.new
> > 66643 933 100 67676 1085c net/bluetooth/built-in.o.defconfig.old
> >
> > Signed-off-by: Joe Perches <joe@perches.com>
>
> I applied this patch with a minimal change in the print format. I changed
> 'bluetooth' to 'Bluetooth'. Thanks a lot for the patch. ;)
Ah, and in the case someone want to add the function name to debug messages
after this patch. It is easy. Just run
echo -n "module bluetooth +pf" > /sys/kernel/debug/dynamic_debug/control
And debug with funcion names will be enabled. ;)
Gustavo
^ permalink raw reply
* Re: [PATCH] Disable router anycast address for /127 prefixes
From: Brian Haley @ 2011-07-01 19:09 UTC (permalink / raw)
To: Bjørn Mork; +Cc: netdev
In-Reply-To: <87y60hsvr2.fsf@nemi.mork.no>
On 07/01/2011 02:26 PM, Bjørn Mork wrote:
> Brian Haley <brian.haley@hp.com> writes:
>> On 07/01/2011 07:22 AM, Bjørn Mork wrote:
>>> RFC 6164 requires that routers MUST disable Subnet-Router anycast
>>> for the prefix when /127 prefixes are used.
>>>
>>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>> ---
>>
>>> @@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
>>> static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
>>> {
>>> struct in6_addr addr;
>>> + if (ifp->prefix_len == 127) /* RFC 6164 */
>>> + return;
>>> ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
>>> if (ipv6_addr_any(&addr))
>>> return;
>>
>> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
>
> I don't understand exactly what you mean here....
If you never add an anycast address when the prefix length is 127, the address
wouldn't be there when you went to remove it. In other words, the call to
__ipv6_dev_ac_dec() would return -ENOENT, which is ignored anyways.
It's not a common codepath so the two lines of code wouldn't hurt anything
I guess...
-Brian
^ permalink raw reply
* Re: [PATCH 1/2] bluetooth: Rename function bt_err to bt_to_errno
From: Gustavo F. Padovan @ 2011-07-01 19:04 UTC (permalink / raw)
To: Joe Perches
Cc: Marcel Holtmann, David S. Miller, linux-bluetooth, netdev,
linux-kernel
In-Reply-To: <895bc01e49b93b9498ca05cfa1bd9cf58cf30df8.1309396408.git.joe@perches.com>
* Joe Perches <joe@perches.com> [2011-06-29 18:18:29 -0700]:
> Make it easier to use more normal logging styles later.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> include/net/bluetooth/bluetooth.h | 2 +-
> net/bluetooth/hci_core.c | 2 +-
> net/bluetooth/l2cap_core.c | 4 ++--
> net/bluetooth/lib.c | 4 ++--
> net/bluetooth/sco.c | 4 ++--
> 5 files changed, 8 insertions(+), 8 deletions(-)
I applied this one as well. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] bluetooth: Add bt_printk
From: Gustavo F. Padovan @ 2011-07-01 19:03 UTC (permalink / raw)
To: Joe Perches
Cc: Marcel Holtmann, David S. Miller,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <f06f1d8f4185db431a038c328c42caf4fe270dd0.1309418368.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Hi Joe,
* Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> [2011-06-30 00:19:51 -0700]:
> Add a local logging function to emit bluetooth specific
> messages. Using vsprintf extension %pV saves code/text
> space.
>
> Convert the current BT_INFO and BT_ERR macros to use bt_printk.
> Remove __func__ from BT_ERR macro (and the uses).
> Prefix "Bluetooth: " to BT_ERR
> Remove __func__ from BT_DBG as function can be prefixed when
> using dynamic_debug.
>
> With allyesconfig:
>
> text data bss dec hex filename
> 129956 8632 36096 174684 2aa5c drivers/bluetooth/built-in.o.new2
> 134402 8632 36064 179098 2bb9a drivers/bluetooth/built-in.o.old
> 14778 1012 3408 19198 4afe net/bluetooth/bnep/built-in.o.new2
> 15067 1012 3408 19487 4c1f net/bluetooth/bnep/built-in.o.old
> 346595 19163 86080 451838 6e4fe net/bluetooth/built-in.o.new2
> 353751 19163 86064 458978 700e2 net/bluetooth/built-in.o.old
> 18483 1172 4264 23919 5d6f net/bluetooth/cmtp/built-in.o.new2
> 18927 1172 4264 24363 5f2b net/bluetooth/cmtp/built-in.o.old
> 19237 1172 5152 25561 63d9 net/bluetooth/hidp/built-in.o.new2
> 19581 1172 5152 25905 6531 net/bluetooth/hidp/built-in.o.old
> 59461 3884 14464 77809 12ff1 net/bluetooth/rfcomm/built-in.o.new2
> 61206 3884 14464 79554 136c2 net/bluetooth/rfcomm/built-in.o.old
>
> with x86 defconfig (and just bluetooth):
>
> $ size net/bluetooth/built-in.o.defconfig.*
> text data bss dec hex filename
> 66358 933 100 67391 1073f net/bluetooth/built-in.o.defconfig.new
> 66643 933 100 67676 1085c net/bluetooth/built-in.o.defconfig.old
>
> Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
I applied this patch with a minimal change in the print format. I changed
'bluetooth' to 'Bluetooth'. Thanks a lot for the patch. ;)
Gustavo
^ permalink raw reply
* [PATCH 1/3 resend] ssb: PCI revision ID register is 8-bit wide
From: Sergei Shtylyov @ 2011-07-01 18:35 UTC (permalink / raw)
To: mb, netdev
The SSB code reads PCI revision ID register as 16-bit entity while the register
is actually 8-bit only (the next 8 bits are the programming interface register).
Fix the read and make the 'rev' field of 'struct ssb_boardinfo' 8-bit as well,
to match the register size.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
The patch is against the recent Linus' tree.
Resending with proper tearline this time...
drivers/ssb/pci.c | 2 +-
include/linux/ssb/ssb.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/ssb/pci.c
===================================================================
--- linux-2.6.orig/drivers/ssb/pci.c
+++ linux-2.6/drivers/ssb/pci.c
@@ -738,7 +738,7 @@ static void ssb_pci_get_boardinfo(struct
&bi->vendor);
pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
&bi->type);
- pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
+ pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
&bi->rev);
}
Index: linux-2.6/include/linux/ssb/ssb.h
===================================================================
--- linux-2.6.orig/include/linux/ssb/ssb.h
+++ linux-2.6/include/linux/ssb/ssb.h
@@ -99,7 +99,7 @@ struct ssb_sprom {
struct ssb_boardinfo {
u16 vendor;
u16 type;
- u16 rev;
+ u8 rev;
};
^ permalink raw reply
* [PATCH 3/3 v2] ssb: use pci_dev->subsystem_{vendor,device}
From: Sergei Shtylyov @ 2011-07-01 18:34 UTC (permalink / raw)
To: mb, netdev
The SSB code reads PCI subsystem IDs from the PCI configuration registers while
they are already stored by the PCI subsystem in the 'subsystem_{vendor|device}'
fields of 'struct pci_dev'...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
The patch is against the recent Linus' tree.
drivers/ssb/pci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/ssb/pci.c
===================================================================
--- linux-2.6.orig/drivers/ssb/pci.c
+++ linux-2.6/drivers/ssb/pci.c
@@ -734,10 +734,8 @@ out_free:
static void ssb_pci_get_boardinfo(struct ssb_bus *bus,
struct ssb_boardinfo *bi)
{
- pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_VENDOR_ID,
- &bi->vendor);
- pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
- &bi->type);
+ bi->vendor = bus->host_pci->subsystem_vendor;
+ bi->type = bus->host_pci->subsystem_device;
bi->rev = bus->host_pci->revision;
}
^ permalink raw reply
* [PATCH 2/3 v2] ssb: use pci_dev->revision
From: Sergei Shtylyov @ 2011-07-01 18:33 UTC (permalink / raw)
To: mb, netdev
The SSB code reads PCI revision ID from the PCI configuration register while
it's already stored by the PCI subsystem in the 'revision' field of 'struct
pci_dev'...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
The patch is against the recent Linus' tree.
drivers/ssb/pci.c | 3 +--
drivers/ssb/scan.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/ssb/pci.c
===================================================================
--- linux-2.6.orig/drivers/ssb/pci.c
+++ linux-2.6/drivers/ssb/pci.c
@@ -738,8 +738,7 @@ static void ssb_pci_get_boardinfo(struct
&bi->vendor);
pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
&bi->type);
- pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
- &bi->rev);
+ bi->rev = bus->host_pci->revision;
}
int ssb_pci_get_invariants(struct ssb_bus *bus,
Index: linux-2.6/drivers/ssb/scan.c
===================================================================
--- linux-2.6.orig/drivers/ssb/scan.c
+++ linux-2.6/drivers/ssb/scan.c
@@ -310,8 +310,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
} else {
if (bus->bustype == SSB_BUSTYPE_PCI) {
bus->chip_id = pcidev_to_chipid(bus->host_pci);
- pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
- &bus->chip_rev);
+ bus->chip_rev = bus->host_pci->revision;
bus->chip_package = 0;
} else {
bus->chip_id = 0x4710;
^ permalink raw reply
* [PATCH 1/3] ssb: PCI revision ID register is 8-bit wide
From: Sergei Shtylyov @ 2011-07-01 18:31 UTC (permalink / raw)
To: mb, netdev
The SSB code reads PCI revision ID register as 16-bit entity while the register
is actually 8-bit only (the next 8 bits are the programming interface register).
Fix the read and make the 'rev' field of 'struct ssb_boardinfo' 8-bit as well,
to match the register size.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
drivers/ssb/pci.c | 2 +-
include/linux/ssb/ssb.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/ssb/pci.c
===================================================================
--- linux-2.6.orig/drivers/ssb/pci.c
+++ linux-2.6/drivers/ssb/pci.c
@@ -738,7 +738,7 @@ static void ssb_pci_get_boardinfo(struct
&bi->vendor);
pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
&bi->type);
- pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
+ pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
&bi->rev);
}
Index: linux-2.6/include/linux/ssb/ssb.h
===================================================================
--- linux-2.6.orig/include/linux/ssb/ssb.h
+++ linux-2.6/include/linux/ssb/ssb.h
@@ -99,7 +99,7 @@ struct ssb_sprom {
struct ssb_boardinfo {
u16 vendor;
u16 type;
- u16 rev;
+ u8 rev;
};
^ permalink raw reply
* Re: [PATCH] Disable router anycast address for /127 prefixes
From: Bjørn Mork @ 2011-07-01 18:26 UTC (permalink / raw)
To: netdev
In-Reply-To: <4E0DDDA5.20401@hp.com>
Brian Haley <brian.haley@hp.com> writes:
> On 07/01/2011 07:22 AM, Bjørn Mork wrote:
>> RFC 6164 requires that routers MUST disable Subnet-Router anycast
>> for the prefix when /127 prefixes are used.
>>
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>> ---
>
>> @@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
>> static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
>> {
>> struct in6_addr addr;
>> + if (ifp->prefix_len == 127) /* RFC 6164 */
>> + return;
>> ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
>> if (ipv6_addr_any(&addr))
>> return;
>
> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
I don't understand exactly what you mean here....
The addrconf_{join,leave}_anycast() functions are definitely called
regardless of prefix length, including both 127 and 128. The latter is
not a problem because it is handled by ipv6_addr_prefix(). But /127
prefixes are not handled according to RFC 6164.
Just to be sure I didn't miss something, I added a simple printk to the
beginning of addrconf_{join,leave}_anycast():
printk(KERN_INFO "%s(): ifp->prefix_len=%d\n", __FUNCTION__, ifp->prefix_len);
and got this as expected after doing
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
[ 73.710174] addrconf_join_anycast(): ifp->prefix_len=128
[ 73.712879] addrconf_join_anycast(): ifp->prefix_len=64
[ 73.716799] addrconf_join_anycast(): ifp->prefix_len=64
[ 73.719798] addrconf_join_anycast(): ifp->prefix_len=64
Notice the /128 prefix, which is the loopback address.
Adding a new interface, and setting a /127 on it:
ifconfig dummy0 up
[ 134.434901] addrconf_join_anycast(): ifp->prefix_len=64
ip addr add 2001:db8:f00::3/127 dev dummy0
[ 198.292972] addrconf_join_anycast(): ifp->prefix_len=127
And verifying that it actually answers the anycast address (which is the
problem since that is supposed to be the other end of the point-to-point
link):
frtest1:~# ping6 2001:db8:f00::2
PING 2001:db8:f00::2(2001:db8:f00::2) 56 data bytes
64 bytes from 2001:db8:f00::3: icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from 2001:db8:f00::3: icmp_seq=2 ttl=64 time=0.049 ms
64 bytes from 2001:db8:f00::3: icmp_seq=3 ttl=64 time=0.039 ms
^C
--- 2001:db8:f00::2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.035/0.041/0.049/0.005 ms
Disabling forwarding again:
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
[ 247.281543] addrconf_leave_anycast(): ifp->prefix_len=128
[ 247.284220] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.287959] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.290178] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.293390] addrconf_leave_anycast(): ifp->prefix_len=127
[ 247.295476] addrconf_leave_anycast(): ifp->prefix_len=64
With the patch, we still get anycast addresses for the shorter prefix
lengths, but not for /127 prefixes:
frtest1:~# echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
frtest1:~# ifconfig dummy0 up
frtest1:~#
frtest1:~# ip addr add 2001:db8:f00::3/127 dev dummy0
frtest1:~# ip -6 addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::5054:ff:feff:100/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:4620:9:29a:5054:ff:feff:106/64 scope global dynamic
valid_lft 86356sec preferred_lft 14356sec
inet6 fe80::5054:ff:feff:106/64 scope link
valid_lft forever preferred_lft forever
4: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500
inet6 2001:db8:f00::3/127 scope global
valid_lft forever preferred_lft forever
inet6 fe80::d8b4:bcff:fe81:172/64 scope link
valid_lft forever preferred_lft forever
frtest1:~# ping6 2001:4620:9:29a::
PING 2001:4620:9:29a::(2001:4620:9:29a::) 56 data bytes
64 bytes from 2001:4620:9:29a:5054:ff:feff:106: icmp_seq=1 ttl=64 time=0.032 ms
64 bytes from 2001:4620:9:29a:5054:ff:feff:106: icmp_seq=2 ttl=64 time=0.040 ms
^C
--- 2001:4620:9:29a:: ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.032/0.036/0.040/0.004 ms
frtest1:~# ping6 2001:db8:f00::2
PING 2001:db8:f00::2(2001:db8:f00::2) 56 data bytes
^C
--- 2001:db8:f00::2 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1008ms
Bjørn
^ permalink raw reply
* Re: bridge vs. bonding/pause frames (was: Forward EAPOL...)
From: Michał Mirosław @ 2011-07-01 17:59 UTC (permalink / raw)
To: David Lamparter; +Cc: Stephen Hemminger, Nick Carter, netdev, davem
In-Reply-To: <20110701151626.GC2613105@jupiter.n2.diac24.net>
W dniu 1 lipca 2011 17:16 użytkownik David Lamparter
<equinox@diac24.net> napisał:
> On Fri, Jul 01, 2011 at 04:58:56PM +0200, Michał Mirosław wrote:
> [...]
>> > We _MUST_NOT_ pass bonding frames in any case, but we
>> > currently do that if STP is off. (cf. my earlier patch 1/2)
>>
>> If you use linux box as a (invisible) L2 network tap, then you want to
>> pass everything in the hub mode (including LACP/whatever).
>
> We must not do that by default, this breaks bridges with bonding devices
> as ports. I'm actively band-aiding that problem with ebtables on one of
> my boxes currently.
>
> How about I change "stp_forward_802local" to "forward_802local" and it
> gets 3 values like:
> - 0 (default) behave like a switch, if STP is on then drop all 16
> groups, if STP is off then drop :01 and :02
> - 1 forward regular groups - drop :01 and :02, forward everything else
> - 2 forward everything ("invisible tap mode")
> optional:
> - -1 drop all 16 groups even if STP is off (not needed, can be done with
> ebtables...)
>
> btw, since the drivers should eat up pause frames, you're not a fully
> invisible L2 tap anyway.
If -1 can be done with ebtables what is different for 0 and 1 cases?
Another idea: you could make this a 16-bit bitmap (bit per group) x2
(STP vs non-STP) - that would cover all uses with the same amount of
code.
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: Michał Mirosław @ 2011-07-01 17:50 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Jiri Pirko, Stephen Hemminger, netdev, davem, kaber, fubar,
eric.dumazet, andy
In-Reply-To: <4E0DF9C6.703@gmail.com>
W dniu 1 lipca 2011 18:45 użytkownik Nicolas de Pesloüan
<nicolas.2p.debian@gmail.com> napisał:
> Le 01/07/2011 17:01, Michał Mirosław a écrit :
>>>> We could introduce a catch-all macvlan/vlan device that would take
>>>> addresses/VLANs which are not covered by other configured
>>>> macvlans/vlans. This would allow clearer configuration and would make
>>>> the evaluation order explicit. As a bonus, this will give another
>>>> device to put tcpdump on. ;-)
>>>
>>> 'Sounds like what I had in mind in
>>> http://marc.info/?l=linux-netdev&m=130622112921245&w=2 .
>> Almost. My idea assumes that eth0.any won't strip VLAN headers (so its
>> just looks like a filtered eth0).
> I originally thought unstripped packets should go to eth0.
> But, if eth0.any get untagged packets, we face two problems:
>
> 1/ We need a way to retrieve the original tag.
> 2/ We need a way to force the tag on output (or we consider eth0.any a pure
> tcpdump device, which is less useful).
>
> But if eth0.any get the exact same packets as those delivered to eth0, this
> seems useless.
>
> Or maybe, eth0.any should get only packets that weren't delivered to any
> eth0.XXXX devices... and should be named eth0.unmatched instead of eth0.any
> :-)
>
> Do we need eth0.untagged too (which would only get packets that were
> originally *not* tagged)?
>
> eth0 - Get everything, untouched. (I know several people except tagged
> packets to be untagged here, but I disagree with this part. eth0 is the raw
> device and should deliver raw packets, possibly retagging packets that were
> untagged by hw-accel).
> eth0.100 - Get VLAN 100 packet, untagged.
> eth0.untagged - Get only non-tagged packets, untouched.
> eth0.unmatched - Get only tagged packets, untouched.
eth0.any in my idea is exactly eth0.untagged + eth0.unmatched in your
proposition (assuming it gets only filtered VIDs/MACs that don't
belong to other subdevices).
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: David Lamparter @ 2011-07-01 17:08 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Ben Greear, Michał Mirosław, Jiri Pirko,
Stephen Hemminger, netdev, davem, kaber, fubar, eric.dumazet,
andy
In-Reply-To: <4E0DFCC1.1050409@gmail.com>
On Fri, Jul 01, 2011 at 06:58:41PM +0200, Nicolas de Pesloüan wrote:
> Le 01/07/2011 18:49, Ben Greear a écrit :
> > On 07/01/2011 09:45 AM, Nicolas de Pesloüan wrote:
> >> Le 01/07/2011 17:01, Michał Mirosław a écrit :
[...]
> >> eth0 - Get everything, untouched. (I know several people except tagged
> >> packets to be untagged here, but I disagree with this part. eth0 is the
> >> raw device and should deliver raw packets, possibly retagging packets
> >> that were untagged by hw-accel).
> >> eth0.100 - Get VLAN 100 packet, untagged.
> >> eth0.untagged - Get only non-tagged packets, untouched.
> >> eth0.unmatched - Get only tagged packets, untouched.
> >
> > Lets let the current vlan tagging changes settle a while before
> > adding yet more cruft in this area.
>
> Agreed.
I also agree that this should sleep for a bit, I do however see a
different use: adding a device to multiple bridges.
(this kinda obviously needs a dynamic priority)
Bridges can filter their RX on everything ebtables can match, they can
even strip off VLAN tags and become "super-VLAN" devices, if you want
that. (Can't access the stripped tag though... but what isn't can
come...)
For macvlan/macvtap tbh i try to abstain from using them. Whatever
performance gains/... they give, a setup like
(eth0-<br0>-veth0)...veth1/tap1
appears much cleaner to me.
-David
^ permalink raw reply
* [rfc] Remove member .name from struct netpoll
From: Joe Perches @ 2011-07-01 17:07 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, LKML
struct netpoll has member .name
struct netpoll {
struct net_device *dev;
char dev_name[IFNAMSIZ];
const char *name;
[...]
};
that is set only by netconsole.c
static struct netconsole_target *alloc_param_target(char *target_config)
{
[...]
nt->np.name = "netconsole";
and used only by net/core/netpoll.c to emit "netconsole: " on
logging messages.
e.g.
void netpoll_print_options(struct netpoll *np)
{
printk(KERN_INFO "%s: local port %d\n",
np->name, np->local_port);
I think it'd be more common to use pr_fmt and pr_<level>
to emit these logging messages.
Are there out of tree users or plans to use "struct netpoll"
by other modules?
If not, I propose to remove name from the struct.
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: Nicolas de Pesloüan @ 2011-07-01 16:58 UTC (permalink / raw)
To: Ben Greear
Cc: Michał Mirosław, Jiri Pirko, Stephen Hemminger, netdev,
davem, kaber, fubar, eric.dumazet, andy
In-Reply-To: <4E0DFA7F.20005@candelatech.com>
Le 01/07/2011 18:49, Ben Greear a écrit :
> On 07/01/2011 09:45 AM, Nicolas de Pesloüan wrote:
>> Le 01/07/2011 17:01, Michał Mirosław a écrit :
>>
>>>>> We could introduce a catch-all macvlan/vlan device that would take
>>>>> addresses/VLANs which are not covered by other configured
>>>>> macvlans/vlans. This would allow clearer configuration and would make
>>>>> the evaluation order explicit. As a bonus, this will give another
>>>>> device to put tcpdump on. ;-)
>>>>
>>>> 'Sounds like what I had in mind in
>>>> http://marc.info/?l=linux-netdev&m=130622112921245&w=2 .
>>>
>>> Almost. My idea assumes that eth0.any won't strip VLAN headers (so its
>>> just looks like a filtered eth0).
>>
>> I originally thought unstripped packets should go to eth0.
>>
>> But, if eth0.any get untagged packets, we face two problems:
>>
>> 1/ We need a way to retrieve the original tag.
>> 2/ We need a way to force the tag on output (or we consider eth0.any a
>> pure tcpdump device, which is less useful).
>>
>> But if eth0.any get the exact same packets as those delivered to eth0,
>> this seems useless.
>>
>> Or maybe, eth0.any should get only packets that weren't delivered to any
>> eth0.XXXX devices... and should be named eth0.unmatched instead of
>> eth0.any :-)
>>
>> Do we need eth0.untagged too (which would only get packets that were
>> originally *not* tagged)?
>>
>> eth0 - Get everything, untouched. (I know several people except tagged
>> packets to be untagged here, but I disagree with this part. eth0 is the
>> raw device and should deliver raw packets, possibly retagging packets
>> that were untagged by hw-accel).
>> eth0.100 - Get VLAN 100 packet, untagged.
>> eth0.untagged - Get only non-tagged packets, untouched.
>> eth0.unmatched - Get only tagged packets, untouched.
>
> Lets let the current vlan tagging changes settle a while before
> adding yet more cruft in this area.
Agreed.
> Packet filters should be able to filter on tags or not, so I don't
> think these extra interfaces would be useful or needed. We may
> need to fix up the sk-filter logic a bit to deal with the
> stripped tags, however.
Agreed too.
Nicolas.
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: David Lamparter @ 2011-07-01 16:55 UTC (permalink / raw)
To: Jiri Pirko
Cc: Nicolas de Pesloüan, netdev, davem, shemminger, kaber, fubar,
eric.dumazet, andy, Ben Greear
In-Reply-To: <20110701054537.GC2075@minipsycho>
On Fri, Jul 01, 2011 at 07:45:38AM +0200, Jiri Pirko wrote:
> Thu, Jun 30, 2011 at 09:50:52PM CEST, nicolas.2p.debian@gmail.com wrote:
> >Le 30/06/2011 17:16, Jiri Pirko a écrit :
> >>For some net topos it is necessary to have multiple "soft-net-devices"
> >>hooked on one netdev. For example very common is to have
> >>eth<->(br+vlan). Vlan is not using rh_handler (yet) but also for example
> >>macvlan would be useful to have hooked on same netdev as br.
> >>
> >>This patch introduces rx_handler list. size struct net_device stays
> >>intact. Measured performance regression on eth-br topo is ~1% (on received
> >>pkts generated by pktgen) and on eth-bond topo it is ~0.25%
> >>
> >>On br I think that the performance can be brought back maybe by using per-cpu
> >>variables to store port in rx_path (I must check this)
> >>
> >>Please comment.
> >>
> >>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> >
> >I like the idea of this patch.
> >
> >I didn't take time for a technical review yet, but I'm not sure
> >ordering should be static, depending on the kind of device (bond, br,
> >macvlan). Ordering is currently static, because it is hard coded.
> >
> >I think rx_handler_prio should be exposed to userspace, to allow user
> >setup to decide the exact order. Default order should be safe, but
> >user should be allowed to force a different order for special setups.
>
> Hmm I didn't think about this. Not sure about the right way how to expose
> this.
I agree with Nicolas, static ordering might not be sufficient. I'm not
even sure if dynamic ordering is sufficient...
Currently, I can use ebtables to control which packets a bridge eats, so
I can implement e.g.
eth0
-> eth0.123
-> br0
-> br0.234
by dropping vlan packets with ID 123 into ebtables "brouting", but other
devices do not have this granularity - if I have a macvlan and a 8021q
vlan, what happens?
Also, btw, the example eth<->(br+vlan) case you're citing works quite
nice if you have above ebtables setup... you're trying to make it work
without ebtables i assume?
-David
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: Ben Greear @ 2011-07-01 16:49 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Michał Mirosław, Jiri Pirko, Stephen Hemminger, netdev,
davem, kaber, fubar, eric.dumazet, andy
In-Reply-To: <4E0DF9C6.703@gmail.com>
On 07/01/2011 09:45 AM, Nicolas de Pesloüan wrote:
> Le 01/07/2011 17:01, Michał Mirosław a écrit :
>
>>>> We could introduce a catch-all macvlan/vlan device that would take
>>>> addresses/VLANs which are not covered by other configured
>>>> macvlans/vlans. This would allow clearer configuration and would make
>>>> the evaluation order explicit. As a bonus, this will give another
>>>> device to put tcpdump on. ;-)
>>>
>>> 'Sounds like what I had in mind in
>>> http://marc.info/?l=linux-netdev&m=130622112921245&w=2 .
>>
>> Almost. My idea assumes that eth0.any won't strip VLAN headers (so its
>> just looks like a filtered eth0).
>
> I originally thought unstripped packets should go to eth0.
>
> But, if eth0.any get untagged packets, we face two problems:
>
> 1/ We need a way to retrieve the original tag.
> 2/ We need a way to force the tag on output (or we consider eth0.any a
> pure tcpdump device, which is less useful).
>
> But if eth0.any get the exact same packets as those delivered to eth0,
> this seems useless.
>
> Or maybe, eth0.any should get only packets that weren't delivered to any
> eth0.XXXX devices... and should be named eth0.unmatched instead of
> eth0.any :-)
>
> Do we need eth0.untagged too (which would only get packets that were
> originally *not* tagged)?
>
> eth0 - Get everything, untouched. (I know several people except tagged
> packets to be untagged here, but I disagree with this part. eth0 is the
> raw device and should deliver raw packets, possibly retagging packets
> that were untagged by hw-accel).
> eth0.100 - Get VLAN 100 packet, untagged.
> eth0.untagged - Get only non-tagged packets, untouched.
> eth0.unmatched - Get only tagged packets, untouched.
Lets let the current vlan tagging changes settle a while before
adding yet more cruft in this area.
Packet filters should be able to filter on tags or not, so I don't
think these extra interfaces would be useful or needed. We may
need to fix up the sk-filter logic a bit to deal with the
stripped tags, however.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [RFC patch net-next-2.6] net: allow multiple rx_handler registration
From: Nicolas de Pesloüan @ 2011-07-01 16:45 UTC (permalink / raw)
To: Michał Mirosław, Jiri Pirko
Cc: Stephen Hemminger, netdev, davem, kaber, fubar, eric.dumazet,
andy
In-Reply-To: <BANLkTi=j03qATuV+a9OHnjcGsK6kB4zo6Q@mail.gmail.com>
Le 01/07/2011 17:01, Michał Mirosław a écrit :
>>> We could introduce a catch-all macvlan/vlan device that would take
>>> addresses/VLANs which are not covered by other configured
>>> macvlans/vlans. This would allow clearer configuration and would make
>>> the evaluation order explicit. As a bonus, this will give another
>>> device to put tcpdump on. ;-)
>>
>> 'Sounds like what I had in mind in
>> http://marc.info/?l=linux-netdev&m=130622112921245&w=2 .
>
> Almost. My idea assumes that eth0.any won't strip VLAN headers (so its
> just looks like a filtered eth0).
I originally thought unstripped packets should go to eth0.
But, if eth0.any get untagged packets, we face two problems:
1/ We need a way to retrieve the original tag.
2/ We need a way to force the tag on output (or we consider eth0.any a pure tcpdump device, which is
less useful).
But if eth0.any get the exact same packets as those delivered to eth0, this seems useless.
Or maybe, eth0.any should get only packets that weren't delivered to any eth0.XXXX devices... and
should be named eth0.unmatched instead of eth0.any :-)
Do we need eth0.untagged too (which would only get packets that were originally *not* tagged)?
eth0 - Get everything, untouched. (I know several people except tagged packets to be untagged here,
but I disagree with this part. eth0 is the raw device and should deliver raw packets, possibly
retagging packets that were untagged by hw-accel).
eth0.100 - Get VLAN 100 packet, untagged.
eth0.untagged - Get only non-tagged packets, untouched.
eth0.unmatched - Get only tagged packets, untouched.
Nicolas.
^ permalink raw reply
* Re: [PATCH] bridge: revisit IEEE 802 local multicast groups
From: David Lamparter @ 2011-07-01 16:40 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Lamparter, netdev, Nick Carter
In-Reply-To: <20110701092612.07b045bf@nehalam.ftrdhcpuser.net>
On Fri, Jul 01, 2011 at 09:26:12AM -0700, Stephen Hemminger wrote:
> On Fri, 1 Jul 2011 13:12:50 +0200
> David Lamparter <equinox@diac24.net> wrote:
>
> > this first and foremost fixes handling of bonding frames, which were
> > incorrectly forwarded until now. they need to never cross a bridge.
> >
> > it also introduces a new switch to control handling of the other
> > not-that-special groups; if you want them forwarded despite having
> > STP running, there's a sysfs knob for that. you can implement your
> > local policy with ebtables then.
> >
> > in the end, we now match hardware switch behaviour rather closely, but
> > still additionally allow playing tricks on things like 802.1X.
> >
> > Signed-off-by: David Lamparter <equinox@diac24.net>
> > Cc: Stephen Hemminger <shemminger@linux-foundation.org>
> > Cc: Nick Carter <ncarter100@gmail.com>
>
> Forwarding pause frames is wrong.
None of the patches discussed forwards pause frames.
> I wonder if the best solution for this crap is to just write
> a userland program to do the forwarding.
You can't do that without moving the remaining STP bits to userspace,
since if you want to keep STP in-kernel, you still need some policy.
Also, there is a fundamental conflict between a working bridge and the
desire to work as fully transparent L2 tap. As long as we forward
802.3ad/bonding frames, we are a broken bridge. Yet we still want that
for the tap case.
Plus, we don't need the userspace daemon if we can set the policy with
ebtables - which we can do if and only if we allow stripping down the
built-in restrictions.
I think the variant that I suggested to Michał, with a 3-value knob
"drop it if STP" / "forward except pause/bond" / "forward all" is
the best way to go. It leaves the default usable but allows controlling
everything through ebtables.
-David
^ permalink raw reply
* Re: [PATCH] bridge: revisit IEEE 802 local multicast groups
From: Stephen Hemminger @ 2011-07-01 16:26 UTC (permalink / raw)
To: David Lamparter; +Cc: netdev, Nick Carter
In-Reply-To: <1309518770-8547-1-git-send-email-equinox@diac24.net>
On Fri, 1 Jul 2011 13:12:50 +0200
David Lamparter <equinox@diac24.net> wrote:
> this first and foremost fixes handling of bonding frames, which were
> incorrectly forwarded until now. they need to never cross a bridge.
>
> it also introduces a new switch to control handling of the other
> not-that-special groups; if you want them forwarded despite having
> STP running, there's a sysfs knob for that. you can implement your
> local policy with ebtables then.
>
> in the end, we now match hardware switch behaviour rather closely, but
> still additionally allow playing tricks on things like 802.1X.
>
> Signed-off-by: David Lamparter <equinox@diac24.net>
> Cc: Stephen Hemminger <shemminger@linux-foundation.org>
> Cc: Nick Carter <ncarter100@gmail.com>
Forwarding pause frames is wrong.
I wonder if the best solution for this crap is to just write
a userland program to do the forwarding.
^ permalink raw reply
* [PATCH 2/2] nfnetlink_queue: provide rcu enabled callbacks
From: Eric Dumazet @ 2011-07-01 15:29 UTC (permalink / raw)
To: Patrick McHardy, Florian Westphal
Cc: sclark46, Eric Leblond, Kuzin Andrey, Anders Nilsson Plymoth,
netfilter-devel, netdev
nenetlink_queue operations on SMP are not efficent if several queues are
used, because of nfnl_mutex contention when applications give packet
verdict.
Use new call_rcu field in struct nfnl_callback to advertize a callback
that is called under rcu_read_lock instead of nfnl_mutex.
On my 2x4x2 machine, I was able to reach 2.000.000 pps going through
user land returning NF_ACCEPT verdicts without losses, instead of less
than 500.000 pps before patch.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Florian Westphal <fw@strlen.de>
CC: Eric Leblond <eric@regit.org>
CC: Patrick McHardy <kaber@trash.net>
---
net/netfilter/nfnetlink_queue.c | 41 ++++++++----------------------
1 files changed, 12 insertions(+), 29 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index fdd2faf..d3692fc 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -620,39 +620,26 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
struct nfqnl_instance *queue;
unsigned int verdict;
struct nf_queue_entry *entry;
- int err;
- rcu_read_lock();
queue = instance_lookup(queue_num);
- if (!queue) {
- err = -ENODEV;
- goto err_out_unlock;
- }
+ if (!queue)
+ return -ENODEV;
- if (queue->peer_pid != NETLINK_CB(skb).pid) {
- err = -EPERM;
- goto err_out_unlock;
- }
+ if (queue->peer_pid != NETLINK_CB(skb).pid)
+ return -EPERM;
- if (!nfqa[NFQA_VERDICT_HDR]) {
- err = -EINVAL;
- goto err_out_unlock;
- }
+ if (!nfqa[NFQA_VERDICT_HDR])
+ return -EINVAL;
vhdr = nla_data(nfqa[NFQA_VERDICT_HDR]);
verdict = ntohl(vhdr->verdict);
- if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT) {
- err = -EINVAL;
- goto err_out_unlock;
- }
+ if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT)
+ return -EINVAL;
entry = find_dequeue_entry(queue, ntohl(vhdr->id));
- if (entry == NULL) {
- err = -ENOENT;
- goto err_out_unlock;
- }
- rcu_read_unlock();
+ if (entry == NULL)
+ return -ENOENT;
if (nfqa[NFQA_PAYLOAD]) {
if (nfqnl_mangle(nla_data(nfqa[NFQA_PAYLOAD]),
@@ -665,10 +652,6 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
nf_reinject(entry, verdict);
return 0;
-
-err_out_unlock:
- rcu_read_unlock();
- return err;
}
static int
@@ -781,9 +764,9 @@ err_out_unlock:
}
static const struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = {
- [NFQNL_MSG_PACKET] = { .call = nfqnl_recv_unsupp,
+ [NFQNL_MSG_PACKET] = { .call_rcu = nfqnl_recv_unsupp,
.attr_count = NFQA_MAX, },
- [NFQNL_MSG_VERDICT] = { .call = nfqnl_recv_verdict,
+ [NFQNL_MSG_VERDICT] = { .call_rcu = nfqnl_recv_verdict,
.attr_count = NFQA_MAX,
.policy = nfqa_verdict_policy },
[NFQNL_MSG_CONFIG] = { .call = nfqnl_recv_config,
^ permalink raw reply related
* [PATCH 1/2] nfnetlink: add RCU in nfnetlink_rcv_msg()
From: Eric Dumazet @ 2011-07-01 15:27 UTC (permalink / raw)
To: Florian Westphal, Patrick McHardy
Cc: Eric Leblond, sclark46, Kuzin Andrey, Anders Nilsson Plymoth,
netfilter-devel, netdev
In-Reply-To: <20110701074936.GR16021@Chamillionaire.breakpoint.cc>
Le vendredi 01 juillet 2011 à 09:49 +0200, Florian Westphal a écrit :
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Number one offender is the nfnl_lock mutex hold each time we give a
> > verdict.
>
> Yes, the nfnl mutex is fairly annoying for nfqueue.
>
> Unfortunately it is not possible to just remove it
> completely since it also protects against module removal.
>
I believe it can, just add appropriate synchronization points.
> But I guess even having to grab a refcount would be
> a huge win as opposed to holding on to the nfnl mutex...
>
> We'd also need to audit all ->call implementations; most
> of them assume the nfnl_mutex is being hold.
CC netdev
We can do another way : Introduce a new ->call_rcu() implementation
and convert places where we prefer not holding nfnf_mutex.
If/when all places are converted, remove the ->call() field for good.
With following two patches, I was able to reach more than 2.000.000 pps
without losses on my setup (limited by my lab setup), instead of less
than 500.000 pps
Thanks
[PATCH 1/2] nfnetlink: add RCU in nfnetlink_rcv_msg()
Goal of this patch is to permit nfnetlink providers not mandate
nfnl_mutex being held while nfnetlink_rcv_msg() calls them.
If struct nfnl_callback contains a non NULL call_rcu(), then
nfnetlink_rcv_msg() will use it instead of call() field, holding
rcu_read_lock instead of nfnl_mutex
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Florian Westphal <fw@strlen.de>
CC: Eric Leblond <eric@regit.org>
CC: Patrick McHardy <kaber@trash.net>
---
include/linux/netfilter/nfnetlink.h | 3 +
net/netfilter/nfnetlink.c | 40 +++++++++++++++++++-------
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 2b11fc1..74d3386 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -60,6 +60,9 @@ struct nfnl_callback {
int (*call)(struct sock *nl, struct sk_buff *skb,
const struct nlmsghdr *nlh,
const struct nlattr * const cda[]);
+ int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
+ const struct nlmsghdr *nlh,
+ const struct nlattr * const cda[]);
const struct nla_policy *policy; /* netlink attribute policy */
const u_int16_t attr_count; /* number of nlattr's */
};
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index b4a4532..1905976 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -37,7 +37,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NETFILTER);
static char __initdata nfversion[] = "0.30";
-static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT];
+static const struct nfnetlink_subsystem __rcu *subsys_table[NFNL_SUBSYS_COUNT];
static DEFINE_MUTEX(nfnl_mutex);
void nfnl_lock(void)
@@ -59,7 +59,7 @@ int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
nfnl_unlock();
return -EBUSY;
}
- subsys_table[n->subsys_id] = n;
+ rcu_assign_pointer(subsys_table[n->subsys_id], n);
nfnl_unlock();
return 0;
@@ -71,7 +71,7 @@ int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n)
nfnl_lock();
subsys_table[n->subsys_id] = NULL;
nfnl_unlock();
-
+ synchronize_rcu();
return 0;
}
EXPORT_SYMBOL_GPL(nfnetlink_subsys_unregister);
@@ -83,7 +83,7 @@ static inline const struct nfnetlink_subsystem *nfnetlink_get_subsys(u_int16_t t
if (subsys_id >= NFNL_SUBSYS_COUNT)
return NULL;
- return subsys_table[subsys_id];
+ return rcu_dereference(subsys_table[subsys_id]);
}
static inline const struct nfnl_callback *
@@ -139,21 +139,27 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
type = nlh->nlmsg_type;
replay:
+ rcu_read_lock();
ss = nfnetlink_get_subsys(type);
if (!ss) {
#ifdef CONFIG_MODULES
- nfnl_unlock();
+ rcu_read_unlock();
request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
- nfnl_lock();
+ rcu_read_lock();
ss = nfnetlink_get_subsys(type);
if (!ss)
#endif
+ {
+ rcu_read_unlock();
return -EINVAL;
+ }
}
nc = nfnetlink_find_client(type, ss);
- if (!nc)
+ if (!nc) {
+ rcu_read_unlock();
return -EINVAL;
+ }
{
int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
@@ -167,7 +173,23 @@ replay:
if (err < 0)
return err;
- err = nc->call(net->nfnl, skb, nlh, (const struct nlattr **)cda);
+ if (nc->call_rcu) {
+ err = nc->call_rcu(net->nfnl, skb, nlh,
+ (const struct nlattr **)cda);
+ rcu_read_unlock();
+ } else {
+ rcu_read_unlock();
+ nfnl_lock();
+ if (rcu_dereference_protected(
+ subsys_table[NFNL_SUBSYS_ID(type)],
+ lockdep_is_held(&nfnl_mutex)) != ss ||
+ nfnetlink_find_client(type, ss) != nc)
+ err = -EAGAIN;
+ else
+ err = nc->call(net->nfnl, skb, nlh,
+ (const struct nlattr **)cda);
+ nfnl_unlock();
+ }
if (err == -EAGAIN)
goto replay;
return err;
@@ -176,9 +198,7 @@ replay:
static void nfnetlink_rcv(struct sk_buff *skb)
{
- nfnl_lock();
netlink_rcv_skb(skb, &nfnetlink_rcv_msg);
- nfnl_unlock();
}
static int __net_init nfnetlink_net_init(struct net *net)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: coding style question on indentation
From: Joe Perches @ 2011-07-01 15:23 UTC (permalink / raw)
To: Sathya.Perla; +Cc: netdev
In-Reply-To: <3367B80B08154D42A3B2BC708B5D41F63F87EF145E@EXMAIL.ad.emulex.com>
On Fri, 2011-07-01 at 04:20 -0700, Sathya.Perla@Emulex.Com wrote:
> a) Aligning the next line with the first argument by inserting a few spaces after the tabs - as in:
>
> dma_unmap_page(&adapter->pdev->dev,
> dma_unmap_addr(rx_page_info, bus),
> adapter->big_page_size, DMA_FROM_DEVICE);
My preference as well, but your example may not be correct.
I think this better:
1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
dma_unmap_page(&adapter->pdev->dev, dma_unmap_addr(rx_page_info, bus),
adapter->big_page_size, DMA_FROM_DEVICE);
maximally fill to 80 cols, then wrap with maximal tabs using spaces
if necessary to align args after opening parenthesis.
In this case, 2 tabs, 7 spaces.
It is your code though, do what you think best.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox