All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rafael Castillo <rafaelcl@google.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
	 Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	intel-wired-lan@lists.osuosl.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Eric Dumazet <edumazet@kernel.org>,
	David Decotigny <decot@google.com>,
	 Madhu Chittim <madhu.chittim@intel.com>,
	Emil Tantilov <emil.s.tantilov@intel.com>,
	 Sridhar Samudrala <sridhar.samudrala@intel.com>,
	Brian Vazquez <brianvv@google.com>,  Li Li <boolli@google.com>,
	Naman Gulati <namangulati@google.com>,
	 Rafael Castillo <rafaelcl@google.com>
Subject: [PATCH iwl-net] idpf: check vport state instead of link_up in hwtstamp get/set
Date: Sat, 14 Nov 2026 01:55:48 +0000	[thread overview]
Message-ID: <20261114015548.42376-1-rafaelcl@google.com> (raw)

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 <rafaelcl@google.com>
---
 drivers/net/ethernet/intel/idpf/idpf_lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index 523c0e0be884..bfe08f5f74a7 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -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;
 	}
-- 
2.56.0.611.g1030f0b940-goog


                 reply	other threads:[~2026-11-16 16:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261114015548.42376-1-rafaelcl@google.com \
    --to=rafaelcl@google.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=boolli@google.com \
    --cc=brianvv@google.com \
    --cc=davem@davemloft.net \
    --cc=decot@google.com \
    --cc=edumazet@kernel.org \
    --cc=emil.s.tantilov@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=madhu.chittim@intel.com \
    --cc=namangulati@google.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sridhar.samudrala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.