summaryrefslogtreecommitdiffstats
path: root/include/net/sctp
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-03-12 02:31:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-12 13:04:02 -0400
commit2075e50caf5ea28be3cba0d01b3058bb5c3b0168 (patch)
tree67dcfce1a110f46f2c796fb802f036053b850248 /include/net/sctp
parent94f8f3b02e1ee0418b5cc9352626cdc2b6bd4299 (diff)
sctp: convert to genradix
This also makes sctp_stream_alloc_(out|in) saner, in that they no longer allocate new flex_arrays/genradixes, they just preallocate more elements. This code does however have a suspicious lack of locking. Link: http://lkml.kernel.org/r/20181217131929.11727-7-kent.overstreet@gmail.com Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Cc: Vlad Yasevich <vyasevich@gmail.com> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Eric Paris <eparis@parisplace.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Paul Moore <paul@paul-moore.com> Cc: Pravin B Shelar <pshelar@ovn.org> Cc: Shaohua Li <shli@kernel.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/net/sctp')
-rw-r--r--include/net/sctp/structs.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 58e4b23cecf4..140fd836a396 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -48,6 +48,7 @@
48#define __sctp_structs_h__ 48#define __sctp_structs_h__
49 49
50#include <linux/ktime.h> 50#include <linux/ktime.h>
51#include <linux/generic-radix-tree.h>
51#include <linux/rhashtable-types.h> 52#include <linux/rhashtable-types.h>
52#include <linux/socket.h> /* linux/in.h needs this!! */ 53#include <linux/socket.h> /* linux/in.h needs this!! */
53#include <linux/in.h> /* We get struct sockaddr_in. */ 54#include <linux/in.h> /* We get struct sockaddr_in. */
@@ -57,7 +58,6 @@
57#include <linux/atomic.h> /* This gets us atomic counters. */ 58#include <linux/atomic.h> /* This gets us atomic counters. */
58#include <linux/skbuff.h> /* We need sk_buff_head. */ 59#include <linux/skbuff.h> /* We need sk_buff_head. */
59#include <linux/workqueue.h> /* We need tq_struct. */ 60#include <linux/workqueue.h> /* We need tq_struct. */
60#include <linux/flex_array.h> /* We need flex_array. */
61#include <linux/sctp.h> /* We need sctp* header structs. */ 61#include <linux/sctp.h> /* We need sctp* header structs. */
62#include <net/sctp/auth.h> /* We need auth specific structs */ 62#include <net/sctp/auth.h> /* We need auth specific structs */
63#include <net/ip.h> /* For inet_skb_parm */ 63#include <net/ip.h> /* For inet_skb_parm */
@@ -1449,8 +1449,9 @@ struct sctp_stream_in {
1449}; 1449};
1450 1450
1451struct sctp_stream { 1451struct sctp_stream {
1452 struct flex_array *out; 1452 GENRADIX(struct sctp_stream_out) out;
1453 struct flex_array *in; 1453 GENRADIX(struct sctp_stream_in) in;
1454
1454 __u16 outcnt; 1455 __u16 outcnt;
1455 __u16 incnt; 1456 __u16 incnt;
1456 /* Current stream being sent, if any */ 1457 /* Current stream being sent, if any */
@@ -1473,17 +1474,17 @@ struct sctp_stream {
1473}; 1474};
1474 1475
1475static inline struct sctp_stream_out *sctp_stream_out( 1476static inline struct sctp_stream_out *sctp_stream_out(
1476 const struct sctp_stream *stream, 1477 struct sctp_stream *stream,
1477 __u16 sid) 1478 __u16 sid)
1478{ 1479{
1479 return flex_array_get(stream->out, sid); 1480 return genradix_ptr(&stream->out, sid);
1480} 1481}
1481 1482
1482static inline struct sctp_stream_in *sctp_stream_in( 1483static inline struct sctp_stream_in *sctp_stream_in(
1483 const struct sctp_stream *stream, 1484 struct sctp_stream *stream,
1484 __u16 sid) 1485 __u16 sid)
1485{ 1486{
1486 return flex_array_get(stream->in, sid); 1487 return genradix_ptr(&stream->in, sid);
1487} 1488}
1488 1489
1489#define SCTP_SO(s, i) sctp_stream_out((s), (i)) 1490#define SCTP_SO(s, i) sctp_stream_out((s), (i))