Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1187046rdb; Fri, 22 Dec 2023 19:08:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZ/Mp8xp/+9RK47MhnT4sSbNxJc70MWBShaYfMIO2n9p/jc6z6FXGol1GKm7cy6bSGMppi X-Received: by 2002:a05:6830:3493:b0:6d9:ea20:1c5f with SMTP id c19-20020a056830349300b006d9ea201c5fmr2656517otu.16.1703300927427; Fri, 22 Dec 2023 19:08:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703300927; cv=none; d=google.com; s=arc-20160816; b=p8PjtBGBgGPzirl3dFcTEbcQGqda7dNl/ShsKNKd5UzSBDWPMTHtbbqgRG0VcLvdAt wkdgoOc6ww/GUKvlZKPnCwjRygk2x0A4dNuOmZBujEJdwpH+VOU0CHKk5NE5gT+LKw0p +IctoRIMlg/41nkUsccxrokD0dCo15JJKezjBT5S3HpQGIWWwcYQodGDnfTWJ9wGwza/ K4TdEzY60hx0UgMdrXR4fMni7RIvvhgzdD3zePq8kM98z9MT+NpO5NFvPOYCHH0BLwmZ wl1KzQns6U8jGW3JR+yToebNocW78BW5y/93BKBhVdT4LyQGxZHQQqGXVDKMk9XL807R W7og== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e8-20020a056a001a8800b006d0d83a11bcsi4288118pfv.102.2023.12.22.19.08.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 19:08:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10246-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10246-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 10B3E285F3F for ; Sat, 23 Dec 2023 03:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 396DE3C498; Sat, 23 Dec 2023 03:00:03 +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 Content-Transfer-Encoding: 8bit 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 -- 2.43.0