Commit 329d9c33 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

ethtool: link up ethnl_header_policy as a nested policy



To get the most out of parsing by the core, and to allow dumping
full policies we need to specify which policy applies to nested
attrs. For headers it's ethnl_header_policy.

$ sed -i 's@\(ETHTOOL_A_.*HEADER\].*=\) { .type = NLA_NESTED },@\1\n\t\tNLA_POLICY_NESTED(ethnl_header_policy),@' net/ethtool/*

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff419afa
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@
#define MAX_CABLE_LENGTH_CM (150 * 100)

const struct nla_policy ethnl_cable_test_act_policy[] = {
	[ETHTOOL_A_CABLE_TEST_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_CABLE_TEST_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
};

static int ethnl_cable_test_started(struct phy_device *phydev, u8 cmd)
@@ -218,7 +219,8 @@ static const struct nla_policy cable_test_tdr_act_cfg_policy[] = {
};

const struct nla_policy ethnl_cable_test_tdr_act_policy[] = {
	[ETHTOOL_A_CABLE_TEST_TDR_HEADER]	= { .type = NLA_NESTED },
	[ETHTOOL_A_CABLE_TEST_TDR_HEADER]	=
		NLA_POLICY_NESTED(ethnl_header_policy),
	[ETHTOOL_A_CABLE_TEST_TDR_CFG]		= { .type = NLA_NESTED },
};

+4 −2
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ struct channels_reply_data {
	container_of(__reply_base, struct channels_reply_data, base)

const struct nla_policy ethnl_channels_get_policy[] = {
	[ETHTOOL_A_CHANNELS_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_CHANNELS_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
};

static int channels_prepare_data(const struct ethnl_req_info *req_base,
@@ -100,7 +101,8 @@ const struct ethnl_request_ops ethnl_channels_request_ops = {
/* CHANNELS_SET */

const struct nla_policy ethnl_channels_set_policy[] = {
	[ETHTOOL_A_CHANNELS_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_CHANNELS_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
	[ETHTOOL_A_CHANNELS_RX_COUNT]		= { .type = NLA_U32 },
	[ETHTOOL_A_CHANNELS_TX_COUNT]		= { .type = NLA_U32 },
	[ETHTOOL_A_CHANNELS_OTHER_COUNT]	= { .type = NLA_U32 },
+4 −2
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ __CHECK_SUPPORTED_OFFSET(COALESCE_TX_MAX_FRAMES_HIGH);
__CHECK_SUPPORTED_OFFSET(COALESCE_RATE_SAMPLE_INTERVAL);

const struct nla_policy ethnl_coalesce_get_policy[] = {
	[ETHTOOL_A_COALESCE_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_COALESCE_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
};

static int coalesce_prepare_data(const struct ethnl_req_info *req_base,
@@ -190,7 +191,8 @@ const struct ethnl_request_ops ethnl_coalesce_request_ops = {
/* COALESCE_SET */

const struct nla_policy ethnl_coalesce_set_policy[] = {
	[ETHTOOL_A_COALESCE_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_COALESCE_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
	[ETHTOOL_A_COALESCE_RX_USECS]		= { .type = NLA_U32 },
	[ETHTOOL_A_COALESCE_RX_MAX_FRAMES]	= { .type = NLA_U32 },
	[ETHTOOL_A_COALESCE_RX_USECS_IRQ]	= { .type = NLA_U32 },
+4 −2
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@ struct debug_reply_data {
	container_of(__reply_base, struct debug_reply_data, base)

const struct nla_policy ethnl_debug_get_policy[] = {
	[ETHTOOL_A_DEBUG_HEADER]	= { .type = NLA_NESTED },
	[ETHTOOL_A_DEBUG_HEADER]	=
		NLA_POLICY_NESTED(ethnl_header_policy),
};

static int debug_prepare_data(const struct ethnl_req_info *req_base,
@@ -77,7 +78,8 @@ const struct ethnl_request_ops ethnl_debug_request_ops = {
/* DEBUG_SET */

const struct nla_policy ethnl_debug_set_policy[] = {
	[ETHTOOL_A_DEBUG_HEADER]	= { .type = NLA_NESTED },
	[ETHTOOL_A_DEBUG_HEADER]	=
		NLA_POLICY_NESTED(ethnl_header_policy),
	[ETHTOOL_A_DEBUG_MSGMASK]	= { .type = NLA_NESTED },
};

+4 −2
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ struct eee_reply_data {
	container_of(__reply_base, struct eee_reply_data, base)

const struct nla_policy ethnl_eee_get_policy[] = {
	[ETHTOOL_A_EEE_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_EEE_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
};

static int eee_prepare_data(const struct ethnl_req_info *req_base,
@@ -122,7 +123,8 @@ const struct ethnl_request_ops ethnl_eee_request_ops = {
/* EEE_SET */

const struct nla_policy ethnl_eee_set_policy[] = {
	[ETHTOOL_A_EEE_HEADER]		= { .type = NLA_NESTED },
	[ETHTOOL_A_EEE_HEADER]		=
		NLA_POLICY_NESTED(ethnl_header_policy),
	[ETHTOOL_A_EEE_MODES_OURS]	= { .type = NLA_NESTED },
	[ETHTOOL_A_EEE_ENABLED]		= { .type = NLA_U8 },
	[ETHTOOL_A_EEE_TX_LPI_ENABLED]	= { .type = NLA_U8 },
Loading