From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 76F3034CFB4; Wed, 3 Dec 2025 16:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764780287; cv=none; b=Mi7/sZo+uou6SrAjIoCWza63gLEzGe5c29s500EmY6mGHJC9vp1dUDI6udc2PoZl00IlddP+IvbkqGA6hoAdIFnTlrzHo2IqTM65317qX+4Xr9BWF4p+u7cfG4NVp/SbUkLMQi+cd5axDhPfzIXgTuhnbBcT6e9aSW0EPav9TTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764780287; c=relaxed/simple; bh=L4LycI8eBVhc49C5W0xmErJLM/9jNGOfOVdivWCV0Og=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L0aXO5+iSQvwfLNrYzxa9aFcl23x5Jkd/2rcAM7hn7GeBkwCVmXNnTUp1x7JGyB9Cp25yMiZqWPwCGFoksG8ZrJzOeDx9119h6DUfOzzsx1AkvuyMsJPDmRd966ou8JUuXJMSJQW9nA2X6p+z/JWomiPx5G2jDCoEOa/pJZjI9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Cx8nb4Md; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Cx8nb4Md" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D73E1C4CEF5; Wed, 3 Dec 2025 16:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764780287; bh=L4LycI8eBVhc49C5W0xmErJLM/9jNGOfOVdivWCV0Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cx8nb4MdkOc51jblXVF7P5/617pqmT4OTlysPpcmQwHk07OyQTq9Nzc33pA8zh4wi JcTuSJOh/mh/1STuiCd9W74Zz1fPLQKAJoImYmIkRqmQfCcN0rF5WUlWBfC81rP5o3 OBcb8qKSnKFkKBJOjwCNLcaGaZCSujeos0ZISACM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 6.1 494/568] can: gs_usb: gs_usb_xmit_callback(): fix handling of failed transmitted URBs Date: Wed, 3 Dec 2025 16:28:16 +0100 Message-ID: <20251203152458.808462268@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152440.645416925@linuxfoundation.org> References: <20251203152440.645416925@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Kleine-Budde [ Upstream commit 516a0cd1c03fa266bb67dd87940a209fd4e53ce7 ] The driver lacks the cleanup of failed transfers of URBs. This reduces the number of available URBs per error by 1. This leads to reduced performance and ultimately to a complete stop of the transmission. If the sending of a bulk URB fails do proper cleanup: - increase netdev stats - mark the echo_sbk as free - free the driver's context and do accounting - wake the send queue Closes: https://github.com/candle-usb/candleLight_fw/issues/187 Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices") Link: https://patch.msgid.link/20251114-gs_usb-fix-usb-callbacks-v1-1-a29b42eacada@pengutronix.de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/usb/gs_usb.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 2cacea6b00f80..7fe9d497491d1 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -707,8 +707,21 @@ static void gs_usb_xmit_callback(struct urb *urb) struct gs_can *dev = txc->dev; struct net_device *netdev = dev->netdev; - if (urb->status) - netdev_info(netdev, "usb xmit fail %u\n", txc->echo_id); + if (!urb->status) + return; + + if (urb->status != -ESHUTDOWN && net_ratelimit()) + netdev_info(netdev, "failed to xmit URB %u: %pe\n", + txc->echo_id, ERR_PTR(urb->status)); + + netdev->stats.tx_dropped++; + netdev->stats.tx_errors++; + + can_free_echo_skb(netdev, txc->echo_id, NULL); + gs_free_tx_context(txc); + atomic_dec(&dev->active_tx_urbs); + + netif_wake_queue(netdev); } static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, -- 2.51.0