Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/1] be2net: missing variable initialization
From: Antonio Alecrim Jr @ 2013-09-13 17:05 UTC (permalink / raw)
  To: Sathya Perla, netdev, linux-kernel; +Cc: Antonio Alecrim Jr

Signed-off-by: Antonio Alecrim Jr <antonio.alecrim@gmail.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 3224d28..100b528 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2802,7 +2802,7 @@ static int be_vfs_if_create(struct be_adapter *adapter)
 	struct be_resources res = {0};
 	struct be_vf_cfg *vf_cfg;
 	u32 cap_flags, en_flags, vf;
-	int status;
+	int status = 0;
 
 	cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |
 		    BE_IF_FLAGS_MULTICAST;
-- 
1.8.3.1

^ permalink raw reply related

* Re: ICMP rate limiting in IPv4 but not in IPv6
From: Hannes Frederic Sowa @ 2013-09-13 16:44 UTC (permalink / raw)
  To: Andy Johnson; +Cc: netdev
In-Reply-To: <CAF0Lin2-ooC6iQCwjnf5196cfy0Xii6H5prS4CEsjeJVAFYcyA@mail.gmail.com>

On Fri, Sep 13, 2013 at 06:57:56PM +0300, Andy Johnson wrote:
> Hello,
> After probing into the RFC of ICMPv6, I am even more confused.
> 
> RFC 4443 says:
> 
> 2.4.  Message Processing Rules
> ...
> 
> (f) Finally, in order to limit the bandwidth and forwarding costs
>        incurred by originating ICMPv6 error messages, an IPv6 node MUST
>        limit the rate of ICMPv6 error messages it originates.
> ...
> The rate-limiting parameters SHOULD be configurable.
> ...
> 
> Any ideas?

Well, nobody has implemented it because nobody missed the feature yet. I
don't believe there is another reason for that. If you come up with a
patch, I am sure it can go upstream.

Do you want to try to come up with a patch? We need to be a bit
careful regarding neighbor discovery but otherwise this should be
relativ straightforward. In the meantime you could also implement such
ratelimiting with netfilter.

Greetings,

  Hannes

^ permalink raw reply

* Re: [PATCH net-next] bridge: fix NULL pointer deref in br_handle_frame
From: Stephen Hemminger @ 2013-09-13 16:21 UTC (permalink / raw)
  To: Hong Zhiguo; +Cc: netdev, davem, zhiguohong, eric.dumazet, vyasevic
In-Reply-To: <1379041787-14232-1-git-send-email-zhiguohong@tencent.com>

On Fri, 13 Sep 2013 11:09:47 +0800
Hong Zhiguo <honkiko@gmail.com> wrote:

> From: Hong Zhiguo <zhiguohong@tencent.com>
> 
> I got an Oops on my box when br_handle_frame is called between these
> 2 lines of del_nbp:
> 	dev->priv_flags &= ~IFF_BRIDGE_PORT;
> 	/* --> br_handle_frame is called at this time */
> 	netdev_rx_handler_unregister(dev);
> 
> In br_handle_frame the return of br_port_get_rcu(dev) is dereferenced
> without check but br_port_get_rcu(dev) returns NULL if:
> 	!(dev->priv_flags & IFF_BRIDGE_PORT)
> 
> In my first fix I moved netdev_rx_handler_unregister up. Eric Dumazet
> pointed out the testing of IFF_BRIDGE_PORT is not necessary here since
> we're in rcu_read_lock and we have synchronize_net() in
> netdev_rx_handler_unregister. This fix removed the testing of
> IFF_BRIDGE_PORT.
> 
> I tested the fix on my box with script doing "brctl addif" and "brctl
> delif" repeatedly while a lot of broadcast frame present on the LAN.
> I added msleep in del_nbp between setting of priv_flags and unregister
> so it's easy to reproduce the oops without the fix.
> 
> I'll send another patch to net-next to take care of br_netfilter and
> ebtable if necessary(seems there's NULL check following but I'll
> have a look).
> 
> The Oops(some lines omitted):
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000021
> IP: [<ffffffff8150901d>] br_handle_frame+0xed/0x230
> Oops: 0000 [#1] PREEMPT SMP
> RIP: 0010:[<ffffffff8150901d>]  [<ffffffff8150901d>] br_handle_frame+0xed/0x230
> RSP: 0018:ffff880030403c10  EFLAGS: 00010286
> Stack:
>  ffff88002c945700 ffffffff81508f30 0000000000000000 ffff88002d41e000
>  ffff880030403c98 ffffffff81477acb ffffffff81477821 ffff880030403c68
>  ffffffff81090e10 00ff88002d545c80 ffff88002c945700 ffffffff81aa50c0
> Call Trace:
>  <IRQ>
>  [<ffffffff81508f30>] ? br_handle_frame_finish+0x300/0x300
>  [<ffffffff81477acb>] __netif_receive_skb_core+0x39b/0x880
> 
> Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
> ---
>  net/bridge/br_input.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index a2fd37e..2244049 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -60,7 +60,7 @@ static int br_pass_frame_up(struct sk_buff *skb)
>  int br_handle_frame_finish(struct sk_buff *skb)
>  {
>  	const unsigned char *dest = eth_hdr(skb)->h_dest;
> -	struct net_bridge_port *p = br_port_get_rcu(skb->dev);
> +	struct net_bridge_port *p = rcu_dereference(skb->dev->rx_handler_data);
>  	struct net_bridge *br;
>  	struct net_bridge_fdb_entry *dst;
>  	struct net_bridge_mdb_entry *mdst;
> @@ -143,7 +143,7 @@ drop:
>  /* note: already called with rcu_read_lock */
>  static int br_handle_local_finish(struct sk_buff *skb)
>  {
> -	struct net_bridge_port *p = br_port_get_rcu(skb->dev);
> +	struct net_bridge_port *p = rcu_dereference(skb->dev->rx_handler_data);
>  	u16 vid = 0;
>  
>  	br_vlan_get_tag(skb, &vid);
> @@ -173,7 +173,7 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
>  	if (!skb)
>  		return RX_HANDLER_CONSUMED;
>  
> -	p = br_port_get_rcu(skb->dev);
> +	p = rcu_dereference(skb->dev->rx_handler_data);
>  
>  	if (unlikely(is_link_local_ether_addr(dest))) {
>  		/*

There are more uses of br_port_get_rcu that have the same problem.
For example receiving an STP packet in that window.
I bet if you look at all the callers of br_port_get_rcu() you will
see the same issue, therefore either the check should be removed from br_port_get_rcu.

A little bit of history, the bridge code orginally did not use RCU,
and there was a flag on the device. Then RCU was added, then the receive
handler stuff was added.

^ permalink raw reply

* [PATCH] ath9k: mark wmi_event_swba as __packed
From: Chris Metcalf @ 2013-09-13 16:14 UTC (permalink / raw)
  To: Luis R. Rodriguez, Jouni Malinen, Vasanthakumar Thiagarajan,
	Senthil Balasubramanian, John W. Linville, linux-wireless,
	ath9k-devel, netdev, linux-kernel

The other structures in wmi.h are already marked this way.
Without this marking, we get an unaliged access panic in the tilegx kernel:

Starting stack dump of tid 0, pid 0 (swapper) on cpu 35 at cycle 198675113844
  frame 0: 0xfffffff7103ada90 ath9k_htc_swba+0x120/0x618 [ath9k_htc]
  frame 1: 0xfffffff7103a4b10 ath9k_wmi_event_tasklet+0x1b0/0x270 [ath9k_htc]
  frame 2: 0xfffffff700326570 tasklet_action+0x148/0x298
  [...]

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
---
 drivers/net/wireless/ath/ath9k/wmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h
index fde6da6..0db37f2 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -39,7 +39,7 @@ struct wmi_fw_version {
 struct wmi_event_swba {
 	__be64 tsf;
 	u8 beacon_pending;
-};
+} __packed;
 
 /*
  * 64 - HTC header - WMI header - 1 / txstatus
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCH] [Trivial] remove unnecessary header file inclusion
From: Ben Hutchings @ 2013-09-13 16:11 UTC (permalink / raw)
  To: ZHAO Gang; +Cc: davem, netdev, linux-kernel
In-Reply-To: <20130913145718.GA2536@will>

On Fri, 2013-09-13 at 22:57 +0800, ZHAO Gang wrote:
> file linux/fib_rules.h doesn't exist, so remove it.

Do you think people wouldn't notice #include of a nonexistent file?  gcc
is quite good at complaining about them...

It's now called include/uapi/linux/fib_rules.h.

Ben.

> Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
> ---
>  include/net/fib_rules.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
> index 4b2b557..c816f91 100644
> --- a/include/net/fib_rules.h
> +++ b/include/net/fib_rules.h
> @@ -4,7 +4,6 @@
>  #include <linux/types.h>
>  #include <linux/slab.h>
>  #include <linux/netdevice.h>
> -#include <linux/fib_rules.h>
>  #include <net/flow.h>
>  #include <net/rtnetlink.h>
>  

-- 
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

* [PATCH v2 iproute2] htb: add support for direct_qlen attribute
From: Eric Dumazet @ 2013-09-13 16:10 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <1379086235.24408.41.camel@edumazet-glaptop>

From: Eric Dumazet <edumazet@google.com>

TCA_HTB_DIRECT_QLEN attribute is supported since linux-3.10

HTB classes use an internal pfifo queue, which limit was not reported
by tc, and value inherited from device tx_queue_len at setup time.
    
With this patch, tc displays the value and can change it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 tc/q_htb.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tc/q_htb.c b/tc/q_htb.c
index 7b6f908..6737ddb 100644
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -31,9 +31,11 @@
 static void explain(void)
 {
 	fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n"
+		"                      [direct_qlen P]\n"
 		" default  minor id of class to which unclassified packets are sent {0}\n"
 		" r2q      DRR quantums are computed as rate in Bps/r2q {10}\n"
 		" debug    string of 16 numbers each 0-3 {0}\n\n"
+		" direct_qlen  Limit of the direct queue {in packets}\n"
 		"... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n"
 		"                      [prio P] [slot S] [pslot PS]\n"
 		"                      [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
@@ -108,6 +110,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	unsigned mtu;
 	unsigned short mpu = 0;
 	unsigned short overhead = 0;
+	unsigned int direct_qlen = ~0U;
 	unsigned int linklayer  = LINKLAYER_ETHERNET; /* Assume ethernet */
 	struct rtattr *tail;
 
@@ -125,6 +128,11 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 			if (get_u32(&mtu, *argv, 10)) {
 				explain1("mtu"); return -1;
 			}
+		} else if (matches(*argv, "direct_qlen") == 0) {
+			NEXT_ARG();
+			if (get_u32(&direct_qlen, *argv, 10)) {
+				explain1("direct_qlen"); return -1;
+			}
 		} else if (matches(*argv, "mpu") == 0) {
 			NEXT_ARG();
 			if (get_u16(&mpu, *argv, 10)) {
@@ -230,6 +238,9 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
 
 	tail = NLMSG_TAIL(n);
+	if (direct_qlen != ~0U)
+		addattr_l(n, 1024, TCA_HTB_DIRECT_QLEN,
+			  &direct_qlen, sizeof(direct_qlen));
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
@@ -240,7 +251,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 
 static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
-	struct rtattr *tb[TCA_HTB_RTAB+1];
+	struct rtattr *tb[TCA_HTB_MAX + 1];
 	struct tc_htb_opt *hopt;
 	struct tc_htb_glob *gopt;
 	double buffer,cbuffer;
@@ -253,7 +264,7 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	if (opt == NULL)
 		return 0;
 
-	parse_rtattr_nested(tb, TCA_HTB_RTAB, opt);
+	parse_rtattr_nested(tb, TCA_HTB_MAX, opt);
 
 	if (tb[TCA_HTB_PARMS]) {
 		hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
@@ -302,6 +313,12 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 		if (show_details)
 			fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
 	}
+	if (tb[TCA_HTB_DIRECT_QLEN] &&
+	    RTA_PAYLOAD(tb[TCA_HTB_DIRECT_QLEN]) >= sizeof(__u32)) {
+		__u32 direct_qlen = rta_getattr_u32(tb[TCA_HTB_DIRECT_QLEN]);
+
+		fprintf(f, " direct_qlen %u", direct_qlen);
+	}
 	return 0;
 }
 

^ permalink raw reply related

* Re: [PATCH iproute2] htb: add support for direct_qlen attribute
From: Eric Dumazet @ 2013-09-13 16:06 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <1379086427.24408.42.camel@edumazet-glaptop>

On Fri, 2013-09-13 at 08:33 -0700, Eric Dumazet wrote:
> On Fri, 2013-09-13 at 08:30 -0700, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > TCA_HTB_DIRECT_QLEN attribute is supported since linux-3.10
> > 
> > HTB classes use an internal pfifo queue, which limit was not reported
> 
> s/classes/qdisc/

I'll send a new version, help should go in explain1()

^ permalink raw reply

* Re: ICMP rate limiting in IPv4 but not in IPv6
From: Andy Johnson @ 2013-09-13 15:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <CAF0Lin0xTW4oQ0OQaTzJhoS6XV3nbb8yZx8jDMAcGyJo9zTs9A@mail.gmail.com>

Hello,
After probing into the RFC of ICMPv6, I am even more confused.

RFC 4443 says:

2.4.  Message Processing Rules
...

(f) Finally, in order to limit the bandwidth and forwarding costs
       incurred by originating ICMPv6 error messages, an IPv6 node MUST
       limit the rate of ICMPv6 error messages it originates.
...
The rate-limiting parameters SHOULD be configurable.
...

Any ideas?

regards,
Andy

On Fri, Sep 13, 2013 at 10:21 AM, Andy Johnson <johnsonzjo@gmail.com> wrote:
> Hello,
>
> I am trying to understand the difference between ICMP rate limiting
> in IPv4 and in IPv6.
>
> In IPv4 we have the ability to rate limit ICMPv4 while in IPv6 we do not have
> this ability.
>
> To be more code-oriented:
> The icmpv4_xrlim_allow() method does inspect the rate mask,
> (net->ipv4.sysctl_icmp_ratemask)
> whereas the icmpv6_xrlim_allow() method does not inspect the rate mask.
>
> I do not understand why, for example, we can rate limit ICMPv4 messages of
> Echo Reply and not rate limit ICMPv6 messages of Echo Reply.
>
> See: icmp_ratemask and icmp_ratelimit in Documentation/networking/ip-sysctl.txt
>
> I believe there is some reason behind it (adding checking of rate mask
> seems to me trivial). I try to figure out the reason behind this but I did not
> find anything reasonable,
>
> Does anybody happen to know ?
>
> Regards,
> Andy

^ permalink raw reply

* Re: [PATCH v3] bonding: Make alb learning packet interval configurable
From: Andy Gospodarek @ 2013-09-13 15:38 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1379084733-9219-1-git-send-email-nhorman@tuxdriver.com>

On Fri, Sep 13, 2013 at 11:05:33AM -0400, Neil Horman wrote:
> running bonding in ALB mode requires that learning packets be sent periodically,
> so that the switch knows where to send responding traffic.  However, depending
> on switch configuration, there may not be any need to send traffic at the
> default rate of 3 packets per second, which represents little more than wasted
> data.  Allow the ALB learning packet interval to be made configurable via sysfs
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Thanks for making those changes, Neil.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>

> Acked-by: Acked-by: Veaceslav Falico <vfalico@redhat.com>
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> CC: "David S. Miller" <davem@davemloft.net>
> 
> ---
> Change Notes:
> v2)
> Add documentation
> 
> v3)
> Document the default value and make it a new macro
> ---
>  Documentation/networking/bonding.txt |  6 ++++++
>  drivers/net/bonding/bond_alb.c       |  2 +-
>  drivers/net/bonding/bond_alb.h       |  9 +++++----
>  drivers/net/bonding/bond_main.c      |  1 +
>  drivers/net/bonding/bond_sysfs.c     | 39 ++++++++++++++++++++++++++++++++++++
>  drivers/net/bonding/bonding.h        |  1 +
>  6 files changed, 53 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
> index 87bbcfe..9b28e71 100644
> --- a/Documentation/networking/bonding.txt
> +++ b/Documentation/networking/bonding.txt
> @@ -1362,6 +1362,12 @@ To add ARP targets:
>  To remove an ARP target:
>  # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
>  
> +To configure the interval between learning packet transmits:
> +# echo 12 > /sys/class/net/bond0/bonding/lp_interval
> +	NOTE: the lp_inteval is the number of seconds between instances where
> +the bonding driver sends learning packets to each slaves peer switch.  The
> +default interval is 1 second.
> +
>  Example Configuration
>  ---------------------
>  	We begin with the same example that is shown in section 3.3,
> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
> index 91f179d..f428ef57 100644
> --- a/drivers/net/bonding/bond_alb.c
> +++ b/drivers/net/bonding/bond_alb.c
> @@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work)
>  	bond_info->lp_counter++;
>  
>  	/* send learning packets */
> -	if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) {
> +	if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) {
>  		/* change of curr_active_slave involves swapping of mac addresses.
>  		 * in order to avoid this swapping from happening while
>  		 * sending the learning packets, the curr_slave_lock must be held for
> diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
> index 28d8e4c..c5eff5d 100644
> --- a/drivers/net/bonding/bond_alb.h
> +++ b/drivers/net/bonding/bond_alb.h
> @@ -36,14 +36,15 @@ struct slave;
>  					 * Used for division - never set
>  					 * to zero !!!
>  					 */
> -#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
> -					 * learning packets to the switch
> -					 */
> +#define BOND_ALB_DEFAULT_LP_INTERVAL 1
> +#define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval)	/* In seconds, periodic send of
> +								 * learning packets to the switch
> +								 */
>  
>  #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
>  				  * ALB_TIMER_TICKS_PER_SEC)
>  
> -#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
> +#define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \
>  			   * ALB_TIMER_TICKS_PER_SEC)
>  
>  #define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 39e5b1c..31106b5 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4416,6 +4416,7 @@ static int bond_check_params(struct bond_params *params)
>  	params->all_slaves_active = all_slaves_active;
>  	params->resend_igmp = resend_igmp;
>  	params->min_links = min_links;
> +	params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
>  
>  	if (primary) {
>  		strncpy(params->primary, primary, IFNAMSIZ);
> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> index ce46776..4532259 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
> @@ -1680,6 +1680,44 @@ out:
>  static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR,
>  		   bonding_show_resend_igmp, bonding_store_resend_igmp);
>  
> +
> +static ssize_t bonding_show_lp_interval(struct device *d,
> +					struct device_attribute *attr,
> +					char *buf)
> +{
> +	struct bonding *bond = to_bond(d);
> +	return sprintf(buf, "%d\n", bond->params.lp_interval);
> +}
> +
> +static ssize_t bonding_store_lp_interval(struct device *d,
> +					 struct device_attribute *attr,
> +					 const char *buf, size_t count)
> +{
> +	struct bonding *bond = to_bond(d);
> +	int new_value, ret = count;
> +
> +	if (sscanf(buf, "%d", &new_value) != 1) {
> +		pr_err("%s: no lp interval value specified.\n",
> +			bond->dev->name);
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	if (new_value <= 0) {
> +		pr_err ("%s: lp_interval must be between 1 and %d\n",
> +			bond->dev->name, INT_MAX);
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	bond->params.lp_interval = new_value;
> +out:
> +	return ret;
> +}
> +
> +static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR,
> +		   bonding_show_lp_interval, bonding_store_lp_interval);
> +
>  static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_slaves.attr,
>  	&dev_attr_mode.attr,
> @@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_all_slaves_active.attr,
>  	&dev_attr_resend_igmp.attr,
>  	&dev_attr_min_links.attr,
> +	&dev_attr_lp_interval.attr,
>  	NULL,
>  };
>  
> diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
> index f7ab161..4bd9d5b 100644
> --- a/drivers/net/bonding/bonding.h
> +++ b/drivers/net/bonding/bonding.h
> @@ -176,6 +176,7 @@ struct bond_params {
>  	int tx_queues;
>  	int all_slaves_active;
>  	int resend_igmp;
> +	int lp_interval;
>  };
>  
>  struct bond_parm_tbl {
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH iproute2] htb: add support for direct_qlen attribute
From: Eric Dumazet @ 2013-09-13 15:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <1379086235.24408.41.camel@edumazet-glaptop>

On Fri, 2013-09-13 at 08:30 -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> TCA_HTB_DIRECT_QLEN attribute is supported since linux-3.10
> 
> HTB classes use an internal pfifo queue, which limit was not reported

s/classes/qdisc/

> by tc, and value inherited from device tx_queue_len at setup time.
>     
> With this patch, tc displays the value and can change it.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---

^ permalink raw reply

* [PATCH iproute2] htb: add support for direct_qlen attribute
From: Eric Dumazet @ 2013-09-13 15:30 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

TCA_HTB_DIRECT_QLEN attribute is supported since linux-3.10

HTB classes use an internal pfifo queue, which limit was not reported
by tc, and value inherited from device tx_queue_len at setup time.
    
With this patch, tc displays the value and can change it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 tc/q_htb.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tc/q_htb.c b/tc/q_htb.c
index 7b6f908..0e878d4 100644
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -37,6 +37,7 @@ static void explain(void)
 		"... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n"
 		"                      [prio P] [slot S] [pslot PS]\n"
 		"                      [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
+		"                      [direct_qlen L]\n"
 		" rate     rate allocated to this class (class can still borrow)\n"
 		" burst    max bytes burst which can be accumulated during idle period {computed}\n"
 		" mpu      minimum packet size used in rate computations\n"
@@ -47,6 +48,7 @@ static void explain(void)
 		" mtu      max packet size we create rate map for {1600}\n"
 		" prio     priority of leaf; lower are served first {0}\n"
 		" quantum  how much bytes to serve from leaf at once {use r2q}\n"
+		" direct_qlen  Limit of the direct queue {in packets}\n"
 		"\nTC HTB version %d.%d\n",HTB_TC_VER>>16,HTB_TC_VER&0xffff
 		);
 }
@@ -108,6 +110,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	unsigned mtu;
 	unsigned short mpu = 0;
 	unsigned short overhead = 0;
+	unsigned int direct_qlen = ~0U;
 	unsigned int linklayer  = LINKLAYER_ETHERNET; /* Assume ethernet */
 	struct rtattr *tail;
 
@@ -125,6 +128,11 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 			if (get_u32(&mtu, *argv, 10)) {
 				explain1("mtu"); return -1;
 			}
+		} else if (matches(*argv, "direct_qlen") == 0) {
+			NEXT_ARG();
+			if (get_u32(&direct_qlen, *argv, 10)) {
+				explain1("direct_qlen"); return -1;
+			}
 		} else if (matches(*argv, "mpu") == 0) {
 			NEXT_ARG();
 			if (get_u16(&mpu, *argv, 10)) {
@@ -230,6 +238,9 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
 
 	tail = NLMSG_TAIL(n);
+	if (direct_qlen != ~0U)
+		addattr_l(n, 1024, TCA_HTB_DIRECT_QLEN,
+			  &direct_qlen, sizeof(direct_qlen));
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
@@ -240,7 +251,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 
 static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
-	struct rtattr *tb[TCA_HTB_RTAB+1];
+	struct rtattr *tb[TCA_HTB_MAX + 1];
 	struct tc_htb_opt *hopt;
 	struct tc_htb_glob *gopt;
 	double buffer,cbuffer;
@@ -253,7 +264,7 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	if (opt == NULL)
 		return 0;
 
-	parse_rtattr_nested(tb, TCA_HTB_RTAB, opt);
+	parse_rtattr_nested(tb, TCA_HTB_MAX, opt);
 
 	if (tb[TCA_HTB_PARMS]) {
 		hopt = RTA_DATA(tb[TCA_HTB_PARMS]);
@@ -302,6 +313,12 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 		if (show_details)
 			fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
 	}
+	if (tb[TCA_HTB_DIRECT_QLEN] &&
+	    RTA_PAYLOAD(tb[TCA_HTB_DIRECT_QLEN]) >= sizeof(__u32)) {
+		__u32 direct_qlen = rta_getattr_u32(tb[TCA_HTB_DIRECT_QLEN]);
+
+		fprintf(f, " direct_qlen %u", direct_qlen);
+	}
 	return 0;
 }
 

^ permalink raw reply related

* Re: [PATCH net 0/4] bridge: Fix problems around the PVID
From: Veaceslav Falico @ 2013-09-13 15:21 UTC (permalink / raw)
  To: Toshiaki Makita
  Cc: David Miller, makita.toshiaki, vyasevic, netdev,
	Fernando Luis Vazquez Cao, Patrick McHardy
In-Reply-To: <1379074013.1678.16.camel@localhost.localdomain>

On Fri, Sep 13, 2013 at 09:06:53PM +0900, Toshiaki Makita wrote:
>On Thu, 2013-09-12 at 16:00 -0400, David Miller wrote:
>> From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> Date: Tue, 10 Sep 2013 19:27:54 +0900
>>
>> > There seem to be some undesirable behaviors related with PVID.
>> > 1. It has no effect assigning PVID to a port. PVID cannot be applied
>> > to any frame regardless of whether we set it or not.
>> > 2. FDB entries learned via frames applied PVID are registered with
>> > VID 0 rather than VID value of PVID.
>> > 3. We can set 0 or 4095 as a PVID that are not allowed in IEEE 802.1Q.
>> > This leads interoperational problems such as sending frames with VID
>> > 4095, which is not allowed in IEEE 802.1Q, and treating frames with VID
>> > 0 as they belong to VLAN 0, which is expected to be handled as they have
>> > no VID according to IEEE 802.1Q.
>> >
>> > Note: 2nd and 3rd problems are potential and not exposed unless 1st problem
>> > is fixed, because we cannot activate PVID due to it.
>>
>> Please work out the issues in patch #2 with Vlad and resubmit this
>> series.
>>
>> Thank you.
>
>I'm hovering between whether we should fix the issue by changing vlan 0
>interface behavior in 8021q module or enabling a bridge port to sending
>priority-tagged frames, or another better way.

Take a look at how was it done for bonding - it just goes through the list
of attached vlan devs, and doesn't care about vlan0 (which can, btw, exist
technically). I'm not sure if that's what you're looking for, but worth a
try.

bond_arp_send_all() might be a good starting point.

>
>If you could comment it, I'd appreciate it :)
>
>
>BTW, I think what is discussed in patch #2 is another problem about
>handling priority-tags, and it exists without this patch set applied.
>It looks like that we should prepare another patch set than this to fix
>that problem.
>
>Should I include patches that fix the priority-tags problem in this
>patch set and resubmit them all together?
>
>
>Thanks,
>
>Toshiaki Makita
>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v3] bonding: Make alb learning packet interval configurable
From: Neil Horman @ 2013-09-13 15:05 UTC (permalink / raw)
  To: netdev; +Cc: vfalico, Neil Horman, Jay Vosburgh, Andy Gospodarek,
	David S. Miller
In-Reply-To: <1378822490-28667-1-git-send-email-nhorman@tuxdriver.com>

running bonding in ALB mode requires that learning packets be sent periodically,
so that the switch knows where to send responding traffic.  However, depending
on switch configuration, there may not be any need to send traffic at the
default rate of 3 packets per second, which represents little more than wasted
data.  Allow the ALB learning packet interval to be made configurable via sysfs

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Acked-by: Veaceslav Falico <vfalico@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>

---
Change Notes:
v2)
Add documentation

v3)
Document the default value and make it a new macro
---
 Documentation/networking/bonding.txt |  6 ++++++
 drivers/net/bonding/bond_alb.c       |  2 +-
 drivers/net/bonding/bond_alb.h       |  9 +++++----
 drivers/net/bonding/bond_main.c      |  1 +
 drivers/net/bonding/bond_sysfs.c     | 39 ++++++++++++++++++++++++++++++++++++
 drivers/net/bonding/bonding.h        |  1 +
 6 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 87bbcfe..9b28e71 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -1362,6 +1362,12 @@ To add ARP targets:
 To remove an ARP target:
 # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
 
+To configure the interval between learning packet transmits:
+# echo 12 > /sys/class/net/bond0/bonding/lp_interval
+	NOTE: the lp_inteval is the number of seconds between instances where
+the bonding driver sends learning packets to each slaves peer switch.  The
+default interval is 1 second.
+
 Example Configuration
 ---------------------
 	We begin with the same example that is shown in section 3.3,
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 91f179d..f428ef57 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work)
 	bond_info->lp_counter++;
 
 	/* send learning packets */
-	if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) {
+	if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) {
 		/* change of curr_active_slave involves swapping of mac addresses.
 		 * in order to avoid this swapping from happening while
 		 * sending the learning packets, the curr_slave_lock must be held for
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index 28d8e4c..c5eff5d 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -36,14 +36,15 @@ struct slave;
 					 * Used for division - never set
 					 * to zero !!!
 					 */
-#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
-					 * learning packets to the switch
-					 */
+#define BOND_ALB_DEFAULT_LP_INTERVAL 1
+#define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval)	/* In seconds, periodic send of
+								 * learning packets to the switch
+								 */
 
 #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
 				  * ALB_TIMER_TICKS_PER_SEC)
 
-#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
+#define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \
 			   * ALB_TIMER_TICKS_PER_SEC)
 
 #define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 39e5b1c..31106b5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4416,6 +4416,7 @@ static int bond_check_params(struct bond_params *params)
 	params->all_slaves_active = all_slaves_active;
 	params->resend_igmp = resend_igmp;
 	params->min_links = min_links;
+	params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
 
 	if (primary) {
 		strncpy(params->primary, primary, IFNAMSIZ);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ce46776..4532259 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1680,6 +1680,44 @@ out:
 static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR,
 		   bonding_show_resend_igmp, bonding_store_resend_igmp);
 
+
+static ssize_t bonding_show_lp_interval(struct device *d,
+					struct device_attribute *attr,
+					char *buf)
+{
+	struct bonding *bond = to_bond(d);
+	return sprintf(buf, "%d\n", bond->params.lp_interval);
+}
+
+static ssize_t bonding_store_lp_interval(struct device *d,
+					 struct device_attribute *attr,
+					 const char *buf, size_t count)
+{
+	struct bonding *bond = to_bond(d);
+	int new_value, ret = count;
+
+	if (sscanf(buf, "%d", &new_value) != 1) {
+		pr_err("%s: no lp interval value specified.\n",
+			bond->dev->name);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if (new_value <= 0) {
+		pr_err ("%s: lp_interval must be between 1 and %d\n",
+			bond->dev->name, INT_MAX);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	bond->params.lp_interval = new_value;
+out:
+	return ret;
+}
+
+static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR,
+		   bonding_show_lp_interval, bonding_store_lp_interval);
+
 static struct attribute *per_bond_attrs[] = {
 	&dev_attr_slaves.attr,
 	&dev_attr_mode.attr,
@@ -1710,6 +1748,7 @@ static struct attribute *per_bond_attrs[] = {
 	&dev_attr_all_slaves_active.attr,
 	&dev_attr_resend_igmp.attr,
 	&dev_attr_min_links.attr,
+	&dev_attr_lp_interval.attr,
 	NULL,
 };
 
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index f7ab161..4bd9d5b 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -176,6 +176,7 @@ struct bond_params {
 	int tx_queues;
 	int all_slaves_active;
 	int resend_igmp;
+	int lp_interval;
 };
 
 struct bond_parm_tbl {
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH] atm: nicstar: fix regression made by previous patch
From: Andy Shevchenko @ 2013-09-13 15:00 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, netdev; +Cc: Andy Shevchenko

The commit 8390f814 "atm: nicstar: re-use native mac_pton() helper" did a
usefull thing. However, mac_pton() returns 1 in the case of the successfully
parsed input. This patch fixes a typo.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/atm/nicstar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 409502a..5aca5f4 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -778,7 +778,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
 		return error;
 	}
 
-	if (mac[i] == NULL || mac_pton(mac[i], card->atmdev->esi)) {
+	if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) {
 		nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
 				   card->atmdev->esi, 6);
 		if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
-- 
1.8.4.rc3

^ permalink raw reply related

* [PATCH] [Trivial] remove unnecessary header file inclusion
From: ZHAO Gang @ 2013-09-13 14:57 UTC (permalink / raw)
  To: gamerh2o; +Cc: davem, netdev, linux-kernel


file linux/fib_rules.h doesn't exist, so remove it.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
---
 include/net/fib_rules.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 4b2b557..c816f91 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -4,7 +4,6 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/netdevice.h>
-#include <linux/fib_rules.h>
 #include <net/flow.h>
 #include <net/rtnetlink.h>
 
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCH] net, vxlan Fix compile warning
From: Stephen Hemminger @ 2013-09-13 14:40 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: netdev, jpirko, tgraf, David S. Miller
In-Reply-To: <52331FF7.3070905@redhat.com>

On Fri, 13 Sep 2013 10:23:51 -0400
Prarit Bhargava <prarit@redhat.com> wrote:

> 
> 
> On 09/13/2013 10:20 AM, Stephen Hemminger wrote:
> > On Fri, 13 Sep 2013 08:29:12 -0400
> > Prarit Bhargava <prarit@redhat.com> wrote:
> > 
> >> Fix a unintialized variable warning.
> >>
> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
> >> drivers/net/vxlan.c:2240:11: error: ‘sock’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >>   vs->sock = sock;
> >>            ^
> >> drivers/net/vxlan.c:2217:17: note: ‘sock’ was declared here
> >>   struct socket *sock;
> >>                  ^
> >>
> >> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> >> Cc: jpirko@redhat.com
> >> Cc: tgraf@redhat.com
> >> Cc: "David S. Miller" <davem@davemloft.net>
> > 
> > Which compiler version? Gcc 4.6 is known to be stupid,
> > and I would rather not change the source if it is only caused
> > by a gcc bug fixed in a later release.
> 
> Hi Stephen,
> 
> [root@intel-rosecity-06 ~]# gcc --version
> gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
> Copyright (C) 2013 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> P.

Argh, gcc got stupid again. I guess we have to live it.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply

* [net] vxlan: Fix sparse warnings
From: Jeff Kirsher @ 2013-09-13 14:34 UTC (permalink / raw)
  To: davem; +Cc: Joseph Gasparakis, netdev, gospo, sassmann, Jeff Kirsher

From: Joseph Gasparakis <joseph.gasparakis@intel.com>

This patch fixes sparse warnings when incorrectly handling the port number
and using int instead of unsigned int iterating through &vn->sock_list[].
Keeping the port as __be16 also makes things clearer wrt endianess.
Also, it was pointed out that vxlan_get_rx_port() had unnecessary checks
which got removed.

Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/vxlan.c       | 18 ++++++++----------
 include/linux/netdevice.h |  8 ++++----
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bf64b41..2400b1b 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -564,7 +564,7 @@ static void vxlan_notify_add_rx_port(struct sock *sk)
 	struct net_device *dev;
 	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
-	u16 port = htons(inet_sk(sk)->inet_sport);
+	__be16 port = inet_sk(sk)->inet_sport;
 
 	rcu_read_lock();
 	for_each_netdev_rcu(net, dev) {
@@ -581,7 +581,7 @@ static void vxlan_notify_del_rx_port(struct sock *sk)
 	struct net_device *dev;
 	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
-	u16 port = htons(inet_sk(sk)->inet_sport);
+	__be16 port = inet_sk(sk)->inet_sport;
 
 	rcu_read_lock();
 	for_each_netdev_rcu(net, dev) {
@@ -2021,7 +2021,8 @@ static struct device_type vxlan_type = {
 };
 
 /* Calls the ndo_add_vxlan_port of the caller in order to
- * supply the listening VXLAN udp ports.
+ * supply the listening VXLAN udp ports. Callers are expected
+ * to implement the ndo_add_vxlan_port.
  */
 void vxlan_get_rx_port(struct net_device *dev)
 {
@@ -2029,16 +2030,13 @@ void vxlan_get_rx_port(struct net_device *dev)
 	struct net *net = dev_net(dev);
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	sa_family_t sa_family;
-	u16 port;
-	int i;
-
-	if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port)
-		return;
+	__be16 port;
+	unsigned int i;
 
 	spin_lock(&vn->sock_lock);
 	for (i = 0; i < PORT_HASH_SIZE; ++i) {
-		hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) {
-			port = htons(inet_sk(vs->sock->sk)->inet_sport);
+		hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {
+			port = inet_sk(vs->sock->sk)->inet_sport;
 			sa_family = vs->sock->sk->sk_family;
 			dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
 							    port);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 041b42a..3de49ac 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -950,14 +950,14 @@ struct netdev_phys_port_id {
  *	multiple net devices on single physical port.
  *
  * void (*ndo_add_vxlan_port)(struct  net_device *dev,
- *			      sa_family_t sa_family, __u16 port);
+ *			      sa_family_t sa_family, __be16 port);
  *	Called by vxlan to notiy a driver about the UDP port and socket
  *	address family that vxlan is listnening to. It is called only when
  *	a new port starts listening. The operation is protected by the
  *	vxlan_net->sock_lock.
  *
  * void (*ndo_del_vxlan_port)(struct  net_device *dev,
- *			      sa_family_t sa_family, __u16 port);
+ *			      sa_family_t sa_family, __be16 port);
  *	Called by vxlan to notify the driver about a UDP port and socket
  *	address family that vxlan is not listening to anymore. The operation
  *	is protected by the vxlan_net->sock_lock.
@@ -1093,10 +1093,10 @@ struct net_device_ops {
 							struct netdev_phys_port_id *ppid);
 	void			(*ndo_add_vxlan_port)(struct  net_device *dev,
 						      sa_family_t sa_family,
-						      __u16 port);
+						      __be16 port);
 	void			(*ndo_del_vxlan_port)(struct  net_device *dev,
 						      sa_family_t sa_family,
-						      __u16 port);
+						      __be16 port);
 };
 
 /*
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCHv3 linux-next] hrtimer: Add notifier when clock_was_set was called
From: Thomas Gleixner @ 2013-09-13 14:32 UTC (permalink / raw)
  To: Fan Du
  Cc: David Miller, herbert, steffen.klassert, dborkman, linux-kernel,
	netdev, John Stultz
In-Reply-To: <52327C92.5010009@windriver.com>

On Fri, 13 Sep 2013, Fan Du wrote:
> (2) What I have been bugging you around here for this long time is really the
> second
>     problem, I'm sorry I didn't make it clearly to you and others, which is
> below:
> 
>     Why using wall clock time to calculate soft/hard IPsec events when
> xfrm_state timer
>     out happens in its timeout handler? Because even if xfrm_state using
> CLOCK_BOOTTIME,
>     system wall clock time changing will surely disturb soft/hard IPsec
> events, which
>     you raised your concern about in (*a*).

No CLOCK_BOOTTIME is not affected by wall clock time changes. It's
basically CLOCK_MONOTONIC, it just keeps counting the suspend time as
well. So without a suspend/resume cycle CLOCK_MONOTONIC and
CLOCK_BOOTTIME are the same. After a suspend/resume cycle
CLOCK_BOOTTIME will be N seconds ahead of CLOCK_MONOTONIC, where N is
the number of seconds spent in suspend.

Thanks,

	tglx

^ permalink raw reply

* Re: [PATCH] net, vxlan Fix compile warning
From: Prarit Bhargava @ 2013-09-13 14:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, jpirko, tgraf, David S. Miller
In-Reply-To: <20130913072028.54b1c28d@samsung-9>



On 09/13/2013 10:20 AM, Stephen Hemminger wrote:
> On Fri, 13 Sep 2013 08:29:12 -0400
> Prarit Bhargava <prarit@redhat.com> wrote:
> 
>> Fix a unintialized variable warning.
>>
>> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>> drivers/net/vxlan.c:2240:11: error: ‘sock’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>   vs->sock = sock;
>>            ^
>> drivers/net/vxlan.c:2217:17: note: ‘sock’ was declared here
>>   struct socket *sock;
>>                  ^
>>
>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>> Cc: jpirko@redhat.com
>> Cc: tgraf@redhat.com
>> Cc: "David S. Miller" <davem@davemloft.net>
> 
> Which compiler version? Gcc 4.6 is known to be stupid,
> and I would rather not change the source if it is only caused
> by a gcc bug fixed in a later release.

Hi Stephen,

[root@intel-rosecity-06 ~]# gcc --version
gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

P.

^ permalink raw reply

* Re: [PATCH] net, vxlan Fix compile warning
From: Stephen Hemminger @ 2013-09-13 14:20 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: netdev, jpirko, tgraf, David S. Miller
In-Reply-To: <1379075352-20051-1-git-send-email-prarit@redhat.com>

On Fri, 13 Sep 2013 08:29:12 -0400
Prarit Bhargava <prarit@redhat.com> wrote:

> Fix a unintialized variable warning.
> 
> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
> drivers/net/vxlan.c:2240:11: error: ‘sock’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   vs->sock = sock;
>            ^
> drivers/net/vxlan.c:2217:17: note: ‘sock’ was declared here
>   struct socket *sock;
>                  ^
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: jpirko@redhat.com
> Cc: tgraf@redhat.com
> Cc: "David S. Miller" <davem@davemloft.net>

Which compiler version? Gcc 4.6 is known to be stupid,
and I would rather not change the source if it is only caused
by a gcc bug fixed in a later release.

^ permalink raw reply

* Re: [PATCH 4/7] ptp: switch to use gpiolib
From: Richard Cochran @ 2013-09-13 13:36 UTC (permalink / raw)
  To: Krzysztof Halasa
  Cc: Linus Walleij, linux-gpio@vger.kernel.org, Imre Kaloz,
	Alexandre Courbot, linux-arm-kernel@lists.infradead.org,
	netdev@vger.kernel.org
In-Reply-To: <m38uz0vrlz.fsf@intrepid.localdomain>

On Fri, Sep 13, 2013 at 02:22:16PM +0200, Krzysztof Halasa wrote:
> Linus Walleij <linus.walleij@linaro.org> writes:
> 
> > Thanks, I have found numerous active hobbyists using the
> > IXP4-based NSLU2 NAS machine for various things - mostly
> > non-network related as it happens, so it'll be with us for a
> > while I think.
> 
> IXP42x are most probably "end of life" in the commercial sense, but the
> newer IXP46x/455 and even newer IXP43x are still being sold. For
> example, Gateworks have a couple of IXP43x boards ("Cambria") which
> I personally find interesting, for some specific applications.

I was really talking about the IXP465 with its PTP function. The Intel
devel board had a silicon bug making the PTP function useless. But
even if the bug got fixed, still the PTP function was very limiting.

I never got any feedback about the IXP465 PTP stuff, and so I doubt
whether anyone is really using the Linux PTP driver on the IXP465, but
you never know.

Thanks,
Richard

^ permalink raw reply

* Re: [PATCH] net, vxlan Fix compile warning
From: Jiri Pirko @ 2013-09-13 12:58 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: netdev, jpirko, tgraf, David S. Miller
In-Reply-To: <1379075352-20051-1-git-send-email-prarit@redhat.com>

Fri, Sep 13, 2013 at 02:29:12PM CEST, prarit@redhat.com wrote:
>Fix a unintialized variable warning.
>
>drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>drivers/net/vxlan.c:2240:11: error: ‘sock’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>  vs->sock = sock;
>           ^
>drivers/net/vxlan.c:2217:17: note: ‘sock’ was declared here
>  struct socket *sock;
>                 ^
>
>Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>Cc: jpirko@redhat.com
>Cc: tgraf@redhat.com
>Cc: "David S. Miller" <davem@davemloft.net>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>

^ permalink raw reply

* Re: [PATCH net v2] net: sctp: fix ipv6 ipsec encryption bug in sctp_v6_xmit
From: Neil Horman @ 2013-09-13 12:42 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: davem, netdev, linux-sctp, adobriyan, Steffen Klassert,
	Hannes Frederic Sowa
In-Reply-To: <1378911516-15942-1-git-send-email-dborkman@redhat.com>

On Wed, Sep 11, 2013 at 04:58:36PM +0200, Daniel Borkmann wrote:
> Alan Chester reported an issue with IPv6 on SCTP that IPsec traffic is not
> being encrypted, whereas on IPv4 it is. Setting up an AH + ESP transport
> does not seem to have the desired effect:
> 
> SCTP + IPv4:
> 
>   22:14:20.809645 IP (tos 0x2,ECT(0), ttl 64, id 0, offset 0, flags [DF], proto AH (51), length 116)
>     192.168.0.2 > 192.168.0.5: AH(spi=0x00000042,sumlen=16,seq=0x1): ESP(spi=0x00000044,seq=0x1), length 72
>   22:14:20.813270 IP (tos 0x2,ECT(0), ttl 64, id 0, offset 0, flags [DF], proto AH (51), length 340)
>     192.168.0.5 > 192.168.0.2: AH(spi=0x00000043,sumlen=16,seq=0x1):
> 
> SCTP + IPv6:
> 
>   22:31:19.215029 IP6 (class 0x02, hlim 64, next-header SCTP (132) payload length: 364)
>     fe80::222:15ff:fe87:7fc.3333 > fe80::92e6:baff:fe0d:5a54.36767: sctp
>     1) [INIT ACK] [init tag: 747759530] [rwnd: 62464] [OS: 10] [MIS: 10]
> 
> Moreover, Alan says:
> 
>   This problem was seen with both Racoon and Racoon2. Other people have seen
>   this with OpenSwan. When IPsec is configured to encrypt all upper layer
>   protocols the SCTP connection does not initialize. After using Wireshark to
>   follow packets, this is because the SCTP packet leaves Box A unencrypted and
>   Box B believes all upper layer protocols are to be encrypted so it drops
>   this packet, causing the SCTP connection to fail to initialize. When IPsec
>   is configured to encrypt just SCTP, the SCTP packets are observed unencrypted.
> 
> In fact, using `socat sctp6-listen:3333 -` on one end and transferring "plaintext"
> string on the other end, results in cleartext on the wire where SCTP eventually
> does not report any errors, thus in the latter case that Alan reports, the
> non-paranoid user might think he's communicating over an encrypted transport on
> SCTP although he's not (tcpdump ... -X):
> 
>   ...
>   0x0030: 5d70 8e1a 0003 001a 177d eb6c 0000 0000  ]p.......}.l....
>   0x0040: 0000 0000 706c 6169 6e74 6578 740a 0000  ....plaintext...
> 
> Only in /proc/net/xfrm_stat we can see XfrmInTmplMismatch increasing on the
> receiver side. Initial follow-up analysis from Alan's bug report was done by
> Alexey Dobriyan. Also thanks to Vlad Yasevich for feedback on this.
> 
> SCTP has its own implementation of sctp_v6_xmit() not calling inet6_csk_xmit().
> This has the implication that it probably never really got updated along with
> changes in inet6_csk_xmit() and therefore does not seem to invoke xfrm handlers.
> 
> SCTP's IPv4 xmit however, properly calls ip_queue_xmit() to do the work. Since
> a call to inet6_csk_xmit() would solve this problem, but result in unecessary
> route lookups, let us just use the cached flowi6 instead that we got through
> sctp_v6_get_dst(). Since all SCTP packets are being sent through sctp_packet_transmit(),
> we do the route lookup / flow caching in sctp_transport_route(), hold it in
> tp->dst and skb_dst_set() right after that. If we would alter fl6->daddr in
> sctp_v6_xmit() to np->opt->srcrt, we possibly could run into the same effect
> of not having xfrm layer pick it up, hence, use fl6_update_dst() in sctp_v6_get_dst()
> instead to get the correct source routed dst entry, which we assign to the skb.
> 
> Also source address routing example from 625034113 ("sctp: fix sctp to work with
> ipv6 source address routing") still works with this patch! Nevertheless, in RFC5095
> it is actually 'recommended' to not use that anyway due to traffic amplification [1].
> So it seems we're not supposed to do that anyway in sctp_v6_xmit(). Moreover, if
> we overwrite the flow destination here, the lower IPv6 layer will be unable to
> put the correct destination address into IP header, as routing header is added in
> ipv6_push_nfrag_opts() but then probably with wrong final destination. Things aside,
> result of this patch is that we do not have any XfrmInTmplMismatch increase plus on
> the wire with this patch it now looks like:
> 
> SCTP + IPv6:
> 
>   08:17:47.074080 IP6 2620:52:0:102f:7a2b:cbff:fe27:1b0a > 2620:52:0:102f:213:72ff:fe32:7eba:
>     AH(spi=0x00005fb4,seq=0x1): ESP(spi=0x00005fb5,seq=0x1), length 72
>   08:17:47.074264 IP6 2620:52:0:102f:213:72ff:fe32:7eba > 2620:52:0:102f:7a2b:cbff:fe27:1b0a:
>     AH(spi=0x00003d54,seq=0x1): ESP(spi=0x00003d55,seq=0x1), length 296
> 
> This fixes Kernel Bugzilla 24412. This security issue seems to be present since
> 2.6.18 kernels. Lets just hope some big passive adversary in the wild didn't have
> its fun with that. lksctp-tools IPv6 regression test suite passes as well with
> this patch.
> 
>  [1] http://www.secdev.org/conf/IPv6_RH_security-csw07.pdf
> 
> Reported-by: Alan Chester <alan.chester@tekelec.com>
> Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
>  v1->v2:
>   - use cached flow
>   - improved commit msg
> 
>  net/sctp/ipv6.c | 42 +++++++++++++-----------------------------
>  1 file changed, 13 insertions(+), 29 deletions(-)
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* Re: [patch v2 -stable] igbvf: integer wrapping bug setting the mtu
From: Jeff Kirsher @ 2013-09-13 12:39 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
	Greg Rose, Peter P Waskiewicz Jr, Alex Duyck, John Ronciak,
	Tushar Dave, David S. Miller, Mitch Williams, Patrick McHardy,
	Greg Kroah-Hartman, e1000-devel, netdev, kernel-janitors
In-Reply-To: <20130913122927.GA31819@elgon.mountain>

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

On Fri, 2013-09-13 at 15:29 +0300, Dan Carpenter wrote:
> If new_mtu is very large then "new_mtu + ETH_HLEN + ETH_FCS_LEN" can
> wrap and the check on the next line can underflow. This is one of
> those
> bugs which can be triggered by the user if you have namespaces
> configured.
> 
> Also since this is something the user can trigger then we don't want
> to
> have dev_err() message.
> 
> This is a static checker fix and I'm not sure what the impact is.
> ---
> v2: reformat and also remove the dev_err()
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan, I have added your patch to my queue.

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

^ permalink raw reply

* [PATCH] net, mellanox mlx4 Fix compile warnings
From: Prarit Bhargava @ 2013-09-13 12:30 UTC (permalink / raw)
  To: netdev; +Cc: Prarit Bhargava, dledford, Amir Vadai, Or Gerlitz

Fix unitialized variable warnings.

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function ‘mlx4_HW2SW_CQ_wrapper’:
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2551:16: error: ‘cq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  atomic_dec(&cq->mtt->ref_count);
                ^
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function ‘mlx4_HW2SW_SRQ_wrapper’:
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2734:17: error: ‘srq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  atomic_dec(&srq->mtt->ref_count);

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: dledford@redhat.com
Cc: Amir Vadai <amirv@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
---
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index dd68763..d703838 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -2563,7 +2563,7 @@ int mlx4_HW2SW_CQ_wrapper(struct mlx4_dev *dev, int slave,
 {
 	int err;
 	int cqn = vhcr->in_modifier;
-	struct res_cq *cq;
+	struct res_cq *uninitialized_var(cq);
 
 	err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq);
 	if (err)
@@ -2746,7 +2746,7 @@ int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave,
 {
 	int err;
 	int srqn = vhcr->in_modifier;
-	struct res_srq *srq;
+	struct res_srq *uninitialized_var(srq);
 
 	err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq);
 	if (err)
-- 
1.7.9.3

^ permalink raw reply related


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