From patchwork Mon Jul 29 20:07:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13745656 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 B098643152; Mon, 29 Jul 2024 20:07:25 +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=1722283648; cv=none; b=W/3latzCS86FuhTzn143QstTg7Xz8XLarZNEDRyBPO7ZHZHg6HIA4TRLpEt3jdElhf8JlFEnumW8ZzmD7JrZcEs1qCIMcjBmGfEL2CtCYN3kwPM4rRFdpYmpkbSR+iU9bXiDtdY6IrwbvJS3zhKWUqHxDmv1kpnE3EcJV/AMwC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722283648; c=relaxed/simple; bh=dHUNGAibRljH817e9T8fK71LyQ0fLnVfb5tWMTWaV0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nCXn37WaAZ/efYgZHGCgJxBxgN1eM9zAh8zXqiFMW0fOmnVa7hBz89lZs6n72y+MqzBvOq5SHR5/O7x+iQnDkwDO1jxyEYPuyJGM2dAzRsVVMyAvR3FH7K/+nGj2OENvQFPGI5PaPwqTXiKezCPMaJKwmrV8v/NZjLTmo42EZjc= 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=erZyYRVN; 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="erZyYRVN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722283647; x=1753819647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dHUNGAibRljH817e9T8fK71LyQ0fLnVfb5tWMTWaV0E=; b=erZyYRVN/O90K6eZ9kb+8eEN2X/174s53AjsMODXvj2/ztPMO7S2OCIw dssTTfwV/vNA11TuQksa3O629n/eJqAe3dII4OYpEgLRgMSb7UxAymbP1 oPZUPu6RWcDRjl7pH5lL4m+3xtNdr79O22bwjbYcfvE527CIWcCScp3NH xus8F2FGt8OxpTWQ2GT2MN7dZWc0oeyByeizKxC/HUlK7yBzFeQgomZiC QMGL6SZWav+U1/NAuW8qC22op7AYB+vV6sTOfylmVkZMyBPaw/x7hl3/J n95buO1+toyIoUouiujt6oOvT8jEPpY1MwPoqza54DLrrlUyIlEGpoOu3 A==; X-CSE-ConnectionGUID: TowsjkwsSrW7d4h2oGFjnA== X-CSE-MsgGUID: LP1qxhMIT2Wei0gL8cg9OQ== X-IronPort-AV: E=McAfee;i="6700,10204,11148"; a="23818514" X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="23818514" 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:23 -0700 X-CSE-ConnectionGUID: BFs897k+QKyDTfsNXSHOrw== X-CSE-MsgGUID: eLUcEbz8Tie0YDGlm8QQbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="54681284" 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: Maciej Fijalkowski , anthony.l.nguyen@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 3/8] ice: replace synchronize_rcu with synchronize_net Date: Mon, 29 Jul 2024 13:07:09 -0700 Message-ID: <20240729200716.681496-4-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: Maciej Fijalkowski Given that ice_qp_dis() is called under rtnl_lock, synchronize_net() can be called instead of synchronize_rcu() so that XDP rings can finish its job in a faster way. Also let us do this as earlier in XSK queue disable flow. Additionally, turn off regular Tx queue before disabling irqs and NAPI. 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: Maciej Fijalkowski Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_xsk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 3104a5657b83..ba50af9a5929 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -52,10 +52,8 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx) static void ice_qp_clean_rings(struct ice_vsi *vsi, u16 q_idx) { ice_clean_tx_ring(vsi->tx_rings[q_idx]); - if (ice_is_xdp_ena_vsi(vsi)) { - synchronize_rcu(); + if (ice_is_xdp_ena_vsi(vsi)) ice_clean_tx_ring(vsi->xdp_rings[q_idx]); - } ice_clean_rx_ring(vsi->rx_rings[q_idx]); } @@ -180,11 +178,12 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) usleep_range(1000, 2000); } + synchronize_net(); + netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx)); + ice_qvec_dis_irq(vsi, rx_ring, q_vector); ice_qvec_toggle_napi(vsi, q_vector, false); - netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx)); - ice_fill_txq_meta(vsi, tx_ring, &txq_meta); err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, tx_ring, &txq_meta); if (err)