aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2016-04-12 17:11:31 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-14 21:40:24 -0400
commit486bdee0134cf21c3714ded809d5933d2b8dfb81 (patch)
treeb22d8924cc7cfdf4126dc5466c844ea69bb60e0e
parentd21fd63ea3856208c3a1cb9b26d81898a2ccf71b (diff)
sctp: add support for RPS and RFS
This patch adds what's missing to properly support RPS and RFS on SCTP, as some of it is already implemented in common calls. Having support for RPS and RFS allows better scaling specially because not all NICs support hashing SCTP headers. Save the hash right when we dequeue a skb from inqueue so we do it only once per skb instead of per chunk. New sockets will then inherit the hash through sctp_copy_sock(). Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sctp/inqueue.c3
-rw-r--r--net/sctp/socket.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 7e8a16c77039..b335ffcef0b9 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -163,6 +163,9 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
163 chunk->singleton = 1; 163 chunk->singleton = 1;
164 ch = (sctp_chunkhdr_t *) chunk->skb->data; 164 ch = (sctp_chunkhdr_t *) chunk->skb->data;
165 chunk->data_accepted = 0; 165 chunk->data_accepted = 0;
166
167 if (chunk->asoc)
168 sock_rps_save_rxhash(chunk->asoc->base.sk, chunk->skb);
166 } 169 }
167 170
168 chunk->chunk_hdr = ch; 171 chunk->chunk_hdr = ch;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 878d28eda1a6..36697f85ce48 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6430,6 +6430,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait)
6430 6430
6431 poll_wait(file, sk_sleep(sk), wait); 6431 poll_wait(file, sk_sleep(sk), wait);
6432 6432
6433 sock_rps_record_flow(sk);
6434
6433 /* A TCP-style listening socket becomes readable when the accept queue 6435 /* A TCP-style listening socket becomes readable when the accept queue
6434 * is not empty. 6436 * is not empty.
6435 */ 6437 */
@@ -7186,6 +7188,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
7186 newsk->sk_lingertime = sk->sk_lingertime; 7188 newsk->sk_lingertime = sk->sk_lingertime;
7187 newsk->sk_rcvtimeo = sk->sk_rcvtimeo; 7189 newsk->sk_rcvtimeo = sk->sk_rcvtimeo;
7188 newsk->sk_sndtimeo = sk->sk_sndtimeo; 7190 newsk->sk_sndtimeo = sk->sk_sndtimeo;
7191 newsk->sk_rxhash = sk->sk_rxhash;
7189 7192
7190 newinet = inet_sk(newsk); 7193 newinet = inet_sk(newsk);
7191 7194