mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
ethtool: wire up set policies to ops
Similarly to get commands wire up the policies of set commands to get parsing by the core and policy dumps. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4f30974feb
commit
5028588b62
@ -11,8 +11,8 @@
|
|||||||
*/
|
*/
|
||||||
#define MAX_CABLE_LENGTH_CM (150 * 100)
|
#define MAX_CABLE_LENGTH_CM (150 * 100)
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
cable_test_act_policy[ETHTOOL_A_CABLE_TEST_MAX + 1] = {
|
ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_MAX + 1] = {
|
||||||
[ETHTOOL_A_CABLE_TEST_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_CABLE_TEST_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_CABLE_TEST_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_CABLE_TEST_HEADER] = { .type = NLA_NESTED },
|
||||||
};
|
};
|
||||||
@ -56,18 +56,12 @@ out:
|
|||||||
|
|
||||||
int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_CABLE_TEST_MAX + 1];
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
const struct ethtool_phy_ops *ops;
|
const struct ethtool_phy_ops *ops;
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_CABLE_TEST_MAX,
|
|
||||||
cable_test_act_policy, info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_CABLE_TEST_HEADER],
|
tb[ETHTOOL_A_CABLE_TEST_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
@ -226,8 +220,8 @@ cable_test_tdr_act_cfg_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX + 1] = {
|
|||||||
[ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR] = { .type = NLA_U8 },
|
[ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR] = { .type = NLA_U8 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1] = {
|
ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1] = {
|
||||||
[ETHTOOL_A_CABLE_TEST_TDR_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_CABLE_TEST_TDR_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_CABLE_TEST_TDR_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_CABLE_TEST_TDR_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_CABLE_TEST_TDR_CFG] = { .type = NLA_NESTED },
|
[ETHTOOL_A_CABLE_TEST_TDR_CFG] = { .type = NLA_NESTED },
|
||||||
@ -313,19 +307,13 @@ static int ethnl_act_cable_test_tdr_cfg(const struct nlattr *nest,
|
|||||||
|
|
||||||
int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1];
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
const struct ethtool_phy_ops *ops;
|
const struct ethtool_phy_ops *ops;
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct phy_tdr_config cfg;
|
struct phy_tdr_config cfg;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_CABLE_TEST_TDR_MAX,
|
|
||||||
cable_test_tdr_act_policy, info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
|
tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -109,8 +109,8 @@ const struct ethnl_request_ops ethnl_channels_request_ops = {
|
|||||||
|
|
||||||
/* CHANNELS_SET */
|
/* CHANNELS_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
channels_set_policy[ETHTOOL_A_CHANNELS_MAX + 1] = {
|
ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_MAX + 1] = {
|
||||||
[ETHTOOL_A_CHANNELS_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_CHANNELS_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_CHANNELS_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_CHANNELS_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_CHANNELS_RX_MAX] = { .type = NLA_REJECT },
|
[ETHTOOL_A_CHANNELS_RX_MAX] = { .type = NLA_REJECT },
|
||||||
@ -125,22 +125,17 @@ channels_set_policy[ETHTOOL_A_CHANNELS_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_CHANNELS_MAX + 1];
|
|
||||||
unsigned int from_channel, old_total, i;
|
unsigned int from_channel, old_total, i;
|
||||||
bool mod = false, mod_combined = false;
|
bool mod = false, mod_combined = false;
|
||||||
struct ethtool_channels channels = {};
|
struct ethtool_channels channels = {};
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct nlattr *err_attr;
|
const struct nlattr *err_attr;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
u32 max_rx_in_use = 0;
|
u32 max_rx_in_use = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_CHANNELS_MAX, channels_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_CHANNELS_HEADER],
|
tb[ETHTOOL_A_CHANNELS_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -213,8 +213,8 @@ const struct ethnl_request_ops ethnl_coalesce_request_ops = {
|
|||||||
|
|
||||||
/* COALESCE_SET */
|
/* COALESCE_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1] = {
|
ethnl_coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1] = {
|
||||||
[ETHTOOL_A_COALESCE_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_COALESCE_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_COALESCE_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_COALESCE_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_COALESCE_RX_USECS] = { .type = NLA_U32 },
|
[ETHTOOL_A_COALESCE_RX_USECS] = { .type = NLA_U32 },
|
||||||
@ -243,9 +243,9 @@ coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_COALESCE_MAX + 1];
|
|
||||||
struct ethtool_coalesce coalesce = {};
|
struct ethtool_coalesce coalesce = {};
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
u32 supported_params;
|
u32 supported_params;
|
||||||
@ -253,11 +253,6 @@ int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)
|
|||||||
int ret;
|
int ret;
|
||||||
u16 a;
|
u16 a;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_COALESCE_MAX, coalesce_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_COALESCE_HEADER],
|
tb[ETHTOOL_A_COALESCE_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -78,8 +78,7 @@ const struct ethnl_request_ops ethnl_debug_request_ops = {
|
|||||||
|
|
||||||
/* DEBUG_SET */
|
/* DEBUG_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy ethnl_debug_set_policy[ETHTOOL_A_DEBUG_MAX + 1] = {
|
||||||
debug_set_policy[ETHTOOL_A_DEBUG_MAX + 1] = {
|
|
||||||
[ETHTOOL_A_DEBUG_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_DEBUG_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_DEBUG_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_DEBUG_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_DEBUG_MSGMASK] = { .type = NLA_NESTED },
|
[ETHTOOL_A_DEBUG_MSGMASK] = { .type = NLA_NESTED },
|
||||||
@ -87,18 +86,13 @@ debug_set_policy[ETHTOOL_A_DEBUG_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_DEBUG_MAX + 1];
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
u32 msg_mask;
|
u32 msg_mask;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_DEBUG_MAX, debug_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_DEBUG_HEADER],
|
tb[ETHTOOL_A_DEBUG_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -128,8 +128,7 @@ const struct ethnl_request_ops ethnl_eee_request_ops = {
|
|||||||
|
|
||||||
/* EEE_SET */
|
/* EEE_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_MAX + 1] = {
|
||||||
eee_set_policy[ETHTOOL_A_EEE_MAX + 1] = {
|
|
||||||
[ETHTOOL_A_EEE_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_EEE_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_EEE_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_EEE_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_EEE_MODES_OURS] = { .type = NLA_NESTED },
|
[ETHTOOL_A_EEE_MODES_OURS] = { .type = NLA_NESTED },
|
||||||
@ -142,18 +141,14 @@ eee_set_policy[ETHTOOL_A_EEE_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_EEE_MAX + 1];
|
|
||||||
struct ethtool_eee eee = {};
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
|
struct ethtool_eee eee = {};
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb, ETHTOOL_A_EEE_MAX,
|
|
||||||
eee_set_policy, info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_EEE_HEADER],
|
tb[ETHTOOL_A_EEE_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -130,8 +130,8 @@ const struct ethnl_request_ops ethnl_features_request_ops = {
|
|||||||
|
|
||||||
/* FEATURES_SET */
|
/* FEATURES_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
features_set_policy[ETHTOOL_A_FEATURES_MAX + 1] = {
|
ethnl_features_set_policy[ETHTOOL_A_FEATURES_MAX + 1] = {
|
||||||
[ETHTOOL_A_FEATURES_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_FEATURES_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_FEATURES_HW] = { .type = NLA_REJECT },
|
[ETHTOOL_A_FEATURES_HW] = { .type = NLA_REJECT },
|
||||||
@ -227,17 +227,12 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
|
|||||||
DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT);
|
DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT);
|
||||||
DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT);
|
DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT);
|
||||||
DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT);
|
DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT);
|
||||||
struct nlattr *tb[ETHTOOL_A_FEATURES_MAX + 1];
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod;
|
bool mod;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_FEATURES_MAX, features_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
if (!tb[ETHTOOL_A_FEATURES_WANTED])
|
if (!tb[ETHTOOL_A_FEATURES_WANTED])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
|
@ -93,8 +93,8 @@ const struct ethnl_request_ops ethnl_linkinfo_request_ops = {
|
|||||||
|
|
||||||
/* LINKINFO_SET */
|
/* LINKINFO_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
linkinfo_set_policy[ETHTOOL_A_LINKINFO_MAX + 1] = {
|
ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_MAX + 1] = {
|
||||||
[ETHTOOL_A_LINKINFO_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_LINKINFO_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_LINKINFO_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_LINKINFO_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_LINKINFO_PORT] = { .type = NLA_U8 },
|
[ETHTOOL_A_LINKINFO_PORT] = { .type = NLA_U8 },
|
||||||
@ -106,19 +106,14 @@ linkinfo_set_policy[ETHTOOL_A_LINKINFO_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_LINKINFO_MAX + 1];
|
|
||||||
struct ethtool_link_ksettings ksettings = {};
|
struct ethtool_link_ksettings ksettings = {};
|
||||||
struct ethtool_link_settings *lsettings;
|
struct ethtool_link_settings *lsettings;
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_LINKINFO_MAX, linkinfo_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_LINKINFO_HEADER],
|
tb[ETHTOOL_A_LINKINFO_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -274,8 +274,8 @@ static const struct link_mode_info link_mode_params[] = {
|
|||||||
__DEFINE_LINK_MODE_PARAMS(100, FX, Full),
|
__DEFINE_LINK_MODE_PARAMS(100, FX, Full),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
linkmodes_set_policy[ETHTOOL_A_LINKMODES_MAX + 1] = {
|
ethnl_linkmodes_set_policy[ETHTOOL_A_LINKMODES_MAX + 1] = {
|
||||||
[ETHTOOL_A_LINKMODES_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_LINKMODES_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_LINKMODES_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_LINKMODES_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_LINKMODES_AUTONEG] = { .type = NLA_U8 },
|
[ETHTOOL_A_LINKMODES_AUTONEG] = { .type = NLA_U8 },
|
||||||
@ -390,18 +390,13 @@ static int ethnl_update_linkmodes(struct genl_info *info, struct nlattr **tb,
|
|||||||
|
|
||||||
int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_LINKMODES_MAX + 1];
|
|
||||||
struct ethtool_link_ksettings ksettings = {};
|
struct ethtool_link_ksettings ksettings = {};
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_LINKMODES_MAX, linkmodes_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_LINKMODES_HEADER],
|
tb[ETHTOOL_A_LINKMODES_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -700,6 +700,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_LINKINFO_SET,
|
.cmd = ETHTOOL_MSG_LINKINFO_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_linkinfo,
|
.doit = ethnl_set_linkinfo,
|
||||||
|
.policy = ethnl_linkinfo_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_linkinfo_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_LINKMODES_GET,
|
.cmd = ETHTOOL_MSG_LINKMODES_GET,
|
||||||
@ -714,6 +716,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_LINKMODES_SET,
|
.cmd = ETHTOOL_MSG_LINKMODES_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_linkmodes,
|
.doit = ethnl_set_linkmodes,
|
||||||
|
.policy = ethnl_linkmodes_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_linkmodes_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_LINKSTATE_GET,
|
.cmd = ETHTOOL_MSG_LINKSTATE_GET,
|
||||||
@ -737,6 +741,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_DEBUG_SET,
|
.cmd = ETHTOOL_MSG_DEBUG_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_debug,
|
.doit = ethnl_set_debug,
|
||||||
|
.policy = ethnl_debug_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_debug_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_WOL_GET,
|
.cmd = ETHTOOL_MSG_WOL_GET,
|
||||||
@ -752,6 +758,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_WOL_SET,
|
.cmd = ETHTOOL_MSG_WOL_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_wol,
|
.doit = ethnl_set_wol,
|
||||||
|
.policy = ethnl_wol_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_wol_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_FEATURES_GET,
|
.cmd = ETHTOOL_MSG_FEATURES_GET,
|
||||||
@ -766,6 +774,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_FEATURES_SET,
|
.cmd = ETHTOOL_MSG_FEATURES_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_features,
|
.doit = ethnl_set_features,
|
||||||
|
.policy = ethnl_features_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_features_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_PRIVFLAGS_GET,
|
.cmd = ETHTOOL_MSG_PRIVFLAGS_GET,
|
||||||
@ -780,6 +790,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_PRIVFLAGS_SET,
|
.cmd = ETHTOOL_MSG_PRIVFLAGS_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_privflags,
|
.doit = ethnl_set_privflags,
|
||||||
|
.policy = ethnl_privflags_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_privflags_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_RINGS_GET,
|
.cmd = ETHTOOL_MSG_RINGS_GET,
|
||||||
@ -794,6 +806,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_RINGS_SET,
|
.cmd = ETHTOOL_MSG_RINGS_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_rings,
|
.doit = ethnl_set_rings,
|
||||||
|
.policy = ethnl_rings_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_rings_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_CHANNELS_GET,
|
.cmd = ETHTOOL_MSG_CHANNELS_GET,
|
||||||
@ -808,6 +822,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_CHANNELS_SET,
|
.cmd = ETHTOOL_MSG_CHANNELS_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_channels,
|
.doit = ethnl_set_channels,
|
||||||
|
.policy = ethnl_channels_get_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_channels_get_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_COALESCE_GET,
|
.cmd = ETHTOOL_MSG_COALESCE_GET,
|
||||||
@ -822,6 +838,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_COALESCE_SET,
|
.cmd = ETHTOOL_MSG_COALESCE_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_coalesce,
|
.doit = ethnl_set_coalesce,
|
||||||
|
.policy = ethnl_coalesce_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_coalesce_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_PAUSE_GET,
|
.cmd = ETHTOOL_MSG_PAUSE_GET,
|
||||||
@ -836,6 +854,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_PAUSE_SET,
|
.cmd = ETHTOOL_MSG_PAUSE_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_pause,
|
.doit = ethnl_set_pause,
|
||||||
|
.policy = ethnl_pause_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_pause_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_EEE_GET,
|
.cmd = ETHTOOL_MSG_EEE_GET,
|
||||||
@ -850,6 +870,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_EEE_SET,
|
.cmd = ETHTOOL_MSG_EEE_SET,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_set_eee,
|
.doit = ethnl_set_eee,
|
||||||
|
.policy = ethnl_eee_set_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_eee_set_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_TSINFO_GET,
|
.cmd = ETHTOOL_MSG_TSINFO_GET,
|
||||||
@ -864,11 +886,15 @@ static const struct genl_ops ethtool_genl_ops[] = {
|
|||||||
.cmd = ETHTOOL_MSG_CABLE_TEST_ACT,
|
.cmd = ETHTOOL_MSG_CABLE_TEST_ACT,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_act_cable_test,
|
.doit = ethnl_act_cable_test,
|
||||||
|
.policy = ethnl_cable_test_act_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_cable_test_act_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_CABLE_TEST_TDR_ACT,
|
.cmd = ETHTOOL_MSG_CABLE_TEST_TDR_ACT,
|
||||||
.flags = GENL_UNS_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
.doit = ethnl_act_cable_test_tdr,
|
.doit = ethnl_act_cable_test_tdr,
|
||||||
|
.policy = ethnl_cable_test_tdr_act_policy,
|
||||||
|
.maxattr = ARRAY_SIZE(ethnl_cable_test_tdr_act_policy) - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = ETHTOOL_MSG_TUNNEL_INFO_GET,
|
.cmd = ETHTOOL_MSG_TUNNEL_INFO_GET,
|
||||||
|
@ -347,18 +347,31 @@ extern const struct ethnl_request_ops ethnl_tsinfo_request_ops;
|
|||||||
|
|
||||||
extern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_MAX + 1];
|
extern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_MAX + 1];
|
extern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_linkmodes_get_policy[ETHTOOL_A_LINKMODES_MAX + 1];
|
extern const struct nla_policy ethnl_linkmodes_get_policy[ETHTOOL_A_LINKMODES_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_linkmodes_set_policy[ETHTOOL_A_LINKMODES_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_linkstate_get_policy[ETHTOOL_A_LINKSTATE_MAX + 1];
|
extern const struct nla_policy ethnl_linkstate_get_policy[ETHTOOL_A_LINKSTATE_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_debug_get_policy[ETHTOOL_A_DEBUG_MAX + 1];
|
extern const struct nla_policy ethnl_debug_get_policy[ETHTOOL_A_DEBUG_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_debug_set_policy[ETHTOOL_A_DEBUG_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_wol_get_policy[ETHTOOL_A_WOL_MAX + 1];
|
extern const struct nla_policy ethnl_wol_get_policy[ETHTOOL_A_WOL_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_wol_set_policy[ETHTOOL_A_WOL_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_features_get_policy[ETHTOOL_A_FEATURES_MAX + 1];
|
extern const struct nla_policy ethnl_features_get_policy[ETHTOOL_A_FEATURES_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_features_set_policy[ETHTOOL_A_FEATURES_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1];
|
extern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_MAX + 1];
|
extern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_MAX + 1];
|
extern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_MAX + 1];
|
extern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_MAX + 1];
|
extern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_MAX + 1];
|
extern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_MAX + 1];
|
extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_MAX + 1];
|
||||||
|
extern const struct nla_policy ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1];
|
||||||
extern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_MAX + 1];
|
extern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_MAX + 1];
|
||||||
|
|
||||||
int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info);
|
int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info);
|
||||||
|
@ -139,8 +139,7 @@ const struct ethnl_request_ops ethnl_pause_request_ops = {
|
|||||||
|
|
||||||
/* PAUSE_SET */
|
/* PAUSE_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_MAX + 1] = {
|
||||||
pause_set_policy[ETHTOOL_A_PAUSE_MAX + 1] = {
|
|
||||||
[ETHTOOL_A_PAUSE_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_PAUSE_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_PAUSE_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_PAUSE_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_PAUSE_AUTONEG] = { .type = NLA_U8 },
|
[ETHTOOL_A_PAUSE_AUTONEG] = { .type = NLA_U8 },
|
||||||
@ -151,18 +150,14 @@ pause_set_policy[ETHTOOL_A_PAUSE_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_pause(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_pause(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_PAUSE_MAX + 1];
|
|
||||||
struct ethtool_pauseparam params = {};
|
struct ethtool_pauseparam params = {};
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb, ETHTOOL_A_PAUSE_MAX,
|
|
||||||
pause_set_policy, info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_PAUSE_HEADER],
|
tb[ETHTOOL_A_PAUSE_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -135,8 +135,8 @@ const struct ethnl_request_ops ethnl_privflags_request_ops = {
|
|||||||
|
|
||||||
/* PRIVFLAGS_SET */
|
/* PRIVFLAGS_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy
|
||||||
privflags_set_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1] = {
|
ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1] = {
|
||||||
[ETHTOOL_A_PRIVFLAGS_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_PRIVFLAGS_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_PRIVFLAGS_FLAGS] = { .type = NLA_NESTED },
|
[ETHTOOL_A_PRIVFLAGS_FLAGS] = { .type = NLA_NESTED },
|
||||||
@ -144,9 +144,9 @@ privflags_set_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_PRIVFLAGS_MAX + 1];
|
|
||||||
const char (*names)[ETH_GSTRING_LEN] = NULL;
|
const char (*names)[ETH_GSTRING_LEN] = NULL;
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
unsigned int nflags;
|
unsigned int nflags;
|
||||||
@ -155,11 +155,6 @@ int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info)
|
|||||||
u32 flags;
|
u32 flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_PRIVFLAGS_MAX, privflags_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
if (!tb[ETHTOOL_A_PRIVFLAGS_FLAGS])
|
if (!tb[ETHTOOL_A_PRIVFLAGS_FLAGS])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ret = ethnl_bitset_is_compact(tb[ETHTOOL_A_PRIVFLAGS_FLAGS], &compact);
|
ret = ethnl_bitset_is_compact(tb[ETHTOOL_A_PRIVFLAGS_FLAGS], &compact);
|
||||||
|
@ -106,8 +106,7 @@ const struct ethnl_request_ops ethnl_rings_request_ops = {
|
|||||||
|
|
||||||
/* RINGS_SET */
|
/* RINGS_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_MAX + 1] = {
|
||||||
rings_set_policy[ETHTOOL_A_RINGS_MAX + 1] = {
|
|
||||||
[ETHTOOL_A_RINGS_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_RINGS_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_RINGS_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_RINGS_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_RINGS_RX_MAX] = { .type = NLA_REJECT },
|
[ETHTOOL_A_RINGS_RX_MAX] = { .type = NLA_REJECT },
|
||||||
@ -122,20 +121,15 @@ rings_set_policy[ETHTOOL_A_RINGS_MAX + 1] = {
|
|||||||
|
|
||||||
int ethnl_set_rings(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_rings(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[ETHTOOL_A_RINGS_MAX + 1];
|
|
||||||
struct ethtool_ringparam ringparam = {};
|
struct ethtool_ringparam ringparam = {};
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
const struct nlattr *err_attr;
|
const struct nlattr *err_attr;
|
||||||
const struct ethtool_ops *ops;
|
const struct ethtool_ops *ops;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
|
|
||||||
ETHTOOL_A_RINGS_MAX, rings_set_policy,
|
|
||||||
info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info,
|
ret = ethnl_parse_header_dev_get(&req_info,
|
||||||
tb[ETHTOOL_A_RINGS_HEADER],
|
tb[ETHTOOL_A_RINGS_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
|
@ -98,8 +98,7 @@ const struct ethnl_request_ops ethnl_wol_request_ops = {
|
|||||||
|
|
||||||
/* WOL_SET */
|
/* WOL_SET */
|
||||||
|
|
||||||
static const struct nla_policy
|
const struct nla_policy ethnl_wol_set_policy[ETHTOOL_A_WOL_MAX + 1] = {
|
||||||
wol_set_policy[ETHTOOL_A_WOL_MAX + 1] = {
|
|
||||||
[ETHTOOL_A_WOL_UNSPEC] = { .type = NLA_REJECT },
|
[ETHTOOL_A_WOL_UNSPEC] = { .type = NLA_REJECT },
|
||||||
[ETHTOOL_A_WOL_HEADER] = { .type = NLA_NESTED },
|
[ETHTOOL_A_WOL_HEADER] = { .type = NLA_NESTED },
|
||||||
[ETHTOOL_A_WOL_MODES] = { .type = NLA_NESTED },
|
[ETHTOOL_A_WOL_MODES] = { .type = NLA_NESTED },
|
||||||
@ -110,16 +109,12 @@ wol_set_policy[ETHTOOL_A_WOL_MAX + 1] = {
|
|||||||
int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info)
|
int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
|
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
|
||||||
struct nlattr *tb[ETHTOOL_A_WOL_MAX + 1];
|
|
||||||
struct ethnl_req_info req_info = {};
|
struct ethnl_req_info req_info = {};
|
||||||
|
struct nlattr **tb = info->attrs;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
bool mod = false;
|
bool mod = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb, ETHTOOL_A_WOL_MAX,
|
|
||||||
wol_set_policy, info->extack);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
ret = ethnl_parse_header_dev_get(&req_info, tb[ETHTOOL_A_WOL_HEADER],
|
ret = ethnl_parse_header_dev_get(&req_info, tb[ETHTOOL_A_WOL_HEADER],
|
||||||
genl_info_net(info), info->extack,
|
genl_info_net(info), info->extack,
|
||||||
true);
|
true);
|
||||||
|
Loading…
Reference in New Issue
Block a user