Netdev List
 help / color / mirror / Atom feed
* iwlagn failed resume from S3
From: Udo Steinberg @ 2011-11-28 14:14 UTC (permalink / raw)
  To: Guy, Wey-Yi, Linux Kernel Mailing List
  Cc: Linux Network Mailing List, linux-wireless

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

Hi,

After coming out of Suspend-to-RAM with Linux-3.1.0, the Centrino Advanced-N
6205 WiFi failed to resume with the following warnings in dmesg. So far this
has happened just once and it's not easily reproducible.

Cheers,

	- Udo

iwlagn 0000:03:00.0: restoring config space at offset 0xf (was 0x100, writing 0x1ff)
iwlagn 0000:03:00.0: restoring config space at offset 0x4 (was 0x4, writing 0xf2500004)
iwlagn 0000:03:00.0: restoring config space at offset 0x3 (was 0x0, writing 0x10)
iwlagn 0000:03:00.0: L1 Disabled; Enabling L0S
iwlagn 0000:03:00.0: Radio type=0x1-0x2-0x0
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 2 (should be 9), sequence 0x2FA readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Not tainted 3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001c15c>] ? iwl_rx_dispatch+0x147/0x20f [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc1 ]---
iwl data: 00000000: 00 00 35 02 00 00 fa 02 00 00 34 02 00 00 fa 02  ..5.......4.....
iwl data: 00000010: 00 00 35 02 00 00 34 02 00 00 35 02 00 00 f7 02  ..5...4...5.....
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 209 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 215 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 221 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 214 is out of range [0-256] 0 0.
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 20 (should be 9), sequence 0x1447 readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Tainted: G        W   3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001c15c>] ? iwl_rx_dispatch+0x147/0x20f [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc2 ]---
iwl data: 00000000: cc 0e ba 13 e6 5d 47 14 14 13 7c 6c 42 dc f5 1a  .....]G...|lB...
iwl data: 00000010: 5a f8 f3 ba 2f b8 6d 20 10 0e 10 b2 c0 38 e7 0b  Z.../.m .....8..
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 0 (should be 9), sequence 0xE1 readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Tainted: G        W   3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001e577>] ? iwl_rx_scan_complete_notif+0x163/0x1d3 [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc3 ]---
iwl data: 00000000: 35 18 04 00 84 c5 e1 00 f1 00 e0 00 58 00 4e 00  5...........X.N.
iwl data: 00000010: 35 08 04 00 85 c5 e1 00 2a b0 e1 00 15 00 13 00  5.......*.......
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 208 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 232 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 213 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 210 is out of range [0-256] 0 0.
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 0 (should be 9), sequence 0x61 readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Tainted: G        W   3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001c15c>] ? iwl_rx_dispatch+0x147/0x20f [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc4 ]---
iwl data: 00000000: 35 18 04 00 47 10 61 00 45 10 61 00 0c 00 0c 00  5...G.a.E.a.....
iwl data: 00000010: 37 00 04 00 48 10 61 00 45 10 61 00 00 00 00 00  7...H.a.E.a.....
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 219 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 220 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 212 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 230 is out of range [0-256] 0 0.
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 0 (should be 9), sequence 0x0 readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Tainted: G        W   3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001c15c>] ? iwl_rx_dispatch+0x147/0x20f [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc5 ]---
iwl data: 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 fe 01 00 00  ................
iwl data: 00000010: b8 c0 0c 04 00 ea ff ff c8 d7 09 07 00 ea ff ff  ................
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 216 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 224 is out of range [0-256] 0 0.
iwlagn 0000:03:00.0: iwl_hcmd_queue_reclaim: Read index for DMA queue txq id (9), index 223 is out of range [0-256] 0 0.
------------[ cut here ]------------
WARNING: at drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c:765 iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]()
Hardware name: 4290W4H
wrong command queue 18 (should be 9), sequence 0x5259 readp=0 writep=0
Modules linked in: iwlagn
Pid: 0, comm: swapper Tainted: G        W   3.1.0 #1
Call Trace:
 <IRQ>  [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffffa0027199>] ? iwl_tx_cmd_complete+0xa4/0x335 [iwlagn]
 [<ffffffffa001c15c>] ? iwl_rx_dispatch+0x147/0x20f [iwlagn]
 [<ffffffffa00251d0>] ? iwl_irq_tasklet+0x7c9/0xb52 [iwlagn]
 [<ffffffffa0025fc3>] ? iwl_isr_ict+0x563/0x628 [iwlagn]
 [<ffffffff8103b439>] ? tasklet_action+0x67/0xa7
 [<ffffffff8103b95b>] ? __do_softirq+0x7f/0x106
 [<ffffffff813c10ec>] ? call_softirq+0x1c/0x26
 [<ffffffff8100351e>] ? do_softirq+0x31/0x67
 [<ffffffff8103bc0f>] ? irq_exit+0x44/0xb0
 [<ffffffff8100325f>] ? do_IRQ+0x94/0xad
 [<ffffffff813bf62b>] ? common_interrupt+0x6b/0x6b
 <EOI>  [<ffffffff8104fe71>] ? __hrtimer_start_range_ns+0x2c6/0x2d9
 [<ffffffff81190656>] ? intel_idle+0xcd/0xe9
 [<ffffffff81190632>] ? intel_idle+0xa9/0xe9
 [<ffffffff812cb231>] ? cpuidle_idle_call+0xa0/0xdb
 [<ffffffff810007b9>] ? cpu_idle+0x53/0x7c
 [<ffffffff816869fa>] ? start_kernel+0x2be/0x2c9
---[ end trace 0107c607401edcc6 ]---
iwl data: 00000000: d0 26 c9 95 25 33 59 52 20 38 a2 2c 91 27 48 90  .&..%3YR 8.,.'H.
iwl data: 00000010: fb 08 36 49 c5 1a a6 ee 13 48 03 62 44 30 77 60  ..6I.....H.bD0w`
iwlagn 0000:03:00.0: Failed to start RT ucode: -110
iwlagn 0000:03:00.0: Unable to initialize device.
------------[ cut here ]------------
WARNING: at net/mac80211/util.c:1182 ieee80211_reconfig+0x110/0x407()
Hardware name: 4290W4H
Hardware became unavailable upon resume. This could be a software issue prior to suspend or a hardware issue.
Modules linked in: iwlagn
Pid: 4801, comm: acpi_handler.sh Tainted: G        W   3.1.0 #1
Call Trace:
 [<ffffffff81036e2d>] ? warn_slowpath_common+0x78/0x8c
 [<ffffffff81379cbf>] ? wiphy_suspend+0x5f/0x5f
 [<ffffffff81036ee2>] ? warn_slowpath_fmt+0x45/0x4a
 [<ffffffff813a7c7e>] ? ieee80211_reconfig+0x110/0x407
 [<ffffffff81379cbf>] ? wiphy_suspend+0x5f/0x5f
 [<ffffffff81379d2b>] ? wiphy_resume+0x6c/0x7c
 [<ffffffff8123d6ed>] ? legacy_resume+0x1e/0x4e
 [<ffffffff8123db3a>] ? device_resume+0xb7/0x100
 [<ffffffff8123e16f>] ? dpm_resume+0xd7/0x182
 [<ffffffff8123e36c>] ? dpm_resume_end+0x8/0x10
 [<ffffffff81062179>] ? suspend_devices_and_enter+0x1b3/0x1ec
 [<ffffffff8106228a>] ? enter_state+0xd8/0x12b
 [<ffffffff810619aa>] ? state_store+0xaa/0xca
 [<ffffffff810f08e1>] ? sysfs_write_file+0xd3/0x10f
 [<ffffffff810ac20b>] ? vfs_write+0xaf/0x129
 [<ffffffff810ac45e>] ? sys_write+0x45/0x6e
 [<ffffffff813bfc7b>] ? system_call_fastpath+0x16/0x1b
---[ end trace 0107c607401edcc7 ]---
legacy_resume(): wiphy_resume+0x0/0x7c returns -110
PM: Device phy0 failed to resume: error -110
PM: resume of devices complete after 2777.958 msecs
PM: Finishing wakeup.
Restarting tasks ... done.
video LNXVIDEO:00: Restoring backlight state

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: [PATCH net-next v2 1/4] can: cc770: add driver core for the Bosch CC770 and Intel AN82527
From: Marc Kleine-Budde @ 2011-11-28 14:18 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	socketcan-users-0fE9KPoRgkgATYTw5x5z8w,
	linux-can-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4ED3966E.7080609-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1114 bytes --]

On 11/28/2011 03:10 PM, Wolfgang Grandegger wrote:

>>>   enum {
>>> 	CC770_OBJ_RX0 = 0,	/* for receiving normal messages */
>>> 	CC770_OBJ_RX1,		/* for receiving normal messages */
>>> 	CC770_OBJ_RX_RTR0,	/* for receiving remote transmission requests */
>>> 	CC770_OBJ_RX_RTR1,	/* for receiving remote transmission requests */
>>> 	CC770_OBJ_TX,		/* for sending messages */
>>> 	CC770_OBJ_MAX  <================
>>
>> ...then add a "," here :P
> 
> Why?

Okay - here the following argument will be not valid :), because OBJ_MAX
will and has always to be the last element in the enum.

But if you don't have a _MAX argument and a new element will be added to
the enum, you'll have to change two lines: 1. add the missing "," 2. add
the new element. Diff will look better if the last element always has a ",".

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


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

[-- Attachment #2: Type: text/plain, Size: 191 bytes --]

_______________________________________________
Socketcan-users mailing list
Socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-users

^ permalink raw reply

* Re: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
From: Wolfgang Grandegger @ 2011-11-28 14:22 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can@vger.kernel.org, socketcan@hartkopp.net,
	lucas.demarchi@profusion.mobi, davem@davemloft.net,
	mkl@pengutronix.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <C3745E3C7FD07D429C54EB3D7606A5A7677E7C@ZRHEX021.ads.zuehlke.com>

On 11/28/2011 02:25 PM, Mosler, Martin wrote:
> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.

Please break lines after 72 chars, or so.

> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
> 
> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>     case 0:
>         netif_stop_queue(dev);
>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
> +       out_8(&regs->cantier, priv->tx_active);
>         return NETDEV_TX_BUSY;
>     case 1:
>         /*  

I cannot apply this patch. It is white space mangled (no tabs but
spaces, etc.). Please fix your mail agent or, even better, use "git
send-email".

Wolfgang.

^ permalink raw reply

* Proposed removal of DECnet support (was: Re: [BUG] 3.2-rc2: BUG kmalloc-8: Redzone overwritten)
From: Steven Whitehouse @ 2011-11-28 14:22 UTC (permalink / raw)
  To: Christine Caulfield
  Cc: David Miller, eric.dumazet, levinsasha928, mpm, cl, penberg,
	linux-mm, linux-kernel, netdev
In-Reply-To: <4ED35B3E.7040105@redhat.com>

Hi,

On Mon, 2011-11-28 at 09:58 +0000, Christine Caulfield wrote:
> On 26/11/11 20:50, David Miller wrote:
> > From: Steven Whitehouse<swhiteho@redhat.com>
> > Date: Mon, 21 Nov 2011 10:58:30 +0000
> >
> >> I have to say that I've been wondering lately whether it has got to the
> >> point where it is no longer useful. Has anybody actually tested it
> >> lately against "real" DEC implementations?
> >
> > I doubt it :-)
> >
> 
> DECnet is in use against real DEC implementations - I have checked it 
> quite recently against a VAX running OpenVMS. How many people are 
> actually using it for real work is a different question though.
> 
Ok, thats useful info.

> It's also true that it's not really supported by anyone as I orphaned it 
> some time ago and nobody else seems to care enough to take it over. So 
> if it's becoming a burden on people doing real kernel work then I don't 
> think many tears will be wept for its removal.
> 
> Chrissie

Really the only issue with keeping it around is the maintenance burden I
think. It doesn't look like anybody wants to take it on, but maybe we
should give it another few days for someone to speak up, just in case
they are on holiday or something at the moment.

Also, I've updated the subject of the thread, to make it more obvious
what is being discussed, as well as bcc'ing it again to the DECnet list,

Steve.


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: AW: AW: [PATCH] net/can/mscan: Enable interrupts when all TX buffers are occupied to get notified when they are available again
From: Wolfgang Grandegger @ 2011-11-28 14:31 UTC (permalink / raw)
  To: Mosler, Martin
  Cc: linux-can@vger.kernel.org, socketcan@hartkopp.net,
	lucas.demarchi@profusion.mobi, davem@davemloft.net,
	mkl@pengutronix.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <C3745E3C7FD07D429C54EB3D7606A5A7677EDE@ZRHEX021.ads.zuehlke.com>

On 11/28/2011 03:13 PM, Mosler, Martin wrote:
>>>>> When all TX buffers of the mscan are occupied the network layer is told to stop sending further packets. However the TX interrupts are not enabled and therefore the driver has no chance to tell the network layer when it is ready to accept further packets.
>>>>>
>>>>> Signed-off-by: Martin Mosler <mmo@zuehlke.com>
>>>>>
>>>>> --- linux-2.6/drivers/net/can/mscan/mscan.c.orig    2011-11-28 13:54:29.547850661 +0100
>>>>> +++ linux-2.6/drivers/net/can/mscan/mscan.c 2011-11-28 13:55:52.427849601 +0100
>>>>> @@ -214,6 +214,7 @@ static netdev_tx_t mscan_start_xmit(stru
>>>>>     case 0:
>>>>>         netif_stop_queue(dev);
>>>>>         dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
>>>>> +       out_8(&regs->cantier, priv->tx_active);
>>>>>         return NETDEV_TX_BUSY;
>>>>>     case 1:
>>>>>         /*
>>>>
>>>> Hm, did you see the error message. Actually, it should never happen, IIRC.
>>>>
>>>> Wolfgang.
>>>
>>> It is in fact a very rare condition, but it was triggered during testing when pulling CAN-HI and CAN-LO lines
>>> to GND and VCC in various combinations to verify how the system is recovering. I am working with a MPC5125
>>> if this is valuable information. (This was only one issue I ran into, I had to do other modifications for other
>>> issues as well, but I think they are chip specific, I'll share them in a separate thread if you like).
>>
>> Sounds like a problem with bus-off recovery. The software has restarted
>> the queue but the TX objects are still active. How do you handle
>> bus-offs? Manually? restart-ms = ?
>>
>> Would be great if you post patches for your other issues.
>>
>> Wolfgang.
> 
> We are using restart-ms = 500 for now.

OK. How the hardware recovers on bus-off on the MPC51xx and especially
on the MPC51xx is still a mystery to me. I think the real problem is
that the software does not wait until the hardware has fully recovered
from bus-off by going to error active. Do you have a kernel log (dmesg
output) with CONFIG_CAN_DEBUG_DEVICES=y and CONFIG_PRINTK_TIME=y?

> I'll post the other patches after I know I did the submit process correctly for this one and when I reviewed 
> them more closely, as it is my first submission to the kernel.

I just commented on that.

Thanks.

Wolfgang.

^ permalink raw reply

* [PATCH 0/6] NFS: create clients and IDMAP pipes per network namespace
From: Stanislav Kinsbursky @ 2011-11-28 14:33 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel

This patch set was created in context of clone of git
branch: git://git.linux-nfs.org/projects/trondmy/nfs-2.6.git.
tag: v3.1

This patch set depends on previous patch sets titled:
1) "SUNRPC: initial part of making pipefs work in net ns"
2) "SUNPRC: cleanup PipeFS for network-namespace-aware users"
3) "SUNRPC: make RPC clients use network-namespace-aware PipeFS routines"

Actually, this patch set consists of two tightly connected parts:
1) NFS clients creation per network namespace
2) IDMAP pipe dentries creation in owner client network namesapce context

This patch set is the third part of making "PipeFS per network namespace".

The following series consists of:

---

Stanislav Kinsbursky (6):
      SUNRPC: fix pipe->ops cleanup on pipe dentry unlink
      NFS: make NFS client allocated per network namespace context
      NFS: pass NFS client owner network namespace to RPC client creation routine
      NFS: create callback transports in parent transport network namespace
      NFS: handle NFS idmap pipe PipeFS dentries by network namespace aware routines
      NFS: idmap PipeFS notifier introduced


 fs/nfs/callback.c                  |   10 +--
 fs/nfs/client.c                    |   22 ++++--
 fs/nfs/idmap.c                     |  136 ++++++++++++++++++++++++++++++++++--
 fs/nfs/internal.h                  |    6 ++
 fs/nfs/mount_clnt.c                |    4 +
 fs/nfs/super.c                     |    4 +
 include/linux/nfs_fs_sb.h          |    1 
 include/linux/nfs_idmap.h          |   13 +--
 include/linux/sunrpc/rpc_pipe_fs.h |    7 ++
 net/sunrpc/clnt.c                  |    1 
 net/sunrpc/rpc_pipe.c              |   67 ++++++++++--------
 11 files changed, 208 insertions(+), 63 deletions(-)

-- 
Signature

^ permalink raw reply

* [PATCH 1/6] SUNRPC: fix pipe->ops cleanup on pipe dentry unlink
From: Stanislav Kinsbursky @ 2011-11-28 14:33 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch looks late due to GSS AUTH patches sent already. But it fixes a flaw
in RPC PipeFS pipes handling.
I've added this patch in the series, because this series related to pipes. But
it should be a part of previous series named "SUNPRC: cleanup PipeFS for
network-namespace-aware users".

Pipe dentry can be created and destroyed many times during pipe life cycle.
This actually means, that we can't set pipe->ops to NULL in rpc_close_pipes()
and use this variable as a flag, indicating, that pipe's dentry is unlinking.
To follow this restriction, this patch replaces "pipe->ops = NULL" assignment
and checks for NULL with "pipe->dentry = NULL" assignment and checks for
NULL respectively.
This patch also removes check for non-NULL pipe->ops (or pipe->dentry) in
rpc_close_pipes() because it always non-NULL now.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 net/sunrpc/rpc_pipe.c |   51 +++++++++++++++++++------------------------------
 1 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 1ea0dcf..b80d7bd 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -86,10 +86,6 @@ rpc_timeout_upcall_queue(struct work_struct *work)
 	void (*destroy_msg)(struct rpc_pipe_msg *);
 
 	spin_lock(&pipe->lock);
-	if (pipe->ops == NULL) {
-		spin_unlock(&pipe->lock);
-		return;
-	}
 	destroy_msg = pipe->ops->destroy_msg;
 	if (pipe->nreaders == 0) {
 		list_splice_init(&pipe->pipe, &free_list);
@@ -115,8 +111,6 @@ rpc_queue_upcall(struct rpc_pipe *pipe, struct rpc_pipe_msg *msg)
 	int res = -EPIPE;
 
 	spin_lock(&pipe->lock);
-	if (pipe->ops == NULL)
-		goto out;
 	if (pipe->nreaders) {
 		list_add_tail(&msg->list, &pipe->pipe);
 		pipe->pipelen += msg->len;
@@ -130,7 +124,6 @@ rpc_queue_upcall(struct rpc_pipe *pipe, struct rpc_pipe_msg *msg)
 		pipe->pipelen += msg->len;
 		res = 0;
 	}
-out:
 	spin_unlock(&pipe->lock);
 	wake_up(&pipe->waitq);
 	return res;
@@ -147,27 +140,23 @@ static void
 rpc_close_pipes(struct inode *inode)
 {
 	struct rpc_pipe *pipe = RPC_I(inode)->pipe;
-	const struct rpc_pipe_ops *ops;
 	int need_release;
+	LIST_HEAD(free_list);
 
 	mutex_lock(&inode->i_mutex);
-	ops = pipe->ops;
-	if (ops != NULL) {
-		LIST_HEAD(free_list);
-		spin_lock(&pipe->lock);
-		need_release = pipe->nreaders != 0 || pipe->nwriters != 0;
-		pipe->nreaders = 0;
-		list_splice_init(&pipe->in_upcall, &free_list);
-		list_splice_init(&pipe->pipe, &free_list);
-		pipe->pipelen = 0;
-		pipe->ops = NULL;
-		spin_unlock(&pipe->lock);
-		rpc_purge_list(pipe, &free_list, ops->destroy_msg, -EPIPE);
-		pipe->nwriters = 0;
-		if (need_release && ops->release_pipe)
-			ops->release_pipe(inode);
-		cancel_delayed_work_sync(&pipe->queue_timeout);
-	}
+	spin_lock(&pipe->lock);
+	need_release = pipe->nreaders != 0 || pipe->nwriters != 0;
+	pipe->nreaders = 0;
+	list_splice_init(&pipe->in_upcall, &free_list);
+	list_splice_init(&pipe->pipe, &free_list);
+	pipe->pipelen = 0;
+	pipe->dentry = NULL;
+	spin_unlock(&pipe->lock);
+	rpc_purge_list(pipe, &free_list, pipe->ops->destroy_msg, -EPIPE);
+	pipe->nwriters = 0;
+	if (need_release && pipe->ops->release_pipe)
+		pipe->ops->release_pipe(inode);
+	cancel_delayed_work_sync(&pipe->queue_timeout);
 	rpc_inode_setowner(inode, NULL);
 	mutex_unlock(&inode->i_mutex);
 }
@@ -204,7 +193,7 @@ rpc_pipe_open(struct inode *inode, struct file *filp)
 	int res = -ENXIO;
 
 	mutex_lock(&inode->i_mutex);
-	if (pipe->ops == NULL)
+	if (pipe->dentry == NULL)
 		goto out;
 	first_open = pipe->nreaders == 0 && pipe->nwriters == 0;
 	if (first_open && pipe->ops->open_pipe) {
@@ -230,7 +219,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp)
 	int last_close;
 
 	mutex_lock(&inode->i_mutex);
-	if (pipe->ops == NULL)
+	if (pipe->dentry == NULL)
 		goto out;
 	msg = filp->private_data;
 	if (msg != NULL) {
@@ -271,7 +260,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)
 	int res = 0;
 
 	mutex_lock(&inode->i_mutex);
-	if (pipe->ops == NULL) {
+	if (pipe->dentry == NULL) {
 		res = -EPIPE;
 		goto out_unlock;
 	}
@@ -314,7 +303,7 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *of
 
 	mutex_lock(&inode->i_mutex);
 	res = -EPIPE;
-	if (pipe->ops != NULL)
+	if (pipe->dentry != NULL)
 		res = pipe->ops->downcall(filp, buf, len);
 	mutex_unlock(&inode->i_mutex);
 	return res;
@@ -329,7 +318,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
 	poll_wait(filp, &pipe->waitq, wait);
 
 	mask = POLLOUT | POLLWRNORM;
-	if (pipe->ops == NULL)
+	if (pipe->dentry == NULL)
 		mask |= POLLERR | POLLHUP;
 	if (filp->private_data || !list_empty(&pipe->pipe))
 		mask |= POLLIN | POLLRDNORM;
@@ -346,7 +335,7 @@ rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	switch (cmd) {
 	case FIONREAD:
 		spin_lock(&pipe->lock);
-		if (pipe->ops == NULL) {
+		if (pipe->dentry == NULL) {
 			spin_unlock(&pipe->lock);
 			return -EPIPE;
 		}

^ permalink raw reply related

* [PATCH 2/6] NFS: make NFS client allocated per network namespace context
From: Stanislav Kinsbursky @ 2011-11-28 14:33 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch adds new net variable to nfs_client structure. This variable is set
on NFS client creation and cheched during matching NFS client search.
Initially current->nsproxy->net_ns is used as network namespace owner for new
NFS client to create. This network namespace pointer is set during mount
options parsing and thus can be passed from user-spave utils in future if will
be necessary.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/client.c           |   16 +++++++++++++---
 fs/nfs/internal.h         |    1 +
 fs/nfs/super.c            |    3 +++
 include/linux/nfs_fs_sb.h |    1 +
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 5833fbb..47a8cd6 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -135,6 +135,7 @@ struct nfs_client_initdata {
 	const struct nfs_rpc_ops *rpc_ops;
 	int proto;
 	u32 minorversion;
+	struct net *net;
 };
 
 /*
@@ -189,6 +190,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
 	if (!IS_ERR(cred))
 		clp->cl_machine_cred = cred;
 	nfs_fscache_get_client_cookie(clp);
+	clp->net = cl_init->net;
 
 	return clp;
 
@@ -475,6 +477,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 		/* Match the full socket address */
 		if (!nfs_sockaddr_cmp(sap, clap))
 			continue;
+		/* Match network namespace */
+		if (clp->net != data->net)
+			continue;
 
 		atomic_inc(&clp->cl_count);
 		return clp;
@@ -825,6 +830,7 @@ static int nfs_init_server(struct nfs_server *server,
 		.addrlen = data->nfs_server.addrlen,
 		.rpc_ops = &nfs_v2_clientops,
 		.proto = data->nfs_server.protocol,
+		.net = data->net,
 	};
 	struct rpc_timeout timeparms;
 	struct nfs_client *clp;
@@ -1386,7 +1392,7 @@ static int nfs4_set_client(struct nfs_server *server,
 		const char *ip_addr,
 		rpc_authflavor_t authflavour,
 		int proto, const struct rpc_timeout *timeparms,
-		u32 minorversion)
+		u32 minorversion, struct net *net)
 {
 	struct nfs_client_initdata cl_init = {
 		.hostname = hostname,
@@ -1395,6 +1401,7 @@ static int nfs4_set_client(struct nfs_server *server,
 		.rpc_ops = &nfs_v4_clientops,
 		.proto = proto,
 		.minorversion = minorversion,
+		.net = net,
 	};
 	struct nfs_client *clp;
 	int error;
@@ -1446,6 +1453,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		.rpc_ops = &nfs_v4_clientops,
 		.proto = ds_proto,
 		.minorversion = mds_clp->cl_minorversion,
+		.net = mds_clp->net,
 	};
 	struct rpc_timeout ds_timeout = {
 		.to_initval = 15 * HZ,
@@ -1572,7 +1580,8 @@ static int nfs4_init_server(struct nfs_server *server,
 			data->auth_flavors[0],
 			data->nfs_server.protocol,
 			&timeparms,
-			data->minorversion);
+			data->minorversion,
+			data->net);
 	if (error < 0)
 		goto error;
 
@@ -1669,7 +1678,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
 				data->authflavor,
 				parent_server->client->cl_xprt->prot,
 				parent_server->client->cl_timeout,
-				parent_client->cl_mvops->minor_version);
+				parent_client->cl_mvops->minor_version,
+				parent_client->net);
 	if (error < 0)
 		goto error;
 
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index ab12913..4565e76 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -123,6 +123,7 @@ struct nfs_parsed_mount_data {
 	} nfs_server;
 
 	struct security_mnt_opts lsm_opts;
+	struct net		*net;
 };
 
 /* mount_clnt.c */
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 5b19b6a..782260d 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -53,6 +53,7 @@
 #include <linux/nfs_xdr.h>
 #include <linux/magic.h>
 #include <linux/parser.h>
+#include <linux/nsproxy.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -1089,6 +1090,8 @@ static int nfs_parse_mount_options(char *raw,
 
 	free_secdata(secdata);
 
+	mnt->net = current->nsproxy->net_ns;
+
 	while ((p = strsep(&raw, ",")) != NULL) {
 		substring_t args[MAX_OPT_ARGS];
 		unsigned long option;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b5479df..71fd605 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -85,6 +85,7 @@ struct nfs_client {
 #endif
 
 	struct server_scope	*server_scope;	/* from exchange_id */
+	struct net		*net;
 };
 
 /*

^ permalink raw reply related

* [PATCH 3/6] NFS: pass NFS client owner network namespace to RPC client creation routine
From: Stanislav Kinsbursky @ 2011-11-28 14:33 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch replaces static "init_net" with nfs_client->net pointer in RPC
client creation calls.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/client.c     |    2 +-
 fs/nfs/internal.h   |    1 +
 fs/nfs/mount_clnt.c |    4 ++--
 fs/nfs/super.c      |    1 +
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 47a8cd6..58eebb5 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -641,7 +641,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp,
 {
 	struct rpc_clnt		*clnt = NULL;
 	struct rpc_create_args args = {
-		.net		= &init_net,
+		.net		= clp->net,
 		.protocol	= clp->cl_proto,
 		.address	= (struct sockaddr *)&clp->cl_addr,
 		.addrsize	= clp->cl_addrlen,
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 4565e76..451acb5 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -138,6 +138,7 @@ struct nfs_mount_request {
 	int			noresvport;
 	unsigned int		*auth_flav_len;
 	rpc_authflavor_t	*auth_flavs;
+	struct net		*net;
 };
 
 extern int nfs_mount(struct nfs_mount_request *info);
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index d4c2d6b..4fbe3a8 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -153,7 +153,7 @@ int nfs_mount(struct nfs_mount_request *info)
 		.rpc_resp	= &result,
 	};
 	struct rpc_create_args args = {
-		.net		= &init_net,
+		.net		= info->net,
 		.protocol	= info->protocol,
 		.address	= info->sap,
 		.addrsize	= info->salen,
@@ -225,7 +225,7 @@ void nfs_umount(const struct nfs_mount_request *info)
 		.to_retries = 2,
 	};
 	struct rpc_create_args args = {
-		.net		= &init_net,
+		.net		= info->net,
 		.protocol	= IPPROTO_UDP,
 		.address	= info->sap,
 		.addrsize	= info->salen,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 782260d..b52819e 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1607,6 +1607,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
 		.noresvport	= args->flags & NFS_MOUNT_NORESVPORT,
 		.auth_flav_len	= &server_authlist_len,
 		.auth_flavs	= server_authlist,
+		.net		= args->net,
 	};
 	int status;
 

^ permalink raw reply related

* [PATCH 4/6] NFS: create callback transports in parent transport network namespace
From: Stanislav Kinsbursky @ 2011-11-28 14:33 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch replaces static "init_net" references with parent transport xprt_net
reference. Thus callback transports will be created in the same network
namespace as respective NFS mount point was created.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/callback.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index e3d2942..1d04f9d 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -102,11 +102,11 @@ nfs4_callback_svc(void *vrqstp)
  * Prepare to bring up the NFSv4 callback service
  */
 struct svc_rqst *
-nfs4_callback_up(struct svc_serv *serv)
+nfs4_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt)
 {
 	int ret;
 
-	ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET,
+	ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET,
 				nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
 	if (ret <= 0)
 		goto out_err;
@@ -114,7 +114,7 @@ nfs4_callback_up(struct svc_serv *serv)
 	dprintk("NFS: Callback listener port = %u (af %u)\n",
 			nfs_callback_tcpport, PF_INET);
 
-	ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET6,
+	ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET6,
 				nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
 	if (ret > 0) {
 		nfs_callback_tcpport6 = ret;
@@ -183,7 +183,7 @@ nfs41_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt)
 	 * fore channel connection.
 	 * Returns the input port (0) and sets the svc_serv bc_xprt on success
 	 */
-	ret = svc_create_xprt(serv, "tcp-bc", &init_net, PF_INET, 0,
+	ret = svc_create_xprt(serv, "tcp-bc", xprt->xprt_net, PF_INET, 0,
 			      SVC_SOCK_ANONYMOUS);
 	if (ret < 0) {
 		rqstp = ERR_PTR(ret);
@@ -269,7 +269,7 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
 					serv, xprt, &rqstp, &callback_svc);
 	if (!minorversion_setup) {
 		/* v4.0 callback setup */
-		rqstp = nfs4_callback_up(serv);
+		rqstp = nfs4_callback_up(serv, xprt);
 		callback_svc = nfs4_callback_svc;
 	}
 

^ permalink raw reply related

* [PATCH 5/6] NFS: handle NFS idmap pipe PipeFS dentries by network namespace aware routines
From: Stanislav Kinsbursky @ 2011-11-28 14:34 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch makes NFS idmap pipes dentries allocated and destroyed in network
namespace context by PipeFS network namespace aware routines.
Network namespace context is obtained from nfs_client structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/idmap.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 60698a1..0680f63 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -350,6 +350,56 @@ static const struct rpc_pipe_ops idmap_upcall_ops = {
 	.destroy_msg	= idmap_pipe_destroy_msg,
 };
 
+static void __nfs_idmap_unregister(struct rpc_pipe *pipe)
+{
+	if (pipe->dentry)
+		rpc_unlink(pipe->dentry);
+}
+
+static int __nfs_idmap_register(struct dentry *dir,
+				     struct idmap *idmap,
+				     struct rpc_pipe *pipe)
+{
+	struct dentry *dentry;
+
+	dentry = rpc_mkpipe_dentry(dir, "idmap", idmap, pipe);
+	if (IS_ERR(dentry))
+		return PTR_ERR(dentry);
+	pipe->dentry = dentry;
+	return 0;
+}
+
+static void nfs_idmap_unregister(struct nfs_client *clp,
+				      struct rpc_pipe *pipe)
+{
+	struct net *net = clp->net;
+	struct super_block *pipefs_sb;
+
+	pipefs_sb = rpc_get_sb_net(net);
+	if (pipefs_sb) {
+		__nfs_idmap_unregister(pipe);
+		rpc_put_sb_net(net);
+	}
+}
+
+static int nfs_idmap_register(struct nfs_client *clp,
+				   struct idmap *idmap,
+				   struct rpc_pipe *pipe)
+{
+	struct net *net = clp->net;
+	struct super_block *pipefs_sb;
+	int err = 0;
+
+	pipefs_sb = rpc_get_sb_net(net);
+	if (pipefs_sb) {
+		if (clp->cl_rpcclient->cl_dentry)
+			err = __nfs_idmap_register(clp->cl_rpcclient->cl_dentry,
+						   idmap, pipe);
+		rpc_put_sb_net(net);
+	}
+	return err;
+}
+
 int
 nfs_idmap_new(struct nfs_client *clp)
 {
@@ -369,12 +419,8 @@ nfs_idmap_new(struct nfs_client *clp)
 		kfree(idmap);
 		return error;
 	}
-
-	if (clp->cl_rpcclient->cl_dentry)
-		pipe->dentry = rpc_mkpipe_dentry(clp->cl_rpcclient->cl_dentry,
-				"idmap", idmap, pipe);
-	if (IS_ERR(pipe->dentry)) {
-		error = PTR_ERR(pipe->dentry);
+	error = nfs_idmap_register(clp, idmap, pipe);
+	if (error) {
 		rpc_destroy_pipe_data(pipe);
 		kfree(idmap);
 		return error;
@@ -397,8 +443,7 @@ nfs_idmap_delete(struct nfs_client *clp)
 
 	if (!idmap)
 		return;
-	if (idmap->idmap_pipe->dentry)
-		rpc_unlink(idmap->idmap_pipe->dentry);
+	nfs_idmap_unregister(clp, idmap->idmap_pipe);
 	rpc_destroy_pipe_data(idmap->idmap_pipe);
 	clp->cl_idmap = NULL;
 	kfree(idmap);

^ permalink raw reply related

* [PATCH 6/6] NFS: idmap PipeFS notifier introduced
From: Stanislav Kinsbursky @ 2011-11-28 14:34 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111128132805.4251.15252.stgit@localhost6.localdomain6>

This patch subscribes NFS clients to RPC pipefs notifications. Idmap notifier
is registering on NFS module load. This notifier callback is responsible for
creation/destruction of PipeFS idmap pipe dentry for NFS4 clients.

Since ipdmap pipe is created in rpc client pipefs directory, we have make sure,
that this directory has been created already. IOW RPC client notifier callback
has been called already. To achive this, PipeFS notifier priorities has been
introduced (RPC clients notifier priority is greater than NFS idmap one).
But this approach gives another problem: unlink for RPC client directory will
be called before NFS idmap pipe unlink on UMOUNT event and will fail, because
directory is not empty.
The solution, introduced in this patch, is to try to remove client directory
once again after idmap pipe was unlinked. This looks like ugly hack, so
probably it should be replaced in some more elegant way.

Note that no locking required in notifier callback because PipeFS superblock
pointer is passed as an argument from it's creation or destruction routine and
thus we can be sure about it's validity.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/client.c                    |    4 +-
 fs/nfs/idmap.c                     |   75 ++++++++++++++++++++++++++++++++++++
 fs/nfs/internal.h                  |    4 ++
 include/linux/nfs_idmap.h          |   13 +-----
 include/linux/sunrpc/rpc_pipe_fs.h |    7 +++
 net/sunrpc/clnt.c                  |    1 
 net/sunrpc/rpc_pipe.c              |   16 ++++++++
 7 files changed, 107 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 58eebb5..4398587 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -52,8 +52,8 @@
 
 #define NFSDBG_FACILITY		NFSDBG_CLIENT
 
-static DEFINE_SPINLOCK(nfs_client_lock);
-static LIST_HEAD(nfs_client_list);
+DEFINE_SPINLOCK(nfs_client_lock);
+LIST_HEAD(nfs_client_list);
 static LIST_HEAD(nfs_volume_list);
 static DECLARE_WAIT_QUEUE_HEAD(nfs_client_active_wq);
 #ifdef CONFIG_NFS_V4
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 0680f63..d8fed37 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -294,6 +294,7 @@ int nfs_map_gid_to_group(const struct nfs_server *server, __u32 gid, char *buf,
 #include <linux/nfs_fs.h>
 
 #include "nfs4_fs.h"
+#include "internal.h"
 
 #define IDMAP_HASH_SZ          128
 
@@ -449,6 +450,80 @@ nfs_idmap_delete(struct nfs_client *clp)
 	kfree(idmap);
 }
 
+static int __rpc_pipefs_event(struct nfs_client *clp, unsigned long event,
+			      struct super_block *sb)
+{
+	int err = 0;
+
+	switch (event) {
+	case RPC_PIPEFS_MOUNT:
+		BUG_ON(clp->cl_rpcclient->cl_dentry == NULL);
+		err = __nfs_idmap_register(clp->cl_rpcclient->cl_dentry,
+						clp->cl_idmap,
+						clp->cl_idmap->idmap_pipe);
+		break;
+	case RPC_PIPEFS_UMOUNT:
+		if (clp->cl_idmap->idmap_pipe) {
+			struct dentry *parent;
+
+			parent = clp->cl_idmap->idmap_pipe->dentry->d_parent;
+			__nfs_idmap_unregister(clp->cl_idmap->idmap_pipe);
+			/*
+			 * Note: This is a dirty hack. SUNRPC hook has been
+			 * called already but simple_rmdir() call for the
+			 * directory returned with error because of idmap pipe
+			 * inside. Thus now we have to remove this directory
+			 * here.
+			 */
+			if (rpc_rmdir(parent))
+				printk(KERN_ERR "%s: failed to remove clnt dir!\n", __func__);
+		}
+		break;
+	default:
+		printk(KERN_ERR "%s: unknown event: %ld\n", __func__, event);
+		return -ENOTSUPP;
+	}
+	return err;
+}
+
+static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
+			    void *ptr)
+{
+	struct super_block *sb = ptr;
+	struct nfs_client *clp;
+	int error = 0;
+
+	spin_lock(&nfs_client_lock);
+	list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
+		if (clp->net != sb->s_fs_info)
+			continue;
+		if (clp->rpc_ops != &nfs_v4_clientops)
+			continue;
+		error = __rpc_pipefs_event(clp, event, sb);
+		if (error)
+			break;
+	}
+	spin_unlock(&nfs_client_lock);
+	return error;
+}
+
+#define PIPEFS_NFS_PRIO		1
+
+static struct notifier_block nfs_idmap_block = {
+	.notifier_call	= rpc_pipefs_event,
+	.priority	= SUNRPC_PIPEFS_NFS_PRIO,
+};
+
+int nfs_idmap_init(void)
+{
+	return rpc_pipefs_notifier_register(&nfs_idmap_block);
+}
+
+void nfs_idmap_quit(void)
+{
+	rpc_pipefs_notifier_unregister(&nfs_idmap_block);
+}
+
 /*
  * Helper routines for manipulating the hashtable
  */
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 451acb5..00e8fa5 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -182,6 +182,10 @@ static inline void nfs_fs_proc_exit(void)
 {
 }
 #endif
+#ifdef CONFIG_NFS_V4
+extern spinlock_t nfs_client_lock;
+extern struct list_head nfs_client_list;
+#endif
 
 /* nfs4namespace.c */
 #ifdef CONFIG_NFS_V4
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index ae7d6a3..238c814 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -67,11 +67,11 @@ struct idmap_msg {
 struct nfs_client;
 struct nfs_server;
 
-#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
-
 int nfs_idmap_init(void);
 void nfs_idmap_quit(void);
 
+#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
+
 static inline int nfs_idmap_new(struct nfs_client *clp)
 {
 	return 0;
@@ -83,15 +83,6 @@ static inline void nfs_idmap_delete(struct nfs_client *clp)
 
 #else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */
 
-static inline int nfs_idmap_init(void)
-{
-	return 0;
-}
-
-static inline void nfs_idmap_quit(void)
-{
-}
-
 int nfs_idmap_new(struct nfs_client *);
 void nfs_idmap_delete(struct nfs_client *);
 
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 0808ed2..7eb0160 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -49,6 +49,11 @@ RPC_I(struct inode *inode)
 	return container_of(inode, struct rpc_inode, vfs_inode);
 }
 
+enum {
+	SUNRPC_PIPEFS_NFS_PRIO,
+	SUNRPC_PIPEFS_RPC_PRIO,
+};
+
 extern int rpc_pipefs_notifier_register(struct notifier_block *);
 extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
 
@@ -78,6 +83,8 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *,
 					   struct cache_detail *);
 extern void rpc_remove_cache_dir(struct dentry *);
 
+extern int rpc_rmdir(struct dentry *dentry);
+
 struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
 void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
 extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index c7237fa..e4f210d 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -234,6 +234,7 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
 
 static struct notifier_block rpc_clients_block = {
 	.notifier_call	= rpc_pipefs_event,
+	.priority	= SUNRPC_PIPEFS_RPC_PRIO,
 };
 
 int rpc_clients_notifier_register(void)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index b80d7bd..e194e32 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -597,6 +597,22 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry)
 	return ret;
 }
 
+int rpc_rmdir(struct dentry *dentry)
+{
+	struct dentry *parent;
+	struct inode *dir;
+	int error;
+
+	parent = dget_parent(dentry);
+	dir = parent->d_inode;
+	mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
+	error = __rpc_rmdir(dir, dentry);
+	mutex_unlock(&dir->i_mutex);
+	dput(parent);
+	return error;
+}
+EXPORT_SYMBOL_GPL(rpc_rmdir);
+
 static int __rpc_unlink(struct inode *dir, struct dentry *dentry)
 {
 	int ret;

^ permalink raw reply related

* Re: ebtables on a stick
From: David Lamparter @ 2011-11-28 14:39 UTC (permalink / raw)
  To: Greg Scott; +Cc: netdev
In-Reply-To: <925A849792280C4E80C5461017A4B8A2A0487F@mail733.InfraSupportEtc.com>

On Sun, Nov 27, 2011 at 09:10:08AM -0600, Greg Scott wrote:
> I have a situation that needs to route mostly and bridge only a little bit.  
> 
> I have a private internal LAN, 192.168.10.nnn.  But one host in the internal side needs a real public IP Address, call it 1.2.115.157.  Everything except that public IP host needs to route.  The public host needs to bridge so it can interact with the world.  But it also needs to interact with the internal LAN.  
> 
> I have a Linux brouter set up with eth0 facing the Internet, eth1 facing the LAN as follows:
> 
> ifconfig eth0 1.2.115.146 mask 255.255.255.240
> ifconfig eth1 192.168.10.1 mask 255.255.255.0
[...]

This doesn't answer your question, but your use case is better solved
with proxy arp.

ip route add 1.2.115.157/32 dev eth1
ip neigh add proxy 1.2.115.157 dev eth0
# ... adjust iptables rules to make sure traffic is allowed
# optional, but I'd recommend:
iptables -t raw -I PREROUTING -d 1.2.115.157 -j NOTRACK
iptables -t raw -I PREROUTING -s 1.2.115.157 -j NOTRACK

on the target host:

ip addr add 1.2.115.157/32 dev ethX
ip route add 192.168.10.1/24 dev ethX
ip route add default via 192.168.10.1

no bridge, no ebtables.

you may need to tweak shared_media/icmp redirect settings on the router,
should work as-is though.


-David

^ permalink raw reply

* Re: [GIT PULL v2] Open vSwitch
From: Herbert Xu @ 2011-11-28 14:51 UTC (permalink / raw)
  To: Fischer, Anna
  Cc: jhs@mojatatu.com, David Miller, jesse@nicira.com,
	netdev@vger.kernel.org, dev@openvswitch.org
In-Reply-To: <0199E0D51A61344794750DC57738F58E7586A74137@GVW1118EXC.americas.hpqcorp.net>

On Mon, Nov 28, 2011 at 01:54:16PM +0000, Fischer, Anna wrote:
>
> Yes, I mentioned this months ago, and I am surprised this critical issue has never been picked up on and addressed. With a flaw like this there is no chance this component can be used in any serious virtualization deployment where different customers share the same physical server.
> 
> The path up to user-space needs to be designed in a multi-queue fashion, so that each vPort has its own queue up to user-space. Ideally those queues also need to be rate controlled in some form, so that no DoS is possible.

Actually, rereading the patch it would appear that the interface
does allow the use of multiple sockets at the user-space end.
Whether the user-space daemon actually does so is another matter
of course :)

There are other issues with the hash implementation.  For example,
there seems to be no limit on the number of collisions in each
bucket.  As the hash table growth code simply continues when it
fails to expand, this means that the number of collisions may
rise without bound.

At least this is each to fix, by using any one of our other
similar hash table implementations as an example.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* RE: ebtables on a stick
From: Greg Scott @ 2011-11-28 14:54 UTC (permalink / raw)
  To: David Lamparter; +Cc: netdev
In-Reply-To: <20111128143901.GA589422@jupiter.n2.diac24.net>

> This doesn't answer your question, but your use case is better solved
> with proxy arp.

Proxy arp scares me to death.  I lived through a disaster a few years ago when I messed up a whole colo site when I put in a box with its public NIC set up with Proxy arp.  If I understand what happens, that proxy-arped NIC answers ARP requests for everyone with its own MAC Address.  Fortunately for me, it only lasted a little while around 4AM one morning before I realized what was going on and took it down.  After I went through that experience I promised myself never again for proxy arp.

That's why I started looking at bridging.  

...But maybe there's a way to make my NIC only answer ARPs for certain IP Addresses I care about?  That would nicely solve the problem.  If it works.  

In my earlier near-disaster, I did this:

echo 1 > /proc/sys/net/ipv4/conf/${INET_IFACE}/proxy_arp

to turn on proxy arp.  I wonder if that ip neighbor stuff does it selectively?  

- Greg


^ permalink raw reply

* Re: [PATCH net-next v2 2/4] can: cc770: add legacy ISA bus driver for the CC770 and AN82527
From: Wolfgang Grandegger @ 2011-11-28 15:10 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-can-u79uwXL29TY76Z2rM5mHXA,
	David Laight, socketcan-users-0fE9KPoRgkgATYTw5x5z8w
In-Reply-To: <4ED3960F.4040508-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On 11/28/2011 03:09 PM, Marc Kleine-Budde wrote:
> On 11/28/2011 03:03 PM, David Laight wrote:
>>>>> +	for (idx = 0; idx < MAXDEV; idx++) {
>>>> ARRAY_SIZE?
>>>
>>> Well, I think ARRAY_SIZE is useful to derive the number of 
>>> elements from a static array of the type:
>>>
>>>   static const int array[] = { 1, 2, 3, 4, }
>>>
>>> but not if its declared as:
>>>
>>>   static array[MAXDEV]:
>>>
>>> ... or have I missed something?
>>
>> Yes - if you use ARRAY_SIZE() then someone reading the code
>> doesn't need to find the array definition to ensure the loop
>> upper bound is correct.
> 
> Yep, that
> was my intention, too.

OK, I see, and as we are all just human beings ...

Wolfgang.

^ permalink raw reply

* Re: [PATCH] 9p: Reduce object size with CONFIG_NET_9P_DEBUG
From: Eric Van Hensbergen @ 2011-11-28 15:10 UTC (permalink / raw)
  To: Joe Perches
  Cc: Ron Minnich, Latchesar Ionkov, David S. Miller, v9fs-developer,
	linux-kernel, netdev
In-Reply-To: <1321661394.5917.7.camel@Joe-Laptop>

sorry, just got to reviewing this because of holidays.

On Fri, Nov 18, 2011 at 6:09 PM, Joe Perches <joe@perches.com> wrote:
> Reduce object size by deduplicating formats.
>
> Use vsprintf extension %pV.
> Rename P9_DPRINTK uses to p9_debug, align arguments.
> Add function for _p9_debug and macro to add __func__.
> Add missing "\n"s to p9_debug uses.
> Remove embedded function names as p9_debug adds it.
> Remove P9_EPRINTK macro and convert use to pr_<level>.
> Add and use pr_fmt and pr_<level>.
>
> $ size fs/9p/built-in.o*
>   text    data     bss     dec     hex filename
>  62133     984   16000   79117   1350d fs/9p/built-in.o.new
>  67342     984   16928   85254   14d06 fs/9p/built-in.o.old
>
> Signed-off-by: Joe Perches <joe@perches.com>

These changes seem reasonable enough, but since you only made changes
in the fs/9p directory and not the net/9p directory which causes
net/9p build to break with this patch.

CC      net/9p/client.o
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c: In function
‘get_protocol_version’:
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c:84:3: error:
implicit declaration of function ‘P9_DPRINTK’
[-Werror=implicit-function-declaration]
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c: In function
‘p9_client_clunk’:
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c:1426:3: error:
implicit declaration of function ‘P9_EPRINTK’
[-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

make[3]: *** [net/9p/client.o] Error 1
make[2]: *** [net/9p] Error 2
make[1]: *** [net] Error 2
make: *** [sub-make] Error 2

           -eric


> ---
>  fs/9p/cache.c          |   64 ++++++++++++++++++------------------
>  fs/9p/fid.c            |    8 ++--
>  fs/9p/v9fs.c           |   83 ++++++++++++++++++++++++++++++----------------
>  fs/9p/vfs_addr.c       |   13 +++----
>  fs/9p/vfs_dentry.c     |   12 +++---
>  fs/9p/vfs_dir.c        |   13 +++----
>  fs/9p/vfs_file.c       |   31 ++++++++---------
>  fs/9p/vfs_inode.c      |   86 ++++++++++++++++++++++++------------------------
>  fs/9p/vfs_inode_dotl.c |   85 +++++++++++++++++++++++------------------------
>  fs/9p/vfs_super.c      |   12 +++---
>  fs/9p/xattr.c          |   16 ++++----
>  include/net/9p/9p.h    |   28 ++++------------
>  12 files changed, 228 insertions(+), 223 deletions(-)
>
> diff --git a/fs/9p/cache.c b/fs/9p/cache.c
> index 945aa5f..a9ea73d 100644
> --- a/fs/9p/cache.c
> +++ b/fs/9p/cache.c
> @@ -62,8 +62,8 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
>        uint16_t klen = 0;
>
>        v9ses = (struct v9fs_session_info *)cookie_netfs_data;
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p buf %p size %u", v9ses,
> -                  buffer, bufmax);
> +       p9_debug(P9_DEBUG_FSC, "session %p buf %p size %u\n",
> +                v9ses, buffer, bufmax);
>
>        if (v9ses->cachetag)
>                klen = strlen(v9ses->cachetag);
> @@ -72,7 +72,7 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
>                return 0;
>
>        memcpy(buffer, v9ses->cachetag, klen);
> -       P9_DPRINTK(P9_DEBUG_FSC, "cache session tag %s", v9ses->cachetag);
> +       p9_debug(P9_DEBUG_FSC, "cache session tag %s\n", v9ses->cachetag);
>        return klen;
>  }
>
> @@ -91,14 +91,14 @@ void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses)
>        v9ses->fscache = fscache_acquire_cookie(v9fs_cache_netfs.primary_index,
>                                                &v9fs_cache_session_index_def,
>                                                v9ses);
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p get cookie %p", v9ses,
> -                  v9ses->fscache);
> +       p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n",
> +                v9ses, v9ses->fscache);
>  }
>
>  void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses)
>  {
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p put cookie %p", v9ses,
> -                  v9ses->fscache);
> +       p9_debug(P9_DEBUG_FSC, "session %p put cookie %p\n",
> +                v9ses, v9ses->fscache);
>        fscache_relinquish_cookie(v9ses->fscache, 0);
>        v9ses->fscache = NULL;
>  }
> @@ -109,8 +109,8 @@ static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
>  {
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path));
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode,
> -                  v9inode->qid.path);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get key %llu\n",
> +                &v9inode->vfs_inode, v9inode->qid.path);
>        return sizeof(v9inode->qid.path);
>  }
>
> @@ -120,8 +120,8 @@ static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        *size = i_size_read(&v9inode->vfs_inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode,
> -                  *size);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get attr %llu\n",
> +                &v9inode->vfs_inode, *size);
>  }
>
>  static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
> @@ -129,8 +129,8 @@ static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
>  {
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version));
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode,
> -                  v9inode->qid.version);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get aux %u\n",
> +                &v9inode->vfs_inode, v9inode->qid.version);
>        return sizeof(v9inode->qid.version);
>  }
>
> @@ -206,8 +206,8 @@ void v9fs_cache_inode_get_cookie(struct inode *inode)
>                                                  &v9fs_cache_inode_index_def,
>                                                  v9inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n",
> +                inode, v9inode->fscache);
>  }
>
>  void v9fs_cache_inode_put_cookie(struct inode *inode)
> @@ -216,8 +216,8 @@ void v9fs_cache_inode_put_cookie(struct inode *inode)
>
>        if (!v9inode->fscache)
>                return;
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p put cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p put cookie %p\n",
> +                inode, v9inode->fscache);
>
>        fscache_relinquish_cookie(v9inode->fscache, 0);
>        v9inode->fscache = NULL;
> @@ -229,8 +229,8 @@ void v9fs_cache_inode_flush_cookie(struct inode *inode)
>
>        if (!v9inode->fscache)
>                return;
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p flush cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p flush cookie %p\n",
> +                inode, v9inode->fscache);
>
>        fscache_relinquish_cookie(v9inode->fscache, 1);
>        v9inode->fscache = NULL;
> @@ -272,8 +272,8 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
>        v9inode->fscache = fscache_acquire_cookie(v9ses->fscache,
>                                                  &v9fs_cache_inode_index_def,
>                                                  v9inode);
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p",
> -                  inode, old, v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
> +                inode, old, v9inode->fscache);
>
>        spin_unlock(&v9inode->fscache_lock);
>  }
> @@ -323,7 +323,7 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        if (!v9inode->fscache)
>                return -ENOBUFS;
>
> @@ -335,13 +335,13 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
>        switch (ret) {
>        case -ENOBUFS:
>        case -ENODATA:
> -               P9_DPRINTK(P9_DEBUG_FSC, "page/inode not in cache %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "page/inode not in cache %d\n", ret);
>                return 1;
>        case 0:
> -               P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
> +               p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
>                return ret;
>        default:
> -               P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
>                return ret;
>        }
>  }
> @@ -361,7 +361,7 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p pages %u", inode, *nr_pages);
> +       p9_debug(P9_DEBUG_FSC, "inode %p pages %u\n", inode, *nr_pages);
>        if (!v9inode->fscache)
>                return -ENOBUFS;
>
> @@ -373,15 +373,15 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
>        switch (ret) {
>        case -ENOBUFS:
>        case -ENODATA:
> -               P9_DPRINTK(P9_DEBUG_FSC, "pages/inodes not in cache %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "pages/inodes not in cache %d\n", ret);
>                return 1;
>        case 0:
>                BUG_ON(!list_empty(pages));
>                BUG_ON(*nr_pages != 0);
> -               P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
> +               p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
>                return ret;
>        default:
> -               P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
>                return ret;
>        }
>  }
> @@ -396,9 +396,9 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL);
> -       P9_DPRINTK(P9_DEBUG_FSC, "ret =  %d", ret);
> +       p9_debug(P9_DEBUG_FSC, "ret =  %d\n", ret);
>        if (ret != 0)
>                v9fs_uncache_page(inode, page);
>  }
> @@ -409,7 +409,7 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
>  void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page)
>  {
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        if (PageFsCache(page))
>                fscache_wait_on_page_write(v9inode->fscache, page);
>  }
> diff --git a/fs/9p/fid.c b/fs/9p/fid.c
> index 85b67ff..da8eefb 100644
> --- a/fs/9p/fid.c
> +++ b/fs/9p/fid.c
> @@ -45,8 +45,8 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
>  {
>        struct v9fs_dentry *dent;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "fid %d dentry %s\n",
> -                                       fid->fid, dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n",
> +                fid->fid, dentry->d_name.name);
>
>        dent = dentry->d_fsdata;
>        if (!dent) {
> @@ -79,8 +79,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, u32 uid, int any)
>        struct v9fs_dentry *dent;
>        struct p9_fid *fid, *ret;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
> -               dentry->d_name.name, dentry, uid, any);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
> +                dentry->d_name.name, dentry, uid, any);
>        dent = (struct v9fs_dentry *) dentry->d_fsdata;
>        ret = NULL;
>        if (dent) {
> diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
> index 2b78014..4afc182 100644
> --- a/fs/9p/v9fs.c
> +++ b/fs/9p/v9fs.c
> @@ -23,6 +23,8 @@
>  *
>  */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/module.h>
>  #include <linux/errno.h>
>  #include <linux/fs.h>
> @@ -85,15 +87,15 @@ static int get_cache_mode(char *s)
>
>        if (!strcmp(s, "loose")) {
>                version = CACHE_LOOSE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
>        } else if (!strcmp(s, "fscache")) {
>                version = CACHE_FSCACHE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
>        } else if (!strcmp(s, "none")) {
>                version = CACHE_NONE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
>        } else
> -               printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s);
> +               pr_info("Unknown Cache mode %s\n", s);
>        return version;
>  }
>
> @@ -140,8 +142,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_debug:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -154,8 +156,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_dfltuid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -164,8 +166,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_dfltgid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -174,8 +176,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_afid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -205,8 +207,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                        s = match_strdup(&args[0]);
>                        if (!s) {
>                                ret = -ENOMEM;
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                 "problem allocating copy of cache arg\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "problem allocating copy of cache arg\n");
>                                goto free_and_return;
>                        }
>                        ret = get_cache_mode(s);
> @@ -223,8 +225,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                        s = match_strdup(&args[0]);
>                        if (!s) {
>                                ret = -ENOMEM;
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                 "problem allocating copy of access arg\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "problem allocating copy of access arg\n");
>                                goto free_and_return;
>                        }
>
> @@ -240,8 +242,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                                v9ses->uid = simple_strtoul(s, &e, 10);
>                                if (*e != '\0') {
>                                        ret = -EINVAL;
> -                                       printk(KERN_INFO "9p: Unknown access "
> -                                                       "argument %s.\n", s);
> +                                       pr_info("Unknown access argument %s\n",
> +                                               s);
>                                        kfree(s);
>                                        goto free_and_return;
>                                }
> @@ -254,9 +256,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  #ifdef CONFIG_9P_FS_POSIX_ACL
>                        v9ses->flags |= V9FS_POSIX_ACL;
>  #else
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                                       "Not defined CONFIG_9P_FS_POSIX_ACL. "
> -                                       "Ignoring posixacl option\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
>  #endif
>                        break;
>
> @@ -318,7 +319,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
>        if (IS_ERR(v9ses->clnt)) {
>                retval = PTR_ERR(v9ses->clnt);
>                v9ses->clnt = NULL;
> -               P9_DPRINTK(P9_DEBUG_ERROR, "problem initializing 9p client\n");
> +               p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
>                goto error;
>        }
>
> @@ -371,7 +372,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
>        if (IS_ERR(fid)) {
>                retval = PTR_ERR(fid);
>                fid = NULL;
> -               P9_DPRINTK(P9_DEBUG_ERROR, "cannot attach\n");
> +               p9_debug(P9_DEBUG_ERROR, "cannot attach\n");
>                goto error;
>        }
>
> @@ -429,7 +430,7 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
>  */
>
>  void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
> -       P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
> +       p9_debug(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
>        p9_client_disconnect(v9ses->clnt);
>  }
>
> @@ -442,7 +443,7 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
>
>  void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses)
>  {
> -       P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
> +       p9_debug(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
>        p9_client_begin_disconnect(v9ses->clnt);
>  }
>
> @@ -591,23 +592,23 @@ static void v9fs_cache_unregister(void)
>  static int __init init_v9fs(void)
>  {
>        int err;
> -       printk(KERN_INFO "Installing v9fs 9p2000 file system support\n");
> +       pr_info("Installing v9fs 9p2000 file system support\n");
>        /* TODO: Setup list of registered trasnport modules */
>        err = register_filesystem(&v9fs_fs_type);
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register filesystem\n");
> +               pr_err("Failed to register filesystem\n");
>                return err;
>        }
>
>        err = v9fs_cache_register();
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register v9fs for caching\n");
> +               pr_err("Failed to register v9fs for caching\n");
>                goto out_fs_unreg;
>        }
>
>        err = v9fs_sysfs_init();
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register with sysfs\n");
> +               pr_err("Failed to register with sysfs\n");
>                goto out_sysfs_cleanup;
>        }
>
> @@ -637,6 +638,30 @@ static void __exit exit_v9fs(void)
>  module_init(init_v9fs)
>  module_exit(exit_v9fs)
>
> +#ifdef CONFIG_NET_9P_DEBUG
> +void _p9_debug(enum p9_debug_flags level, const char *func,
> +              const char *fmt, ...)
> +{
> +       struct va_format vaf;
> +       va_list args;
> +
> +       if ((p9_debug_level & level) != level)
> +               return;
> +
> +       va_start(args, fmt);
> +
> +       vaf.fmt = fmt;
> +       vaf.va = &args;
> +
> +       if (level == P9_DEBUG_9P)
> +               pr_notice("(%8.8d) %pV", task_pid_nr(current), &vaf);
> +       else
> +               pr_notice("-- %s (%d): %pV", func, task_pid_nr(current), &vaf);
> +
> +       va_end(args);
> +}
> +#endif
> +
>  MODULE_AUTHOR("Latchesar Ionkov <lucho@ionkov.net>");
>  MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
>  MODULE_AUTHOR("Ron Minnich <rminnich@lanl.gov>");
> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> index 2524e4c..0ad61c6 100644
> --- a/fs/9p/vfs_addr.c
> +++ b/fs/9p/vfs_addr.c
> @@ -56,7 +56,7 @@ static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
>        struct inode *inode;
>
>        inode = page->mapping->host;
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        BUG_ON(!PageLocked(page));
>
> @@ -116,14 +116,14 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping,
>        struct inode *inode;
>
>        inode = mapping->host;
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
>
>        ret = v9fs_readpages_from_fscache(inode, mapping, pages, &nr_pages);
>        if (ret == 0)
>                return ret;
>
>        ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp);
> -       P9_DPRINTK(P9_DEBUG_VFS, "  = %d\n", ret);
> +       p9_debug(P9_DEBUG_VFS, "  = %d\n", ret);
>        return ret;
>  }
>
> @@ -263,10 +263,9 @@ v9fs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
>         * Now that we do caching with cache mode enabled, We need
>         * to support direct IO
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) "
> -                       "off/no(%lld/%lu) EINVAL\n",
> -                       iocb->ki_filp->f_path.dentry->d_name.name,
> -                       (long long) pos, nr_segs);
> +       p9_debug(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) off/no(%lld/%lu) EINVAL\n",
> +                iocb->ki_filp->f_path.dentry->d_name.name,
> +                (long long)pos, nr_segs);
>
>        return -EINVAL;
>  }
> diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
> index e022890..d529437 100644
> --- a/fs/9p/vfs_dentry.c
> +++ b/fs/9p/vfs_dentry.c
> @@ -53,8 +53,8 @@
>
>  static int v9fs_dentry_delete(const struct dentry *dentry)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
> -                                                                       dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>
>        return 1;
>  }
> @@ -66,8 +66,8 @@ static int v9fs_dentry_delete(const struct dentry *dentry)
>  */
>  static int v9fs_cached_dentry_delete(const struct dentry *dentry)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> -                  dentry->d_name.name, dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>
>        /* Don't cache negative dentries */
>        if (!dentry->d_inode)
> @@ -86,8 +86,8 @@ static void v9fs_dentry_release(struct dentry *dentry)
>        struct v9fs_dentry *dent;
>        struct p9_fid *temp, *current_fid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
> -                                                                       dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>        dent = dentry->d_fsdata;
>        if (dent) {
>                list_for_each_entry_safe(current_fid, temp, &dent->fidlist,
> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
> index 598fff1..ff911e7 100644
> --- a/fs/9p/vfs_dir.c
> +++ b/fs/9p/vfs_dir.c
> @@ -140,7 +140,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
>        int reclen = 0;
>        struct p9_rdir *rdir;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
>        fid = filp->private_data;
>
>        buflen = fid->clnt->msize - P9_IOHDRSZ;
> @@ -168,7 +168,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
>                        err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
>                                          rdir->tail - rdir->head, &st);
>                        if (err) {
> -                               P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
> +                               p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
>                                err = -EIO;
>                                p9stat_free(&st);
>                                goto unlock_and_exit;
> @@ -213,7 +213,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
>        struct p9_dirent curdirent;
>        u64 oldoffset = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
>        fid = filp->private_data;
>
>        buflen = fid->clnt->msize - P9_READDIRHDRSZ;
> @@ -244,7 +244,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
>                                            rdir->tail - rdir->head,
>                                            &curdirent);
>                        if (err < 0) {
> -                               P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
> +                               p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
>                                err = -EIO;
>                                goto unlock_and_exit;
>                        }
> @@ -290,9 +290,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
>        struct p9_fid *fid;
>
>        fid = filp->private_data;
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -                       "v9fs_dir_release: inode: %p filp: %p fid: %d\n",
> -                       inode, filp, fid ? fid->fid : -1);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
> +                inode, filp, fid ? fid->fid : -1);
>        if (fid)
>                p9_client_clunk(fid);
>        return 0;
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 62857a8..8947f9f 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -61,7 +61,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
>        struct p9_fid *fid;
>        int omode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
>        v9inode = V9FS_I(inode);
>        v9ses = v9fs_inode2v9ses(inode);
>        if (v9fs_proto_dotl(v9ses))
> @@ -135,7 +135,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
>        int res = 0;
>        struct inode *inode = filp->f_path.dentry->d_inode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -304,8 +304,8 @@ static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
>        struct inode *inode = filp->f_path.dentry->d_inode;
>        int ret = -ENOLCK;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
> -                               cmd, fl, filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
> +                filp, cmd, fl, filp->f_path.dentry->d_name.name);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -340,8 +340,8 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
>        struct inode *inode = filp->f_path.dentry->d_inode;
>        int ret = -ENOLCK;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
> -                               cmd, fl, filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
> +                filp, cmd, fl, filp->f_path.dentry->d_name.name);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -384,8 +384,8 @@ v9fs_fid_readn(struct p9_fid *fid, char *data, char __user *udata, u32 count,
>  {
>        int n, total, size;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "fid %d offset %llu count %d\n", fid->fid,
> -                  (long long unsigned) offset, count);
> +       p9_debug(P9_DEBUG_VFS, "fid %d offset %llu count %d\n",
> +                fid->fid, (long long unsigned)offset, count);
>        n = 0;
>        total = 0;
>        size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
> @@ -443,7 +443,7 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
>        struct p9_fid *fid;
>        size_t size;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
> +       p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
>        fid = filp->private_data;
>
>        size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
> @@ -470,8 +470,8 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
>        loff_t origin = *offset;
>        unsigned long pg_start, pg_end;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
> -               (int)count, (int)*offset);
> +       p9_debug(P9_DEBUG_VFS, "data %p count %d offset %x\n",
> +                data, (int)count, (int)*offset);
>
>        clnt = fid->clnt;
>        do {
> @@ -552,7 +552,7 @@ static int v9fs_file_fsync(struct file *filp, loff_t start, loff_t end,
>                return retval;
>
>        mutex_lock(&inode->i_mutex);
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
> +       p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
>
>        fid = filp->private_data;
>        v9fs_blank_wstat(&wstat);
> @@ -575,8 +575,7 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
>                return retval;
>
>        mutex_lock(&inode->i_mutex);
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n",
> -                       filp, datasync);
> +       p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
>
>        fid = filp->private_data;
>
> @@ -607,8 +606,8 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
>        struct inode *inode = filp->f_path.dentry->d_inode;
>
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n",
> -                  page, (unsigned long)filp->private_data);
> +       p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
> +                page, (unsigned long)filp->private_data);
>
>        v9inode = V9FS_I(inode);
>        /* make sure the cache has finished storing the page */
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
> index 879ed88..85c2973 100644
> --- a/fs/9p/vfs_inode.c
> +++ b/fs/9p/vfs_inode.c
> @@ -23,6 +23,8 @@
>  *
>  */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/module.h>
>  #include <linux/errno.h>
>  #include <linux/fs.h>
> @@ -133,9 +135,8 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses,
>                        res |= S_IFBLK;
>                        break;
>                default:
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                               "Unknown special type %c %s\n", type,
> -                               stat->extension);
> +                       p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
> +                                type, stat->extension);
>                };
>                *rdev = MKDEV(major, minor);
>        } else
> @@ -281,8 +282,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>                } else if (v9fs_proto_dotu(v9ses)) {
>                        inode->i_op = &v9fs_file_inode_operations;
>                } else {
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                                  "special files without extended mode\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "special files without extended mode\n");
>                        err = -EINVAL;
>                        goto error;
>                }
> @@ -307,8 +308,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>                break;
>        case S_IFLNK:
>                if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
> -                       P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
> -                                               "legacy protocol.\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "extended modes used with legacy protocol\n");
>                        err = -EINVAL;
>                        goto error;
>                }
> @@ -335,8 +336,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>
>                break;
>        default:
> -               P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
> -                          mode, mode & S_IFMT);
> +               p9_debug(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
> +                        mode, mode & S_IFMT);
>                err = -EINVAL;
>                goto error;
>        }
> @@ -358,11 +359,12 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev)
>        struct inode *inode;
>        struct v9fs_session_info *v9ses = sb->s_fs_info;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
> +       p9_debug(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
>
>        inode = new_inode(sb);
>        if (!inode) {
> -               P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n");
> +               pr_warn("%s (%d): Problem allocating inode\n",
> +                       __func__, task_pid_nr(current));
>                return ERR_PTR(-ENOMEM);
>        }
>        err = v9fs_init_inode(v9ses, inode, mode, rdev);
> @@ -578,15 +580,15 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
>        struct p9_fid *v9fid, *dfid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
> -                  dir, dentry, flags);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
> +                dir, dentry, flags);
>
>        v9ses = v9fs_inode2v9ses(dir);
>        inode = dentry->d_inode;
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                retval = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
>                return retval;
>        }
>        if (v9fs_proto_dotl(v9ses))
> @@ -635,7 +637,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        struct p9_fid *dfid, *ofid, *fid;
>        struct inode *inode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>
>        err = 0;
>        ofid = NULL;
> @@ -644,7 +646,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return ERR_PTR(err);
>        }
>
> @@ -652,13 +654,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        ofid = p9_client_walk(dfid, 0, NULL, 1);
>        if (IS_ERR(ofid)) {
>                err = PTR_ERR(ofid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                return ERR_PTR(err);
>        }
>
>        err = p9_client_fcreate(ofid, name, perm, mode, extension);
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
>                goto error;
>        }
>
> @@ -666,7 +668,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        fid = p9_client_walk(dfid, 1, &name, 1);
>        if (IS_ERR(fid)) {
>                err = PTR_ERR(fid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                fid = NULL;
>                goto error;
>        }
> @@ -675,7 +677,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>        if (IS_ERR(inode)) {
>                err = PTR_ERR(inode);
> -               P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
>                goto error;
>        }
>        err = v9fs_fid_add(dentry, fid);
> @@ -793,7 +795,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
>        struct p9_fid *fid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>        err = 0;
>        v9ses = v9fs_inode2v9ses(dir);
>        perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
> @@ -831,8 +833,8 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
>        char *name;
>        int result = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
> -               dir, dentry->d_name.name, dentry, nameidata);
> +       p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
> +                dir, dentry->d_name.name, dentry, nameidata);
>
>        if (dentry->d_name.len > NAME_MAX)
>                return ERR_PTR(-ENAMETOOLONG);
> @@ -938,7 +940,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
>        struct p9_fid *newdirfid;
>        struct p9_wstat wstat;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>        retval = 0;
>        old_inode = old_dentry->d_inode;
>        new_inode = new_dentry->d_inode;
> @@ -974,8 +976,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
>                 * 9P .u can only handle file rename in the same directory
>                 */
>
> -               P9_DPRINTK(P9_DEBUG_ERROR,
> -                               "old dir and new dir are different\n");
> +               p9_debug(P9_DEBUG_ERROR, "old dir and new dir are different\n");
>                retval = -EXDEV;
>                goto clunk_newdir;
>        }
> @@ -1031,7 +1032,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
>        struct p9_fid *fid;
>        struct p9_wstat *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
> +       p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
>        err = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
> @@ -1068,7 +1069,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
>        struct p9_fid *fid;
>        struct p9_wstat wstat;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>        retval = inode_change_ok(dentry->d_inode, iattr);
>        if (retval)
>                return retval;
> @@ -1213,7 +1214,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
>        struct p9_fid *fid;
>        struct p9_wstat *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
>        retval = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        fid = v9fs_fid_lookup(dentry);
> @@ -1235,8 +1236,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
>        /* copy extension buffer into buffer */
>        strncpy(buffer, st->extension, buflen);
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer);
> +       p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n",
> +                dentry->d_name.name, st->extension, buffer);
>
>        retval = strnlen(buffer, buflen);
>  done:
> @@ -1257,7 +1258,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
>        int len = 0;
>        char *link = __getname();
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
>
>        if (!link)
>                link = ERR_PTR(-ENOMEM);
> @@ -1288,8 +1289,8 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
>  {
>        char *s = nd_get_link(nd);
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name,
> -               IS_ERR(s) ? "<error>" : s);
> +       p9_debug(P9_DEBUG_VFS, " %s %s\n",
> +                dentry->d_name.name, IS_ERR(s) ? "<error>" : s);
>        if (!IS_ERR(s))
>                __putname(s);
>  }
> @@ -1312,7 +1313,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
>
>        v9ses = v9fs_inode2v9ses(dir);
>        if (!v9fs_proto_dotu(v9ses)) {
> -               P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n");
> +               p9_debug(P9_DEBUG_ERROR, "not extended\n");
>                return -EPERM;
>        }
>
> @@ -1340,8 +1341,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
>  static int
>  v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino,
> -                                       dentry->d_name.name, symname);
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
> +                dir->i_ino, dentry->d_name.name, symname);
>
>        return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname);
>  }
> @@ -1362,9 +1363,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
>        char *name;
>        struct p9_fid *oldfid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
> -               old_dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
> +                dir->i_ino, dentry->d_name.name, old_dentry->d_name.name);
>
>        oldfid = v9fs_fid_clone(old_dentry);
>        if (IS_ERR(oldfid))
> @@ -1403,9 +1403,9 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
>        int retval;
>        char *name;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
> -               dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
> +                dir->i_ino, dentry->d_name.name, mode,
> +                MAJOR(rdev), MINOR(rdev));
>
>        if (!new_valid_dev(rdev))
>                return -EINVAL;
> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
> index 0b5745e..73488fb 100644
> --- a/fs/9p/vfs_inode_dotl.c
> +++ b/fs/9p/vfs_inode_dotl.c
> @@ -283,13 +283,13 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        }
>
>        name = (char *) dentry->d_name.name;
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
> -                       "mode:0x%x\n", name, flags, omode);
> +       p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
> +                name, flags, omode);
>
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return err;
>        }
>
> @@ -297,7 +297,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        ofid = p9_client_walk(dfid, 0, NULL, 1);
>        if (IS_ERR(ofid)) {
>                err = PTR_ERR(ofid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                return err;
>        }
>
> @@ -307,16 +307,15 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in creat %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
> +                        err);
>                goto error;
>        }
>        err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
>                                    mode, gid, &qid);
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                               "p9_client_open_dotl failed in creat %d\n",
> -                               err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
> +                        err);
>                goto error;
>        }
>        v9fs_invalidate_inode_attr(dir);
> @@ -325,14 +324,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        fid = p9_client_walk(dfid, 1, &name, 1);
>        if (IS_ERR(fid)) {
>                err = PTR_ERR(fid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                fid = NULL;
>                goto error;
>        }
>        inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>        if (IS_ERR(inode)) {
>                err = PTR_ERR(inode);
> -               P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
>                goto error;
>        }
>        err = v9fs_fid_add(dentry, fid);
> @@ -408,7 +407,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        struct dentry *dir_dentry;
>        struct posix_acl *dacl = NULL, *pacl = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>        err = 0;
>        v9ses = v9fs_inode2v9ses(dir);
>
> @@ -420,7 +419,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        dfid = v9fs_fid_lookup(dir_dentry);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                dfid = NULL;
>                goto error;
>        }
> @@ -430,8 +429,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in mkdir %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n",
> +                        err);
>                goto error;
>        }
>        name = (char *) dentry->d_name.name;
> @@ -444,8 +443,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -453,8 +452,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -495,7 +494,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
>        struct p9_fid *fid;
>        struct p9_stat_dotl *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
> +       p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
>        err = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
> @@ -537,7 +536,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
>        struct p9_fid *fid;
>        struct p9_iattr_dotl p9attr;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        retval = inode_change_ok(dentry->d_inode, iattr);
>        if (retval)
> @@ -670,14 +669,13 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>        struct v9fs_session_info *v9ses;
>
>        name = (char *) dentry->d_name.name;
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
> -                       dir->i_ino, name, symname);
> +       p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
>        v9ses = v9fs_inode2v9ses(dir);
>
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return err;
>        }
>
> @@ -687,7 +685,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>        err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid);
>
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
>                goto error;
>        }
>
> @@ -697,8 +695,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                                       err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -707,8 +705,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                                       err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -751,9 +749,8 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
>        struct p9_fid *dfid, *oldfid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
> -                       dir->i_ino, old_dentry->d_name.name,
> -                       dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
> +                dir->i_ino, old_dentry->d_name.name, dentry->d_name.name);
>
>        v9ses = v9fs_inode2v9ses(dir);
>        dir_dentry = v9fs_dentry_from_dir_inode(dir);
> @@ -770,7 +767,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
>        err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
>
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
>                return err;
>        }
>
> @@ -813,9 +810,9 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        struct dentry *dir_dentry;
>        struct posix_acl *dacl = NULL, *pacl = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
> -               dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev));
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
> +                dir->i_ino, dentry->d_name.name, omode,
> +                MAJOR(rdev), MINOR(rdev));
>
>        if (!new_valid_dev(rdev))
>                return -EINVAL;
> @@ -825,7 +822,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        dfid = v9fs_fid_lookup(dir_dentry);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                dfid = NULL;
>                goto error;
>        }
> @@ -835,8 +832,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in mknod %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
> +                        err);
>                goto error;
>        }
>        name = (char *) dentry->d_name.name;
> @@ -851,8 +848,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -860,8 +857,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -905,7 +902,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
>        char *link = __getname();
>        char *target;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
>
>        if (!link) {
>                link = ERR_PTR(-ENOMEM);
> diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
> index c70251d..06d19735 100644
> --- a/fs/9p/vfs_super.c
> +++ b/fs/9p/vfs_super.c
> @@ -121,7 +121,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
>        struct p9_fid *fid;
>        int retval = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " \n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
>        if (!v9ses)
> @@ -191,7 +191,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
>                goto release_sb;
>        v9fs_fid_add(root, fid);
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
> +       p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
>        return dget(sb->s_root);
>
>  clunk_fid:
> @@ -223,7 +223,7 @@ static void v9fs_kill_super(struct super_block *s)
>  {
>        struct v9fs_session_info *v9ses = s->s_fs_info;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
> +       p9_debug(P9_DEBUG_VFS, " %p\n", s);
>
>        kill_anon_super(s);
>
> @@ -231,7 +231,7 @@ static void v9fs_kill_super(struct super_block *s)
>        v9fs_session_close(v9ses);
>        kfree(v9ses);
>        s->s_fs_info = NULL;
> -       P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
> +       p9_debug(P9_DEBUG_VFS, "exiting kill_super\n");
>  }
>
>  static void
> @@ -303,7 +303,7 @@ static int v9fs_write_inode(struct inode *inode,
>         * send an fsync request to server irrespective of
>         * wbc->sync_mode.
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
> +       p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
>        v9inode = V9FS_I(inode);
>        if (!v9inode->writeback_fid)
>                return 0;
> @@ -326,7 +326,7 @@ static int v9fs_write_inode_dotl(struct inode *inode,
>         * send an fsync request to server irrespective of
>         * wbc->sync_mode.
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
> +       p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
>        v9inode = V9FS_I(inode);
>        if (!v9inode->writeback_fid)
>                return 0;
> diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
> index d288773..29653b7 100644
> --- a/fs/9p/xattr.c
> +++ b/fs/9p/xattr.c
> @@ -32,8 +32,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
>        attr_fid = p9_client_xattrwalk(fid, name, &attr_size);
>        if (IS_ERR(attr_fid)) {
>                retval = PTR_ERR(attr_fid);
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                       "p9_client_attrwalk failed %zd\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_attrwalk failed %zd\n",
> +                        retval);
>                attr_fid = NULL;
>                goto error;
>        }
> @@ -87,8 +87,8 @@ ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
>  {
>        struct p9_fid *fid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu\n",
> -               __func__, name, buffer_size);
> +       p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu\n",
> +                name, buffer_size);
>        fid = v9fs_fid_lookup(dentry);
>        if (IS_ERR(fid))
>                return PTR_ERR(fid);
> @@ -115,8 +115,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
>        int retval, msize, write_count;
>        struct p9_fid *fid = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu flags = %d\n",
> -               __func__, name, value_len, flags);
> +       p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
> +                name, value_len, flags);
>
>        fid = v9fs_fid_clone(dentry);
>        if (IS_ERR(fid)) {
> @@ -129,8 +129,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
>         */
>        retval = p9_client_xattrcreate(fid, name, value_len, flags);
>        if (retval < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                       "p9_client_xattrcreate failed %d\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
> +                        retval);
>                goto error;
>        }
>        msize = fid->clnt->msize;
> diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
> index 2d70b95..7184853 100644
> --- a/include/net/9p/9p.h
> +++ b/include/net/9p/9p.h
> @@ -63,30 +63,16 @@ enum p9_debug_flags {
>
>  #ifdef CONFIG_NET_9P_DEBUG
>  extern unsigned int p9_debug_level;
> -
> -#define P9_DPRINTK(level, format, arg...) \
> -do {  \
> -       if ((p9_debug_level & level) == level) {\
> -               if (level == P9_DEBUG_9P) \
> -                       printk(KERN_NOTICE "(%8.8d) " \
> -                       format , task_pid_nr(current) , ## arg); \
> -               else \
> -                       printk(KERN_NOTICE "-- %s (%d): " \
> -                       format , __func__, task_pid_nr(current) , ## arg); \
> -       } \
> -} while (0)
> -
> +__printf(3, 4)
> +void _p9_debug(enum p9_debug_flags level, const char *func,
> +              const char *fmt, ...);
> +#define p9_debug(level, fmt, ...)                      \
> +       _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
>  #else
> -#define P9_DPRINTK(level, format, arg...)  do { } while (0)
> +#define p9_debug(level, fmt, ...)                      \
> +       no_printk(fmt, ##__VA_ARGS__)
>  #endif
>
> -
> -#define P9_EPRINTK(level, format, arg...) \
> -do { \
> -       printk(level "9p: %s (%d): " \
> -               format , __func__, task_pid_nr(current), ## arg); \
> -} while (0)
> -
>  /**
>  * enum p9_msg_t - 9P message types
>  * @P9_TLERROR: not used
>
>
>

^ permalink raw reply

* [PATCH net-next 0/4] net: factorize flow dissector
From: Eric Dumazet @ 2011-11-28 15:20 UTC (permalink / raw)
  To: jhs-jkUAjuhPggJWk0Htik3J/w
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, chrisw-H+wXaHxf7aLQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Florian Westphal,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
	herbert-F6s6mLieUQo7FNHlEwC/lvQIK84fMopw,
	shemminger-ZtmgI6mnKB3QT0dZR+AlfA, Dan Siemon, David Miller
In-Reply-To: <1322226171.2403.14.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

Le vendredi 25 novembre 2011 à 14:02 +0100, Eric Dumazet a écrit :

> cls_flow is not complete, since it doesnt handle tunnels for example.
> 
> It calls a 'partial flow classifier' to find each needed element, one by
> one.
> (adding tunnel decap would need to perform this several time for each
> packet)
> 
> __skb_get_rxhash() is more tunnel aware, yet some protocols are still
> missing, for example IPPROTO_IPV6.
> 
> Instead of adding logic to both dissectors, we could have a central flow
> dissector, filling a temporary pivot structure with found elements (src
> addr, dst addr, ports, ...), going through tunnels encap if found.
> 
> Then net/sched/cls_flow.c could pick needed elems from this structure to
> compute the hash as specified in tc command :
> (for example : tc filter ...  flow hash keys proto-dst,dst ...)
> 
> (One dissector call per packet for any number of keys in the filter)
> 
> Same for net/sched/sch_sfb.c : Use the pivot structure and compute the
> two hashes (using two hashrnd values)
> 
> And __skb_get_rxhash() could use the same flow dissector, and pick (src
> addr, dst addr, ports) to compute skb->rxhash, and set skb->l4_rxhash if
> "ports" is not null.
> 

Here is a patch serie doing this factorization / cleanup.

[PATCH net-next 1/4] net: introduce skb_flow_dissect()
[PATCH net-next 2/4] net: use skb_flow_dissect() in __skb_get_rxhash()
[PATCH net-next 3/4] cls_flow: use skb_flow_dissect()
[PATCH net-next 4/4] sch_sfb: use skb_flow_dissect()

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

cumulative diffstat :
 include/net/flow_keys.h   |   15 +++
 net/core/Makefile         |    2 
 net/core/dev.c            |  124 ++----------------------
 net/core/flow_dissector.c |  130 ++++++++++++++++++++++++++
 net/ipv4/tcp.c            |    8 -
 net/sched/cls_flow.c      |  180 +++++++++---------------------------
 net/sched/sch_sfb.c       |   17 ++-
 7 files changed, 225 insertions(+), 251 deletions(-)



_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply

* [PATCH net-next 1/4] net: introduce skb_flow_dissect()
From: Eric Dumazet @ 2011-11-28 15:22 UTC (permalink / raw)
  To: David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, chrisw-H+wXaHxf7aLQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Florian Westphal,
	jhs-jkUAjuhPggJWk0Htik3J/w,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
	herbert-F6s6mLieUQo7FNHlEwC/lvQIK84fMopw, Stephen Hemminger,
	Dan Siemon

We use at least two flow dissectors in network stack, with known
limitations and code duplication.

Introduce skb_flow_dissect() to factorize this, highly inspired from
existing dissector from __skb_get_rxhash()

Note : We extensively use skb_header_pointer(), this permits us to not
touch skb at all.

Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 include/net/flow_keys.h   |   15 ++++
 net/core/Makefile         |    2 
 net/core/flow_dissector.c |  134 ++++++++++++++++++++++++++++++++++++
 3 files changed, 150 insertions(+), 1 deletion(-)

diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
new file mode 100644
index 0000000..7a61e21
--- /dev/null
+++ b/include/net/flow_keys.h
@@ -0,0 +1,15 @@
+#ifndef _NET_FLOW_KEYS_H
+#define _NET_FLOW_KEYS_H
+
+struct flow_keys {
+	__be32 src;
+	__be32 dst;
+	union {
+		__be32 ports;
+		__be16 port16[2];
+	};
+	u8 ip_proto;
+};
+
+extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
+#endif
diff --git a/net/core/Makefile b/net/core/Makefile
index 3606d40..c4ecc86 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -3,7 +3,7 @@
 #
 
 obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
-	 gen_stats.o gen_estimator.o net_namespace.o secure_seq.o
+	 gen_stats.o gen_estimator.o net_namespace.o secure_seq.o flow_dissector.o
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
new file mode 100644
index 0000000..d0e085b
--- /dev/null
+++ b/net/core/flow_dissector.c
@@ -0,0 +1,134 @@
+#include <linux/skbuff.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/if_vlan.h>
+#include <net/ip.h>
+#include <linux/if_tunnel.h>
+#include <linux/if_pppox.h>
+#include <linux/ppp_defs.h>
+#include <net/flow_keys.h>
+
+
+bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
+{
+	int poff, nhoff = skb_network_offset(skb);
+	u8 ip_proto;
+	u16 proto = skb->protocol;
+
+	memset(flow, 0, sizeof(*flow));
+
+again:
+	switch (proto) {
+	case __constant_htons(ETH_P_IP): {
+		const struct iphdr *iph;
+		struct iphdr _iph;
+ip:
+		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
+		if (!iph)
+			return false;
+
+		if (ip_is_fragment(iph))
+			ip_proto = 0;
+		else
+			ip_proto = iph->protocol;
+		flow->src = iph->saddr;
+		flow->dst = iph->daddr;
+		nhoff += iph->ihl * 4;
+		break;
+	}
+	case __constant_htons(ETH_P_IPV6): {
+		const struct ipv6hdr *iph;
+		struct ipv6hdr _iph;
+ipv6:
+		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
+		if (!iph)
+			return false;
+
+		ip_proto = iph->nexthdr;
+		flow->src = iph->saddr.s6_addr32[3];
+		flow->dst = iph->daddr.s6_addr32[3];
+		nhoff += sizeof(struct ipv6hdr);
+		break;
+	}
+	case __constant_htons(ETH_P_8021Q): {
+		const struct vlan_hdr *vlan;
+		struct vlan_hdr _vlan;
+
+		vlan = skb_header_pointer(skb, nhoff, sizeof(_vlan), &_vlan);
+		if (!vlan)
+			return false;
+
+		proto = vlan->h_vlan_encapsulated_proto;
+		nhoff += sizeof(*vlan);
+		goto again;
+	}
+	case __constant_htons(ETH_P_PPP_SES): {
+		struct {
+			struct pppoe_hdr hdr;
+			__be16 proto;
+		} *hdr, _hdr;
+		hdr = skb_header_pointer(skb, nhoff, sizeof(_hdr), &_hdr);
+		if (!hdr)
+			return false;
+		proto = hdr->proto;
+		nhoff += PPPOE_SES_HLEN;
+		switch (proto) {
+		case __constant_htons(PPP_IP):
+			goto ip;
+		case __constant_htons(PPP_IPV6):
+			goto ipv6;
+		default:
+			return false;
+		}
+	}
+	default:
+		return false;
+	}
+
+	switch (ip_proto) {
+	case IPPROTO_GRE: {
+		struct gre_hdr {
+			__be16 flags;
+			__be16 proto;
+		} *hdr, _hdr;
+
+		hdr = skb_header_pointer(skb, nhoff, sizeof(_hdr), &_hdr);
+		if (!hdr)
+			return false;
+		/*
+		 * Only look inside GRE if version zero and no
+		 * routing
+		 */
+		if (!(hdr->flags & (GRE_VERSION|GRE_ROUTING))) {
+			proto = hdr->proto;
+			nhoff += 4;
+			if (hdr->flags & GRE_CSUM)
+				nhoff += 4;
+			if (hdr->flags & GRE_KEY)
+				nhoff += 4;
+			if (hdr->flags & GRE_SEQ)
+				nhoff += 4;
+			goto again;
+		}
+		break;
+	}
+	case IPPROTO_IPIP:
+		goto again;
+	default:
+		break;
+	}
+
+	flow->ip_proto = ip_proto;
+	poff = proto_ports_offset(ip_proto);
+	if (poff >= 0) {
+		__be32 *ports, _ports;
+
+		nhoff += poff;
+		ports = skb_header_pointer(skb, nhoff, sizeof(_ports), &_ports);
+		if (ports)
+			flow->ports = *ports;
+	}
+
+	return true;
+}
+EXPORT_SYMBOL(skb_flow_dissect);

^ permalink raw reply related

* [PATCH net-next 2/4] net: use skb_flow_dissect() in __skb_get_rxhash()
From: Eric Dumazet @ 2011-11-28 15:23 UTC (permalink / raw)
  To: David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, chrisw-H+wXaHxf7aLQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Florian Westphal,
	jhs-jkUAjuhPggJWk0Htik3J/w,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
	herbert-F6s6mLieUQo7FNHlEwC/lvQIK84fMopw, Stephen Hemminger,
	Dan Siemon

No functional changes.

This uses the code we factorized in skb_flow_dissect()

Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 net/core/dev.c |  125 +++++------------------------------------------
 1 file changed, 14 insertions(+), 111 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8afb244..962e3de 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -133,11 +133,9 @@
 #include <linux/pci.h>
 #include <linux/inetdevice.h>
 #include <linux/cpu_rmap.h>
-#include <linux/if_tunnel.h>
-#include <linux/if_pppox.h>
-#include <linux/ppp_defs.h>
 #include <linux/net_tstamp.h>
 #include <linux/jump_label.h>
+#include <net/flow_keys.h>
 
 #include "net-sysfs.h"
 
@@ -2598,123 +2596,28 @@ static inline void ____napi_schedule(struct softnet_data *sd,
  */
 void __skb_get_rxhash(struct sk_buff *skb)
 {
-	int nhoff, hash = 0, poff;
-	const struct ipv6hdr *ip6;
-	const struct iphdr *ip;
-	const struct vlan_hdr *vlan;
-	u8 ip_proto;
-	u32 addr1, addr2;
-	u16 proto;
-	union {
-		u32 v32;
-		u16 v16[2];
-	} ports;
-
-	nhoff = skb_network_offset(skb);
-	proto = skb->protocol;
-
-again:
-	switch (proto) {
-	case __constant_htons(ETH_P_IP):
-ip:
-		if (!pskb_may_pull(skb, sizeof(*ip) + nhoff))
-			goto done;
-
-		ip = (const struct iphdr *) (skb->data + nhoff);
-		if (ip_is_fragment(ip))
-			ip_proto = 0;
-		else
-			ip_proto = ip->protocol;
-		addr1 = (__force u32) ip->saddr;
-		addr2 = (__force u32) ip->daddr;
-		nhoff += ip->ihl * 4;
-		break;
-	case __constant_htons(ETH_P_IPV6):
-ipv6:
-		if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff))
-			goto done;
-
-		ip6 = (const struct ipv6hdr *) (skb->data + nhoff);
-		ip_proto = ip6->nexthdr;
-		addr1 = (__force u32) ip6->saddr.s6_addr32[3];
-		addr2 = (__force u32) ip6->daddr.s6_addr32[3];
-		nhoff += 40;
-		break;
-	case __constant_htons(ETH_P_8021Q):
-		if (!pskb_may_pull(skb, sizeof(*vlan) + nhoff))
-			goto done;
-		vlan = (const struct vlan_hdr *) (skb->data + nhoff);
-		proto = vlan->h_vlan_encapsulated_proto;
-		nhoff += sizeof(*vlan);
-		goto again;
-	case __constant_htons(ETH_P_PPP_SES):
-		if (!pskb_may_pull(skb, PPPOE_SES_HLEN + nhoff))
-			goto done;
-		proto = *((__be16 *) (skb->data + nhoff +
-				      sizeof(struct pppoe_hdr)));
-		nhoff += PPPOE_SES_HLEN;
-		switch (proto) {
-		case __constant_htons(PPP_IP):
-			goto ip;
-		case __constant_htons(PPP_IPV6):
-			goto ipv6;
-		default:
-			goto done;
-		}
-	default:
-		goto done;
-	}
-
-	switch (ip_proto) {
-	case IPPROTO_GRE:
-		if (pskb_may_pull(skb, nhoff + 16)) {
-			u8 *h = skb->data + nhoff;
-			__be16 flags = *(__be16 *)h;
+	struct flow_keys keys;
+	u32 hash;
 
-			/*
-			 * Only look inside GRE if version zero and no
-			 * routing
-			 */
-			if (!(flags & (GRE_VERSION|GRE_ROUTING))) {
-				proto = *(__be16 *)(h + 2);
-				nhoff += 4;
-				if (flags & GRE_CSUM)
-					nhoff += 4;
-				if (flags & GRE_KEY)
-					nhoff += 4;
-				if (flags & GRE_SEQ)
-					nhoff += 4;
-				goto again;
-			}
-		}
-		break;
-	case IPPROTO_IPIP:
-		goto again;
-	default:
-		break;
-	}
+	if (!skb_flow_dissect(skb, &keys))
+		return;
 
-	ports.v32 = 0;
-	poff = proto_ports_offset(ip_proto);
-	if (poff >= 0) {
-		nhoff += poff;
-		if (pskb_may_pull(skb, nhoff + 4)) {
-			ports.v32 = * (__force u32 *) (skb->data + nhoff);
-			if (ports.v16[1] < ports.v16[0])
-				swap(ports.v16[0], ports.v16[1]);
-			skb->l4_rxhash = 1;
-		}
+	if (keys.ports) {
+		if ((__force u16)keys.port16[1] < (__force u16)keys.port16[0])
+			swap(keys.port16[0], keys.port16[1]);
+		skb->l4_rxhash = 1;
 	}
 
 	/* get a consistent hash (same value on both flow directions) */
-	if (addr2 < addr1)
-		swap(addr1, addr2);
+	if ((__force u32)keys.dst < (__force u32)keys.src)
+		swap(keys.dst, keys.src);
 
-	hash = jhash_3words(addr1, addr2, ports.v32, hashrnd);
+	hash = jhash_3words((__force u32)keys.dst,
+			    (__force u32)keys.src,
+			    (__force u32)keys.ports, hashrnd);
 	if (!hash)
 		hash = 1;
 
-done:
 	skb->rxhash = hash;
 }
 EXPORT_SYMBOL(__skb_get_rxhash);

^ permalink raw reply related

* [PATCH net-next 3/4] cls_flow: use skb_flow_dissect()
From: Eric Dumazet @ 2011-11-28 15:24 UTC (permalink / raw)
  To: David Miller
  Cc: chrisw-H+wXaHxf7aLQT0dZR+AlfA, dev-yBygre7rU0TnMu66kgdUjQ, netdev,
	Florian Westphal, jhs-jkUAjuhPggJWk0Htik3J/w,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
	herbert-F6s6mLieUQo7FNHlEwC/lvQIK84fMopw, Stephen Hemminger,
	Dan Siemon

Instead of using a custom flow dissector, use skb_flow_dissect() and
benefit from tunnelling support.

This lack of tunnelling support was mentioned by Dan Siemon.

Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 net/sched/cls_flow.c |  180 ++++++++++-------------------------------
 1 file changed, 48 insertions(+), 132 deletions(-)

diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 7b58230..a120ec5 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -26,6 +26,8 @@
 #include <net/pkt_cls.h>
 #include <net/ip.h>
 #include <net/route.h>
+#include <net/flow_keys.h>
+
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 #include <net/netfilter/nf_conntrack.h>
 #endif
@@ -66,134 +68,37 @@ static inline u32 addr_fold(void *addr)
 	return (a & 0xFFFFFFFF) ^ (BITS_PER_LONG > 32 ? a >> 32 : 0);
 }
 
-static u32 flow_get_src(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_src(const struct sk_buff *skb, const struct flow_keys *flow)
 {
-	__be32 *data = NULL, hdata;
-
-	switch (skb->protocol) {
-	case htons(ETH_P_IP):
-		data = skb_header_pointer(skb,
-					  nhoff + offsetof(struct iphdr,
-							   saddr),
-					  4, &hdata);
-		break;
-	case htons(ETH_P_IPV6):
-		data = skb_header_pointer(skb,
-					 nhoff + offsetof(struct ipv6hdr,
-							  saddr.s6_addr32[3]),
-					 4, &hdata);
-		break;
-	}
-
-	if (data)
-		return ntohl(*data);
+	if (flow->src)
+		return ntohl(flow->src);
 	return addr_fold(skb->sk);
 }
 
-static u32 flow_get_dst(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow)
 {
-	__be32 *data = NULL, hdata;
-
-	switch (skb->protocol) {
-	case htons(ETH_P_IP):
-		data = skb_header_pointer(skb,
-					  nhoff + offsetof(struct iphdr,
-							   daddr),
-					  4, &hdata);
-		break;
-	case htons(ETH_P_IPV6):
-		data = skb_header_pointer(skb,
-					 nhoff + offsetof(struct ipv6hdr,
-							  daddr.s6_addr32[3]),
-					 4, &hdata);
-		break;
-	}
-
-	if (data)
-		return ntohl(*data);
+	if (flow->dst)
+		return ntohl(flow->dst);
 	return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol;
 }
 
-static u32 flow_get_proto(const struct sk_buff *skb, int nhoff)
-{
-	__u8 *data = NULL, hdata;
-
-	switch (skb->protocol) {
-	case htons(ETH_P_IP):
-		data = skb_header_pointer(skb,
-					  nhoff + offsetof(struct iphdr,
-							   protocol),
-					  1, &hdata);
-		break;
-	case htons(ETH_P_IPV6):
-		data = skb_header_pointer(skb,
-					 nhoff + offsetof(struct ipv6hdr,
-							  nexthdr),
-					 1, &hdata);
-		break;
-	}
-	if (data)
-		return *data;
-	return 0;
-}
-
-/* helper function to get either src or dst port */
-static __be16 *flow_get_proto_common(const struct sk_buff *skb, int nhoff,
-				     __be16 *_port, int dst)
+static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow)
 {
-	__be16 *port = NULL;
-	int poff;
-
-	switch (skb->protocol) {
-	case htons(ETH_P_IP): {
-		struct iphdr *iph, _iph;
-
-		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
-		if (!iph)
-			break;
-		if (ip_is_fragment(iph))
-			break;
-		poff = proto_ports_offset(iph->protocol);
-		if (poff >= 0)
-			port = skb_header_pointer(skb,
-					nhoff + iph->ihl * 4 + poff + dst,
-					sizeof(*_port), _port);
-		break;
-	}
-	case htons(ETH_P_IPV6): {
-		struct ipv6hdr *iph, _iph;
-
-		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
-		if (!iph)
-			break;
-		poff = proto_ports_offset(iph->nexthdr);
-		if (poff >= 0)
-			port = skb_header_pointer(skb,
-					nhoff + sizeof(*iph) + poff + dst,
-					sizeof(*_port), _port);
-		break;
-	}
-	}
-
-	return port;
+	return flow->ip_proto;
 }
 
-static u32 flow_get_proto_src(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_proto_src(const struct sk_buff *skb, const struct flow_keys *flow)
 {
-	__be16 _port, *port = flow_get_proto_common(skb, nhoff, &_port, 0);
-
-	if (port)
-		return ntohs(*port);
+	if (flow->ports)
+		return ntohs(flow->port16[0]);
 
 	return addr_fold(skb->sk);
 }
 
-static u32 flow_get_proto_dst(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_proto_dst(const struct sk_buff *skb, const struct flow_keys *flow)
 {
-	__be16 _port, *port = flow_get_proto_common(skb, nhoff, &_port, 2);
-
-	if (port)
-		return ntohs(*port);
+	if (flow->ports)
+		return ntohs(flow->port16[1]);
 
 	return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol;
 }
@@ -239,7 +144,7 @@ static u32 flow_get_nfct(const struct sk_buff *skb)
 })
 #endif
 
-static u32 flow_get_nfct_src(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow)
 {
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
@@ -248,10 +153,10 @@ static u32 flow_get_nfct_src(const struct sk_buff *skb, int nhoff)
 		return ntohl(CTTUPLE(skb, src.u3.ip6[3]));
 	}
 fallback:
-	return flow_get_src(skb, nhoff);
+	return flow_get_src(skb, flow);
 }
 
-static u32 flow_get_nfct_dst(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow)
 {
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
@@ -260,21 +165,21 @@ static u32 flow_get_nfct_dst(const struct sk_buff *skb, int nhoff)
 		return ntohl(CTTUPLE(skb, dst.u3.ip6[3]));
 	}
 fallback:
-	return flow_get_dst(skb, nhoff);
+	return flow_get_dst(skb, flow);
 }
 
-static u32 flow_get_nfct_proto_src(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_nfct_proto_src(const struct sk_buff *skb, const struct flow_keys *flow)
 {
 	return ntohs(CTTUPLE(skb, src.u.all));
 fallback:
-	return flow_get_proto_src(skb, nhoff);
+	return flow_get_proto_src(skb, flow);
 }
 
-static u32 flow_get_nfct_proto_dst(const struct sk_buff *skb, int nhoff)
+static u32 flow_get_nfct_proto_dst(const struct sk_buff *skb, const struct flow_keys *flow)
 {
 	return ntohs(CTTUPLE(skb, dst.u.all));
 fallback:
-	return flow_get_proto_dst(skb, nhoff);
+	return flow_get_proto_dst(skb, flow);
 }
 
 static u32 flow_get_rtclassid(const struct sk_buff *skb)
@@ -314,21 +219,19 @@ static u32 flow_get_rxhash(struct sk_buff *skb)
 	return skb_get_rxhash(skb);
 }
 
-static u32 flow_key_get(struct sk_buff *skb, int key)
+static u32 flow_key_get(struct sk_buff *skb, int key, struct flow_keys *flow)
 {
-	int nhoff = skb_network_offset(skb);
-
 	switch (key) {
 	case FLOW_KEY_SRC:
-		return flow_get_src(skb, nhoff);
+		return flow_get_src(skb, flow);
 	case FLOW_KEY_DST:
-		return flow_get_dst(skb, nhoff);
+		return flow_get_dst(skb, flow);
 	case FLOW_KEY_PROTO:
-		return flow_get_proto(skb, nhoff);
+		return flow_get_proto(skb, flow);
 	case FLOW_KEY_PROTO_SRC:
-		return flow_get_proto_src(skb, nhoff);
+		return flow_get_proto_src(skb, flow);
 	case FLOW_KEY_PROTO_DST:
-		return flow_get_proto_dst(skb, nhoff);
+		return flow_get_proto_dst(skb, flow);
 	case FLOW_KEY_IIF:
 		return flow_get_iif(skb);
 	case FLOW_KEY_PRIORITY:
@@ -338,13 +241,13 @@ static u32 flow_key_get(struct sk_buff *skb, int key)
 	case FLOW_KEY_NFCT:
 		return flow_get_nfct(skb);
 	case FLOW_KEY_NFCT_SRC:
-		return flow_get_nfct_src(skb, nhoff);
+		return flow_get_nfct_src(skb, flow);
 	case FLOW_KEY_NFCT_DST:
-		return flow_get_nfct_dst(skb, nhoff);
+		return flow_get_nfct_dst(skb, flow);
 	case FLOW_KEY_NFCT_PROTO_SRC:
-		return flow_get_nfct_proto_src(skb, nhoff);
+		return flow_get_nfct_proto_src(skb, flow);
 	case FLOW_KEY_NFCT_PROTO_DST:
-		return flow_get_nfct_proto_dst(skb, nhoff);
+		return flow_get_nfct_proto_dst(skb, flow);
 	case FLOW_KEY_RTCLASSID:
 		return flow_get_rtclassid(skb);
 	case FLOW_KEY_SKUID:
@@ -361,6 +264,16 @@ static u32 flow_key_get(struct sk_buff *skb, int key)
 	}
 }
 
+#define FLOW_KEYS_NEEDED ((1 << FLOW_KEY_SRC) | 		\
+			  (1 << FLOW_KEY_DST) |			\
+			  (1 << FLOW_KEY_PROTO) |		\
+			  (1 << FLOW_KEY_PROTO_SRC) |		\
+			  (1 << FLOW_KEY_PROTO_DST) | 		\
+			  (1 << FLOW_KEY_NFCT_SRC) |		\
+			  (1 << FLOW_KEY_NFCT_DST) |		\
+			  (1 << FLOW_KEY_NFCT_PROTO_SRC) |	\
+			  (1 << FLOW_KEY_NFCT_PROTO_DST))
+ 
 static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 			 struct tcf_result *res)
 {
@@ -373,16 +286,19 @@ static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 
 	list_for_each_entry(f, &head->filters, list) {
 		u32 keys[f->nkeys];
+		struct flow_keys flow_keys;
 
 		if (!tcf_em_tree_match(skb, &f->ematches, NULL))
 			continue;
 
 		keymask = f->keymask;
+		if (keymask & FLOW_KEYS_NEEDED)
+			skb_flow_dissect(skb, &flow_keys);
 
 		for (n = 0; n < f->nkeys; n++) {
 			key = ffs(keymask) - 1;
 			keymask &= ~(1 << key);
-			keys[n] = flow_key_get(skb, key);
+			keys[n] = flow_key_get(skb, key, &flow_keys);
 		}
 
 		if (f->mode == FLOW_MODE_HASH)

^ permalink raw reply related

* [PATCH net-next 4/4] sch_sfb: use skb_flow_dissect()
From: Eric Dumazet @ 2011-11-28 15:25 UTC (permalink / raw)
  To: David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, Dan Siemon, netdev, Florian Westphal,
	jhs-jkUAjuhPggJWk0Htik3J/w,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w,
	herbert-F6s6mLieUQo7FNHlEwC/lvQIK84fMopw,
	chrisw-H+wXaHxf7aLQT0dZR+AlfA, Stephen Hemminger

Current SFB double hashing is not fulfilling SFB theory, if two flows
share same rxhash value.

Using skb_flow_dissect() permits to really have better hash dispersion,
and get tunnelling support as well.

Double hashing point was mentioned by Florian Westphal

Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 net/sched/sch_sfb.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index e83c272..96e42ca 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -26,6 +26,7 @@
 #include <net/ip.h>
 #include <net/pkt_sched.h>
 #include <net/inet_ecn.h>
+#include <net/flow_keys.h>
 
 /*
  * SFB uses two B[l][n] : L x N arrays of bins (L levels, N bins per level)
@@ -286,6 +287,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 	u32 minqlen = ~0;
 	u32 r, slot, salt, sfbhash;
 	int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
+	struct flow_keys keys;
 
 	if (unlikely(sch->q.qlen >= q->limit)) {
 		sch->qstats.overlimits++;
@@ -309,13 +311,19 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 		/* If using external classifiers, get result and record it. */
 		if (!sfb_classify(skb, q, &ret, &salt))
 			goto other_drop;
+		keys.src = salt;
+		keys.dst = 0;
+		keys.ports = 0;
 	} else {
-		salt = skb_get_rxhash(skb);
+		skb_flow_dissect(skb, &keys);
 	}
 
 	slot = q->slot;
 
-	sfbhash = jhash_1word(salt, q->bins[slot].perturbation);
+	sfbhash = jhash_3words((__force u32)keys.dst,
+			       (__force u32)keys.src,
+			       (__force u32)keys.ports,
+			       q->bins[slot].perturbation);
 	if (!sfbhash)
 		sfbhash = 1;
 	sfb_skb_cb(skb)->hashes[slot] = sfbhash;
@@ -347,7 +355,10 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 	if (unlikely(p_min >= SFB_MAX_PROB)) {
 		/* Inelastic flow */
 		if (q->double_buffering) {
-			sfbhash = jhash_1word(salt, q->bins[slot].perturbation);
+			sfbhash = jhash_3words((__force u32)keys.dst,
+					       (__force u32)keys.src,
+					       (__force u32)keys.ports,
+					       q->bins[slot].perturbation);
 			if (!sfbhash)
 				sfbhash = 1;
 			sfb_skb_cb(skb)->hashes[slot] = sfbhash;

^ permalink raw reply related

* Re: [GIT PULL v2] Open vSwitch
From: Martin Casado @ 2011-11-28 15:27 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	Herbert Xu, David Miller
In-Reply-To: <1322488954.7338.66.camel@mojatatu>


>> However, what's more worrying for me right now is the gaping
>> DoS opportunities that exist in the patch as is.
>>
>> In particular, the whole design principle of punting all new
>> flows to user-space is an excellent way of attacking the system.
> Indeed this is an issue with openflow in general.
> The general solution is to rate limit how much goes to the controller
> but even that is insufficient.
>
This is a common misunderstanding about OpenFlow.  It does not require 
the first packet of each flow to go to the controller.  In fact, no 
production system I'm aware of does this.  Generally OpenFlow-based 
solutions targeted at large environments (e.g. data center, or WAN)  
send only traditional control traffic to the controller (e.g. BGP or 
OSPF), or none at all.
.martin

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Casado
Nicira Networks, Inc.
www.nicira.com
cell: 650-776-1457
~~~~~~~~~~~~~~~~~~~~~~~~~~~

^ permalink raw reply

* Re: [PATCH 54/62] rds: remove the second argument of k[un]map_atomic()
From: Venkat Venkatsubra @ 2011-11-28 15:28 UTC (permalink / raw)
  To: davem; +Cc: netdev, rds-devel, akpm, linux-kernel, amwang

From: Cong Wang <amwang@redhat.com>
Date: Sun, 27 Nov 2011 13:27:34 +0800

> Signed-off-by: Cong Wang <amwang@redhat.com>

Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>

^ permalink raw reply

* Re: ebtables on a stick
From: David Lamparter @ 2011-11-28 15:30 UTC (permalink / raw)
  To: Greg Scott; +Cc: David Lamparter, netdev
In-Reply-To: <925A849792280C4E80C5461017A4B8A2A0488A@mail733.InfraSupportEtc.com>

On Mon, Nov 28, 2011 at 08:54:09AM -0600, Greg Scott wrote:
> > This doesn't answer your question, but your use case is better solved
> > with proxy arp.
>
> ...But maybe there's a way to make my NIC only answer ARPs for certain IP Addresses I care about?  That would nicely solve the problem.  If it works.  

"ip neigh add proxy 1.2.3.4 dev eth0". Please look at the example i gave
you.

> In my earlier near-disaster, I did this:
> 
> echo 1 > /proc/sys/net/ipv4/conf/${INET_IFACE}/proxy_arp

NO. You do not touch this switch. Be afraid of this switch.

The instructions i gave you are complete. This switch is not involved.

> to turn on proxy arp.  I wonder if that ip neighbor stuff does it selectively?  

We already had this discussion in July.

"ip neigh add proxy" is independent of /proc/.../proxy_arp.


-David

^ 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