Re: [PATCH net-next 06/11] ethtool: rss: support setting hkey via Netlink

From
Gal Pressman <hidden>
Date
2025-07-13 11:10:57
Reply to
Jakub Kicinski, 2025-07-11
On 11/07/2025 4:52, Jakub Kicinski wrote:
Support setting RSS hashing key via ethtool Netlink.
Use the Netlink policy to make sure user doesn't pass
an empty key, "resetting" the key is not a thing.
Makes sense.
quoted hunk ↗ jump to hunk
+static int
+rss_set_prep_hkey(struct net_device *dev, struct genl_info *info,
+		  struct rss_reply_data *data, struct ethtool_rxfh_param *rxfh,
+		  bool *mod)
+{
+	struct nlattr **tb = info->attrs;
+
+	if (!tb[ETHTOOL_A_RSS_HKEY])
+		return 0;
+
+	if (nla_len(tb[ETHTOOL_A_RSS_HKEY]) != data->hkey_size) {
+		NL_SET_BAD_ATTR(info->extack, tb[ETHTOOL_A_RSS_HKEY]);
+		return -EINVAL;
+	}
+
+	rxfh->key_size = data->hkey_size;
+	rxfh->key = kzalloc(data->hkey_size, GFP_KERNEL);
+	if (!rxfh->key)
+		return -ENOMEM;
+
+	nla_memcpy(rxfh->key, tb[ETHTOOL_A_RSS_HKEY], rxfh->key_size);
+
+	*mod |= memcmp(rxfh->key, data->hkey, data->hkey_size);
ethnl_update_binary()?
quoted hunk ↗ jump to hunk
+
+	return 0;
+}
Thread (33 messages) 33 messages, 3 authors, last reply 2025-07-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help