History

Revert "net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings"

This reverts commit 3bd9b9abdf1563a22041b7255baea6d449902f1a. We cannot use the new tagged struct group because it throws C++ errors even under "extern C".

Kees Cook committed 1 year ago

Commit 1cfb5e51 parent 920efe39 files · +22 −26Browse files

Unified · Split

9 files
  1. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 −3
  2. drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +2 −2
  3. drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +1 −1
  4. drivers/net/ethernet/cisco/enic/enic_ethtool.c +1 −1
  5. drivers/net/ethernet/qlogic/qede/qede_ethtool.c +2 −2
  6. include/linux/ethtool.h +1 −1
  7. net/ethtool/ioctl.c +1 −1
  8. net/ethtool/linkinfo.c +4 −4
  9. net/ethtool/linkmodes.c +7 −11
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+3−3
@@ -2780,7 +2780,7 @@ u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed) · 2779 unmodified lines
27802780 static void bnxt_get_default_speeds(struct ethtool_link_ksettings *lk_ksettings,
27812781 struct bnxt_link_info *link_info)
27822782 {
2783− struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
2783+ struct ethtool_link_settings *base = &lk_ksettings->base;
27842784
27852785 if (link_info->link_state == BNXT_LINK_STATE_UP) {
27862786 base->speed = bnxt_fw_to_ethtool_speed(link_info->link_speed);
@@ -2799,7 +2799,7 @@ static void bnxt_get_default_speeds(struct ethtool_link_ksettings *lk_ksettings, · 12 unmodified lines
27992799 static int bnxt_get_link_ksettings(struct net_device *dev,
28002800 struct ethtool_link_ksettings *lk_ksettings)
28012801 {
2802− struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
2802+ struct ethtool_link_settings *base = &lk_ksettings->base;
28032803 enum ethtool_link_mode_bit_indices link_mode;
28042804 struct bnxt *bp = netdev_priv(dev);
28052805 struct bnxt_link_info *link_info;
@@ -3022,9 +3022,9 @@ u16 bnxt_get_fw_auto_link_speeds(const unsigned long *mode) · 216 unmodified lines
30223022 static int bnxt_set_link_ksettings(struct net_device *dev,
30233023 const struct ethtool_link_ksettings *lk_ksettings)
30243024 {
3025− const struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
30263025 struct bnxt *bp = netdev_priv(dev);
30273026 struct bnxt_link_info *link_info = &bp->link_info;
3027+ const struct ethtool_link_settings *base = &lk_ksettings->base;
30283028 bool set_pause = false;
30293029 u32 speed, lanes = 0;
30303030 int rc = 0;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c+2−2
@@ -662,8 +662,8 @@ static unsigned int lmm_to_fw_caps(const unsigned long *link_mode_mask) · 661 unmodified lines
662662 static int get_link_ksettings(struct net_device *dev,
663663 struct ethtool_link_ksettings *link_ksettings)
664664 {
665− struct ethtool_link_settings_hdr *base = &link_ksettings->base;
666665 struct port_info *pi = netdev_priv(dev);
666+ struct ethtool_link_settings *base = &link_ksettings->base;
667667
668668 /* For the nonce, the Firmware doesn't send up Port State changes
669669 * when the Virtual Interface attached to the Port is down. So
@@ -717,9 +717,9 @@ static int get_link_ksettings(struct net_device *dev, · 47 unmodified lines
717717 static int set_link_ksettings(struct net_device *dev,
718718 const struct ethtool_link_ksettings *link_ksettings)
719719 {
720− const struct ethtool_link_settings_hdr *base = &link_ksettings->base;
721720 struct port_info *pi = netdev_priv(dev);
722721 struct link_config *lc = &pi->link_cfg;
722+ const struct ethtool_link_settings *base = &link_ksettings->base;
723723 struct link_config old_lc;
724724 unsigned int fw_caps;
725725 int ret = 0;
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c+1−1
@@ -1436,8 +1436,8 @@ static void fw_caps_to_lmm(enum fw_port_type port_type, · 1435 unmodified lines
14361436 static int cxgb4vf_get_link_ksettings(struct net_device *dev,
14371437 struct ethtool_link_ksettings *link_ksettings)
14381438 {
1439− struct ethtool_link_settings_hdr *base = &link_ksettings->base;
14401439 struct port_info *pi = netdev_priv(dev);
1440+ struct ethtool_link_settings *base = &link_ksettings->base;
14411441
14421442 /* For the nonce, the Firmware doesn't send up Port State changes
14431443 * when the Virtual Interface attached to the Port is down. So
drivers/net/ethernet/cisco/enic/enic_ethtool.c+1−1
@@ -129,8 +129,8 @@ static void enic_intr_coal_set_rx(struct enic *enic, u32 timer) · 128 unmodified lines
129129 static int enic_get_ksettings(struct net_device *netdev,
130130 struct ethtool_link_ksettings *ecmd)
131131 {
132− struct ethtool_link_settings_hdr *base = &ecmd->base;
133132 struct enic *enic = netdev_priv(netdev);
133+ struct ethtool_link_settings *base = &ecmd->base;
134134
135135 ethtool_link_ksettings_add_link_mode(ecmd, supported,
136136 10000baseT_Full);
drivers/net/ethernet/qlogic/qede/qede_ethtool.c+2−2
@@ -504,7 +504,7 @@ static int qede_get_link_ksettings(struct net_device *dev, · 503 unmodified lines
504504 struct ethtool_link_ksettings *cmd)
505505 {
506506 typeof(cmd->link_modes) *link_modes = &cmd->link_modes;
507− struct ethtool_link_settings_hdr *base = &cmd->base;
507+ struct ethtool_link_settings *base = &cmd->base;
508508 struct qede_dev *edev = netdev_priv(dev);
509509 struct qed_link_output current_link;
510510
@@ -537,7 +537,7 @@ static int qede_get_link_ksettings(struct net_device *dev, · 26 unmodified lines
537537 static int qede_set_link_ksettings(struct net_device *dev,
538538 const struct ethtool_link_ksettings *cmd)
539539 {
540− const struct ethtool_link_settings_hdr *base = &cmd->base;
540+ const struct ethtool_link_settings *base = &cmd->base;
541541 const struct ethtool_forced_speed_map *map;
542542 struct qede_dev *edev = netdev_priv(dev);
543543 struct qed_link_output current_link;
include/linux/ethtool.h+1−1
@@ -211,7 +211,7 @@ void ethtool_rxfh_context_lost(struct net_device *dev, u32 context_id); · 210 unmodified lines
211211 * fields, but they are allowed to overwrite them (will be ignored).
212212 */
213213 struct ethtool_link_ksettings {
214− struct ethtool_link_settings_hdr base;
214+ struct ethtool_link_settings base;
215215 struct {
216216 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
217217 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
net/ethtool/ioctl.c+1−1
@@ -425,7 +425,7 @@ convert_link_ksettings_to_legacy_settings( · 424 unmodified lines
425425
426426 /* layout of the struct passed from/to userland */
427427 struct ethtool_link_usettings {
428− struct ethtool_link_settings_hdr base;
428+ struct ethtool_link_settings base;
429429 struct {
430430 __u32 supported[__ETHTOOL_LINK_MODE_MASK_NU32];
431431 __u32 advertising[__ETHTOOL_LINK_MODE_MASK_NU32];
net/ethtool/linkinfo.c+4−4
@@ -8,9 +8,9 @@ struct linkinfo_req_info { · 7 unmodified lines
88 };
99
1010 struct linkinfo_reply_data {
11− struct ethnl_reply_data base;
12− struct ethtool_link_ksettings ksettings;
13− struct ethtool_link_settings_hdr *lsettings;
11+ struct ethnl_reply_data base;
12+ struct ethtool_link_ksettings ksettings;
13+ struct ethtool_link_settings *lsettings;
1414 };
1515
1616 #define LINKINFO_REPDATA(__reply_base) \
@@ -98,7 +98,7 @@ static int · 81 unmodified lines
9898 ethnl_set_linkinfo(struct ethnl_req_info *req_info, struct genl_info *info)
9999 {
100100 struct ethtool_link_ksettings ksettings = {};
101− struct ethtool_link_settings_hdr *lsettings;
101+ struct ethtool_link_settings *lsettings;
102102 struct net_device *dev = req_info->dev;
103103 struct nlattr **tb = info->attrs;
104104 bool mod = false;
net/ethtool/linkmodes.c+7−11
@@ -11,10 +11,10 @@ struct linkmodes_req_info { · 10 unmodified lines
1111 };
1212
1313 struct linkmodes_reply_data {
14− struct ethnl_reply_data base;
15− struct ethtool_link_ksettings ksettings;
16− struct ethtool_link_settings_hdr *lsettings;
17− bool peer_empty;
14+ struct ethnl_reply_data base;
15+ struct ethtool_link_ksettings ksettings;
16+ struct ethtool_link_settings *lsettings;
17+ bool peer_empty;
1818 };
1919
2020 #define LINKMODES_REPDATA(__reply_base) \
@@ -62,12 +62,10 @@ static int linkmodes_reply_size(const struct ethnl_req_info *req_base, · 41 unmodified lines
6262 {
6363 const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
6464 const struct ethtool_link_ksettings *ksettings = &data->ksettings;
65+ const struct ethtool_link_settings *lsettings = &ksettings->base;
6566 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
66− const struct ethtool_link_settings_hdr *lsettings;
6767 int len, ret;
6868
69− lsettings = &ksettings->base;
70−
7169 len = nla_total_size(sizeof(u8)) /* LINKMODES_AUTONEG */
7270 + nla_total_size(sizeof(u32)) /* LINKMODES_SPEED */
7371 + nla_total_size(sizeof(u32)) /* LINKMODES_LANES */
@@ -105,12 +103,10 @@ static int linkmodes_fill_reply(struct sk_buff *skb, · 31 unmodified lines
105103 {
106104 const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
107105 const struct ethtool_link_ksettings *ksettings = &data->ksettings;
106+ const struct ethtool_link_settings *lsettings = &ksettings->base;
108107 bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
109− const struct ethtool_link_settings_hdr *lsettings;
110108 int ret;
111109
112− lsettings = &ksettings->base;
113−
114110 if (nla_put_u8(skb, ETHTOOL_A_LINKMODES_AUTONEG, lsettings->autoneg))
115111 return -EMSGSIZE;
116112
@@ -241,7 +237,7 @@ static int ethnl_update_linkmodes(struct genl_info *info, struct nlattr **tb, · 124 unmodified lines
241237 struct ethtool_link_ksettings *ksettings,
242238 bool *mod, const struct net_device *dev)
243239 {
244− struct ethtool_link_settings_hdr *lsettings = &ksettings->base;
240+ struct ethtool_link_settings *lsettings = &ksettings->base;
245241 bool req_speed, req_lanes, req_duplex;
246242 const struct nlattr *master_slave_cfg, *lanes_cfg;
247243 int ret;