Skip to content

Commit 486bdee

Browse files
marceloleitnerdavem330
authored andcommitted
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>
1 parent d21fd63 commit 486bdee

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎net/sctp/inqueue.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
163163
chunk->singleton = 1;
164164
ch = (sctp_chunkhdr_t *) chunk->skb->data;
165165
chunk->data_accepted = 0;
166+
167+
if (chunk->asoc)
168+
sock_rps_save_rxhash(chunk->asoc->base.sk, chunk->skb);
166169
}
167170

168171
chunk->chunk_hdr = ch;

‎net/sctp/socket.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6430,6 +6430,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait)
64306430

64316431
poll_wait(file, sk_sleep(sk), wait);
64326432

6433+
sock_rps_record_flow(sk);
6434+
64336435
/* A TCP-style listening socket becomes readable when the accept queue
64346436
* is not empty.
64356437
*/
@@ -7186,6 +7188,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
71867188
newsk->sk_lingertime = sk->sk_lingertime;
71877189
newsk->sk_rcvtimeo = sk->sk_rcvtimeo;
71887190
newsk->sk_sndtimeo = sk->sk_sndtimeo;
7191+
newsk->sk_rxhash = sk->sk_rxhash;
71897192

71907193
newinet = inet_sk(newsk);
71917194

0 commit comments

Comments
 (0)