net: ethtool: mm: sanitize some UAPI configurations
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 18 Apr 2023 11:14:55 +0000 (14:14 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 21 Apr 2023 03:03:21 +0000 (20:03 -0700)
commit35b288d6e3d467f6f7bf466fee6184b275999f14
tree0715846cd3a23682f8cb36a09cf8e77d211375c9
parent16a2c7634442b48ff24177d04b7ce429840b102e
net: ethtool: mm: sanitize some UAPI configurations

The verify-enabled boolean (ETHTOOL_A_MM_VERIFY_ENABLED) was intended to
be a sub-setting of tx-enabled (ETHTOOL_A_MM_TX_ENABLED). IOW, MAC Merge
TX can be enabled with or without verification, but verification with TX
disabled makes no sense.

The pmac-enabled boolean (ETHTOOL_A_MM_PMAC_ENABLED) was intended to be
a global toggle from an API perspective, whereas tx-enabled just handles
the TX direction. IOW, the pMAC can be enabled with or without TX, but
it doesn't make sense to enable TX if the pMAC is not enabled.

Add two checks which sanitize and reject these invalid cases.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/mm.c