Skip to content

Commit

Permalink
net: ethtool: add ring parameter filtering
Browse files Browse the repository at this point in the history
While the devmem is running, the tcp-data-split and
hds-thresh configuration should not be changed.
If user tries to change tcp-data-split and threshold value while the
devmem is running, it fails and shows extack message.

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://patch.msgid.link/20250114142852.3364986-5-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Taehee Yoo authored and Jakub Kicinski committed Jan 15, 2025
1 parent a08a5c9 commit e617790
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions net/ethtool/rings.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,19 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
return -EINVAL;
}

if (dev_get_min_mp_channel_count(dev)) {
if (kernel_ringparam.tcp_data_split !=
ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
NL_SET_ERR_MSG(info->extack,
"can't disable tcp-data-split while device has memory provider enabled");
return -EINVAL;
} else if (kernel_ringparam.hds_thresh) {
NL_SET_ERR_MSG(info->extack,
"can't set non-zero hds_thresh while device is memory provider enabled");
return -EINVAL;
}
}

/* ensure new ring parameters are within limits */
if (ringparam.rx_pending > ringparam.rx_max_pending)
err_attr = tb[ETHTOOL_A_RINGS_RX];
Expand Down

0 comments on commit e617790

Please sign in to comment.