Commit b489a6e5 authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Jakub Kicinski

tls: Rename TLS_INFO_ZC_SENDFILE to TLS_INFO_ZC_TX

To embrace possible future optimizations of TLS, rename zerocopy
sendfile definitions to more generic ones:

* setsockopt: TLS_TX_ZEROCOPY_SENDFILE- > TLS_TX_ZEROCOPY_RO
* sock_diag: TLS_INFO_ZC_SENDFILE -> TLS_INFO_ZC_RO_TX

RO stands for readonly and emphasizes that the application shouldn't
modify the data being transmitted with zerocopy to avoid potential
disconnection.

Fixes: c1318b39 ("tls: Add opt-in zerocopy mode of sendfile()")
Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Link: https://lore.kernel.org/r/20220608153425.3151146-1-maximmi@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 825464e7
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
/* TLS socket options */ /* TLS socket options */
#define TLS_TX 1 /* Set transmit parameters */ #define TLS_TX 1 /* Set transmit parameters */
#define TLS_RX 2 /* Set receive parameters */ #define TLS_RX 2 /* Set receive parameters */
#define TLS_TX_ZEROCOPY_SENDFILE 3 /* transmit zerocopy sendfile */ #define TLS_TX_ZEROCOPY_RO 3 /* TX zerocopy (only sendfile now) */
/* Supported versions */ /* Supported versions */
#define TLS_VERSION_MINOR(ver) ((ver) & 0xFF) #define TLS_VERSION_MINOR(ver) ((ver) & 0xFF)
...@@ -161,7 +161,7 @@ enum { ...@@ -161,7 +161,7 @@ enum {
TLS_INFO_CIPHER, TLS_INFO_CIPHER,
TLS_INFO_TXCONF, TLS_INFO_TXCONF,
TLS_INFO_RXCONF, TLS_INFO_RXCONF,
TLS_INFO_ZC_SENDFILE, TLS_INFO_ZC_RO_TX,
__TLS_INFO_MAX, __TLS_INFO_MAX,
}; };
#define TLS_INFO_MAX (__TLS_INFO_MAX - 1) #define TLS_INFO_MAX (__TLS_INFO_MAX - 1)
......
...@@ -544,7 +544,7 @@ static int do_tls_getsockopt(struct sock *sk, int optname, ...@@ -544,7 +544,7 @@ static int do_tls_getsockopt(struct sock *sk, int optname,
rc = do_tls_getsockopt_conf(sk, optval, optlen, rc = do_tls_getsockopt_conf(sk, optval, optlen,
optname == TLS_TX); optname == TLS_TX);
break; break;
case TLS_TX_ZEROCOPY_SENDFILE: case TLS_TX_ZEROCOPY_RO:
rc = do_tls_getsockopt_tx_zc(sk, optval, optlen); rc = do_tls_getsockopt_tx_zc(sk, optval, optlen);
break; break;
default: default:
...@@ -731,7 +731,7 @@ static int do_tls_setsockopt(struct sock *sk, int optname, sockptr_t optval, ...@@ -731,7 +731,7 @@ static int do_tls_setsockopt(struct sock *sk, int optname, sockptr_t optval,
optname == TLS_TX); optname == TLS_TX);
release_sock(sk); release_sock(sk);
break; break;
case TLS_TX_ZEROCOPY_SENDFILE: case TLS_TX_ZEROCOPY_RO:
lock_sock(sk); lock_sock(sk);
rc = do_tls_setsockopt_tx_zc(sk, optval, optlen); rc = do_tls_setsockopt_tx_zc(sk, optval, optlen);
release_sock(sk); release_sock(sk);
...@@ -970,7 +970,7 @@ static int tls_get_info(const struct sock *sk, struct sk_buff *skb) ...@@ -970,7 +970,7 @@ static int tls_get_info(const struct sock *sk, struct sk_buff *skb)
goto nla_failure; goto nla_failure;
if (ctx->tx_conf == TLS_HW && ctx->zerocopy_sendfile) { if (ctx->tx_conf == TLS_HW && ctx->zerocopy_sendfile) {
err = nla_put_flag(skb, TLS_INFO_ZC_SENDFILE); err = nla_put_flag(skb, TLS_INFO_ZC_RO_TX);
if (err) if (err)
goto nla_failure; goto nla_failure;
} }
...@@ -994,7 +994,7 @@ static size_t tls_get_info_size(const struct sock *sk) ...@@ -994,7 +994,7 @@ static size_t tls_get_info_size(const struct sock *sk)
nla_total_size(sizeof(u16)) + /* TLS_INFO_CIPHER */ nla_total_size(sizeof(u16)) + /* TLS_INFO_CIPHER */
nla_total_size(sizeof(u16)) + /* TLS_INFO_RXCONF */ nla_total_size(sizeof(u16)) + /* TLS_INFO_RXCONF */
nla_total_size(sizeof(u16)) + /* TLS_INFO_TXCONF */ nla_total_size(sizeof(u16)) + /* TLS_INFO_TXCONF */
nla_total_size(0) + /* TLS_INFO_ZC_SENDFILE */ nla_total_size(0) + /* TLS_INFO_ZC_RO_TX */
0; 0;
return size; return size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment