mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
idpf: add rss_data field to RSS function parameters
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>
This commit is contained in:
committed by
Tony Nguyen
parent
47ee0543a4
commit
cfa7029a25
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user