From nobody Mon Feb 9 12:28:43 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 Reviewed-by: Vladimir Oltean --- 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 From nobody Mon Feb 9 12:28:43 2026 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 67CF33816F4 for ; Sun, 8 Feb 2026 22:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591371; cv=none; b=lr6An6iUU1iPuMsMjoPj4QBTCac6VYMuVwrxUhweCEcD8QBTG5CWOJt0gtsbC30HZO1dr/n0HTa4rOywEjgJdZ9Frl0Em9ndz2XoxWJdOg+9MtswtEbQmW2yTDixXKLeJNZRgpjXZtS2AnSySEL9poiBN7JWAJvZgsVLVJ+TbIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591371; c=relaxed/simple; bh=gxDkdnVAO6y54w+N+kQlH2pPvGHccqes7EFBl713Y8g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Hafv1IoTKCUYFKZp51QtKZVils7CIopdU5R9wlZb0L8IFL9xeuWJJ0K1JYjwx+yR0PwO2uWGJjN7GPs6rqZrh1t+cSsmhdkWntGdxp1jtgf1FjJPXLgbKG0gvXeKBNM89fLrU82jBqLODA5fO76EGLTVoK49iyAD6ipj0itJLAU= 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=qw7fmFGI; arc=none smtp.client-ip=209.85.222.178 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="qw7fmFGI" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-8c6a0702b86so365169885a.0 for ; Sun, 08 Feb 2026 14:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770591370; x=1771196170; 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=RnjPU7xCzjMHF4Wlfjb1OOwJlHU37KjHOMIV04vFqVA=; b=qw7fmFGI/B35gvy2qV0wtnRgJ+5BJQSRFlNG9Lov2nkQ7ammP5Jm2PUBWsfmD1xYCH MXQptgt07fHFtiRGfiT6Ay5NNVqu/G5ih/ex1GfaoyrG/93PJaXs+MQrPZ0luIAYq8tV BCvY8e9Hf6mySiD/1rQf33sXHUodyqGPWIS9Hr8dzOgTnAipqUO+83kXP3eduPgyEw1A iNUDFadniKTd9GMhWWHnYBdNPfa7PzpEuaSZ+g1Kr/SkkbAZdwz8A8M7kP9MVk29gPBg +5xNSwKz6yjpV40UjvlADycOHy6lbAPvG9tXcAP17OFY6RkDrFBn3EkIZE5JaxK2qWQG qr3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770591370; x=1771196170; 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=RnjPU7xCzjMHF4Wlfjb1OOwJlHU37KjHOMIV04vFqVA=; b=Wp/33pUuUK7TJbp93Y5b3lCfBZywdMFN+SsakG6i6NzJeRFPIM+DAvVtQl8mhSZJBY t6o9NsNnzYuNlb9PfDXuPHBVAPXQx1eD+bMJohUKmrXQSNXr5HmZjKqqApyzl3giTzpk UZbS19q2P8pjbqSB1GJ0Y/LiF0YQ3teUQLXyhQsv6mqw2AA0s6iL8IeLZwoj89F2sS5d oMAt1Ny1g3bhIus+Ddwyt0dB7HArmzIZO8hHRMqSRvzcc+YPj7ZedKBnL+kQrQ+hZu9+ WcXebUPLhR39f6Jznl42hHsUNb80vNUE92lT/nkS5FI1s4ZyWYb1FZShw3pqLevvhVal Nlug== X-Forwarded-Encrypted: i=1; AJvYcCWWmkkZQHndP07H29BJQL55wo1PVDXWg/ZqZe816UUZiPGZiYAC2FQxKz0vDpmg+J1u4KOxfAsvIkmFZV0=@vger.kernel.org X-Gm-Message-State: AOJu0YxFnhEBvwyc8Tt3d5ftmBTmLcp5tFFZhClMBD9MKJWO5qlIu7Gt 2MiQ9ojFDn0vDvhbcsPDozn6zOufhg6yH1jUMHW0w5pYyhCDtBIPbZEPitN0ZEvz+I8= X-Gm-Gg: AZuq6aIhAAXwH88RW6JMaIZlEkoNroF3TmtqCzLX6mLE8eOvWHt053vvOwwGrTTZZvw LM3Dkqwb6YL6gXHjIP9r42i/g0OeGjW7wIAqAFcYzfE20GROBOUIPqZDzSlxueYYD4WlZaMO7U1 ZdtNWd5tTX3V/I9ap70+t06BuA5byaccXqjxQ0woe9TErgrIUbIWOChonaK37471u4fj54R8fN4 25qwan4f9cFaBhohSxzn391UR2JopyaimzZiLqPKpQ4xA5xwN9CPxolpeHz8AxryiCowbCCR2NQ 6qedcVs6zYpCgVsJsn3QxuTF2aT6aZyYYBVVmGDPJkRiDMKfpz8+I30Lgqv6sQCe3etTn1mqW8v fBBKpA/WjWJsSJ6dO9tisqTBXlGsQBi2lgj8FCSrUL0XkixOI8klMZyMhv4HM7kZa1XEPXciRTL +uo+Wr653OoPc70YAEkdaAl0WZZm7rts4sCyiizCvZZgRX7RKWufkmX96H2DPg2WJncSIppMbm7 NuBxwtXHXlKYIRXwqreivwbR+rcp1s= X-Received: by 2002:a05:620a:4142:b0:8c7:fdc:e853 with SMTP id af79cd13be357-8caeee3411cmr1221080485a.1.1770591370334; Sun, 08 Feb 2026 14:56:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 14:56:10 -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 2/3] net: mscc: ocelot: split xmit into FDMA and register injection paths Date: Sun, 8 Feb 2026 22:56:01 +0000 Message-Id: <20260208225602.1339325-3-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" Split ocelot_port_xmit() into two separate functions: - ocelot_port_xmit_fdma(): handles the FDMA injection path - ocelot_port_xmit_inj(): handles the register-based injection path The top-level ocelot_port_xmit() now dispatches to the appropriate function based on the ocelot_fdma_enabled static key. This is a pure refactor with no behavioral change. Separating the two code paths makes each one simpler and prepares for adding proper locking to the register injection path without affecting the FDMA path. Signed-off-by: Ziyi Guo Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_net.c | 39 ++++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index ef4a6c768de9..d6b0936beca2 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -571,7 +571,25 @@ static bool ocelot_xmit_timestamp(struct ocelot *ocelo= t, int port, return true; } =20 -static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device= *dev) +static netdev_tx_t ocelot_port_xmit_fdma(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 (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) + return NETDEV_TX_OK; + + ocelot_fdma_inject_frame(ocelot, port, rew_op, skb, dev); + + return NETDEV_TX_OK; +} + +static netdev_tx_t ocelot_port_xmit_inj(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; @@ -579,24 +597,27 @@ static netdev_tx_t ocelot_port_xmit(struct sk_buff *s= kb, struct net_device *dev) int port =3D priv->port.index; u32 rew_op =3D 0; =20 - if (!static_branch_unlikely(&ocelot_fdma_enabled) && - !ocelot_can_inject(ocelot, 0)) + if (!ocelot_can_inject(ocelot, 0)) return NETDEV_TX_BUSY; =20 if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) return NETDEV_TX_OK; =20 - if (static_branch_unlikely(&ocelot_fdma_enabled)) { - ocelot_fdma_inject_frame(ocelot, port, rew_op, skb, dev); - } else { - ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); + ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); =20 - consume_skb(skb); - } + consume_skb(skb); =20 return NETDEV_TX_OK; } =20 +static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device= *dev) +{ + if (static_branch_unlikely(&ocelot_fdma_enabled)) + return ocelot_port_xmit_fdma(skb, dev); + + return ocelot_port_xmit_inj(skb, dev); +} + enum ocelot_action_type { OCELOT_MACT_LEARN, OCELOT_MACT_FORGET, --=20 2.34.1 From nobody Mon Feb 9 12:28:43 2026 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 EA38C303A15 for ; Sun, 8 Feb 2026 22:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591375; cv=none; b=ryDHb7zmiA5OIuXHjanyS/AnnjWiWAvDhEM1uya7HTJtEIZInEVZeaLaqSVQsftTmqSdGAFELaZTOFVGU8ofeoW46BrW0GVMY3MTo1VqfInYMSy+M8Pd08FYRrJtupSCXn8gnnmyXm9cm1cNb16CVgwng/4EIpLjRh4pQtRRckM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591375; c=relaxed/simple; bh=s8VGpGMSGaZ2+p5mTzzQyysE0AJW/x8r5xi6k/4c5gI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=agToPY24hW2sY4pIyMcPn+ea/TKa4efyjhh6F0mbZZ5VUmq0aZujUlOdhwMB8Deeh5DY7IbkhLWtgjtqPWbCECgGzsJAbJUgcKBDP2eYUASR01J5Le6W6ccw6QMy40NxiUOKLogWi2meAUC/gLfCMqCABnCf0yXhyA27I56A/rE= 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=bWHPh5Oh; arc=none smtp.client-ip=209.85.222.179 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="bWHPh5Oh" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-8ca01dc7d40so413055885a.1 for ; Sun, 08 Feb 2026 14:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770591374; x=1771196174; 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=RsIvHDz2axLyTXF6o/p1gIQLrDHj0fdiTLIqaKocJCQ=; b=bWHPh5Ohn9PgORxTg3OTBVQK1BShO75ZjuRFk2hoJBJ6je749OxI28mZugXYsiuN5b 6cLFMq+SwmdN53hW2+PfSj388B4slEIeRbYhaYWpxV1IZ6ZtKx9XcyFf64MYelhRomyq LLrBMrNiNgaW7rPO0cK1a07YKLQ69JMRicXIeCSTuMiZkedRm4l6Kpz4Fw4Q7mGnqrJq ckn8i1VEqbWpnJQnn0CM7u7P4KC5S8WZ3tHrKNUinkrAraSu3qZjUsyL01pPiaaSFrXr Gg+FPZTgHP5W6yzVpwOy3R4wa+6PctvgOdYIVQBKIsJdqr1yzg0e3XmcBegPS+sz+yLd ZaOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770591374; x=1771196174; 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=RsIvHDz2axLyTXF6o/p1gIQLrDHj0fdiTLIqaKocJCQ=; b=hq5W9Q65R8ILdu+TqXwlji+xqlwusO6jH0Mm2Y8wQlgFA65EgcgAH3mBEkfm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PNo OUzp+Mxy5dmXmkm+0nKgihHmiI+dBM= X-Received: by 2002:a05:620a:458e:b0:8c6:de6f:898e with SMTP id af79cd13be357-8caefcca7d5mr1105942585a.9.1770591373816; Sun, 08 Feb 2026 14:56:13 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 14:56:13 -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 3/3] net: mscc: ocelot: add missing lock protection in ocelot_port_xmit_inj() Date: Sun, 8 Feb 2026 22:56:02 +0000 Message-Id: <20260208225602.1339325-4-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" ocelot_port_xmit_inj() calls ocelot_can_inject() and ocelot_port_inject_frame() without holding the injection group lock. Both functions contain lockdep_assert_held() for the injection lock, and the correct caller felix_port_deferred_xmit() properly acquires the lock using ocelot_lock_inj_grp() before calling these functions. Add ocelot_lock_inj_grp()/ocelot_unlock_inj_grp() around the register injection path to fix the missing lock protection. The FDMA path is not affected as it uses its own locking mechanism. Fixes: c5e12ac3beb0 ("net: mscc: ocelot: serialize access to the injection/= extraction groups") Signed-off-by: Ziyi Guo Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_net.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index d6b0936beca2..9fd8ac7e875c 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -597,14 +597,22 @@ static netdev_tx_t ocelot_port_xmit_inj(struct sk_buf= f *skb, int port =3D priv->port.index; u32 rew_op =3D 0; =20 - if (!ocelot_can_inject(ocelot, 0)) + ocelot_lock_inj_grp(ocelot, 0); + + if (!ocelot_can_inject(ocelot, 0)) { + ocelot_unlock_inj_grp(ocelot, 0); return NETDEV_TX_BUSY; + } =20 - if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) + if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) { + ocelot_unlock_inj_grp(ocelot, 0); return NETDEV_TX_OK; + } =20 ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); =20 + ocelot_unlock_inj_grp(ocelot, 0); + consume_skb(skb); =20 return NETDEV_TX_OK; --=20 2.34.1