From patchwork Tue Jun 4 13:21:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fijalkowski, Maciej" X-Patchwork-Id: 13685303 X-Patchwork-Delegate: kuba@kernel.org 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 X-Patchwork-Delegate: kuba@kernel.org 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))