Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 01/11] selftests: Adjust spectrum-2 two_mask_test
From: Ido Schimmel @ 2018-11-14  8:22 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: davem@davemloft.net, Jiri Pirko, mlxsw, Ido Schimmel
In-Reply-To: <20181114082138.14284-1-idosch@mellanox.com>

From: Jiri Pirko <jiri@mellanox.com>

In order for this to behave as required with delta bits, change the mask
for rule with handle 103.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
index 3b75180f455d..6b96eb6f6e74 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
@@ -142,7 +142,7 @@ two_masks_test()
 	tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
 		$tcflags dst_ip 192.0.2.2 action drop
 	tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
-		$tcflags dst_ip 192.0.0.0/16 action drop
+		$tcflags dst_ip 192.0.0.0/8 action drop
 
 	$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
 		-t ip -q
-- 
2.19.1

^ permalink raw reply related

* [PATCH net-next 00/11] mlxsw: spectrum: acl: Introduce ERP sharing by multiple masks
From: Ido Schimmel @ 2018-11-14  8:22 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: davem@davemloft.net, Jiri Pirko, mlxsw, Ido Schimmel

Jiri says:

The Spectrum-2 hardware has limitation number of ERPs per-region. In
order to accommodate more masks than number of ERPs, the hardware
supports to insert rules with delta bits. By that, the rules with masks
that differ in up-to 8 consecutive bits can share the same ERP.

Patches 1 and 2 fix couple of issues that would appear in existing
selftests after adding delta support

Patch 3 introduces a generic object aggregation library. Now it is
static, but it will get extended for recalculation of aggregations in
the future in order to reach more optimal aggregation.

Patch 4 just simply converts existing ERP code to use the objagg library
instead of a rhashtable.

Patches 5-9 do more or less small changes to prepare ground for the last
patch.

Patch 10 fills-up delta callbacks of objagg library and utilizes the
delta bits for rule insertion.

The last patch adds selftest to test the mlxsw Spectrum-2 delta flows.

Jiri Pirko (11):
  selftests: Adjust spectrum-2 two_mask_test
  selftests: Adjust spectrum-2 ctcam_two_atcam_masks_test
  lib: introduce initial implementation of object aggregation manager
  mlxsw: spectrum: acl_erp: Convert to use objagg for tracking ERPs
  mlxsw: spectrum: acl: Pass key pointer to master_mask_set/clear
  mlxsw: core_acl: Change order of args of ops->encode_block()
  mlxsw: spectrum: acl: Don't encode the key again in
    mlxsw_sp_acl_atcam_12kb_lkey_id_get()
  mlxsw: spectrum: acl: Remove mlxsw_afk_encode() block range args and
    key/mask check
  mlxsw: spectrum: acl: Push code related to num_ctcam_erps inc/dec into
    separate helpers
  mlxsw: spectrum: acl: Implement delta for ERP
  selftests: mlxsw: spectrum-2: Add simple delta test

 MAINTAINERS                                   |   8 +
 drivers/net/ethernet/mellanox/mlxsw/Kconfig   |   1 +
 .../mellanox/mlxsw/core_acl_flex_keys.c       |  22 +-
 .../mellanox/mlxsw/core_acl_flex_keys.h       |   7 +-
 drivers/net/ethernet/mellanox/mlxsw/reg.h     |   8 +-
 .../mellanox/mlxsw/spectrum2_acl_tcam.c       |  12 +-
 .../mellanox/mlxsw/spectrum_acl_atcam.c       |  75 +-
 .../mellanox/mlxsw/spectrum_acl_ctcam.c       |   5 +-
 .../mellanox/mlxsw/spectrum_acl_erp.c         | 454 +++++++---
 .../mellanox/mlxsw/spectrum_acl_flex_keys.c   |  32 +-
 .../mellanox/mlxsw/spectrum_acl_tcam.h        |  42 +-
 include/linux/objagg.h                        |  46 +
 include/trace/events/objagg.h                 | 228 +++++
 lib/Kconfig                                   |   3 +
 lib/Kconfig.debug                             |  10 +
 lib/Makefile                                  |   2 +
 lib/objagg.c                                  | 501 +++++++++++
 lib/test_objagg.c                             | 835 ++++++++++++++++++
 .../drivers/net/mlxsw/spectrum-2/tc_flower.sh |  86 +-
 19 files changed, 2184 insertions(+), 193 deletions(-)
 create mode 100644 include/linux/objagg.h
 create mode 100644 include/trace/events/objagg.h
 create mode 100644 lib/objagg.c
 create mode 100644 lib/test_objagg.c

-- 
2.19.1

^ permalink raw reply

* af_xdp zero copy ideas
From: Michael S. Tsirkin @ 2018-11-14  8:10 UTC (permalink / raw)
  To: bjorn.topel; +Cc: netdev
In-Reply-To: <20180604120601.18123-1-bjorn.topel@gmail.com>

So a I mentioned during the presentation for the af_xdp zero copy I
think it's pretty important to be able to close the device and get back
the affected memory. One way would be to unmap the DMA memory from
userspace and map in some other memory. It's tricky since you need
to also replace the mapping to the backing file which could be
hugetlbfs, tmpfs, just a file ...

HTH,

-- 
MST

^ permalink raw reply

* Re: [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX
From: Andy Gross @ 2018-11-14 18:02 UTC (permalink / raw)
  To: Arun Kumar Neelakantam
  Cc: davem, bjorn.andersson, clew, netdev, linux-kernel, linux-arm-msm,
	fw, hannes, dvlasenk, nicolas.dechesne, David Brown,
	open list:ARM/QUALCOMM SUPPORT
In-Reply-To: <1538545205-17939-1-git-send-email-aneela@codeaurora.org>

On Wed, Oct 03, 2018 at 11:10:02AM +0530, Arun Kumar Neelakantam wrote:
> Txn IDs created up to INT_MAX cause overflow while storing
> the IDs in u16 type supported by QMI header.
> 
> Limit the txn IDs max value to U16_MAX to avoid overflow.
> 
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
> ---

Thanks for sending this in.  I'll queue it up.


Andy

^ permalink raw reply

* [PATCH bpf] bpf: allocate local storage buffers using GFP_ATOMIC
From: Roman Gushchin @ 2018-11-14 18:00 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel-team, Roman Gushchin, Alexei Starovoitov,
	Daniel Borkmann

Naresh reported an issue with the non-atomic memory allocation of
cgroup local storage buffers:

[   73.047526] BUG: sleeping function called from invalid context at
/srv/oe/build/tmp-rpb-glibc/work-shared/intel-corei7-64/kernel-source/mm/slab.h:421
[   73.060915] in_atomic(): 1, irqs_disabled(): 0, pid: 3157, name: test_cgroup_sto
[   73.068342] INFO: lockdep is turned off.
[   73.072293] CPU: 2 PID: 3157 Comm: test_cgroup_sto Not tainted
4.20.0-rc2-next-20181113 #1
[   73.080548] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS
2.0b 07/27/2017
[   73.088018] Call Trace:
[   73.090463]  dump_stack+0x70/0xa5
[   73.093783]  ___might_sleep+0x152/0x240
[   73.097619]  __might_sleep+0x4a/0x80
[   73.101191]  __kmalloc_node+0x1cf/0x2f0
[   73.105031]  ? cgroup_storage_update_elem+0x46/0x90
[   73.109909]  cgroup_storage_update_elem+0x46/0x90

cgroup_storage_update_elem() (as well as other update map update
callbacks) is called with disabled preemption, so GFP_ATOMIC
allocation should be used: e.g. alloc_htab_elem() in hashtab.c.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
---
 kernel/bpf/local_storage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c
index c97a8f968638..bed9d48a7ae9 100644
--- a/kernel/bpf/local_storage.c
+++ b/kernel/bpf/local_storage.c
@@ -139,7 +139,8 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key,
 		return -ENOENT;
 
 	new = kmalloc_node(sizeof(struct bpf_storage_buffer) +
-			   map->value_size, __GFP_ZERO | GFP_USER,
+			   map->value_size,
+			   __GFP_ZERO | GFP_ATOMIC | __GFP_NOWARN,
 			   map->numa_node);
 	if (!new)
 		return -ENOMEM;
-- 
2.17.2

^ permalink raw reply related

* Re: [PATCH v2 net-next 19/21] net: usb: aqc111: Add support for wake on LAN by MAGIC packet
From: Igor Russkikh @ 2018-11-14  7:56 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S . Miller, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org, Dmitry Bezrukov
In-Reply-To: <20181113210241.GC9828@lunn.ch>


>> +
>> +		if (aqc111_data->dpa) {
>> +			aqc111_set_phy_speed(dev, AUTONEG_ENABLE, SPEED_100);
> 
> So this is better, you leave auto-neg enabled. But you really should
> be taking the link partners capabilities into account.

We've considered that, but then thought about the following case:

After such a sleep state where partner's capabilities were considered,
user may move with the unit and replug it into different link partner with
other, incompatible speed mask. That will anyway lead to wol link failure.

In that sense it may be better to just select the most widely available
100M low power speed and don't do any intelligence here?

Regards,
  Igor

^ permalink raw reply

* Re: [PATCH v2 net-next 18/21] net: usb: aqc111: Implement get/set_link_ksettings callbacks
From: Igor Russkikh @ 2018-11-14  7:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S . Miller, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org, Dmitry Bezrukov
In-Reply-To: <20181113205041.GA9828@lunn.ch>


>> +	if (usb_speed == USB_SPEED_SUPER) {
>> +		ethtool_link_ksettings_add_link_mode(elk, supported,
>> +						     2500baseT_Full);
>> +		ethtool_link_ksettings_add_link_mode(elk, supported,
>> +						     5000baseT_Full);
>> +	}
> 
> Hi Igor
> 
> We discussed this with the first version of the patches. I think you
> should add a comment explaining why 2.5G and 5G is disabled unless
> Super speed is available.

Right, I've explained that to you but forgot to add a comment here.

>> +	if (aqc111_data->autoneg)
>> +		bitmap_copy(elk->link_modes.advertising,
>> +			    elk->link_modes.supported,
>> +			    __ETHTOOL_LINK_MODE_MASK_NBITS);
> 
> linkmode_copy(). It is quite new, so you probably don't know about it.

Ok,

Regards,
  Igor

^ permalink raw reply

* Re: [PATCH v2 net-next 06/21] net: usb: aqc111: Introduce link management
From: Igor Russkikh @ 2018-11-14  7:44 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S . Miller, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org, Dmitry Bezrukov
In-Reply-To: <20181113205845.GB9828@lunn.ch>

>>
>> Add full hardware initialization sequence and link configuration logic
> 
> Hi Igor
> 
> I'm still not convinced the PHY driver should be embedded in the MAC
> driver, rather than using phylink.
> 
> If i remember correctly, it was because the MAC is involved in
> determining if the link is up? That is nothing new. phylink expects
> this. The MAC driver should call phylink_mac_change() when the MACs
> SERDES goes up/down.

Hi Andrew,

I'm actually still in doubt as well on this matter.
Of course thats quite possible.

Here was my original comment:

> Thats again because of this product has tightly integrated MAC+Phy.
> MAC FW controls system interface and reports/alters link state
> as a joint state on copper and SIF (even in dpa direct phy mode).
> 
> We can't extract phy api into a standalone fully functional phylib therefore.
> Also as far as I know this particular phy is not available in the wild.

So the point is that MAC firmware is managing SERDES and system interface link.
Even if we cut out phy stuff into a separate phylink driver - that driver will
never be functional in standalone mode, without aqc111 mac driver.

It only may make sense from software decomposition perspective - to separate pieces of
phy code.

We'll discuss and reconsider this internally and will give you more comments,

Thanks,
  Igor

^ permalink raw reply

* Re: [PATCH net-next 01/10] udp: implement complete book-keeping for encap_needed
From: Eric Dumazet @ 2018-11-14  7:08 UTC (permalink / raw)
  To: Paolo Abeni, netdev
  Cc: David S. Miller, Willem de Bruijn, Steffen Klassert,
	Subash Abhinov Kasiviswanathan
In-Reply-To: <7690feb3a9d55edf3fffe16f5710fa374a3c03ca.1541588248.git.pabeni@redhat.com>



On 11/07/2018 03:38 AM, Paolo Abeni wrote:
> The *encap_needed static keys are enabled by UDP tunnels
> and several UDP encapsulations type, but they are never
> turned off. This can cause unneeded overall performance
> degradation for systems where such features are used
> transiently.
> 
> This patch introduces complete book-keeping for such keys,
> decreasing the usage at socket destruction time, if needed,
> and avoiding that the same socket could increase the key
> usage multiple times.
> 
> rfc v3 -> v1:
>  - add socket lock around udp_tunnel_encap_enable()
> 
> rfc v2 -> rfc v3:
>  - use udp_tunnel_encap_enable() in setsockopt()
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  include/linux/udp.h      |  7 ++++++-
>  include/net/udp_tunnel.h |  6 ++++++
>  net/ipv4/udp.c           | 19 +++++++++++++------
>  net/ipv6/udp.c           | 14 +++++++++-----
>  4 files changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/udp.h b/include/linux/udp.h
> index 320d49d85484..a4dafff407fb 100644
> --- a/include/linux/udp.h
> +++ b/include/linux/udp.h
> @@ -49,7 +49,12 @@ struct udp_sock {
>  	unsigned int	 corkflag;	/* Cork is required */
>  	__u8		 encap_type;	/* Is this an Encapsulation socket? */
>  	unsigned char	 no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
> -			 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */
> +			 no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
> +			 encap_enabled:1; /* This socket enabled encap
> +					   * processing; UDP tunnels and
> +					   * different encapsulation layer set
> +					   * this
> +					   */
>  	/*
>  	 * Following member retains the information to create a UDP header
>  	 * when the socket is uncorked.
> diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
> index fe680ab6b15a..3fbe56430e3b 100644
> --- a/include/net/udp_tunnel.h
> +++ b/include/net/udp_tunnel.h
> @@ -165,6 +165,12 @@ static inline int udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum)
>  
>  static inline void udp_tunnel_encap_enable(struct socket *sock)
>  {
> +	struct udp_sock *up = udp_sk(sock->sk);
> +
> +	if (up->encap_enabled)
> +		return;
> +
> +	up->encap_enabled = 1;
>  #if IS_ENABLED(CONFIG_IPV6)
>  	if (sock->sk->sk_family == PF_INET6)
>  		ipv6_stub->udpv6_encap_enable();
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 1976fddb9e00..0ed715a72249 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -115,6 +115,7 @@
>  #include "udp_impl.h"
>  #include <net/sock_reuseport.h>
>  #include <net/addrconf.h>
> +#include <net/udp_tunnel.h>
>  
>  struct udp_table udp_table __read_mostly;
>  EXPORT_SYMBOL(udp_table);
> @@ -2398,11 +2399,15 @@ void udp_destroy_sock(struct sock *sk)
>  	bool slow = lock_sock_fast(sk);
>  	udp_flush_pending_frames(sk);
>  	unlock_sock_fast(sk, slow);
> -	if (static_branch_unlikely(&udp_encap_needed_key) && up->encap_type) {
> -		void (*encap_destroy)(struct sock *sk);
> -		encap_destroy = READ_ONCE(up->encap_destroy);
> -		if (encap_destroy)
> -			encap_destroy(sk);
> +	if (static_branch_unlikely(&udp_encap_needed_key)) {
> +		if (up->encap_type) {
> +			void (*encap_destroy)(struct sock *sk);
> +			encap_destroy = READ_ONCE(up->encap_destroy);
> +			if (encap_destroy)
> +				encap_destroy(sk);
> +		}
> +		if (up->encap_enabled)
> +			static_branch_disable(&udp_encap_needed_key);
>  	}
>  }
>  
> @@ -2447,7 +2452,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
>  			/* FALLTHROUGH */
>  		case UDP_ENCAP_L2TPINUDP:
>  			up->encap_type = val;
> -			udp_encap_enable();
> +			lock_sock(sk);
> +			udp_tunnel_encap_enable(sk->sk_socket);
> +			release_sock(sk);
>  			break;
>  		default:
>  			err = -ENOPROTOOPT;
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index d2d97d07ef27..fc0ce6c59ebb 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1458,11 +1458,15 @@ void udpv6_destroy_sock(struct sock *sk)
>  	udp_v6_flush_pending_frames(sk);
>  	release_sock(sk);
>  
> -	if (static_branch_unlikely(&udpv6_encap_needed_key) && up->encap_type) {
> -		void (*encap_destroy)(struct sock *sk);
> -		encap_destroy = READ_ONCE(up->encap_destroy);
> -		if (encap_destroy)
> -			encap_destroy(sk);
> +	if (static_branch_unlikely(&udpv6_encap_needed_key)) {
> +		if (up->encap_type) {
> +			void (*encap_destroy)(struct sock *sk);
> +			encap_destroy = READ_ONCE(up->encap_destroy);
> +			if (encap_destroy)
> +				encap_destroy(sk);
> +		}
> +		if (up->encap_enabled)
> +			static_branch_disable(&udpv6_encap_needed_key);


Where is the opposite operation done ?

syzbot reported :

WARNING: CPU: 0 PID: 7564 at kernel/jump_label.c:188 static_key_disable_cpuslocked+0x2bb/0x310 kernel/jump_label.c:188
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 7564 Comm: syz-executor2 Not tainted 4.20.0-rc1-next-20181109+ #110
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x244/0x39d lib/dump_stack.c:113
 panic+0x2ad/0x55c kernel/panic.c:188
 __warn.cold.8+0x20/0x45 kernel/panic.c:540
 report_bug+0x254/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
 do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:290
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:969
RIP: 0010:static_key_disable_cpuslocked+0x2bb/0x310 kernel/jump_label.c:188
Code: ff eb db e8 07 da e3 ff 48 89 da 48 c7 c6 00 bf 31 88 48 c7 c7 e0 bb 31 88 e8 71 0d ad ff 0f 0b e9 0e fe ff ff e8 e5 d9 e3 ff <0f> 0b e9 2b ff ff ff 4c 89 f7 e8 56 32 27 00 e9 5e fe ff ff 48 89
RSP: 0018:ffff8801ba2b7928 EFLAGS: 00010293
RAX: ffff8801bb558340 RBX: 00000000ffffffff RCX: ffffffff819bcdf5
RDX: 0000000000000000 RSI: ffffffff819bcecb RDI: 0000000000000005
RBP: ffff8801ba2b79f0 R08: ffff8801bb558340 R09: fffffbfff17885c4
R10: fffffbfff17885c4 R11: ffffffff8bc42e23 R12: 1ffff10037456f25
R13: 1ffff10037456f31 R14: dffffc0000000000 R15: ffff8801ba2b79c8
 static_key_disable+0x1a/0x30 kernel/jump_label.c:202
 udpv6_destroy_sock+0x1e3/0x220 net/ipv6/udp.c:1492
 sk_common_release+0x6d/0x320 net/core/sock.c:3001
 udp_lib_close+0x15/0x20 include/net/udp.h:206
 inet_release+0x104/0x1f0 net/ipv4/af_inet.c:428
 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:458
 __sock_release+0xd7/0x250 net/socket.c:580
 sock_close+0x19/0x20 net/socket.c:1142
 __fput+0x3bc/0xa70 fs/file_table.c:279
 ____fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x411021
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 34 19 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffeb03ec0a0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000411021
RDX: 0000000000000001 RSI: 0000000000731ce8 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffeb03ebfd0 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000002
Kernel Offset: disabled
Rebooting in 86400 seconds..

^ permalink raw reply

* Re: [PATCH net-next 17/17] net: sched: unlock rules update API
From: Jiri Pirko @ 2018-11-14  6:44 UTC (permalink / raw)
  To: Vlad Buslov
  Cc: David Miller, netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, ast@kernel.org, daniel@iogearbox.net
In-Reply-To: <vbfftw5jdit.fsf@reg-r-vrt-018-180.mtr.labs.mlnx>

Tue, Nov 13, 2018 at 02:46:54PM CET, vladbu@mellanox.com wrote:
>On Mon 12 Nov 2018 at 17:30, David Miller <davem@davemloft.net> wrote:
>> From: Vlad Buslov <vladbu@mellanox.com>
>> Date: Mon, 12 Nov 2018 09:55:46 +0200
>>
>>> Register netlink protocol handlers for message types RTM_NEWTFILTER,
>>> RTM_DELTFILTER, RTM_GETTFILTER as unlocked. Set rtnl_held variable that
>>> tracks rtnl mutex state to be false by default.
>>
>> This whole conditional locking mechanism is really not clean and makes
>> this code so much harder to understand and audit.
>>
>> Please improve the code so that this kind of construct is not needed.
>>
>> Thank you.
>
>Hi David,
>
>I considered several approaches to this problem and decided that this
>one is most straightforward to implement. I understand your concern and
>agree that this code is not easiest to understand and can suggest
>several possible solutions that do not require this kind of elaborate
>locking mechanism in cls API, but have their own drawbacks:
>
>1. Convert all qdiscs and classifiers to support unlocked execution,
>like we did for actions. However, according to my experience with
>converting flower classifier, these require much more code than actions.
>I would estimate it to be more work than whole current unlocking effort
>(hundred+ patches). Also, authors of some of them might be unhappy with
>such intrusive changes. I don't think this approach is realistic.
>
>2. Somehow determine if rtnl is needed at the beginning of cls API rule
>update functions. Currently, this is not possible because locking
>requirements are determined by qdisc_class_ops and tcf_proto_ops 'flags'
>field, which requires code to first do whole ops lookup sequence.
>However, instead of class field I can put 'flags' in some kind of hash
>table or array that will map qdisc/classifier type string to flags, so
>it will be possible to determine locking requirements by just parsing
>netlink message and obtaining flags by qdisc/classifier type. I do not
>consider it pretty solution either, but maybe you have different
>opinion.

I think you will have to do 2. or some modification. Can't you just
check for cls ability to run unlocked early on in tc_new_tfilter()?
You would call tcf_proto_locking_check(nla_data(tca[TCA_KIND]), ...),
which would do tcf_proto_lookup_ops() for ops and check the flags?


>
>3. Anything you can suggest? I might be missing something simple that
>you would consider more elegant solution to this problem.
>
>Thanks,
>Vlad
>

^ permalink raw reply

* Re: [PATCH V3 1/7] net: lorawan: Add macro and definition for LoRaWAN
From: Andreas Färber @ 2018-11-14 16:12 UTC (permalink / raw)
  To: Jian-Hong Pan
  Cc: David S . Miller, netdev, linux-arm-kernel, linux-kernel,
	Marcel Holtmann, Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt
In-Reply-To: <20181114160126.4445-2-starnight@g.ncu.edu.tw>

Am 14.11.18 um 17:01 schrieb Jian-Hong Pan:
> This patch adds the macro and definition for the implementation of
> LoRaWAN protocol.
> 
> Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
> ---
> V2:
> - Modify the commit message

Note that both v2 and v3 don't seem to be based on the latest lora-next
branch, as your constants are already queued and used there.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply

* Re: [PATCH net-next 0/4] net: ethernet: ti: cpsw: allow vlan h/w timestamping
From: Strashko, Grygorii @ 2018-11-14 16:05 UTC (permalink / raw)
  To: David Miller, ivan.khoronzhuk; +Cc: linux-omap, netdev, linux-kernel
In-Reply-To: <20181113.163042.2086307929074044277.davem@davemloft.net>



On 11/13/2018 6:30 PM, David Miller wrote:
> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> Date: Mon, 12 Nov 2018 16:00:19 +0200
> 
>> The patchset adds several improvements and allows vlan h/w ts.
>>
>> Based on net-next/master
> 
> Series applied, thanks.
> 

Sry, for delay.
Thank you.

^ permalink raw reply

* [PATCH V3 7/7] net: lorawan: List LORAWAN in menuconfig
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

List LORAWAN and MACLORAWAN in menuconfig and make they can be built.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Split the LoRaWAN class module patch in V1 into LoRaWAN socket and
  LoRaWAN Soft MAC modules

 net/Kconfig  | 2 ++
 net/Makefile | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/Kconfig b/net/Kconfig
index 053b36998c18..b12b8bed6abb 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -224,6 +224,8 @@ source "net/6lowpan/Kconfig"
 source "net/ieee802154/Kconfig"
 source "net/mac802154/Kconfig"
 source "net/lora/Kconfig"
+source "net/lorawan/Kconfig"
+source "net/maclorawan/Kconfig"
 source "net/sched/Kconfig"
 source "net/dcb/Kconfig"
 source "net/dns_resolver/Kconfig"
diff --git a/net/Makefile b/net/Makefile
index e80b84313851..9d5515965a8f 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -63,6 +63,8 @@ obj-$(CONFIG_6LOWPAN)		+= 6lowpan/
 obj-$(CONFIG_IEEE802154)	+= ieee802154/
 obj-$(CONFIG_MAC802154)		+= mac802154/
 obj-$(CONFIG_LORA)		+= lora/
+obj-$(CONFIG_LORAWAN)		+= lorawan/
+obj-$(CONFIG_MACLORAWAN)	+= maclorawan/
 
 ifeq ($(CONFIG_NET),y)
 obj-$(CONFIG_SYSCTL)		+= sysctl_net.o
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 5/7] net: maclorawan: Implement the crypto of maclorawan module
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

Implement the crypto for encryption/decryption and message
integrity code (MIC) according to LoRaWAN(TM) Specification Ver. 1.0.2.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Split the LoRaWAN class module patch in V1 into LoRaWAN socket and
  LoRaWAN Soft MAC modules
- Rename the lrwsec files to crypto files
- Modify for Big/Little-Endian
- Use SPDX license identifiers

V3:
- Order local variables from longest to shortest line in the functions

 net/maclorawan/crypto.c | 209 ++++++++++++++++++++++++++++++++++++++++
 net/maclorawan/crypto.h |  27 ++++++
 2 files changed, 236 insertions(+)
 create mode 100644 net/maclorawan/crypto.c
 create mode 100644 net/maclorawan/crypto.h

diff --git a/net/maclorawan/crypto.c b/net/maclorawan/crypto.c
new file mode 100644
index 000000000000..5337a661c9d0
--- /dev/null
+++ b/net/maclorawan/crypto.c
@@ -0,0 +1,209 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN soft MAC
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#include <linux/scatterlist.h>
+#include <crypto/hash.h>
+#include <crypto/skcipher.h>
+#include "crypto.h"
+
+struct crypto_shash *
+lrw_mic_key_setup(u8 *k, size_t k_len)
+{
+	struct crypto_shash *tfm;
+	char *algo = "cmac(aes)";
+	int err;
+
+	tfm = crypto_alloc_shash(algo, 0, 0);
+	if (!IS_ERR(tfm)) {
+		err = crypto_shash_setkey(tfm, k, k_len);
+		if (err) {
+			crypto_free_shash(tfm);
+			tfm = NULL;
+		}
+	}
+
+	return tfm;
+}
+
+int
+lrw_aes_cmac(struct crypto_shash *tfm, u8 *bz, u8 *data, size_t len, u8 *out)
+{
+	SHASH_DESC_ON_STACK(desc, tfm);
+	int err;
+
+	desc->tfm = tfm;
+
+	err = crypto_shash_init(desc);
+	if (err)
+		goto lrw_aes_cmac_end;
+
+	err = crypto_shash_update(desc, bz, 16);
+	if (err)
+		goto lrw_aes_cmac_end;
+
+	err = crypto_shash_update(desc, data, len);
+	if (err)
+		goto lrw_aes_cmac_end;
+
+	err = crypto_shash_final(desc, out);
+
+lrw_aes_cmac_end:
+	return err;
+}
+
+int
+lrw_set_bzero(u8 dir, u32 devaddr, u32 fcnt, u8 len, u8 *bz)
+{
+	__le32 le_devaddr = cpu_to_le32(devaddr);
+	__le32 le_fcnt = cpu_to_le32(fcnt);
+
+	bz[0] = 0x49;
+	memset(bz + 1, 0x00, 4);
+	bz[5] = dir;
+	memcpy(bz + 6, &le_devaddr, 4);
+	memcpy(bz + 10, &le_fcnt, 4);
+	bz[14] = 0x00;
+	bz[15] = len;
+
+	return 0;
+}
+
+int
+lrw_calc_mic(struct crypto_shash *tfm,
+	     u8 dir, u32 devaddr, u32 fcnt, u8* buf, size_t len, u8 *mic4)
+{
+	u8 mic[16];
+	u8 bz[16];
+	int err;
+
+	/* According to LoRaWAN Specification Version 1.0.2
+	 * - 4.4 Massege Integrity Code (MIC) */
+	lrw_set_bzero(dir, devaddr, fcnt, len, bz);
+	err = lrw_aes_cmac(tfm, bz, buf, len, mic);
+	if (!err)
+		memcpy(mic4, mic, 4);
+
+	return err;
+}
+
+void
+lrw_mic_key_free(struct crypto_shash *tfm)
+{
+	crypto_free_shash(tfm);
+}
+
+struct crypto_skcipher *
+lrw_aes_enc_key_setup(char *algo, u8 *k, size_t k_len)
+{
+	struct crypto_skcipher *tfm;
+	int err;
+
+	tfm = crypto_alloc_skcipher(algo, 0, CRYPTO_ALG_ASYNC);
+	if (!IS_ERR(tfm)) {
+		err = crypto_skcipher_setkey(tfm, k, k_len);
+		if (err) {
+			crypto_free_skcipher(tfm);
+			tfm = NULL;
+		}
+	}
+
+	return tfm;
+}
+
+struct crypto_skcipher *
+lrw_encrypt_key_setup(u8 *k, size_t k_len)
+{
+	return lrw_aes_enc_key_setup("cbc(aes)", k, k_len);
+}
+
+int
+lrw_aes_enc(struct crypto_skcipher *tfm, u8 *in, size_t len, u8 *out)
+{
+	SKCIPHER_REQUEST_ON_STACK(req, tfm);
+	struct scatterlist src, dst;
+	u8 iv[16];
+	int err;
+
+	memset(iv, 0, 16);
+	/* The buffer for sg_init_one cannot be a global or const local
+	 * (will confuse the scatterlist) */
+	sg_init_one(&src, in, len);
+	sg_init_one(&dst, out, len);
+
+	skcipher_request_set_tfm(req, tfm);
+	skcipher_request_set_callback(req, 0, NULL, NULL);
+	skcipher_request_set_crypt(req, &src, &dst, len, iv);
+	err = crypto_skcipher_encrypt(req);
+	skcipher_request_zero(req);
+
+	return err;
+}
+
+#define	LRW_SEQUENCE_OF_BLOCK_LEN	16
+
+int
+lrw_set_sob(u8 dir, u32 devaddr, u32 fcnt, u8 index, u8 *sob)
+{
+	__le32 le_devaddr = cpu_to_le32(devaddr);
+	__le32 _fcnt = cpu_to_le32(fcnt);
+
+	sob[0] = 0x01;
+	memset(sob + 1, 0x00, 4);
+	sob[5] = dir;
+	memcpy(sob + 6, &le_devaddr, 4);
+	memcpy(sob + 10, &_fcnt, 4);
+	sob[14] = 0x00;
+	sob[15] = index;
+
+	return 0;
+}
+
+int
+lrw_encrypt_sob(struct crypto_skcipher *tfm, u8 *sob)
+{
+	return lrw_aes_enc(tfm, sob, LRW_SEQUENCE_OF_BLOCK_LEN, sob);
+}
+
+int
+lrw_encrypt_buf(struct crypto_skcipher *tfm,
+		u8 dir, u32 devaddr, u32 fcnt, u8 *buf, size_t len)
+{
+	u8 sob[LRW_SEQUENCE_OF_BLOCK_LEN];
+	u8 i, j;
+
+	/* According to LoRaWAN Specification Version 1.0.2
+	 * - 4.3.3 MAC Frame Payload Encryption (FRMPayload) */
+	for (i = 0; (i * LRW_SEQUENCE_OF_BLOCK_LEN) < len; i++) {
+		lrw_set_sob(dir, devaddr, fcnt, i, sob);
+		lrw_encrypt_sob(tfm, sob);
+		for (j = 0; (i * LRW_SEQUENCE_OF_BLOCK_LEN + j) < len; j++)
+			buf[i * LRW_SEQUENCE_OF_BLOCK_LEN + j] ^= sob[j];
+	}
+
+	return 0;
+}
+
+int
+lrw_decrypt_buf(struct crypto_skcipher *tfm,
+		u8 dir, u32 devaddr, u32 fcnt, u8 *buf, size_t len)
+{
+	/* Accoding to XOR swap algorithm */
+	return lrw_encrypt_buf(tfm, dir, devaddr, fcnt, buf, len);
+}
+
+void
+lrw_aes_enc_key_free(struct crypto_skcipher *tfm)
+{
+	crypto_free_skcipher(tfm);
+}
+
+void
+lrw_encrypt_key_free(struct crypto_skcipher *tfm)
+{
+	lrw_aes_enc_key_free(tfm);
+}
diff --git a/net/maclorawan/crypto.h b/net/maclorawan/crypto.h
new file mode 100644
index 000000000000..2ede02efb8c6
--- /dev/null
+++ b/net/maclorawan/crypto.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN soft MAC
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#ifndef __LORAWAN_CRYPTO_H__
+#define __LORAWAN_CRYPTO_H__
+
+#include <crypto/hash.h>
+#include <crypto/skcipher.h>
+
+struct crypto_shash *lrw_mic_key_setup(u8 *k, size_t k_len);
+int lrw_calc_mic(struct crypto_shash *tfm,
+		 u8 dir, u32 devaddr, u32 fcnt, u8* buf, size_t len, u8 *mic4);
+void lrw_mic_key_free(struct crypto_shash *tfm);
+
+struct crypto_skcipher *lrw_encrypt_key_setup(u8 *k, size_t k_len);
+int lrw_encrypt_buf(struct crypto_skcipher *tfm,
+		    u8 dir, u32 devaddr, u32 fcnt, u8 *buf, size_t len);
+int lrw_decrypt_buf(struct crypto_skcipher *tfm,
+		    u8 dir, u32 devaddr, u32 fcnt, u8 *buf, size_t len);
+void lrw_encrypt_key_free(struct crypto_skcipher *tfm);
+
+#endif
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 4/7] net: maclorawan: Add maclorawan module declaration
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

Add the maclorawan header file for common APIs in the module.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Split the LoRaWAN class module patch in V1 into LoRaWAN socket and
  LoRaWAN Soft MAC modules
- Use SPDX license identifiers

 net/maclorawan/maclorawan.h | 199 ++++++++++++++++++++++++++++++++++++
 1 file changed, 199 insertions(+)
 create mode 100644 net/maclorawan/maclorawan.h

diff --git a/net/maclorawan/maclorawan.h b/net/maclorawan/maclorawan.h
new file mode 100644
index 000000000000..66b87f051d51
--- /dev/null
+++ b/net/maclorawan/maclorawan.h
@@ -0,0 +1,199 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN soft MAC
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#ifndef __MAC_LORAWAN_H__
+#define __MAC_LORAWAN_H__
+
+#include <linux/mutex.h>
+#include <linux/spinlock.h>
+#include <linux/skbuff.h>
+#include <linux/workqueue.h>
+#include <linux/netdevice.h>
+#include <uapi/linux/if_arp.h>
+#include <crypto/hash.h>
+#include <crypto/skcipher.h>
+#include <linux/lora/lorawan.h>
+
+#define	LORAWAN_MODULE_NAME	"maclorawan"
+
+/* List the message types of LoRaWAN */
+enum {
+	LRW_JOIN_REQUEST,
+	LRW_JOIN_ACCEPT,
+	LRW_UNCONFIRMED_DATA_UP,
+	LRW_UNCONFIRMED_DATA_DOWN,
+	LRW_CONFIRMED_DATA_UP,
+	LRW_CONFIRMED_DATA_DOWN,
+	LRW_RFU,
+	LRW_PROPRIETARY,
+};
+
+/* List the communication directions */
+enum {
+	LRW_UPLINK,
+	LRW_DOWNLINK,
+};
+
+/* States of LoRaWAN slot timing */
+enum {
+	LRW_INIT_SS,
+	LRW_XMITTING_SS,
+	LRW_XMITTED,
+	LRW_RX1_SS,
+	LRW_RX2_SS,
+	LRW_RXTIMEOUT_SS,
+	LRW_RXRECEIVED_SS,
+	LRW_RETRANSMIT_SS,
+};
+
+#define	LRW_MHDR_LEN		1
+#define	LRW_FHDR_MAX_LEN	22
+#define	LRW_FOPS_MAX_LEN	15
+#define	LRW_FPORT_LEN		1
+#define	LRW_MIC_LEN		4
+
+/**
+ * lrw_fhdr - Hold the message's basic information of the frame
+ *
+ * @mtype:		this message's type
+ * @fctrl:		the frame control byte
+ * @fcnt:		this message's frame counter value
+ * @fopts:		this frame's options field
+ * @fopts_len:		the length of the fopts
+ */
+struct lrw_fhdr {
+	u8 mtype;
+	u8 fctrl;
+	u16 fcnt;
+	u8 fopts[LRW_FPORT_LEN];
+	u8 fopts_len;
+};
+
+/**
+ * lrw_session - LoRaWAN session for Class A end device
+ *
+ * @lrw_st:		points to the belonging lrw_st
+ * @entry:		the entry of the ss_list in lrw_struct
+ * @devaddr:		the LoRaWAN device address of this LoRaWAN hardware
+ * @fcnt_up:		uplink frame counter
+ * @fcnt_down:		downlink frame counter
+ * @fport:		the LoRaWAN data message's port field
+ * @tx_skb:		points to the TX skb, the frame
+ * @rx_skb:		points to the RX skb, the frame
+ * @tx_fhdr:		hold the message's basic information of the TX frame
+ * @rx_fhdr:		hold the message's basic information of the RX frame
+ * @tx_should_ack:	flag for determining the TX which should be acked or not
+ * @retry:		retry times for xmitting failed
+ * @state:		this session's current state
+ * @state_lock:		lock of the session's state
+ * @timer:		timing for this session and the state transition
+ * @timeout_work:	work if waiting acknowledge time out
+ * @rx_delay1:		RX1 delay time in seconds
+ * @rx_delay2:		RX2 delay time in seconds
+ * @rx1_window:		RX1 window opening time in mini-seconds
+ * @rx2_window:		RX2 window opening time in mini-seconds
+ * @ack_timeout:	time out time for waiting acknowledge in seconds
+ */
+struct lrw_session {
+	struct lrw_struct *lrw_st;
+	struct list_head entry;
+
+	u32 devaddr;
+	u16 fcnt_up;
+	u16 fcnt_down;
+	u8 fport;
+	struct sk_buff *tx_skb;
+	struct sk_buff *rx_skb;
+	struct lrw_fhdr tx_fhdr;
+	struct lrw_fhdr rx_fhdr;
+
+	bool tx_should_ack;
+	u8 retry;
+	u8 state;
+	spinlock_t state_lock;
+
+	struct timer_list timer;
+	struct work_struct timeout_work;
+	unsigned long rx_delay1;
+	unsigned long rx_delay2;
+	unsigned long rx1_window;
+	unsigned long rx2_window;
+	unsigned long ack_timeout;
+};
+
+/**
+ * lrw_struct - The full LoRaWAN hardware to the LoRa device.
+ *
+ * @dev:		this LoRa device registed in system
+ * @hw:			the LoRa device of this LoRaWAN hardware
+ * @ops:		handle of LoRa operations interfaces
+ * @rx_skb_list:	the list of received frames
+ * @ss_list:		LoRaWAN session list of this LoRaWAN hardware
+ * @_cur_ss:		pointer of the current processing session
+ * @rx_should_ack:	represent the current session should be acked or not
+ * @state:		the state of this LoRaWAN hardware
+ * @app_eui:		the LoRaWAN application EUI
+ * @dev_eui:		the LoRaWAN device EUI
+ * @devaddr:		the LoRaWAN device address of this LoRaWAN hardware
+ * @appky:		the Application key
+ * @nwkskey:		the Network session key
+ * @appskey:		the Application session key
+ * @nwks_shash_tfm:	the hash handler for LoRaWAN network session
+ * @nwks_skc_tfm:	the crypto handler for LoRaWAN network session
+ * @apps_skc_tfm:	the crypto handler for LoRaWAN application session
+ * @fcnt_up:		the counter of this LoRaWAN hardware's up frame
+ * @fcnt_down:		the counter of this LoRaWAN hardware's down frame
+ * @xmit_task:		the xmit task for the current LoRaWAN session
+ * @rx_work:		the RX work in workqueue for the current LoRaWAN session
+ * @ndev:		points to the emulating network device
+ * @_net:		the current network namespace of this LoRaWAN hardware
+ */
+struct lrw_struct {
+	struct device dev;
+	struct lrw_hw hw;
+	struct lrw_operations *ops;
+
+	struct sk_buff_head rx_skb_list;
+	struct list_head ss_list;
+	struct mutex ss_list_lock;
+	struct lrw_session *_cur_ss;
+	bool rx_should_ack;
+	u8 state;
+
+	u64 app_eui;
+	u64 dev_eui;
+	u32 devaddr;
+	u8 appkey[LRW_KEY_LEN];
+	u8 nwkskey[LRW_KEY_LEN];
+	u8 appskey[LRW_KEY_LEN];
+	struct crypto_shash *nwks_shash_tfm;
+	struct crypto_skcipher *nwks_skc_tfm;
+	struct crypto_skcipher *apps_skc_tfm;
+
+	u16 fcnt_up;
+	u16 fcnt_down;
+
+	struct tasklet_struct xmit_task;
+	struct work_struct rx_work;
+
+	struct net_device *ndev;
+	possible_net_t _net;
+};
+
+#define	NETDEV_2_LRW(ndev)	((struct lrw_struct *)netdev_priv(ndev))
+
+struct lrw_session * lrw_alloc_ss(struct lrw_struct *);
+void lrw_free_ss(struct lrw_session *);
+void lrw_del_ss(struct lrw_session *);
+int lrw_start_hw(struct lrw_struct *);
+void lrw_stop_hw(struct lrw_struct *);
+void lrw_prepare_tx_frame(struct lrw_session *);
+void lrw_xmit(unsigned long);
+void lrw_rx_work(struct work_struct *);
+
+#endif
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 3/7] net: lorawan: Add LoRaWAN API declaration for LoRa devices
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

Add public LoRaWAN API for compatible LoRa device drivers.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Split the LoRaWAN class module patch in V1 into LoRaWAN socket and
  LoRaWAN Soft MAC modules
- Merge the lrw_operations: set_bw, set_mod, set_sf into set_dr
- Use SPDX license identifiers

V3:
- Remove the unused lrw_random_addr function

 include/linux/lora/lorawan.h | 131 +++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 include/linux/lora/lorawan.h

diff --git a/include/linux/lora/lorawan.h b/include/linux/lora/lorawan.h
new file mode 100644
index 000000000000..cdeb280b2261
--- /dev/null
+++ b/include/linux/lora/lorawan.h
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN compatible hardware's definitions
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#ifndef __LORAWAN_H__
+#define __LORAWAN_H__
+
+#include <linux/skbuff.h>
+
+/* List the role of the LoRaWAN hardware */
+enum {
+	LRW_GATEWAY,
+	LRW_CLASS_A_NODE,
+	LRW_CLASS_B_NODE,
+	LRW_CLASS_C_NODE,
+};
+
+/* List the RF modes */
+enum {
+	LRW_LORA,
+	LRW_FSK,
+};
+
+/**
+ * lrw_dr - This structure holds the RF related configuration of the data rate.
+ * @bw:
+ * 	Bandwidth in Hz
+ *
+ * @sf:
+ * 	Spread factor of CSS modulation used by LoRa mode
+ *
+ * @mode:
+ * 	LoRa or FSK mode
+ */
+struct lrw_dr {
+	u32 bw;
+	u8 sf;
+	u8 mode;
+};
+
+#define	LRW_DEVADDR_LEN		(sizeof(__le32))
+
+/* List the LoRa device's states of LoRaWAN hardware */
+enum {
+	LRW_STOP,
+	LRW_START,
+	LRW_STATE_IDLE,
+	LRW_STATE_TX,
+	LRW_STATE_RX,
+};
+
+/**
+ * lrw_hw - This structure holds the LoRa device of LoRaWAN hardware.
+ * @priv:
+ * 	points to the private data of the LoRa device
+ */
+struct lrw_hw {
+	void *priv;
+};
+
+/**
+ * lrw_operations - Lists the LoRaWAN device/interface's operations.
+ * These are callback functions for the LoRaWAN module.  Compatible LoRa device
+ * driver should implement some of them according to the usage.  The
+ * unimplemented callback functions must be assigned as NULL.
+ *
+ * @start:
+ *	called when the interface is being up state
+ *
+ * @stop:
+ *	called when the interface is being down state
+ *
+ * @xmit_async:
+ *	called to xmit the data through the interface asynchronously
+ *
+ * @set_txpower:
+ *	called to set xmitting RF power in mBm of the interface
+ *
+ * @set_frq:
+ *	called to set carrier frequency in Hz of the interface
+ *
+ * @set_dr:
+ *	called to set related RF configuration of the LoRaWAN data rate
+ *
+ * @start_rx_window:
+ *	called to ask the LoRa device open a receiving window
+ *
+ * @set_state:
+ *	called to set the LoRa device's working state
+ */
+struct lrw_operations {
+	int (*start)(struct lrw_hw *);
+	void (*stop)(struct lrw_hw *);
+
+	int (*xmit_async)(struct lrw_hw *, struct sk_buff *);
+	int (*set_txpower)(struct lrw_hw *, s32);
+	int (*set_frq)(struct lrw_hw *, u32);
+	int (*set_dr)(struct lrw_hw *, struct lrw_dr *);
+	int (*start_rx_window)(struct lrw_hw *, u32);
+	int (*set_state)(struct lrw_hw *, u8);
+};
+
+struct lrw_hw *lrw_alloc_hw(size_t, struct lrw_operations *);
+void lrw_free_hw(struct lrw_hw *);
+int lrw_register_hw(struct lrw_hw *);
+void lrw_unregister_hw(struct lrw_hw *);
+void lrw_rx_irqsave(struct lrw_hw *, struct sk_buff *);
+void lrw_xmit_complete(struct lrw_hw *, struct sk_buff *);
+
+void lrw_set_deveui(struct lrw_hw *, u64);
+u64 lrw_get_deveui(struct lrw_hw *);
+void lrw_set_appeui(struct lrw_hw *, u64);
+u64 lrw_get_appeui(struct lrw_hw *);
+void lrw_set_devaddr(struct lrw_hw *, u32);
+u32 lrw_get_devaddr(struct lrw_hw *);
+
+enum {
+	LRW_APPKEY,
+	LRW_NWKSKEY,
+	LRW_APPSKEY,
+};
+
+#define	LRW_KEY_LEN		16
+
+int lrw_set_key(struct lrw_hw *, u8, u8 *, size_t);
+
+#endif
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 2/7] net: lorawan: Add LoRaWAN socket module
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

This patch adds a new address/protocol family for LoRaWAN network.
It also implements the the functions and maps to Datagram socket for
LoRaWAN unconfirmed data messages.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Split the LoRaWAN class module patch in V1 into LoRaWAN socket and
  LoRaWAN Soft MAC modules
- Add lorawan_netdev.h header file for network address related
  declaration
- Use SPDX license identifiers

V3:
- Change the inline functions to a single line macro or just remove the
  decoration word - inline
- Order local variables from longest to shortest line in the functions
- Change mac_cb inline function to lrw_get_mac_cb macro

 include/linux/lora/lorawan_netdev.h |  49 ++
 net/lorawan/Kconfig                 |  10 +
 net/lorawan/Makefile                |   2 +
 net/lorawan/socket.c                | 688 ++++++++++++++++++++++++++++
 4 files changed, 749 insertions(+)
 create mode 100644 include/linux/lora/lorawan_netdev.h
 create mode 100644 net/lorawan/Kconfig
 create mode 100644 net/lorawan/Makefile
 create mode 100644 net/lorawan/socket.c

diff --git a/include/linux/lora/lorawan_netdev.h b/include/linux/lora/lorawan_netdev.h
new file mode 100644
index 000000000000..f6689b7c4cb0
--- /dev/null
+++ b/include/linux/lora/lorawan_netdev.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN stack related definitions
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#ifndef __LORAWAN_NET_DEVICE_H__
+#define __LORAWAN_NET_DEVICE_H__
+
+enum {
+	LRW_ADDR_APPEUI,
+	LRW_ADDR_DEVEUI,
+	LRW_ADDR_DEVADDR,
+};
+
+struct lrw_addr_in {
+	int addr_type;
+	union {
+		u64 app_eui;
+		u64 dev_eui;
+		u32 devaddr;
+	};
+};
+
+struct sockaddr_lorawan {
+	sa_family_t family; /* AF_LORAWAN */
+	struct lrw_addr_in addr_in;
+};
+
+/**
+ * lrw_mac_cb - This structure holds the control buffer (cb) of sk_buff
+ *
+ * @devaddr:	the LoRaWAN device address of this LoRaWAN hardware
+ */
+struct lrw_mac_cb {
+	u32 devaddr;
+};
+
+/**
+ * lrw_get_mac_cb - Get the LoRaWAN MAC control buffer of the sk_buff
+ * @skb:	the exchanging sk_buff
+ *
+ * Return:	the pointer of LoRaWAN MAC control buffer
+ */
+#define	lrw_get_mac_cb(skb)	((struct lrw_mac_cb *)skb->cb)
+
+#endif
diff --git a/net/lorawan/Kconfig b/net/lorawan/Kconfig
new file mode 100644
index 000000000000..7f2f344085c4
--- /dev/null
+++ b/net/lorawan/Kconfig
@@ -0,0 +1,10 @@
+config LORAWAN
+	tristate "LoRaWAN Network support"
+	---help---
+	  LoRaWAN defines low data rate, low power and long range wireless
+	  wide area networks. It was designed to organize networks of automation
+	  devices, such as sensors, switches and actuators. It can operate
+	  multiple kilometers wide.
+
+	  Say Y here to compile LoRaWAN support into the kernel or say M to
+	  compile it as a module.
diff --git a/net/lorawan/Makefile b/net/lorawan/Makefile
new file mode 100644
index 000000000000..8c923ca6541a
--- /dev/null
+++ b/net/lorawan/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_LORAWAN)	+= lorawan.o
+lorawan-objs		:= socket.o
diff --git a/net/lorawan/socket.c b/net/lorawan/socket.c
new file mode 100644
index 000000000000..f0bd391c4137
--- /dev/null
+++ b/net/lorawan/socket.c
@@ -0,0 +1,688 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
+/*-
+ * LoRaWAN stack related definitions
+ *
+ * Copyright (c) 2018 Jian-Hong, Pan <starnight@g.ncu.edu.tw>
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/list.h>
+#include <linux/net.h>
+#include <linux/if_arp.h>
+#include <linux/termios.h>		/* For TIOCOUTQ/INQ */
+#include <net/sock.h>
+#include <linux/lora/lorawan_netdev.h>
+
+#define	LORAWAN_MODULE_NAME	"lorawan"
+
+#define	LRW_DBG_STR(fmt)	LORAWAN_MODULE_NAME": "fmt
+#define	lrw_info(fmt, ...)	(pr_info(LRW_DBG_STR(fmt), ##__VA_ARGS__))
+#define	lrw_dbg(fmt, ...)	(pr_debug(LRW_DBG_STR(fmt), ##__VA_ARGS__))
+
+/**
+ * dgram_sock - This structure holds the states of Datagram socket
+ *
+ * @sk:			network layer representation of the socket
+ * 			sk must be the first member of dgram_sock
+ * @src_devaddr:	the LoRaWAN device address for this connection
+ * @bound:		this socket is bound or not
+ * @connected:		this socket is connected to the destination or not
+ * @want_ack:		this socket needs to ack for the connection or not
+ */
+struct dgram_sock {
+	struct sock sk;
+	u32 src_devaddr;
+
+	u8 bound:1;
+	u8 connected:1;
+};
+
+static HLIST_HEAD(dgram_head);
+static DEFINE_RWLOCK(dgram_lock);
+
+static struct dgram_sock *
+dgram_sk(const struct sock *sk)
+{
+	return container_of(sk, struct dgram_sock, sk);
+}
+
+static struct net_device *
+lrw_get_dev_by_addr(struct net *net, u32 devaddr)
+{
+	__be32 be_addr = cpu_to_be32(devaddr);
+	struct net_device *ndev = NULL;
+
+	rcu_read_lock();
+	ndev = dev_getbyhwaddr_rcu(net, ARPHRD_LORAWAN, (char *)&be_addr);
+	if (ndev)
+		dev_hold(ndev);
+	rcu_read_unlock();
+
+	return ndev;
+}
+
+static int
+dgram_init(struct sock *sk)
+{
+	return 0;
+}
+
+static void
+dgram_close(struct sock *sk, long timeout)
+{
+	sk_common_release(sk);
+}
+
+static int
+dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
+{
+	struct sockaddr_lorawan *addr = (struct sockaddr_lorawan *)uaddr;
+	struct dgram_sock *ro = dgram_sk(sk);
+	struct net_device *ndev;
+	int ret;
+
+	lock_sock(sk);
+	ro->bound = 0;
+
+	ret = -EINVAL;
+	if (len < sizeof(*addr))
+		goto dgram_bind_end;
+
+	if (addr->family != AF_LORAWAN)
+		goto dgram_bind_end;
+
+	if (addr->addr_in.addr_type != LRW_ADDR_DEVADDR)
+		goto dgram_bind_end;
+
+	lrw_dbg("%s: bind address %X\n", __func__, addr->addr_in.devaddr);
+	ndev = lrw_get_dev_by_addr(sock_net(sk), addr->addr_in.devaddr);
+	if (!ndev) {
+		ret = -ENODEV;
+		goto dgram_bind_end;
+	}
+	netdev_dbg(ndev, "%s: get ndev\n", __func__);
+
+	if (ndev->type != ARPHRD_LORAWAN) {
+		ret = -ENODEV;
+		goto dgram_bind_end;
+	}
+
+	ro->src_devaddr = addr->addr_in.devaddr;
+	ro->bound = 1;
+	ret = 0;
+	dev_put(ndev);
+	lrw_dbg("%s: bound address %X\n", __func__, ro->src_devaddr);
+
+dgram_bind_end:
+	release_sock(sk);
+	return ret;
+}
+
+static int
+lrw_dev_hard_header(struct sk_buff *skb, struct net_device *ndev,
+		    const u32 src_devaddr, size_t len)
+{
+	/* TODO: Prepare the LoRaWAN sending header here */
+	return 0;
+}
+
+static int
+dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
+{
+	struct dgram_sock *ro = dgram_sk(sk);
+	struct net_device *ndev;
+	struct sk_buff *skb;
+	size_t hlen;
+	size_t tlen;
+	int ret;
+
+	lrw_dbg("%s: going to send %zu bytes", __func__, size);
+	if (msg->msg_flags & MSG_OOB) {
+		lrw_dbg("msg->msg_flags = 0x%x\n", msg->msg_flags);
+		return -EOPNOTSUPP;
+	}
+
+	lrw_dbg("%s: check msg_name\n", __func__);
+	if (!ro->connected && !msg->msg_name)
+		return -EDESTADDRREQ;
+	else if (ro->connected && msg->msg_name)
+		return -EISCONN;
+
+	lrw_dbg("%s: check bound\n", __func__);
+	if (!ro->bound)
+		ndev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_LORAWAN);
+	else
+		ndev = lrw_get_dev_by_addr(sock_net(sk), ro->src_devaddr);
+
+	if (!ndev) {
+		lrw_dbg("no dev\n");
+		ret = -ENXIO;
+		goto dgram_sendmsg_end;
+	}
+
+	if (size > ndev->mtu){
+		netdev_dbg(ndev, "size = %zu, mtu = %u\n", size, ndev->mtu);
+		ret = -EMSGSIZE;
+		goto dgram_sendmsg_end;
+	}
+
+	netdev_dbg(ndev, "%s: create skb\n", __func__);
+	hlen = LL_RESERVED_SPACE(ndev);
+	tlen = ndev->needed_tailroom;
+	skb = sock_alloc_send_skb(sk, hlen + tlen + size,
+				  msg->msg_flags & MSG_DONTWAIT,
+				  &ret);
+
+	if (!skb)
+		goto dgram_sendmsg_no_skb;
+
+	skb_reserve(skb, hlen);
+	skb_reset_network_header(skb);
+
+	ret = lrw_dev_hard_header(skb, ndev, 0, size);
+	if (ret < 0)
+		goto dgram_sendmsg_no_skb;
+
+	ret = memcpy_from_msg(skb_put(skb, size), msg, size);
+	if (ret > 0)
+		goto dgram_sendmsg_err_skb;
+
+	skb->dev = ndev;
+	skb->protocol = htons(ETH_P_LORAWAN);
+
+	netdev_dbg(ndev, "%s: push skb to xmit queue\n", __func__);
+	ret = dev_queue_xmit(skb);
+	if (ret > 0)
+		ret = net_xmit_errno(ret);
+	netdev_dbg(ndev, "%s: pushed skb to xmit queue with ret=%d\n",
+			 __func__, ret);
+	dev_put(ndev);
+
+	return ret ?: size;
+
+dgram_sendmsg_err_skb:
+	kfree_skb(skb);
+dgram_sendmsg_no_skb:
+	dev_put(ndev);
+
+dgram_sendmsg_end:
+	return ret;
+}
+
+static int
+dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
+	      int noblock, int flags, int *addr_len)
+{
+	DECLARE_SOCKADDR(struct sockaddr_lorawan *, saddr, msg->msg_name);
+	struct sk_buff *skb;
+	size_t copied = 0;
+	int err;
+
+	skb = skb_recv_datagram(sk, flags, noblock, &err);
+	if (!skb)
+		goto dgram_recvmsg_end;
+
+	copied = skb->len;
+	if (len < copied) {
+		msg->msg_flags |= MSG_TRUNC;
+		copied = len;
+	}
+
+	err = skb_copy_datagram_msg(skb, 0, msg, copied);
+	if (err)
+		goto dgram_recvmsg_done;
+
+	sock_recv_ts_and_drops(msg, sk, skb);
+	if(saddr) {
+		memset(saddr, 0, sizeof(*saddr));
+		saddr->family = AF_LORAWAN;
+		saddr->addr_in.devaddr = lrw_get_mac_cb(skb)->devaddr;
+		*addr_len = sizeof(*saddr);
+	}
+
+	if (flags & MSG_TRUNC)
+		copied = skb->len;
+
+dgram_recvmsg_done:
+	skb_free_datagram(sk, skb);
+
+dgram_recvmsg_end:
+	if (err)
+		return err;
+	return copied;
+}
+
+static int
+dgram_hash(struct sock *sk)
+{
+	lrw_dbg("%s\n", __func__);
+	write_lock_bh(&dgram_lock);
+	sk_add_node(sk, &dgram_head);
+	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
+	write_unlock_bh(&dgram_lock);
+
+	return 0;
+}
+
+static void
+dgram_unhash(struct sock *sk)
+{
+	lrw_dbg("%s\n", __func__);
+	write_lock_bh(&dgram_lock);
+	if (sk_del_node_init(sk))
+		sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
+	write_unlock_bh(&dgram_lock);
+}
+
+static int
+dgram_connect(struct sock *sk, struct sockaddr *uaddr, int len)
+{
+	struct dgram_sock *ro = dgram_sk(sk);
+
+	/* Nodes of LoRaWAN send data to a gateway only, then data is received
+	 * and transferred to servers with the gateway's policy.
+	 * So, the destination address is not used by nodes.
+	 */
+	lock_sock(sk);
+	ro->connected = 1;
+	release_sock(sk);
+
+	return 0;
+}
+
+static int
+dgram_disconnect(struct sock *sk, int flags)
+{
+	struct dgram_sock *ro = dgram_sk(sk);
+
+	lock_sock(sk);
+	ro->connected = 0;
+	release_sock(sk);
+
+	return 0;
+}
+
+static int
+dgram_ioctl(struct sock *sk, int cmd, unsigned long arg)
+{
+	struct net_device *ndev = sk->sk_dst_cache->dev;
+	struct sk_buff *skb;
+	int amount;
+	int err;
+
+	netdev_dbg(ndev, "%s: ioctl file (cmd=0x%X)\n", __func__, cmd);
+	switch (cmd) {
+	case SIOCOUTQ:
+		amount = sk_wmem_alloc_get(sk);
+		err = put_user(amount, (int __user *)arg);
+		break;
+	case SIOCINQ:
+		amount = 0;
+		spin_lock_bh(&sk->sk_receive_queue.lock);
+		skb = skb_peek(&sk->sk_receive_queue);
+		if (skb) {
+			/* We will only return the amount of this packet
+			 * since that is all that will be read.
+			 */
+			amount = skb->len;
+		}
+		spin_unlock_bh(&sk->sk_receive_queue.lock);
+		err = put_user(amount, (int __user *)arg);
+		break;
+	default:
+		err = -ENOIOCTLCMD;
+	}
+
+	return err;
+}
+
+static int
+dgram_getsockopt(struct sock *sk, int level, int optname,
+		 char __user *optval, int __user *optlen)
+{
+	int val, len;
+
+	if (level != SOL_LORAWAN)
+		return -EOPNOTSUPP;
+
+	if (get_user(len, optlen))
+		return -EFAULT;
+
+	len = min_t(unsigned int, len, sizeof(int));
+
+	switch (optname) {
+	default:
+		return -ENOPROTOOPT;
+	}
+
+	if (put_user(len, optlen))
+		return -EFAULT;
+
+	if (copy_to_user(optval, &val, len))
+		return -EFAULT;
+
+	return 0;
+}
+
+static int
+dgram_setsockopt(struct sock *sk, int level, int optname,
+		 char __user *optval, unsigned int optlen)
+{
+	int val;
+	int err;
+
+	err = 0;
+
+	if (optlen < sizeof(int))
+		return -EINVAL;
+
+	if (get_user(val, (int __user *)optval))
+		return -EFAULT;
+
+	lock_sock(sk);
+
+	switch (optname) {
+	default:
+		err = -ENOPROTOOPT;
+		break;
+	}
+
+	release_sock(sk);
+
+	return err;
+}
+
+static struct proto lrw_dgram_prot = {
+	.name		= "LoRaWAN",
+	.owner		= THIS_MODULE,
+	.obj_size	= sizeof(struct dgram_sock),
+	.init		= dgram_init,
+	.close		= dgram_close,
+	.bind		= dgram_bind,
+	.sendmsg	= dgram_sendmsg,
+	.recvmsg	= dgram_recvmsg,
+	.hash		= dgram_hash,
+	.unhash		= dgram_unhash,
+	.connect	= dgram_connect,
+	.disconnect	= dgram_disconnect,
+	.ioctl		= dgram_ioctl,
+	.getsockopt	= dgram_getsockopt,
+	.setsockopt	= dgram_setsockopt,
+};
+
+static int
+lrw_sock_release(struct socket *sock)
+{
+	struct sock *sk = sock->sk;
+
+	if (sk) {
+		sock->sk = NULL;
+		sk->sk_prot->close(sk, 0);
+	}
+
+	return 0;
+}
+
+static int
+lrw_sock_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
+{
+	struct sockaddr_lorawan *addr = (struct sockaddr_lorawan *)uaddr;
+	struct sock *sk = sock->sk;
+
+	lrw_dbg("%s: bind address %X\n", __func__, addr->addr_in.devaddr);
+	if (sk->sk_prot->bind)
+		return sk->sk_prot->bind(sk, uaddr, addr_len);
+
+	return sock_no_bind(sock, uaddr, addr_len);
+}
+
+static int
+lrw_sock_connect(struct socket *sock, struct sockaddr *uaddr,
+		 int addr_len, int flags)
+{
+	struct sock *sk = sock->sk;
+
+	if (addr_len < sizeof(uaddr->sa_family))
+		return -EINVAL;
+
+	return sk->sk_prot->connect(sk, uaddr, addr_len);
+}
+
+static int
+lrw_ndev_ioctl(struct sock *sk, struct ifreq __user *arg, unsigned int cmd)
+{
+	struct net_device *ndev;
+	struct ifreq ifr;
+	int ret;
+
+	lrw_dbg("%s: cmd %ud\n", __func__, cmd);
+	ret = -ENOIOCTLCMD;
+
+	if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
+		return -EFAULT;
+
+	ifr.ifr_name[IFNAMSIZ-1] = 0;
+
+	dev_load(sock_net(sk), ifr.ifr_name);
+	ndev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
+
+	netdev_dbg(ndev, "%s: cmd %ud\n", __func__, cmd);
+	if (!ndev)
+		return -ENODEV;
+
+	if (ndev->type == ARPHRD_LORAWAN && ndev->netdev_ops->ndo_do_ioctl)
+		ret = ndev->netdev_ops->ndo_do_ioctl(ndev, &ifr, cmd);
+
+	if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))
+		ret = -EFAULT;
+	dev_put(ndev);
+
+	return ret;
+}
+
+static int
+lrw_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+{
+	struct sock *sk = sock->sk;
+
+	lrw_dbg("%s: cmd %ud\n", __func__, cmd);
+	switch (cmd) {
+	case SIOCGSTAMP:
+		return sock_get_timestamp(sk, (struct timeval __user *)arg);
+	case SIOCGSTAMPNS:
+		return sock_get_timestampns(sk, (struct timespec __user *)arg);
+	case SIOCOUTQ:
+	case SIOCINQ:
+		if (!sk->sk_prot->ioctl)
+			return -ENOIOCTLCMD;
+		return sk->sk_prot->ioctl(sk, cmd, arg);
+	default:
+		return lrw_ndev_ioctl(sk, (struct ifreq __user *)arg, cmd);
+	}
+}
+
+static int
+lrw_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
+{
+	struct sock *sk = sock->sk;
+
+	lrw_dbg("%s: going to send %zu bytes\n", __func__, len);
+	return sk->sk_prot->sendmsg(sk, msg, len);
+}
+
+static const struct proto_ops lrw_dgram_ops = {
+	.family		= PF_LORAWAN,
+	.owner		= THIS_MODULE,
+	.release	= lrw_sock_release,
+	.bind		= lrw_sock_bind,
+	.connect	= lrw_sock_connect,
+	.socketpair	= sock_no_socketpair,
+	.accept		= sock_no_accept,
+	.getname	= sock_no_getname,
+	.poll		= datagram_poll,
+	.ioctl		= lrw_sock_ioctl,
+	.listen		= sock_no_listen,
+	.shutdown	= sock_no_shutdown,
+	.setsockopt	= sock_common_setsockopt,
+	.getsockopt	= sock_common_getsockopt,
+	.sendmsg	= lrw_sock_sendmsg,
+	.recvmsg	= sock_common_recvmsg,
+	.mmap		= sock_no_mmap,
+	.sendpage	= sock_no_sendpage,
+};
+
+static int
+lorawan_creat(struct net *net, struct socket *sock, int protocol, int kern)
+{
+	struct sock *sk;
+	int ret;
+
+	if (!net_eq(net, &init_net))
+		return -EAFNOSUPPORT;
+
+	if (sock->type != SOCK_DGRAM)
+		return -EAFNOSUPPORT;
+
+	/* Allocates enough memory for dgram_sock whose first member is sk */
+	sk = sk_alloc(net, PF_LORAWAN, GFP_KERNEL, &lrw_dgram_prot, kern);
+	if (!sk)
+		return -ENOMEM;
+
+	sock->ops = &lrw_dgram_ops;
+	sock_init_data(sock, sk);
+	sk->sk_family = PF_LORAWAN;
+	sock_set_flag(sk, SOCK_ZAPPED);
+
+	if (sk->sk_prot->hash) {
+		ret = sk->sk_prot->hash(sk);
+		if (ret) {
+			sk_common_release(sk);
+			goto lorawan_creat_end;
+		}
+	}
+
+	if (sk->sk_prot->init) {
+		ret = sk->sk_prot->init(sk);
+		if (ret)
+			sk_common_release(sk);
+	}
+
+lorawan_creat_end:
+	return ret;
+}
+
+static const struct net_proto_family lorawan_family_ops = {
+	.owner		= THIS_MODULE,
+	.family		= PF_LORAWAN,
+	.create		= lorawan_creat,
+};
+
+static int
+lrw_dgram_deliver(struct net_device *ndev, struct sk_buff *skb)
+{
+	struct dgram_sock *ro;
+	struct sock *sk;
+	bool found;
+	int ret;
+
+	ret = NET_RX_SUCCESS;
+	found = false;
+
+	read_lock(&dgram_lock);
+	sk_for_each(sk, &dgram_head) {
+		ro = dgram_sk(sk);
+		if(cpu_to_le32(ro->src_devaddr) == *(__le32 *)ndev->dev_addr) {
+			found = true;
+			break;
+		}
+	}
+	read_unlock(&dgram_lock);
+
+	if (!found)
+		goto lrw_dgram_deliver_err;
+
+	skb = skb_share_check(skb, GFP_ATOMIC);
+	if (!skb)
+		return NET_RX_DROP;
+
+	if (sock_queue_rcv_skb(sk, skb) < 0)
+		goto lrw_dgram_deliver_err;
+
+	return ret;
+
+lrw_dgram_deliver_err:
+	kfree_skb(skb);
+	ret = NET_RX_DROP;
+	return ret;
+}
+
+static int
+lorawan_rcv(struct sk_buff *skb, struct net_device *ndev,
+	    struct packet_type *pt, struct net_device *orig_ndev)
+{
+	if (!netif_running(ndev))
+		goto lorawan_rcv_drop;
+
+	if (!net_eq(dev_net(ndev), &init_net))
+		goto lorawan_rcv_drop;
+
+	if (ndev->type != ARPHRD_LORAWAN)
+		goto lorawan_rcv_drop;
+
+	if (skb->pkt_type != PACKET_OTHERHOST)
+		return lrw_dgram_deliver(ndev, skb);
+
+lorawan_rcv_drop:
+	kfree_skb(skb);
+	return NET_RX_DROP;
+}
+
+static struct packet_type lorawan_packet_type = {
+	.type		= htons(ETH_P_LORAWAN),
+	.func		= lorawan_rcv,
+};
+
+static int __init
+lrw_sock_init(void)
+{
+	int ret;
+
+	lrw_info("module inserted\n");
+	ret = proto_register(&lrw_dgram_prot, 1);
+	if(ret)
+		goto lrw_sock_init_end;
+
+	/* Tell SOCKET that we are alive */
+	ret = sock_register(&lorawan_family_ops);
+	if(ret)
+		goto lrw_sock_init_err;
+
+	dev_add_pack(&lorawan_packet_type);
+	ret = 0;
+	goto lrw_sock_init_end;
+
+lrw_sock_init_err:
+	proto_unregister(&lrw_dgram_prot);
+
+lrw_sock_init_end:
+	return 0;
+}
+
+static void __exit
+lrw_sock_exit(void)
+{
+	dev_remove_pack(&lorawan_packet_type);
+	sock_unregister(PF_LORAWAN);
+	proto_unregister(&lrw_dgram_prot);
+	lrw_info("module removed\n");
+}
+
+module_init(lrw_sock_init);
+module_exit(lrw_sock_exit);
+
+MODULE_AUTHOR("Jian-Hong Pan, <starnight@g.ncu.edu.tw>");
+MODULE_DESCRIPTION("LoRaWAN socket kernel module");
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_ALIAS_NETPROTO(PF_LORAWAN);
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 1/7] net: lorawan: Add macro and definition for LoRaWAN
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

This patch adds the macro and definition for the implementation of
LoRaWAN protocol.

Signed-off-by: Jian-Hong Pan <starnight@g.ncu.edu.tw>
---
V2:
- Modify the commit message

 include/linux/socket.h              | 5 ++++-
 include/uapi/linux/if_arp.h         | 1 +
 include/uapi/linux/if_ether.h       | 1 +
 net/core/dev.c                      | 4 ++--
 security/selinux/hooks.c            | 4 +++-
 security/selinux/include/classmap.h | 4 +++-
 6 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/include/linux/socket.h b/include/linux/socket.h
index aa1e288b1659..e5c8381fd1aa 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -209,8 +209,9 @@ struct ucred {
 				 */
 #define AF_XDP		44	/* XDP sockets			*/
 #define AF_LORA		45	/* LoRa sockets			*/
+#define AF_LORAWAN	46	/* LoRaWAN sockets			*/
 
-#define AF_MAX		46	/* For now.. */
+#define AF_MAX		47	/* For now.. */
 
 /* Protocol families, same as address families. */
 #define PF_UNSPEC	AF_UNSPEC
@@ -261,6 +262,7 @@ struct ucred {
 #define PF_SMC		AF_SMC
 #define PF_XDP		AF_XDP
 #define PF_LORA		AF_LORA
+#define PF_LORAWAN	AF_LORAWAN
 #define PF_MAX		AF_MAX
 
 /* Maximum queue length specifiable by listen.  */
@@ -343,6 +345,7 @@ struct ucred {
 #define SOL_KCM		281
 #define SOL_TLS		282
 #define SOL_XDP		283
+#define SOL_LORAWAN	284
 
 /* IPX options */
 #define IPX_TYPE	1
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index 1ed7cb3f2129..2376f7839355 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -99,6 +99,7 @@
 #define ARPHRD_6LOWPAN	825		/* IPv6 over LoWPAN             */
 #define ARPHRD_VSOCKMON	826		/* Vsock monitor header		*/
 #define ARPHRD_LORA	827		/* LoRa				*/
+#define ARPHRD_LORAWAN	828		/* LoRaWAN			*/
 
 #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */
 #define ARPHRD_NONE	  0xFFFE	/* zero header length */
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 45644dcf5b39..b1ac70d4a377 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -148,6 +148,7 @@
 					 * aggregation protocol
 					 */
 #define ETH_P_LORA	0x00FA		/* LoRa				*/
+#define ETH_P_LORAWAN	0x00FB		/* LoRaWAN			*/
 
 /*
  *	This is an Ethernet frame header.
diff --git a/net/core/dev.c b/net/core/dev.c
index f68122f0ab02..b95ce79ec5a8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -297,7 +297,7 @@ static const unsigned short netdev_lock_type[] = {
 	 ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
 	 ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM,
 	 ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE,
-	 ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE};
+	 ARPHRD_IEEE802154, ARPHRD_LORAWAN, ARPHRD_VOID, ARPHRD_NONE};
 
 static const char *const netdev_lock_name[] = {
 	"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
@@ -314,7 +314,7 @@ static const char *const netdev_lock_name[] = {
 	"_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL",
 	"_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM",
 	"_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE",
-	"_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"};
+	"_xmit_IEEE802154", "_xmit_LORAWAN", "_xmit_VOID", "_xmit_NONE"};
 
 static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)];
 static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)];
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index aaf520a689d8..0da3a1d69cb8 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1477,7 +1477,9 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
 			return SECCLASS_XDP_SOCKET;
 		case PF_LORA:
 			return SECCLASS_LORA_SOCKET;
-#if PF_MAX > 46
+		case PF_LORAWAN:
+			return SECCLASS_LORAWAN_SOCKET;
+#if PF_MAX > 47
 #error New address family defined, please update this function.
 #endif
 		}
diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
index 060d4bf8385e..fa0151fe6f32 100644
--- a/security/selinux/include/classmap.h
+++ b/security/selinux/include/classmap.h
@@ -244,9 +244,11 @@ struct security_class_mapping secclass_map[] = {
 	  { COMMON_SOCK_PERMS, NULL } },
 	{ "lora_socket",
 	  { COMMON_SOCK_PERMS, NULL } },
+	{ "lorawan_socket",
+	  { COMMON_SOCK_PERMS, NULL } },
 	{ NULL }
   };
 
-#if PF_MAX > 46
+#if PF_MAX > 47
 #error New address family defined, please update secclass_map.
 #endif
-- 
2.19.1

^ permalink raw reply related

* [PATCH V3 0/7] net: lorawan: Add LoRaWAN soft MAC module
From: Jian-Hong Pan @ 2018-11-14 16:01 UTC (permalink / raw)
  To: Andreas Färber, David S . Miller
  Cc: netdev, linux-arm-kernel, linux-kernel, Marcel Holtmann,
	Dollar Chen, Ken Yu, linux-wpan, Stefan Schmidt, Jian-Hong Pan
In-Reply-To: <20181105.101610.1437737564548154497.davem@davemloft.net>

LoRaWAN(TM) is the MAC layer defined by LoRa Alliance(TM) over LoRa
devices.  LoRa is one of Low-Power Wide-Area Network (LPWAN) technology.

LoRaWAN networks typically are laid out in a star-of-stars topology in
which gateways relay messages between end-devices and a central network
server at the backend.  Gateways are connected to the network server via
standard IP connections while end-devices use single hop LoRa(TM) or FSK
communication to one or many gateways.

A LoRa network distinguishes between a basic LoRaWAN (named Class A) and
optional features (Class B, Class C ...):
* Bi-directional end-devices (Class A)
* Bi-directional end-devices with scheduled receive slots (Class B)
* Bi-directional end-devices with maximal receive slots (Class C)

This patch set add LoRaWAN class module implementing the stack,
especially the soft MAC, between socket APIs and LoRa device drivers.

socket APIs:
send and receive the data
------------------------------------------------------------------------
LoRaWAN class module implements soft MAC:
append the header/footer, encryption/decryption, timing slot and MAC
commands
------------------------------------------------------------------------
LoRa device drivers:
send and receive the messages for MAC layer
------------------------------------------------------------------------
LoRa devices

This module starts from simple and implements partial Class A
end-devices features defined in LoRaWAN(TM) Specification Ver. 1.0.2.
More features and complexity, for example regional parameters, confirmed
data messages, join request/accept messages for Over-The-Air Activation,
MAC commands ... will be added in the future.

Jian-Hong Pan (7):
  net: lorawan: Add macro and definition for LoRaWAN
  net: lorawan: Add LoRaWAN socket module
  net: lorawan: Add LoRaWAN API declaration for LoRa devices
  net: maclorawan: Add maclorawan module declaration
  net: maclorawan: Implement the crypto of maclorawan module
  net: maclorawan: Implement maclorawan class module
  net: lorawan: List LORAWAN in menuconfig

 include/linux/lora/lorawan.h        | 131 ++++++
 include/linux/lora/lorawan_netdev.h |  49 ++
 include/linux/socket.h              |   5 +-
 include/uapi/linux/if_arp.h         |   1 +
 include/uapi/linux/if_ether.h       |   1 +
 net/Kconfig                         |   2 +
 net/Makefile                        |   2 +
 net/core/dev.c                      |   4 +-
 net/lorawan/Kconfig                 |  10 +
 net/lorawan/Makefile                |   2 +
 net/lorawan/socket.c                | 688 ++++++++++++++++++++++++++++
 net/maclorawan/Kconfig              |  14 +
 net/maclorawan/Makefile             |   2 +
 net/maclorawan/crypto.c             | 209 +++++++++
 net/maclorawan/crypto.h             |  27 ++
 net/maclorawan/mac.c                | 520 +++++++++++++++++++++
 net/maclorawan/maclorawan.h         | 199 ++++++++
 net/maclorawan/main.c               | 605 ++++++++++++++++++++++++
 security/selinux/hooks.c            |   4 +-
 security/selinux/include/classmap.h |   4 +-
 20 files changed, 2474 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/lora/lorawan.h
 create mode 100644 include/linux/lora/lorawan_netdev.h
 create mode 100644 net/lorawan/Kconfig
 create mode 100644 net/lorawan/Makefile
 create mode 100644 net/lorawan/socket.c
 create mode 100644 net/maclorawan/Kconfig
 create mode 100644 net/maclorawan/Makefile
 create mode 100644 net/maclorawan/crypto.c
 create mode 100644 net/maclorawan/crypto.h
 create mode 100644 net/maclorawan/mac.c
 create mode 100644 net/maclorawan/maclorawan.h
 create mode 100644 net/maclorawan/main.c

-- 
2.19.1

^ permalink raw reply

* Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce
From: Leon Romanovsky @ 2018-11-14 16:00 UTC (permalink / raw)
  To: Kenneth Lee
  Cc: Alexander Shishkin, Tim Sell, Sanyog Kale, Randy Dunlap,
	Uwe Kleine-König, Vinod Koul, David Kershner, Sagar Dharia,
	Gavin Schenk, Jens Axboe, Philippe Ombredanne, Cyrille Pitchen,
	Johan Hovold, Zhou Wang, Hao Fang, Jonathan Cameron, Zaibo Xu,
	linux-doc, linux-kernel
In-Reply-To: <95310df4-b32c-42f0-c750-3ad5eb89b3dd@gmail.com>

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

On Wed, Nov 14, 2018 at 10:58:09AM +0800, Kenneth Lee wrote:
>
> 在 2018/11/13 上午8:23, Leon Romanovsky 写道:
> > On Mon, Nov 12, 2018 at 03:58:02PM +0800, Kenneth Lee wrote:
> > > From: Kenneth Lee <liguozhu@hisilicon.com>
> > >
> > > WarpDrive is a general accelerator framework for the user application to
> > > access the hardware without going through the kernel in data path.
> > >
> > > The kernel component to provide kernel facility to driver for expose the
> > > user interface is called uacce. It a short name for
> > > "Unified/User-space-access-intended Accelerator Framework".
> > >
> > > This patch add document to explain how it works.
> > + RDMA and netdev folks
> >
> > Sorry, to be late in the game, I don't see other patches, but from
> > the description below it seems like you are reinventing RDMA verbs
> > model. I have hard time to see the differences in the proposed
> > framework to already implemented in drivers/infiniband/* for the kernel
> > space and for the https://github.com/linux-rdma/rdma-core/ for the user
> > space parts.
>
> Thanks Leon,
>
> Yes, we tried to solve similar problem in RDMA. We also learned a lot from
> the exist code of RDMA. But we we have to make a new one because we cannot
> register accelerators such as AI operation, encryption or compression to the
> RDMA framework:)

Assuming that you did everything right and still failed to use RDMA
framework, you was supposed to fix it and not to reinvent new exactly
same one. It is how we develop kernel, by reusing existing code.

>
> Another problem we tried to address is the way to pin the memory for dma
> operation. The RDMA way to pin the memory cannot avoid the page lost due to
> copy-on-write operation during the memory is used by the device. This may
> not be important to RDMA library. But it is important to accelerator.

Such support exists in drivers/infiniband/ from late 2014 and
it is called ODP (on demand paging).

>
> Hope this can help the understanding.

Yes, it helped me a lot.
Now, I'm more than before convinced that this whole patchset shouldn't
exist in the first place.

To be clear, NAK.

Thanks

>
> Cheers
>
> >
> > Hard NAK from RDMA side.
> >
> > Thanks
> >
> > > Signed-off-by: Kenneth Lee <liguozhu@hisilicon.com>
> > > ---
> > >   Documentation/warpdrive/warpdrive.rst       | 260 +++++++
> > >   Documentation/warpdrive/wd-arch.svg         | 764 ++++++++++++++++++++
> > >   Documentation/warpdrive/wd.svg              | 526 ++++++++++++++
> > >   Documentation/warpdrive/wd_q_addr_space.svg | 359 +++++++++
> > >   4 files changed, 1909 insertions(+)
> > >   create mode 100644 Documentation/warpdrive/warpdrive.rst
> > >   create mode 100644 Documentation/warpdrive/wd-arch.svg
> > >   create mode 100644 Documentation/warpdrive/wd.svg
> > >   create mode 100644 Documentation/warpdrive/wd_q_addr_space.svg
> > >
> > > diff --git a/Documentation/warpdrive/warpdrive.rst b/Documentation/warpdrive/warpdrive.rst
> > > new file mode 100644
> > > index 000000000000..ef84d3a2d462
> > > --- /dev/null
> > > +++ b/Documentation/warpdrive/warpdrive.rst
> > > @@ -0,0 +1,260 @@
> > > +Introduction of WarpDrive
> > > +=========================
> > > +
> > > +*WarpDrive* is a general accelerator framework for the user application to
> > > +access the hardware without going through the kernel in data path.
> > > +
> > > +It can be used as the quick channel for accelerators, network adaptors or
> > > +other hardware for application in user space.
> > > +
> > > +This may make some implementation simpler.  E.g.  you can reuse most of the
> > > +*netdev* driver in kernel and just share some ring buffer to the user space
> > > +driver for *DPDK* [4] or *ODP* [5]. Or you can combine the RSA accelerator with
> > > +the *netdev* in the user space as a https reversed proxy, etc.
> > > +
> > > +*WarpDrive* takes the hardware accelerator as a heterogeneous processor which
> > > +can share particular load from the CPU:
> > > +
> > > +.. image:: wd.svg
> > > +        :alt: WarpDrive Concept
> > > +
> > > +The virtual concept, queue, is used to manage the requests sent to the
> > > +accelerator. The application send requests to the queue by writing to some
> > > +particular address, while the hardware takes the requests directly from the
> > > +address and send feedback accordingly.
> > > +
> > > +The format of the queue may differ from hardware to hardware. But the
> > > +application need not to make any system call for the communication.
> > > +
> > > +*WarpDrive* tries to create a shared virtual address space for all involved
> > > +accelerators. Within this space, the requests sent to queue can refer to any
> > > +virtual address, which will be valid to the application and all involved
> > > +accelerators.
> > > +
> > > +The name *WarpDrive* is simply a cool and general name meaning the framework
> > > +makes the application faster. It includes general user library, kernel
> > > +management module and drivers for the hardware. In kernel, the management
> > > +module is called *uacce*, meaning "Unified/User-space-access-intended
> > > +Accelerator Framework".
> > > +
> > > +
> > > +How does it work
> > > +================
> > > +
> > > +*WarpDrive* uses *mmap* and *IOMMU* to play the trick.
> > > +
> > > +*Uacce* creates a chrdev for the device registered to it. A "queue" will be
> > > +created when the chrdev is opened. The application access the queue by mmap
> > > +different address region of the queue file.
> > > +
> > > +The following figure demonstrated the queue file address space:
> > > +
> > > +.. image:: wd_q_addr_space.svg
> > > +        :alt: WarpDrive Queue Address Space
> > > +
> > > +The first region of the space, device region, is used for the application to
> > > +write request or read answer to or from the hardware.
> > > +
> > > +Normally, there can be three types of device regions mmio and memory regions.
> > > +It is recommended to use common memory for request/answer descriptors and use
> > > +the mmio space for device notification, such as doorbell. But of course, this
> > > +is all up to the interface designer.
> > > +
> > > +There can be two types of device memory regions, kernel-only and user-shared.
> > > +This will be explained in the "kernel APIs" section.
> > > +
> > > +The Static Share Virtual Memory region is necessary only when the device IOMMU
> > > +does not support "Share Virtual Memory". This will be explained after the
> > > +*IOMMU* idea.
> > > +
> > > +
> > > +Architecture
> > > +------------
> > > +
> > > +The full *WarpDrive* architecture is represented in the following class
> > > +diagram:
> > > +
> > > +.. image:: wd-arch.svg
> > > +        :alt: WarpDrive Architecture
> > > +
> > > +
> > > +The user API
> > > +------------
> > > +
> > > +We adopt a polling style interface in the user space: ::
> > > +
> > > +        int wd_request_queue(struct wd_queue *q);
> > > +        void wd_release_queue(struct wd_queue *q);
> > > +
> > > +        int wd_send(struct wd_queue *q, void *req);
> > > +        int wd_recv(struct wd_queue *q, void **req);
> > > +        int wd_recv_sync(struct wd_queue *q, void **req);
> > > +        void wd_flush(struct wd_queue *q);
> > > +
> > > +wd_recv_sync() is a wrapper to its non-sync version. It will trapped into
> > > +kernel and waits until the queue become available.
> > > +
> > > +If the queue do not support SVA/SVM. The following helper function
> > > +can be used to create Static Virtual Share Memory: ::
> > > +
> > > +        void *wd_preserve_share_memory(struct wd_queue *q, size_t size);
> > > +
> > > +The user API is not mandatory. It is simply a suggestion and hint what the
> > > +kernel interface is supposed to support.
> > > +
> > > +
> > > +The user driver
> > > +---------------
> > > +
> > > +The queue file mmap space will need a user driver to wrap the communication
> > > +protocol. *UACCE* provides some attributes in sysfs for the user driver to
> > > +match the right accelerator accordingly.
> > > +
> > > +The *UACCE* device attribute is under the following directory:
> > > +
> > > +/sys/class/uacce/<dev-name>/params
> > > +
> > > +The following attributes is supported:
> > > +
> > > +nr_queue_remained (ro)
> > > +        number of queue remained
> > > +
> > > +api_version (ro)
> > > +        a string to identify the queue mmap space format and its version
> > > +
> > > +device_attr (ro)
> > > +        attributes of the device, see UACCE_DEV_xxx flag defined in uacce.h
> > > +
> > > +numa_node (ro)
> > > +        id of numa node
> > > +
> > > +priority (rw)
> > > +        Priority or the device, bigger is higher
> > > +
> > > +(This is not yet implemented in RFC version)
> > > +
> > > +
> > > +The kernel API
> > > +--------------
> > > +
> > > +The *uacce* kernel API is defined in uacce.h. If the hardware support SVM/SVA,
> > > +The driver need only the following API functions: ::
> > > +
> > > +        int uacce_register(uacce);
> > > +        void uacce_unregister(uacce);
> > > +        void uacce_wake_up(q);
> > > +
> > > +*uacce_wake_up* is used to notify the process who epoll() on the queue file.
> > > +
> > > +According to the IOMMU capability, *uacce* categories the devices as follow:
> > > +
> > > +UACCE_DEV_NOIOMMU
> > > +        The device has no IOMMU. The user process cannot use VA on the hardware
> > > +        This mode is not recommended.
> > > +
> > > +UACCE_DEV_SVA (UACCE_DEV_PASID | UACCE_DEV_FAULT_FROM_DEV)
> > > +        The device has IOMMU which can share the same page table with user
> > > +        process
> > > +
> > > +UACCE_DEV_SHARE_DOMAIN
> > > +        The device has IOMMU which has no multiple page table and device page
> > > +        fault support
> > > +
> > > +If the device works in mode other than UACCE_DEV_NOIOMMU, *uacce* will set its
> > > +IOMMU to IOMMU_DOMAIN_UNMANAGED. So the driver must not use any kernel
> > > +DMA API but the following ones from *uacce* instead: ::
> > > +
> > > +        uacce_dma_map(q, va, size, prot);
> > > +        uacce_dma_unmap(q, va, size, prot);
> > > +
> > > +*uacce_dma_map/unmap* is valid only for UACCE_DEV_SVA device. It creates a
> > > +particular PASID and page table for the kernel in the IOMMU (Not yet
> > > +implemented in the RFC)
> > > +
> > > +For the UACCE_DEV_SHARE_DOMAIN device, uacce_dma_map/unmap is not valid.
> > > +*Uacce* call back start_queue only when the DUS and DKO region is mmapped. The
> > > +accelerator driver must use those dma buffer, via uacce_queue->qfrs[], on
> > > +start_queue call back. The size of the queue file region is defined by
> > > +uacce->ops->qf_pg_start[].
> > > +
> > > +We have to do it this way because most of current IOMMU cannot support the
> > > +kernel and user virtual address at the same time. So we have to let them both
> > > +share the same user virtual address space.
> > > +
> > > +If the device have to support kernel and user at the same time, both kernel
> > > +and the user should use these DMA API. This is not convenient. A better
> > > +solution is to change the future DMA/IOMMU design to let them separate the
> > > +address space between the user and kernel space. But it is not going to be in
> > > +a short time.
> > > +
> > > +
> > > +Multiple processes support
> > > +==========================
> > > +
> > > +In the latest mainline kernel (4.19) when this document is written, the IOMMU
> > > +subsystem do not support multiple process page tables yet.
> > > +
> > > +Most IOMMU hardware implementation support multi-process with the concept
> > > +of PASID. But they may use different name, e.g. it is call sub-stream-id in
> > > +SMMU of ARM. With PASID or similar design, multi page table can be added to
> > > +the IOMMU and referred by its PASID.
> > > +
> > > +*JPB* has a patchset to enable this[1]_. We have tested it with our hardware
> > > +(which is known as *D06*). It works well. *WarpDrive* rely on them to support
> > > +UACCE_DEV_SVA. If it is not enabled, *WarpDrive* can still work. But it
> > > +support only one process, the device will be set to UACCE_DEV_SHARE_DOMAIN
> > > +even it is set to UACCE_DEV_SVA initially.
> > > +
> > > +Static Share Virtual Memory is mainly used by UACCE_DEV_SHARE_DOMAIN device.
> > > +
> > > +
> > > +Legacy Mode Support
> > > +===================
> > > +For the hardware without IOMMU, WarpDrive can still work, the only problem is
> > > +VA cannot be used in the device. The driver should adopt another strategy for
> > > +the shared memory. It is only for testing, and not recommended.
> > > +
> > > +
> > > +The Folk Scenario
> > > +=================
> > > +For a process with allocated queues and shared memory, what happen if it forks
> > > +a child?
> > > +
> > > +The fd of the queue will be duplicated on folk, so the child can send request
> > > +to the same queue as its parent. But the requests which is sent from processes
> > > +except for the one who open the queue will be blocked.
> > > +
> > > +It is recommended to add O_CLOEXEC to the queue file.
> > > +
> > > +The queue mmap space has a VM_DONTCOPY in its VMA. So the child will lost all
> > > +those VMAs.
> > > +
> > > +This is why *WarpDrive* does not adopt the mode used in *VFIO* and *InfiniBand*.
> > > +Both solutions can set any user pointer for hardware sharing. But they cannot
> > > +support fork when the dma is in process. Or the "Copy-On-Write" procedure will
> > > +make the parent process lost its physical pages.
> > > +
> > > +
> > > +The Sample Code
> > > +===============
> > > +There is a sample user land implementation with a simple driver for Hisilicon
> > > +Hi1620 ZIP Accelerator.
> > > +
> > > +To test, do the following in samples/warpdrive (for the case of PC host): ::
> > > +        ./autogen.sh
> > > +        ./conf.sh       # or simply ./configure if you build on target system
> > > +        make
> > > +
> > > +Then you can get test_hisi_zip in the test subdirectory. Copy it to the target
> > > +system and make sure the hisi_zip driver is enabled (the major and minor of
> > > +the uacce chrdev can be gotten from the dmesg or sysfs), and run: ::
> > > +        mknod /dev/ua1 c <major> <minior>
> > > +        test/test_hisi_zip -z < data > data.zip
> > > +        test/test_hisi_zip -g < data > data.gzip
> > > +
> > > +
> > > +References
> > > +==========
> > > +.. [1] https://patchwork.kernel.org/patch/10394851/
> > > +
> > > +.. vim: tw=78
> > > diff --git a/Documentation/warpdrive/wd-arch.svg b/Documentation/warpdrive/wd-arch.svg
> > > new file mode 100644
> > > index 000000000000..e59934188443
> > > --- /dev/null
> > > +++ b/Documentation/warpdrive/wd-arch.svg
> > > @@ -0,0 +1,764 @@
> > > +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > > +<!-- Created with Inkscape (http://www.inkscape.org/) -->
> > > +
> > > +<svg
> > > +   xmlns:dc="http://purl.org/dc/elements/1.1/"
> > > +   xmlns:cc="http://creativecommons.org/ns#"
> > > +   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> > > +   xmlns:svg="http://www.w3.org/2000/svg"
> > > +   xmlns="http://www.w3.org/2000/svg"
> > > +   xmlns:xlink="http://www.w3.org/1999/xlink"
> > > +   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
> > > +   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
> > > +   width="210mm"
> > > +   height="193mm"
> > > +   viewBox="0 0 744.09449 683.85823"
> > > +   id="svg2"
> > > +   version="1.1"
> > > +   inkscape:version="0.92.3 (2405546, 2018-03-11)"
> > > +   sodipodi:docname="wd-arch.svg">
> > > +  <defs
> > > +     id="defs4">
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       id="linearGradient6830">
> > > +      <stop
> > > +         style="stop-color:#000000;stop-opacity:1;"
> > > +         offset="0"
> > > +         id="stop6832" />
> > > +      <stop
> > > +         style="stop-color:#000000;stop-opacity:0;"
> > > +         offset="1"
> > > +         id="stop6834" />
> > > +    </linearGradient>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="translate(-89.949614,405.94594)" />
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       id="linearGradient5026">
> > > +      <stop
> > > +         style="stop-color:#f2f2f2;stop-opacity:1;"
> > > +         offset="0"
> > > +         id="stop5028" />
> > > +      <stop
> > > +         style="stop-color:#f2f2f2;stop-opacity:0;"
> > > +         offset="1"
> > > +         id="stop5030" />
> > > +    </linearGradient>
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6" />
> > > +    </filter>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-1"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="translate(175.77842,400.29111)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-0"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-9" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="18.960653"
> > > +       markerHeight="11.194658"
> > > +       refX="9.4803267"
> > > +       refY="5.5973287"
> > > +       orient="auto"
> > > +       id="marker4613">
> > > +      <rect
> > > +         y="-5.1589785"
> > > +         x="5.8504119"
> > > +         height="10.317957"
> > > +         width="10.317957"
> > > +         id="rect4212"
> > > +         style="fill:#ffffff;stroke:#000000;stroke-width:0.69143367;stroke-miterlimit:4;stroke-dasharray:none"
> > > +         transform="matrix(0.86111274,0.50841405,-0.86111274,0.50841405,0,0)">
> > > +        <title
> > > +           id="title4262">generation</title>
> > > +      </rect>
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-9"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.2452511,0,0,0.98513016,-190.95632,540.33156)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-9-7"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.3742742,0,0,0.97786398,-234.52617,654.63367)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8-5"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9-0" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-6">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-1"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-9-4"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.3742912,0,0,2.0035845,-468.34428,342.56603)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8-54"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9-7" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1-8">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9-6"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1-8-8">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9-6-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-0">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-93"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-0-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-93-6"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter5382"
> > > +       x="-0.089695387"
> > > +       width="1.1793908"
> > > +       y="-0.10052069"
> > > +       height="1.2010413">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="0.86758925"
> > > +         id="feGaussianBlur5384" />
> > > +    </filter>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient6830"
> > > +       id="linearGradient6836"
> > > +       x1="362.73923"
> > > +       y1="700.04059"
> > > +       x2="340.4751"
> > > +       y2="678.25488"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="translate(-23.771026,-135.76835)" />
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-6-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-1-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-9-7-3"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.3742742,0,0,0.97786395,-57.357186,649.55786)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8-5-0"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9-0-2" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1-1">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9-0"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +  </defs>
> > > +  <sodipodi:namedview
> > > +     id="base"
> > > +     pagecolor="#ffffff"
> > > +     bordercolor="#666666"
> > > +     borderopacity="1.0"
> > > +     inkscape:pageopacity="0.0"
> > > +     inkscape:pageshadow="2"
> > > +     inkscape:zoom="0.98994949"
> > > +     inkscape:cx="222.32868"
> > > +     inkscape:cy="370.44492"
> > > +     inkscape:document-units="px"
> > > +     inkscape:current-layer="layer1"
> > > +     showgrid="false"
> > > +     inkscape:window-width="1916"
> > > +     inkscape:window-height="1033"
> > > +     inkscape:window-x="0"
> > > +     inkscape:window-y="22"
> > > +     inkscape:window-maximized="0"
> > > +     fit-margin-right="0.3"
> > > +     inkscape:snap-global="false" />
> > > +  <metadata
> > > +     id="metadata7">
> > > +    <rdf:RDF>
> > > +      <cc:Work
> > > +         rdf:about="">
> > > +        <dc:format>image/svg+xml</dc:format>
> > > +        <dc:type
> > > +           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
> > > +        <dc:title />
> > > +      </cc:Work>
> > > +    </rdf:RDF>
> > > +  </metadata>
> > > +  <g
> > > +     inkscape:label="Layer 1"
> > > +     inkscape:groupmode="layer"
> > > +     id="layer1"
> > > +     transform="translate(0,-368.50374)">
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3)"
> > > +       id="rect4136-3-6"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="283.01144"
> > > +       y="588.80896" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032);fill-opacity:1;stroke:#000000;stroke-width:0.6465112"
> > > +       id="rect4136-2"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="281.63498"
> > > +       y="586.75739" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="294.21747"
> > > +       y="612.50073"
> > > +       id="text4138-6"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1"
> > > +         x="294.21747"
> > > +         y="612.50073"
> > > +         style="font-size:15px;line-height:1.25">WarpDrive</tspan></text>
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-0)"
> > > +       id="rect4136-3-6-3"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="548.7395"
> > > +       y="583.15417" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-1);fill-opacity:1;stroke:#000000;stroke-width:0.6465112"
> > > +       id="rect4136-2-60"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="547.36304"
> > > +       y="581.1026" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="557.83484"
> > > +       y="602.32745"
> > > +       id="text4138-6-6"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-2"
> > > +         x="557.83484"
> > > +         y="602.32745"
> > > +         style="font-size:15px;line-height:1.25">user_driver</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4613)"
> > > +       d="m 547.36304,600.78954 -156.58203,0.0691"
> > > +       id="path4855"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8)"
> > > +       id="rect4136-3-6-5-7"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.2452511,0,0,0.98513016,113.15182,641.02594)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-9);fill-opacity:1;stroke:#000000;stroke-width:0.71606314"
> > > +       id="rect4136-2-6-3"
> > > +       width="125.86729"
> > > +       height="31.522341"
> > > +       x="271.75983"
> > > +       y="718.45435" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="309.13705"
> > > +       y="745.55371"
> > > +       id="text4138-6-2-6"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1"
> > > +         x="309.13705"
> > > +         y="745.55371"
> > > +         style="font-size:15px;line-height:1.25">uacce</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2)"
> > > +       d="m 329.57309,619.72453 5.0373,97.14447"
> > > +       id="path4661-3"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2-1)"
> > > +       d="m 342.57219,830.63108 -5.67699,-79.2841"
> > > +       id="path4661-3-4"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8-5)"
> > > +       id="rect4136-3-6-5-7-3"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.3742742,0,0,0.97786398,101.09126,754.58534)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-9-7);fill-opacity:1;stroke:#000000;stroke-width:0.74946606"
> > > +       id="rect4136-2-6-3-6"
> > > +       width="138.90866"
> > > +       height="31.289837"
> > > +       x="276.13297"
> > > +       y="831.44263" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="295.67819"
> > > +       y="852.98224"
> > > +       id="text4138-6-2-6-1"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-0"
> > > +         x="295.67819"
> > > +         y="852.98224"
> > > +         style="font-size:15px;line-height:1.25">Device Driver</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2-6)"
> > > +       d="m 623.05084,615.00104 0.51369,333.80219"
> > > +       id="path4661-3-5"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="392.63568"
> > > +       y="660.83667"
> > > +       id="text4138-6-2-6-1-6-2-5"><tspan
> > > +         sodipodi:role="line"
> > > +         x="392.63568"
> > > +         y="660.83667"
> > > +         id="tspan4305"
> > > +         style="font-size:15px;line-height:1.25">&lt;&lt;anom_file&gt;&gt;</tspan><tspan
> > > +         sodipodi:role="line"
> > > +         x="392.63568"
> > > +         y="679.58667"
> > > +         style="font-size:15px;line-height:1.25"
> > > +         id="tspan1139">Queue FD</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="389.92969"
> > > +       y="587.44836"
> > > +       id="text4138-6-2-6-1-6-2-56"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-0-3-0-9"
> > > +         x="389.92969"
> > > +         y="587.44836"
> > > +         style="font-size:15px;line-height:1.25">1</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="528.64813"
> > > +       y="600.08429"
> > > +       id="text4138-6-2-6-1-6-3"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-0-3-7"
> > > +         x="528.64813"
> > > +         y="600.08429"
> > > +         style="font-size:15px;line-height:1.25">*</tspan></text>
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8-54)"
> > > +       id="rect4136-3-6-5-7-4"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.3745874,0,0,1.8929066,-132.7754,556.04505)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-9-4);fill-opacity:1;stroke:#000000;stroke-width:1.07280123"
> > > +       id="rect4136-2-6-3-4"
> > > +       width="138.91039"
> > > +       height="64.111"
> > > +       x="42.321312"
> > > +       y="704.8371" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="110.30745"
> > > +       y="722.94025"
> > > +       id="text4138-6-2-6-3"><tspan
> > > +         sodipodi:role="line"
> > > +         x="111.99202"
> > > +         y="722.94025"
> > > +         id="tspan4366"
> > > +         style="font-size:15px;line-height:1.25;text-align:center;text-anchor:middle">other standard </tspan><tspan
> > > +         sodipodi:role="line"
> > > +         x="110.30745"
> > > +         y="741.69025"
> > > +         id="tspan4368"
> > > +         style="font-size:15px;line-height:1.25;text-align:center;text-anchor:middle">framework</tspan><tspan
> > > +         sodipodi:role="line"
> > > +         x="110.30745"
> > > +         y="760.44025"
> > > +         style="font-size:15px;line-height:1.25;text-align:center;text-anchor:middle"
> > > +         id="tspan6840">(crypto/nic/others)</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2-1-8)"
> > > +       d="M 276.29661,849.04109 134.04449,771.90853"
> > > +       id="path4661-3-4-8"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="313.70813"
> > > +       y="730.06366"
> > > +       id="text4138-6-2-6-36"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-7"
> > > +         x="313.70813"
> > > +         y="730.06366"
> > > +         style="font-size:10px;line-height:1.25">&lt;&lt;lkm&gt;&gt;</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="259.53165"
> > > +       y="797.8056"
> > > +       id="text4138-6-2-6-1-6-2-5-7-5"><tspan
> > > +         sodipodi:role="line"
> > > +         x="259.53165"
> > > +         y="797.8056"
> > > +         style="font-size:15px;line-height:1.25;text-align:start;text-anchor:start"
> > > +         id="tspan2357">uacce register api</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="29.145819"
> > > +       y="833.44244"
> > > +       id="text4138-6-2-6-1-6-2-5-7-5-2"><tspan
> > > +         sodipodi:role="line"
> > > +         x="29.145819"
> > > +         y="833.44244"
> > > +         id="tspan4301"
> > > +         style="font-size:15px;line-height:1.25">register to other subsystem</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="301.20813"
> > > +       y="597.29437"
> > > +       id="text4138-6-2-6-36-1"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-7-2"
> > > +         x="301.20813"
> > > +         y="597.29437"
> > > +         style="font-size:10px;line-height:1.25">&lt;&lt;user_lib&gt;&gt;</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="615.9505"
> > > +       y="739.44012"
> > > +       id="text4138-6-2-6-1-6-2-5-3"><tspan
> > > +         sodipodi:role="line"
> > > +         x="615.9505"
> > > +         y="739.44012"
> > > +         id="tspan4274-7"
> > > +         style="font-size:15px;line-height:1.25">mmapped memory r/w interface</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="371.01291"
> > > +       y="529.23682"
> > > +       id="text4138-6-2-6-1-6-2-5-36"><tspan
> > > +         sodipodi:role="line"
> > > +         x="371.01291"
> > > +         y="529.23682"
> > > +         id="tspan4305-3"
> > > +         style="font-size:15px;line-height:1.25">wd user api</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="m 328.19325,585.87943 0,-23.57142"
> > > +       id="path4348"
> > > +       inkscape:connector-curvature="0" />
> > > +    <ellipse
> > > +       style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0"
> > > +       id="path4350"
> > > +       cx="328.01468"
> > > +       cy="551.95081"
> > > +       rx="11.607142"
> > > +       ry="10.357142" />
> > > +    <path
> > > +       style="opacity:0.444;fill:url(#linearGradient6836);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;filter:url(#filter5382)"
> > > +       id="path4350-2"
> > > +       sodipodi:type="arc"
> > > +       sodipodi:cx="329.44327"
> > > +       sodipodi:cy="553.37933"
> > > +       sodipodi:rx="11.607142"
> > > +       sodipodi:ry="10.357142"
> > > +       sodipodi:start="0"
> > > +       sodipodi:end="6.2509098"
> > > +       d="m 341.05041,553.37933 a 11.607142,10.357142 0 0 1 -11.51349,10.35681 11.607142,10.357142 0 0 1 -11.69928,-10.18967 11.607142,10.357142 0 0 1 11.32469,-10.52124 11.607142,10.357142 0 0 1 11.88204,10.01988"
> > > +       sodipodi:open="true" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="619.67596"
> > > +       y="978.22363"
> > > +       id="text4138-6-2-6-1-6-2-5-36-3"><tspan
> > > +         sodipodi:role="line"
> > > +         x="619.67596"
> > > +         y="978.22363"
> > > +         id="tspan4305-3-67"
> > > +         style="font-size:15px;line-height:1.25">Device(Hardware)</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2-6-2)"
> > > +       d="m 347.51164,865.4527 193.91929,99.10053"
> > > +       id="path4661-3-5-1"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8-5-0)"
> > > +       id="rect4136-3-6-5-7-3-1"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.3742742,0,0,0.97786395,278.26025,749.50952)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-9-7-3);fill-opacity:1;stroke:#000000;stroke-width:0.74946606"
> > > +       id="rect4136-2-6-3-6-0"
> > > +       width="138.90868"
> > > +       height="31.289839"
> > > +       x="453.30197"
> > > +       y="826.36682" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="493.68158"
> > > +       y="847.90643"
> > > +       id="text4138-6-2-6-1-5"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-1-0-1"
> > > +         x="493.68158"
> > > +         y="847.90643"
> > > +         style="font-size:15px;line-height:1.25;stroke-width:1px">IOMMU</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-2-1-1)"
> > > +       d="m 389.49372,755.46667 111.75324,68.4507"
> > > +       id="path4661-3-4-85"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="427.70282"
> > > +       y="776.91418"
> > > +       id="text4138-6-2-6-1-6-2-5-7-5-0"><tspan
> > > +         sodipodi:role="line"
> > > +         x="427.70282"
> > > +         y="776.91418"
> > > +         style="font-size:15px;line-height:1.25;text-align:start;text-anchor:start;stroke-width:1px"
> > > +         id="tspan2357-6">manage the driver iommu state</tspan></text>
> > > +  </g>
> > > +</svg>
> > > diff --git a/Documentation/warpdrive/wd.svg b/Documentation/warpdrive/wd.svg
> > > new file mode 100644
> > > index 000000000000..87ab92ebfbc6
> > > --- /dev/null
> > > +++ b/Documentation/warpdrive/wd.svg
> > > @@ -0,0 +1,526 @@
> > > +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > > +<!-- Created with Inkscape (http://www.inkscape.org/) -->
> > > +
> > > +<svg
> > > +   xmlns:dc="http://purl.org/dc/elements/1.1/"
> > > +   xmlns:cc="http://creativecommons.org/ns#"
> > > +   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> > > +   xmlns:svg="http://www.w3.org/2000/svg"
> > > +   xmlns="http://www.w3.org/2000/svg"
> > > +   xmlns:xlink="http://www.w3.org/1999/xlink"
> > > +   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
> > > +   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
> > > +   width="210mm"
> > > +   height="116mm"
> > > +   viewBox="0 0 744.09449 411.02338"
> > > +   id="svg2"
> > > +   version="1.1"
> > > +   inkscape:version="0.92.3 (2405546, 2018-03-11)"
> > > +   sodipodi:docname="wd.svg">
> > > +  <defs
> > > +     id="defs4">
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       id="linearGradient5026">
> > > +      <stop
> > > +         style="stop-color:#f2f2f2;stop-opacity:1;"
> > > +         offset="0"
> > > +         id="stop5028" />
> > > +      <stop
> > > +         style="stop-color:#f2f2f2;stop-opacity:0;"
> > > +         offset="1"
> > > +         id="stop5030" />
> > > +    </linearGradient>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(2.7384117,0,0,0.91666329,-952.8283,571.10143)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="18.960653"
> > > +       markerHeight="11.194658"
> > > +       refX="9.4803267"
> > > +       refY="5.5973287"
> > > +       orient="auto"
> > > +       id="marker4613">
> > > +      <rect
> > > +         y="-5.1589785"
> > > +         x="5.8504119"
> > > +         height="10.317957"
> > > +         width="10.317957"
> > > +         id="rect4212"
> > > +         style="fill:#ffffff;stroke:#000000;stroke-width:0.69143367;stroke-miterlimit:4;stroke-dasharray:none"
> > > +         transform="matrix(0.86111274,0.50841405,-0.86111274,0.50841405,0,0)">
> > > +        <title
> > > +           id="title4262">generation</title>
> > > +      </rect>
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-9"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.2452511,0,0,0.98513016,-190.95632,540.33156)" />
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-6">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-1"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1-8">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9-6"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-1-8-8">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-9-6-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-0">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-93"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-0-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-93-6"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-2-6-2">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-9-1-9"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-8"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.0104674,0,0,1.0052679,-218.642,661.15448)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9" />
> > > +    </filter>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-8-2"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(2.1450559,0,0,1.0052679,-521.97704,740.76422)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8-5"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9-1" />
> > > +    </filter>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-8-0"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.0104674,0,0,1.0052679,83.456748,660.20747)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-8-6"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-9-2" />
> > > +    </filter>
> > > +    <linearGradient
> > > +       inkscape:collect="always"
> > > +       xlink:href="#linearGradient5026"
> > > +       id="linearGradient5032-3-84"
> > > +       x1="353"
> > > +       y1="211.3622"
> > > +       x2="565.5"
> > > +       y2="174.8622"
> > > +       gradientUnits="userSpaceOnUse"
> > > +       gradientTransform="matrix(1.9884948,0,0,0.94903536,-318.42665,564.37696)" />
> > > +    <filter
> > > +       inkscape:collect="always"
> > > +       style="color-interpolation-filters:sRGB"
> > > +       id="filter4169-3-5-4"
> > > +       x="-0.031597666"
> > > +       width="1.0631953"
> > > +       y="-0.099812768"
> > > +       height="1.1996255">
> > > +      <feGaussianBlur
> > > +         inkscape:collect="always"
> > > +         stdDeviation="1.3307599"
> > > +         id="feGaussianBlur4171-6-3-0" />
> > > +    </filter>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-0-0">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-93-8"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +    <marker
> > > +       markerWidth="11.227358"
> > > +       markerHeight="12.355258"
> > > +       refX="10"
> > > +       refY="6.177629"
> > > +       orient="auto"
> > > +       id="marker4825-6-3">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path4757-1-1"
> > > +         d="M 0.42024733,0.42806444 10.231357,6.3500844 0.24347733,11.918544"
> > > +         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
> > > +    </marker>
> > > +  </defs>
> > > +  <sodipodi:namedview
> > > +     id="base"
> > > +     pagecolor="#ffffff"
> > > +     bordercolor="#666666"
> > > +     borderopacity="1.0"
> > > +     inkscape:pageopacity="0.0"
> > > +     inkscape:pageshadow="2"
> > > +     inkscape:zoom="0.98994949"
> > > +     inkscape:cx="457.47339"
> > > +     inkscape:cy="250.14781"
> > > +     inkscape:document-units="px"
> > > +     inkscape:current-layer="layer1"
> > > +     showgrid="false"
> > > +     inkscape:window-width="1916"
> > > +     inkscape:window-height="1033"
> > > +     inkscape:window-x="0"
> > > +     inkscape:window-y="22"
> > > +     inkscape:window-maximized="0"
> > > +     fit-margin-right="0.3" />
> > > +  <metadata
> > > +     id="metadata7">
> > > +    <rdf:RDF>
> > > +      <cc:Work
> > > +         rdf:about="">
> > > +        <dc:format>image/svg+xml</dc:format>
> > > +        <dc:type
> > > +           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
> > > +        <dc:title></dc:title>
> > > +      </cc:Work>
> > > +    </rdf:RDF>
> > > +  </metadata>
> > > +  <g
> > > +     inkscape:label="Layer 1"
> > > +     inkscape:groupmode="layer"
> > > +     id="layer1"
> > > +     transform="translate(0,-641.33861)">
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5)"
> > > +       id="rect4136-3-6-5"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(2.7384116,0,0,0.91666328,-284.06895,664.79751)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3);fill-opacity:1;stroke:#000000;stroke-width:1.02430749"
> > > +       id="rect4136-2-6"
> > > +       width="276.79272"
> > > +       height="29.331528"
> > > +       x="64.723419"
> > > +       y="736.84473" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="78.223282"
> > > +       y="756.79803"
> > > +       id="text4138-6-2"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9"
> > > +         x="78.223282"
> > > +         y="756.79803"
> > > +         style="font-size:15px;line-height:1.25">user application (running by the CPU</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6)"
> > > +       d="m 217.67507,876.6738 113.40331,45.0758"
> > > +       id="path4661"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-0)"
> > > +       d="m 208.10197,767.69811 0.29362,76.03656"
> > > +       id="path4661-6"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8)"
> > > +       id="rect4136-3-6-5-3"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.0104673,0,0,1.0052679,28.128628,763.90722)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-8);fill-opacity:1;stroke:#000000;stroke-width:0.65159565"
> > > +       id="rect4136-2-6-6"
> > > +       width="102.13586"
> > > +       height="32.16671"
> > > +       x="156.83217"
> > > +       y="842.91852" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="188.58519"
> > > +       y="864.47125"
> > > +       id="text4138-6-2-8"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-0"
> > > +         x="188.58519"
> > > +         y="864.47125"
> > > +         style="font-size:15px;line-height:1.25;stroke-width:1px">MMU</tspan></text>
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8-5)"
> > > +       id="rect4136-3-6-5-3-1"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(2.1450556,0,0,1.0052679,1.87637,843.51696)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-8-2);fill-opacity:1;stroke:#000000;stroke-width:0.94937181"
> > > +       id="rect4136-2-6-6-0"
> > > +       width="216.8176"
> > > +       height="32.16671"
> > > +       x="275.09283"
> > > +       y="922.5282" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="347.81482"
> > > +       y="943.23291"
> > > +       id="text4138-6-2-8-8"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-0-5"
> > > +         x="347.81482"
> > > +         y="943.23291"
> > > +         style="font-size:15px;line-height:1.25;stroke-width:1px">Memory</tspan></text>
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-8-6)"
> > > +       id="rect4136-3-6-5-3-5"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.0104673,0,0,1.0052679,330.22737,762.9602)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-8-0);fill-opacity:1;stroke:#000000;stroke-width:0.65159565"
> > > +       id="rect4136-2-6-6-8"
> > > +       width="102.13586"
> > > +       height="32.16671"
> > > +       x="458.93091"
> > > +       y="841.9715" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="490.68393"
> > > +       y="863.52423"
> > > +       id="text4138-6-2-8-6"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-0-2"
> > > +         x="490.68393"
> > > +         y="863.52423"
> > > +         style="font-size:15px;line-height:1.25;stroke-width:1px">IOMMU</tspan></text>
> > > +    <rect
> > > +       style="fill:#000000;stroke:#000000;stroke-width:0.6465112;filter:url(#filter4169-3-5-4)"
> > > +       id="rect4136-3-6-5-6"
> > > +       width="101.07784"
> > > +       height="31.998148"
> > > +       x="128.74678"
> > > +       y="80.648842"
> > > +       transform="matrix(1.9884947,0,0,0.94903537,167.19229,661.38193)" />
> > > +    <rect
> > > +       style="fill:url(#linearGradient5032-3-84);fill-opacity:1;stroke:#000000;stroke-width:0.88813609"
> > > +       id="rect4136-2-6-2"
> > > +       width="200.99274"
> > > +       height="30.367374"
> > > +       x="420.4675"
> > > +       y="735.97351" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:12px;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="441.95297"
> > > +       y="755.9068"
> > > +       id="text4138-6-2-9"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan4140-1-9-9"
> > > +         x="441.95297"
> > > +         y="755.9068"
> > > +         style="font-size:15px;line-height:1.25;stroke-width:1px">Hardware Accelerator</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-0-0)"
> > > +       d="m 508.2914,766.55885 0.29362,76.03656"
> > > +       id="path4661-6-1"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4825-6-3)"
> > > +       d="M 499.70201,876.47297 361.38296,920.80258"
> > > +       id="path4661-1"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +  </g>
> > > +</svg>
> > > diff --git a/Documentation/warpdrive/wd_q_addr_space.svg b/Documentation/warpdrive/wd_q_addr_space.svg
> > > new file mode 100644
> > > index 000000000000..5e6cf8e89908
> > > --- /dev/null
> > > +++ b/Documentation/warpdrive/wd_q_addr_space.svg
> > > @@ -0,0 +1,359 @@
> > > +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > > +<!-- Created with Inkscape (http://www.inkscape.org/) -->
> > > +
> > > +<svg
> > > +   xmlns:dc="http://purl.org/dc/elements/1.1/"
> > > +   xmlns:cc="http://creativecommons.org/ns#"
> > > +   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> > > +   xmlns:svg="http://www.w3.org/2000/svg"
> > > +   xmlns="http://www.w3.org/2000/svg"
> > > +   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
> > > +   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
> > > +   width="210mm"
> > > +   height="124mm"
> > > +   viewBox="0 0 210 124"
> > > +   version="1.1"
> > > +   id="svg8"
> > > +   inkscape:version="0.92.3 (2405546, 2018-03-11)"
> > > +   sodipodi:docname="wd_q_addr_space.svg">
> > > +  <defs
> > > +     id="defs2">
> > > +    <marker
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       orient="auto"
> > > +       refY="0"
> > > +       refX="0"
> > > +       id="marker5428"
> > > +       style="overflow:visible"
> > > +       inkscape:isstock="true">
> > > +      <path
> > > +         id="path5426"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:isstock="true"
> > > +       style="overflow:visible"
> > > +       id="marker2922"
> > > +       refX="0"
> > > +       refY="0"
> > > +       orient="auto"
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       inkscape:collect="always">
> > > +      <path
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         id="path2920"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:stockid="Arrow1Mstart"
> > > +       orient="auto"
> > > +       refY="0"
> > > +       refX="0"
> > > +       id="Arrow1Mstart"
> > > +       style="overflow:visible"
> > > +       inkscape:isstock="true">
> > > +      <path
> > > +         id="path840"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         transform="matrix(0.4,0,0,0.4,4,0)"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       orient="auto"
> > > +       refY="0"
> > > +       refX="0"
> > > +       id="Arrow1Mend"
> > > +       style="overflow:visible"
> > > +       inkscape:isstock="true"
> > > +       inkscape:collect="always">
> > > +      <path
> > > +         id="path843"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:stockid="Arrow1Mstart"
> > > +       orient="auto"
> > > +       refY="0"
> > > +       refX="0"
> > > +       id="Arrow1Mstart-5"
> > > +       style="overflow:visible"
> > > +       inkscape:isstock="true">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path840-1"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         transform="matrix(0.4,0,0,0.4,4,0)" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       orient="auto"
> > > +       refY="0"
> > > +       refX="0"
> > > +       id="Arrow1Mend-1"
> > > +       style="overflow:visible"
> > > +       inkscape:isstock="true">
> > > +      <path
> > > +         inkscape:connector-curvature="0"
> > > +         id="path843-0"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:isstock="true"
> > > +       style="overflow:visible"
> > > +       id="marker2922-2"
> > > +       refX="0"
> > > +       refY="0"
> > > +       orient="auto"
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       inkscape:collect="always">
> > > +      <path
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         id="path2920-9"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:isstock="true"
> > > +       style="overflow:visible"
> > > +       id="marker2922-27"
> > > +       refX="0"
> > > +       refY="0"
> > > +       orient="auto"
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       inkscape:collect="always">
> > > +      <path
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         id="path2920-0"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +    <marker
> > > +       inkscape:isstock="true"
> > > +       style="overflow:visible"
> > > +       id="marker2922-27-8"
> > > +       refX="0"
> > > +       refY="0"
> > > +       orient="auto"
> > > +       inkscape:stockid="Arrow1Mend"
> > > +       inkscape:collect="always">
> > > +      <path
> > > +         transform="matrix(-0.4,0,0,-0.4,-4,0)"
> > > +         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
> > > +         d="M 0,0 5,-5 -12.5,0 5,5 Z"
> > > +         id="path2920-0-0"
> > > +         inkscape:connector-curvature="0" />
> > > +    </marker>
> > > +  </defs>
> > > +  <sodipodi:namedview
> > > +     id="base"
> > > +     pagecolor="#ffffff"
> > > +     bordercolor="#666666"
> > > +     borderopacity="1.0"
> > > +     inkscape:pageopacity="0.0"
> > > +     inkscape:pageshadow="2"
> > > +     inkscape:zoom="1.4"
> > > +     inkscape:cx="401.66654"
> > > +     inkscape:cy="218.12255"
> > > +     inkscape:document-units="mm"
> > > +     inkscape:current-layer="layer1"
> > > +     showgrid="false"
> > > +     inkscape:window-width="1916"
> > > +     inkscape:window-height="1033"
> > > +     inkscape:window-x="0"
> > > +     inkscape:window-y="22"
> > > +     inkscape:window-maximized="0" />
> > > +  <metadata
> > > +     id="metadata5">
> > > +    <rdf:RDF>
> > > +      <cc:Work
> > > +         rdf:about="">
> > > +        <dc:format>image/svg+xml</dc:format>
> > > +        <dc:type
> > > +           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
> > > +        <dc:title />
> > > +      </cc:Work>
> > > +    </rdf:RDF>
> > > +  </metadata>
> > > +  <g
> > > +     inkscape:label="Layer 1"
> > > +     inkscape:groupmode="layer"
> > > +     id="layer1"
> > > +     transform="translate(0,-173)">
> > > +    <rect
> > > +       style="opacity:0.82999998;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.82745098"
> > > +       id="rect815"
> > > +       width="21.262758"
> > > +       height="40.350552"
> > > +       x="55.509361"
> > > +       y="195.00098"
> > > +       ry="0" />
> > > +    <rect
> > > +       style="opacity:0.82999998;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.82745098"
> > > +       id="rect815-1"
> > > +       width="21.24276"
> > > +       height="43.732346"
> > > +       x="55.519352"
> > > +       y="235.26543"
> > > +       ry="0" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="50.549229"
> > > +       y="190.6078"
> > > +       id="text1118"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116"
> > > +         x="50.549229"
> > > +         y="190.6078"
> > > +         style="stroke-width:0.26458332px">queue file address space</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="M 76.818568,194.95453 H 97.229281"
> > > +       id="path1126"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="M 76.818568,235.20899 H 96.095361"
> > > +       id="path1126-8"
> > > +       inkscape:connector-curvature="0" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="m 76.762111,278.99778 h 19.27678"
> > > +       id="path1126-0"
> > > +       inkscape:connector-curvature="0" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="m 55.519355,265.20165 v 19.27678"
> > > +       id="path1126-2"
> > > +       inkscape:connector-curvature="0" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       d="m 76.762111,265.20165 v 19.27678"
> > > +       id="path1126-2-1"
> > > +       inkscape:connector-curvature="0" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
> > > +       d="m 87.590896,194.76554 0,39.87648"
> > > +       id="path1126-2-1-0"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart-5);marker-end:url(#Arrow1Mend-1)"
> > > +       d="m 82.48822,235.77596 v 42.90029"
> > > +       id="path1126-2-1-0-8"
> > > +       inkscape:connector-curvature="0"
> > > +       sodipodi:nodetypes="cc" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker2922)"
> > > +       d="M 44.123633,195.3325 H 55.651907"
> > > +       id="path2912"
> > > +       inkscape:connector-curvature="0" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="32.217381"
> > > +       y="196.27745"
> > > +       id="text2968"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan2966"
> > > +         x="32.217381"
> > > +         y="196.27745"
> > > +         style="stroke-width:0.26458332px">offset 0</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="91.199554"
> > > +       y="216.03946"
> > > +       id="text1118-5"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116-0"
> > > +         x="91.199554"
> > > +         y="216.03946"
> > > +         style="stroke-width:0.26458332px">device region (mapped to device mmio or shared kernel driver memory)</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="86.188072"
> > > +       y="244.50081"
> > > +       id="text1118-5-6"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116-0-4"
> > > +         x="86.188072"
> > > +         y="244.50081"
> > > +         style="stroke-width:0.26458332px">static share virtual memory region (for device without share virtual memory)</tspan></text>
> > > +    <flowRoot
> > > +       xml:space="preserve"
> > > +       id="flowRoot5699"
> > > +       style="font-style:normal;font-weight:normal;font-size:11.25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
> > > +         id="flowRegion5701"><rect
> > > +           id="rect5703"
> > > +           width="5182.8569"
> > > +           height="385.71429"
> > > +           x="34.285713"
> > > +           y="71.09111" /></flowRegion><flowPara
> > > +         id="flowPara5705" /></flowRoot>    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker2922-2)"
> > > +       d="M 43.679028,206.85268 H 55.207302"
> > > +       id="path2912-1"
> > > +       inkscape:connector-curvature="0" />
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker2922-27)"
> > > +       d="M 44.057004,224.23959 H 55.585278"
> > > +       id="path2912-9"
> > > +       inkscape:connector-curvature="0" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="24.139778"
> > > +       y="202.40636"
> > > +       id="text1118-5-3"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116-0-6"
> > > +         x="24.139778"
> > > +         y="202.40636"
> > > +         style="stroke-width:0.26458332px">device mmio region</tspan></text>
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="17.010948"
> > > +       y="216.73672"
> > > +       id="text1118-5-3-3"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116-0-6-6"
> > > +         x="17.010948"
> > > +         y="216.73672"
> > > +         style="stroke-width:0.26458332px">device kernel only  region</tspan></text>
> > > +    <path
> > > +       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker2922-27-8)"
> > > +       d="M 43.981087,235.35153 H 55.509361"
> > > +       id="path2912-9-2"
> > > +       inkscape:connector-curvature="0" />
> > > +    <text
> > > +       xml:space="preserve"
> > > +       style="font-style:normal;font-weight:normal;font-size:2.9765625px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
> > > +       x="17.575975"
> > > +       y="230.53285"
> > > +       id="text1118-5-3-3-0"><tspan
> > > +         sodipodi:role="line"
> > > +         id="tspan1116-0-6-6-5"
> > > +         x="17.575975"
> > > +         y="230.53285"
> > > +         style="stroke-width:0.26458332px">device user share  region</tspan></text>
> > > +  </g>
> > > +</svg>
> > > --
> > > 2.17.1
> > >

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

^ permalink raw reply

* Re: [PATCH 4/4] usbnet: smsc95xx: check for csum being in last four bytes
From: Sergei Shtylyov @ 2018-11-14 15:59 UTC (permalink / raw)
  To: Ben Dooks, netdev
  Cc: oneukum, davem, linux-usb, linux-kernel, steve.glendinning,
	linux-kernel
In-Reply-To: <20181114115022.9584-5-ben.dooks@codethink.co.uk>

On 11/14/2018 02:50 PM, Ben Dooks wrote:

> The manual states that the checksum cannot lie in the last DWORD of the
> transmission, so add a basic check for this and fall back to software
> checksumming the packet.
> 
> This only seems to trigger for ACK packets with no options or data to
> return to the other end, and the use of the tx-alignment option makes
> it more likely to happen.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Fixes for v2:
> - Fix spelling of check at Sergei's suggestion
> - Move skb->len check into smsc95xx_can_tx_checksum()
> - Change name of smsc95xx_can_checksum to explicitly say it is tx-csum
> ---
>  drivers/net/usb/smsc95xx.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 8f7c473f3260..cc78ef78cc93 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -1997,6 +1997,23 @@ static u32 smsc95xx_calc_csum_preamble(struct sk_buff *skb)
>  	return (high_16 << 16) | low_16;
>  }
>  
> +/* The TX CSUM won't work if the checksum lies in the last 4 bytes of the
> + * transmission. This is fairly unlikely, only seems to trigger with some
> + * short TCP ACK packets sent.
> + *
> + * Note, this calculation should probably check for the alignment of the
> + * data as well, but a straight check for csum being in the last four bytes
> + * of the packet should be ok for now.
> +*/

   Missed a space before */. 

[...]

MBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next] tcp: clean up STATE_TRACE
From: Eric Dumazet @ 2018-11-14 15:44 UTC (permalink / raw)
  To: Yafang Shao, davem, edumazet; +Cc: netdev, linux-kernel
In-Reply-To: <1542205577-21925-1-git-send-email-laoar.shao@gmail.com>



On 11/14/2018 06:26 AM, Yafang Shao wrote:
> Currently we can use bpf or tcp tracepoint to conveniently trace the tcp
> state transition at the run time.
> So we don't need to do this stuff at the compile time anymore.
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
>  include/net/tcp.h | 12 ------------
>  net/ipv4/tcp.c    |  4 ----
>  2 files changed, 16 deletions(-)

Yes, sure.

Signed-off-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* Re: VETH & AF_PACKET problem
From: Anand H. Krishnan @ 2018-11-14  4:55 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev
In-Reply-To: <CAF=yD-+SwWL5L10CZ-1ZTiam-b-KidUbFzeABmz4ssgZPfD7Vw@mail.gmail.com>

Ok. I have 4.18.11 ubuntu. I will try out the latest kernel and will
let you know.
Thank you for your opinion and help.

Thanks,
Anand
On Wed, Nov 14, 2018 at 10:11 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Tue, Nov 13, 2018 at 8:29 PM Anand H. Krishnan
> <anandhkrishnan@gmail.com> wrote:
> >
> > skb_scrub_packet calls skb_orphan and from there the destructor is called.
>
> Not since
>
>   commit 9c4c325252c54b34d53b3d0ffd535182b744e03d
>   skbuff: preserve sock reference when scrubbing the skb.
>   v4.19-rc1~140^2~523^2
>
> But the general issue is valid that the tx_ring slot should not be
> released until all users of the pages are freed, not just when the
> skb is orphaned (e.g., on skb_set_owner_r).
>
> I think that this can happen even on a transmit to a physical
> nic, if a clone is queued for reception on a packet socket. That
> clone does not clone the destructor, so if the reader is slow,
> the slot may be released from consume_skb on the original
> path.
>
> I have not verified this yet. But if correct, then the long term
> solution is to use refcounted uarg, similar to msg_zerocopy.

^ permalink raw reply

* Re: VETH & AF_PACKET problem
From: Willem de Bruijn @ 2018-11-14  4:41 UTC (permalink / raw)
  To: Anand H. Krishnan; +Cc: Network Development
In-Reply-To: <CACeb84vyf_CZqy-Wr-mG_2CT89ZuohkB3MtnOm21Ezw5t_YGug@mail.gmail.com>

On Tue, Nov 13, 2018 at 8:29 PM Anand H. Krishnan
<anandhkrishnan@gmail.com> wrote:
>
> skb_scrub_packet calls skb_orphan and from there the destructor is called.

Not since

  commit 9c4c325252c54b34d53b3d0ffd535182b744e03d
  skbuff: preserve sock reference when scrubbing the skb.
  v4.19-rc1~140^2~523^2

But the general issue is valid that the tx_ring slot should not be
released until all users of the pages are freed, not just when the
skb is orphaned (e.g., on skb_set_owner_r).

I think that this can happen even on a transmit to a physical
nic, if a clone is queued for reception on a packet socket. That
clone does not clone the destructor, so if the reader is slow,
the slot may be released from consume_skb on the original
path.

I have not verified this yet. But if correct, then the long term
solution is to use refcounted uarg, similar to msg_zerocopy.

^ permalink raw reply

* Re: [PATCH net] ipvs: call ip_vs_dst_notifier before ipv6_dev_notf
From: kbuild test robot @ 2018-11-14  4:38 UTC (permalink / raw)
  To: Xin Long
  Cc: kbuild-all, network dev, netfilter-devel, davem, pablo,
	Hans Schillstrom
In-Reply-To: <4bfc74f2a94e3721afd5ee4dd3cb60f8e4b68c7c.1542129933.git.lucien.xin@gmail.com>

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

Hi Xin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]

url:    https://github.com/0day-ci/linux/commits/Xin-Long/ipvs-call-ip_vs_dst_notifier-before-ipv6_dev_notf/20181114-055727
config: i386-randconfig-x005-11131818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> net/netfilter/ipvs/ip_vs_ctl.c:3983:14: error: 'ADDRCONF_NOTIFY_PRIORITY' undeclared here (not in a function); did you mean 'DEVCONF_NDISC_NOTIFY'?
     .priority = ADDRCONF_NOTIFY_PRIORITY + 5,
                 ^~~~~~~~~~~~~~~~~~~~~~~~
                 DEVCONF_NDISC_NOTIFY

vim +3983 net/netfilter/ipvs/ip_vs_ctl.c

  3980	
  3981	static struct notifier_block ip_vs_dst_notifier = {
  3982		.notifier_call = ip_vs_dst_event,
> 3983		.priority = ADDRCONF_NOTIFY_PRIORITY + 5,
  3984	};
  3985	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33999 bytes --]

^ 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