]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
idpf: add rss_data field to RSS function parameters
authorPavan Kumar Linga <pavan.kumar.linga@intel.com>
Thu, 13 Nov 2025 00:41:39 +0000 (16:41 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 22 Jan 2026 22:00:06 +0000 (14:00 -0800)
Retrieve rss_data field of vport just once and pass it to RSS related
functions instead of retrieving it in each function.

While at it, update s/rss/RSS in the RSS function doc comments.

Reviewed-by: Anton Nadezhdin <anton.nadezhdin@intel.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf.h
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
drivers/net/ethernet/intel/idpf/idpf_lib.c
drivers/net/ethernet/intel/idpf/idpf_txrx.c
drivers/net/ethernet/intel/idpf/idpf_txrx.h
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h

index 4d005986d7844d018a02dcfe3bd65b3ae909df37..9b6c61f494a267303d260895d6b8114b60d160dc 100644 (file)
@@ -9,6 +9,7 @@ struct idpf_adapter;
 struct idpf_vport;
 struct idpf_vport_max_q;
 struct idpf_q_vec_rsrc;
+struct idpf_rss_data;
 
 #include <net/pkt_sched.h>
 #include <linux/aer.h>
index 3d0f3170a6f2f311479ef18d01fa6552769adb96..1d78a621d65bfca3a90fe79bd596d33fb3c1a521 100644 (file)
@@ -503,7 +503,7 @@ static int idpf_set_rxfh(struct net_device *netdev,
        }
 
        if (test_bit(IDPF_VPORT_UP, np->state))
-               err = idpf_config_rss(vport);
+               err = idpf_config_rss(vport, rss_data);
 
 unlock_mutex:
        idpf_vport_ctrl_unlock(netdev);
index ae268e75b1674b3d5fd2b94dfb82c3ae7edae39d..08c5c7370ca41e40ebf82b92e0e79ec6b2831b89 100644 (file)
@@ -1078,8 +1078,8 @@ static void idpf_vport_rel(struct idpf_vport *vport)
        u16 idx = vport->idx;
 
        vport_config = adapter->vport_config[vport->idx];
-       idpf_deinit_rss_lut(vport);
        rss_data = &vport_config->user_config.rss_data;
+       idpf_deinit_rss_lut(rss_data);
        kfree(rss_data->rss_key);
        rss_data->rss_key = NULL;
 
@@ -1297,11 +1297,11 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
        if (!rss_data->rss_key)
                goto free_qreg_chunks;
 
-       /* Initialize default rss key */
+       /* Initialize default RSS key */
        netdev_rss_key_fill((void *)rss_data->rss_key, rss_data->rss_key_size);
 
-       /* Initialize default rss LUT */
-       err = idpf_init_rss_lut(vport);
+       /* Initialize default RSS LUT */
+       err = idpf_init_rss_lut(vport, rss_data);
        if (err)
                goto free_rss_key;
 
@@ -1493,6 +1493,7 @@ static int idpf_vport_open(struct idpf_vport *vport, bool rtnl)
        struct idpf_adapter *adapter = vport->adapter;
        struct idpf_vport_config *vport_config;
        struct idpf_queue_id_reg_info *chunks;
+       struct idpf_rss_data *rss_data;
        int err;
 
        if (test_bit(IDPF_VPORT_UP, np->state))
@@ -1589,7 +1590,8 @@ static int idpf_vport_open(struct idpf_vport *vport, bool rtnl)
 
        idpf_restore_features(vport);
 
-       err = idpf_config_rss(vport);
+       rss_data = &vport_config->user_config.rss_data;
+       err = idpf_config_rss(vport, rss_data);
        if (err) {
                dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n",
                        vport->vport_id, err);
@@ -2093,8 +2095,12 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
                goto err_open;
 
        if (reset_cause == IDPF_SR_Q_CHANGE &&
-           !netif_is_rxfh_configured(vport->netdev))
-               idpf_fill_dflt_rss_lut(vport);
+           !netif_is_rxfh_configured(vport->netdev)) {
+               struct idpf_rss_data *rss_data;
+
+               rss_data = &vport_config->user_config.rss_data;
+               idpf_fill_dflt_rss_lut(vport, rss_data);
+       }
 
        if (vport_is_up)
                err = idpf_vport_open(vport, false);
@@ -2273,7 +2279,12 @@ static int idpf_set_features(struct net_device *netdev,
                 * the HW when the interface is brought up.
                 */
                if (test_bit(IDPF_VPORT_UP, np->state)) {
-                       err = idpf_config_rss(vport);
+                       struct idpf_vport_config *vport_config;
+                       struct idpf_rss_data *rss_data;
+
+                       vport_config = adapter->vport_config[vport->idx];
+                       rss_data = &vport_config->user_config.rss_data;
+                       err = idpf_config_rss(vport, rss_data);
                        if (err)
                                goto unlock_mutex;
                }
index f41cf79d11cb996c25caedf51fbf5921cf6ffdd4..c97e20bbcd342eb6189641f7381ae0cf82bd7e34 100644 (file)
@@ -4670,33 +4670,32 @@ void idpf_vport_intr_ena(struct idpf_vport *vport, struct idpf_q_vec_rsrc *rsrc)
 /**
  * idpf_config_rss - Send virtchnl messages to configure RSS
  * @vport: virtual port
+ * @rss_data: pointer to RSS key and lut info
  *
  * Return: 0 on success, negative on failure
  */
-int idpf_config_rss(struct idpf_vport *vport)
+int idpf_config_rss(struct idpf_vport *vport, struct idpf_rss_data *rss_data)
 {
        int err;
 
-       err = idpf_send_get_set_rss_key_msg(vport, false);
+       err = idpf_send_get_set_rss_key_msg(vport, rss_data, false);
        if (err)
                return err;
 
-       return idpf_send_get_set_rss_lut_msg(vport, false);
+       return idpf_send_get_set_rss_lut_msg(vport, rss_data, false);
 }
 
 /**
  * idpf_fill_dflt_rss_lut - Fill the indirection table with the default values
  * @vport: virtual port structure
+ * @rss_data: pointer to RSS key and lut info
  */
-void idpf_fill_dflt_rss_lut(struct idpf_vport *vport)
+void idpf_fill_dflt_rss_lut(struct idpf_vport *vport,
+                           struct idpf_rss_data *rss_data)
 {
        u16 num_active_rxq = vport->dflt_qv_rsrc.num_rxq;
-       struct idpf_adapter *adapter = vport->adapter;
-       struct idpf_rss_data *rss_data;
        int i;
 
-       rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data;
-
        for (i = 0; i < rss_data->rss_lut_size; i++)
                rss_data->rss_lut[i] = i % num_active_rxq;
 }
@@ -4704,15 +4703,12 @@ void idpf_fill_dflt_rss_lut(struct idpf_vport *vport)
 /**
  * idpf_init_rss_lut - Allocate and initialize RSS LUT
  * @vport: virtual port
+ * @rss_data: pointer to RSS key and lut info
  *
  * Return: 0 on success, negative on failure
  */
-int idpf_init_rss_lut(struct idpf_vport *vport)
+int idpf_init_rss_lut(struct idpf_vport *vport, struct idpf_rss_data *rss_data)
 {
-       struct idpf_adapter *adapter = vport->adapter;
-       struct idpf_rss_data *rss_data;
-
-       rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data;
        if (!rss_data->rss_lut) {
                u32 lut_size;
 
@@ -4723,21 +4719,17 @@ int idpf_init_rss_lut(struct idpf_vport *vport)
        }
 
        /* Fill the default RSS lut values */
-       idpf_fill_dflt_rss_lut(vport);
+       idpf_fill_dflt_rss_lut(vport, rss_data);
 
        return 0;
 }
 
 /**
  * idpf_deinit_rss_lut - Release RSS LUT
- * @vport: virtual port
+ * @rss_data: pointer to RSS key and lut info
  */
-void idpf_deinit_rss_lut(struct idpf_vport *vport)
+void idpf_deinit_rss_lut(struct idpf_rss_data *rss_data)
 {
-       struct idpf_adapter *adapter = vport->adapter;
-       struct idpf_rss_data *rss_data;
-
-       rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data;
        kfree(rss_data->rss_lut);
        rss_data->rss_lut = NULL;
 }
index 99daa081268af038c1aaf41e5f25f6dbac1df737..4be5b3b6d3ed2b1ffde761398e1c4b99aa67a701 100644 (file)
@@ -1098,10 +1098,11 @@ int idpf_vport_intr_init(struct idpf_vport *vport,
                         struct idpf_q_vec_rsrc *rsrc);
 void idpf_vport_intr_ena(struct idpf_vport *vport,
                         struct idpf_q_vec_rsrc *rsrc);
-void idpf_fill_dflt_rss_lut(struct idpf_vport *vport);
-int idpf_config_rss(struct idpf_vport *vport);
-int idpf_init_rss_lut(struct idpf_vport *vport);
-void idpf_deinit_rss_lut(struct idpf_vport *vport);
+void idpf_fill_dflt_rss_lut(struct idpf_vport *vport,
+                           struct idpf_rss_data *rss_data);
+int idpf_config_rss(struct idpf_vport *vport, struct idpf_rss_data *rss_data);
+int idpf_init_rss_lut(struct idpf_vport *vport, struct idpf_rss_data *rss_data);
+void idpf_deinit_rss_lut(struct idpf_rss_data *rss_data);
 int idpf_rx_bufs_init_all(struct idpf_vport *vport,
                          struct idpf_q_vec_rsrc *rsrc);
 
index 211f00e7b30d4fe7ab854a06504c703fa5f94b6f..434e77a05405616e73bc5d0865f1050b896cf609 100644 (file)
@@ -2827,30 +2827,31 @@ int idpf_send_get_stats_msg(struct idpf_vport *vport)
 }
 
 /**
- * idpf_send_get_set_rss_lut_msg - Send virtchnl get or set rss lut message
+ * idpf_send_get_set_rss_lut_msg - Send virtchnl get or set RSS lut message
  * @vport: virtual port data structure
- * @get: flag to set or get rss look up table
+ * @rss_data: pointer to RSS key and lut info
+ * @get: flag to set or get RSS look up table
  *
  * When rxhash is disabled, RSS LUT will be configured with zeros.  If rxhash
  * is enabled, the LUT values stored in driver's soft copy will be used to setup
  * the HW.
  *
- * Returns 0 on success, negative on failure.
+ * Return: 0 on success, negative on failure.
  */
-int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get)
+int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport,
+                                 struct idpf_rss_data *rss_data,
+                                 bool get)
 {
        struct virtchnl2_rss_lut *recv_rl __free(kfree) = NULL;
        struct virtchnl2_rss_lut *rl __free(kfree) = NULL;
        struct idpf_vc_xn_params xn_params = {};
-       struct idpf_rss_data *rss_data;
        int buf_size, lut_buf_size;
        ssize_t reply_sz;
        bool rxhash_ena;
        int i;
 
-       rss_data =
-               &vport->adapter->vport_config[vport->idx]->user_config.rss_data;
        rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH);
+
        buf_size = struct_size(rl, lut, rss_data->rss_lut_size);
        rl = kzalloc(buf_size, GFP_KERNEL);
        if (!rl)
@@ -2909,24 +2910,24 @@ do_memcpy:
 }
 
 /**
- * idpf_send_get_set_rss_key_msg - Send virtchnl get or set rss key message
+ * idpf_send_get_set_rss_key_msg - Send virtchnl get or set RSS key message
  * @vport: virtual port data structure
- * @get: flag to set or get rss look up table
+ * @rss_data: pointer to RSS key and lut info
+ * @get: flag to set or get RSS look up table
  *
- * Returns 0 on success, negative on failure
+ * Return: 0 on success, negative on failure
  */
-int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport, bool get)
+int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport,
+                                 struct idpf_rss_data *rss_data,
+                                 bool get)
 {
        struct virtchnl2_rss_key *recv_rk __free(kfree) = NULL;
        struct virtchnl2_rss_key *rk __free(kfree) = NULL;
        struct idpf_vc_xn_params xn_params = {};
-       struct idpf_rss_data *rss_data;
        ssize_t reply_sz;
        int i, buf_size;
        u16 key_size;
 
-       rss_data =
-               &vport->adapter->vport_config[vport->idx]->user_config.rss_data;
        buf_size = struct_size(rk, key_flex, rss_data->rss_key_size);
        rk = kzalloc(buf_size, GFP_KERNEL);
        if (!rk)
index 6fde600dfe53af023dcc44574ac88e2097627b99..e35e1efa211c81c3f57142e1e79982d13c32f005 100644 (file)
@@ -199,8 +199,12 @@ int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport);
 int idpf_send_ena_dis_loopback_msg(struct idpf_vport *vport);
 int idpf_send_get_stats_msg(struct idpf_vport *vport);
 int idpf_send_set_sriov_vfs_msg(struct idpf_adapter *adapter, u16 num_vfs);
-int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport, bool get);
-int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get);
+int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport,
+                                 struct idpf_rss_data *rss_data,
+                                 bool get);
+int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport,
+                                 struct idpf_rss_data *rss_data,
+                                 bool get);
 void idpf_vc_xn_shutdown(struct idpf_vc_xn_manager *vcxn_mngr);
 int idpf_idc_rdma_vc_send_sync(struct iidc_rdma_core_dev_info *cdev_info,
                               u8 *send_msg, u16 msg_size,