Skip to content

Commit 50d7371

Browse files
alobakinkuba-moo
authored andcommitted
ethtool: add SET for TCP_DATA_SPLIT ringparam
Follow up commit 9690ae6 ("ethtool: add header/data split indication") and add the set part of Ethtool's header split, i.e. ability to enable/disable header split via the Ethtool Netlink interface. This might be helpful to optimize the setup for particular workloads, for example, to avoid XDP frags, and so on. A driver should advertise ``ETHTOOL_RING_USE_TCP_DATA_SPLIT`` in its ops->supported_ring_params to allow doing that. "Unknown" passed from the userspace when the header split is supported means the driver is free to choose the preferred state. Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 173b6d1 commit 50d7371

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

include/linux/ethtool.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ struct kernel_ethtool_ringparam {
9595
* @ETHTOOL_RING_USE_TX_PUSH: capture for setting tx_push
9696
* @ETHTOOL_RING_USE_RX_PUSH: capture for setting rx_push
9797
* @ETHTOOL_RING_USE_TX_PUSH_BUF_LEN: capture for setting tx_push_buf_len
98+
* @ETHTOOL_RING_USE_TCP_DATA_SPLIT: capture for setting tcp_data_split
9899
*/
99100
enum ethtool_supported_ring_param {
100101
ETHTOOL_RING_USE_RX_BUF_LEN = BIT(0),
101102
ETHTOOL_RING_USE_CQE_SIZE = BIT(1),
102103
ETHTOOL_RING_USE_TX_PUSH = BIT(2),
103104
ETHTOOL_RING_USE_RX_PUSH = BIT(3),
104105
ETHTOOL_RING_USE_TX_PUSH_BUF_LEN = BIT(4),
106+
ETHTOOL_RING_USE_TCP_DATA_SPLIT = BIT(5),
105107
};
106108

107109
#define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit))

net/ethtool/rings.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ const struct nla_policy ethnl_rings_set_policy[] = {
124124
[ETHTOOL_A_RINGS_RX_JUMBO] = { .type = NLA_U32 },
125125
[ETHTOOL_A_RINGS_TX] = { .type = NLA_U32 },
126126
[ETHTOOL_A_RINGS_RX_BUF_LEN] = NLA_POLICY_MIN(NLA_U32, 1),
127+
[ETHTOOL_A_RINGS_TCP_DATA_SPLIT] =
128+
NLA_POLICY_MAX(NLA_U8, ETHTOOL_TCP_DATA_SPLIT_ENABLED),
127129
[ETHTOOL_A_RINGS_CQE_SIZE] = NLA_POLICY_MIN(NLA_U32, 1),
128130
[ETHTOOL_A_RINGS_TX_PUSH] = NLA_POLICY_MAX(NLA_U8, 1),
129131
[ETHTOOL_A_RINGS_RX_PUSH] = NLA_POLICY_MAX(NLA_U8, 1),
@@ -145,6 +147,14 @@ ethnl_set_rings_validate(struct ethnl_req_info *req_info,
145147
return -EOPNOTSUPP;
146148
}
147149

150+
if (tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT] &&
151+
!(ops->supported_ring_params & ETHTOOL_RING_USE_TCP_DATA_SPLIT)) {
152+
NL_SET_ERR_MSG_ATTR(info->extack,
153+
tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT],
154+
"setting TCP data split is not supported");
155+
return -EOPNOTSUPP;
156+
}
157+
148158
if (tb[ETHTOOL_A_RINGS_CQE_SIZE] &&
149159
!(ops->supported_ring_params & ETHTOOL_RING_USE_CQE_SIZE)) {
150160
NL_SET_ERR_MSG_ATTR(info->extack,
@@ -202,6 +212,8 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
202212
ethnl_update_u32(&ringparam.tx_pending, tb[ETHTOOL_A_RINGS_TX], &mod);
203213
ethnl_update_u32(&kernel_ringparam.rx_buf_len,
204214
tb[ETHTOOL_A_RINGS_RX_BUF_LEN], &mod);
215+
ethnl_update_u8(&kernel_ringparam.tcp_data_split,
216+
tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT], &mod);
205217
ethnl_update_u32(&kernel_ringparam.cqe_size,
206218
tb[ETHTOOL_A_RINGS_CQE_SIZE], &mod);
207219
ethnl_update_u8(&kernel_ringparam.tx_push,

0 commit comments

Comments
 (0)