mlxsw: spectrum: Clear PTP configuration after unregistering the netdevice
authorAmit Cohen <amcohen@nvidia.com>
Fri, 12 Aug 2022 15:32:01 +0000 (17:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:40:24 +0000 (11:40 +0200)
commita44a1a14211df0e10ed4c322ea914fca192f58bf
treebbfeadb970c9ac9242ea65871d07618538c14025
parentdd236b62d25e44ecfa26b0910a12f8d8251aff00
mlxsw: spectrum: Clear PTP configuration after unregistering the netdevice

commit a159e986ad26d3f35c0157ac92760ba5e44e6785 upstream.

Currently as part of removing port, PTP API is called to clear the
existing configuration and set the 'rx_filter' and 'tx_type' to zero.
The clearing is done before unregistering the netdevice, which means that
there is a window of time in which the user can reconfigure PTP in the
port, and this configuration will not be cleared.

Reorder the operations, clear PTP configuration after unregistering the
netdevice.

Fixes: 8748642751ede ("mlxsw: spectrum: PTP: Support SIOCGHWTSTAMP, SIOCSHWTSTAMP ioctls")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c