[Intel-wired-lan] [PATCH RFC net-next 30/34] idpf: move search rx and tx queues to header
Alexander Lobakin
aleksander.lobakin at intel.com
Sat Dec 23 02:55:50 UTC 2023
From: Michal Kubiak <michal.kubiak at intel.com>
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 <michal.kubiak at intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin at intel.com>
---
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
More information about the Intel-wired-lan
mailing list