Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp961374lqo; Fri, 17 May 2024 06:58:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJ0BMBjX8P9SDdNoKOxQyblIE5RExYXRUNXVNi3Pq0DrBMyKRShvjIM69I5i+w8fO2hKGhrohKo32Y+we2fIFSCzT6GN2FZxq7mg/ffw== X-Google-Smtp-Source: AGHT+IFzksGQHQhALgnaxYDsqD8BfyOr024+SBY3v6K+Sknqe4PZ+E0OMbmhdiM1D8GCND7XV968 X-Received: by 2002:a05:6830:101a:b0:6f1:20c3:3356 with SMTP id 46e09a7af769-6f120c33466mr9954963a34.33.1715954310608; Fri, 17 May 2024 06:58:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715954310; cv=pass; d=google.com; s=arc-20160816; b=BbBktJF2osXMjMyBRdclRMKxPm8EyES75ctpqsRRMdTrx663SrrG+WO96ru+bTO1Gt InjLmQ2mNoGo+ddL/2CIrHEU6tocRKhz6PbrDua4IPSavD7tY4K6aXDsX6tMUkZzkrqt BZZ2gr1W6yDB6zAngb6OaMu2nUHsx+9WzeX0kRQaDA1xa7L9cCbPcPQ8MOe86epCG7Fl D0a4toEy6jAR3HkskPiQuW3CSFMdwpHzWLa1ACvfZbW8p0tQCiN680TS0SjPoPnGJ0pB 6N1b6Wt7WIYzgagkbii4maESOUZ7qkk6x2H/hF56RV6YSUKqFsPo1rIOwaHujAsOJMF+ zZsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=fTPxjmDGTDpcxFd/wjl4TcchhFDXRnvQhzYPDA8SjvU=; fh=9CIbX7pj5Br/7BfDzpuI4haaN2gezTicKGOuYshclmo=; b=BUsPa2o19JF4GFzYHFafxg71MblaT326nI0EExlAaeLmqsrwo1Qa4Vs5pImYYtCXX4 JvUVI18R+Oc5/GjKekTw6PbkrYGxwazCqXgQY/GezNqvF/TnRRHXzACpYE0xl44sC4dD Fsy6otfiBfzvL1bGe2xPj4SUZubUMjpGZICTZBKBWkGrMV5yuyeeE5J/FNVxbLpcvWUr zdYfygP9I55ineCmbtk1dft86/qfsPaBIRMVaKHIOpU3UoIdd+22eCs3PmWnzmJY6dZv f5nRlgOE4WWTYEESOotpKAnuc+NS1ZiUiFUOib2fPqaUWVSPWY5erUlqbspOdOr1GfaH XY9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=KB3cZuft; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-182167-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df549f67csi189229801cf.37.2024.05.17.06.58.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 06:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182167-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=KB3cZuft; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-182167-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EFD591C20A4B for ; Fri, 17 May 2024 13:58:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A067D56B60; Fri, 17 May 2024 13:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="KB3cZuft" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F09FB3B1AE; Fri, 17 May 2024 13:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715954301; cv=none; b=t8LlFNz+kZb2+Bl+1ako4umPB5f+EVA7/uDBKMK7MvxuKSdJ7IZXJVkpX7IvJj3ncyQBp2NOGXW5AlyceO7N+fcn67ljv9yfMgdTVRKrSexcdkTvULq4wYIOi+mupIoMDYkCoBbqxcC3PrD3UtrLopLA7hIKQfcAsa+BUiNRko0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715954301; c=relaxed/simple; bh=+dsbdBjhGrjm4WBAkfNNWSaDLuo2cRZvTPsNHLA+HzM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qsZgYdWxgu2fIaEKQ+vRs0+HRuUxRWeb+FnjGdQiT9pcD3ljuasJdsG2fl2SNUwoEMovepBYh+J1yK0keTDAKKolL5bIcfViDfB+SGB5GUYoV3I8cP9yT2WF5t6KtAunvmRlDOWNTPr117kcD7iFpkFtfWpa0q12eiuLNYz5oWk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=KB3cZuft; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1715954300; x=1747490300; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+dsbdBjhGrjm4WBAkfNNWSaDLuo2cRZvTPsNHLA+HzM=; b=KB3cZuftFQW/AdUrm3kFtkMbHGK0LoWT262YTfYYefJk9hcgDVE9QsMp tnddwFR1V8sXslRKW7ebrxo8cnCygsQmQ+ZntxnyY1qCxz1vpLX6GvCju isk8tC18MymYvwWTaRPTvyB7YmUT4t4CxnfsonxMAKIXC7eR9E3z5mJa5 U1FDj6oqkTB39jB+0UI3vA/nq1S/DmCAGnBOhfiUDYKi4rWRGcoFE8TDB mNjavp/lC9c5oUeMP1TmzhQLzMIEcCuyTJ41pvkpiJ3yazjMy6DLOUxQ9 aRYn402olCqBxJlUI0XfR2nmBOiihJxcFjjlJamJXnPVNr/eyUMN94M/G w==; X-CSE-ConnectionGUID: ufAfKQToSxqUayt+FPsL2A== X-CSE-MsgGUID: 27KVWmirSw2qpnX6nz50SQ== X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="25061077" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 May 2024 06:58:18 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 17 May 2024 06:58:15 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 17 May 2024 06:58:12 -0700 From: Horatiu Vultur To: , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net v2] net: lan966x: Remove ptp traps in case the ptp is not enabled. Date: Fri, 17 May 2024 15:58:08 +0200 Message-ID: <20240517135808.3025435-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Lan966x is adding ptp traps to redirect the ptp frames to the CPU such that the HW will not forward these frames anywhere. The issue is that in case ptp is not enabled and the timestamping source is et to HWTSTAMP_SOURCE_NETDEV then these traps would not be removed on the error path. Fix this by removing the traps in this case as they are not needed. Fixes: 54e1ed69c40a ("net: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()") Suggested-by: Vladimir Oltean Reviewed-by: Vladimir Oltean Signed-off-by: Horatiu Vultur --- v1->v2: - as suggested by Vladimir, add the check before programming the traps in the first place --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 2635ef8958c80..fbff37067ab78 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -474,14 +474,14 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev, cfg->source != HWTSTAMP_SOURCE_PHYLIB) return -EOPNOTSUPP; + if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp) + return -EOPNOTSUPP; + err = lan966x_ptp_setup_traps(port, cfg); if (err) return err; if (cfg->source == HWTSTAMP_SOURCE_NETDEV) { - if (!port->lan966x->ptp) - return -EOPNOTSUPP; - err = lan966x_ptp_hwtstamp_set(port, cfg, extack); if (err) { lan966x_ptp_del_traps(port); -- 2.34.1