From patchwork Thu Feb 22 19:04:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Brady X-Patchwork-Id: 13567981 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 031066AFA9 for ; Thu, 22 Feb 2024 19:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708628712; cv=none; b=oCt3OsKQic7fVFbOlfX1zuJjYASQOHMF9GS6TKO5XW9dy0/QoA7UNDv3r8ilBqP4JiIAB41MEi5eMkM9f3ngwTKWK+H0VluFu2Y6TgqsdLsVs212GmDazkGeiVLrUoz+ehUnXBJ3LzOMyGhnmZ22l0LKRP+0nr08Rp5HTz3MwLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708628712; c=relaxed/simple; bh=9eIBb6bWagUzQQoX287zEEWkvYERQxEq7punHXUjISE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jk0rfNG8YyQpvy8lgfSAPqqcctFERqJe61Wyo/xtYqjn1ImyM5+1qsdD411jGVvauwhVEguzKzPPooY/coMA7oaJd0kImobVt4XZ02Zbdguu48vUw2HT1b1ERypBx64XPABaJwUXhPkZGjK3Wf+HULQFhWmsjZp3zqrJ+PP/fsM= 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=fecaTwyO; arc=none smtp.client-ip=192.198.163.11 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="fecaTwyO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708628711; x=1740164711; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9eIBb6bWagUzQQoX287zEEWkvYERQxEq7punHXUjISE=; b=fecaTwyOyFCwfpo4Q+o8Z6d8+C+tgPndlTAB+/iG1CmcRLkgxL34O77t oplfAEsj3m4dxFUIu4xr3BGo5VFfgq2njOl+HO1KiBortGRty/N/fSy6i VeZEYIw2uX9gJ98NZ7MU7reN25ZNunHltBd1dyn5eW6JASebn/tN3sGWL 9Q3ca2XLsWtwVE0/314HTEu0P1re4NdAIWxkYRAe5MTulq38bvPIhCYIZ RMVnPTHYwOrREiC9C0A1rb61Tz7OYnkFUwm+1RHUE7yrFcx3bjQ042/69 son8FkU5cwvq7omopCmpUfFkdHxi+0MsmR13P1A9+0Ku9nxbAoDgDM6H/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="13506400" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="13506400" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 11:05:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="10171422" Received: from dev1-atbrady.jf.intel.com ([10.166.241.35]) by fmviesa004.fm.intel.com with ESMTP; 22 Feb 2024 11:05:10 -0800 From: Alan Brady To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, Alan Brady , Alexander Lobakin Subject: [PATCH v6 10/11 iwl-next] idpf: fix minor controlq issues Date: Thu, 22 Feb 2024 11:04:40 -0800 Message-ID: <20240222190441.2610930-11-alan.brady@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222190441.2610930-1-alan.brady@intel.com> References: <20240222190441.2610930-1-alan.brady@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 While we're here improving virtchnl we can include two minor fixes for the lower level ctrlq flow. This adds a memory barrier to idpf_post_rx_buffs before we update tail on the controlq. We should make sure our writes have had a chance to finish before we tell HW it can touch them. This also removes some defensive programming in idpf_ctrlq_recv. The caller should not be using a num_q_msg value of zero or more than the ring size and it's their responsibility to call functions sanely. Tested-by: Alexander Lobakin Signed-off-by: Alan Brady Tested-by: Krishneil Singh --- drivers/net/ethernet/intel/idpf/idpf_controlq.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_controlq.c b/drivers/net/ethernet/intel/idpf/idpf_controlq.c index c7f43d2fcd13..4849590a5591 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_controlq.c +++ b/drivers/net/ethernet/intel/idpf/idpf_controlq.c @@ -516,6 +516,8 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq, /* Wrap to end of end ring since current ntp is 0 */ cq->next_to_post = cq->ring_size - 1; + dma_wmb(); + wr32(hw, cq->reg.tail, cq->next_to_post); } @@ -546,11 +548,6 @@ int idpf_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg, int err = 0; u16 i; - if (*num_q_msg == 0) - return 0; - else if (*num_q_msg > cq->ring_size) - return -EBADR; - /* take the lock before we start messing with the ring */ mutex_lock(&cq->cq_lock);