[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200607160246.GD1022955@lunn.ch>
Date: Sun, 7 Jun 2020 18:02:46 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Amit Cohen <amitc@...lanox.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
corbet@....net, jiri@...lanox.com, idosch@...lanox.com,
shuah@...nel.org, mkubecek@...e.cz, gustavo@...eddedor.com,
cforno12@...ux.vnet.ibm.com, f.fainelli@...il.com,
linux@...pel-privat.de, alexandru.ardelean@...log.com,
ayal@...lanox.com, petrm@...lanox.com, mlxsw@...lanox.com,
liuhangbin@...il.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH net-next 04/10] ethtool: Add link extended state
> @@ -108,6 +131,12 @@ static int linkstate_reply_size(const struct ethnl_req_info *req_base,
> if (data->sqi_max != -EOPNOTSUPP)
> len += nla_total_size(sizeof(u32));
>
> + if (data->ext_state_provided)
> + len += sizeof(u8); /* LINKSTATE_EXT_STATE */
> +
> + if (data->ethtool_ext_state_info.__ext_substate)
> + len += sizeof(u8); /* LINKSTATE_EXT_SUBSTATE */
> +
This looks wrong. A u8 attribute takes up a lot more space than
sizeof(u8) because of the TLV overheads. That is what the
nla_total_size() is for.
Andrew
Powered by blists - more mailing lists