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 CE3457E0E9; Wed, 7 Aug 2024 15:14:15 +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=1723043655; cv=none; b=piVGfWNKqS8cmKbhACYTuo4KHtFvMYfr8z9oNnCE6G6n00LKUsYYb3a2dD8pOBI+9HjTz7iCjVyPGhqi3v7EO01DanPgpW1k0M2iOOiYl0D3RYVECpinVeHEJgVOKBw/v0Yo1UXLjMISW/zw5WAXTfmT2yWAqJY6qbzXmfIIk5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723043655; c=relaxed/simple; bh=pXgVObKlFDa5lcznOzUZsF5b3L9Vhiyo/Q/7C3DSfVw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O9xzrX/PpPHAvNngDkuXFltFj0gtcatFxOegdR3a/oUzfigDRKiRJJMr8W+BuSkP6R2SAjM3dGksmFmj7t93DSmnsbmjIaq5YCAyp5gFXbyCUdMgcE9pJY/AY0O7qYw3NEDtQ9Nlj4nmr7fFzamxOsXBxFmbf3Z001Rq2yu2P3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EMbxW5aM; 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="EMbxW5aM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61785C32781; Wed, 7 Aug 2024 15:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723043655; bh=pXgVObKlFDa5lcznOzUZsF5b3L9Vhiyo/Q/7C3DSfVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMbxW5aM2xj08BXwxBUWOylZHTp99fEGo3HRJbmDgfSXr8SXhsKaR8++XSsHYKvP8 WLYNwRW3Istl41qryLCmMzMGlwJOhvbirsTOafVpibCXQ1W5RjuJpDfpnq/IWZPile ieluJi6WRTJlaiXAtB2/VeMe/58unBkH0TIGpHtw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shannon Nelson , Michal Kubiak , Maciej Fijalkowski , Tony Nguyen , Sasha Levin , Chandan Kumar Rout Subject: [PATCH 6.1 50/86] ice: respect netif readiness in AF_XDP ZC related ndos Date: Wed, 7 Aug 2024 17:00:29 +0200 Message-ID: <20240807150040.894074416@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240807150039.247123516@linuxfoundation.org> References: <20240807150039.247123516@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Michal Kubiak [ Upstream commit ec145a18687fec8dd97eeb4f30057fa4debef577 ] Address a scenario in which XSK ZC Tx produces descriptors to XDP Tx ring when link is either not yet fully initialized or process of stopping the netdev has already started. To avoid this, add checks against carrier readiness in ice_xsk_wakeup() and in ice_xmit_zc(). One could argue that bailing out early in ice_xsk_wakeup() would be sufficient but given the fact that we produce Tx descriptors on behalf of NAPI that is triggered for Rx traffic, the latter is also needed. Bringing link up is an asynchronous event executed within ice_service_task so even though interface has been brought up there is still a time frame where link is not yet ok. Without this patch, when AF_XDP ZC Tx is used simultaneously with stack Tx, Tx timeouts occur after going through link flap (admin brings interface down then up again). HW seem to be unable to transmit descriptor to the wire after HW tail register bump which in turn causes bit __QUEUE_STATE_STACK_XOFF to be set forever as netdev_tx_completed_queue() sees no cleaned bytes on the input. Fixes: 126cdfe1007a ("ice: xsk: Improve AF_XDP ZC Tx and use batching API") Fixes: 2d4238f55697 ("ice: Add support for AF_XDP") Reviewed-by: Shannon Nelson Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) Signed-off-by: Michal Kubiak Signed-off-by: Maciej Fijalkowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_xsk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index b917f271cdac1..61e4730bba59e 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -937,6 +937,10 @@ bool ice_xmit_zc(struct ice_tx_ring *xdp_ring) ice_clean_xdp_irq_zc(xdp_ring); + if (!netif_carrier_ok(xdp_ring->vsi->netdev) || + !netif_running(xdp_ring->vsi->netdev)) + return true; + budget = ICE_DESC_UNUSED(xdp_ring); budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring)); @@ -980,7 +984,7 @@ ice_xsk_wakeup(struct net_device *netdev, u32 queue_id, struct ice_vsi *vsi = np->vsi; struct ice_tx_ring *ring; - if (test_bit(ICE_VSI_DOWN, vsi->state)) + if (test_bit(ICE_VSI_DOWN, vsi->state) || !netif_carrier_ok(netdev)) return -ENETDOWN; if (!ice_is_xdp_ena_vsi(vsi)) -- 2.43.0