Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] net: introduce napi_schedule_irqoff()
From: Eric Dumazet @ 2014-10-29  3:30 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: David Miller, netdev
In-Reply-To: <CAADnVQJ0XD6YmUi_MBpoEgkScxp2ictQepY2YqtvfbXzF=voZQ@mail.gmail.com>

On Tue, 2014-10-28 at 18:17 -0700, Alexei Starovoitov wrote:

> Interesting! Are you trying to optimize some of such NIC drivers? ;)

??

> but all of 10G+ and virtio won't apply, right?


Which 10G+ driver could not use this ?

mlx4 patch would be :

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index c8e75dab80553c876b195361456fb49587231055..c562c1468944f9ad4319e5faaf19bf9e66d15eaf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -878,8 +878,8 @@ void mlx4_en_rx_irq(struct mlx4_cq *mcq)
 	struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq);
 	struct mlx4_en_priv *priv = netdev_priv(cq->dev);
 
-	if (priv->port_up)
-		napi_schedule(&cq->napi);
+	if (likely(priv->port_up))
+		napi_schedule_irqoff(&cq->napi);
 	else
 		mlx4_en_arm_cq(priv, cq);
 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 34c137878545fc672dad1a3d86e11c034c0ac368..5c4062921cdf46f1a7021a39705275c33ca4de77 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -479,8 +479,8 @@ void mlx4_en_tx_irq(struct mlx4_cq *mcq)
 	struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq);
 	struct mlx4_en_priv *priv = netdev_priv(cq->dev);
 
-	if (priv->port_up)
-		napi_schedule(&cq->napi);
+	if (likely(priv->port_up))
+		napi_schedule_irqoff(&cq->napi);
 	else
 		mlx4_en_arm_cq(priv, cq);
 }

^ permalink raw reply related

* [PATCH net 3/3] r8152: check WORK_ENABLE in suspend function
From: Hayes Wang @ 2014-10-29  3:12 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
In-Reply-To: <1394712342-15778-69-Taiwan-albertk@realtek.com>

Avoid unnecessary behavior when autosuspend occurs during open().
The relative processes should only be run after finishing open().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f224231..ca3c5d5 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3207,7 +3207,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
 		netif_device_detach(netdev);
 	}
 
-	if (netif_running(netdev)) {
+	if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
 		clear_bit(WORK_ENABLE, &tp->flags);
 		usb_kill_urb(tp->intr_urb);
 		tasklet_disable(&tp->tl);
-- 
1.9.3

^ permalink raw reply related

* [PATCH net 2/3] r8152: reset tp->speed before autoresuming in open function
From: Hayes Wang @ 2014-10-29  3:12 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: nic_swsd-Rasf1IRRPZFBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Hayes Wang
In-Reply-To: <1394712342-15778-69-Taiwan-albertk-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>

If (tp->speed & LINK_STATUS) is not zero, the rtl8152_resume()
would call rtl_start_rx() before enabling the tx/rx. Avoid this
by resetting it to zero.

Signed-off-by: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/usb/r8152.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index a17ca58..f224231 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2891,6 +2891,9 @@ static int rtl8152_open(struct net_device *netdev)
 	if (res)
 		goto out;
 
+	/* set speed to 0 to avoid autoresume try to submit rx */
+	tp->speed = 0;
+
 	res = usb_autopm_get_interface(tp->intf);
 	if (res < 0) {
 		free_all_mem(tp);
@@ -2904,6 +2907,8 @@ static int rtl8152_open(struct net_device *netdev)
 		clear_bit(WORK_ENABLE, &tp->flags);
 		usb_kill_urb(tp->intr_urb);
 		cancel_delayed_work_sync(&tp->schedule);
+
+		/* disable the tx/rx, if the workqueue has enabled them. */
 		if (tp->speed & LINK_STATUS)
 			tp->rtl_ops.disable(tp);
 	}
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH net 1/3] r8152: clear SELECTIVE_SUSPEND when autoresuming
From: Hayes Wang @ 2014-10-29  3:12 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
In-Reply-To: <1394712342-15778-69-Taiwan-albertk@realtek.com>

The flag of SELECTIVE_SUSPEND should be cleared when autoresuming.
Otherwise, when the system suspend and resume occur, it may have
the wrong flow.

Besides, because the flag of SELECTIVE_SUSPEND couldn't be used
to check if the hw enables the relative feature, it should alwayes
be disabled in close().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e3d84c3..a17ca58 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2955,10 +2955,7 @@ static int rtl8152_close(struct net_device *netdev)
 		 * be disable when autoresume occurs, because the
 		 * netif_running() would be false.
 		 */
-		if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
-			rtl_runtime_suspend_enable(tp, false);
-			clear_bit(SELECTIVE_SUSPEND, &tp->flags);
-		}
+		rtl_runtime_suspend_enable(tp, false);
 
 		tasklet_disable(&tp->tl);
 		tp->rtl_ops.down(tp);
@@ -3253,6 +3250,8 @@ static int rtl8152_resume(struct usb_interface *intf)
 			set_bit(WORK_ENABLE, &tp->flags);
 		}
 		usb_submit_urb(tp->intr_urb, GFP_KERNEL);
+	} else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
+		clear_bit(SELECTIVE_SUSPEND, &tp->flags);
 	}
 
 	mutex_unlock(&tp->control);
-- 
1.9.3

^ permalink raw reply related

* [PATCH net 0/3] r8152: patches for autosuspend
From: Hayes Wang @ 2014-10-29  3:12 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang

There are unexpected processes when enabling autosuspend.
These patches are used to fix them.

Hayes Wang (3):
  r8152: clear SELECTIVE_SUSPEND when autoresuming
  r8152: reset tp->speed before autoresuming in open function
  r8152: check WORK_ENABLE in suspend function

 drivers/net/usb/r8152.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
1.9.3

^ permalink raw reply

* Re: [PATCH net-next] datapath: Rename last_action() as nla_is_last() and move to netlink.h
From: Simon Horman @ 2014-10-29  2:10 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, pshelar, dev, tgraf, azhou
In-Reply-To: <20141028.170808.1107344256534933398.davem@davemloft.net>

On Tue, Oct 28, 2014 at 05:08:08PM -0400, David Miller wrote:
> From: Simon Horman <simon.horman@netronome.com>
> Date: Mon, 27 Oct 2014 16:12:16 +0900
> 
> > The original motivation for this change was to allow the helper to be used
> > in files other than actions.c as part of work on an odp select group
> > action.
> > 
> > It was as pointed out by Thomas Graf that this helper would be best off
> > living in netlink.h. Furthermore, I think that the generic nature of this
> > helper means it is best off in netlink.h regardless of if it is used more
> > than one .c file or not. Thus, I would like it considered independent of
> > the work on an odp select group action.
> > 
> > Cc: Thomas Graf <tgraf@suug.ch>
> > Cc: Pravin Shelar <pshelar@nicira.com>
> > Cc: Andy Zhou <azhou@nicira.com>
> > Signed-off-by: Simon Horman <simon.horman@netronome.com>
> 
> Applied, thanks Simon.

Thanks

^ permalink raw reply

* RE: suspend/resume broken on 3.18-rc2
From: fugang.duan @ 2014-10-29  2:04 UTC (permalink / raw)
  To: Fabio Estevam, Frank.Li@freescale.com
  Cc: Russell King, Shawn Guo, netdev@vger.kernel.org
In-Reply-To: <CAOMZO5C5znc2ZD5GoPKC7qQPoFGaJf47BoTMY0HQtEbW46d4dw@mail.gmail.com>

From: Fabio Estevam <festevam@gmail.com> Sent: Wednesday, October 29, 2014 1:19 AM
>To: Duan Fugang-B38611; Li Frank-B20596
>Cc: Russell King; Shawn Guo; netdev@vger.kernel.org
>Subject: fec: suspend/resume broken on 3.18-rc2
>
>Hi,
>
>I am running 3.18-rc2 on a mx6sx sdb board and noticed that fec
>suspend/resume is broken (works fine on 3.17 though):
>
>root@freescale /$ echo enabled > /sys/class/tty/ttymxc0/power/wakeup
>root@freescale /$ echo mem > /sys/power/state
>[   12.383292] PM: Syncing filesystems ... done.
>[   12.423555] Freezing user space processes ... (elapsed 0.003 seconds)
>done.
>[   12.434382] Freezing remaining freezable tasks ... (elapsed 0.003
>seconds) done.
>[   12.510232] PM: suspend of devices complete after 58.151 msecs
>[   12.516258] PM: suspend devices took 0.080 seconds
>[   12.530579] PM: late suspend of devices complete after 9.454 msecs
>[   12.546818] PM: noirq suspend of devices complete after 9.806 msecs
>[   12.553328] Disabling non-boot CPUs ...
>[   12.568077] PM: noirq resume of devices complete after 9.212 msecs
>[   12.582440] PM: early resume of devices complete after 6.426 msecs
>[   12.593831] fec 2188000.ethernet eth0: rcv is not +last
>[   12.599237] Unable to handle kernel NULL pointer dereference at
>virtual address 00000000
>[   12.607438] pgd = 80004000
>[   12.610187] [00000000] *pgd=00000000
>[   12.613834] Internal error: Oops: 17 [#1] SMP ARM
>[   12.618583] Modules linked in:
>[   12.621706] CPU: 0 PID: 2 Comm: kthreadd Not tainted
>3.18.0-rc2-00043-gf7e87a4-dirty #178
>[   12.629943] task: be0789c0 ti: be088000 task.ti: be088000
>[   12.635398] PC is at memcpy+0x80/0x330
>[   12.639197] LR is at gro_pull_from_frag0+0x34/0xa8
>[   12.644034] pc : [<802a6b60>]    lr : [<80539b8c>]    psr: 00000153
>[   12.644034] sp : be089b34  ip : 00000010  fp : be089b6c
>[   12.655577] r10: 00000000  r9 : 0000000e  r8 : 8094d9c0
>[   12.660842] r7 : 8094d9c0  r6 : 00000012  r5 : bd9e5040  r4 : bd89d9c0
>[   12.667412] r3 : 00000804  r2 : fffffff2  r1 : 00000000  r0 : bd9e483c
>[   12.673987] Flags: nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM
>Segment kernel
>[   12.681432] Control: 10c5387d  Table: bd99804a  DAC: 00000015
>[   12.687228] Process kthreadd (pid: 2, stack limit = 0xbe088240)
>[   12.693197] Stack: (0xbe089b34 to 0xbe08a000)
>[   12.697601] 9b20:
>bd9e5040 00000012 8094d9c0
>[   12.705850] 9b40: 8094d9c0 bd9e483c bd89d9c0 80539b8c 00000000
>bd89d9c0 be338710 00000003
>[   12.714097] 9b60: be089bc4 be089b70 8053b0f4 80539b64 00000000
>00000000 8053b1b4 811a0f80
>[   12.722344] 9b80: 000007c1 befa4c80 be338000 00000002 be089bcc
>8094d9c0 00000000 bd89d9c0
>[   12.730588] 9ba0: be338710 00000000 bf084000 bd89d9c0 be338000
>00000001 be089bdc be089bc8
>[   12.738833] 9bc0: 8053b8e0 8053b08c bf084000 00000080 be089c5c
>be089be0 80414f14 8053b8c4
>[   12.747077] 9be0: 00000000 00000000 be338710 be338600 00000040
>be338694 00000000 00000000
>[   12.755320] 9c00: 80984c74 bd0c0900 00000000 00000000 00000000
>be33a000 be33807c be338074
>[   12.763565] 9c20: 00000040 00000001 80060d50 80060c18 0000012c
>0000012c be7c41c0 80946100
>[   12.771810] 9c40: be7c41c8 00000040 00000003 be338710 be089c94
>be089c60 8053b628 80414ad8
>[   12.780053] 9c60: 80060d50 ffff8fbc 00000008 00000000 8094608c
>be088000 00000003 00000100
>[   12.788297] 9c80: 00000003 80946080 be089cdc be089c98 8002d008
>8053b568 be089cbc be089ca8
>[   12.796542] 9ca0: 00000001 00208040 ffff8fbb 0000000a be089cdc
>be088000 8094cd78 80940e6c
>[   12.804786] 9cc0: be088000 00000000 be00a400 00000001 be089cf4
>be089ce0 8002d448 8002cef4
>[   12.813032] 9ce0: 00000180 00000000 be089d24 be089cf8 80069e40
>8002d3a4 be089d50 c080e10c
>[   12.821277] 9d00: 00000086 be089d50 8094cef0 c080e100 bd02e180
>00000000 be089d4c be089d28
>[   12.829521] 9d20: 8000875c 80069dd8 be0789c0 800b3f20 80000153
>ffffffff be089d84 809aa580
>[   12.837766] 9d40: be089e54 be089d50 80012b64 80008740 00000000
>00000001 809a8940 00000000
>[   12.846009] 9d60: 002000d0 809a8940 00000000 00000000 809aa580
>bd02e180 00000000 be089e54
>[   12.854254] 9d80: 00200010 be089d98 00080008 800b3f20 80000153
>ffffffff 00000000 81157f4c
>[   12.862498] 9da0: be0789c0 8096a990 80ad76a0 0000000c be088000
>be7c3b50 be089e5c be089dc8
>[   12.870744] 9dc0: 8005e760 8005dd08 be0789c0 00000000 00000458
>802c749c 00000000 be7c3ba8
>[   12.878988] 9de0: 00000002 00000000 00000458 00000000 be089e0c
>be089e00 80ad8360 be078e18
>[   12.887232] 9e00: 0000000c 00000000 806a02e8 00000001 00002edb
>00000000 be001880 00000010
>[   12.895476] 9e20: be089e64 be089e30 800e78ac 00800711 be088000
>be0789c0 00000000 809aa580
>[   12.903722] 9e40: bd02e180 ffffffff be089e64 be089e58 800b48a8
>800b3ee8 be089ef4 be089e68
>[   12.911967] 9e60: 80027a50 800b4894 80ad76a0 0000005c be088000
>8095c8c0 be089f1c be089e88
>[   12.920210] 9e80: 8005e760 8005dd08 be089ecc be089e98 80047bdc
>806a02f8 00000000 00000000
>[   12.928453] 9ea0: 80047b98 00000000 00000000 be3fef80 800433d8
>00000000 80add860 be078e18
>[   12.936696] 9ec0: 0000005c 00000000 8069aec0 00800711 be3fef80
>00000000 00000000 00000000
>[   12.944942] 9ee0: 00000001 be088000 be089f64 be089ef8 80028f1c
>8002798c 00000000 00000000
>[   12.953186] 9f00: 00000001 00000000 00000001 be088000 be089f54
>be089f20 8006049c 8005e3b8
>[   12.961429] 9f20: 00000001 00000000 be0789c0 8095c8b0 bd1a5c40
>8095c8b0 8095c8d0 be3fef94
>[   12.969677] 9f40: be3fef80 8095c8b0 8095c8d0 00000000 00000001
>be088000 be089f7c be089f68
>[   12.977921] 9f60: 8002925c 80028e80 00000000 be3fef94 be089fac
>be089f80 80043d24 80029238
>[   12.986165] 9f80: ffffffff 00000000 80043c48 00000000 00000000
>00000000 00000000 00000000
>[   12.994411] 9fa0: 00000000 be089fb0 8000ece8 80043c54 00000000
>00000000 00000000 00000000
>[   13.002653] 9fc0: 00000000 00000000 00000000 00000000 00000000
>00000000 00000000 00000000
>[   13.010897] 9fe0: 00000000 00000000 00000000 00000000 00000013
>00000000 beff3ab1 beff3c11
>[   13.019129] Backtrace:
>[   13.021659] [<80539b58>] (gro_pull_from_frag0) from [<8053b0f4>]
>(dev_gro_receive+0x74/0x3e8)
>[   13.030245]  r6:00000003 r5:be338710 r4:bd89d9c0 r3:00000000
>[   13.036069] [<8053b080>] (dev_gro_receive) from [<8053b8e0>]
>(napi_gro_receive+0x28/0xa8)
>[   13.044303]  r10:00000001 r9:be338000 r8:bd89d9c0 r7:bf084000
>r6:00000000 r5:be338710
>[   13.052314]  r4:bd89d9c0
>[   13.054927] [<8053b8b8>] (napi_gro_receive) from [<80414f14>]
>(fec_enet_rx_napi+0x448/0xadc)
>[   13.063423]  r5:00000080 r4:bf084000
>[   13.067099] [<80414acc>] (fec_enet_rx_napi) from [<8053b628>]
>(net_rx_action+0xcc/0x1b4)
>[   13.075246]  r10:be338710 r9:00000003 r8:00000040 r7:be7c41c8
>r6:80946100 r5:be7c41c0
>[   13.083257]  r4:0000012c
>[   13.085865] [<8053b55c>] (net_rx_action) from [<8002d008>]
>(__do_softirq+0x120/0x268)
>[   13.093754]  r10:80946080 r9:00000003 r8:00000100 r7:00000003
>r6:be088000 r5:8094608c
>[   13.101766]  r4:00000000
>[   13.104368] [<8002cee8>] (__do_softirq) from [<8002d448>]
>(irq_exit+0xb0/0x104)
>[   13.111731]  r10:00000001 r9:be00a400 r8:00000000 r7:be088000
>r6:80940e6c r5:8094cd78
>[   13.119738]  r4:be088000
>[   13.122345] [<8002d398>] (irq_exit) from [<80069e40>]
>(__handle_domain_irq+0x74/0xc8)
>[   13.130233]  r4:00000000 r3:00000180
>[   13.133907] [<80069dcc>] (__handle_domain_irq) from [<8000875c>]
>(gic_handle_irq+0x28/0x68)
>[   13.142317]  r10:00000000 r9:bd02e180 r8:c080e100 r7:8094cef0
>r6:be089d50 r5:00000086
>[   13.150328]  r4:c080e10c r3:be089d50
>[   13.153997] [<80008734>] (gic_handle_irq) from [<80012b64>]
>(__irq_svc+0x44/0x5c)
>[   13.161539] Exception stack(0xbe089d50 to 0xbe089d98)
>[   13.166638] 9d40:                                     00000000
>00000001 809a8940 00000000
>[   13.174884] 9d60: 002000d0 809a8940 00000000 00000000 809aa580
>bd02e180 00000000 be089e54
>[   13.183126] 9d80: 00200010 be089d98 00080008 800b3f20 80000153 ffffffff
>[   13.189785]  r8:809aa580 r7:be089d84 r6:ffffffff r5:80000153
>r4:800b3f20 r3:be0789c0
>[   13.197725] [<800b3edc>] (__alloc_pages_nodemask) from [<800b48a8>]
>(alloc_kmem_pages_node+0x20/0x28)
>[   13.207008]  r10:ffffffff r9:bd02e180 r8:809aa580 r7:00000000
>r6:be0789c0 r5:be088000
>[   13.215018]  r4:00800711
>[   13.217635] [<800b4888>] (alloc_kmem_pages_node) from [<80027a50>]
>(copy_process.part.52+0xd0/0x1440)
>[   13.226938] [<80027980>] (copy_process.part.52) from [<80028f1c>]
>(do_fork+0xa8/0x3b8)
>[   13.234913]  r10:be088000 r9:00000001 r8:00000000 r7:00000000
>r6:00000000 r5:be3fef80
>[   13.242922]  r4:00800711
>[   13.245528] [<80028e74>] (do_fork) from [<8002925c>]
>(kernel_thread+0x30/0x38)
>[   13.252803]  r10:be088000 r9:00000001 r8:00000000 r7:8095c8d0
>r6:8095c8b0 r5:be3fef80
>[   13.260813]  r4:be3fef94
>[   13.263419] [<8002922c>] (kernel_thread) from [<80043d24>]
>(kthreadd+0xdc/0x14c)
>[   13.270889] [<80043c48>] (kthreadd) from [<8000ece8>]
>(ret_from_fork+0x14/0x2c)
>[   13.278254]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
>r6:00000000 r5:80043c48
>[   13.286263]  r4:00000000 r3:ffffffff
>[   13.289930] Code: e320f000 e4913004 e4914004 e4915004 (e4916004)
>[   13.296165] ---[ end trace bc69878b7a8d6f78 ]---
>[   13.300839] Kernel panic - not syncing: Fatal exception in interrupt
>[   13.307258] ---[ end Kernel panic - not syncing: Fatal exception in
>interrupt
>
>Haven't started debugging this yet, but just wanted to report in case this
>sounds familiar to someone.
>
>Regards,
>
>Fabio Estevam

I will double check it. Thanks for your report.

Regards,
Andy

^ permalink raw reply

* Re: [PATCH V3.18] rtlwifi: Add check for get_btc_status callback
From: Murilo Opsfelder Araujo @ 2014-10-29  1:43 UTC (permalink / raw)
  To: Larry Finger, linville
  Cc: linux-wireless, troy_tan, netdev, Mike Galbraith, Thadeu Cascardo
In-Reply-To: <1414081629-23002-1-git-send-email-Larry.Finger@lwfinger.net>

On 10/23/2014 02:27 PM, Larry Finger wrote:
> Drivers that do not use the get_btc_status() callback may not define a
> dummy routine. The caller needs to check before making the call.
>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
> Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
> Cc: Thadeu Cascardo <cascardo@cascardo.eti.br>
> ---
>
> John,
>
> This missing statement is causing kernel crashes for several of the drivers.
> This patch should be applied ASAP.
>
> Larry
> ---
>
>   drivers/net/wireless/rtlwifi/pci.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
> index 667aba8..25daa87 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -1796,7 +1796,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
>   	rtl_pci_reset_trx_ring(hw);
>
>   	rtlpci->driver_is_goingto_unload = false;
> -	if (rtlpriv->cfg->ops->get_btc_status()) {
> +	if (rtlpriv->cfg->ops->get_btc_status &&
> +	    rtlpriv->cfg->ops->get_btc_status()) {
>   		rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv);
>   		rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv);
>   	}
>
Hi, Larry & everyone.

This patch didn't solve and next-20141028 is still crashing on my laptop 
with rtl8192se device:

http://opsfelder.com/~murilo/lkml/next-20141028_crashing.jpg

-- 
Murilo

^ permalink raw reply

* Re: [PATCH net-next 2/2] udp: Reset flow table for flows over unconnected sockets
From: Tom Herbert @ 2014-10-29  1:35 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
In-Reply-To: <1414517910.631.14.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Oct 28, 2014 at 10:38 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2014-10-28 at 08:18 -0700, Tom Herbert wrote:
>
>> UDP tunnels are becoming increasingly common. VXLAN, FOU, GUE, geneve,
>> l2tp, esp/UDP, GRE/UDP, nvgre, etc. all rely on steering based on the
>> outer header without deep inspection. When the source port is set to
>> inner hash RFS works as is and steering is effectively done based
>> inner TCP connections. If aRFS supports UDP, then this should just
>> work also for UDP tunnels (another instance where we don't need
>> protocol specific support in devices for tunneling).
>
>
> If you really wanted to solve this, you would need to change RFS to be
> aware of the tunnel and find L4 information, instead of current
> implementation stopping at first UDP layer.
>
> But as get_rps_cpu() / __skb_flow_dissect() have no way to find this,
> you instead chose to invalidate RFS and maybe rely on RPS, because it
> might help your workload.
>
> Just to be clear : I tested the patch and saw a regression in my tests,
> sending as little as one million UDP packets per second on the target.
>
Can you describe this test so that I can try to reproduce and maybe
debug the issue you're seeing with the patch?

Thanks,
Tom

> Not only UDP rx processing was slower, but TCP flows were impacted.
>
> With a table of 65536 slots, each slot was written 16 times per second
> in average.
>
> Google kernels have RFS_Hit/FRS_Miss snmp counters to catch this kind of
> problems. Maybe I should upstream this part.
>
>
>

^ permalink raw reply

* Re: [PATCH net-next] net: introduce napi_schedule_irqoff()
From: Alexei Starovoitov @ 2014-10-29  1:17 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1414544713.631.30.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Oct 28, 2014 at 6:05 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> napi_schedule() can be called from any context and has to mask hard
> irqs.
>
> Add a variant that can only be called from hard interrupts handlers
> or when irqs are already masked.
>
> Many NIC drivers can use it from their hard IRQ handler instead of
> generic variant.

Interesting! Are you trying to optimize some of such NIC drivers? ;)
but all of 10G+ and virtio won't apply, right?

^ permalink raw reply

* [PATCH net-next] net: introduce napi_schedule_irqoff()
From: Eric Dumazet @ 2014-10-29  1:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

napi_schedule() can be called from any context and has to mask hard
irqs.

Add a variant that can only be called from hard interrupts handlers
or when irqs are already masked.

Many NIC drivers can use it from their hard IRQ handler instead of
generic variant.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/netdevice.h |   13 +++++++++++++
 net/core/dev.c            |   15 ++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 74fd5d37f15a472239c1c63cebe7ce9e59fc4c90..c85e065122460e9f077bcb6788018be38e1d7ddf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -386,6 +386,7 @@ typedef enum rx_handler_result rx_handler_result_t;
 typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
 
 void __napi_schedule(struct napi_struct *n);
+void __napi_schedule_irqoff(struct napi_struct *n);
 
 static inline bool napi_disable_pending(struct napi_struct *n)
 {
@@ -420,6 +421,18 @@ static inline void napi_schedule(struct napi_struct *n)
 		__napi_schedule(n);
 }
 
+/**
+ *	napi_schedule_irqoff - schedule NAPI poll
+ *	@n: napi context
+ *
+ * Variant of napi_schedule(), assuming hard irqs are masked.
+ */
+static inline void napi_schedule_irqoff(struct napi_struct *n)
+{
+	if (napi_schedule_prep(n))
+		__napi_schedule_irqoff(n);
+}
+
 /* Try to reschedule poll. Called by dev->poll() after napi_complete().  */
 static inline bool napi_reschedule(struct napi_struct *napi)
 {
diff --git a/net/core/dev.c b/net/core/dev.c
index b793e3521a3631319bf4d0e7c17c0c9a933331da..759940cdf89635d58778502276d9914e47f837f9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4372,7 +4372,8 @@ static int process_backlog(struct napi_struct *napi, int quota)
  * __napi_schedule - schedule for receive
  * @n: entry to schedule
  *
- * The entry's receive function will be scheduled to run
+ * The entry's receive function will be scheduled to run.
+ * Consider using __napi_schedule_irqoff() if hard irqs are masked.
  */
 void __napi_schedule(struct napi_struct *n)
 {
@@ -4384,6 +4385,18 @@ void __napi_schedule(struct napi_struct *n)
 }
 EXPORT_SYMBOL(__napi_schedule);
 
+/**
+ * __napi_schedule_irqoff - schedule for receive
+ * @n: entry to schedule
+ *
+ * Variant of __napi_schedule() assuming hard irqs are masked
+ */
+void __napi_schedule_irqoff(struct napi_struct *n)
+{
+	____napi_schedule(this_cpu_ptr(&softnet_data), n);
+}
+EXPORT_SYMBOL(__napi_schedule_irqoff);
+
 void __napi_complete(struct napi_struct *n)
 {
 	BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));

^ permalink raw reply related

* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2014-10-29  0:14 UTC (permalink / raw)
  To: David Miller, netdev
  Cc: linux-next, linux-kernel, Vince Bridgers, Viet Nga Dao

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

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
drivers/net/phy/marvell.c between commit 99d881f993f0 ("net: phy: Add
SGMII Configuration for Marvell 88E1145 Initialization") from the net
tree and commit b02241755d0e ("net: phy: Adding SGMII support for
Marvell 88ee1145 driver") from the net-next tree.

I fixed it up (they are basically the same patch :-( so I just fixed up
the differences and basically used the net tree version) and can carry
the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* [PATCH net-next 1/3] bpf: reduce verifier memory consumption
From: Alexei Starovoitov @ 2014-10-28 22:11 UTC (permalink / raw)
  To: David S. Miller
  Cc: Hannes Frederic Sowa, Eric Dumazet, Daniel Borkmann,
	Andy Lutomirski, netdev, linux-kernel
In-Reply-To: <1414534303-9906-1-git-send-email-ast@plumgrid.com>

verifier keeps track of register state spilled to stack.
registers are 8-byte wide and always aligned, so instead of tracking them
in every byte-sized stack slot, use MAX_BPF_STACK / 8 array to track
spilled register state.
Though verifier runs in user context and its state freed immediately
after verification, it makes sense to reduce its memory usage.
This optimization reduces sizeof(struct verifier_state)
from 12464 to 1712 on 64-bit and from 6232 to 1112 on 32-bit.

Note, this patch doesn't change existing limits, which are there to bound
time and memory during verification: 4k total number of insns in a program,
1k number of jumps (states to visit) and 32k number of processed insn
(since an insn may be visited multiple times). Theoretical worst case memory
during verification is 1712 * 1k = 17Mbyte. Out-of-memory situation triggers
cleanup and rejects the program.

Suggested-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
 kernel/bpf/verifier.c |  101 ++++++++++++++++++++++++++++---------------------
 1 file changed, 57 insertions(+), 44 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9f81818f2941..b6a1f7c14a67 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -153,22 +153,19 @@ struct reg_state {
 
 enum bpf_stack_slot_type {
 	STACK_INVALID,    /* nothing was stored in this stack slot */
-	STACK_SPILL,      /* 1st byte of register spilled into stack */
-	STACK_SPILL_PART, /* other 7 bytes of register spill */
+	STACK_SPILL,      /* register spilled into stack */
 	STACK_MISC	  /* BPF program wrote some data into this slot */
 };
 
-struct bpf_stack_slot {
-	enum bpf_stack_slot_type stype;
-	struct reg_state reg_st;
-};
+#define BPF_REG_SIZE 8	/* size of eBPF register in bytes */
 
 /* state of the program:
  * type of all registers and stack info
  */
 struct verifier_state {
 	struct reg_state regs[MAX_BPF_REG];
-	struct bpf_stack_slot stack[MAX_BPF_STACK];
+	u8 stack_slot_type[MAX_BPF_STACK];
+	struct reg_state spilled_regs[MAX_BPF_STACK / BPF_REG_SIZE];
 };
 
 /* linked list of verifier states used to prune search */
@@ -259,10 +256,10 @@ static void print_verifier_state(struct verifier_env *env)
 				env->cur_state.regs[i].map_ptr->key_size,
 				env->cur_state.regs[i].map_ptr->value_size);
 	}
-	for (i = 0; i < MAX_BPF_STACK; i++) {
-		if (env->cur_state.stack[i].stype == STACK_SPILL)
+	for (i = 0; i < MAX_BPF_STACK; i += BPF_REG_SIZE) {
+		if (env->cur_state.stack_slot_type[i] == STACK_SPILL)
 			verbose(" fp%d=%s", -MAX_BPF_STACK + i,
-				reg_type_str[env->cur_state.stack[i].reg_st.type]);
+				reg_type_str[env->cur_state.spilled_regs[i / BPF_REG_SIZE].type]);
 	}
 	verbose("\n");
 }
@@ -539,8 +536,10 @@ static int bpf_size_to_bytes(int bpf_size)
 static int check_stack_write(struct verifier_state *state, int off, int size,
 			     int value_regno)
 {
-	struct bpf_stack_slot *slot;
 	int i;
+	/* caller checked that off % size == 0 and -MAX_BPF_STACK <= off < 0,
+	 * so it's aligned access and [off, off + size) are within stack limits
+	 */
 
 	if (value_regno >= 0 &&
 	    (state->regs[value_regno].type == PTR_TO_MAP_VALUE ||
@@ -548,30 +547,24 @@ static int check_stack_write(struct verifier_state *state, int off, int size,
 	     state->regs[value_regno].type == PTR_TO_CTX)) {
 
 		/* register containing pointer is being spilled into stack */
-		if (size != 8) {
+		if (size != BPF_REG_SIZE) {
 			verbose("invalid size of register spill\n");
 			return -EACCES;
 		}
 
-		slot = &state->stack[MAX_BPF_STACK + off];
-		slot->stype = STACK_SPILL;
 		/* save register state */
-		slot->reg_st = state->regs[value_regno];
-		for (i = 1; i < 8; i++) {
-			slot = &state->stack[MAX_BPF_STACK + off + i];
-			slot->stype = STACK_SPILL_PART;
-			slot->reg_st.type = UNKNOWN_VALUE;
-			slot->reg_st.map_ptr = NULL;
-		}
-	} else {
+		state->spilled_regs[(MAX_BPF_STACK + off) / BPF_REG_SIZE] =
+			state->regs[value_regno];
 
+		for (i = 0; i < BPF_REG_SIZE; i++)
+			state->stack_slot_type[MAX_BPF_STACK + off + i] = STACK_SPILL;
+	} else {
 		/* regular write of data into stack */
-		for (i = 0; i < size; i++) {
-			slot = &state->stack[MAX_BPF_STACK + off + i];
-			slot->stype = STACK_MISC;
-			slot->reg_st.type = UNKNOWN_VALUE;
-			slot->reg_st.map_ptr = NULL;
-		}
+		state->spilled_regs[(MAX_BPF_STACK + off) / BPF_REG_SIZE] =
+			(struct reg_state) {};
+
+		for (i = 0; i < size; i++)
+			state->stack_slot_type[MAX_BPF_STACK + off + i] = STACK_MISC;
 	}
 	return 0;
 }
@@ -579,19 +572,18 @@ static int check_stack_write(struct verifier_state *state, int off, int size,
 static int check_stack_read(struct verifier_state *state, int off, int size,
 			    int value_regno)
 {
+	u8 *slot_type;
 	int i;
-	struct bpf_stack_slot *slot;
 
-	slot = &state->stack[MAX_BPF_STACK + off];
+	slot_type = &state->stack_slot_type[MAX_BPF_STACK + off];
 
-	if (slot->stype == STACK_SPILL) {
-		if (size != 8) {
+	if (slot_type[0] == STACK_SPILL) {
+		if (size != BPF_REG_SIZE) {
 			verbose("invalid size of register spill\n");
 			return -EACCES;
 		}
-		for (i = 1; i < 8; i++) {
-			if (state->stack[MAX_BPF_STACK + off + i].stype !=
-			    STACK_SPILL_PART) {
+		for (i = 1; i < BPF_REG_SIZE; i++) {
+			if (slot_type[i] != STACK_SPILL) {
 				verbose("corrupted spill memory\n");
 				return -EACCES;
 			}
@@ -599,12 +591,12 @@ static int check_stack_read(struct verifier_state *state, int off, int size,
 
 		if (value_regno >= 0)
 			/* restore register state from stack */
-			state->regs[value_regno] = slot->reg_st;
+			state->regs[value_regno] =
+				state->spilled_regs[(MAX_BPF_STACK + off) / BPF_REG_SIZE];
 		return 0;
 	} else {
 		for (i = 0; i < size; i++) {
-			if (state->stack[MAX_BPF_STACK + off + i].stype !=
-			    STACK_MISC) {
+			if (slot_type[i] != STACK_MISC) {
 				verbose("invalid read from stack off %d+%d size %d\n",
 					off, i, size);
 				return -EACCES;
@@ -747,7 +739,7 @@ static int check_stack_boundary(struct verifier_env *env,
 	}
 
 	for (i = 0; i < access_size; i++) {
-		if (state->stack[MAX_BPF_STACK + off + i].stype != STACK_MISC) {
+		if (state->stack_slot_type[MAX_BPF_STACK + off + i] != STACK_MISC) {
 			verbose("invalid indirect read from stack off %d+%d size %d\n",
 				off, i, access_size);
 			return -EACCES;
@@ -1417,12 +1409,33 @@ static bool states_equal(struct verifier_state *old, struct verifier_state *cur)
 	}
 
 	for (i = 0; i < MAX_BPF_STACK; i++) {
-		if (memcmp(&old->stack[i], &cur->stack[i],
-			   sizeof(old->stack[0])) != 0) {
-			if (old->stack[i].stype == STACK_INVALID)
-				continue;
+		if (old->stack_slot_type[i] == STACK_INVALID)
+			continue;
+		if (old->stack_slot_type[i] != cur->stack_slot_type[i])
+			/* Ex: old explored (safe) state has STACK_SPILL in
+			 * this stack slot, but current has has STACK_MISC ->
+			 * this verifier states are not equivalent,
+			 * return false to continue verification of this path
+			 */
 			return false;
-		}
+		if (i % BPF_REG_SIZE)
+			continue;
+		if (memcmp(&old->spilled_regs[i / BPF_REG_SIZE],
+			   &cur->spilled_regs[i / BPF_REG_SIZE],
+			   sizeof(old->spilled_regs[0])))
+			/* when explored and current stack slot types are
+			 * the same, check that stored pointers types
+			 * are the same as well.
+			 * Ex: explored safe path could have stored
+			 * (struct reg_state) {.type = PTR_TO_STACK, .imm = -8}
+			 * but current path has stored:
+			 * (struct reg_state) {.type = PTR_TO_STACK, .imm = -16}
+			 * such verifier states are not equivalent.
+			 * return false to continue verification of this path
+			 */
+			return false;
+		else
+			continue;
 	}
 	return true;
 }
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 3/3] test: bpf: add a testcase reduced from nmap
From: Alexei Starovoitov @ 2014-10-28 22:11 UTC (permalink / raw)
  To: David S. Miller
  Cc: Hannes Frederic Sowa, Eric Dumazet, Daniel Borkmann,
	Andy Lutomirski, netdev, linux-kernel
In-Reply-To: <1414534303-9906-1-git-send-email-ast@plumgrid.com>

nmap generates classic BPF programs to filter ARP packets with given target MAC
which triggered a bug in eBPF x64 JIT. The bug was fixed in
commit e0ee9c12157d ("x86: bpf_jit: fix two bugs in eBPF JIT compiler")
This patch is adding a testcase in eBPF instructions (those that
were generated by classic->eBPF converter) to be processed by JIT.
The test is primarily targeting JIT compiler.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
 lib/test_bpf.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 23e070bcf72d..3f167d2eeb94 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -1756,6 +1756,49 @@ static struct bpf_test tests[] = {
 		{ },
 		{ { 0, 1 } }
 	},
+	{
+		"nmap reduced",
+		.u.insns_int = {
+			BPF_MOV64_REG(R6, R1),
+			BPF_LD_ABS(BPF_H, 12),
+			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 28),
+			BPF_LD_ABS(BPF_H, 12),
+			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 26),
+			BPF_MOV32_IMM(R0, 18),
+			BPF_STX_MEM(BPF_W, R10, R0, -64),
+			BPF_LDX_MEM(BPF_W, R7, R10, -64),
+			BPF_LD_IND(BPF_W, R7, 14),
+			BPF_STX_MEM(BPF_W, R10, R0, -60),
+			BPF_MOV32_IMM(R0, 280971478),
+			BPF_STX_MEM(BPF_W, R10, R0, -56),
+			BPF_LDX_MEM(BPF_W, R7, R10, -56),
+			BPF_LDX_MEM(BPF_W, R0, R10, -60),
+			BPF_ALU32_REG(BPF_SUB, R0, R7),
+			BPF_JMP_IMM(BPF_JNE, R0, 0, 15),
+			BPF_LD_ABS(BPF_H, 12),
+			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 13),
+			BPF_MOV32_IMM(R0, 22),
+			BPF_STX_MEM(BPF_W, R10, R0, -56),
+			BPF_LDX_MEM(BPF_W, R7, R10, -56),
+			BPF_LD_IND(BPF_H, R7, 14),
+			BPF_STX_MEM(BPF_W, R10, R0, -52),
+			BPF_MOV32_IMM(R0, 17366),
+			BPF_STX_MEM(BPF_W, R10, R0, -48),
+			BPF_LDX_MEM(BPF_W, R7, R10, -48),
+			BPF_LDX_MEM(BPF_W, R0, R10, -52),
+			BPF_ALU32_REG(BPF_SUB, R0, R7),
+			BPF_JMP_IMM(BPF_JNE, R0, 0, 2),
+			BPF_MOV32_IMM(R0, 256),
+			BPF_EXIT_INSN(),
+			BPF_MOV32_IMM(R0, 0),
+			BPF_EXIT_INSN(),
+		},
+		INTERNAL,
+		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x06, 0, 0,
+		  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+		  0x10, 0xbf, 0x48, 0xd6, 0x43, 0xd6},
+		{ { 38, 256 } }
+	},
 };
 
 static struct net_device dev;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 2/3] samples: bpf: add a verifier test and summary line
From: Alexei Starovoitov @ 2014-10-28 22:11 UTC (permalink / raw)
  To: David S. Miller
  Cc: Hannes Frederic Sowa, Eric Dumazet, Daniel Borkmann,
	Andy Lutomirski, netdev, linux-kernel
In-Reply-To: <1414534303-9906-1-git-send-email-ast@plumgrid.com>

- add a test specifically targeting verifier state pruning.
It checks state propagation between registers, storing that
state into stack and state pruning algorithm recognizing
equivalent stack and register states.

- add summary line to spot failures easier

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
 samples/bpf/test_verifier.c |   46 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c
index eb4bec0ad8af..63402742345e 100644
--- a/samples/bpf/test_verifier.c
+++ b/samples/bpf/test_verifier.c
@@ -602,6 +602,45 @@ static struct bpf_test tests[] = {
 		},
 		.result = ACCEPT,
 	},
+	{
+		"jump test 5",
+		.insns = {
+			BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
+			BPF_MOV64_REG(BPF_REG_3, BPF_REG_2),
+			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 0),
+			BPF_MOV64_IMM(BPF_REG_0, 0),
+			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 0),
+			BPF_MOV64_IMM(BPF_REG_0, 0),
+			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 0),
+			BPF_MOV64_IMM(BPF_REG_0, 0),
+			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 0),
+			BPF_MOV64_IMM(BPF_REG_0, 0),
+			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 2),
+			BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8),
+			BPF_JMP_IMM(BPF_JA, 0, 0, 0),
+			BPF_MOV64_IMM(BPF_REG_0, 0),
+			BPF_EXIT_INSN(),
+		},
+		.result = ACCEPT,
+	},
 };
 
 static int probe_filter_length(struct bpf_insn *fp)
@@ -630,7 +669,7 @@ static int create_map(void)
 
 static int test(void)
 {
-	int prog_fd, i;
+	int prog_fd, i, pass_cnt = 0, err_cnt = 0;
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		struct bpf_insn *prog = tests[i].insns;
@@ -657,21 +696,25 @@ static int test(void)
 				printf("FAIL\nfailed to load prog '%s'\n",
 				       strerror(errno));
 				printf("%s", bpf_log_buf);
+				err_cnt++;
 				goto fail;
 			}
 		} else {
 			if (prog_fd >= 0) {
 				printf("FAIL\nunexpected success to load\n");
 				printf("%s", bpf_log_buf);
+				err_cnt++;
 				goto fail;
 			}
 			if (strstr(bpf_log_buf, tests[i].errstr) == 0) {
 				printf("FAIL\nunexpected error message: %s",
 				       bpf_log_buf);
+				err_cnt++;
 				goto fail;
 			}
 		}
 
+		pass_cnt++;
 		printf("OK\n");
 fail:
 		if (map_fd >= 0)
@@ -679,6 +722,7 @@ fail:
 		close(prog_fd);
 
 	}
+	printf("Summary: %d PASSED, %d FAILED\n", pass_cnt, err_cnt);
 
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 0/3] reduce verifier memory consumption and add tests
From: Alexei Starovoitov @ 2014-10-28 22:11 UTC (permalink / raw)
  To: David S. Miller
  Cc: Hannes Frederic Sowa, Eric Dumazet, Daniel Borkmann,
	Andy Lutomirski, netdev, linux-kernel

Small set of cleanups:
 - reduce verifier memory consumption
 - add verifier test to check register state propagation and state equivalence
 - add JIT test reduced from recent nmap triggered crash

Alexei Starovoitov (3):
  bpf: reduce verifier memory consumption
  samples: bpf: add a verifier test and summary line
  test: bpf: add a testcase reduced from nmap

 kernel/bpf/verifier.c       |  101 ++++++++++++++++++++++++-------------------
 lib/test_bpf.c              |   43 ++++++++++++++++++
 samples/bpf/test_verifier.c |   46 +++++++++++++++++++-
 3 files changed, 145 insertions(+), 45 deletions(-)

-- 
1.7.9.5

^ permalink raw reply

* Re: [PATCH] ovs: Turn vports with dependencies into separate modules
From: Thomas Graf @ 2014-10-28 21:47 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: David Miller, dev@openvswitch.org, netdev@vger.kernel.org
In-Reply-To: <CAADnVQK2HRn=XyqF==tuDPFgA5gamVCZmxg5ELVjBX2i0dYwfA@mail.gmail.com>

On 10/28/14 at 02:42pm, Alexei Starovoitov wrote:
> On Tue, Oct 28, 2014 at 2:27 PM, David Miller <davem@davemloft.net> wrote:
> >>
> >> it fails the build when lockdep is on:
> >> ERROR: "lockdep_ovsl_is_held" [net/openvswitch/vport-gre.ko] undefined!
> >
> > I've fixed it thusly:
> 
> thanks! that was quick. the fix looks good.

Thanks and sorry for causing this fallout

^ permalink raw reply

* Re: [PATCH] ovs: Turn vports with dependencies into separate modules
From: Alexei Starovoitov @ 2014-10-28 21:42 UTC (permalink / raw)
  To: David Miller; +Cc: Thomas Graf, dev@openvswitch.org, netdev@vger.kernel.org
In-Reply-To: <20141028.172743.459865270069950735.davem@davemloft.net>

On Tue, Oct 28, 2014 at 2:27 PM, David Miller <davem@davemloft.net> wrote:
>>
>> it fails the build when lockdep is on:
>> ERROR: "lockdep_ovsl_is_held" [net/openvswitch/vport-gre.ko] undefined!
>
> I've fixed it thusly:

thanks! that was quick. the fix looks good.

^ permalink raw reply

* Re: [PATCH net 0/3] cdc-ether: handle promiscuous mode
From: David Miller @ 2014-10-28 21:30 UTC (permalink / raw)
  To: oneukum; +Cc: olivier.blin, netdev, hayeswang, bjorn
In-Reply-To: <1414530625.29018.1.camel@linux-0dmf.site>

From: Oliver Neukum <oneukum@suse.de>
Date: Tue, 28 Oct 2014 22:10:25 +0100

> On Tue, 2014-10-28 at 15:49 -0400, David Miller wrote:
>> From: Olivier Blin <olivier.blin@softathome.com>
>> Date: Fri, 24 Oct 2014 19:42:59 +0200
>> 
>> > Since kernel 3.16, my Lenovo USB network adapters (RTL8153) using
>> > cdc-ether are not working anymore in a bridge.
>> > 
>> > This is due to commit c472ab68ad67db23c9907a27649b7dc0899b61f9, which
>> > resets the packet filter when the device is bound.
>> > 
>> > The default packet filter set by cdc-ether does not include
>> > promiscuous, while the adapter seemed to have promiscuous enabled by
>> > default.
>> > 
>> > This patch series allows to support promiscuous mode for cdc-ether, by
>> > hooking into set_rx_mode.
>> > 
>> > Incidentally, maybe this device should be handled by the r8152 driver,
>> > but this patch series is still nice for other adapters.
>> 
>> Can a usbnet expert please review this series?
> 
> Acked-by: Oliver Neukum <oneukum@suse.de>

Series applied, thanks!

^ permalink raw reply

* Re: [PATCH] ovs: Turn vports with dependencies into separate modules
From: David Miller @ 2014-10-28 21:27 UTC (permalink / raw)
  To: alexei.starovoitov; +Cc: tgraf, dev, netdev
In-Reply-To: <CAADnVQ+Z6-7sdWAEvHkKR==Nds6hqBfbfPmtUDiZXOTE9DRnGw@mail.gmail.com>

From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Tue, 28 Oct 2014 13:57:13 -0700

> On Tue, Oct 28, 2014 at 11:43 AM, David Miller <davem@davemloft.net> wrote:
>> From: Thomas Graf <tgraf@suug.ch>
>> Date: Wed, 22 Oct 2014 17:29:06 +0200
>>
>>> The internal and netdev vport remain part of openvswitch.ko. Encap
>>> vports including vxlan, gre, and geneve can be built as separate
>>> modules and are loaded on demand. Modules can be unloaded after use.
>>> Datapath ports keep a reference to the vport module during their
>>> lifetime.
>>>
>>> Allows to remove the error prone maintenance of the global list
>>> vport_ops_list.
>>>
>>> Signed-off-by: Thomas Graf <tgraf@suug.ch>
>>
>> Applied, thanks a lot Thomas.
> 
> Thomas,
> 
> it fails the build when lockdep is on:
> ERROR: "lockdep_ovsl_is_held" [net/openvswitch/vport-gre.ko] undefined!

I've fixed it thusly:

====================
[PATCH] openvswitch: Export lockdep_ovsl_is_held to modules.

ERROR: "lockdep_ovsl_is_held" [net/openvswitch/vport-gre.ko] undefined!

Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/openvswitch/datapath.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index aecddb9..f18302f 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -131,6 +131,7 @@ int lockdep_ovsl_is_held(void)
 	else
 		return 1;
 }
+EXPORT_SYMBOL(lockdep_ovsl_is_held);
 #endif
 
 static struct vport *new_vport(const struct vport_parms *);
-- 
1.7.11.7

^ permalink raw reply related

* Re: [PATCH net-next 00/13] Mellanox ethernet driver update Oct-27-2014
From: David Miller @ 2014-10-28 21:22 UTC (permalink / raw)
  To: amirv; +Cc: netdev, yevgenyp, ogerlitz
In-Reply-To: <1414402667-8841-1-git-send-email-amirv@mellanox.com>

From: Amir Vadai <amirv@mellanox.com>
Date: Mon, 27 Oct 2014 11:37:34 +0200

> This patchset introduces some small bug fixes, support in get/set of
> vlan offload and get/set/capabilities of the link.
> 
> First 7 patches by Saeed, add support in setting/getting link speed and getting
> cable capabilities.
> Next 2 patches also by Saeed, enable the user to turn rx/tx vlan offloading on
> and off.
> Jenni fixed a bug in error flow during device initalization.
> Ido and Jack fixed some code duplication and errors discovered by static checker.
> last patch by me is a fix to make ethtool report the actual rings used by
> indirection QP.
> 
> Patches were applied and tested against commit 61ed53d ("Merge tag 'ntb-3.18'
> of git://github.com/jonmason/ntb")

Series applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH net 0/3] cdc-ether: handle promiscuous mode
From: Oliver Neukum @ 2014-10-28 21:10 UTC (permalink / raw)
  To: David Miller; +Cc: olivier.blin, netdev, hayeswang, bjorn
In-Reply-To: <20141028.154926.273240718595756465.davem@davemloft.net>

On Tue, 2014-10-28 at 15:49 -0400, David Miller wrote:
> From: Olivier Blin <olivier.blin@softathome.com>
> Date: Fri, 24 Oct 2014 19:42:59 +0200
> 
> > Since kernel 3.16, my Lenovo USB network adapters (RTL8153) using
> > cdc-ether are not working anymore in a bridge.
> > 
> > This is due to commit c472ab68ad67db23c9907a27649b7dc0899b61f9, which
> > resets the packet filter when the device is bound.
> > 
> > The default packet filter set by cdc-ether does not include
> > promiscuous, while the adapter seemed to have promiscuous enabled by
> > default.
> > 
> > This patch series allows to support promiscuous mode for cdc-ether, by
> > hooking into set_rx_mode.
> > 
> > Incidentally, maybe this device should be handled by the r8152 driver,
> > but this patch series is still nice for other adapters.
> 
> Can a usbnet expert please review this series?

Acked-by: Oliver Neukum <oneukum@suse.de>

	Regards
		Oliver

^ permalink raw reply

* [PATCH] carl9170: Convert byte_rev_table uses to bitrev8
From: Joe Perches @ 2014-10-28 21:18 UTC (permalink / raw)
  To: Christian Lamparter
  Cc: John W. Linville, Wang, Yalin, Russell King, linux-mm,
	Will Deacon, Akinobu Mita, linux-arm-kernel, linux-wireless,
	netdev, LKML
In-Reply-To: <1414392371.8884.2.camel@perches.com>

Use the inline function instead of directly indexing the array.

This allows some architectures with hardware instructions
for bit reversals to eliminate the array.

Signed-off-by: Joe Perches <joe@perches.com>
---
On Sun, 2014-10-26 at 23:46 -0700, Joe Perches wrote:
> On Mon, 2014-10-27 at 14:37 +0800, Wang, Yalin wrote:
> > this change add CONFIG_HAVE_ARCH_BITREVERSE config option,
> > so that we can use arm/arm64 rbit instruction to do bitrev operation
> > by hardware.
[]
> > diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h
> > index 7ffe03f..ef5b2bb 100644
> > --- a/include/linux/bitrev.h
> > +++ b/include/linux/bitrev.h
> > @@ -3,6 +3,14 @@
> >  
> >  #include <linux/types.h>
> >  
> > +#ifdef CONFIG_HAVE_ARCH_BITREVERSE
> > +#include <asm/bitrev.h>
> > +
> > +#define bitrev32 __arch_bitrev32
> > +#define bitrev16 __arch_bitrev16
> > +#define bitrev8 __arch_bitrev8
> > +
> > +#else
> >  extern u8 const byte_rev_table[256];

 drivers/net/wireless/ath/carl9170/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
index b80b213..dca6df1 100644
--- a/drivers/net/wireless/ath/carl9170/phy.c
+++ b/drivers/net/wireless/ath/carl9170/phy.c
@@ -994,7 +994,7 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, bool band5ghz,
 			refsel0 = 0;
 			refsel1 = 1;
 		}
-		chansel = byte_rev_table[chansel];
+		chansel = bitrev8(chansel);
 	} else {
 		if (freq == 2484) {
 			chansel = 10 + (freq - 2274) / 5;
@@ -1002,7 +1002,7 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, bool band5ghz,
 		} else
 			chansel = 16 + (freq - 2272) / 5;
 		chansel *= 4;
-		chansel = byte_rev_table[chansel];
+		chansel = bitrev8(chansel);
 	}
 
 	d1 =	chansel;


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related

* Re: [PATCH net 0/2] net: systemport: RX path and suspend fixes
From: David Miller @ 2014-10-28 21:11 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev
In-Reply-To: <1414519921-3246-1-git-send-email-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 28 Oct 2014 11:11:59 -0700

> These two patches fix a race condition where we have our RX interrupts
> enabled, but not NAPI for the RX path, and the second patch fixes an
> issue for packets stuck in RX fifo during a suspend/resume cycle.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH] fixup! net: pxa168_eth: Provide phy_interface mode on platform_data
From: Sebastian Hesselbarth @ 2014-10-28 21:11 UTC (permalink / raw)
  To: David Miller
  Cc: antoine.tenart, f.fainelli, eric.y.miao, haojian.zhuang,
	linux-arm-kernel, netdev, linux-kernel
In-Reply-To: <20141028.164939.509353257563688482.davem@davemloft.net>

On 28.10.2014 21:49, David Miller wrote:
> From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Date: Sat, 25 Oct 2014 12:08:59 +0200
>
>> Do not add phy include to the board file but platform_data include
>> instead.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> ---
>> David,
>>
>> I should have compile tested this patch earlier. I did now on
>> pxa168_defconfig right after I received an 0-day kbuild error
>> on this patch.
>>
>> This is the corresponding fix, can you please squash it in?
>>
>> Thanks and sorry for the noise,
>
> Patch applied to net-next, but:
>
> 1) There is never any way for me to "squash" a patch into an old
>     one.  Once I apply a patch it is a permanent commit in my tree
>     and cannot be undone and/or modified.
>
>     Therefore the only thing you can do is send me a relative fix
>     and that's what shows up in my tree as yet another later commit.

Ok, good to know and sorry for the crippled fixup patch. I was assuming
that net-next is also rebased until pulled/moved to some stable state.

> 2) Always be specific about the target tree in you subject,
>     line.  Never assume I can figure it out by context.

Also, sorry for the little information given.

Thanks,

Sebastian

^ permalink raw reply


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