From patchwork Sat Dec 23 02:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 182896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1462652dyi; Fri, 22 Dec 2023 19:09:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9zz3LGqjQlAY1+ihnNUoq2uKT0w8Er3+9E3Wm5u2sgJyJ3wgl/R2gYoCAZE5R5Wv5r+8h X-Received: by 2002:a7b:cd8e:0:b0:40c:6ae0:559b with SMTP id y14-20020a7bcd8e000000b0040c6ae0559bmr712589wmj.343.1703300939780; Fri, 22 Dec 2023 19:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703300939; cv=none; d=google.com; s=arc-20160816; b=vWWXa6CDfvmWKjLMyOIwZjAnMnwYR6roF4HNxGLj4kizxtAgL7nl/wim7Hjwf+vi/w FqKdZy5M8+oHABHgMeib+TNGgKP4F2EUoQLKS2pNz6CjLxQbryNHVBjKm2SmrpW0VLEO DT6d+7O2TUHwKeIFhlgBNUH70Jsd0uwf39w/IA9JcKnpypB2rLhZ2J0E+ntOw9/QpSMA qfSLSsNvL7aihtcKinCrfzIVZbw7K7xxFMTAYwc3DcA4SnMCq50pvDiwhN+VOwa2UHkc OtM3V9BPttiiDuNu+5VyQs850v2Dnwgw6x/za/DTqkwYDXE//u4KEvrZXP5La9GiGZ3p Tk1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QH9cIs+OMmq3ZoK8z1fKZ1I0db2qYDBpd5VkrKFMyno=; fh=J3H3jkZRTdH/CD0R7uXO8r43FYFiJ1FqB2ouoqeBxmQ=; b=r1pILQ92Bg/k600Ry0dmsE83omyc98/FD2KYjzvHPYZYblyKeMkhoTcRbhO40XWM/x 25Q1qcSGl0NftTyOqXWauHkiO8123rSooyHO1DGFYY4Y8IIh7Y+5Wl2jogRYUj2Bdb6w Axka870MGVEwQVNDCoT2aYG0oabVKprjjBpkV0GA1OEBRI75RUJ/iwsFKJiC7IfuDbyk xpNhlxrutb2bqzd3SqrQccJhtQKRzoFrA1PU+5iU1DqjjDgJoOaw1z2/IgFkEbrJCWRd DwdkrBsZ8HBwRJ0KM8PmmRtItm+/6NZDiwDVbOzetEJE5lMpkIRYdk+Zncyfkg6xGKE6 Kwlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fHpdwHDj; spf=pass (google.com: domain of linux-kernel+bounces-10246-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10246-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gi34-20020a1709070ca200b00a1d3eccb0f0si2166095ejc.428.2023.12.22.19.08.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 19:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10246-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fHpdwHDj; spf=pass (google.com: domain of linux-kernel+bounces-10246-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10246-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 406121F23D23 for ; Sat, 23 Dec 2023 03:08:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02A5F3D3B8; Sat, 23 Dec 2023 03:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fHpdwHDj" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 136383C06A; Sat, 23 Dec 2023 03:00:01 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703300401; x=1734836401; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aYQdHCgMRF5nMXbGmL6Lo6tQCKIRvL6ThHkKSgt1nOY=; b=fHpdwHDjMTWRltW1AYtolldYXWoTuvBaHC5VTWLetpe15sr/aAXzKoFu U6WUcCRz6CL1OB43hwHqYM3FoeFx2wdcQBhKIMZAGiTLTMH9qNvXF8eeM n7FM1hy4N9Z1Kv+TNeS34IiM54AE8JpKJ9YG1znhguAAes74nKsDcfb2+ a4SAyTQ/pmc0zBfCFVegcFxi6jmpqaZnuQ1vCLaENLz3XQnx7AVjYvzO+ 13J7RHETJjbqK/UNRpoVYhL1c8Z92DFhMrSY84B58HliiewILgQIiLTFz IfJeUZyygqdAap4aJWUlFrSBSCXW9wvGCtxkfqdJifvA6trxujcwGGYYI g==; X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="386611078" X-IronPort-AV: E=Sophos;i="6.04,298,1695711600"; d="scan'208";a="386611078" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 19:00:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,298,1695711600"; d="scan'208";a="25537663" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orviesa001.jf.intel.com with ESMTP; 22 Dec 2023 18:59:57 -0800 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Maciej Fijalkowski , Michal Kubiak , Larysa Zaremba , Alexei Starovoitov , Daniel Borkmann , Willem de Bruijn , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next 30/34] idpf: move search rx and tx queues to header Date: Sat, 23 Dec 2023 03:55:50 +0100 Message-ID: <20231223025554.2316836-31-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231223025554.2316836-1-aleksander.lobakin@intel.com> References: <20231223025554.2316836-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786040485978121381 X-GMAIL-MSGID: 1786040485978121381 From: Michal Kubiak Move Rx and Tx queue lookup functions from the ethtool implementation to the idpf header. Now, those functions can be used globally, including XDP configuration. Signed-off-by: Michal Kubiak Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/idpf/idpf.h | 41 +++++++++++++++++++ .../net/ethernet/intel/idpf/idpf_ethtool.c | 39 ------------------ 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h index a12c56f9f2ef..d99ebd045c4e 100644 --- a/drivers/net/ethernet/intel/idpf/idpf.h +++ b/drivers/net/ethernet/intel/idpf/idpf.h @@ -696,6 +696,47 @@ static inline int idpf_is_queue_model_split(u16 q_model) return q_model == VIRTCHNL2_QUEUE_MODEL_SPLIT; } +/** + * idpf_find_rxq - find rxq from q index + * @vport: virtual port associated to queue + * @q_num: q index used to find queue + * + * returns pointer to rx queue + */ +static inline struct idpf_queue * +idpf_find_rxq(struct idpf_vport *vport, int q_num) +{ + int q_grp, q_idx; + + if (!idpf_is_queue_model_split(vport->rxq_model)) + return vport->rxq_grps->singleq.rxqs[q_num]; + + q_grp = q_num / IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; + q_idx = q_num % IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; + + return &vport->rxq_grps[q_grp].splitq.rxq_sets[q_idx]->rxq; +} + +/** + * idpf_find_txq - find txq from q index + * @vport: virtual port associated to queue + * @q_num: q index used to find queue + * + * returns pointer to tx queue + */ +static inline struct idpf_queue * +idpf_find_txq(struct idpf_vport *vport, int q_num) +{ + int q_grp; + + if (!idpf_is_queue_model_split(vport->txq_model)) + return vport->txqs[q_num]; + + q_grp = q_num / IDPF_DFLT_SPLITQ_TXQ_PER_GROUP; + + return vport->txq_grps[q_grp].complq; +} + /** * idpf_xdp_is_prog_ena - check if there is an XDP program on adapter * @vport: vport to check diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c index 0d192417205d..f7ec679c9b16 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c +++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c @@ -953,45 +953,6 @@ static void idpf_get_ethtool_stats(struct net_device *netdev, idpf_vport_ctrl_unlock(netdev); } -/** - * idpf_find_rxq - find rxq from q index - * @vport: virtual port associated to queue - * @q_num: q index used to find queue - * - * returns pointer to rx queue - */ -static struct idpf_queue *idpf_find_rxq(struct idpf_vport *vport, int q_num) -{ - int q_grp, q_idx; - - if (!idpf_is_queue_model_split(vport->rxq_model)) - return vport->rxq_grps->singleq.rxqs[q_num]; - - q_grp = q_num / IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; - q_idx = q_num % IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; - - return &vport->rxq_grps[q_grp].splitq.rxq_sets[q_idx]->rxq; -} - -/** - * idpf_find_txq - find txq from q index - * @vport: virtual port associated to queue - * @q_num: q index used to find queue - * - * returns pointer to tx queue - */ -static struct idpf_queue *idpf_find_txq(struct idpf_vport *vport, int q_num) -{ - int q_grp; - - if (!idpf_is_queue_model_split(vport->txq_model)) - return vport->txqs[q_num]; - - q_grp = q_num / IDPF_DFLT_SPLITQ_TXQ_PER_GROUP; - - return vport->txq_grps[q_grp].complq; -} - /** * __idpf_get_q_coalesce - get ITR values for specific queue * @ec: ethtool structure to fill with driver's coalesce settings