Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Joe Perches @ 2011-08-09 18:12 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: linux-kernel, stufever, netdev, davem, Wang Shaoyan
In-Reply-To: <1312912774.2547.1.camel@edumazet-laptop>

On Tue, 2011-08-09 at 19:59 +0200, Eric Dumazet wrote:
> Le mardi 09 août 2011 à 10:52 -0700, Joe Perches a écrit :
> > On Tue, 2011-08-09 at 18:53 +0200, Eric Dumazet wrote:
> > > Le mercredi 10 août 2011 à 00:39 +0800, stufever@gmail.com a écrit :
> > []
> > > > +	if (!local_rqfpr || !local_rqfcr) {
> > > > +		pr_err("Out of memory\n");
> > > 	Please remove this pr_err(), kmalloc() will complain already.
> > Always?
> > I know there's a trace option, but is it always on?
> Yes, unless caller added ___GFP_NOWARN in gfp :
> ptr = kmalloc(size, GFP_KERNEL | ___GFP_NOWARN);

Isn't that true only for slub?

Do you know where this get emitted?
I looked cursorily but I don't see it.


^ permalink raw reply

* Re: [Patch] scm: Capture the full credentials of the scm sender
From: Eric Dumazet @ 2011-08-09 18:12 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Tim Chen, Eric W. Biederman, David S. Miller, Al Viro,
	linux-kernel, netdev
In-Reply-To: <4E41772D.1070700@linux.intel.com>

Le mardi 09 août 2011 à 11:06 -0700, Andi Kleen a écrit :
> > This patch corrects an erroneous update of credential's gid with uid
> > introduced in commit 257b5358b32f17 since 2.6.36.
> 
> 
> Please also add a Cc: stable@kernel.org
> 

David handles stable submission himself, a priori.

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

^ permalink raw reply

* Re: [Patch] scm: Capture the full credentials of the scm sender
From: Andi Kleen @ 2011-08-09 18:06 UTC (permalink / raw)
  To: Tim Chen
  Cc: Eric Dumazet, Eric W. Biederman, David S. Miller, Al Viro,
	linux-kernel, netdev
In-Reply-To: <1312908512.2576.97.camel@schen9-DESK>


> This patch corrects an erroneous update of credential's gid with uid
> introduced in commit 257b5358b32f17 since 2.6.36.


Please also add a Cc: stable@kernel.org

-Andi

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Eric Dumazet @ 2011-08-09 17:59 UTC (permalink / raw)
  To: Joe Perches; +Cc: stufever, linux-kernel, netdev, davem, Wang Shaoyan
In-Reply-To: <1312912326.11924.12.camel@Joe-Laptop>

Le mardi 09 août 2011 à 10:52 -0700, Joe Perches a écrit :
> On Tue, 2011-08-09 at 18:53 +0200, Eric Dumazet wrote:
> > Le mercredi 10 août 2011 à 00:39 +0800, stufever@gmail.com a écrit :
> []
> > > +	if (!local_rqfpr || !local_rqfcr) {
> > > +		pr_err("Out of memory\n");
> > 	Please remove this pr_err(), kmalloc() will complain already.
> 
> Always?
> I know there's a trace option, but is it always on?
> 

Yes, unless caller added ___GFP_NOWARN in gfp :

ptr = kmalloc(size, GFP_KERNEL | ___GFP_NOWARN);

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Joe Perches @ 2011-08-09 17:52 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: stufever, linux-kernel, netdev, davem, Wang Shaoyan
In-Reply-To: <1312908784.2371.53.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Tue, 2011-08-09 at 18:53 +0200, Eric Dumazet wrote:
> Le mercredi 10 août 2011 à 00:39 +0800, stufever@gmail.com a écrit :
[]
> > +	if (!local_rqfpr || !local_rqfcr) {
> > +		pr_err("Out of memory\n");
> 	Please remove this pr_err(), kmalloc() will complain already.

Always?
I know there's a trace option, but is it always on?

^ permalink raw reply

* Re: [PATCH] Fix RCU warning in rt_cache_seq_show
From: Eric Dumazet @ 2011-08-09 17:18 UTC (permalink / raw)
  To: Mark Rutland, Paul E. McKenney; +Cc: netdev, David S. Miller, Gergely Kalman
In-Reply-To: <1312909360-2675-1-git-send-email-mark.rutland@arm.com>

Le mardi 09 août 2011 à 18:02 +0100, Mark Rutland a écrit :
> Commit f2c31e32 ("net: fix NULL dereferences in check_peer_redir()")
> added rcu protection to dst neighbour, and updated callsites for
> dst_{get,set}_neighbour. Unfortunately, it missed rt_cache_seq_show.
> 
> This produces a warning on v3.1-rc1 (on a preemptible kernel, on an
> ARM Vexpress A9x4):
> 
> ===================================================
> [ INFO: suspicious rcu_dereference_check() usage. ]
> ---------------------------------------------------
> include/net/dst.h:91 invoked rcu_dereference_check() without protection!
> 
> other info that might help us debug this:
> 
> rcu_scheduler_active = 1, debug_locks = 0
> 2 locks held by proc01/32159:
> 
> stack backtrace:
> [<80014880>] (unwind_backtrace+0x0/0xf8) from [<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4)
> [<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4) from [<800e0c5c>] (seq_read+0x324/0x4a4)
> [<800e0c5c>] (seq_read+0x324/0x4a4) from [<8010786c>] (proc_reg_read+0x70/0x94)
> [<8010786c>] (proc_reg_read+0x70/0x94) from [<800c0ba8>] (vfs_read+0xb0/0x144)
> [<800c0ba8>] (vfs_read+0xb0/0x144) from [<800c0ea8>] (sys_read+0x40/0x70)
> [<800c0ea8>] (sys_read+0x40/0x70) from [<8000e0c0>] (ret_fast_syscall+0x0/0x3c)
> 
> This patch adds calls to rcu_read_{lock,unlock} in rt_cache_seq_show,
> protecting the dereferenced variable, and clearing the warning.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Gergely Kalman <synapse@hippy.csoma.elte.hu>
> ---
>  net/ipv4/route.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index e3dec1c..6699ef7 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -419,6 +419,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
>  		struct neighbour *n;
>  		int len;
>  
> +		rcu_read_lock();
>  		n = dst_get_neighbour(&r->dst);
>  		seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
>  			      "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
> @@ -435,6 +436,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
>  			-1,
>  			(n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0,
>  			r->rt_spec_dst, &len);
> +		rcu_read_unlock();
>  
>  		seq_printf(seq, "%*s\n", 127 - len, "");
>  	}


Hmm, I though rcu_read_lock_bh() (done by caller of this function) was
protecting us here.


Paul, is it really needed, or is it a lockdep artifact ?






^ permalink raw reply

* Re: [PATCH] slip: fix NOHZ local_softirq_pending 08 warning
From: Oliver Hartkopp @ 2011-08-09 17:07 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev, Alan Cox
In-Reply-To: <CAKh5naYrNPG3UO02VzG13QUP-SOP8-Td+O0G5LAr-+npduP49A@mail.gmail.com>

Hello Ilya,

is the processing of characters in the tty input stream for line disciplines
*always* done in softirq context???

If so, i would send a patch for drivers/net/can/slcan.c too ...

Thanks,
Oliver

On 05.08.2011 21:23, Matvejchikov Ilya wrote:
> When using nanosleep() in an userspace application we get a ratelimit warning:
> 
> 	NOHZ: local_softirq_pending 08
> 
> According to 481a8199142c050b72bff8a1956a49fd0a75bbe0 the problem is caused by
> netif_rx() function. This patch replaces netif_rx() with netif_rx_ni() which
> has to be used from process/softirq context.
> 
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
> ---
>  drivers/net/slip.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/slip.c b/drivers/net/slip.c
> index f11b3f3..4c61753 100644
> --- a/drivers/net/slip.c
> +++ b/drivers/net/slip.c
> @@ -367,7 +367,7 @@ static void sl_bump(struct slip *sl)
>  	memcpy(skb_put(skb, count), sl->rbuff, count);
>  	skb_reset_mac_header(skb);
>  	skb->protocol = htons(ETH_P_IP);
> -	netif_rx(skb);
> +	netif_rx_ni(skb);
>  	dev->stats.rx_packets++;
>  }
> 


^ permalink raw reply

* [PATCH] Fix RCU warning in rt_cache_seq_show
From: Mark Rutland @ 2011-08-09 17:02 UTC (permalink / raw)
  To: netdev; +Cc: Mark Rutland, David S. Miller, Eric Dumazet, Gergely Kalman

Commit f2c31e32 ("net: fix NULL dereferences in check_peer_redir()")
added rcu protection to dst neighbour, and updated callsites for
dst_{get,set}_neighbour. Unfortunately, it missed rt_cache_seq_show.

This produces a warning on v3.1-rc1 (on a preemptible kernel, on an
ARM Vexpress A9x4):

===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
include/net/dst.h:91 invoked rcu_dereference_check() without protection!

other info that might help us debug this:

rcu_scheduler_active = 1, debug_locks = 0
2 locks held by proc01/32159:

stack backtrace:
[<80014880>] (unwind_backtrace+0x0/0xf8) from [<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4)
[<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4) from [<800e0c5c>] (seq_read+0x324/0x4a4)
[<800e0c5c>] (seq_read+0x324/0x4a4) from [<8010786c>] (proc_reg_read+0x70/0x94)
[<8010786c>] (proc_reg_read+0x70/0x94) from [<800c0ba8>] (vfs_read+0xb0/0x144)
[<800c0ba8>] (vfs_read+0xb0/0x144) from [<800c0ea8>] (sys_read+0x40/0x70)
[<800c0ea8>] (sys_read+0x40/0x70) from [<8000e0c0>] (ret_fast_syscall+0x0/0x3c)

This patch adds calls to rcu_read_{lock,unlock} in rt_cache_seq_show,
protecting the dereferenced variable, and clearing the warning.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Gergely Kalman <synapse@hippy.csoma.elte.hu>
---
 net/ipv4/route.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index e3dec1c..6699ef7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -419,6 +419,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
 		struct neighbour *n;
 		int len;
 
+		rcu_read_lock();
 		n = dst_get_neighbour(&r->dst);
 		seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
 			      "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
@@ -435,6 +436,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
 			-1,
 			(n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0,
 			r->rt_spec_dst, &len);
+		rcu_read_unlock();
 
 		seq_printf(seq, "%*s\n", 127 - len, "");
 	}
-- 
1.7.0.4



^ permalink raw reply related

* Re: [PATCH net-next] neigh: reduce arp latency
From: Julian Anastasov @ 2011-08-09 17:06 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1312904434.2371.39.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>


	Hello,

On Tue, 9 Aug 2011, Eric Dumazet wrote:

> Remove the artificial HZ latency on arp resolution.
> 
> Instead of firing a timer in one jiffy (up to 10 ms if HZ=100), lets
> send the ARP message immediately.
> 
> @@ -957,7 +964,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
>  			atomic_set(&neigh->probes, neigh->parms->ucast_probes);
>  			neigh->nud_state     = NUD_INCOMPLETE;
>  			neigh->updated = jiffies;
> -			neigh_add_timer(neigh, now + 1);
> +			neigh_add_timer(neigh, now + HZ);

	To be correct with old NUD_INCOMPLETE logic may be we can use 
max(neigh->parms->retrans_time, HZ/2) here instead of HZ?

> +			immediate_probe = true;
>  		} else {
>  			neigh->nud_state = NUD_FAILED;
>  			neigh->updated = jiffies;

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Eric Dumazet @ 2011-08-09 16:53 UTC (permalink / raw)
  To: stufever; +Cc: linux-kernel, netdev, davem, Wang Shaoyan
In-Reply-To: <1312907945-1982-1-git-send-email-wangshaoyan.pt@taobao.com>

Le mercredi 10 août 2011 à 00:39 +0800, stufever@gmail.com a écrit :
> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> 
>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
> 
> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> ---
>  drivers/net/gianfar_ethtool.c |   20 +++++++++++++++++---
>  1 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
> index 6e35069..134fe1b 100644
> --- a/drivers/net/gianfar_ethtool.c
> +++ b/drivers/net/gianfar_ethtool.c
> @@ -686,10 +686,21 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>  {
>  	unsigned int last_rule_idx = priv->cur_filer_idx;
>  	unsigned int cmp_rqfpr;
> -	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
> -	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
> +	unsigned int *local_rqfpr;
> +	unsigned int *local_rqfcr;
>  	int i = 0x0, k = 0x0;
>  	int j = MAX_FILER_IDX, l = 0x0;
> +	int ret = 1;
> +
> +	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	if (!local_rqfpr || !local_rqfcr) {
> +		pr_err("Out of memory\n");

	Please remove this pr_err(), kmalloc() will complain already.

> +		ret = 0;
> +		got err;
> +	}
>  
>  	switch (class) {
>  	case TCP_V4_FLOW:
> @@ -765,7 +776,10 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>  		priv->cur_filer_idx = priv->cur_filer_idx - 1;
>  	}
>  
> -	return 1;
> +err:
> +	kfree(local_rqfcr);
> +	kfree(local_rqfpr);
> +	return ret;
>  }
>  

You should now track all "return 0;" done in this function to make sure
no memory leak is added by your patch.

^ permalink raw reply

* [Patch] scm: Capture the full credentials of the scm sender
From: Tim Chen @ 2011-08-09 16:48 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Eric W. Biederman, David S. Miller, Al Viro, ak, linux-kernel,
	netdev
In-Reply-To: <1312857834.2531.15.camel@edumazet-laptop>

On Tue, 2011-08-09 at 04:43 +0200, Eric Dumazet wrote:

> Good catch Tim.
> 
> BTW your patch is a bit flawed : one wrapped line and "---" marker
> missing.
> 
> Could you add in Changelog bug came from commit 257b5358b32f17
> (scm: Capture the full credentials of the scm sender) to ease stable
> teams work ?
> (linux-2.6.36 was the first kernel to include this commit)
> 
> 
> 

Updated the log as requested.  Thanks.

Tim

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

This patch corrects an erroneous update of credential's gid with uid
introduced in commit 257b5358b32f17 since 2.6.36.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
diff --git a/net/core/scm.c b/net/core/scm.c
index 4c1ef02..811b53f 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -192,7 +192,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
 					goto error;
 
 				cred->uid = cred->euid = p->creds.uid;
-				cred->gid = cred->egid = p->creds.uid;
+				cred->gid = cred->egid = p->creds.gid;
 				put_cred(p->cred);
 				p->cred = cred;
 			}



^ permalink raw reply related

* [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: stufever @ 2011-08-09 16:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, davem, Wang Shaoyan

From: Wang Shaoyan <wangshaoyan.pt@taobao.com>

  drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes

Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
 drivers/net/gianfar_ethtool.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 6e35069..134fe1b 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -686,10 +686,21 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 {
 	unsigned int last_rule_idx = priv->cur_filer_idx;
 	unsigned int cmp_rqfpr;
-	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
-	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
+	unsigned int *local_rqfpr;
+	unsigned int *local_rqfcr;
 	int i = 0x0, k = 0x0;
 	int j = MAX_FILER_IDX, l = 0x0;
+	int ret = 1;
+
+	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	if (!local_rqfpr || !local_rqfcr) {
+		pr_err("Out of memory\n");
+		ret = 0;
+		got err;
+	}
 
 	switch (class) {
 	case TCP_V4_FLOW:
@@ -765,7 +776,10 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 		priv->cur_filer_idx = priv->cur_filer_idx - 1;
 	}
 
-	return 1;
+err:
+	kfree(local_rqfcr);
+	kfree(local_rqfpr);
+	return ret;
 }
 
 static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
-- 
1.7.0.4

^ permalink raw reply related

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Wang Shaoyan @ 2011-08-09 16:37 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, netdev, davem, Wang Shaoyan
In-Reply-To: <1312906118.11924.8.camel@Joe-Laptop>

I thought kfree should not call, when kmalloc is failed. Now I think
is fine, thanks, it is much clearer

> Perhaps it'd be clearer to use:
>
>        local_rqfpr = kmalloc(...)
>        local_rqfcr = kmalloc(...)
>        if (!local_rqfpr || !local_rqfcr) {
>                pr_err(...)
>                ret = -ENOMEM;
>                goto err;
>        }
>
> [...]
>
> err:
>        kfree(local_rqfpr);
>        kfree(local_rqfcr);
>        return ret;
>
> Is the "local_" prefix useful?
> It seems like visual noise to me.

They are some temporary variable, we better to left them

>
>



-- 
Wang Shaoyan

^ permalink raw reply

* Re: [PATCH net-next 0/6] be2net: fixes
From: Eric Dumazet @ 2011-08-09 16:23 UTC (permalink / raw)
  To: Sathya Perla; +Cc: netdev, David Miller
In-Reply-To: <1312904848.2371.42.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

Le mardi 09 août 2011 à 17:47 +0200, Eric Dumazet a écrit :
> Le mercredi 03 août 2011 à 11:27 +0530, Sathya Perla a écrit :
> 
> > Pls apply.
> > 
> > Sathya Perla (6):
> >   be2net: remove wrong and unnecessary calls to netif_carrier_off()
> >   be2net: no need to query link status
> >   be2net: non-member vlan pkts not received in promiscous mode
> >   be2net: use RX_FILTER cmd to program multicast addresses
> >   be2net: add support for flashing Teranetics PHY firmware
> >   be2net: drop pkts that do not belong to the port
> > 
> >  drivers/net/benet/be.h         |    8 ++-
> >  drivers/net/benet/be_cmds.c    |  140 +++++++++++++-----------------------
> >  drivers/net/benet/be_cmds.h    |   38 ++++------
> >  drivers/net/benet/be_ethtool.c |   32 ++-------
> >  drivers/net/benet/be_hw.h      |   21 ++++--
> >  drivers/net/benet/be_main.c    |  155 ++++++++++++++++++++++++----------------
> >  6 files changed, 185 insertions(+), 209 deletions(-)
> > 
> 
> Not sure which recent be2net patch is problematic on 32bit arches :
> 
> Kernel: arch/x86/boot/bzImage is ready  (#280)
>   Building modules, stage 2.
>   MODPOST 1854 modules
> ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
> make[1]: *** [__modpost] Erreur 1
> make: *** [modules] Erreur 2
> 
> Please fix this, thanks.
> 
> 

Comes from commit ac124ff973e27802797
(be2net: cleanup and refactor stats code)

be_rx_eqd_update() now performs u64 divides.

Following patch should be enough, there is no way packet count can
overwrap a long anyway between two samples...



[PATCH] benet: fix build error on 32bit arch

Error comes from commit ac124ff973e27802797
(be2net: cleanup and refactor stats code)

ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/benet/be_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 1a3acca..7c98d8e 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -936,7 +936,7 @@ static void be_rx_eqd_update(struct be_adapter *adapter, struct be_rx_obj *rxo)
 		pkts = stats->rx_pkts;
 	} while (u64_stats_fetch_retry_bh(&stats->sync, start));
 
-	stats->rx_pps = (pkts - stats->rx_pkts_prev) / (delta / HZ);
+	stats->rx_pps = (unsigned long)(pkts - stats->rx_pkts_prev) / (delta / HZ);
 	stats->rx_pkts_prev = pkts;
 	stats->rx_jiffies = now;
 	eqd = stats->rx_pps / 110000;



^ permalink raw reply related

* Re: [PATCH 1/6] Security: define security_sk_getsecid.
From: Casey Schaufler @ 2011-08-09 16:13 UTC (permalink / raw)
  To: rongqing.li; +Cc: netdev, selinux, linux-security-module, sds, Casey Schaufler
In-Reply-To: <1312874910-31010-2-git-send-email-rongqing.li@windriver.com>

On 8/9/2011 12:28 AM, rongqing.li@windriver.com wrote:
> From: Roy.Li <rongqing.li@windriver.com>
>
> Define security_sk_getsecid to get the security id of a sock.

Why are you requesting the secid when you're just going to
use it to get the secctx? Why not ask for that directly?
Is there ever a case where you only want the secid?

>
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
>  include/linux/security.h |    6 ++++++
>  security/security.c      |    6 ++++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/security.h b/include/linux/security.h
> index ebd2a53..739ac39 100644
> --- a/include/linux/security.h
> +++ b/include/linux/security.h
> @@ -2560,6 +2560,7 @@ int security_sk_alloc(struct sock *sk, int family, gfp_t priority);
>  void security_sk_free(struct sock *sk);
>  void security_sk_clone(const struct sock *sk, struct sock *newsk);
>  void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
> +void security_sk_getsecid(struct sock *sk, u32 *secid);
>  void security_req_classify_flow(const struct request_sock *req, struct flowi *fl);
>  void security_sock_graft(struct sock*sk, struct socket *parent);
>  int security_inet_conn_request(struct sock *sk,
> @@ -2701,6 +2702,11 @@ static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
>  {
>  }
>  
> +static inline void security_sk_getsecid(struct sock *sk, u32 *secid)
> +{
> +	*secid = 0;
> +}
> +
>  static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
>  {
>  }
> diff --git a/security/security.c b/security/security.c
> index 0e4fccf..b0e0825 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -1104,6 +1104,12 @@ void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
>  }
>  EXPORT_SYMBOL(security_sk_classify_flow);
>  
> +void security_sk_getsecid(struct sock *sk, u32 *secid)
> +{
> +	security_ops->sk_getsecid(sk, secid);
> +}
> +EXPORT_SYMBOL(security_sk_getsecid);
> +
>  void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
>  {
>  	security_ops->req_classify_flow(req, fl);


^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Joe Perches @ 2011-08-09 16:08 UTC (permalink / raw)
  To: stufever; +Cc: linux-kernel, netdev, davem, Sandeep.Kumar, Wang Shaoyan
In-Reply-To: <1312904711-1855-1-git-send-email-wangshaoyan.pt@taobao.com>

On Tue, 2011-08-09 at 23:45 +0800, stufever@gmail.com wrote:
> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
[]
> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
[]
> @@ -686,10 +686,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>  {
>  	unsigned int last_rule_idx = priv->cur_filer_idx;
>  	unsigned int cmp_rqfpr;
> -	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
> -	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
> +	unsigned int *local_rqfpr;
> +	unsigned int *local_rqfcr;
>  	int i = 0x0, k = 0x0;
>  	int j = MAX_FILER_IDX, l = 0x0;
> +	int ret = 1;
> +
> +	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	if (!local_rqfpr) {
> +		pr_err("Out of memory\n");
> +		ret = 0;
> +		got err;
> +	}
> +	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	if (!local_rqfcr) {
> +		pr_err("Out of memory\n");
> +		ret = 0;
> +		goto err1;
> +	}

Perhaps it'd be clearer to use:

	local_rqfpr = kmalloc(...)
	local_rqfcr = kmalloc(...)
	if (!local_rqfpr || !local_rqfcr) {
		pr_err(...)
		ret = -ENOMEM;
		goto err;
	}

[...]

err:
	kfree(local_rqfpr);
	kfree(local_rqfcr);
	return ret;

Is the "local_" prefix useful?
It seems like visual noise to me.

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Wang Shaoyan @ 2011-08-09 16:06 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, netdev, Sandeep.Kumar, wangshaoyan.pt
In-Reply-To: <20110809.085049.747100276988072226.davem@davemloft.net>

Thanks for remainding, I just want to cover up my careless asap:-)

2011/8/9 David Miller <davem@davemloft.net>:
> From: stufever@gmail.com
> Date: Tue,  9 Aug 2011 23:45:11 +0800
>
>> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>>
>>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
>>
>> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>
> Would you be so kind as to actually acknowledge in some way the person
> who found all the bugs in your first version of this patch? :-/
>
>



-- 
Wang Shaoyan

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Wang Shaoyan @ 2011-08-09 16:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: linux-kernel, netdev, davem, Wang Shaoyan
In-Reply-To: <1312904624.2371.40.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

Thanks, I'm sorry to my careless.

2011/8/9 Eric Dumazet <eric.dumazet@gmail.com>:
> Le mardi 09 août 2011 à 23:18 +0800, stufever@gmail.com a écrit :
>> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>>
>>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
>>
>> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>> ---
>>  drivers/net/gianfar_ethtool.c |   26 +++++++++++++++++++++++---
>>  1 files changed, 23 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
>> index 6e35069..039e9c3 100644
>> --- a/drivers/net/gianfar_ethtool.c
>> +++ b/drivers/net/gianfar_ethtool.c
>> @@ -686,10 +686,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>>  {
>>       unsigned int last_rule_idx = priv->cur_filer_idx;
>>       unsigned int cmp_rqfpr;
>> -     unsigned int local_rqfpr[MAX_FILER_IDX + 1];
>> -     unsigned int local_rqfcr[MAX_FILER_IDX + 1];
>> +     unsigned int *local_rqfpr;
>> +     unsigned int *local_rqfcr;
>>       int i = 0x0, k = 0x0;
>>       int j = MAX_FILER_IDX, l = 0x0;
>> +     int ret = 1;
>> +
>> +     local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
>> +             GFP_KERNEL);
>> +     if (local_rqfpr) {
>
>        if (!local_rqfpr) {
>
>> +             pr_err("Out of memory\n");
>> +             ret = 0;
>> +             got err;
>> +     }
>> +     local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
>> +             GFP_KERNEL);
>> +     if (local_rqfcr) {
>
> same here : if (!local_rqfcr) ...
>
>> +             pr_err("Out of memory\n");
>> +             ret = 0;
>> +             goto err1;
>> +     }
>>
>>       switch (class) {
>>       case TCP_V4_FLOW:
>> @@ -765,7 +781,11 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>>               priv->cur_filer_idx = priv->cur_filer_idx - 1;
>>       }
>>
>> -     return 1;
>> +     kfree(local_rqfcr);
>> +err1:
>> +     kfree(local_rqfpr);
>> +err:
>> +     return ret;
>>  }
>>
>>  static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
>
>
>



-- 
Wang Shaoyan

^ permalink raw reply

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: David Miller @ 2011-08-09 15:50 UTC (permalink / raw)
  To: stufever; +Cc: linux-kernel, netdev, Sandeep.Kumar, wangshaoyan.pt
In-Reply-To: <1312904711-1855-1-git-send-email-wangshaoyan.pt@taobao.com>

From: stufever@gmail.com
Date: Tue,  9 Aug 2011 23:45:11 +0800

> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> 
>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
> 
> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>

Would you be so kind as to actually acknowledge in some way the person
who found all the bugs in your first version of this patch? :-/

^ permalink raw reply

* Re: [PATCH net-next 0/6] be2net: fixes
From: Eric Dumazet @ 2011-08-09 15:47 UTC (permalink / raw)
  To: Sathya Perla; +Cc: netdev, David Miller
In-Reply-To: <1312351066-16745-1-git-send-email-sathya.perla@emulex.com>

Le mercredi 03 août 2011 à 11:27 +0530, Sathya Perla a écrit :

> Pls apply.
> 
> Sathya Perla (6):
>   be2net: remove wrong and unnecessary calls to netif_carrier_off()
>   be2net: no need to query link status
>   be2net: non-member vlan pkts not received in promiscous mode
>   be2net: use RX_FILTER cmd to program multicast addresses
>   be2net: add support for flashing Teranetics PHY firmware
>   be2net: drop pkts that do not belong to the port
> 
>  drivers/net/benet/be.h         |    8 ++-
>  drivers/net/benet/be_cmds.c    |  140 +++++++++++++-----------------------
>  drivers/net/benet/be_cmds.h    |   38 ++++------
>  drivers/net/benet/be_ethtool.c |   32 ++-------
>  drivers/net/benet/be_hw.h      |   21 ++++--
>  drivers/net/benet/be_main.c    |  155 ++++++++++++++++++++++++----------------
>  6 files changed, 185 insertions(+), 209 deletions(-)
> 

Not sure which recent be2net patch is problematic on 32bit arches :

Kernel: arch/x86/boot/bzImage is ready  (#280)
  Building modules, stage 2.
  MODPOST 1854 modules
ERROR: "__udivdi3" [drivers/net/benet/be2net.ko] undefined!
make[1]: *** [__modpost] Erreur 1
make: *** [modules] Erreur 2

Please fix this, thanks.




^ permalink raw reply

* [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: stufever @ 2011-08-09 15:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, davem, Sandeep.Kumar, Wang Shaoyan

From: Wang Shaoyan <wangshaoyan.pt@taobao.com>

  drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes

Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
 drivers/net/gianfar_ethtool.c |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 6e35069..9bca11c 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -686,10 +686,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 {
 	unsigned int last_rule_idx = priv->cur_filer_idx;
 	unsigned int cmp_rqfpr;
-	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
-	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
+	unsigned int *local_rqfpr;
+	unsigned int *local_rqfcr;
 	int i = 0x0, k = 0x0;
 	int j = MAX_FILER_IDX, l = 0x0;
+	int ret = 1;
+
+	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	if (!local_rqfpr) {
+		pr_err("Out of memory\n");
+		ret = 0;
+		got err;
+	}
+	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	if (!local_rqfcr) {
+		pr_err("Out of memory\n");
+		ret = 0;
+		goto err1;
+	}
 
 	switch (class) {
 	case TCP_V4_FLOW:
@@ -765,7 +781,11 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 		priv->cur_filer_idx = priv->cur_filer_idx - 1;
 	}
 
-	return 1;
+	kfree(local_rqfcr);
+err1:
+	kfree(local_rqfpr);
+err:
+	return ret;
 }
 
 static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
-- 
1.7.0.4

^ permalink raw reply related

* Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: Eric Dumazet @ 2011-08-09 15:43 UTC (permalink / raw)
  To: stufever; +Cc: linux-kernel, netdev, davem, Sandeep.Kumar, Wang Shaoyan
In-Reply-To: <1312903103-1734-1-git-send-email-wangshaoyan.pt@taobao.com>

Le mardi 09 août 2011 à 23:18 +0800, stufever@gmail.com a écrit :
> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> 
>   drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
> 
> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> ---
>  drivers/net/gianfar_ethtool.c |   26 +++++++++++++++++++++++---
>  1 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
> index 6e35069..039e9c3 100644
> --- a/drivers/net/gianfar_ethtool.c
> +++ b/drivers/net/gianfar_ethtool.c
> @@ -686,10 +686,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>  {
>  	unsigned int last_rule_idx = priv->cur_filer_idx;
>  	unsigned int cmp_rqfpr;
> -	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
> -	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
> +	unsigned int *local_rqfpr;
> +	unsigned int *local_rqfcr;
>  	int i = 0x0, k = 0x0;
>  	int j = MAX_FILER_IDX, l = 0x0;
> +	int ret = 1;
> +
> +	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	if (local_rqfpr) {

	if (!local_rqfpr) {

> +		pr_err("Out of memory\n");
> +		ret = 0;
> +		got err;
> +	}
> +	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> +		GFP_KERNEL);
> +	if (local_rqfcr) {

same here : if (!local_rqfcr) ...

> +		pr_err("Out of memory\n");
> +		ret = 0;
> +		goto err1;
> +	}
>  
>  	switch (class) {
>  	case TCP_V4_FLOW:
> @@ -765,7 +781,11 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
>  		priv->cur_filer_idx = priv->cur_filer_idx - 1;
>  	}
>  
> -	return 1;
> +	kfree(local_rqfcr);
> +err1:
> +	kfree(local_rqfpr);
> +err:
> +	return ret;
>  }
>  
>  static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)

^ permalink raw reply

* [PATCH net-next] neigh: reduce arp latency
From: Eric Dumazet @ 2011-08-09 15:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Remove the artificial HZ latency on arp resolution.

Instead of firing a timer in one jiffy (up to 10 ms if HZ=100), lets
send the ARP message immediately.

Before patch :

# arp -d 192.168.20.108 ; ping -c 3 192.168.20.108
PING 192.168.20.108 (192.168.20.108) 56(84) bytes of data.
64 bytes from 192.168.20.108: icmp_seq=1 ttl=64 time=9.91 ms
64 bytes from 192.168.20.108: icmp_seq=2 ttl=64 time=0.065 ms
64 bytes from 192.168.20.108: icmp_seq=3 ttl=64 time=0.061 ms

After patch :

$ arp -d 192.168.20.108 ; ping -c 3 192.168.20.108
PING 192.168.20.108 (192.168.20.108) 56(84) bytes of data.
64 bytes from 192.168.20.108: icmp_seq=1 ttl=64 time=0.152 ms
64 bytes from 192.168.20.108: icmp_seq=2 ttl=64 time=0.064 ms
64 bytes from 192.168.20.108: icmp_seq=3 ttl=64 time=0.074 ms

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/core/neighbour.c |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8fab9b0..d99f908 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -844,6 +844,19 @@ static void neigh_invalidate(struct neighbour *neigh)
 	skb_queue_purge(&neigh->arp_queue);
 }
 
+static void neigh_probe(struct neighbour *neigh)
+	__releases(neigh->lock)
+{
+	struct sk_buff *skb = skb_peek(&neigh->arp_queue);
+	/* keep skb alive even if arp_queue overflows */
+	if (skb)
+		skb = skb_copy(skb, GFP_ATOMIC);
+	write_unlock(&neigh->lock);
+	neigh->ops->solicit(neigh, skb);
+	atomic_inc(&neigh->probes);
+	kfree_skb(skb);
+}
+
 /* Called when a timer expires for a neighbour entry. */
 
 static void neigh_timer_handler(unsigned long arg)
@@ -920,14 +933,7 @@ static void neigh_timer_handler(unsigned long arg)
 			neigh_hold(neigh);
 	}
 	if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) {
-		struct sk_buff *skb = skb_peek(&neigh->arp_queue);
-		/* keep skb alive even if arp_queue overflows */
-		if (skb)
-			skb = skb_copy(skb, GFP_ATOMIC);
-		write_unlock(&neigh->lock);
-		neigh->ops->solicit(neigh, skb);
-		atomic_inc(&neigh->probes);
-		kfree_skb(skb);
+		neigh_probe(neigh);
 	} else {
 out:
 		write_unlock(&neigh->lock);
@@ -943,6 +949,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
 {
 	int rc;
 	unsigned long now;
+	bool immediate_probe = false;
 
 	write_lock_bh(&neigh->lock);
 
@@ -957,7 +964,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
 			atomic_set(&neigh->probes, neigh->parms->ucast_probes);
 			neigh->nud_state     = NUD_INCOMPLETE;
 			neigh->updated = jiffies;
-			neigh_add_timer(neigh, now + 1);
+			neigh_add_timer(neigh, now + HZ);
+			immediate_probe = true;
 		} else {
 			neigh->nud_state = NUD_FAILED;
 			neigh->updated = jiffies;
@@ -989,7 +997,11 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
 		rc = 1;
 	}
 out_unlock_bh:
-	write_unlock_bh(&neigh->lock);
+	if (immediate_probe)
+		neigh_probe(neigh);
+	else
+		write_unlock(&neigh->lock);
+	local_bh_enable();
 	return rc;
 }
 EXPORT_SYMBOL(__neigh_event_send);



^ permalink raw reply related

* Re: [PATCH 09/12] headers, xtables: Add missing #include <linux/netfilter.h>
From: Patrick McHardy @ 2011-08-09 15:29 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev, netfilter-devel
In-Reply-To: <1312809632.2591.1148.camel@deadeye>

On 08.08.2011 15:20, Ben Hutchings wrote:
> Various headers use union nf_inet_addr, defined in <linux/netfilter.h>.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

All netfilter related patches:

Acked-by: Patrick McHardy <kaber@trash.net>

^ permalink raw reply

* [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
From: stufever @ 2011-08-09 15:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, davem, Sandeep.Kumar, Wang Shaoyan

From: Wang Shaoyan <wangshaoyan.pt@taobao.com>

  drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes

Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
 drivers/net/gianfar_ethtool.c |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 6e35069..039e9c3 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -686,10 +686,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 {
 	unsigned int last_rule_idx = priv->cur_filer_idx;
 	unsigned int cmp_rqfpr;
-	unsigned int local_rqfpr[MAX_FILER_IDX + 1];
-	unsigned int local_rqfcr[MAX_FILER_IDX + 1];
+	unsigned int *local_rqfpr;
+	unsigned int *local_rqfcr;
 	int i = 0x0, k = 0x0;
 	int j = MAX_FILER_IDX, l = 0x0;
+	int ret = 1;
+
+	local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	if (local_rqfpr) {
+		pr_err("Out of memory\n");
+		ret = 0;
+		got err;
+	}
+	local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
+		GFP_KERNEL);
+	if (local_rqfcr) {
+		pr_err("Out of memory\n");
+		ret = 0;
+		goto err1;
+	}
 
 	switch (class) {
 	case TCP_V4_FLOW:
@@ -765,7 +781,11 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
 		priv->cur_filer_idx = priv->cur_filer_idx - 1;
 	}
 
-	return 1;
+	kfree(local_rqfcr);
+err1:
+	kfree(local_rqfpr);
+err:
+	return ret;
 }
 
 static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
-- 
1.7.0.4

^ 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