idpf: check vport state instead of link_up in hwtstamp get/set
Subsystems (2)
PATCH 1/1 idpf: check vport state instead of link_up in hwtstamp get/set
vport->link_up is cleared on vport stop and only restored asynchronously when the Control Plane delivers VIRTCHNL2_EVENT_LINK_CHANGE, causing SIOCSHWTSTAMP and SIOCGHWTSTAMP to fail with -EPERM right after open or soft reset or while physical link is down. Check test_bit(IDPF_VPORT_UP, np->state) instead so hardware timestamping can be queried and configured whenever the vport is administratively up.
Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")
Signed-off-by Rafael Castillo <[email protected]>
--- drivers/net/ethernet/intel/idpf/idpf_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_lib.c +4 -2
@@ -2598,13 +2598,14 @@ static int idpf_hwtstamp_set(struct net_device *netdev,struct kernel_hwtstamp_config *config, struct netlink_ext_ack *extack) { + struct idpf_netdev_priv *np = netdev_priv(netdev);struct idpf_vport *vport;int err;idpf_vport_ctrl_lock (netdev); vport =idpf_netdev_to_vport (netdev); -if (!vport->link_up) { +if (!test_bit (IDPF_VPORT_UP , np->state)) {idpf_vport_ctrl_unlock (netdev);return -EPERM ; }
@@ -2625,12 +2626,13 @@ static int idpf_hwtstamp_set(struct net_device *netdev,static int idpf_hwtstamp_get (struct net_device *netdev,struct kernel_hwtstamp_config *config) { +struct idpf_netdev_priv *np =netdev_priv (netdev);struct idpf_vport *vport;idpf_vport_ctrl_lock (netdev); vport =idpf_netdev_to_vport (netdev); -if (!vport->link_up) { +if (!test_bit (IDPF_VPORT_UP , np->state)) {idpf_vport_ctrl_unlock (netdev);return -EPERM ; }
Signature · 1 line
2.56.0.611.g1030f0b940-goog