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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 BA746C27C54 for ; Tue, 4 Jun 2024 13:22:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6E73E61202; Tue, 4 Jun 2024 13:22:15 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UxjbQ1YWjc7S; Tue, 4 Jun 2024 13:22:14 +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 smtp3.osuosl.org A2CBD61238 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717507334; bh=cFHeUIviL7JGgLKR24jcKh6XpvHJKA/ZrVmujZ1W2IY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Tgs5oKVwY6aQ1X5aOqk60THIBEjbEcWRa2S4kV2tIc4/PgmdEvc1K838AWG0Srupd 8tIlOCTC4030M6bkcrhTN/RyXAxA3Dmnh2PIldCOD+3K3OUBUZQFxsFGU4bglu3vlp n8MsSAeoXUUWFJKYMcONLZNp3zf6c08ZIRgO9aVF+pV09RrbWW1hR0U2j28dpBfN1g dAHoDS3TyhUcbijSaiCmI3f4VXEFWZYQV6MFx12foTiM2qUKN4vTMFHr4eLRLg90Vb p0PdpMMZawNuDmEXtAa0cHvTxWFdivSms3rw/+kH1L0h/geLqH0D1ZMDqQEh/cS1xe CEa5h8vVlx35w== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id A2CBD61238; Tue, 4 Jun 2024 13:22:14 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 8AB4C1BF2A2 for ; Tue, 4 Jun 2024 13:22:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 84190404DF for ; Tue, 4 Jun 2024 13:22:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RyGqBoa7XqUn for ; Tue, 4 Jun 2024 13:22:11 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.10; helo=mgamail.intel.com; envelope-from=maciej.fijalkowski@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B198D404B4 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B198D404B4 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by smtp2.osuosl.org (Postfix) with ESMTPS id B198D404B4 for ; Tue, 4 Jun 2024 13:22:11 +0000 (UTC) X-CSE-ConnectionGUID: 025BGZGWTHKe+XO2JGs1uw== X-CSE-MsgGUID: I1LYpnVVQvuukYcZgWpE2Q== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="31552842" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="31552842" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 06:22:11 -0700 X-CSE-ConnectionGUID: c4e0qQ4oQiG2D6qtWrNGWg== X-CSE-MsgGUID: z/jI2l2iQ4SuuKeh4o7kZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="37350114" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmviesa009.fm.intel.com with ESMTP; 04 Jun 2024 06:22:09 -0700 From: Maciej Fijalkowski To: intel-wired-lan@lists.osuosl.org Date: Tue, 4 Jun 2024 15:21:48 +0200 Message-Id: <20240604132155.3573752-2-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240604132155.3573752-1-maciej.fijalkowski@intel.com> References: <20240604132155.3573752-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=1717507331; x=1749043331; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U1j7CNF4LcH2zPcjK6TZP8rlhAMj+XXPcs1ymrObjjw=; b=lShLOXQoXWIGLNl3O0mvAXinSGdIjBQAXONoGRUogFaxxVrNuwqkVIlV Q00VedD4/dEMn53LkrKQSauawif+Ce3b4JJDwLIGK7s4p8eP85rVNpkA1 4fhq6ibBAcVRI0eU/cy+T4jM1906I6+Z2yT31J/H7bGbNJWnGgpgiWs7t U4idxa/o6vnIWwD/xBdWlXSAdUfC/XfqiLUQ7gWIik6AbPSdmiSV8jE1P pTbEQo+r6uG20Tqe5nsXIQFiGN0tbhZy8m9IMWRrdc+9fwGTR0KM8Klfx MSEBtR3//uVH2iG+SrUBe9gkjaBx37oMHoJY6EyGt0M2gLWYbL43QOBmO w==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=lShLOXQo Subject: [Intel-wired-lan] [PATCH v3 iwl-net 1/8] 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, jacob.e.keller@intel.com, Chandan Kumar Rout , magnus.karlsson@intel.com, Shannon Nelson 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") Reviewed-by: Shannon Nelson Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 A88F1146A83 for ; Tue, 4 Jun 2024 13:22:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717507333; cv=none; b=ZJr9al2vTakAfPKmMj1x56NB5mPlvMcVqRgDggNcqDRc0Gb4G00gHUKMFnJh24q9x1PW82OZFoe1APikOrN5Kugjg/C4jASkgw1J8m9/IU87d6w9px44zdF+qJfsVSpTymZgP/nfdM8LOoVondbd626kvjx63gnSSaVneQOXi9U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717507333; c=relaxed/simple; bh=U1j7CNF4LcH2zPcjK6TZP8rlhAMj+XXPcs1ymrObjjw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nhpXfpEjrzmmx4riiHPgRQO24khC4wrAiamgZUoWHA+01kqqUPeDTO6QIFmydXGy88t1t9DRQna5xIGF2BWWGAy6vhc6fV/YZVMabVNiAHpK6hoxAD5LssAH/meIrxjVdz7nje7t+g2htkpPYhDeyi5Fi2++xnG3rWRUB10cDSo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lShLOXQo; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lShLOXQo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717507331; x=1749043331; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U1j7CNF4LcH2zPcjK6TZP8rlhAMj+XXPcs1ymrObjjw=; b=lShLOXQoXWIGLNl3O0mvAXinSGdIjBQAXONoGRUogFaxxVrNuwqkVIlV Q00VedD4/dEMn53LkrKQSauawif+Ce3b4JJDwLIGK7s4p8eP85rVNpkA1 4fhq6ibBAcVRI0eU/cy+T4jM1906I6+Z2yT31J/H7bGbNJWnGgpgiWs7t U4idxa/o6vnIWwD/xBdWlXSAdUfC/XfqiLUQ7gWIik6AbPSdmiSV8jE1P pTbEQo+r6uG20Tqe5nsXIQFiGN0tbhZy8m9IMWRrdc+9fwGTR0KM8Klfx MSEBtR3//uVH2iG+SrUBe9gkjaBx37oMHoJY6EyGt0M2gLWYbL43QOBmO w==; X-CSE-ConnectionGUID: wxX+Kc6EQQG6ZXiLhNBmoQ== X-CSE-MsgGUID: KXO4cnK/SbSxnUUtg/rMRA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="31552843" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="31552843" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 06:22:11 -0700 X-CSE-ConnectionGUID: c4e0qQ4oQiG2D6qtWrNGWg== X-CSE-MsgGUID: z/jI2l2iQ4SuuKeh4o7kZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="37350114" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmviesa009.fm.intel.com with ESMTP; 04 Jun 2024 06:22:09 -0700 From: Maciej Fijalkowski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, magnus.karlsson@intel.com, michal.kubiak@intel.com, larysa.zaremba@intel.com, jacob.e.keller@intel.com, Shannon Nelson , Chandan Kumar Rout , Maciej Fijalkowski Subject: [PATCH v3 iwl-net 1/8] ice: respect netif readiness in AF_XDP ZC related ndo's Date: Tue, 4 Jun 2024 15:21:48 +0200 Message-Id: <20240604132155.3573752-2-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240604132155.3573752-1-maciej.fijalkowski@intel.com> References: <20240604132155.3573752-1-maciej.fijalkowski@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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") Reviewed-by: Shannon Nelson Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) 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