From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 549C6C25B78 for ; Tue, 28 May 2024 13:15:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1F78282013; Tue, 28 May 2024 13:15:36 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TxJ615oA-gE4; Tue, 28 May 2024 13:15:34 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5CB4D81FDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1716902134; bh=rtPBtzp6NmbBY+ZLKkmwvyGGGxVJEfuueSxrH4x6Uf8=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=umCLzM4G29zGN4L6s1jmwinGOJJhMQf3vxeslHWknVwEM/oyMqWnE/tgdJkplNIrx dWsNx3YrmFDnS7ribl4HuN3Bo4K1w31NrSDaxQcKvytSZp7XIviTifM1fzE049lfYh e1jCpMpbFISf1jVbvu546L53Yo5aYU8CR7KfhS3wYQVTqa1Sq2Vsm2/n0RNTJC+TON TdmP/LnBiItc4R6bE0jHxlIQKfhr5yVbl3YJSjfn39C5mdTnOj1BQ7TSk4Z6IgOnO6 DkQDwlpa3/Vk1FeiPRR360yYVM3vYQm+R3L2ojXK7CvCp1l3RZj5CgaQHU/g/0jKBX rGn6KrKwsBQxw== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 5CB4D81FDE; Tue, 28 May 2024 13:15:34 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1B8E01D281D for ; Tue, 28 May 2024 13:15:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 141BD82011 for ; Tue, 28 May 2024 13:15:32 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id jsiPWvJbQmuc for ; Tue, 28 May 2024 13:15:31 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.21; helo=mgamail.intel.com; envelope-from=maciej.fijalkowski@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 4D02881FD7 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4D02881FD7 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4D02881FD7 for ; Tue, 28 May 2024 13:15:30 +0000 (UTC) X-CSE-ConnectionGUID: b55ztvvdSuejOJWnY1jpfw== X-CSE-MsgGUID: asKm32rxSZegQ5NrTlbBgA== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="13193526" X-IronPort-AV: E=Sophos;i="6.08,195,1712646000"; d="scan'208";a="13193526" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 06:15:31 -0700 X-CSE-ConnectionGUID: snxPHJpoRPO3MbU5aeH8Fw== X-CSE-MsgGUID: 9LakitMJS7+V6bWMmQfCHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,195,1712646000"; d="scan'208";a="39891105" Received: from boxer.igk.intel.com ([10.102.20.173]) by orviesa003.jf.intel.com with ESMTP; 28 May 2024 06:15:29 -0700 From: Maciej Fijalkowski To: intel-wired-lan@lists.osuosl.org Date: Tue, 28 May 2024 15:14:19 +0200 Message-Id: <20240528131429.3012910-2-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240528131429.3012910-1-maciej.fijalkowski@intel.com> References: <20240528131429.3012910-1-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716902132; x=1748438132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ROb1fNo4eUUBVPk/vZTtKWpVQ5tdIGh5tR00KpxWySo=; b=ANrHbWwPWHQ7pB8P/LD48x8UO9PzCpLt2i6ce7COXuKe7LVVqIP7n0ij 5j/FP8SkK5WGDps8gnQ4Xurk2LcFhTbtXUEg/hyfSzz3JorjkcHmHymlo XuwfLVylhz0UT61fdIDxpSw4enCMz73BkzhpwOAxMr8ncNVhxQefrj6WM aWMPTCifpcrdR/YilmJiwolGQ9gf6MmMKnoaPvb3vQcoEL7NqYO2qJO7K RmnVb+1Ka/Z38NOpgx/pzVzVz/WKcKy1fRKEfEimSJXBMML9lCaRbgdWX 6xMa+Vcp5q7PygqvaKor5wK7x/uEd9pNqEslxWHRVLAtIah48jtniDwwk w==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ANrHbWwP Subject: [Intel-wired-lan] [PATCH iwl-net 01/11] ice: respect netif readiness in AF_XDP ZC related ndo's X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maciej Fijalkowski , larysa.zaremba@intel.com, netdev@vger.kernel.org, michal.kubiak@intel.com, anthony.l.nguyen@intel.com, magnus.karlsson@intel.com Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Michal Kubiak 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") Signed-off-by: Michal Kubiak Signed-off-by: Maciej Fijalkowski --- 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 2015f66b0cf9..1bd4b054dd80 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -1048,6 +1048,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)); @@ -1091,7 +1095,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.34.1