From nobody Tue Feb 10 15:29:00 2026 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7C9A38171F for ; Sun, 8 Feb 2026 22:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591368; cv=none; b=QoA3jn/T3Ble4zFNeVDluoyXA8qaNs8WytKXLw00jPY9zWaMSFouWQMz58e4/xl1s8ElYy2ybPdaI9BLNlEvvv8kHiHdo0QRjRgIIcKigKlH3rbPtV/r89sxbjqD1OZQDdATsaoPRvP6qnJzkqrIo6CLxtnia0MFhfPICS1Gz3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591368; c=relaxed/simple; bh=YooQjcRgRjok2wwi3LDCK/dPDX0sm1zbY3S8Sb0XBvQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gZUpbH+Jc5fW4SubXaaKtsdFC3W93m+Dp9AMspvdG/Wij3shuflqPSUdMGficUa9rYka3HsLdPX4cqIf5eRPSjCpFpZ/E6P6iHuWpjgbGDq52DcVZg/mM1CNzKbwaEbs3xbJTwdVVGr8Yo4DV3vF+AyshppaqMLfB4f9nQHJp6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu; spf=pass smtp.mailfrom=u.northwestern.edu; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b=mz/VMTpO; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b="mz/VMTpO" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-8c7199e7f79so338120085a.0 for ; Sun, 08 Feb 2026 14:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770591368; x=1771196168; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y+1eFZR72lSiF0+tCPVl7Il+zloaNZIJ9PmkYReDnuE=; b=mz/VMTpOuqGu+Pcqo9z5OTOVLWf+rLC/CdtFOaoCAvQuRlPRDUD3/0KM3aVdu19Izk u4wuVeaHFTqJkPLK4kaXymWaWNddPJYjor6R9wE4aCXhugFhAdWfrv2mbaT27u/EtTV4 HsEad3yN0WNOSwR5wCbeKbid/iDLpGdmp2CiV+gcepY9qfVnCQEQvGUps59CYNoYG9ek XakLRuwYNU9CAjDe6LxHaCvCmAwGBjBxyOr44EuCKMMZONPQ1XNZecPxyt+U/cerqia5 jCdro40/XvLcEZw+CTQTxedaD/8IFnVQibkijntTGVzvgWT7es/sbYVi1NMENOtDqrdJ Iqew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770591368; x=1771196168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=y+1eFZR72lSiF0+tCPVl7Il+zloaNZIJ9PmkYReDnuE=; b=bUgFJ5B4pnSxuWXuzNEg0+1zcHDptm3Ngp4N3CXNTbwMcIoUc2tfezsaiwTYYkPiG4 3VpyS73/ZRrO9am5IQtG7D50pmfG8K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3704:b0:8c9:fb26:dc6e with SMTP id af79cd13be357-8caefcca4f2mr1261218385a.38.1770591367729; Sun, 08 Feb 2026 14:56:07 -0800 (PST) Received: from security.cs.northwestern.edu (security.cs.northwestern.edu. [165.124.184.136]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf9ee9efasm679622485a.43.2026.02.08.14.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 14:56:07 -0800 (PST) From: Ziyi Guo To: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni Cc: UNGLinuxDriver@microchip.com, Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ziyi Guo Subject: [PATCH v3 1/3] net: mscc: ocelot: extract ocelot_xmit_timestamp() helper Date: Sun, 8 Feb 2026 22:56:00 +0000 Message-Id: <20260208225602.1339325-2-n7l8m4@u.northwestern.edu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260208225602.1339325-1-n7l8m4@u.northwestern.edu> References: <20260208225602.1339325-1-n7l8m4@u.northwestern.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extract the PTP timestamp handling logic from ocelot_port_xmit() into a separate ocelot_xmit_timestamp() helper function. This is a pure refactor with no behavioral change. The helper returns false if the skb was consumed (freed) due to a timestamp request failure, and true if the caller should continue with frame injection. The rew_op value is returned via pointer. This prepares for splitting ocelot_port_xmit() into separate FDMA and register injection paths in a subsequent patch. Signed-off-by: Ziyi Guo --- drivers/net/ethernet/mscc/ocelot_net.c | 36 ++++++++++++++++---------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index 469784d3a1a6..ef4a6c768de9 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -551,33 +551,41 @@ static int ocelot_port_stop(struct net_device *dev) return 0; } =20 -static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device= *dev) +static bool ocelot_xmit_timestamp(struct ocelot *ocelot, int port, + struct sk_buff *skb, u32 *rew_op) { - struct ocelot_port_private *priv =3D netdev_priv(dev); - struct ocelot_port *ocelot_port =3D &priv->port; - struct ocelot *ocelot =3D ocelot_port->ocelot; - int port =3D priv->port.index; - u32 rew_op =3D 0; - - if (!static_branch_unlikely(&ocelot_fdma_enabled) && - !ocelot_can_inject(ocelot, 0)) - return NETDEV_TX_BUSY; - - /* Check if timestamping is needed */ if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { struct sk_buff *clone =3D NULL; =20 if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { kfree_skb(skb); - return NETDEV_TX_OK; + return false; } =20 if (clone) OCELOT_SKB_CB(skb)->clone =3D clone; =20 - rew_op =3D ocelot_ptp_rew_op(skb); + *rew_op =3D ocelot_ptp_rew_op(skb); } =20 + return true; +} + +static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device= *dev) +{ + struct ocelot_port_private *priv =3D netdev_priv(dev); + struct ocelot_port *ocelot_port =3D &priv->port; + struct ocelot *ocelot =3D ocelot_port->ocelot; + int port =3D priv->port.index; + u32 rew_op =3D 0; + + if (!static_branch_unlikely(&ocelot_fdma_enabled) && + !ocelot_can_inject(ocelot, 0)) + return NETDEV_TX_BUSY; + + if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) + return NETDEV_TX_OK; + if (static_branch_unlikely(&ocelot_fdma_enabled)) { ocelot_fdma_inject_frame(ocelot, port, rew_op, skb, dev); } else { --=20 2.34.1