From patchwork Mon Jul 29 20:07:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13745653 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 8FA9C84D02; Mon, 29 Jul 2024 20:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722283646; cv=none; b=bhtYUMUXIIxSTT/HJ0ikA9ufIQZWJDB/qwtSVee6Mp4NE/EfNpNembSRO4VkZ5+51D3nwukPw+rawLDonISilO2+MLdHjSgx/Xtt0mQktwm+WElVnJw4743KJ9aLawX2WLzAlv7p3gADVdJzzLZc7AuCpYkbl4GjhJPlO/R64O8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722283646; c=relaxed/simple; bh=iNn0PtDLZyYks73jrKoaCX4Kn/S4WXPffBJBm0F3Od4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KGjLvMTkh8vP+NSfMf6zExPIB61cba+K/30Oqp5Gx3FQqHWoSuCKt6IJ2/XGNouvy/acxPVMp4iQiNjvRwj83MYN2qvzYEQdrGtPWE6auDwhXaAWh7TW9bYdO5L1CD5kwmivB4UX4udlhsWNXmY41GCXT2x95piWyKFkMKQqZGw= 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=TEzaYttb; arc=none smtp.client-ip=198.175.65.15 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="TEzaYttb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722283644; x=1753819644; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iNn0PtDLZyYks73jrKoaCX4Kn/S4WXPffBJBm0F3Od4=; b=TEzaYttbOLQKehPzJKO6GUqepcp/OZFaoUpbw+heGu8OPxJnVv28GXtv WfyF4RD8QDKxr1VjJtaHekn0uN4Qtg6ZOmPrgXGN7j0Oky/7RYJuJxMLc XRshRuGT/xLLdJlBafw4tTdt5QnNxZEjS5vsUDOE8aQN+xCBOepd9r5OT QK+2RHtStIsegXxU4Yn+rDh0NUa+FMFFN12wmJyKrT0/IQ8l806icv/HQ NKluWk+nfclvY5jqbHZ5PSa+ZOiajKfjxvTz717FVEslYCs9j9uCLgw21 fGv/8hJn6gcOQJLG/KWJZD7JPj/fcKVBn2UJW35Sjgw9E9F68dcYJU7w/ g==; X-CSE-ConnectionGUID: dxiSkjmvTq6M7xozdX98kQ== X-CSE-MsgGUID: HiRKAWq+QAOkdvDC0M6N+w== X-IronPort-AV: E=McAfee;i="6700,10204,11148"; a="23818497" X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="23818497" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2024 13:07:22 -0700 X-CSE-ConnectionGUID: AcWge2VlRHWXhcLCfz4wVw== X-CSE-MsgGUID: zBMHTXVrSkau9n9nrlAn6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="54681278" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa007.jf.intel.com with ESMTP; 29 Jul 2024 13:07:23 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Michal Kubiak , anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com, magnus.karlsson@intel.com, aleksander.lobakin@intel.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, bpf@vger.kernel.org, Shannon Nelson , Chandan Kumar Rout Subject: [PATCH net v2 1/8] ice: respect netif readiness in AF_XDP ZC related ndo's Date: Mon, 29 Jul 2024 13:07:07 -0700 Message-ID: <20240729200716.681496-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240729200716.681496-1-anthony.l.nguyen@intel.com> References: <20240729200716.681496-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: bpf@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 Signed-off-by: Tony Nguyen --- 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 a65955eb23c0..72738b8b8a68 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))