eee.c (a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0) | eee.c (d80a52335374e484a4ff2afdc9af843e73273945) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2 3#include "netlink.h" 4#include "common.h" 5#include "bitset.h" 6 7#define EEE_MODES_COUNT \ | 1// SPDX-License-Identifier: GPL-2.0-only 2 3#include "netlink.h" 4#include "common.h" 5#include "bitset.h" 6 7#define EEE_MODES_COUNT \ |
8 (sizeof_field(struct ethtool_eee, supported) * BITS_PER_BYTE) | 8 (sizeof_field(struct ethtool_keee, supported) * BITS_PER_BYTE) |
9 10struct eee_req_info { 11 struct ethnl_req_info base; 12}; 13 14struct eee_reply_data { 15 struct ethnl_reply_data base; | 9 10struct eee_req_info { 11 struct ethnl_req_info base; 12}; 13 14struct eee_reply_data { 15 struct ethnl_reply_data base; |
16 struct ethtool_eee eee; | 16 struct ethtool_keee eee; |
17}; 18 19#define EEE_REPDATA(__reply_base) \ 20 container_of(__reply_base, struct eee_reply_data, base) 21 22const struct nla_policy ethnl_eee_get_policy[] = { 23 [ETHTOOL_A_EEE_HEADER] = 24 NLA_POLICY_NESTED(ethnl_header_policy), --- 18 unchanged lines hidden (view full) --- 43 return ret; 44} 45 46static int eee_reply_size(const struct ethnl_req_info *req_base, 47 const struct ethnl_reply_data *reply_base) 48{ 49 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS; 50 const struct eee_reply_data *data = EEE_REPDATA(reply_base); | 17}; 18 19#define EEE_REPDATA(__reply_base) \ 20 container_of(__reply_base, struct eee_reply_data, base) 21 22const struct nla_policy ethnl_eee_get_policy[] = { 23 [ETHTOOL_A_EEE_HEADER] = 24 NLA_POLICY_NESTED(ethnl_header_policy), --- 18 unchanged lines hidden (view full) --- 43 return ret; 44} 45 46static int eee_reply_size(const struct ethnl_req_info *req_base, 47 const struct ethnl_reply_data *reply_base) 48{ 49 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS; 50 const struct eee_reply_data *data = EEE_REPDATA(reply_base); |
51 const struct ethtool_eee *eee = &data->eee; | 51 const struct ethtool_keee *eee = &data->eee; |
52 int len = 0; 53 int ret; 54 55 BUILD_BUG_ON(sizeof(eee->advertised) * BITS_PER_BYTE != 56 EEE_MODES_COUNT); 57 BUILD_BUG_ON(sizeof(eee->lp_advertised) * BITS_PER_BYTE != 58 EEE_MODES_COUNT); 59 --- 19 unchanged lines hidden (view full) --- 79} 80 81static int eee_fill_reply(struct sk_buff *skb, 82 const struct ethnl_req_info *req_base, 83 const struct ethnl_reply_data *reply_base) 84{ 85 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS; 86 const struct eee_reply_data *data = EEE_REPDATA(reply_base); | 52 int len = 0; 53 int ret; 54 55 BUILD_BUG_ON(sizeof(eee->advertised) * BITS_PER_BYTE != 56 EEE_MODES_COUNT); 57 BUILD_BUG_ON(sizeof(eee->lp_advertised) * BITS_PER_BYTE != 58 EEE_MODES_COUNT); 59 --- 19 unchanged lines hidden (view full) --- 79} 80 81static int eee_fill_reply(struct sk_buff *skb, 82 const struct ethnl_req_info *req_base, 83 const struct ethnl_reply_data *reply_base) 84{ 85 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS; 86 const struct eee_reply_data *data = EEE_REPDATA(reply_base); |
87 const struct ethtool_eee *eee = &data->eee; | 87 const struct ethtool_keee *eee = &data->eee; |
88 int ret; 89 90 ret = ethnl_put_bitset32(skb, ETHTOOL_A_EEE_MODES_OURS, 91 &eee->advertised, &eee->supported, 92 EEE_MODES_COUNT, link_mode_names, compact); 93 if (ret < 0) 94 return ret; 95 ret = ethnl_put_bitset32(skb, ETHTOOL_A_EEE_MODES_PEER, --- 31 unchanged lines hidden (view full) --- 127 return ops->get_eee && ops->set_eee ? 1 : -EOPNOTSUPP; 128} 129 130static int 131ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info) 132{ 133 struct net_device *dev = req_info->dev; 134 struct nlattr **tb = info->attrs; | 88 int ret; 89 90 ret = ethnl_put_bitset32(skb, ETHTOOL_A_EEE_MODES_OURS, 91 &eee->advertised, &eee->supported, 92 EEE_MODES_COUNT, link_mode_names, compact); 93 if (ret < 0) 94 return ret; 95 ret = ethnl_put_bitset32(skb, ETHTOOL_A_EEE_MODES_PEER, --- 31 unchanged lines hidden (view full) --- 127 return ops->get_eee && ops->set_eee ? 1 : -EOPNOTSUPP; 128} 129 130static int 131ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info) 132{ 133 struct net_device *dev = req_info->dev; 134 struct nlattr **tb = info->attrs; |
135 struct ethtool_eee eee = {}; | 135 struct ethtool_keee eee = {}; |
136 bool mod = false; 137 int ret; 138 139 ret = dev->ethtool_ops->get_eee(dev, &eee); 140 if (ret < 0) 141 return ret; 142 143 ret = ethnl_update_bitset32(&eee.advertised, EEE_MODES_COUNT, --- 31 unchanged lines hidden --- | 136 bool mod = false; 137 int ret; 138 139 ret = dev->ethtool_ops->get_eee(dev, &eee); 140 if (ret < 0) 141 return ret; 142 143 ret = ethnl_update_bitset32(&eee.advertised, EEE_MODES_COUNT, --- 31 unchanged lines hidden --- |