* Re: [PATCH 1/2] ipv4: Remove output route check in ipv4_mtu
From: Timo Teras @ 2013-01-17 8:35 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David Miller, Julian Anastasov, luky-37, pupilla, netdev
In-Reply-To: <20130117065500.GG18940@secunet.com>
On Thu, 17 Jan 2013 07:55:01 +0100 Steffen Klassert
<steffen.klassert@secunet.com> wrote:
> The output route check was introduced with git commit 261663b0
> (ipv4: Don't use the cached pmtu informations for input routes)
> during times when we cached the pmtu informations on the
> inetpeer. Now the pmtu informations are back in the routes,
> so this check is obsolete. It also had some unwanted side effects,
> as reported by Timo Teras and Lukas Tribus.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
Acked-by: Timo Teräs <timo.teras@iki.fi>
I think this should also go to stable queues which are applicable, since
the original commit caused CLAMPMSS and XFRM pmtu regressions.
The original thread of this is:
http://marc.info/?t=134208398500001&r=1&w=2
My original revert request is at:
http://marc.info/?l=linux-netdev&m=134242561624266&w=2
and additional reasoning at:
http://marc.info/?l=linux-netdev&m=134243626627716&w=2
Thanks,
Timo
^ permalink raw reply
* Re: [PATCH net-next] sk-filter: Add ability to lock a socket filter program
From: David Miller @ 2013-01-17 8:33 UTC (permalink / raw)
To: bernat; +Cc: netdev
In-Reply-To: <1358373349-22326-1-git-send-email-bernat@luffy.cx>
From: Vincent Bernat <bernat@luffy.cx>
Date: Wed, 16 Jan 2013 22:55:49 +0100
> While a privileged program can open a raw socket, attach some
> restrictive filter and drop its privileges (or send the socket to an
> unprivileged program through some Unix socket), the filter can still
> be removed or modified by the unprivileged program. This commit adds a
> socket option to lock the filter (SO_LOCK_FILTER) preventing any
> modification of a socket filter program.
>
> This is similar to OpenBSD BIOCLOCK ioctl on bpf sockets, except even
> root is not allowed change/drop the filter.
>
> The state of the lock can be read with getsockopt(). No error is
> triggered if the state is not changed. -EPERM is returned when a user
> tries to remove the lock or to change/remove the filter while the lock
> is active. The check is done directly in sk_attach_filter() and
> sk_detach_filter() and does not affect only setsockopt() syscall.
>
> Signed-off-by: Vincent Bernat <bernat@luffy.cx>
Looks good, applied, thanks Vincent.
^ permalink raw reply
* Re: [PATCH net-next] bnx2x: fix GRO parameters
From: Yuval Mintz @ 2013-01-17 7:16 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Eilon Greenstein, ariele
In-Reply-To: <1358355038.19956.694.camel@edumazet-glaptop>
> There is no downside providing gso_segs and gso_type, you have all
> needed information as shown in the patch I cooked and tested.
>
> Our goal is to remove CONFIG_INET_LRO, so all multi-segments packets
> should have the same set of parameters (gso_size, gso_segs, gso_type)
I concur - I'll make the semantic modification to your patch and re-submit
it later on today.
Thanks,
Yuval
^ permalink raw reply
* [PATCH] ipv6: Add an error handler for icmp6
From: Steffen Klassert @ 2013-01-17 8:09 UTC (permalink / raw)
To: David Miller; +Cc: Duan Jiong, netdev
pmtu and redirect events are now handled in the protocols error handler,
so add an error handler for icmp6 to do this. It is needed in the case
when we have no socket context. Based on a patch by Duan Jiong.
Reported-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/icmp.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b4a9fd5..fff5bdd 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -81,10 +81,22 @@ static inline struct sock *icmpv6_sk(struct net *net)
return net->ipv6.icmp_sk[smp_processor_id()];
}
+static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+ u8 type, u8 code, int offset, __be32 info)
+{
+ struct net *net = dev_net(skb->dev);
+
+ if (type == ICMPV6_PKT_TOOBIG)
+ ip6_update_pmtu(skb, net, info, 0, 0);
+ else if (type == NDISC_REDIRECT)
+ ip6_redirect(skb, net, 0, 0);
+}
+
static int icmpv6_rcv(struct sk_buff *skb);
static const struct inet6_protocol icmpv6_protocol = {
.handler = icmpv6_rcv,
+ .err_handler = icmpv6_err,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
--
1.7.9.5
^ permalink raw reply related
* [patch] isdn/gigaset: off by one check leading to oops
From: Dan Carpenter @ 2013-01-17 7:44 UTC (permalink / raw)
To: Hansjoerg Lipp
Cc: Tilman Schmidt, Karsten Keil, gigaset307x-common, netdev,
kernel-janitors
If l == 12 then later we subtract 12 leaving zero. We do a zero size
allocation, so "dbgline" points to the ZERO_SIZE_PTR. It leads to an
oops when we set the NUL terminator:
dbgline[3 * l - 1] = '\0';
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis stuff.
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 68452b7..0d34325 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -239,7 +239,7 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
return;
l = CAPIMSG_LEN(data);
- if (l < 12) {
+ if (l <= 12) {
gig_dbg(level, "%s: ??? LEN=%04d", tag, l);
return;
}
^ permalink raw reply related
* Re: [PATCH net-next 4/7] net/mlx4_en: Set carrier to off when a port is stopped
From: Amir Vadai @ 2013-01-17 7:04 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David S. Miller, netdev, Or Gerlitz, Eugenia Emantayev
In-Reply-To: <1358352016.2923.15.camel@bwh-desktop.uk.solarflarecom.com>
On 16/01/2013 18:00, Ben Hutchings wrote:
> On Wed, 2013-01-16 at 17:42 +0200, Amir Vadai wrote:
>> >From: Eugenia Emantayev<eugenia@mellanox.com>
>> >
>> >Under heavy CPU load changing ring size/mtu/etc. could result in transmit
>> >timeout, since stop-start port might take more than 10 sec. Set
>> >netif_carrier_off to prevent tx queue transmit timeout.
> A spurious link change can restart L3 auto-configuration (DHCP, SLAAC,
> etc.) netif_device_detach() also inhibits the watchdog and doesn't have
> that problem.
>
> Ben.
>
Thanks, Ben.
I will change it to netif_device_attach().
Since this will need some testing, will resend the patchset without this
patch for now.
Amir.
^ permalink raw reply
* Re: Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>
From: Cong Wang @ 2013-01-17 7:02 UTC (permalink / raw)
To: Jike Song
Cc: David Miller, vapier, bhutchings, libc-alpha, yoshfuji, tmb,
eblake, netdev, linux-kernel, libvirt-list, tgraf, schwab, carlos
In-Reply-To: <1358405953.2547.3.camel@cr0>
----- Original Message -----
>
> I see no reason, even although I don't know why it is 46 instead of
> 40.
Ok, for "0000:0000:0000:0000:0000:0000:255.255.255.255".
^ permalink raw reply
* Re: Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>
From: Cong Wang @ 2013-01-17 6:59 UTC (permalink / raw)
To: Jike Song
Cc: David Miller, vapier, bhutchings, libc-alpha, yoshfuji, tmb,
eblake, netdev, linux-kernel, libvirt-list, tgraf, schwab, carlos
In-Reply-To: <CANE52KhF17WRZTUbrjRDnwcbdN+V+69=ZqXjBwPjnswEO5iz7g@mail.gmail.com>
On Thu, 2013-01-17 at 11:55 +0800, Jike Song wrote:
> On Thu, Jan 17, 2013 at 2:59 AM, David Miller <davem@davemloft.net> wrote:
>
> >
> > When GLIBC doesn't provide it's own definition of some networking
> > macros or interfaces that the kernel provides, people include the
> > kernel header.
> >
>
> Recently I got a problem when copying a structure from kernel to userspace,
> after debugging I found:
>
> kernel: include/linux/inet.h
>
> #define INET6_ADDRSTRLEN (48)
>
> glibc: /usr/include/netinet/in.h
>
> #define INET6_ADDRSTRLEN 46
>
>
> Any reason to differentiate them from each other?
>
I see no reason, even although I don't know why it is 46 instead of 40.
But include/linux/inet.h is not exported to user-space, AFAIK.
^ permalink raw reply
* [PATCH 2/2] ipv4: Don't update the pmtu on mtu locked routes
From: Steffen Klassert @ 2013-01-17 6:58 UTC (permalink / raw)
To: David Miller; +Cc: Julian Anastasov, timo.teras, luky-37, pupilla, netdev
In-Reply-To: <20130117065500.GG18940@secunet.com>
Routes with locked mtu should not use learned pmtu informations,
so do not update the pmtu on these routes.
Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/route.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6e4a89c..259cbee 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -912,6 +912,9 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
struct dst_entry *dst = &rt->dst;
struct fib_result res;
+ if (dst_metric_locked(dst, RTAX_MTU))
+ return;
+
if (dst->dev->mtu < mtu)
return;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/2] ipv4: Remove output route check in ipv4_mtu
From: Steffen Klassert @ 2013-01-17 6:55 UTC (permalink / raw)
To: David Miller; +Cc: Julian Anastasov, timo.teras, luky-37, pupilla, netdev
The output route check was introduced with git commit 261663b0
(ipv4: Don't use the cached pmtu informations for input routes)
during times when we cached the pmtu informations on the
inetpeer. Now the pmtu informations are back in the routes,
so this check is obsolete. It also had some unwanted side effects,
as reported by Timo Teras and Lukas Tribus.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 844a9ef..6e4a89c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1120,7 +1120,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
if (!mtu || time_after_eq(jiffies, rt->dst.expires))
mtu = dst_metric_raw(dst, RTAX_MTU);
- if (mtu && rt_is_output_route(rt))
+ if (mtu)
return mtu;
mtu = dst->dev->mtu;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] CDC_NCM adding support IFF_NOARP for infineon modem platform
From: Wei Shuai @ 2013-01-17 6:44 UTC (permalink / raw)
To: Dan Williams
Cc: Greg Kroah-Hartman, Alexey Orishko, Bjørn Mork,
linux-usb@vger.kernel.org, netdev@vger.kernel.org
In-Reply-To: <1358372743.8713.0.camel@dcbw.foobar.com>
OK, I will follow up. after add FLAG_NOARP, how should I handle
IFF_NOARP? will I do it in cdc_ncm.c or usb_net.c?
2013/1/17 Dan Williams <dcbw@redhat.com>:
> On Sat, 2013-01-12 at 19:34 +0800, Wei Shuai wrote:
>> Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. so I introduce a flag CDC_NCM_DRIVER_DATA_NOARP which is defined in driver_info:data. so later on, if more such buggy devices are found, they could use same flag to handle.
>
> So given that Dave now approves of IFF_NOARP, let's change your original
> patch to add a FLAG_NOARP for the .flags structure instead of inventing
> another mechanism for .data.
>
> Dan
>
>> Signed-off-by: Wei Shuai <cpuwolf@gmail.com>
>> ---
>> drivers/net/usb/cdc_ncm.c | 29 +++++++++++++++++++++++++++++
>> 1 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
>> index 71b6e92..6093e07 100644
>> --- a/drivers/net/usb/cdc_ncm.c
>> +++ b/drivers/net/usb/cdc_ncm.c
>> @@ -55,6 +55,9 @@
>>
>> #define DRIVER_VERSION "14-Mar-2012"
>>
>> +/* Flags for driver_info::data */
>> +#define CDC_NCM_DRIVER_DATA_NOARP 1
>> +
>> static void cdc_ncm_txpath_bh(unsigned long param);
>> static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx);
>> static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer);
>> @@ -573,6 +576,10 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
>> return -ENODEV;
>> #endif
>>
>> + if (dev->driver_info->data & CDC_NCM_DRIVER_DATA_NOARP) {
>> + /* some buggy device cannot do ARP*/
>> + dev->net->flags |= IFF_NOARP;
>> + }
>> /* NCM data altsetting is always 1 */
>> ret = cdc_ncm_bind_common(dev, intf, 1);
>>
>> @@ -1155,6 +1162,21 @@ static const struct driver_info wwan_info = {
>> .tx_fixup = cdc_ncm_tx_fixup,
>> };
>>
>> +/* Same as wwan_info, but with IFF_NOARP */
>> +static const struct driver_info wwan_noarp_info = {
>> + .description = "Mobile Broadband Network Device (NO ARP)",
>> + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
>> + | FLAG_WWAN,
>> + .data = CDC_NCM_DRIVER_DATA_NOARP,
>> + .bind = cdc_ncm_bind,
>> + .unbind = cdc_ncm_unbind,
>> + .check_connect = cdc_ncm_check_connect,
>> + .manage_power = usbnet_manage_power,
>> + .status = cdc_ncm_status,
>> + .rx_fixup = cdc_ncm_rx_fixup,
>> + .tx_fixup = cdc_ncm_tx_fixup,
>> +};
>> +
>> static const struct usb_device_id cdc_devs[] = {
>> /* Ericsson MBM devices like F5521gw */
>> { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
>> @@ -1194,6 +1216,13 @@ static const struct usb_device_id cdc_devs[] = {
>> .driver_info = (unsigned long)&wwan_info,
>> },
>>
>> + /* Infineon(now Intel) HSPA Modem platform */
>> + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,
>> + USB_CLASS_COMM,
>> + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
>> + .driver_info = (unsigned long)&wwan_noarp_info,
>> + },
>> +
>> /* Generic CDC-NCM devices */
>> { USB_INTERFACE_INFO(USB_CLASS_COMM,
>> USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
>
>
^ permalink raw reply
* Re: [PATCH] ipv4: Remove output route check in ipv4_mtu
From: Steffen Klassert @ 2013-01-17 6:31 UTC (permalink / raw)
To: Julian Anastasov; +Cc: David Miller, timo.teras, luky-37, pupilla, netdev
In-Reply-To: <alpine.LFD.2.00.1301162236320.1760@ja.ssi.bg>
On Wed, Jan 16, 2013 at 11:01:39PM +0200, Julian Anastasov wrote:
>
> On Wed, 16 Jan 2013, Steffen Klassert wrote:
> >
> > Not absolutely sure what you want to do if the mtu is locked.
> > But if you don't want to genetate a nh exception and don't update
> > rt->rt_pmtu in this case, rt->rt_pmtu is never set on routes with
> > locked mtu. We probably would not need to change ipv4_mtu() to the
> > above variant.
>
> Yes, we have to exit __ip_rt_update_pmtu if
> fib_mtu is locked. Then rt_pmtu should stay 0 and
> your variant of ipv4_mtu should be ok. I hope you
> can simply extend your patch with such additional
> check in __ip_rt_update_pmtu:
>
> if (dst_metric_locked(dst, RTAX_MTU))
> return;
>
That's what I had in mind. I'll do that with an additional
patch, it's a another issue.
Thanks for the input!
^ permalink raw reply
* Re: [Patch net-next 1/2] xfrm: replace rwlock on xfrm_state_afinfo with rcu
From: Cong Wang @ 2013-01-17 6:22 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev, Steffen Klassert, Herbert Xu, David S. Miller
In-Reply-To: <50F6B1DC.4030307@linux-ipv6.org>
On Wed, 2013-01-16 at 22:57 +0900, YOSHIFUJI Hideaki wrote:
> Cong Wang wrote:
> >
> > static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo)
> > - __releases(xfrm_state_afinfo_lock)
> > {
> > - write_unlock_bh(&xfrm_state_afinfo_lock);
> > + spin_unlock_bh(&xfrm_state_afinfo_lock);
> > }
> >
> > int xfrm_register_type(const struct xfrm_type *type, unsigned short family)
>
> Why removing __releases() hint?
There is no __acquires matched:
% git grep __acquires -- net/xfrm
<nothing output>
^ permalink raw reply
* Re: [PATCH net-next V6 06/14] bridge: Add netlink interface to configure vlans on bridge ports
From: David Miller @ 2013-01-17 5:52 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev
In-Reply-To: <kd806c$ptv$2@ger.gmane.org>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 17 Jan 2013 04:54:37 +0000 (UTC)
> On Wed, 16 Jan 2013 at 18:18 GMT, Vlad Yasevich <vyasevic@redhat.com> wrote:
>> +
>> +struct bridge_vlan_info {
>> + u16 flags;
>> + u16 vid;
>> +};
>
> I think you have to use __u16 in UAPI headers.
That's right.
^ permalink raw reply
* Re: [PATCH net-next V6 12/14] bridge: Add vlan support to static neighbors
From: Cong Wang @ 2013-01-17 5:16 UTC (permalink / raw)
To: netdev
In-Reply-To: <1358360289-23249-13-git-send-email-vyasevic@redhat.com>
On Wed, 16 Jan 2013 at 18:18 GMT, Vlad Yasevich <vyasevic@redhat.com> wrote:
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index a244efc..90d0bc9 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -506,6 +506,10 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
> ci.ndm_refcnt = 0;
> if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci))
> goto nla_put_failure;
> +
> + if (nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id))
> + goto nla_put_failure;
Why not just nla_put_u16()?
> +
> + /* We have vlans configured on this port and user didn't
> + * specify a VLAN. To be nice, add/update entry for every
> + * vlan on this port.
> + */
> + err = -ENOENT;
> + list_for_each_entry_rcu(pve, &p->vlan_info.vlan_list, list) {
> + err &= __br_fdb_delete(p, addr, pve->vid);
> + }
'&=' or '|='?
^ permalink raw reply
* [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
In-Reply-To: <1358399388-30062-1-git-send-email-alan@signal11.us>
Handle the reception of uncompressed packets (dispatch type = IPv6).
Signed-off-by: Alan Ott <alan@signal11.us>
---
net/ieee802154/6lowpan.c | 41 ++++++++++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 9 deletions(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 1714cfa..09cba81 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1147,19 +1147,42 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
goto drop;
/* check that it's our buffer */
- switch (skb->data[0] & 0xe0) {
- case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
- case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
- case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */
- local_skb = skb_clone(skb, GFP_ATOMIC);
+ if (skb->data[0] == LOWPAN_DISPATCH_IPV6) {
+ /* Copy the packet so that the IPv6 header is
+ * properly aligned.
+ */
+ local_skb = skb_copy_expand(skb, NET_SKB_PAD - 1,
+ skb_tailroom(skb), GFP_ATOMIC);
if (!local_skb)
goto drop;
- lowpan_process_data(local_skb);
+ local_skb->protocol = htons(ETH_P_IPV6);
+ local_skb->pkt_type = PACKET_HOST;
+
+ /* Pull off the 1-byte of 6lowpan header. */
+ skb_pull(local_skb, 1);
+ skb_reset_network_header(local_skb);
+ skb_set_transport_header(local_skb, sizeof(struct ipv6hdr));
+
+ lowpan_give_skb_to_devices(local_skb);
+
+ kfree_skb(local_skb);
kfree_skb(skb);
- break;
- default:
- break;
+ } else {
+ switch (skb->data[0] & 0xe0) {
+ case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
+ case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
+ case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */
+ local_skb = skb_clone(skb, GFP_ATOMIC);
+ if (!local_skb)
+ goto drop;
+ lowpan_process_data(local_skb);
+
+ kfree_skb(skb);
+ break;
+ default:
+ break;
+ }
}
return NET_RX_SUCCESS;
--
1.7.11.2
^ permalink raw reply related
* [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: Eric Dumazet, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Alan Ott
In-Reply-To: <1358399388-30062-1-git-send-email-alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
Refactor the handing of the skb's to the individual lowpan devices into a
function.
Signed-off-by: Alan Ott <alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
---
net/ieee802154/6lowpan.c | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index f651da6..1714cfa 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -594,10 +594,32 @@ static int lowpan_header_create(struct sk_buff *skb,
}
}
+static int lowpan_give_skb_to_devices(struct sk_buff *skb)
+{
+ struct lowpan_dev_record *entry;
+ struct sk_buff *skb_cp;
+ int stat = NET_RX_SUCCESS;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(entry, &lowpan_devices, list)
+ if (lowpan_dev_info(entry->ldev)->real_dev == skb->dev) {
+ skb_cp = skb_copy(skb, GFP_ATOMIC);
+ if (!skb_cp) {
+ stat = -ENOMEM;
+ break;
+ }
+
+ skb_cp->dev = entry->ldev;
+ stat = netif_rx(skb_cp);
+ }
+ rcu_read_unlock();
+
+ return stat;
+}
+
static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr)
{
struct sk_buff *new;
- struct lowpan_dev_record *entry;
int stat = NET_RX_SUCCESS;
new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
@@ -614,19 +636,7 @@ static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr)
new->protocol = htons(ETH_P_IPV6);
new->pkt_type = PACKET_HOST;
- rcu_read_lock();
- list_for_each_entry_rcu(entry, &lowpan_devices, list)
- if (lowpan_dev_info(entry->ldev)->real_dev == new->dev) {
- skb = skb_copy(new, GFP_ATOMIC);
- if (!skb) {
- stat = -ENOMEM;
- break;
- }
-
- skb->dev = entry->ldev;
- stat = netif_rx(skb);
- }
- rcu_read_unlock();
+ stat = lowpan_give_skb_to_devices(new);
kfree_skb(new);
--
1.7.11.2
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
^ permalink raw reply related
* [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: Eric Dumazet, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Alan Ott
In-Reply-To: <1358315037-10043-1-git-send-email-alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
This has been tested by exchanging data with with the Contiki operating
system using a Redwire Econotag. Contiki had to be set to send uncompressed
data, and had to have a #define modified to enable reception and processing
of header-compressed packets when not set to send compressed data.
Version 2 fixes a format issue pointed out by David Miller.
Alan Ott (2):
6lowpan: Refactor packet delivery into a function
6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
net/ieee802154/6lowpan.c | 79 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 56 insertions(+), 23 deletions(-)
--
1.7.11.2
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
^ permalink raw reply
* Re: [PATCH net-next V6 06/14] bridge: Add netlink interface to configure vlans on bridge ports
From: Cong Wang @ 2013-01-17 4:54 UTC (permalink / raw)
To: netdev
In-Reply-To: <1358360289-23249-7-git-send-email-vyasevic@redhat.com>
On Wed, 16 Jan 2013 at 18:18 GMT, Vlad Yasevich <vyasevic@redhat.com> wrote:
> +
> +struct bridge_vlan_info {
> + u16 flags;
> + u16 vid;
> +};
I think you have to use __u16 in UAPI headers.
^ permalink raw reply
* Re: [Patch net-next v4] netpoll: fix a rtnl lock assertion failure
From: Eric Dumazet @ 2013-01-17 4:53 UTC (permalink / raw)
To: Cong Wang; +Cc: David Miller, netdev, jiri
In-Reply-To: <1358396284.3855.16.camel@cr0>
On Thu, 2013-01-17 at 12:18 +0800, Cong Wang wrote:
> > Why not just... call dev_get_by_name()? It doesn't hurt to over-RCU
> > lock.
> >
>
> Just that taking RCU read lock while having rtnl lock is unnecessary, no
> other reason.
Calling the dev_get_by_name() would be just fine, and generate less
code.
Its not a fast path...
Anyway David already applied your patch.
^ permalink raw reply
* Re: [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure
From: Cong Wang @ 2013-01-17 4:47 UTC (permalink / raw)
To: netdev
In-Reply-To: <1358360289-23249-3-git-send-email-vyasevic@redhat.com>
On Wed, 16 Jan 2013 at 18:17 GMT, Vlad Yasevich <vyasevic@redhat.com> wrote:
> +config BRIDGE_VLAN_FILTERING
> + bool "VLAN filtering"
> + depends on BRIDGE
> + depends on VLAN_8021Q
> + default y
This should default to n, otherwise Linus will complain.
> + ---help---
> + If you say Y here, then the Ethernet bridge will be able selectively
> + receive and forward traffic based on VLAN information in the packet
> + any VLAN information configured on the bridge port or bridge device.
_and_ any VLAN information...? Missed 'and'?
^ permalink raw reply
* Re: [Patch net-next] netpoll: fix a missing dev refcounting
From: David Miller @ 2013-01-17 4:33 UTC (permalink / raw)
To: amwang; +Cc: netdev, eric.dumazet, jiri
In-Reply-To: <1358396468-14938-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Date: Thu, 17 Jan 2013 12:21:08 +0800
> __dev_get_by_name() doesn't refcount the network device,
> so we have to do this by ourselves. Noticed by Eric.
>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Applied.
^ permalink raw reply
* [Patch net-next] netpoll: fix a missing dev refcounting
From: Cong Wang @ 2013-01-17 4:21 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet, Jiri Pirko, David S. Miller, Cong Wang
__dev_get_by_name() doesn't refcount the network device,
so we have to do this by ourselves. Noticed by Eric.
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a5ad1c1..a9b1004 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -1056,6 +1056,7 @@ int netpoll_setup(struct netpoll *np)
err = -ENODEV;
goto unlock;
}
+ dev_hold(ndev);
if (netdev_master_upper_dev_get(ndev)) {
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
^ permalink raw reply related
* Re: [Patch net-next v4] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-17 4:18 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, jiri
In-Reply-To: <20130116.225413.1184047803896995845.davem@davemloft.net>
On Wed, 2013-01-16 at 22:54 -0500, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Thu, 17 Jan 2013 11:30:18 +0800
>
> > On Wed, 2013-01-16 at 17:24 -0800, Eric Dumazet wrote:
> >> On Tue, 2013-01-15 at 17:34 +0800, Cong Wang wrote:
> >> > if (np->dev_name)
> >> > - ndev = dev_get_by_name(&init_net, np->dev_name);
> >> > + ndev = __dev_get_by_name(&init_net, np->dev_name);
> >>
> >> This change brings interesting bugs.
> >
> > Hmm, I didn't realize __dev_get_by_name() doesn't hold the device, so
> > just call dev_hold() after this?
>
> Why not just... call dev_get_by_name()? It doesn't hurt to over-RCU
> lock.
>
Just that taking RCU read lock while having rtnl lock is unnecessary, no
other reason.
^ permalink raw reply
* Re: [Patch net-next v4] netpoll: fix a rtnl lock assertion failure
From: Cong Wang @ 2013-01-17 4:00 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, jiri
In-Reply-To: <20130116.225238.238898828520417471.davem@davemloft.net>
On Wed, 2013-01-16 at 22:52 -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 16 Jan 2013 17:24:45 -0800
>
> >> if (np->dev_name)
> >> - ndev = dev_get_by_name(&init_net, np->dev_name);
> >> + ndev = __dev_get_by_name(&init_net, np->dev_name);
> ...
> > Please revert this part.
>
> You mean just revert that hunk above that made it use the
> non-refcounting version of dev_get_by_name()?
But there is no reason to take both rtnl lock and RCU read lock,
although that is fine.
I think just adding dev_hold() is enough.
^ 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