- 07 Mar, 2016 19 commits
-
-
David Howells authored
Rename rxrpc_UDP_error_report() to rxrpc_error_report() as it might get called for something other than UDP. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Rename ar-error.c to peer-event.c. This will form the core of the peer event handling code. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Add /proc/net/rxrpc_peers to display the remote endpoint records that are resident in the peer cache. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Implement the peer RxRPC endpoint cache. Only the primary cache is used. This is indexed on the following details: - Network transport family - currently only AF_INET. - Network transport type - currently only UDP. - Peer network transport address. We use the RCU read lock to handle non-creating lookups so that we can do the look up from bottom half context in the sk_error_report handler. Creating lookups are done under spinlock rather than mutex as they might be set up due to an external stimulus if the local endpoint is a server. Captured network error messages (ICMP) are handled with respect to this struct and MTU size and RTT are cached here. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Rename ar-peer.c to peer-object.c for consistency (to be) with the other new object cache management files. It will be modified in a later commit. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Rename ar-local.c to local-event.c. What's left in the file is the local endpoint event/packet handling code after the object management has been separated out. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Add a proc file to list local rxrpc endpoints using the object cache facility to do much of the work. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Implement the local RxRPC endpoint cache. Only the primary cache is used. This is indexed on the following details: - Local network transport family - currently only AF_INET. - Local network transport type - currently only UDP. - Local network transport address. The hash isn't very big since we don't expect to have many local endpoints hanging around - RxRPC sockets opened with a 0 service ID (ie. client-only sockets) share local endpoints if they have matching local network addresses (typically all zeros). We use a mutex to handle lookups and don't provide RCU-only lookups since we only expect write access to this cache to be done from process context when opening a socket. The local endpoint object is pointed to by the transport socket's sk_user_data for the life of the transport socket so that it's fast to access by the transport socket sk_data_ready and sk_error_report callbacks. Further, the transport socket is shut down before we clear the sk_user_data pointer, so that we can be sure that the transport socket's callbacks won't be invoked once the RCU destruction is scheduled. The local endpoint retains the transport socket that we use to send and capture packets and capture network error messages (ICMP). The socket is opened when an endpoint is looked up - if it doesn't already exist. Note that to make this work, we have to get rid of rxrpc_local_lock as that causes a potential deadlock between a softirq looking in an object cache whilst holding that lock vs objcache_clear() taking the cache lock and then an interrupt. However, since the socket is locked by the caller of the rxrpc_data_ready() function and given that we don't clear sk_user_data until after we've shut down the socket, we are guaranteed that the local endpoint struct is pinned until rxrpc_data_ready() returns - so we don't need to lock the local endpoint struct there. The other places we've taken the lock where we read the usage count and then increment it if not zero can be replaced by atomic_inc_not_zero() (hidden inside rxrpc_get_local_maybe()). Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Separate local endpoint object handling out into its own file preparatory to overhauling it to use the new object cache. The original file is then be used exclusively for the local endpoint packet and event handling. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Use the object cache primary hash to provide lists of RxRPC objects through /proc/net/ for all caches where desired. Each user of the cache just needs to provide a show function in its objcache struct and register the proc file with objcache_seq_fops as its file operations. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Add a common object cache implementation for RxRPC. This will be used to cache objects of various types (calls, connections, local and remote endpoint records). Each object that would be cached must contain an obj_node struct for the cache to use. The object's usage count and link pointers are here, plus other internal metadata. Each object cache consists of a primary hash to which all objects of that type must be added and a secondary hash to which objects may also be added and removed a single time. Objects are automatically removed from both hashes when they expire. Objects start off life with a usage count of 2 - one for the cache and one for the caller. When an object's usage count is reduced to 1, it sits in the cache until its expiry time is reached, at which point the cache attempts to reduce the count to 0 and, if successful, clean it up. An object with a usage count of 1 in the cache can be looked up and have its usage count increased, thereby stopping the expiry process. Objects are looked up, unlinked and destroyed under RCU-safe conditions. A garbage collector cycles through all the hash buckets in the primary hash and compares the expiry times of the usage-count-1 objects to the current time, removing any that have expired. This is kicked by a single timer for the whole cache rather than having a timer per object. Signed-off-by: David Howells <dhowells@redhat.com>
-
Jon Paul Maloy authored
Until now, we have kept a pre-allocated protocol message header aggregated into struct tipc_link. Apart from adding unnecessary footprint to the link instances, this requires extra code both to initialize and re-initialize it. We now remove this sub-optimization. This change also makes it possible to clean up the function tipc_build_proto_msg() and remove a couple of small functions that were accessing the mentioned header. In particular, we can replace all occurrences of the local function call link_own_addr(link) with the generic tipc_own_addr(net). Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Richard Alpe authored
Make sure the user has provided a scope for multicast and link local addresses used locally by a UDP bearer. Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Richard Alpe authored
The netlink policy for TIPC_NLA_UDP_LOCAL and TIPC_NLA_UDP_REMOTE is of type binary with a defined length. This causes the policy framework to threat the defined length as maximum length. There is however no protection against a user sending a smaller amount of data. Prior to this patch this wasn't handled which could result in a partially incomplete sockaddr_storage struct containing uninitialized data. In this patch we use nla_memcpy() when copying the user data. This ensures a potential gap at the end is cleared out properly. This was found by Julia with Coccinelle tool. Reported-by: Daniel Borkmann <daniel@iogearbox.net> Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Richard Alpe authored
Make sure we have a link before checking if it has been reset or not. Prior to this patch tipc_link_is_reset() could be called with a non existing link, resulting in a null pointer dereference. Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Richard Alpe authored
Prior to this patch enabling a IPv4 UDP bearer caused a null pointer dereference in iptunnel_xmit_stats(), when it tried to dereference the net device from the skb. To resolve this we now point the skb device to the net device resolved from the routing table. Fixes: 039f5062 (ip_tunnel: Move stats update to iptunnel_xmit()) Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Bernhard Walle authored
is actually "active high". Thanks for Troy Kisky for pointing that out. Since the patch is in linux-next, this patch is incremental and doesn't replace the original patch. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Wu Fengguang authored
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21: ERROR: application of sizeof to pointer sizeof when applied to a pointer typed expression gives the size of the pointer Generated by: scripts/coccinelle/misc/noderef.cocci CC: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
WANG Cong authored
Cc: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
- 05 Mar, 2016 5 commits
-
-
David S. Miller authored
Zhang Shengju says: ==================== use reset to set header pointers This patch series replace set function with reset when offset is zero. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-
Zhang Shengju authored
Since offset is zero, it's not necessary to use set function. Reset function is straightforward, and will remove the unnecessary add operation in set function. Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Zhang Shengju authored
Since offset is zero, it's not necessary to use set function. Reset function is straightforward, and will remove the unnecessary add operation in set function. Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Zhang Shengju authored
Since offset is zero, it's not necessary to use set function. Reset function is straightforward, and will remove the unnecessary add operation in set function. Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Zhang Shengju authored
Since offset is zero, it's not necessary to use set function. Reset function is straightforward, and will remove the unnecessary add operation in set function. Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
- 04 Mar, 2016 16 commits
-
-
David S. Miller authored
Merge tag 'rxrpc-rewrite-20160304' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs David Howells says: ==================== RxRPC: Rewrite part 1 Here's the first set of patches from my RxRPC rewrite, aimed at net-next. These do some clean ups and bug fixes. Most of the changes are small, but there are a couple of bigger changes: (*) Convert call flag numbers and event numbers into enums. Then rename the event numbers to all have _EV_ in their name to stop confusion. Fix one instance of an event bit being used instead of a flag bit. (*) A copy of the Rx protocol header is kept in the sk_buff private data. Keep this in host byte order rather than network byte order as it makes more sense. A number of other fields then get converted into host byte order too. Conversion between host and network byte order is then done at the packet reception/generation stage. This is based on net-next/master ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-
David S. Miller authored
Nicolas Dichtel says: ==================== uapi: consolidate DIV_ROUND_UP definition The inital goal was to consolidate ethtool.h uapi header. But I took the opportunity to remove all duplicate definitions of DIV_ROUND_UP. v3: add patch #2 and #3 v2: split the patch define DIV_ROUND_UP in uapi ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-
Nicolas Dichtel authored
INT_MAX needs limits.h in userland. When ethtool.h is included by a userland app, we got the following error: .../usr/include/linux/ethtool.h: In function 'ethtool_validate_speed': .../usr/include/linux/ethtool.h:1471:18: error: 'INT_MAX' undeclared (first use in this function) return speed <= INT_MAX || speed == SPEED_UNKNOWN ^ Fixes: e02564ee ("ethtool: make validate_speed accept all speeds between 0 and INT_MAX") CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Nicolas Dichtel authored
Let's use __KERNEL_DIV_ROUND_UP, which is defined in uapi/linux/kernel.h. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Nicolas Dichtel authored
let's use the common definition to avoid the following warning during the compilation: drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:161:0: warning: "DIV_ROUND_UP" redefined #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) ^ In file included from include/linux/list.h:8:0, from include/linux/module.h:9, from drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:16: include/linux/kernel.h:67:0: note: this is the location of the previous definition #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP ^ Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Nicolas Dichtel authored
DIV_ROUND_UP is defined in linux/kernel.h only for the kernel. When ethtool.h is included by a userland app, we got the following error: include/linux/ethtool.h:1218:8: error: variably modified 'queue_mask' at file scope __u32 queue_mask[DIV_ROUND_UP(MAX_NUM_QUEUE, 32)]; ^ Let's add a common definition in uapi and use it everywhere. Fixes: ac2c7ad0 ("net/ethtool: introduce a new ioctl for per queue setting") CC: Kan Liang <kan.liang@intel.com> Suggested-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
Simon Horman authored
Rolf is no longer in his previous role at Netronome and as far as I know no longer working on the NFP driver. Thus it does not seem appropriate for him to be a co-maintainer anymore. Reviewed-by: Dinan Gunawardena <dinan.gunawardena@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-
David Howells authored
In the ICMP message processing code, don't try to map ICMP codes to UNIX error codes as the caller (IPv4/IPv6) already did that for us (ee_errno). Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Clear the unused part of a sockaddr_rxrpc structs so that memcmp() can be used to compare them. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Forced casts are needed to avoid sparse warning when directly comparing be32 values. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
The version number rxkad places in the response should be network byte order. Whilst we're at it, rearrange the code to be more readable. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Use ACCESS_ONCE() when accessing the other-end pointer into a circular buffer as it's possible the other-end pointer might change whilst we're doing this, and if we access it twice, we might get some weird things happening. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Remove some excess whitespace, insert some missing spaces and adjust a couple of comments. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Currently, received RxRPC packets outside the range 1-13 are rejected. There are, however, holes in the range that should also be rejected - plus at least one type we don't yet support - so reject these also. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
The upper bound of the defined range for rx_mtu is being set in the same member as the lower bound (extra1) rather than the correct place (extra2). I'm not entirely sure why this compiles. Signed-off-by: David Howells <dhowells@redhat.com>
-
David Howells authored
Fix the protocol family set in the proto_ops for rxrpc to be PF_RXRPC not PF_UNIX. Signed-off-by: David Howells <dhowells@redhat.com>
-