]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Revert "net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings"
authorKees Cook <kees@kernel.org>
Fri, 15 Nov 2024 20:43:03 +0000 (12:43 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Nov 2024 02:52:11 +0000 (18:52 -0800)
This reverts commit 3bd9b9abdf1563a22041b7255baea6d449902f1a. We cannot
use the new tagged struct group because it throws C++ errors even under
"extern C".

Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20241115204308.3821419-1-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
drivers/net/ethernet/cisco/enic/enic_ethtool.c
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
include/linux/ethtool.h
net/ethtool/ioctl.c
net/ethtool/linkinfo.c
net/ethtool/linkmodes.c

index cfd2c65b1c905beee7417d0e3cff6a4b268c7294..061a40b1974b062f313617e7e046f3750424e2d7 100644 (file)
@@ -2780,7 +2780,7 @@ u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed)
 static void bnxt_get_default_speeds(struct ethtool_link_ksettings *lk_ksettings,
                                    struct bnxt_link_info *link_info)
 {
-       struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
+       struct ethtool_link_settings *base = &lk_ksettings->base;
 
        if (link_info->link_state == BNXT_LINK_STATE_UP) {
                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,
 static int bnxt_get_link_ksettings(struct net_device *dev,
                                   struct ethtool_link_ksettings *lk_ksettings)
 {
-       struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
+       struct ethtool_link_settings *base = &lk_ksettings->base;
        enum ethtool_link_mode_bit_indices link_mode;
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_link_info *link_info;
@@ -3022,9 +3022,9 @@ u16 bnxt_get_fw_auto_link_speeds(const unsigned long *mode)
 static int bnxt_set_link_ksettings(struct net_device *dev,
                           const struct ethtool_link_ksettings *lk_ksettings)
 {
-       const struct ethtool_link_settings_hdr *base = &lk_ksettings->base;
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_link_info *link_info = &bp->link_info;
+       const struct ethtool_link_settings *base = &lk_ksettings->base;
        bool set_pause = false;
        u32 speed, lanes = 0;
        int rc = 0;
index 45d28a65347e2b7d35863399530609b9ad6a9433..7f3f5afa864f4a58c8b0adf2a1ec333b9a4bac1e 100644 (file)
@@ -662,8 +662,8 @@ static unsigned int lmm_to_fw_caps(const unsigned long *link_mode_mask)
 static int get_link_ksettings(struct net_device *dev,
                              struct ethtool_link_ksettings *link_ksettings)
 {
-       struct ethtool_link_settings_hdr *base = &link_ksettings->base;
        struct port_info *pi = netdev_priv(dev);
+       struct ethtool_link_settings *base = &link_ksettings->base;
 
        /* For the nonce, the Firmware doesn't send up Port State changes
         * when the Virtual Interface attached to the Port is down.  So
@@ -717,9 +717,9 @@ static int get_link_ksettings(struct net_device *dev,
 static int set_link_ksettings(struct net_device *dev,
                            const struct ethtool_link_ksettings *link_ksettings)
 {
-       const struct ethtool_link_settings_hdr *base = &link_ksettings->base;
        struct port_info *pi = netdev_priv(dev);
        struct link_config *lc = &pi->link_cfg;
+       const struct ethtool_link_settings *base = &link_ksettings->base;
        struct link_config old_lc;
        unsigned int fw_caps;
        int ret = 0;
index 61d08547e3f916bf7305cd980a8da2b81af9d502..2fbe0f059a0bffffe36324c859c46d639c6766f4 100644 (file)
@@ -1436,8 +1436,8 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
 static int cxgb4vf_get_link_ksettings(struct net_device *dev,
                                  struct ethtool_link_ksettings *link_ksettings)
 {
-       struct ethtool_link_settings_hdr *base = &link_ksettings->base;
        struct port_info *pi = netdev_priv(dev);
+       struct ethtool_link_settings *base = &link_ksettings->base;
 
        /* For the nonce, the Firmware doesn't send up Port State changes
         * when the Virtual Interface attached to the Port is down.  So
index 95b071153fedab96764eb678bf6662eb844f4dfa..d607b4f0542ceaef09e9528a591ca27177986143 100644 (file)
@@ -129,8 +129,8 @@ static void enic_intr_coal_set_rx(struct enic *enic, u32 timer)
 static int enic_get_ksettings(struct net_device *netdev,
                              struct ethtool_link_ksettings *ecmd)
 {
-       struct ethtool_link_settings_hdr *base = &ecmd->base;
        struct enic *enic = netdev_priv(netdev);
+       struct ethtool_link_settings *base = &ecmd->base;
 
        ethtool_link_ksettings_add_link_mode(ecmd, supported,
                                             10000baseT_Full);
index c553da16d4b1df6263b7d52308c610f6268d543c..e50e1df0a433e46dc1a772fc65348215b02759db 100644 (file)
@@ -504,7 +504,7 @@ static int qede_get_link_ksettings(struct net_device *dev,
                                   struct ethtool_link_ksettings *cmd)
 {
        typeof(cmd->link_modes) *link_modes = &cmd->link_modes;
-       struct ethtool_link_settings_hdr *base = &cmd->base;
+       struct ethtool_link_settings *base = &cmd->base;
        struct qede_dev *edev = netdev_priv(dev);
        struct qed_link_output current_link;
 
@@ -537,7 +537,7 @@ static int qede_get_link_ksettings(struct net_device *dev,
 static int qede_set_link_ksettings(struct net_device *dev,
                                   const struct ethtool_link_ksettings *cmd)
 {
-       const struct ethtool_link_settings_hdr *base = &cmd->base;
+       const struct ethtool_link_settings *base = &cmd->base;
        const struct ethtool_forced_speed_map *map;
        struct qede_dev *edev = netdev_priv(dev);
        struct qed_link_output current_link;
index 299280c94d070ef3cb6446ec0a1e871911c5a2e2..b8b935b526033f578a3cd8ad22cc0b600fda60e4 100644 (file)
@@ -211,7 +211,7 @@ void ethtool_rxfh_context_lost(struct net_device *dev, u32 context_id);
  * fields, but they are allowed to overwrite them (will be ignored).
  */
 struct ethtool_link_ksettings {
-       struct ethtool_link_settings_hdr base;
+       struct ethtool_link_settings base;
        struct {
                __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
                __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
index d86399bcf223ad9c8f1794a587927811d92175fe..61df8ce44379de8ba54c9818eec6c35c7fe80a48 100644 (file)
@@ -425,7 +425,7 @@ convert_link_ksettings_to_legacy_settings(
 
 /* layout of the struct passed from/to userland */
 struct ethtool_link_usettings {
-       struct ethtool_link_settings_hdr base;
+       struct ethtool_link_settings base;
        struct {
                __u32 supported[__ETHTOOL_LINK_MODE_MASK_NU32];
                __u32 advertising[__ETHTOOL_LINK_MODE_MASK_NU32];
index 2d5bc57160bed42a2fb09feb16bfe1e6031ded47..30b8ce2751594ebdb49c1ebc80e3c7674795ce2a 100644 (file)
@@ -8,9 +8,9 @@ struct linkinfo_req_info {
 };
 
 struct linkinfo_reply_data {
-       struct ethnl_reply_data                 base;
-       struct ethtool_link_ksettings           ksettings;
-       struct ethtool_link_settings_hdr        *lsettings;
+       struct ethnl_reply_data         base;
+       struct ethtool_link_ksettings   ksettings;
+       struct ethtool_link_settings    *lsettings;
 };
 
 #define LINKINFO_REPDATA(__reply_base) \
@@ -98,7 +98,7 @@ static int
 ethnl_set_linkinfo(struct ethnl_req_info *req_info, struct genl_info *info)
 {
        struct ethtool_link_ksettings ksettings = {};
-       struct ethtool_link_settings_hdr *lsettings;
+       struct ethtool_link_settings *lsettings;
        struct net_device *dev = req_info->dev;
        struct nlattr **tb = info->attrs;
        bool mod = false;
index 17e49cf89f03cd7ae192320569896f4e174a1c54..259cd9ef1f2a1c1f5d0cb2d7d1d5d34bda42ebbf 100644 (file)
@@ -11,10 +11,10 @@ struct linkmodes_req_info {
 };
 
 struct linkmodes_reply_data {
-       struct ethnl_reply_data                 base;
-       struct ethtool_link_ksettings           ksettings;
-       struct ethtool_link_settings_hdr        *lsettings;
-       bool                                    peer_empty;
+       struct ethnl_reply_data         base;
+       struct ethtool_link_ksettings   ksettings;
+       struct ethtool_link_settings    *lsettings;
+       bool                            peer_empty;
 };
 
 #define LINKMODES_REPDATA(__reply_base) \
@@ -62,12 +62,10 @@ static int linkmodes_reply_size(const struct ethnl_req_info *req_base,
 {
        const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
        const struct ethtool_link_ksettings *ksettings = &data->ksettings;
+       const struct ethtool_link_settings *lsettings = &ksettings->base;
        bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
-       const struct ethtool_link_settings_hdr *lsettings;
        int len, ret;
 
-       lsettings = &ksettings->base;
-
        len = nla_total_size(sizeof(u8)) /* LINKMODES_AUTONEG */
                + nla_total_size(sizeof(u32)) /* LINKMODES_SPEED */
                + nla_total_size(sizeof(u32)) /* LINKMODES_LANES */
@@ -105,12 +103,10 @@ static int linkmodes_fill_reply(struct sk_buff *skb,
 {
        const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
        const struct ethtool_link_ksettings *ksettings = &data->ksettings;
+       const struct ethtool_link_settings *lsettings = &ksettings->base;
        bool compact = req_base->flags & ETHTOOL_FLAG_COMPACT_BITSETS;
-       const struct ethtool_link_settings_hdr *lsettings;
        int ret;
 
-       lsettings = &ksettings->base;
-
        if (nla_put_u8(skb, ETHTOOL_A_LINKMODES_AUTONEG, lsettings->autoneg))
                return -EMSGSIZE;
 
@@ -241,7 +237,7 @@ static int ethnl_update_linkmodes(struct genl_info *info, struct nlattr **tb,
                                  struct ethtool_link_ksettings *ksettings,
                                  bool *mod, const struct net_device *dev)
 {
-       struct ethtool_link_settings_hdr *lsettings = &ksettings->base;
+       struct ethtool_link_settings *lsettings = &ksettings->base;
        bool req_speed, req_lanes, req_duplex;
        const struct nlattr *master_slave_cfg, *lanes_cfg;
        int ret;