diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-13 00:44:06 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-13 03:58:13 +0100 |
commit | 1e2e01172fd11b4dbfee746c0c8fbcaa9dbf22a0 (patch) | |
tree | 8384ce93ce79c7fa49bb29349102dd2b4d1137fd /include/net/request_sock.h | |
parent | inet: add ireq_state field to inet_request_sock (diff) | |
download | linux-1e2e01172fd11b4dbfee746c0c8fbcaa9dbf22a0.tar.xz linux-1e2e01172fd11b4dbfee746c0c8fbcaa9dbf22a0.zip |
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 '')
-rw-r--r-- | include/net/request_sock.h | 8 |
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 |