diff options
author | Dave Watson <davejwatson@fb.com> | 2017-06-14 20:37:14 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-15 18:12:40 +0200 |
commit | 734942cc4ea6478eed125af258da1bdbb4afe578 (patch) | |
tree | a6b0b27cb551055a7c5d5756c40d737543323df1 /include/net/tcp.h | |
parent | Merge branch 'Broadcom-DTE-based-PTP-clock' (diff) | |
download | linux-734942cc4ea6478eed125af258da1bdbb4afe578.tar.xz linux-734942cc4ea6478eed125af258da1bdbb4afe578.zip |
tcp: ULP infrastructure
Add the infrustructure for attaching Upper Layer Protocols (ULPs) over TCP
sockets. Based on a similar infrastructure in tcp_cong. The idea is that any
ULP can add its own logic by changing the TCP proto_ops structure to its own
methods.
Example usage:
setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls"));
modules will call:
tcp_register_ulp(&tcp_tls_ulp_ops);
to register/unregister their ulp, with an init function and name.
A list of registered ulps will be returned by tcp_get_available_ulp, which is
hooked up to /proc. Example:
$ cat /proc/sys/net/ipv4/tcp_available_ulp
tls
There is currently no functionality to remove or chain ULPs, but
it should be possible to add these in the future if needed.
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Dave Watson <davejwatson@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 3ab677d11d02..b439f46f149c 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1991,4 +1991,29 @@ static inline void tcp_listendrop(const struct sock *sk) enum hrtimer_restart tcp_pace_kick(struct hrtimer *timer); +/* + * Interface for adding Upper Level Protocols over TCP + */ + +#define TCP_ULP_NAME_MAX 16 +#define TCP_ULP_MAX 128 +#define TCP_ULP_BUF_MAX (TCP_ULP_NAME_MAX*TCP_ULP_MAX) + +struct tcp_ulp_ops { + struct list_head list; + + /* initialize ulp */ + int (*init)(struct sock *sk); + /* cleanup ulp */ + void (*release)(struct sock *sk); + + char name[TCP_ULP_NAME_MAX]; + struct module *owner; +}; +int tcp_register_ulp(struct tcp_ulp_ops *type); +void tcp_unregister_ulp(struct tcp_ulp_ops *type); +int tcp_set_ulp(struct sock *sk, const char *name); +void tcp_get_available_ulp(char *buf, size_t len); +void tcp_cleanup_ulp(struct sock *sk); + #endif /* _TCP_H */ |