summaryrefslogtreecommitdiffstats
path: root/include/net/request_sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-12 16:44:06 -0700
committerDavid S. Miller <davem@davemloft.net>2015-03-12 22:58:13 -0400
commit1e2e01172fd11b4dbfee746c0c8fbcaa9dbf22a0 (patch)
tree8384ce93ce79c7fa49bb29349102dd2b4d1137fd /include/net/request_sock.h
parentd34ac51b76e8c7de6094cfb11780ef9c2b93469f (diff)
downloadlinux-1e2e01172fd11b4dbfee746c0c8fbcaa9dbf22a0.tar.bz2
inet: add rsk_refcnt/ireq_refcnt to request socks
When request socks will be in ehash, they'll need to be refcounted. This patch adds rsk_refcnt/ireq_refcnt macros, and adds reqsk_put() function, but nothing yet use them. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/request_sock.h')
-rw-r--r--include/net/request_sock.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 7f830ff67f08..e255ecf8bb40 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -49,6 +49,8 @@ int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
*/
struct request_sock {
struct sock_common __req_common;
+#define rsk_refcnt __req_common.skc_refcnt
+
struct request_sock *dl_next;
u16 mss;
u8 num_retrans; /* number of retransmits */
@@ -86,6 +88,12 @@ static inline void reqsk_free(struct request_sock *req)
__reqsk_free(req);
}
+static inline void reqsk_put(struct request_sock *req)
+{
+ if (atomic_dec_and_test(&req->rsk_refcnt))
+ reqsk_free(req);
+}
+
extern int sysctl_max_syn_backlog;
/** struct listen_sock - listen state