aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/dccp.h1
-rw-r--r--net/dccp/proto.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 33d86f53138b..3a94625a1af3 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -87,6 +87,7 @@ extern int sysctl_dccp_feat_tx_ccid;
87extern int sysctl_dccp_feat_ack_ratio; 87extern int sysctl_dccp_feat_ack_ratio;
88extern int sysctl_dccp_feat_send_ack_vector; 88extern int sysctl_dccp_feat_send_ack_vector;
89extern int sysctl_dccp_feat_send_ndp_count; 89extern int sysctl_dccp_feat_send_ndp_count;
90extern int sysctl_dccp_tx_qlen;
90 91
91/* is seq1 < seq2 ? */ 92/* is seq1 < seq2 ? */
92static inline int before48(const u64 seq1, const u64 seq2) 93static inline int before48(const u64 seq1, const u64 seq2)
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 0225bdacd3b1..a7f345c8d0db 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -52,6 +52,9 @@ struct inet_hashinfo __cacheline_aligned dccp_hashinfo = {
52 52
53EXPORT_SYMBOL_GPL(dccp_hashinfo); 53EXPORT_SYMBOL_GPL(dccp_hashinfo);
54 54
55/* the maximum queue length for tx in packets. 0 is no limit */
56int sysctl_dccp_tx_qlen __read_mostly = 5;
57
55void dccp_set_state(struct sock *sk, const int state) 58void dccp_set_state(struct sock *sk, const int state)
56{ 59{
57 const int oldstate = sk->sk_state; 60 const int oldstate = sk->sk_state;
@@ -645,6 +648,13 @@ int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
645 return -EMSGSIZE; 648 return -EMSGSIZE;
646 649
647 lock_sock(sk); 650 lock_sock(sk);
651
652 if (sysctl_dccp_tx_qlen &&
653 (sk->sk_write_queue.qlen >= sysctl_dccp_tx_qlen)) {
654 rc = -EAGAIN;
655 goto out_release;
656 }
657
648 timeo = sock_sndtimeo(sk, noblock); 658 timeo = sock_sndtimeo(sk, noblock);
649 659
650 /* 660 /*