From patchwork Mon Nov 25 23:58:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Hay X-Patchwork-Id: 13885370 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.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 94641195FEF for ; Mon, 25 Nov 2024 23:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732578715; cv=none; b=fPsOVOsYl6SZMOXJnNDX5WhY8SM9J+SU5MapdTNVGPM9KbORI+97G93ZRaSj/0MM/1TDfai7cd4OeMQsMsT9nXoHJT2aYHywiZ3OIkKfeyKldGfiJf1Sb4duD0jIXsPQ7aKQOoCc58LDk3kJl8fhHpeZrNAlcD546iirXWveEzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732578715; c=relaxed/simple; bh=oKmrbFBW91xqVYvbebB/vpZoCPgp9Bu1WvEqBD4XIfA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=abHBPtqInBlCzMMntevo4oT4GTvcLiiO3KNkGYsk1Vwn2qIn6sEnjwEj2mC5c3DB4IsO+728f9JUHtX+oIDYZ/dtf7BpogcowWhJqocFicM57C6eod9/eUL3WuFNNsnFqn0IOrgnw5RlyWPSe01vpW45iUNiFhbbXJJ5TdSVl8M= 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=hht2hV30; arc=none smtp.client-ip=192.198.163.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="hht2hV30" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732578714; x=1764114714; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oKmrbFBW91xqVYvbebB/vpZoCPgp9Bu1WvEqBD4XIfA=; b=hht2hV30sHHLJT39mlYFwWIkYNZnwvQACI5wdk+bfJgoopMhVBVFCsA6 eE6rnrgIPtAfJx5a8F+TbVb2fKc7q5DnUELZp7GAoRUttdPR9G5JjFI/0 ShY5eQdiy/70IdzmA9dXZE80EqJogy5Yp/JaU7vbsCAV5rZlhrJl0rzvg GpvymuNAOlxuSnHCiYeOkyjFoUHahjUcyPvGqRpjpuyqlFPGJ18CSxFN6 64KTILz2IJ+ICmTQqi49YOD7OsBlFZmTzLWu1q456slvd7oc25r2pySIp u5aEtrHHFH4giB2WYE4NU7/GbtoDZ3SsDhT/OS6sJBuZCBGXbHUfzwsjn g==; X-CSE-ConnectionGUID: L+3lT3KBQ5WD3p/c+QuVgQ== X-CSE-MsgGUID: 5aP4BbcNReW5J3c0xoTa9A== X-IronPort-AV: E=McAfee;i="6700,10204,11267"; a="44108299" X-IronPort-AV: E=Sophos;i="6.12,184,1728975600"; d="scan'208";a="44108299" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2024 15:51:53 -0800 X-CSE-ConnectionGUID: Mm8ohnSfRKKePUGUyfe13g== X-CSE-MsgGUID: gOhpcJkcQhiHzuofj0uFbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,184,1728975600"; d="scan'208";a="92239631" Received: from dcskidmo-m40.jf.intel.com ([10.166.241.13]) by orviesa008.jf.intel.com with ESMTP; 25 Nov 2024 15:51:53 -0800 From: Joshua Hay To: intel-wired-lan@lists.osuosl.org Cc: przemyslaw.kitszel@intel.com, michal.kubiak@intel.com, aleksander.lobakin@intel.com, madhu.chittim@intel.com, netdev@vger.kernel.org, Joshua Hay Subject: [Intel-wired-lan][PATCH iwl-net 2/2] idpf: trigger SW interrupt when exiting wb_on_itr mode Date: Mon, 25 Nov 2024 15:58:55 -0800 Message-Id: <20241125235855.64850-3-joshua.a.hay@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241125235855.64850-1-joshua.a.hay@intel.com> References: <20241125235855.64850-1-joshua.a.hay@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 There is a race condition between exiting wb_on_itr and completion write backs. For example, we are in wb_on_itr mode and a Tx completion is generated by HW, ready to be written back, as we are re-enabling interrupts: HW SW | | | | idpf_tx_splitq_clean_all | | napi_complete_done | | | tx_completion_wb | idpf_vport_intr_update_itr_ena_irq That tx_completion_wb happens before the vector is fully re-enabled. Continuing with this example, it is a UDP stream and the tx_completion_wb is the last one in the flow (there are no rx packets). Because the HW generated the completion before the interrupt is fully enabled, the HW will not fire the interrupt once the timer expires and the write back will not happen. NAPI poll won't be called. We have indicated we're back in interrupt mode but nothing else will trigger the interrupt. Therefore, the completion goes unprocessed, triggering a Tx timeout. To mitigate this, fire a SW triggered interrupt upon exiting wb_on_itr. This interrupt will catch the rogue completion and avoid the timeout. Add logic to set the appropriate bits in the vector's dyn_ctl register. Fixes: 9c4a27da0ecc ("idpf: enable WB_ON_ITR") Reviewed-by: Madhu Chittim Signed-off-by: Joshua Hay --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index a8989dd98272..9558b90469c8 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -3604,21 +3604,32 @@ static void idpf_vport_intr_dis_irq_all(struct idpf_vport *vport) /** * idpf_vport_intr_buildreg_itr - Enable default interrupt generation settings * @q_vector: pointer to q_vector - * @type: itr index - * @itr: itr value */ -static u32 idpf_vport_intr_buildreg_itr(struct idpf_q_vector *q_vector, - const int type, u16 itr) +static u32 idpf_vport_intr_buildreg_itr(struct idpf_q_vector *q_vector) { - u32 itr_val; + u32 itr_val = q_vector->intr_reg.dyn_ctl_intena_m; + int type = IDPF_NO_ITR_UPDATE_IDX; + u16 itr = 0; + + if (q_vector->wb_on_itr) { + /* + * Trigger a software interrupt when exiting wb_on_itr, to make + * sure we catch any pending write backs that might have been + * missed due to interrupt state transition. + */ + + itr_val |= q_vector->intr_reg.dyn_ctl_swint_trig_m | + q_vector->intr_reg.dyn_ctl_sw_itridx_ena_m; + type = IDPF_SW_ITR_UPDATE_IDX; + itr = IDPF_ITR_20K; + } itr &= IDPF_ITR_MASK; /* Don't clear PBA because that can cause lost interrupts that * came in while we were cleaning/polling */ - itr_val = q_vector->intr_reg.dyn_ctl_intena_m | - (type << q_vector->intr_reg.dyn_ctl_itridx_s) | - (itr << (q_vector->intr_reg.dyn_ctl_intrvl_s - 1)); + itr_val |= (type << q_vector->intr_reg.dyn_ctl_itridx_s) | + (itr << (q_vector->intr_reg.dyn_ctl_intrvl_s - 1)); return itr_val; } @@ -3716,9 +3727,8 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector) /* net_dim() updates ITR out-of-band using a work item */ idpf_net_dim(q_vector); + intval = idpf_vport_intr_buildreg_itr(q_vector); q_vector->wb_on_itr = false; - intval = idpf_vport_intr_buildreg_itr(q_vector, - IDPF_NO_ITR_UPDATE_IDX, 0); writel(intval, q_vector->intr_reg.dyn_ctl); }