From patchwork Mon Aug 12 14:56:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 13760757 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 572B818455F for ; Mon, 12 Aug 2024 14:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723474630; cv=none; b=mSk+Az4fkl2lTbJ5fLz50GlWaJWEyjTSPjvQal3ysYmR42cVtuXr4h+SGyL4gsUEXCoxb4+D/xwvni6ycxyhCvhOgOnmSimM1lRCxDnYUiBHjY0crhIeQK9wddJEzn6nIz2553wIWgZRg1u1qYB8zmke2xvMGY5br/ArQxNuE+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723474630; c=relaxed/simple; bh=qttIpi4HRsWevPJvdgv7JnCbSSNPmNcCGu3sxRJxwIQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hLLNkMhUNOCN6TKqdNJHi2HvpmjA8QrURQG/Ri6Ukt2/q57gON/BEi8TZN5XelgQecHOjzAB1+qN2QAqoi5PU3/7Z9zlSoBenpXC/O5mHzgCW+TAltmuvc4bQtyjgK27PtG7zbdZMN6lrmwmi/hctG9QtYQQCzrwHbLd7/Dmxk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=jFX0zuWg; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="jFX0zuWg" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7105043330aso3573446b3a.0 for ; Mon, 12 Aug 2024 07:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1723474628; x=1724079428; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=krsVPmGJ7mUpHzCKNJF3hcG8Is07gdPgaERGEpodORE=; b=jFX0zuWgifE0wxa+qx0p21VDtTATsMsRg2biF4fCKZWSZcCXaV72F8/iyjB9AWyHyb bx4g3+K1HEunDLIIxjU+wrhXchD6KFpHs4cLG7TjNm7JsU6ctO2gCyL14FQowBc8OH0V U28Lhvuuo018y03Anf55v/9zAUCFGWIcrniZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723474628; x=1724079428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=krsVPmGJ7mUpHzCKNJF3hcG8Is07gdPgaERGEpodORE=; b=UoaG0i11glTR5ozk7Q1Fj2f9QuEtKa2ExIVlSU/x0zA5cw+zZR85HVeoiPdyQSNlsH e/7Hwg/ybCtCV+tVjvv6sQINVcYTGuKsNnoM9yCK3uJ4KS9R/gBq0PItwZqU2fvXEmnC B/q2I0ipXTczbZWpyJT/8NkkxTCq/Ky52DPA4hMPTrJX4hGm0k4vpVd+FoWjnPCY6qmw +LA5HZPWL2kvn/Faog9FQnYkR3+/9aEC5FiU+Vm9XgyfBtstI6jMCEM3AGeCMPcvqEXh 1qIVFUpAeFHrliR/qHYP0aQEuWMjawmx7HZI/IKfLmeKmsozNAVkL6FQ+5DcAmKx8qTE vtzg== X-Gm-Message-State: AOJu0Yz82EmcaKS+0gEm5UTLJF6tQ7OV7wEkRFLVC/ke1GicN9qJhAEW 32cs3rix8zLkIBsJhUyLxA2NALZV+zCnMUqBKkgMYTESiUM1xG51zpMDva+tUGMgMCxmAnzJJ0U mHk19P6ecG/TFBCgI9Su4Cq02dpJhpUvAnTq/ClcDgw5nhVYmZh/BrlTMCCJeSGpFqTsCNS/oCZ AOmqmdIuW1J5H1ub+91AvQUWXhLqlja6vR8yTuow== X-Google-Smtp-Source: AGHT+IGI1VKC/hH97K8mVlaBVtWBUX28eQCqGKnY+VncEcLp2Gvi+LfAg0ooVhF0BwcGRliS31Rfvw== X-Received: by 2002:a17:902:d4cd:b0:1fa:449:1dd6 with SMTP id d9443c01a7336-201ca1c77edmr6127215ad.48.1723474628092; Mon, 12 Aug 2024 07:57:08 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb8fd835sm39006955ad.89.2024.08.12.07.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 07:57:07 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: Joe Damato , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver), linux-kernel@vger.kernel.org (open list) Subject: [RFC net-next 2/6] mlx5: Use napi_affinity_no_change Date: Mon, 12 Aug 2024 14:56:23 +0000 Message-Id: <20240812145633.52911-3-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240812145633.52911-1-jdamato@fastly.com> References: <20240812145633.52911-1-jdamato@fastly.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 X-Patchwork-State: RFC Use napi_affinity_no_change instead of mlx5's internal implementation, simplifying and centralizing the logic. Signed-off-by: Joe Damato --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 9 +-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 7832f6b6c8a8..c288e3f45a06 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -767,7 +767,7 @@ struct mlx5e_channel { spinlock_t async_icosq_lock; /* data path - accessed per napi poll */ - const struct cpumask *aff_mask; + unsigned int irq; struct mlx5e_ch_stats *stats; /* control */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 6f686fabed44..7b217aafbdfd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2684,8 +2684,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, c->mkey_be = cpu_to_be32(mdev->mlx5e_res.hw_objs.mkey); c->num_tc = mlx5e_get_dcb_num_tc(params); c->xdp = !!params->xdp_prog; + c->irq = irq; c->stats = &priv->channel_stats[ix]->ch; - c->aff_mask = irq_get_effective_affinity_mask(irq); c->lag_port = mlx5e_enumerate_lag_port(mdev, ix); netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c index 5873fde65c2e..ee453d019c3b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c @@ -39,13 +39,6 @@ #include "en/xsk/tx.h" #include "en_accel/ktls_txrx.h" -static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c) -{ - int current_cpu = smp_processor_id(); - - return cpumask_test_cpu(current_cpu, c->aff_mask); -} - static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq) { struct mlx5e_sq_stats *stats = sq->stats; @@ -201,7 +194,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) busy |= busy_xsk; if (busy) { - if (likely(mlx5e_channel_no_affinity_change(c))) { + if (likely(napi_affinity_no_change(c->irq))) { work_done = budget; goto out; }