]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
idpf: compile singleq code only under default-n CONFIG_IDPF_SINGLEQ
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Thu, 20 Jun 2024 13:53:42 +0000 (15:53 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 10 Jul 2024 17:42:26 +0000 (10:42 -0700)
Currently, all HW supporting idpf supports the singleq model, but none
of it advertises it by default, as splitq is supported and preferred
for multiple reasons. Still, this almost dead code often times adds
hotpath branches and redundant cacheline accesses.
While it can't currently be removed, add CONFIG_IDPF_SINGLEQ and build
the singleq code only when it's enabled manually. This corresponds to
-10 Kb of object code size and a good bunch of hotpath checks.
idpf_is_queue_model_split() works as a gate and compiles out to `true`
when the config option is disabled.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/Kconfig
drivers/net/ethernet/intel/idpf/Kconfig [new file with mode: 0644]
drivers/net/ethernet/intel/idpf/Makefile
drivers/net/ethernet/intel/idpf/idpf.h
drivers/net/ethernet/intel/idpf/idpf_txrx.c
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c

index e0287fbd501dc639e4d07dc3e49f3ac54f13fcbd..0375c7448a573494b809ce83e53d6888b1242ead 100644 (file)
@@ -384,17 +384,6 @@ config IGC_LEDS
          Optional support for controlling the NIC LED's with the netdev
          LED trigger.
 
-config IDPF
-       tristate "Intel(R) Infrastructure Data Path Function Support"
-       depends on PCI_MSI
-       select DIMLIB
-       select PAGE_POOL
-       select PAGE_POOL_STATS
-       help
-         This driver supports Intel(R) Infrastructure Data Path Function
-         devices.
-
-         To compile this driver as a module, choose M here. The module
-         will be called idpf.
+source "drivers/net/ethernet/intel/idpf/Kconfig"
 
 endif # NET_VENDOR_INTEL
diff --git a/drivers/net/ethernet/intel/idpf/Kconfig b/drivers/net/ethernet/intel/idpf/Kconfig
new file mode 100644 (file)
index 0000000..9082c16
--- /dev/null
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Copyright (C) 2024 Intel Corporation
+
+config IDPF
+       tristate "Intel(R) Infrastructure Data Path Function Support"
+       depends on PCI_MSI
+       select DIMLIB
+       select PAGE_POOL
+       select PAGE_POOL_STATS
+       help
+         This driver supports Intel(R) Infrastructure Data Path Function
+         devices.
+
+         To compile this driver as a module, choose M here. The module
+         will be called idpf.
+
+if IDPF
+
+config IDPF_SINGLEQ
+       bool "idpf singleq support"
+       help
+         This option enables support for legacy single Rx/Tx queues w/no
+         completion and fill queues. Only enable if you have hardware which
+         wants to work in this mode as it increases the driver size and adds
+         runtme checks on hotpath.
+
+endif # IDPF
index 6844ead2f3acf945324b58e0cd9b9c948990b0b3..2ce01a0b58981d364bff42acf8d75cba4152b3d2 100644 (file)
@@ -12,7 +12,8 @@ idpf-y := \
        idpf_ethtool.o          \
        idpf_lib.o              \
        idpf_main.o             \
-       idpf_singleq_txrx.o     \
        idpf_txrx.o             \
        idpf_virtchnl.o         \
        idpf_vf_dev.o
+
+idpf-$(CONFIG_IDPF_SINGLEQ)    += idpf_singleq_txrx.o
index f9e43d171f17127515bbe7f8b9e93045aeea245b..5d9529f5b41bc7713a8cbbcd960633f5dc647a8a 100644 (file)
@@ -599,7 +599,8 @@ struct idpf_adapter {
  */
 static inline int idpf_is_queue_model_split(u16 q_model)
 {
-       return q_model == VIRTCHNL2_QUEUE_MODEL_SPLIT;
+       return !IS_ENABLED(CONFIG_IDPF_SINGLEQ) ||
+              q_model == VIRTCHNL2_QUEUE_MODEL_SPLIT;
 }
 
 #define idpf_is_cap_ena(adapter, field, flag) \
index 5dd1b1a9e624c4205592f6b32a7cf9b37bdccd8a..e79a8f9dfc402d64494e185214d10f163b29f48f 100644 (file)
@@ -1309,7 +1309,7 @@ static void idpf_vport_calc_numq_per_grp(struct idpf_vport *vport,
 static void idpf_rxq_set_descids(const struct idpf_vport *vport,
                                 struct idpf_rx_queue *q)
 {
-       if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+       if (idpf_is_queue_model_split(vport->rxq_model)) {
                q->rxdids = VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M;
        } else {
                if (vport->base_rxd)
index 44602b87cd41148d9bf405a721ec1729f5e1969a..1aa4770dfe1892f95f4adbf3b73b53a4fae7b00e 100644 (file)
@@ -1256,12 +1256,12 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter,
        vport_msg->vport_type = cpu_to_le16(VIRTCHNL2_VPORT_TYPE_DEFAULT);
        vport_msg->vport_index = cpu_to_le16(idx);
 
-       if (adapter->req_tx_splitq)
+       if (adapter->req_tx_splitq || !IS_ENABLED(CONFIG_IDPF_SINGLEQ))
                vport_msg->txq_model = cpu_to_le16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
        else
                vport_msg->txq_model = cpu_to_le16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
 
-       if (adapter->req_rx_splitq)
+       if (adapter->req_rx_splitq || !IS_ENABLED(CONFIG_IDPF_SINGLEQ))
                vport_msg->rxq_model = cpu_to_le16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
        else
                vport_msg->rxq_model = cpu_to_le16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
@@ -1323,10 +1323,17 @@ int idpf_check_supported_desc_ids(struct idpf_vport *vport)
 
        vport_msg = adapter->vport_params_recvd[vport->idx];
 
+       if (!IS_ENABLED(CONFIG_IDPF_SINGLEQ) &&
+           (vport_msg->rxq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE ||
+            vport_msg->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)) {
+               pci_err(adapter->pdev, "singleq mode requested, but not compiled-in\n");
+               return -EOPNOTSUPP;
+       }
+
        rx_desc_ids = le64_to_cpu(vport_msg->rx_desc_ids);
        tx_desc_ids = le64_to_cpu(vport_msg->tx_desc_ids);
 
-       if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+       if (idpf_is_queue_model_split(vport->rxq_model)) {
                if (!(rx_desc_ids & VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M)) {
                        dev_info(&adapter->pdev->dev, "Minimum RX descriptor support not provided, using the default\n");
                        vport_msg->rx_desc_ids = cpu_to_le64(VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M);
@@ -1336,7 +1343,7 @@ int idpf_check_supported_desc_ids(struct idpf_vport *vport)
                        vport->base_rxd = true;
        }
 
-       if (vport->txq_model != VIRTCHNL2_QUEUE_MODEL_SPLIT)
+       if (!idpf_is_queue_model_split(vport->txq_model))
                return 0;
 
        if ((tx_desc_ids & MIN_SUPPORT_TXDID) != MIN_SUPPORT_TXDID) {