Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] net: vxlan: when lower dev unregisters remove vxlan dev as well
From: Daniel Borkmann @ 2014-01-10 19:07 UTC (permalink / raw)
  To: Cong Wang; +Cc: David Miller, netdev
In-Reply-To: <CAHA+R7NPyEmSpmojrM6pOsAVq3B6NjVWWCw0oQMPZFdCaDW9sA@mail.gmail.com>

On 01/10/2014 07:51 PM, Cong Wang wrote:
> On Fri, Jan 10, 2014 at 5:01 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
>> We can create a vxlan device with an explicit underlying carrier.
>> In that case, when the carrier link is being deleted from the
>> system (e.g. due to module unload) we should also clean up all
>> created vxlan devices on top of it since otherwise we're in an
>> inconsistent state in vxlan device. In that case, the user needs
>> to remove all such devices, while in case of other virtual devs
>> that sit on top of physical ones, it is usually the case that
>> these devices do unregister automatically as well and do not
>> leave the burden on the user.
>>
>> This work is not necessary when vxlan device was not created with
>> a real underlying device, as connections can resume in that case
>> when driver is plugged again. But at least for the other cases,
>> we should go ahead and do the cleanup on removal.
>
> So it makes sense to move the notifier register to vxlan_newlink()
> from vxlan_init_module()?

That is probably a design descision ... I didn't want to bloat the
struct vxlan_dev, and by this approach, we can simply batch removals
through unregister_netdevice_many(), that's all.

> ...
>>
>> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
>> index 481f85d..39035ba 100644
>> --- a/drivers/net/vxlan.c
>> +++ b/drivers/net/vxlan.c
>> @@ -2656,6 +2656,54 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
>>          .fill_info      = vxlan_fill_info,
>>   };
>>
>> +static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
>> +                                            struct net_device *dev)
>> +{
>> +       struct vxlan_dev *vxlan, *next;
>> +       LIST_HEAD(list_kill);
>> +
>> +       BUG_ON(!rtnl_is_locked());
>
>
> This is not necessary at all, it is known that netdev notication
> holds rtnl lock.

We're not in fast-path, and if someone would call that function outside
of the notifier chain, it might be good to check if the lock was taken,
but if there's a strong opinion to not have that, I'll just remove it.

>> +
>> +       list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next) {
>> +               struct vxlan_rdst *dst = &vxlan->default_dst;
>> +
>> +               /* In case we created vxlan device with carrier
>> +                * and we loose the carrier due to module unload
>> +                * we also need to remove vxlan device. In other
>> +                * cases, it's not necessary and remote_ifindex
>> +                * is 0 here, so no matches.
>> +                */
>> +               if (dst->remote_ifindex == dev->ifindex)
>> +                       vxlan_dellink(vxlan->dev, &list_kill);
>> +       }
>> +
>> +       unregister_netdevice_many(&list_kill);
>> +       list_del(&list_kill);
>
>
> I think you need to flush fdb as well?

Seems this is not done through normal rtnl_ops->dellink(); vxlan_dellink()
is what we call there as well ...

>>   static __net_init int vxlan_init_net(struct net *net)
>>   {
>>          struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> @@ -2673,14 +2721,16 @@ static __net_init int vxlan_init_net(struct net *net)
>>   static __net_exit void vxlan_exit_net(struct net *net)
>>   {
>>          struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> -       struct vxlan_dev *vxlan;
>> -       LIST_HEAD(list);
>> +       struct vxlan_dev *vxlan, *next;
>> +       LIST_HEAD(list_kill);
>>
>>          rtnl_lock();
>> -       list_for_each_entry(vxlan, &vn->vxlan_list, next)
>> -               unregister_netdevice_queue(vxlan->dev, &list);
>> -       unregister_netdevice_many(&list);
>> +       list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next)
>> +               vxlan_dellink(vxlan->dev, &list_kill);
>> +       unregister_netdevice_many(&list_kill);
>>          rtnl_unlock();
>> +
>> +       list_del(&list_kill);
>
>
> Why these changes in vxlan_exit_net()?

I think this is way cleaner; instead of only doing half the work, we
should remove it in the same way as we remove devices through normal
rtnl ops. In case we would do allocations in future that are being
freed during vxlan_dellink(), we would simply leak them here otherwise.

^ permalink raw reply

* Re: [PATCH] HHF qdisc: fix jiffies-time conversion.
From: Nandita Dukkipati @ 2014-01-10 19:02 UTC (permalink / raw)
  To: Terry Lam; +Cc: David S. Miller, Netdev, Stephen Hemminger
In-Reply-To: <1389256800-18809-1-git-send-email-vtlam@google.com>

On Thu, Jan 9, 2014 at 12:40 AM, Terry Lam <vtlam@google.com> wrote:
> This is to be compatible with the use of "get_time" (i.e. default
> time unit in us) in iproute2 patch for HHF as requested by Stephen.
>
> Signed-off-by: Terry Lam <vtlam@google.com>
> ---
>  net/sched/sch_hhf.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c
> index cf7f614..1cf84a9 100644
> --- a/net/sched/sch_hhf.c
> +++ b/net/sched/sch_hhf.c
> @@ -574,18 +574,18 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
>                 q->hh_flows_limit = nla_get_u32(tb[TCA_HHF_HH_FLOWS_LIMIT]);
>
>         if (tb[TCA_HHF_RESET_TIMEOUT]) {
> -               u32 ms = nla_get_u32(tb[TCA_HHF_RESET_TIMEOUT]);
> +               u32 us = nla_get_u32(tb[TCA_HHF_RESET_TIMEOUT]);
>
> -               q->hhf_reset_timeout = msecs_to_jiffies(ms);
> +               q->hhf_reset_timeout = usecs_to_jiffies(us);
>         }
>
>         if (tb[TCA_HHF_ADMIT_BYTES])
>                 q->hhf_admit_bytes = nla_get_u32(tb[TCA_HHF_ADMIT_BYTES]);
>
>         if (tb[TCA_HHF_EVICT_TIMEOUT]) {
> -               u32 ms = nla_get_u32(tb[TCA_HHF_EVICT_TIMEOUT]);
> +               u32 us = nla_get_u32(tb[TCA_HHF_EVICT_TIMEOUT]);
>
> -               q->hhf_evict_timeout = msecs_to_jiffies(ms);
> +               q->hhf_evict_timeout = usecs_to_jiffies(us);
>         }
>
>         qlen = sch->q.qlen;
> @@ -684,10 +684,10 @@ static int hhf_dump(struct Qdisc *sch, struct sk_buff *skb)
>             nla_put_u32(skb, TCA_HHF_QUANTUM, q->quantum) ||
>             nla_put_u32(skb, TCA_HHF_HH_FLOWS_LIMIT, q->hh_flows_limit) ||
>             nla_put_u32(skb, TCA_HHF_RESET_TIMEOUT,
> -                       jiffies_to_msecs(q->hhf_reset_timeout)) ||
> +                       jiffies_to_usecs(q->hhf_reset_timeout)) ||
>             nla_put_u32(skb, TCA_HHF_ADMIT_BYTES, q->hhf_admit_bytes) ||
>             nla_put_u32(skb, TCA_HHF_EVICT_TIMEOUT,
> -                       jiffies_to_msecs(q->hhf_evict_timeout)) ||
> +                       jiffies_to_usecs(q->hhf_evict_timeout)) ||
>             nla_put_u32(skb, TCA_HHF_NON_HH_WEIGHT, q->hhf_non_hh_weight))
>                 goto nla_put_failure;
>
> --
> 1.8.5.1
>
Acked-by: Nandita Dukkipati <nanditad@google.com>

^ permalink raw reply

* [PATCH] netfilter: introduce l2tp match extension
From: Pablo Neira Ayuso @ 2014-01-10 18:55 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1389380158-8754-1-git-send-email-pablo@netfilter.org>

From: James Chapman <jchapman@katalix.com>

Introduce an xtables add-on for matching L2TP packets. Supports L2TPv2
and L2TPv3 over IPv4 and IPv6. As well as filtering on L2TP tunnel-id
and session-id, the filtering decision can also include the L2TP
packet type (control or data), protocol version (2 or 3) and
encapsulation type (UDP or IP).

The most common use for this will likely be to filter L2TP data
packets of individual L2TP tunnels or sessions. While a u32 match can
be used, the L2TP protocol headers are such that field offsets differ
depending on bits set in the header, making rules for matching generic
L2TP connections cumbersome. This match extension takes care of all
that.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/uapi/linux/netfilter/Kbuild    |    1 +
 include/uapi/linux/netfilter/xt_l2tp.h |   27 +++
 net/netfilter/Kconfig                  |   10 +
 net/netfilter/Makefile                 |    1 +
 net/netfilter/xt_l2tp.c                |  354 ++++++++++++++++++++++++++++++++
 5 files changed, 393 insertions(+)
 create mode 100644 include/uapi/linux/netfilter/xt_l2tp.h
 create mode 100644 net/netfilter/xt_l2tp.c

diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 2344f5a..1d973d2 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -58,6 +58,7 @@ header-y += xt_helper.h
 header-y += xt_ipcomp.h
 header-y += xt_iprange.h
 header-y += xt_ipvs.h
+header-y += xt_l2tp.h
 header-y += xt_length.h
 header-y += xt_limit.h
 header-y += xt_mac.h
diff --git a/include/uapi/linux/netfilter/xt_l2tp.h b/include/uapi/linux/netfilter/xt_l2tp.h
new file mode 100644
index 0000000..7dccfa0
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_l2tp.h
@@ -0,0 +1,27 @@
+#ifndef _LINUX_NETFILTER_XT_L2TP_H
+#define _LINUX_NETFILTER_XT_L2TP_H
+
+#include <linux/types.h>
+
+enum xt_l2tp_type {
+	XT_L2TP_TYPE_CONTROL,
+	XT_L2TP_TYPE_DATA,
+};
+
+/* L2TP matching stuff */
+struct xt_l2tp_info {
+	__u32 tid;			/* tunnel id */
+	__u32 sid;			/* session id */
+	__u8 version;			/* L2TP protocol version */
+	__u8 type;			/* L2TP packet type */
+	__u8 flags;			/* which fields to match */
+};
+
+enum {
+	XT_L2TP_TID	= (1 << 0),	/* match L2TP tunnel id */
+	XT_L2TP_SID	= (1 << 1),	/* match L2TP session id */
+	XT_L2TP_VERSION	= (1 << 2),	/* match L2TP protocol version */
+	XT_L2TP_TYPE	= (1 << 3),	/* match L2TP packet type */
+};
+
+#endif /* _LINUX_NETFILTER_XT_L2TP_H */
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index c3b3b26..a1be47b 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -1131,6 +1131,16 @@ config NETFILTER_XT_MATCH_IPVS
 
 	  If unsure, say N.
 
+config NETFILTER_XT_MATCH_L2TP
+	tristate '"l2tp" match support'
+	depends on NETFILTER_ADVANCED
+	default L2TP
+	---help---
+	This option adds an "L2TP" match, which allows you to match against
+	L2TP protocol header fields.
+
+	To compile it as a module, choose M here. If unsure, say N.
+
 config NETFILTER_XT_MATCH_LENGTH
 	tristate '"length" match support'
 	depends on NETFILTER_ADVANCED
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index 78b4e1c..b8bc5b8 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -137,6 +137,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o
+obj-$(CONFIG_NETFILTER_XT_MATCH_L2TP) += xt_l2tp.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o
diff --git a/net/netfilter/xt_l2tp.c b/net/netfilter/xt_l2tp.c
new file mode 100644
index 0000000..8aee572
--- /dev/null
+++ b/net/netfilter/xt_l2tp.c
@@ -0,0 +1,354 @@
+/* Kernel module to match L2TP header parameters. */
+
+/* (C) 2013      James Chapman <jchapman@katalix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/if_ether.h>
+#include <net/ip.h>
+#include <linux/ipv6.h>
+#include <net/ipv6.h>
+#include <net/udp.h>
+#include <linux/l2tp.h>
+
+#include <linux/netfilter_ipv4.h>
+#include <linux/netfilter_ipv6.h>
+#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/netfilter_ipv6/ip6_tables.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/netfilter/xt_tcpudp.h>
+#include <linux/netfilter/xt_l2tp.h>
+
+/* L2TP header masks */
+#define L2TP_HDR_T_BIT	0x8000
+#define L2TP_HDR_L_BIT	0x4000
+#define L2TP_HDR_VER	0x000f
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
+MODULE_DESCRIPTION("Xtables: L2TP header match");
+MODULE_ALIAS("ipt_l2tp");
+MODULE_ALIAS("ip6t_l2tp");
+
+/* The L2TP fields that can be matched */
+struct l2tp_data {
+	u32 tid;
+	u32 sid;
+	u8 type;
+	u8 version;
+};
+
+union l2tp_val {
+	__be16 val16[2];
+	__be32 val32;
+};
+
+static bool l2tp_match(const struct xt_l2tp_info *info, struct l2tp_data *data)
+{
+	if ((info->flags & XT_L2TP_TYPE) && (info->type != data->type))
+		return false;
+
+	if ((info->flags & XT_L2TP_VERSION) && (info->version != data->version))
+		return false;
+
+	/* Check tid only for L2TPv3 control or any L2TPv2 packets */
+	if ((info->flags & XT_L2TP_TID) &&
+	    ((data->type == XT_L2TP_TYPE_CONTROL) || (data->version == 2)) &&
+	    (info->tid != data->tid))
+		return false;
+
+	/* Check sid only for L2TP data packets */
+	if ((info->flags & XT_L2TP_SID) && (data->type == XT_L2TP_TYPE_DATA) &&
+	    (info->sid != data->sid))
+		return false;
+
+	return true;
+}
+
+/* Parse L2TP header fields when UDP encapsulation is used. Handles
+ * L2TPv2 and L2TPv3. Note the L2TPv3 control and data packets have a
+ * different format. See
+ * RFC2661, Section 3.1, L2TPv2 Header Format
+ * RFC3931, Section 3.2.1, L2TPv3 Control Message Header
+ * RFC3931, Section 3.2.2, L2TPv3 Data Message Header
+ * RFC3931, Section 4.1.2.1, L2TPv3 Session Header over UDP
+ */
+static bool l2tp_udp_mt(const struct sk_buff *skb, struct xt_action_param *par, u16 thoff)
+{
+	const struct xt_l2tp_info *info = par->matchinfo;
+	int uhlen = sizeof(struct udphdr);
+	int offs = thoff + uhlen;
+	union l2tp_val *lh;
+	union l2tp_val lhbuf;
+	u16 flags;
+	struct l2tp_data data = { 0, };
+
+	if (par->fragoff != 0)
+		return false;
+
+	/* Extract L2TP header fields. The flags in the first 16 bits
+	 * tell us where the other fields are.
+	 */
+	lh = skb_header_pointer(skb, offs, 2, &lhbuf);
+	if (lh == NULL)
+		return false;
+
+	flags = ntohs(lh->val16[0]);
+	if (flags & L2TP_HDR_T_BIT)
+		data.type = XT_L2TP_TYPE_CONTROL;
+	else
+		data.type = XT_L2TP_TYPE_DATA;
+	data.version = (u8) flags & L2TP_HDR_VER;
+
+	/* Now extract the L2TP tid/sid. These are in different places
+	 * for L2TPv2 (rfc2661) and L2TPv3 (rfc3931). For L2TPv2, we
+	 * must also check to see if the length field is present,
+	 * since this affects the offsets into the packet of the
+	 * tid/sid fields.
+	 */
+	if (data.version == 3) {
+		lh = skb_header_pointer(skb, offs + 4, 4, &lhbuf);
+		if (lh == NULL)
+			return false;
+		if (data.type == XT_L2TP_TYPE_CONTROL)
+			data.tid = ntohl(lh->val32);
+		else
+			data.sid = ntohl(lh->val32);
+	} else if (data.version == 2) {
+		if (flags & L2TP_HDR_L_BIT)
+			offs += 2;
+		lh = skb_header_pointer(skb, offs + 2, 4, &lhbuf);
+		if (lh == NULL)
+			return false;
+		data.tid = (u32) ntohs(lh->val16[0]);
+		data.sid = (u32) ntohs(lh->val16[1]);
+	} else
+		return false;
+
+	return l2tp_match(info, &data);
+}
+
+/* Parse L2TP header fields for IP encapsulation (no UDP header).
+ * L2TPv3 data packets have a different form with IP encap. See
+ * RC3931, Section 4.1.1.1, L2TPv3 Session Header over IP.
+ * RC3931, Section 4.1.1.2, L2TPv3 Control and Data Traffic over IP.
+ */
+static bool l2tp_ip_mt(const struct sk_buff *skb, struct xt_action_param *par, u16 thoff)
+{
+	const struct xt_l2tp_info *info = par->matchinfo;
+	union l2tp_val *lh;
+	union l2tp_val lhbuf;
+	struct l2tp_data data = { 0, };
+
+	/* For IP encap, the L2TP sid is the first 32-bits. */
+	lh = skb_header_pointer(skb, thoff, sizeof(lhbuf), &lhbuf);
+	if (lh == NULL)
+		return false;
+	if (lh->val32 == 0) {
+		/* Must be a control packet. The L2TP tid is further
+		 * into the packet.
+		 */
+		data.type = XT_L2TP_TYPE_CONTROL;
+		lh = skb_header_pointer(skb, thoff + 8, sizeof(lhbuf),
+					&lhbuf);
+		if (lh == NULL)
+			return false;
+		data.tid = ntohl(lh->val32);
+	} else {
+		data.sid = ntohl(lh->val32);
+		data.type = XT_L2TP_TYPE_DATA;
+	}
+
+	data.version = 3;
+
+	return l2tp_match(info, &data);
+}
+
+static bool l2tp_mt4(const struct sk_buff *skb, struct xt_action_param *par)
+{
+	struct iphdr *iph = ip_hdr(skb);
+	u8 ipproto = iph->protocol;
+
+	/* l2tp_mt_check4 already restricts the transport protocol */
+	switch (ipproto) {
+	case IPPROTO_UDP:
+		return l2tp_udp_mt(skb, par, par->thoff);
+	case IPPROTO_L2TP:
+		return l2tp_ip_mt(skb, par, par->thoff);
+	}
+
+	return false;
+}
+
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
+static bool l2tp_mt6(const struct sk_buff *skb, struct xt_action_param *par)
+{
+	unsigned int thoff = 0;
+	unsigned short fragoff = 0;
+	int ipproto;
+
+	ipproto = ipv6_find_hdr(skb, &thoff, -1, &fragoff, NULL);
+	if (fragoff != 0)
+		return false;
+
+	/* l2tp_mt_check6 already restricts the transport protocol */
+	switch (ipproto) {
+	case IPPROTO_UDP:
+		return l2tp_udp_mt(skb, par, thoff);
+	case IPPROTO_L2TP:
+		return l2tp_ip_mt(skb, par, thoff);
+	}
+
+	return false;
+}
+#endif
+
+static int l2tp_mt_check(const struct xt_mtchk_param *par)
+{
+	const struct xt_l2tp_info *info = par->matchinfo;
+
+	/* Check for invalid flags */
+	if (info->flags & ~(XT_L2TP_TID | XT_L2TP_SID | XT_L2TP_VERSION |
+			    XT_L2TP_TYPE)) {
+		pr_info("unknown flags: %x\n", info->flags);
+		return -EINVAL;
+	}
+
+	/* At least one of tid, sid or type=control must be specified */
+	if ((!(info->flags & XT_L2TP_TID)) &&
+	    (!(info->flags & XT_L2TP_SID)) &&
+	    ((!(info->flags & XT_L2TP_TYPE)) ||
+	     (info->type != XT_L2TP_TYPE_CONTROL))) {
+		pr_info("invalid flags combination: %x\n", info->flags);
+		return -EINVAL;
+	}
+
+	/* If version 2 is specified, check that incompatible params
+	 * are not supplied
+	 */
+	if (info->flags & XT_L2TP_VERSION) {
+		if ((info->version < 2) || (info->version > 3)) {
+			pr_info("wrong L2TP version: %u\n", info->version);
+			return -EINVAL;
+		}
+
+		if (info->version == 2) {
+			if ((info->flags & XT_L2TP_TID) &&
+			    (info->tid > 0xffff)) {
+				pr_info("v2 tid > 0xffff: %u\n", info->tid);
+				return -EINVAL;
+			}
+			if ((info->flags & XT_L2TP_SID) &&
+			    (info->sid > 0xffff)) {
+				pr_info("v2 sid > 0xffff: %u\n", info->sid);
+				return -EINVAL;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int l2tp_mt_check4(const struct xt_mtchk_param *par)
+{
+	const struct xt_l2tp_info *info = par->matchinfo;
+	const struct ipt_entry *e = par->entryinfo;
+	const struct ipt_ip *ip = &e->ip;
+	int ret;
+
+	ret = l2tp_mt_check(par);
+	if (ret != 0)
+		return ret;
+
+	if ((ip->proto != IPPROTO_UDP) &&
+	    (ip->proto != IPPROTO_L2TP)) {
+		pr_info("missing protocol rule (udp|l2tpip)\n");
+		return -EINVAL;
+	}
+
+	if ((ip->proto == IPPROTO_L2TP) &&
+	    (info->version == 2)) {
+		pr_info("v2 doesn't support IP mode\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
+static int l2tp_mt_check6(const struct xt_mtchk_param *par)
+{
+	const struct xt_l2tp_info *info = par->matchinfo;
+	const struct ip6t_entry *e = par->entryinfo;
+	const struct ip6t_ip6 *ip = &e->ipv6;
+	int ret;
+
+	ret = l2tp_mt_check(par);
+	if (ret != 0)
+		return ret;
+
+	if ((ip->proto != IPPROTO_UDP) &&
+	    (ip->proto != IPPROTO_L2TP)) {
+		pr_info("missing protocol rule (udp|l2tpip)\n");
+		return -EINVAL;
+	}
+
+	if ((ip->proto == IPPROTO_L2TP) &&
+	    (info->version == 2)) {
+		pr_info("v2 doesn't support IP mode\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+#endif
+
+static struct xt_match l2tp_mt_reg[] __read_mostly = {
+	{
+		.name      = "l2tp",
+		.revision  = 0,
+		.family    = NFPROTO_IPV4,
+		.match     = l2tp_mt4,
+		.matchsize = XT_ALIGN(sizeof(struct xt_l2tp_info)),
+		.checkentry = l2tp_mt_check4,
+		.hooks     = ((1 << NF_INET_PRE_ROUTING) |
+			      (1 << NF_INET_LOCAL_IN) |
+			      (1 << NF_INET_LOCAL_OUT) |
+			      (1 << NF_INET_FORWARD)),
+		.me        = THIS_MODULE,
+	},
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
+	{
+		.name      = "l2tp",
+		.revision  = 0,
+		.family    = NFPROTO_IPV6,
+		.match     = l2tp_mt6,
+		.matchsize = XT_ALIGN(sizeof(struct xt_l2tp_info)),
+		.checkentry = l2tp_mt_check6,
+		.hooks     = ((1 << NF_INET_PRE_ROUTING) |
+			      (1 << NF_INET_LOCAL_IN) |
+			      (1 << NF_INET_LOCAL_OUT) |
+			      (1 << NF_INET_FORWARD)),
+		.me        = THIS_MODULE,
+	},
+#endif
+};
+
+static int __init l2tp_mt_init(void)
+{
+	return xt_register_matches(&l2tp_mt_reg[0], ARRAY_SIZE(l2tp_mt_reg));
+}
+
+static void __exit l2tp_mt_exit(void)
+{
+	xt_unregister_matches(&l2tp_mt_reg[0], ARRAY_SIZE(l2tp_mt_reg));
+}
+
+module_init(l2tp_mt_init);
+module_exit(l2tp_mt_exit);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH] netfilter updates for net-next
From: Pablo Neira Ayuso @ 2014-01-10 18:55 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

Hi David,

This batch contains one single patch with the l2tp match
for xtables, from James Chapman.

You can pull these changes from:

  git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

Thanks!

----------------------------------------------------------------

You can pull these changes from:

The following changes since commit d0eb1f7e66dd53355746cd6a8e7e56c465dc6cde:

  ip_tunnel: fix sparse non static symbol warning (2014-01-09 14:31:47 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

for you to fetch changes up to 74f77a6b2b1c98d3f14364dccdd2353b99ecfeda:

  netfilter: introduce l2tp match extension (2014-01-09 21:36:39 +0100)

----------------------------------------------------------------
James Chapman (1):
      netfilter: introduce l2tp match extension

 include/uapi/linux/netfilter/Kbuild    |    1 +
 include/uapi/linux/netfilter/xt_l2tp.h |   27 +++
 net/netfilter/Kconfig                  |   10 +
 net/netfilter/Makefile                 |    1 +
 net/netfilter/xt_l2tp.c                |  354 ++++++++++++++++++++++++++++++++
 5 files changed, 393 insertions(+)
 create mode 100644 include/uapi/linux/netfilter/xt_l2tp.h
 create mode 100644 net/netfilter/xt_l2tp.c


^ permalink raw reply

* Re: [PATCH] net: Check skb->rxhash in gro_receive
From: Eric Dumazet @ 2014-01-10 18:54 UTC (permalink / raw)
  To: Tom Herbert; +Cc: David Miller, Linux Netdev List
In-Reply-To: <CA+mtBx-8=tiYw=-_TydO0bC_tJXK6MqxjnZQaCXqUtxLSF7xhQ@mail.gmail.com>

On Fri, 2014-01-10 at 10:15 -0800, Tom Herbert wrote:

> The objective is to compute the rxhash at most once per packet.

Once per GRO packet ( up to 45 MSS) or once per incoming frame ( 1 MSS
) ?

Your patch computes rxhash for every incoming frame.

> 
> > If your patch was doing this, I would have no complain.
> >
> > (No new conditional branch, and skb->rxhash, if provided by the NIC,
> > can give a hint.)
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index ce01847793c0..c9f7a26d7ce7 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -3798,7 +3798,8 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
> >         for (p = napi->gro_list; p; p = p->next) {
> >                 unsigned long diffs;
> >
> > -               diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
> > +               diffs = p->rxhash ^ skb->rxhash;
> > +               diffs |= (unsigned long)p->dev ^ (unsigned long)skb->dev;
> >                 diffs |= p->vlan_tci ^ skb->vlan_tci;
> >                 if (maclen == ETH_HLEN)
> >                         diffs |= compare_ether_header(skb_mac_header(p),
> >
> As I said in the commit log, the skb->rxhash should be a very strong
> indicator of that flows will match (maybe >99% ?), so putting that
> first potentially short circuits a lot of work even in just this
> function.

Are you speaking of your "goto skip;" ?

compare_ether_header() is done with 10 instructions on x86_64

There is no point trying to avoid it.

Really, 99% of the time gro_list contains zero or one single slot, I
have hard data saying so.

If you want to optimize the case where list is fully populated (because
of yet another synthetic benchmark you use), you really need to build a
temporary list so that all layers do not even have to check
NAPI_GRO_CB(p)->same_flow

Each gro handler would remove non matching flow from this temp list.

-> when we finally reach tcp_gro_receive(), list would contain a single
element.

^ permalink raw reply

* Re: [PATCH net-next] net: vxlan: when lower dev unregisters remove vxlan dev as well
From: Cong Wang @ 2014-01-10 18:51 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: David Miller, netdev
In-Reply-To: <1389358907-19885-1-git-send-email-dborkman@redhat.com>

On Fri, Jan 10, 2014 at 5:01 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
> We can create a vxlan device with an explicit underlying carrier.
> In that case, when the carrier link is being deleted from the
> system (e.g. due to module unload) we should also clean up all
> created vxlan devices on top of it since otherwise we're in an
> inconsistent state in vxlan device. In that case, the user needs
> to remove all such devices, while in case of other virtual devs
> that sit on top of physical ones, it is usually the case that
> these devices do unregister automatically as well and do not
> leave the burden on the user.
>
> This work is not necessary when vxlan device was not created with
> a real underlying device, as connections can resume in that case
> when driver is plugged again. But at least for the other cases,
> we should go ahead and do the cleanup on removal.
>

So it makes sense to move the notifier register to vxlan_newlink()
from vxlan_init_module()?

...
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 481f85d..39035ba 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2656,6 +2656,54 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
>         .fill_info      = vxlan_fill_info,
>  };
>
> +static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
> +                                            struct net_device *dev)
> +{
> +       struct vxlan_dev *vxlan, *next;
> +       LIST_HEAD(list_kill);
> +
> +       BUG_ON(!rtnl_is_locked());


This is not necessary at all, it is known that netdev notication
holds rtnl lock.

> +
> +       list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next) {
> +               struct vxlan_rdst *dst = &vxlan->default_dst;
> +
> +               /* In case we created vxlan device with carrier
> +                * and we loose the carrier due to module unload
> +                * we also need to remove vxlan device. In other
> +                * cases, it's not necessary and remote_ifindex
> +                * is 0 here, so no matches.
> +                */
> +               if (dst->remote_ifindex == dev->ifindex)
> +                       vxlan_dellink(vxlan->dev, &list_kill);
> +       }
> +
> +       unregister_netdevice_many(&list_kill);
> +       list_del(&list_kill);


I think you need to flush fdb as well?


>  static __net_init int vxlan_init_net(struct net *net)
>  {
>         struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> @@ -2673,14 +2721,16 @@ static __net_init int vxlan_init_net(struct net *net)
>  static __net_exit void vxlan_exit_net(struct net *net)
>  {
>         struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> -       struct vxlan_dev *vxlan;
> -       LIST_HEAD(list);
> +       struct vxlan_dev *vxlan, *next;
> +       LIST_HEAD(list_kill);
>
>         rtnl_lock();
> -       list_for_each_entry(vxlan, &vn->vxlan_list, next)
> -               unregister_netdevice_queue(vxlan->dev, &list);
> -       unregister_netdevice_many(&list);
> +       list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next)
> +               vxlan_dellink(vxlan->dev, &list_kill);
> +       unregister_netdevice_many(&list_kill);
>         rtnl_unlock();
> +
> +       list_del(&list_kill);


Why these changes in vxlan_exit_net()?

^ permalink raw reply

* pull request: wireless-next 2014-01-10
From: John W. Linville @ 2014-01-10 18:38 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev

[-- Attachment #1: Type: text/plain, Size: 28409 bytes --]

Dave,

Please pull these updates for the 3.14 stream!

For the mac80211 bits, Johannes says:

"Felix adds some helper functions for P2P NoA software tracking, Joe
fixes alignment (but as this apparently never caused issues I didn't
send it to 3.13), Kyeyoon/Jouni add QoS-mapping support (a Hotspot 2.0
feature), Weilong fixed a bunch of checkpatch errors and I get to play
fire-fighter or so and clean up other people's locking issues. I also
added nl80211 vendor-specific events, as we'd discussed at the wireless
summit."

For the iwlwifi bits, Emmanuel says:

"I have here a rework of the interrupt handling to meet RT kernel
requirements - basically we don't take any lock in the primary interrupt
handler. This gave me a good reason to clean things up a bit on the way.
There is also a fix of the QoS mapping along with a few workarounds for
hardware / firmware issues that are hard to hit.
Three fixes suggested by static analyzers, and other various stuff.
Most importantly, I update the Copyright note to include the new year."

For the bluetooth bits, Gustavo says:

"More patches to 3.14. The bulk of changes here is the 6LoWPAN support for
Bluetooth LE Devices. The commits that touches net/ieee802154/ are already
acked by David Miller. Other than that we have some RFCOMM fixes and
improvements plus fixes and clean ups all over the tree."

Beyond that, ath9k, brcmfmac, mwifiex, and wil6210 get their usual
level of attention.  The wl1251 driver gets a number of updates,
and there are a handful of other bits here and there.

Please let me know if there are problems!

John

---

The following changes since commit 11b57f90257c1d6a91cee720151b69e0c2020cf6:

  xen-netback: stop vif thread spinning if frontend is unresponsive (2014-01-09 23:05:46 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem

for you to fetch changes up to 235f93922878234f3d99a4205ebe3634ee955919:

  Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem (2014-01-10 10:59:40 -0500)

----------------------------------------------------------------

Alexander Aring (9):
      6lowpan: fix/move/cleanup debug functions
      6lowpan: introduce lowpan_push_hc_data function
      6lowpan: udp use lowpan_push_hc_data function
      6lowpan: fix udp compress ordering
      6lowpan: fix udp byte ordering
      6lowpan: add udp warning for elided checksum
      6lowpan: udp use lowpan_fetch_skb function
      6lowpan: udp use subtraction on both conditions
      6lowpan: cleanup udp compress function

Arend van Spriel (14):
      brcmfmac: rework SDIO register access functions
      brcmfmac: cleanup helper functions in sdio remove path
      brcmfmac: cleanup helper functions in sdio probe path
      brcmfmac: correct reporting HT40 support in wiphy htcap
      brcmfmac: add sdio drive strength programming for bcm4334 chipset
      brcmfmac: correct detection of save&restore device capability
      brcmfmac: enable watchdog when bus initialization is complete
      brcmfmac: only disable clock when brcmf_sdio_bus_init() fails
      brcmfmac: inform cfg80211 when changing the CONNECTED state
      brcmfmac: move wiphy_unregister() call to brcmf_cfg80211_detach()
      brcmfmac: call brcmf_cfg80211_detach() after removal of interfaces
      brcmfmac: use custom destructor callback for all netdevice interfaces
      mmc: add SDIO identifiers for Broadcom WLAN devices
      brcmfmac: add support for bcm43362 device

Arik Nemtsov (1):
      iwlwifi: mvm: squash a spurious warning on chnctx change

Bing Zhao (2):
      mwifiex: fix potential buffer overflow in dt configuration
      mwifiex: use a function to replace two copies of a code fragment

Christian Engelmayer (1):
      wireless: cw1200: Fix memory leak in cw1200_wow_suspend()

Claudio Takahasi (2):
      Bluetooth: Fix setting Universal/Local bit
      Bluetooth: Fix 6loWPAN peer lookup

David Gnedt (11):
      wl1251: fix scan behaviour while not associated
      wl1251: retry power save entry
      wl1251: implement hardware ARP filtering
      wl1251: split RX and TX data path initialisation
      wl1251: configure hardware en-/decryption for monitor mode
      wl1251: implement multicast address filtering (fwd)
      wl1251: disable power saving in monitor mode
      wl1251: fix channel switching in monitor mode
      wl1251: enable tx path in monitor mode if necessary for packet injection
      wl1251: disable retry and ACK policy for injected packets
      wl1251: enforce changed hw encryption support on monitor state change

Emmanuel Grumbach (20):
      iwlwifi: pcie: clean up ICT allocation code
      iwlwifi: pcie: track interrupt mask in SW
      iwlwifi: pcie: re-organize the PCIe ISR code
      iwlwifi: pcie: move the ICT / non-ICT handling functions
      iwlwifi: pcie: read the interrupt cause from the handler
      iwlwifi: pcie: determine the interrupt type in the handler
      iwlwifi: pcie: return inta from iwl_pcie_int_cause_{non_}ict
      iwlwifi: pcie: no need to save inta in trans_pcie
      iwlwifi: pcie: move interrupt prints to the common handler
      iwlwifi: pcie: use don't disable interrupt when irq_lock is taken
      iwlwifi: pcie: use don't disable interrupt when rxq->lock is taken
      iwlwifi: mvm: fix AC / FIFO mapping
      iwlwifi: pcie: keep the NIC awake when commands are in flight
      iwlwifi: pcie: don't update the op_mode if rfkill hasn't changed
      iwlwifi: pcie: allow the op_mode to call stop_device whenever it wants
      iwlwifi: mvm: disable the device as soon as RFKILL fires
      iwlwifi: mvm: fix harmless smatch / coccinelle warnings
      iwlwifi: mvm: BT Coex - update channel inihibition for channel 14
      iwlwifi: mvm: dump to debugfs the SRAM as binary
      iwlwifi: Update Copyright to 2014

Eran Harary (1):
      iwlwifi: pcie: Fix CSR_RESET operation access type

Eyal Shapira (1):
      iwlwifi: mvm: rs: fix a potential NULL deref

Eytan Lifshitz (1):
      iwlwifi: mvm: fix possible memory leak

Felix Fietkau (3):
      mac80211: add helper functions for tracking P2P NoA state
      ath9k_hw: fix gentimer callback without overflow handler
      ath9k_hw: fix TSF offset calculation

Fengguang Wu (1):
      iwlwifi: mvm: fix coccinelle warnings

Gianluca Anzolin (4):
      Bluetooth: Release RFCOMM port when the last user closes the TTY
      Bluetooth: Move rfcomm_get_device() before rfcomm_dev_activate()
      Bluetooth: Always wait for a connection on RFCOMM open()
      Bluetooth: Remove rfcomm_carrier_raised()

Hante Meuleman (2):
      brcmfmac: Remove some obsolete definitions and variables.
      brcmfmac: Limit control message length from host to device.

Hauke Mehrtens (2):
      bcma: fix sparse warnings in driver_chipcommon_sflash.c
      ssb: fix sparse warnings in driver_chipcommon_sflash.c

Ilan Peer (3):
      iwlwifi: mvm: Add a missed beacons threshold
      iwlwifi: mvm: change the parameters for calculating an AP TBTT
      iwlwifi: mvm: dynamically update tsf_id

Joe Perches (1):
      mac80211: align struct ps_data.tim to unsigned long

Johan Hedberg (4):
      Bluetooth: Add missing 6lowpan.h include
      Bluetooth: Fix test for lookup_dev return value
      Bluetooth: Fix NULL pointer dereference when disconnecting
      Bluetooth: Default to no security with L2CAP RAW sockets

Johannes Berg (4):
      mac80211: make ieee80211_recalc_radar_chanctx static
      mac80211: remove unnecessary iflist_mtx locking
      mac80211: fix iflist_mtx/mtx locking in radar detection
      nl80211: support vendor-specific events

John W. Linville (5):
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211-next
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless
      Merge branch 'for-upstream' of git://git.kernel.org/.../bluetooth/bluetooth-next
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem

Josh Triplett (1):
      net: wireless: brcm80211: Drop debug version with build date/time

Jukka Rissanen (5):
      6lowpan: Moving generic compression code into 6lowpan_iphc.c
      net: if_arp: add ARPHRD_6LOWPAN type
      ipv6: Add checks for 6LOWPAN ARP type
      Bluetooth: Enable 6LoWPAN support for BT LE devices
      Bluetooth: Manually enable or disable 6LoWPAN between devices

Julia Lawall (10):
      rt2x00: use ether_addr_equal_64bits
      ath5k: use ether_addr_equal_64bits
      p54: use ether_addr_equal_64bits
      mwl8k: use ether_addr_equal_64bits
      rtlwifi: use ether_addr_equal_64bits
      iwlegacy: use ether_addr_equal_64bits
      ath9k: use ether_addr_equal_64bits
      ipw2x00: use ether_addr_equal_64bits
      at76c50x-usb: use ether_addr_equal_64bits
      carl9170: use ether_addr_equal_64bits

Kyeyoon Park (2):
      cfg80211: Add support for QoS mapping
      mac80211: Add support for QoS mapping

Marcel Holtmann (5):
      Bluetooth: Set HCI_QUIRK_RESET_ON_CLOSE for Socket SDIO cards
      Bluetooth: Add support for vectored writes to virtual HCI driver
      Bluetooth: Use MD SET register for changing SDIO Type-B to Type-A
      Bluetooth: Add quirk for disabling Delete Stored Link Key command
      Bluetooth: Deal with USB devices that are faking CSR vendor

Paul Gortmaker (1):
      wireless: delete non-required instances of include <linux/init.h>

Pavel Machek (2):
      wl1251: add nvs file name to module firmware list
      wl1251: fix NULL pointer dereference

Sujith Manoharan (28):
      ath9k: Fix max AMPDU size calculation
      ath9k: Register supported HW hang checks
      ath9k: Add HW callbacks for MAC/BB hang checks
      ath9k: Fix MAC HW hang check for AR9003
      ath9k: Fix PHY restart workaround
      ath9k: Fix baseband watchdog interrupts
      ath9k: Identify baseband watchdog signatures
      ath9k: Fix baseband watchdog reset
      ath9k: Remove RX Poll
      ath9k: Process BB watchdog events in the tasklet
      ath9k: Fix "cc_lock" usage
      ath9k: Remove unused functions
      ath9k: Move private HW callbacks to hw-ops.h
      ath9k: Handle unsupported MAC versions early
      ath9k: Cleanup __ath9k_hw_init()
      ath9k: Fix AR9100 chip power-on
      ath9k: Remove unused config option ack_6mb
      ath9k: Fix interrupt statistics
      ath9k: Add version/revision macros for QCA9531
      ath9k: Assign macVersion for QCA9531
      ath9k: Add QCA953x initvals
      ath9k: Initialize QCA953x INI arrays
      ath9k: Add hardware support for QCA9531
      ath9k: Fix AR955x RX sensitivity
      ath9k: Fix regulatory compliance
      ath9k: Update WB335 PCI IDs
      ath9k: Use correct channel for RX packets
      ath9k: Disable cross-band FCC

Vladimir Kondratiev (3):
      wil6210: interrupt moderation
      wil6210: Fix IP version indication for Tx csum offload
      wil6210: prefetch head of packet

Wei Yongjun (3):
      Bluetooth: remove unused including <linux/version.h>
      Bluetooth: fix return value check
      ath9k: fix sparse non static symbol warning

Weilong Chen (1):
      mac80211: fix checkpatch errors

Wenliang Fan (1):
      drivers/net/wireless/hostap: Integer overflow

 drivers/bcma/driver_chipcommon_sflash.c            |   6 +-
 drivers/bluetooth/btsdio.c                         |   6 +-
 drivers/bluetooth/btusb.c                          |  46 +-
 drivers/bluetooth/hci_vhci.c                       |  29 +-
 drivers/net/wireless/adm8211.c                     |   1 -
 drivers/net/wireless/airo_cs.c                     |   1 -
 drivers/net/wireless/at76c50x-usb.c                |   2 +-
 drivers/net/wireless/ath/ar5523/ar5523.c           |   1 -
 drivers/net/wireless/ath/ath5k/base.c              |   4 +-
 drivers/net/wireless/ath/ath9k/ar9002_hw.c         |  15 +
 drivers/net/wireless/ath/ath9k/ar9003_calib.c      | 223 ++++++
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |  13 +-
 drivers/net/wireless/ath/ath9k/ar9003_hw.c         | 161 +++-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c        |  91 ++-
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |  17 +-
 drivers/net/wireless/ath/ath9k/ar953x_initvals.h   | 718 +++++++++++++++++
 drivers/net/wireless/ath/ath9k/ath9k.h             |   7 +-
 drivers/net/wireless/ath/ath9k/beacon.c            |  10 +-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c      |   2 +-
 drivers/net/wireless/ath/ath9k/hw-ops.h            |  42 +
 drivers/net/wireless/ath/ath9k/hw.c                | 323 +++-----
 drivers/net/wireless/ath/ath9k/hw.h                |  28 +-
 drivers/net/wireless/ath/ath9k/init.c              |   2 -
 drivers/net/wireless/ath/ath9k/link.c              |  67 +-
 drivers/net/wireless/ath/ath9k/mac.c               |  24 +-
 drivers/net/wireless/ath/ath9k/main.c              |  76 +-
 drivers/net/wireless/ath/ath9k/pci.c               | 101 ++-
 drivers/net/wireless/ath/ath9k/recv.c              |  31 +-
 drivers/net/wireless/ath/ath9k/reg.h               |  14 +-
 drivers/net/wireless/ath/ath9k/spectral.c          |   2 +-
 drivers/net/wireless/ath/ath9k/wow.c               |   1 -
 drivers/net/wireless/ath/ath9k/xmit.c              |   9 +-
 drivers/net/wireless/ath/carl9170/debug.c          |   1 -
 drivers/net/wireless/ath/carl9170/main.c           |   1 -
 drivers/net/wireless/ath/carl9170/rx.c             |   7 +-
 drivers/net/wireless/ath/carl9170/tx.c             |   1 -
 drivers/net/wireless/ath/wil6210/interrupt.c       |  13 +
 drivers/net/wireless/ath/wil6210/txrx.c            |   8 +-
 drivers/net/wireless/ath/wil6210/wil6210.h         |   1 +
 drivers/net/wireless/atmel.c                       |   1 -
 drivers/net/wireless/atmel_cs.c                    |   1 -
 drivers/net/wireless/atmel_pci.c                   |   1 -
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c     |  10 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   | 230 +++---
 drivers/net/wireless/brcm80211/brcmfmac/dhd.h      |   7 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   |   9 -
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |   9 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 167 ++--
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |   2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c      |  43 +-
 .../net/wireless/brcm80211/brcmfmac/sdio_chip.c    |  46 ++
 .../net/wireless/brcm80211/brcmfmac/sdio_chip.h    |   8 -
 .../net/wireless/brcm80211/brcmfmac/sdio_host.h    |   1 -
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  | 164 ++--
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.h  |   5 +-
 .../net/wireless/brcm80211/include/brcm_hw_ids.h   |   1 +
 .../net/wireless/brcm80211/include/brcmu_wifi.h    |  14 +
 drivers/net/wireless/cw1200/fwio.c                 |   1 -
 drivers/net/wireless/cw1200/main.c                 |   1 -
 drivers/net/wireless/cw1200/pm.c                   |  11 +-
 drivers/net/wireless/hostap/hostap_cs.c            |   1 -
 drivers/net/wireless/hostap/hostap_ioctl.c         |   2 +-
 drivers/net/wireless/hostap/hostap_pci.c           |   1 -
 drivers/net/wireless/hostap/hostap_plx.c           |   1 -
 drivers/net/wireless/ipw2x00/ipw2200.h             |   1 -
 drivers/net/wireless/ipw2x00/libipw_rx.c           |   2 +-
 drivers/net/wireless/iwlegacy/3945-rs.c            |   1 -
 drivers/net/wireless/iwlegacy/3945.c               |   5 +-
 drivers/net/wireless/iwlegacy/4965-rs.c            |   1 -
 drivers/net/wireless/iwlegacy/4965.c               |   1 -
 drivers/net/wireless/iwlegacy/common.c             |   9 +-
 drivers/net/wireless/iwlwifi/dvm/agn.h             |   4 +-
 drivers/net/wireless/iwlwifi/dvm/calib.c           |   4 +-
 drivers/net/wireless/iwlwifi/dvm/calib.h           |   4 +-
 drivers/net/wireless/iwlwifi/dvm/commands.h        |   4 +-
 drivers/net/wireless/iwlwifi/dvm/debugfs.c         |   2 +-
 drivers/net/wireless/iwlwifi/dvm/dev.h             |   2 +-
 drivers/net/wireless/iwlwifi/dvm/devices.c         |   2 +-
 drivers/net/wireless/iwlwifi/dvm/led.c             |   3 +-
 drivers/net/wireless/iwlwifi/dvm/led.h             |   2 +-
 drivers/net/wireless/iwlwifi/dvm/lib.c             |   3 +-
 drivers/net/wireless/iwlwifi/dvm/mac80211.c        |   3 +-
 drivers/net/wireless/iwlwifi/dvm/main.c            |   2 +-
 drivers/net/wireless/iwlwifi/dvm/power.c           |   3 +-
 drivers/net/wireless/iwlwifi/dvm/power.h           |   2 +-
 drivers/net/wireless/iwlwifi/dvm/rs.c              |   3 +-
 drivers/net/wireless/iwlwifi/dvm/rs.h              |   2 +-
 drivers/net/wireless/iwlwifi/dvm/rx.c              |   2 +-
 drivers/net/wireless/iwlwifi/dvm/rxon.c            |   2 +-
 drivers/net/wireless/iwlwifi/dvm/scan.c            |   2 +-
 drivers/net/wireless/iwlwifi/dvm/sta.c             |   2 +-
 drivers/net/wireless/iwlwifi/dvm/tt.c              |   3 +-
 drivers/net/wireless/iwlwifi/dvm/tt.h              |   2 +-
 drivers/net/wireless/iwlwifi/dvm/tx.c              |   3 +-
 drivers/net/wireless/iwlwifi/dvm/ucode.c           |   3 +-
 drivers/net/wireless/iwlwifi/iwl-1000.c            |   2 +-
 drivers/net/wireless/iwlwifi/iwl-2000.c            |   2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c            |   2 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c            |   2 +-
 drivers/net/wireless/iwlwifi/iwl-7000.c            |   4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-hw.h          |   4 +-
 drivers/net/wireless/iwlwifi/iwl-config.h          |   4 +-
 drivers/net/wireless/iwlwifi/iwl-csr.h             |   7 +-
 drivers/net/wireless/iwlwifi/iwl-debug.h           |   2 +-
 drivers/net/wireless/iwlwifi/iwl-devtrace.c        |   2 +-
 drivers/net/wireless/iwlwifi/iwl-devtrace.h        |   2 +-
 drivers/net/wireless/iwlwifi/iwl-drv.c             |   4 +-
 drivers/net/wireless/iwlwifi/iwl-drv.h             |   6 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c    |   4 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h    |   4 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-read.c     |   4 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-read.h     |   4 +-
 drivers/net/wireless/iwlwifi/iwl-fh.h              |   4 +-
 drivers/net/wireless/iwlwifi/iwl-fw-file.h         |   4 +-
 drivers/net/wireless/iwlwifi/iwl-fw.h              |   4 +-
 drivers/net/wireless/iwlwifi/iwl-io.c              |   2 +-
 drivers/net/wireless/iwlwifi/iwl-io.h              |   2 +-
 drivers/net/wireless/iwlwifi/iwl-modparams.h       |   4 +-
 drivers/net/wireless/iwlwifi/iwl-notif-wait.c      |   4 +-
 drivers/net/wireless/iwlwifi/iwl-notif-wait.h      |   4 +-
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.c       |   4 +-
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.h       |   4 +-
 drivers/net/wireless/iwlwifi/iwl-op-mode.h         |   4 +-
 drivers/net/wireless/iwlwifi/iwl-phy-db.c          |   4 +-
 drivers/net/wireless/iwlwifi/iwl-phy-db.h          |   4 +-
 drivers/net/wireless/iwlwifi/iwl-prph.h            |   4 +-
 drivers/net/wireless/iwlwifi/iwl-trans.h           |  11 +-
 drivers/net/wireless/iwlwifi/mvm/binding.c         |   4 +-
 drivers/net/wireless/iwlwifi/mvm/bt-coex.c         |   8 +-
 drivers/net/wireless/iwlwifi/mvm/constants.h       |   4 +-
 drivers/net/wireless/iwlwifi/mvm/d3.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c     |   4 +-
 drivers/net/wireless/iwlwifi/mvm/debugfs.c         |  53 +-
 drivers/net/wireless/iwlwifi/mvm/debugfs.h         |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h  |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h       |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h      |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-power.h    |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h       |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h     |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h      |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h       |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api.h          |   4 +-
 drivers/net/wireless/iwlwifi/mvm/fw.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/led.c             |   6 +-
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c        | 160 ++--
 drivers/net/wireless/iwlwifi/mvm/mac80211.c        |  24 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h             |   7 +-
 drivers/net/wireless/iwlwifi/mvm/nvm.c             |  15 +-
 drivers/net/wireless/iwlwifi/mvm/ops.c             |   6 +-
 drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c        |   4 +-
 drivers/net/wireless/iwlwifi/mvm/power.c           |   5 +-
 drivers/net/wireless/iwlwifi/mvm/power_legacy.c    |   4 +-
 drivers/net/wireless/iwlwifi/mvm/quota.c           |   4 +-
 drivers/net/wireless/iwlwifi/mvm/rs.c              |  14 +-
 drivers/net/wireless/iwlwifi/mvm/rs.h              |   2 +-
 drivers/net/wireless/iwlwifi/mvm/rx.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/scan.c            |  13 +-
 drivers/net/wireless/iwlwifi/mvm/sf.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c             |   4 +-
 drivers/net/wireless/iwlwifi/mvm/sta.h             |   4 +-
 drivers/net/wireless/iwlwifi/mvm/testmode.h        |   4 +-
 drivers/net/wireless/iwlwifi/mvm/time-event.c      |   4 +-
 drivers/net/wireless/iwlwifi/mvm/time-event.h      |   4 +-
 drivers/net/wireless/iwlwifi/mvm/tt.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/tx.c              |   4 +-
 drivers/net/wireless/iwlwifi/mvm/utils.c           |   4 +-
 drivers/net/wireless/iwlwifi/pcie/drv.c            |   4 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h       |  40 +-
 drivers/net/wireless/iwlwifi/pcie/rx.c             | 400 ++++------
 drivers/net/wireless/iwlwifi/pcie/trans.c          |  79 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c             | 106 ++-
 drivers/net/wireless/mwifiex/cfg80211.c            |   9 +-
 drivers/net/wireless/mwifiex/main.c                |   2 +-
 drivers/net/wireless/mwifiex/main.h                |   1 +
 drivers/net/wireless/mwifiex/sta_cmd.c             |   5 +-
 drivers/net/wireless/mwifiex/sta_ioctl.c           |  17 +-
 drivers/net/wireless/mwl8k.c                       |   3 +-
 drivers/net/wireless/orinoco/hermes.c              |   1 -
 drivers/net/wireless/orinoco/orinoco_cs.c          |   1 -
 drivers/net/wireless/orinoco/orinoco_usb.c         |   1 -
 drivers/net/wireless/orinoco/spectrum_cs.c         |   1 -
 drivers/net/wireless/p54/eeprom.c                  |   1 -
 drivers/net/wireless/p54/fwio.c                    |   1 -
 drivers/net/wireless/p54/led.c                     |   1 -
 drivers/net/wireless/p54/main.c                    |   1 -
 drivers/net/wireless/p54/p54pci.c                  |   1 -
 drivers/net/wireless/p54/p54usb.c                  |   1 -
 drivers/net/wireless/p54/txrx.c                    |   3 +-
 drivers/net/wireless/rndis_wlan.c                  |   1 -
 drivers/net/wireless/rt2x00/rt2400pci.c            |   1 -
 drivers/net/wireless/rt2x00/rt2500pci.c            |   1 -
 drivers/net/wireless/rt2x00/rt2500usb.c            |   1 -
 drivers/net/wireless/rt2x00/rt2800usb.c            |   1 -
 drivers/net/wireless/rt2x00/rt2x00dev.c            |   4 +-
 drivers/net/wireless/rt2x00/rt61pci.c              |   1 -
 drivers/net/wireless/rt2x00/rt73usb.c              |   1 -
 drivers/net/wireless/rtl818x/rtl8180/dev.c         |   1 -
 drivers/net/wireless/rtl818x/rtl8180/grf5101.c     |   1 -
 drivers/net/wireless/rtl818x/rtl8180/max2820.c     |   1 -
 drivers/net/wireless/rtl818x/rtl8180/rtl8225.c     |   1 -
 drivers/net/wireless/rtl818x/rtl8180/sa2400.c      |   1 -
 drivers/net/wireless/rtl818x/rtl8187/dev.c         |   1 -
 drivers/net/wireless/rtl818x/rtl8187/rtl8225.c     |   1 -
 drivers/net/wireless/rtlwifi/base.c                |   4 +-
 drivers/net/wireless/rtlwifi/ps.c                  |   4 +-
 drivers/net/wireless/ti/wl1251/acx.c               |  49 +-
 drivers/net/wireless/ti/wl1251/acx.h               |  26 +-
 drivers/net/wireless/ti/wl1251/boot.c              |   3 +-
 drivers/net/wireless/ti/wl1251/cmd.c               |  58 +-
 drivers/net/wireless/ti/wl1251/cmd.h               |   8 +-
 drivers/net/wireless/ti/wl1251/event.c             |  46 +-
 drivers/net/wireless/ti/wl1251/event.h             |   7 +
 drivers/net/wireless/ti/wl1251/init.c              |  13 +-
 drivers/net/wireless/ti/wl1251/main.c              | 150 +++-
 drivers/net/wireless/ti/wl1251/rx.c                |   2 +-
 drivers/net/wireless/ti/wl1251/tx.c                |  35 +-
 drivers/net/wireless/ti/wl1251/wl1251.h            |   6 +
 drivers/net/wireless/wl3501_cs.c                   |   1 -
 drivers/ssb/driver_chipcommon_sflash.c             |   6 +-
 include/linux/mmc/sdio_ids.h                       |   9 +
 include/net/bluetooth/hci.h                        |   4 +-
 include/net/bluetooth/hci_core.h                   |   1 +
 include/net/bluetooth/l2cap.h                      |   1 +
 include/net/cfg80211.h                             | 118 ++-
 include/net/mac80211.h                             |  47 ++
 include/uapi/linux/if_arp.h                        |   1 +
 include/uapi/linux/nl80211.h                       |  17 +
 net/bluetooth/6lowpan.c                            | 860 +++++++++++++++++++++
 net/bluetooth/6lowpan.h                            |  26 +
 net/bluetooth/Makefile                             |   6 +-
 net/bluetooth/hci_core.c                           |  52 +-
 net/bluetooth/hci_event.c                          |   3 +
 net/bluetooth/l2cap_core.c                         |  12 +
 net/bluetooth/l2cap_sock.c                         |   3 +
 net/bluetooth/rfcomm/tty.c                         | 103 ++-
 net/ieee802154/6lowpan.c                           | 796 +------------------
 net/ieee802154/6lowpan.h                           |  72 ++
 net/ieee802154/6lowpan_iphc.c                      | 799 +++++++++++++++++++
 net/ieee802154/Makefile                            |   2 +-
 net/ipv6/addrconf.c                                |   4 +-
 net/mac80211/aes_cmac.c                            |   2 +-
 net/mac80211/aes_cmac.h                            |   2 +-
 net/mac80211/cfg.c                                 |  54 +-
 net/mac80211/chan.c                                |  67 +-
 net/mac80211/ibss.c                                |   7 +
 net/mac80211/ieee80211_i.h                         |  11 +-
 net/mac80211/iface.c                               |   8 +-
 net/mac80211/mlme.c                                |  25 +-
 net/mac80211/rc80211_minstrel.c                    |   8 +-
 net/mac80211/rc80211_minstrel_ht.c                 |   2 +-
 net/mac80211/tkip.c                                |   2 +-
 net/mac80211/trace.h                               |   2 +-
 net/mac80211/tx.c                                  |   4 +-
 net/mac80211/util.c                                | 150 +++-
 net/mac80211/wme.c                                 |   7 +-
 net/wireless/ap.c                                  |   1 +
 net/wireless/ibss.c                                |   2 +
 net/wireless/mesh.c                                |   1 +
 net/wireless/nl80211.c                             | 160 +++-
 net/wireless/rdev-ops.h                            |  15 +
 net/wireless/sme.c                                 |   2 +
 net/wireless/trace.h                               |  40 +
 net/wireless/util.c                                |  19 +-
 264 files changed, 5728 insertions(+), 2387 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/ar953x_initvals.h
 create mode 100644 net/bluetooth/6lowpan.c
 create mode 100644 net/bluetooth/6lowpan.h
 create mode 100644 net/ieee802154/6lowpan_iphc.c
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH net] bonding: reset the slave's mtu when its be changed
From: Sergei Shtylyov @ 2014-01-10 19:41 UTC (permalink / raw)
  To: Ding Tianhong, Jay Vosburgh, Veaceslav Falico, Netdev,
	David S. Miller
In-Reply-To: <52CFDA63.8070601@huawei.com>

Hello.

On 01/10/2014 02:32 PM, Ding Tianhong wrote:

> All slave should have the same mtu with mastet's, and the bond do it when

    Only "master", already noted by Dave.

> enslave the slave, but the user could change the slave's mtu, it will cause
> the master and slave have different mtu, althrough in AB mode, it does not

    Only "although".

> matter if the slave is not the current slave, but in other mode, it is incorrect,
> so reset the slave's mtu like the master set.

> Cc: Jay Vosburgh <fubar@us.ibm.com>
> Cc: Veaceslav Falico <vfalico@redhat.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>   drivers/net/bonding/bond_main.c | 21 ++++++++++-----------
>   1 file changed, 10 insertions(+), 11 deletions(-)

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 398e299..e7b5bcf 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2882,18 +2882,17 @@ static int bond_slave_netdev_event(unsigned long event,
>   		 */
>   		break;
>   	case NETDEV_CHANGEMTU:
> -		/*
> -		 * TODO: Should slaves be allowed to
> -		 * independently alter their MTU?  For
> -		 * an active-backup bond, slaves need
> -		 * not be the same type of device, so
> -		 * MTUs may vary.  For other modes,
> -		 * slaves arguably should have the
> -		 * same MTUs. To do this, we'd need to
> -		 * take over the slave's change_mtu
> -		 * function for the duration of their
> -		 * servitude.
> +		/* All slave should have the same mtu
> +		 * as master.
>   		 */
> +		if (slave->dev->mtu != bond->dev->mtu) {
> +			int res;

    Please insert empty line after declaration.

> +			slave->original_mtu = slave->dev->mtu;
> +			res = dev_set_mtu(slave->dev, bond->dev->mtu);
> +			if (res)
> +				pr_debug("Error %d calling dev_set_mtu for slave %s\n",
> +					 res, slave->dev->name);

    {} wouldn't hurt around multi-line *if* arm.

> +		}
>   		break;
>   	case NETDEV_CHANGENAME:
>   		/*

WBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next v2] ipv6: move IPV6_TCLASS_SHIFT into ipv6.h
From: Cong Wang @ 2014-01-10 18:33 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev
In-Reply-To: <1389348199-5855-1-git-send-email-roy.qing.li@gmail.com>

On Fri, Jan 10, 2014 at 2:03 AM,  <roy.qing.li@gmail.com> wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> Two places defined IPV6_TCLASS_SHIFT, so we should move it into ipv6.h,
> and use this macro as possible.
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  Sorry, version 1 has bug in fib6_rule_match it should be frist
> mask flowlabel with IPV6_TCLASS_MASK, then call ntohl


Since you are on it, it's better to introduce a helper function
for these 'shift and mask' operation.

^ permalink raw reply

* Re: [PATCH net] bonding: reset the slave's mtu when its be changed
From: David Miller @ 2014-01-10 18:33 UTC (permalink / raw)
  To: dingtianhong; +Cc: fubar, vfalico, netdev
In-Reply-To: <52CFDA63.8070601@huawei.com>

From: Ding Tianhong <dingtianhong@huawei.com>
Date: Fri, 10 Jan 2014 19:32:51 +0800

> All slave should have the same mtu with mastet's, and the bond do it when
                                          ^^^^^^

Typo, you mean "master"

^ permalink raw reply

* [PATCH net-next] IPv6: enable bind() to assign an anycast address
From: Francois-Xavier Le Bail @ 2014-01-10 18:12 UTC (permalink / raw)
  To: netdev
  Cc: Hannes Frederic Sowa, David S. Miller, Alexey Kuznetsov,
	James Morris, Hideaki Yoshifuji, Patrick McHardy,
	Francois-Xavier Le Bail

- Add ipv6_chk_acast_addr_src() to check if an anycast address is link-local
  on given interface or is global (on any interface).
- Use it in inet6_bind().

Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
Tested with link-local and global anycast addresses.
Tested with SOCK_DGRAM socket, bind and UDP traffic OK.
Tested with SOCK_STREAM socket, bind OK, traffic need another change.

 include/net/addrconf.h |    5 +++--
 net/ipv6/af_inet6.c    |    4 +++-
 net/ipv6/anycast.c     |   11 +++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 66c4a44..50e39a8 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -205,8 +205,9 @@ void ipv6_sock_ac_close(struct sock *sk);
 int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
 int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
 bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
-				const struct in6_addr *addr);
-
+			 const struct in6_addr *addr);
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+			     const struct in6_addr *addr);
 
 /* Device notifier */
 int register_inet6addr_notifier(struct notifier_block *nb);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index c921d5d..68b81e9 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -347,7 +347,9 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 			if (!(addr_type & IPV6_ADDR_MULTICAST))	{
 				if (!(inet->freebind || inet->transparent) &&
 				    !ipv6_chk_addr(net, &addr->sin6_addr,
-						   dev, 0)) {
+						   dev, 0) &&
+				    !ipv6_chk_acast_addr_src(net, dev,
+							     &addr->sin6_addr)) {
 					err = -EADDRNOTAVAIL;
 					goto out_unlock;
 				}
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5a80f15..9f25dda 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -383,6 +383,17 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
 	return found;
 }
 
+/*	check if address is link-local on given interface
+ *	or is global on any interface
+ */
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+			     const struct in6_addr *addr)
+{
+	if (ipv6_addr_type(addr) & IPV6_ADDR_LINKLOCAL)
+		return ipv6_chk_acast_dev(dev, addr);
+	else
+		return ipv6_chk_acast_addr(net, NULL, addr);
+}
 
 #ifdef CONFIG_PROC_FS
 struct ac6_iter_state {

^ permalink raw reply related

* Re: [PATCH 3/3] atl1: update statistics code
From: Ben Hutchings @ 2014-01-10 18:29 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
In-Reply-To: <1389370103-3009-4-git-send-email-sd@queasysnail.net>

On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
>  drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
> index 538211d..31d460a 100644
> --- a/drivers/net/ethernet/atheros/atlx/atl1.c
> +++ b/drivers/net/ethernet/atheros/atlx/atl1.c
[...]
> @@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
>  	adapter->soft_stats.tx_trunc += smb->tx_trunc;
>  	adapter->soft_stats.tx_pause += smb->tx_pause;
>  
> -	netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
> -	netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
>  	netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
>  	netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
>  	netdev->stats.multicast = adapter->soft_stats.multicast;
>  	netdev->stats.collisions = adapter->soft_stats.collisions;
>  	netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
> -	netdev->stats.rx_over_errors =
> -		adapter->soft_stats.rx_missed_errors;
>  	netdev->stats.rx_length_errors =
>  		adapter->soft_stats.rx_length_errors;
>  	netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
>  	netdev->stats.rx_frame_errors =
>  		adapter->soft_stats.rx_frame_errors;
>  	netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
> -	netdev->stats.rx_missed_errors =
> -		adapter->soft_stats.rx_missed_errors;

So adapter->soft_stats.rx_missed_errors is set (to something silly) and
then ignored...

> +	netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
>  	netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
>  	netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
>  	netdev->stats.tx_aborted_errors =
> @@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
>  		adapter->soft_stats.tx_window_errors;
>  	netdev->stats.tx_carrier_errors =
>  		adapter->soft_stats.tx_carrier_errors;
> +
> +	netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
> +				   netdev->stats.rx_errors;
> +	netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
> +				   netdev->stats.tx_errors;

Given that adapter->soft_stats largely mirrors struct net_device_stats,
would it not make sense to do these additions there so that
adapter->soft_stats.{rx,tx}_packets include all packets?

I.e. you could do something like:

	delta_rx_errors = (smb->rx_frag + smb->rx_fcs_err +
			   smb->rx_len_err + smb->rx_sz_ov + smb->rx_rxf_ov +
			   smb->rx_rrd_ov + smb->rx_align_err);
	adapter->soft_stats.rx_errors += delta_rx_errors;
	adapter->soft_stats.rx_packets += delta_rx_errors;

(and similarly for TX).

Basically I think these changes belong further up the function.

Ben.

>  }
>  
>  static void atl1_update_mailbox(struct atl1_adapter *adapter)

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH net 0/2] qlcnic: Bug fixes
From: David Miller @ 2014-01-10 18:26 UTC (permalink / raw)
  To: shahed.shaikh; +Cc: netdev, Dept_NX_Linux_NIC_Driver
In-Reply-To: <1389289265-9586-1-git-send-email-shahed.shaikh@qlogic.com>

From: Shahed Shaikh <shahed.shaikh@qlogic.com>
Date: Thu, 9 Jan 2014 12:41:03 -0500

> This patch series has couple of bug fixes related to statistics.
> 
> Please apply this series to net.

Series applied, thank you.

^ permalink raw reply

* Re: [PATCH net V3 2/2] net: core: explicitly select a txq before doing l2 forwarding
From: David Miller @ 2014-01-10 18:24 UTC (permalink / raw)
  To: jasowang
  Cc: nhorman, mst, e1000-devel, netdev, linux-kernel, john.r.fastabend
In-Reply-To: <1389341906-2367-2-git-send-email-jasowang@redhat.com>

From: Jason Wang <jasowang@redhat.com>
Date: Fri, 10 Jan 2014 16:18:26 +0800

> Currently, the tx queue were selected implicitly in ndo_dfwd_start_xmit(). The
> will cause several issues:
> 
> - NETIF_F_LLTX were removed for macvlan, so txq lock were done for macvlan
>   instead of lower device which misses the necessary txq synchronization for
>   lower device such as txq stopping or frozen required by dev watchdog or
>   control path.
> - dev_hard_start_xmit() was called with NULL txq which bypasses the net device
>   watchdog.
> - dev_hard_start_xmit() does not check txq everywhere which will lead a crash
>   when tso is disabled for lower device.
> 
> Fix this by explicitly introducing a new param for .ndo_select_queue() for just
> selecting queues in the case of l2 forwarding offload. netdev_pick_tx() was also
> extended to accept this parameter and dev_queue_xmit_accel() was used to do l2
> forwarding transmission.
> 
> With this fixes, NETIF_F_LLTX could be preserved for macvlan and there's no need
> to check txq against NULL in dev_hard_start_xmit(). Also there's no need to keep
> a dedicated ndo_dfwd_start_xmit() and we can just reuse the code of
> dev_queue_xmit() to do the transmission.
> 
> In the future, it was also required for macvtap l2 forwarding support since it
> provides a necessary synchronization method.
> 
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: e1000-devel@lists.sourceforge.net
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Applied.

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply

* Re: [PATCH net V3 1/2] macvlan: forbid L2 fowarding offload for macvtap
From: David Miller @ 2014-01-10 18:24 UTC (permalink / raw)
  To: jasowang; +Cc: netdev, linux-kernel, mst, john.r.fastabend, nhorman
In-Reply-To: <1389341906-2367-1-git-send-email-jasowang@redhat.com>

From: Jason Wang <jasowang@redhat.com>
Date: Fri, 10 Jan 2014 16:18:25 +0800

> L2 fowarding offload will bypass the rx handler of real device. This will make
> the packet could not be forwarded to macvtap device. Another problem is the
> dev_hard_start_xmit() called for macvtap does not have any synchronization.
> 
> Fix this by forbidding L2 forwarding for macvtap.
> 
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Applied.

^ permalink raw reply

* Re: pull request: wireless 2014-01-09
From: David Miller @ 2014-01-10 18:21 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20140109153317.GA2131@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Thu, 9 Jan 2014 10:33:17 -0500

> I know that this is late in the process.  But, Linus did say he was
> doing an -rc8 no matter what!
> 
> For the mac80211 bits, Johannes says:
> 
> "I have a fix from Javier for mac80211_hwsim when used with wmediumd
> userspace, and a fix from Felix for buffering in AP mode."
> 
> For the NFC bits, Samuel says:
> 
> "This pull request only contains one fix for a regression introduced with
> commit e29a9e2ae165620d. Without this fix, we can not establish a p2p link
> in target mode. Only initiator mode works."
> 
> For the iwlwifi bits, Emmanuel says:
> 
> "It only includes new device IDs so it's not vital. If you have a pull
> request to net.git anyway, I'd happy to have this in."
> 
> Please let me know if there are problems!  If you don't want to pull
> this one for 3.13 then I'll just roll it into the wireless-next tree...

Pulled, thanks John.

^ permalink raw reply

* RE: [net-next 05/16] i40e: fix long lines
From: Williams, Mitch A @ 2014-01-10 18:20 UTC (permalink / raw)
  To: Joe Perches
  Cc: David Laight, Kirsher, Jeffrey T, davem@davemloft.net,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Brandeburg, Jesse
In-Reply-To: <1389377693.2537.39.camel@joe-AO722>



> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Friday, January 10, 2014 10:15 AM
> To: Williams, Mitch A
> Cc: David Laight; Kirsher, Jeffrey T; davem@davemloft.net;
> netdev@vger.kernel.org; gospo@redhat.com; sassmann@redhat.com; Brandeburg,
> Jesse
> Subject: Re: [net-next 05/16] i40e: fix long lines
> 
> On Fri, 2014-01-10 at 18:05 +0000, Williams, Mitch A wrote:
> > > -----Original Message-----
> > > From: Joe Perches [mailto:joe@perches.com]
> > > Sent: Friday, January 10, 2014 2:36 AM
> []
> > > On Fri, 2014-01-10 at 10:02 +0000, David Laight wrote:
> > > > > Another way this could be changed is to put the
> > > > > return value on a separate line like:
> > > > >
> > > > > i40e_status
> > > > > i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 seid,
> bool
> > > set,
> > > > > 				    struct i40e_asq_cmd_details *cmd_details)
> > > >
> > > > Personally I prefer that so I can find the definition by grepping
> > > > for '^function_name' - but it doesn't seem to be done in any linux
> > > > source files.
> > >
> > > That form is used in a lot of files.
> > > $ git grep -E "^[a-z_]+\("
> > >
> >
> > So, Joe, I just want to be clear. Is this a NAK, or just an FYI?
> 
> Hi Mitch.
> 
> This is your/intel's code.  I don't/shouldn't nak it.
> I made a simple suggestion of an alternate style.
> 
> > If it's a serious issue for you (or Dave), we'll fix it right away.
> 
> It's up to you all to fix it (or not) as you chose.
> It's trivial to me.
> 
> cheers, Joe

Thanks, Joe. As long as Dave is OK with it, I'll let it stand as-is and scrub the whole driver later for stuff like this.

BTW, I appreciate all the time you spend looking at our code. We've got a decent sized team here, but it's always good to have somebody outside the organization keeping us honest.

-Mitch

^ permalink raw reply

* Re: [PATCH 2/3] atl1e: update statistics code
From: Ben Hutchings @ 2014-01-10 18:20 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
In-Reply-To: <1389370103-3009-3-git-send-email-sd@queasysnail.net>

On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
> 
> Minor whitespace fixes to match the style in alx.
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

> ---
>  drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 30 ++++++++++++++++---------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> index 7a73f3a..d5c2d3e 100644
> --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> @@ -1177,32 +1177,40 @@ static struct net_device_stats *atl1e_get_stats(struct net_device *netdev)
>  	struct atl1e_hw_stats  *hw_stats = &adapter->hw_stats;
>  	struct net_device_stats *net_stats = &netdev->stats;
>  
> -	net_stats->rx_packets = hw_stats->rx_ok;
> -	net_stats->tx_packets = hw_stats->tx_ok;
>  	net_stats->rx_bytes   = hw_stats->rx_byte_cnt;
>  	net_stats->tx_bytes   = hw_stats->tx_byte_cnt;
>  	net_stats->multicast  = hw_stats->rx_mcast;
>  	net_stats->collisions = hw_stats->tx_1_col +
> -				hw_stats->tx_2_col * 2 +
> -				hw_stats->tx_late_col + hw_stats->tx_abort_col;
> +				hw_stats->tx_2_col +
> +				hw_stats->tx_late_col +
> +				hw_stats->tx_abort_col;
> +
> +	net_stats->rx_errors  = hw_stats->rx_frag +
> +				hw_stats->rx_fcs_err +
> +				hw_stats->rx_len_err +
> +				hw_stats->rx_sz_ov +
> +				hw_stats->rx_rrd_ov +
> +				hw_stats->rx_align_err +
> +				hw_stats->rx_rxf_ov;
>  
> -	net_stats->rx_errors  = hw_stats->rx_frag + hw_stats->rx_fcs_err +
> -				hw_stats->rx_len_err + hw_stats->rx_sz_ov +
> -				hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
>  	net_stats->rx_fifo_errors   = hw_stats->rx_rxf_ov;
>  	net_stats->rx_length_errors = hw_stats->rx_len_err;
>  	net_stats->rx_crc_errors    = hw_stats->rx_fcs_err;
>  	net_stats->rx_frame_errors  = hw_stats->rx_align_err;
> -	net_stats->rx_over_errors   = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> +	net_stats->rx_dropped       = hw_stats->rx_rrd_ov;
>  
> -	net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> +	net_stats->tx_errors = hw_stats->tx_late_col +
> +			       hw_stats->tx_abort_col +
> +			       hw_stats->tx_underrun +
> +			       hw_stats->tx_trunc;
>  
> -	net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
> -			       hw_stats->tx_underrun + hw_stats->tx_trunc;
>  	net_stats->tx_fifo_errors    = hw_stats->tx_underrun;
>  	net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
>  	net_stats->tx_window_errors  = hw_stats->tx_late_col;
>  
> +	net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
> +	net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
> +
>  	return net_stats;
>  }
>  

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH net] bnx2x: fix DMA unmapping of TSO split BDs
From: David Miller @ 2014-01-10 18:19 UTC (permalink / raw)
  To: mschmidt; +Cc: netdev, ariele, yuvalmin, dmitry
In-Reply-To: <1389274587-6097-1-git-send-email-mschmidt@redhat.com>

From: Michal Schmidt <mschmidt@redhat.com>
Date: Thu,  9 Jan 2014 14:36:27 +0100

> bnx2x triggers warnings with CONFIG_DMA_API_DEBUG=y:
> 
>   WARNING: CPU: 0 PID: 2253 at lib/dma-debug.c:887 check_unmap+0xf8/0x920()
>   bnx2x 0000:28:00.0: DMA-API: device driver frees DMA memory with
>   different size [device address=0x00000000da2b389e] [map size=1490 bytes]
>   [unmap size=66 bytes]
> 
> The reason is that bnx2x splits a TSO BD into two BDs (headers + data)
> using one DMA mapping for both, but it uses only the length of the first
> BD when unmapping.
> 
> This patch fixes the bug by unmapping the whole length of the two BDs.
> 
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH 1/3] atl1c: update statistics code
From: Ben Hutchings @ 2014-01-10 18:19 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
In-Reply-To: <1389370103-3009-2-git-send-email-sd@queasysnail.net>

On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
> 
> Minor whitespace fixes to match the style in alx.
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Again I don't know the hardware, but this seems to make sense.

Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

> ---
>  drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 31 ++++++++++++++++---------
>  1 file changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2980175..4d3258d 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1500,31 +1500,40 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev)
>  	struct net_device_stats *net_stats = &netdev->stats;
>  
>  	atl1c_update_hw_stats(adapter);
> -	net_stats->rx_packets = hw_stats->rx_ok;
> -	net_stats->tx_packets = hw_stats->tx_ok;
>  	net_stats->rx_bytes   = hw_stats->rx_byte_cnt;
>  	net_stats->tx_bytes   = hw_stats->tx_byte_cnt;
>  	net_stats->multicast  = hw_stats->rx_mcast;
>  	net_stats->collisions = hw_stats->tx_1_col +
> -				hw_stats->tx_2_col * 2 +
> -				hw_stats->tx_late_col + hw_stats->tx_abort_col;
> -	net_stats->rx_errors  = hw_stats->rx_frag + hw_stats->rx_fcs_err +
> -				hw_stats->rx_len_err + hw_stats->rx_sz_ov +
> -				hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
> +				hw_stats->tx_2_col +
> +				hw_stats->tx_late_col +
> +				hw_stats->tx_abort_col;
> +
> +	net_stats->rx_errors  = hw_stats->rx_frag +
> +				hw_stats->rx_fcs_err +
> +				hw_stats->rx_len_err +
> +				hw_stats->rx_sz_ov +
> +				hw_stats->rx_rrd_ov +
> +				hw_stats->rx_align_err +
> +				hw_stats->rx_rxf_ov;
> +
>  	net_stats->rx_fifo_errors   = hw_stats->rx_rxf_ov;
>  	net_stats->rx_length_errors = hw_stats->rx_len_err;
>  	net_stats->rx_crc_errors    = hw_stats->rx_fcs_err;
>  	net_stats->rx_frame_errors  = hw_stats->rx_align_err;
> -	net_stats->rx_over_errors   = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> +	net_stats->rx_dropped       = hw_stats->rx_rrd_ov;
>  
> -	net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> +	net_stats->tx_errors = hw_stats->tx_late_col +
> +			       hw_stats->tx_abort_col +
> +			       hw_stats->tx_underrun +
> +			       hw_stats->tx_trunc;
>  
> -	net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
> -				hw_stats->tx_underrun + hw_stats->tx_trunc;
>  	net_stats->tx_fifo_errors    = hw_stats->tx_underrun;
>  	net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
>  	net_stats->tx_window_errors  = hw_stats->tx_late_col;
>  
> +	net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
> +	net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
> +
>  	return net_stats;
>  }
>  

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH] net: Check skb->rxhash in gro_receive
From: Tom Herbert @ 2014-01-10 18:15 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
In-Reply-To: <1389375935.31367.102.camel@edumazet-glaptop2.roam.corp.google.com>

On Fri, Jan 10, 2014 at 9:45 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2014-01-10 at 08:27 -0800, Tom Herbert wrote:
>> On Thu, Jan 9, 2014 at 9:38 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > On Thu, 2014-01-09 at 20:54 -0800, Tom Herbert wrote:
>> >> When initializing a gro_list for a packet, first check the rxhash of
>> >> the incoming skb against that of the skb's in the list. This should be
>> >> a very strong inidicator of whether the flow is going to be matched,
>> >> and potentially allows a lot of other checks to be short circuited.
>> >>
>> >
>> > Hmm... this idea was discussed in the past. I used it when attempting to
>> > use a hash table instead of a gro_list last year.
>> >
>> > Unfortunately this added lot of cycles when rxhash is not provided by
>> > hardware, and my tests found it was not a win.
>> >
>> > Remember : in most cases, gro_list contains one flow, so this test does
>> > nothing special but adds overhead.
>>
>> I don't understand what your basis is that gro_list in most cases
>> contains one flow, but assuming that were true, maybe we should make
>> the it only contain one flow eliminating the complexity of multiple
>> flows (same_flow logic is convoluted and layers of encapsulation is
>> not going to simplify things).
>>
>
> The complexity of GRO is the aggregation itself. You wont avoid it.
>
>> If we are doing RPS or RFS, rxhash will be computed anyway, so the
>> case your optimizing is pretty narrow: no RPS, no RFS, no hardware
>> hash, and a single flow in gro_list. Nevertheless, if this is really
>> an important concern, we can make the check directly against
>> skb->rxhash so to be opportunistic and avoid the possibility of
>> computation.
>
>
> We'll compute rxhash once per GRO packet, containing up to 40 MSS
> packets.
>
> Thats a big difference.
>
The objective is to compute the rxhash at most once per packet.

> If your patch was doing this, I would have no complain.
>
> (No new conditional branch, and skb->rxhash, if provided by the NIC,
> can give a hint.)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index ce01847793c0..c9f7a26d7ce7 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3798,7 +3798,8 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
>         for (p = napi->gro_list; p; p = p->next) {
>                 unsigned long diffs;
>
> -               diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
> +               diffs = p->rxhash ^ skb->rxhash;
> +               diffs |= (unsigned long)p->dev ^ (unsigned long)skb->dev;
>                 diffs |= p->vlan_tci ^ skb->vlan_tci;
>                 if (maclen == ETH_HLEN)
>                         diffs |= compare_ether_header(skb_mac_header(p),
>
As I said in the commit log, the skb->rxhash should be a very strong
indicator of that flows will match (maybe >99% ?), so putting that
first potentially short circuits a lot of work even in just this
function.

>
>

^ permalink raw reply

* Re: [net-next 05/16] i40e: fix long lines
From: Joe Perches @ 2014-01-10 18:14 UTC (permalink / raw)
  To: Williams, Mitch A
  Cc: David Laight, Kirsher, Jeffrey T, davem@davemloft.net,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Brandeburg, Jesse
In-Reply-To: <AAEA33E297BCAC4B9BB20A7C2DF0AB8D654F044C@FMSMSX113.amr.corp.intel.com>

On Fri, 2014-01-10 at 18:05 +0000, Williams, Mitch A wrote:
> > -----Original Message-----
> > From: Joe Perches [mailto:joe@perches.com]
> > Sent: Friday, January 10, 2014 2:36 AM
[]
> > On Fri, 2014-01-10 at 10:02 +0000, David Laight wrote:
> > > > Another way this could be changed is to put the
> > > > return value on a separate line like:
> > > >
> > > > i40e_status
> > > > i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 seid, bool
> > set,
> > > > 				    struct i40e_asq_cmd_details *cmd_details)
> > >
> > > Personally I prefer that so I can find the definition by grepping
> > > for '^function_name' - but it doesn't seem to be done in any linux
> > > source files.
> > 
> > That form is used in a lot of files.
> > $ git grep -E "^[a-z_]+\("
> > 
> 
> So, Joe, I just want to be clear. Is this a NAK, or just an FYI?

Hi Mitch.

This is your/intel's code.  I don't/shouldn't nak it.
I made a simple suggestion of an alternate style.

> If it's a serious issue for you (or Dave), we'll fix it right away.

It's up to you all to fix it (or not) as you chose.
It's trivial to me.

cheers, Joe

^ permalink raw reply

* RE: [net-next 05/16] i40e: fix long lines
From: Williams, Mitch A @ 2014-01-10 18:05 UTC (permalink / raw)
  To: Joe Perches, David Laight
  Cc: Kirsher, Jeffrey T, davem@davemloft.net, netdev@vger.kernel.org,
	gospo@redhat.com, sassmann@redhat.com, Brandeburg, Jesse
In-Reply-To: <1389350138.2537.3.camel@joe-AO722>



> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Friday, January 10, 2014 2:36 AM
> To: David Laight
> Cc: Kirsher, Jeffrey T; davem@davemloft.net; Williams, Mitch A;
> netdev@vger.kernel.org; gospo@redhat.com; sassmann@redhat.com; Brandeburg,
> Jesse
> Subject: Re: [net-next 05/16] i40e: fix long lines
> 
> On Fri, 2014-01-10 at 10:02 +0000, David Laight wrote:
> > > Another way this could be changed is to put the
> > > return value on a separate line like:
> > >
> > > i40e_status
> > > i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 seid, bool
> set,
> > > 				    struct i40e_asq_cmd_details *cmd_details)
> >
> > Personally I prefer that so I can find the definition by grepping
> > for '^function_name' - but it doesn't seem to be done in any linux
> > source files.
> 
> That form is used in a lot of files.
> $ git grep -E "^[a-z_]+\("
> 

So, Joe, I just want to be clear. Is this a NAK, or just an FYI? If it's a serious issue for you (or Dave), we'll fix it right away. Otherwise, I'll just keep it in mind and come back with a janitorial patch once we've got all of the driver functionality sorted.

-Mitch

^ permalink raw reply

* Re: [net-next 00/16][pull request] Intel Wired LAN Driver Updates
From: Jeff Kirsher @ 2014-01-10 17:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, gospo, sassmann
In-Reply-To: <20140110.124852.946925725687619117.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

On Fri, 2014-01-10 at 12:48 -0500, David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Fri, 10 Jan 2014 00:58:40 -0800
> 
> > This series contains updates to i40e only.
> 
> Please address the feedback given and resubmit, thank you.

Will do.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH] netdevice.7: document SIOCGIFCONF case ifc_req==NULL
From: Michael Kerrisk (man-pages) @ 2014-01-10 17:52 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20140109233018.886FA140064-MSQiN3VOO+MkAF8ESQKhnNBPR1lH4CV8@public.gmane.org>

On 01/10/2014 12:30 PM, Tilman Schmidt wrote:
> Add the missing description of the possibility to call SIOCGIFCONF
> with ifc_req==NULL to determine the needed buffer size, as described
> in http://lkml.indiana.edu/hypermail/linux/kernel/0110.1/0506.html
> and verified against source files net/core/dev_ioctl.c and
> net/ipv4/devinet.c in the current kernel git tree.
> This functionality has been present since the beginning of the 2.6
> series. It's about time it gets documented.
> While I'm at it, also generally clarify the section on SIOCGIFCONF.
> 
> Patch prepared against man-pages version 3.55.
> 
> Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>

Hello Tilman,

Thanks for the patch. I'm trying to verify this from the code, but 
am having some trouble finding the relevant pieces. Could you point
me more specifically at the points in the kernel source where this
case is handled?

Thanks,

Michael



> ---
>  man7/netdevice.7 |   83 +++++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 57 insertions(+), 26 deletions(-)
> 
> --- a/man7/netdevice.7	2013-12-12 08:42:55.000000000 +0100
> +++ b/man7/netdevice.7	2014-01-09 23:43:23.000000000 +0100
> @@ -15,7 +15,7 @@
>  .\" Modified, 2011-11-02, <bidulock-B8ReZeU34LJAfugRpC6u6w@public.gmane.org>, added many basic
>  .\"  but missing ioctls, such as SIOCGIFADDR.
>  .\"
> -.TH NETDEVICE  7 2012-04-26 "Linux" "Linux Programmer's Manual"
> +.TH NETDEVICE  7 2014-01-09 "Linux" "Linux Programmer's Manual"
>  .SH NAME
>  netdevice \- low-level access to Linux network devices
>  .SH SYNOPSIS
> @@ -29,7 +29,7 @@
>  Linux supports some standard ioctls to configure network devices.
>  They can be used on any socket's file descriptor regardless of the
>  family or type.
> -They pass an
> +Most of them pass an
>  .I ifreq
>  structure:
>  
> @@ -53,14 +53,6 @@
>          char           *ifr_data;
>      };
>  };
> -
> -struct ifconf {
> -    int                 ifc_len; /* size of buffer */
> -    union {
> -        char           *ifc_buf; /* buffer address */
> -        struct ifreq   *ifc_req; /* array of structures */
> -    };
> -};
>  .fi
>  .in
>  
> @@ -265,30 +257,69 @@
>  means only addresses of the
>  .B AF_INET
>  (IPv4) family for compatibility.
> -The user passes a
> +Unlike the others, this ioctl passes an
>  .I ifconf
> -structure as argument to the ioctl.
> -It contains a pointer to an array of
> -.I ifreq
> -structures in
> +structure:
> +
> +.in +4n
> +.nf
> +struct ifconf {
> +    int                 ifc_len; /* size of buffer */
> +    union {
> +        char           *ifc_buf; /* buffer address */
> +        struct ifreq   *ifc_req; /* array of structures */
> +    };
> +};
> +.fi
> +.in
> +
> +If
>  .I ifc_req
> -and its length in bytes in
> +is NULL,
> +.B SIOCGIFCONF
> +returns the necessary buffer size in bytes
> +for receiving all available addresses in
>  .IR ifc_len .
> -The kernel fills the ifreqs with all current L3 interface addresses that
> -are running:
> +Otherwise
> +.I ifc_req
> +contains a pointer to an array of
> +.I ifreq
> +structures to be filled with all currently active L3 interface addresses.
> +.I ifc_len
> +contains the size of the array in bytes.
> +Within each
> +.I ifreq
> +structure,
>  .I ifr_name
> -contains the interface name (eth0:1 etc.),
> +will receive the interface name, and
>  .I ifr_addr
>  the address.
> -The kernel returns with the actual length in
> +The actual number of bytes transferred is returned in
>  .IR ifc_len .
> -If
> +
> +If the size specified by
> +.I ifc_len
> +is insufficient to store all the addresses,
> +the kernel will skip the exceeding ones and return success.
> +There is no reliable way of detecting this condition once it has occurred.
> +It is therefore recommended to either determine the necessary buffer size
> +beforehand by calling
> +.B SIOCGIFCONF
> +with
> +.I ifc_req
> +set to NULL, or to retry the call with a bigger buffer whenever
>  .I ifc_len
> -is equal to the original length the buffer probably has overflowed
> -and you should retry with a bigger buffer to get all addresses.
> -When no error occurs the ioctl returns 0;
> -otherwise \-1.
> -Overflow is not an error.
> +upon return differs by less than sizeof(struct
> +.IR ifreq )
> +from its original value.
> +
> +If an error occurs accessing the
> +.I ifconf
> +or
> +.I ifreq
> +structures,
> +.B EFAULT
> +will be returned.
>  .\" Slaving isn't supported in 2.2
>  .\" .
>  .\" .TP
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox