Commit 87ce161e authored by Guangbin Huang's avatar Guangbin Huang Committed by Jakub Kicinski

net: hns3: RSS indirection table use device specification

As RSS indirection table size may be different in different
hardware. Instead of using macro, this value is better to use
device specification which querying from firmware.

BTW, RSS indirection table should be allocated by the queried
size instead the static array.

.get_rss_indir_size in struct hnae3_ae_ops is not used now,
so remove it as well.
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1cef42c8
...@@ -410,8 +410,6 @@ struct hnae3_ae_dev { ...@@ -410,8 +410,6 @@ struct hnae3_ae_dev {
* Get the len of the regs dump * Get the len of the regs dump
* get_rss_key_size() * get_rss_key_size()
* Get rss key size * Get rss key size
* get_rss_indir_size()
* Get rss indirection table size
* get_rss() * get_rss()
* Get rss table * Get rss table
* set_rss() * set_rss()
...@@ -555,7 +553,6 @@ struct hnae3_ae_ops { ...@@ -555,7 +553,6 @@ struct hnae3_ae_ops {
int (*get_regs_len)(struct hnae3_handle *handle); int (*get_regs_len)(struct hnae3_handle *handle);
u32 (*get_rss_key_size)(struct hnae3_handle *handle); u32 (*get_rss_key_size)(struct hnae3_handle *handle);
u32 (*get_rss_indir_size)(struct hnae3_handle *handle);
int (*get_rss)(struct hnae3_handle *handle, u32 *indir, u8 *key, int (*get_rss)(struct hnae3_handle *handle, u32 *indir, u8 *key,
u8 *hfunc); u8 *hfunc);
int (*set_rss)(struct hnae3_handle *handle, const u32 *indir, int (*set_rss)(struct hnae3_handle *handle, const u32 *indir,
......
...@@ -859,11 +859,9 @@ static u32 hns3_get_rss_key_size(struct net_device *netdev) ...@@ -859,11 +859,9 @@ static u32 hns3_get_rss_key_size(struct net_device *netdev)
static u32 hns3_get_rss_indir_size(struct net_device *netdev) static u32 hns3_get_rss_indir_size(struct net_device *netdev)
{ {
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);
if (!h->ae_algo->ops->get_rss_indir_size) return ae_dev->dev_specs.rss_ind_tbl_size;
return 0;
return h->ae_algo->ops->get_rss_indir_size(h);
} }
static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key, static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key,
......
...@@ -4237,11 +4237,6 @@ static u32 hclge_get_rss_key_size(struct hnae3_handle *handle) ...@@ -4237,11 +4237,6 @@ static u32 hclge_get_rss_key_size(struct hnae3_handle *handle)
return HCLGE_RSS_KEY_SIZE; return HCLGE_RSS_KEY_SIZE;
} }
static u32 hclge_get_rss_indir_size(struct hnae3_handle *handle)
{
return HCLGE_RSS_IND_TBL_SIZE;
}
static int hclge_set_rss_algo_key(struct hclge_dev *hdev, static int hclge_set_rss_algo_key(struct hclge_dev *hdev,
const u8 hfunc, const u8 *key) const u8 hfunc, const u8 *key)
{ {
...@@ -4283,6 +4278,7 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir) ...@@ -4283,6 +4278,7 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir)
{ {
struct hclge_rss_indirection_table_cmd *req; struct hclge_rss_indirection_table_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
int rss_cfg_tbl_num;
u8 rss_msb_oft; u8 rss_msb_oft;
u8 rss_msb_val; u8 rss_msb_val;
int ret; int ret;
...@@ -4291,8 +4287,10 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir) ...@@ -4291,8 +4287,10 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir)
u32 j; u32 j;
req = (struct hclge_rss_indirection_table_cmd *)desc.data; req = (struct hclge_rss_indirection_table_cmd *)desc.data;
rss_cfg_tbl_num = hdev->ae_dev->dev_specs.rss_ind_tbl_size /
HCLGE_RSS_CFG_TBL_SIZE;
for (i = 0; i < HCLGE_RSS_CFG_TBL_NUM; i++) { for (i = 0; i < rss_cfg_tbl_num; i++) {
hclge_cmd_setup_basic_desc hclge_cmd_setup_basic_desc
(&desc, HCLGE_OPC_RSS_INDIR_TABLE, false); (&desc, HCLGE_OPC_RSS_INDIR_TABLE, false);
...@@ -4398,6 +4396,7 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) ...@@ -4398,6 +4396,7 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
u8 *key, u8 *hfunc) u8 *key, u8 *hfunc)
{ {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
int i; int i;
...@@ -4422,7 +4421,7 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, ...@@ -4422,7 +4421,7 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
/* Get indirect table */ /* Get indirect table */
if (indir) if (indir)
for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++)
indir[i] = vport->rss_indirection_tbl[i]; indir[i] = vport->rss_indirection_tbl[i];
return 0; return 0;
...@@ -4431,6 +4430,7 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, ...@@ -4431,6 +4430,7 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
u8 hash_algo; u8 hash_algo;
...@@ -4462,7 +4462,7 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, ...@@ -4462,7 +4462,7 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir,
} }
/* Update the shadow RSS table with user specified qids */ /* Update the shadow RSS table with user specified qids */
for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++)
vport->rss_indirection_tbl[i] = indir[i]; vport->rss_indirection_tbl[i] = indir[i];
/* Update the hardware */ /* Update the hardware */
...@@ -4703,14 +4703,15 @@ void hclge_rss_indir_init_cfg(struct hclge_dev *hdev) ...@@ -4703,14 +4703,15 @@ void hclge_rss_indir_init_cfg(struct hclge_dev *hdev)
int i, j; int i, j;
for (j = 0; j < hdev->num_vmdq_vport + 1; j++) { for (j = 0; j < hdev->num_vmdq_vport + 1; j++) {
for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
vport[j].rss_indirection_tbl[i] = vport[j].rss_indirection_tbl[i] =
i % vport[j].alloc_rss_size; i % vport[j].alloc_rss_size;
} }
} }
static void hclge_rss_init_cfg(struct hclge_dev *hdev) static int hclge_rss_init_cfg(struct hclge_dev *hdev)
{ {
u16 rss_ind_tbl_size = hdev->ae_dev->dev_specs.rss_ind_tbl_size;
int i, rss_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; int i, rss_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
struct hclge_vport *vport = hdev->vport; struct hclge_vport *vport = hdev->vport;
...@@ -4718,6 +4719,8 @@ static void hclge_rss_init_cfg(struct hclge_dev *hdev) ...@@ -4718,6 +4719,8 @@ static void hclge_rss_init_cfg(struct hclge_dev *hdev)
rss_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; rss_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
u16 *rss_ind_tbl;
vport[i].rss_tuple_sets.ipv4_tcp_en = vport[i].rss_tuple_sets.ipv4_tcp_en =
HCLGE_RSS_INPUT_TUPLE_OTHER; HCLGE_RSS_INPUT_TUPLE_OTHER;
vport[i].rss_tuple_sets.ipv4_udp_en = vport[i].rss_tuple_sets.ipv4_udp_en =
...@@ -4739,11 +4742,19 @@ static void hclge_rss_init_cfg(struct hclge_dev *hdev) ...@@ -4739,11 +4742,19 @@ static void hclge_rss_init_cfg(struct hclge_dev *hdev)
vport[i].rss_algo = rss_algo; vport[i].rss_algo = rss_algo;
rss_ind_tbl = devm_kcalloc(&hdev->pdev->dev, rss_ind_tbl_size,
sizeof(*rss_ind_tbl), GFP_KERNEL);
if (!rss_ind_tbl)
return -ENOMEM;
vport[i].rss_indirection_tbl = rss_ind_tbl;
memcpy(vport[i].rss_hash_key, hclge_hash_key, memcpy(vport[i].rss_hash_key, hclge_hash_key,
HCLGE_RSS_KEY_SIZE); HCLGE_RSS_KEY_SIZE);
} }
hclge_rss_indir_init_cfg(hdev); hclge_rss_indir_init_cfg(hdev);
return 0;
} }
int hclge_bind_ring_with_vector(struct hclge_vport *vport, int hclge_bind_ring_with_vector(struct hclge_vport *vport,
...@@ -10581,7 +10592,12 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -10581,7 +10592,12 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
goto err_mdiobus_unreg; goto err_mdiobus_unreg;
} }
hclge_rss_init_cfg(hdev); ret = hclge_rss_init_cfg(hdev);
if (ret) {
dev_err(&pdev->dev, "failed to init rss cfg, ret = %d\n", ret);
goto err_mdiobus_unreg;
}
ret = hclge_rss_init_hw(hdev); ret = hclge_rss_init_hw(hdev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret); dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret);
...@@ -11072,6 +11088,7 @@ static void hclge_get_tqps_and_rss_info(struct hnae3_handle *handle, ...@@ -11072,6 +11088,7 @@ static void hclge_get_tqps_and_rss_info(struct hnae3_handle *handle,
static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num,
bool rxfh_configured) bool rxfh_configured)
{ {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
u16 tc_offset[HCLGE_MAX_TC_NUM] = {0}; u16 tc_offset[HCLGE_MAX_TC_NUM] = {0};
...@@ -11115,11 +11132,12 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, ...@@ -11115,11 +11132,12 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num,
goto out; goto out;
/* Reinitializes the rss indirect table according to the new RSS size */ /* Reinitializes the rss indirect table according to the new RSS size */
rss_indir = kcalloc(HCLGE_RSS_IND_TBL_SIZE, sizeof(u32), GFP_KERNEL); rss_indir = kcalloc(ae_dev->dev_specs.rss_ind_tbl_size, sizeof(u32),
GFP_KERNEL);
if (!rss_indir) if (!rss_indir)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++)
rss_indir[i] = i % kinfo->rss_size; rss_indir[i] = i % kinfo->rss_size;
ret = hclge_set_rss(handle, rss_indir, NULL, 0); ret = hclge_set_rss(handle, rss_indir, NULL, 0);
...@@ -11799,7 +11817,6 @@ static const struct hnae3_ae_ops hclge_ops = { ...@@ -11799,7 +11817,6 @@ static const struct hnae3_ae_ops hclge_ops = {
.get_fec = hclge_get_fec, .get_fec = hclge_get_fec,
.set_fec = hclge_set_fec, .set_fec = hclge_set_fec,
.get_rss_key_size = hclge_get_rss_key_size, .get_rss_key_size = hclge_get_rss_key_size,
.get_rss_indir_size = hclge_get_rss_indir_size,
.get_rss = hclge_get_rss, .get_rss = hclge_get_rss,
.set_rss = hclge_set_rss, .set_rss = hclge_set_rss,
.set_rss_tuple = hclge_set_rss_tuple, .set_rss_tuple = hclge_set_rss_tuple,
......
...@@ -97,8 +97,6 @@ ...@@ -97,8 +97,6 @@
#define HCLGE_RSS_HASH_ALGO_SIMPLE 1 #define HCLGE_RSS_HASH_ALGO_SIMPLE 1
#define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2 #define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2
#define HCLGE_RSS_HASH_ALGO_MASK GENMASK(3, 0) #define HCLGE_RSS_HASH_ALGO_MASK GENMASK(3, 0)
#define HCLGE_RSS_CFG_TBL_NUM \
(HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE)
#define HCLGE_RSS_INPUT_TUPLE_OTHER GENMASK(3, 0) #define HCLGE_RSS_INPUT_TUPLE_OTHER GENMASK(3, 0)
#define HCLGE_RSS_INPUT_TUPLE_SCTP GENMASK(4, 0) #define HCLGE_RSS_INPUT_TUPLE_SCTP GENMASK(4, 0)
...@@ -922,7 +920,7 @@ struct hclge_vport { ...@@ -922,7 +920,7 @@ struct hclge_vport {
u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */ u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */
/* User configured lookup table entries */ /* User configured lookup table entries */
u16 rss_indirection_tbl[HCLGE_RSS_IND_TBL_SIZE]; u16 *rss_indirection_tbl;
int rss_algo; /* User configured hash algorithm */ int rss_algo; /* User configured hash algorithm */
/* User configured rss tuple sets */ /* User configured rss tuple sets */
struct hclge_rss_tuple_cfg rss_tuple_sets; struct hclge_rss_tuple_cfg rss_tuple_sets;
......
...@@ -642,22 +642,20 @@ static u32 hclgevf_get_rss_key_size(struct hnae3_handle *handle) ...@@ -642,22 +642,20 @@ static u32 hclgevf_get_rss_key_size(struct hnae3_handle *handle)
return HCLGEVF_RSS_KEY_SIZE; return HCLGEVF_RSS_KEY_SIZE;
} }
static u32 hclgevf_get_rss_indir_size(struct hnae3_handle *handle)
{
return HCLGEVF_RSS_IND_TBL_SIZE;
}
static int hclgevf_set_rss_indir_table(struct hclgevf_dev *hdev) static int hclgevf_set_rss_indir_table(struct hclgevf_dev *hdev)
{ {
const u8 *indir = hdev->rss_cfg.rss_indirection_tbl; const u8 *indir = hdev->rss_cfg.rss_indirection_tbl;
struct hclgevf_rss_indirection_table_cmd *req; struct hclgevf_rss_indirection_table_cmd *req;
struct hclgevf_desc desc; struct hclgevf_desc desc;
int rss_cfg_tbl_num;
int status; int status;
int i, j; int i, j;
req = (struct hclgevf_rss_indirection_table_cmd *)desc.data; req = (struct hclgevf_rss_indirection_table_cmd *)desc.data;
rss_cfg_tbl_num = hdev->ae_dev->dev_specs.rss_ind_tbl_size /
HCLGEVF_RSS_CFG_TBL_SIZE;
for (i = 0; i < HCLGEVF_RSS_CFG_TBL_NUM; i++) { for (i = 0; i < rss_cfg_tbl_num; i++) {
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_INDIR_TABLE, hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_INDIR_TABLE,
false); false);
req->start_table_index = i * HCLGEVF_RSS_CFG_TBL_SIZE; req->start_table_index = i * HCLGEVF_RSS_CFG_TBL_SIZE;
...@@ -795,7 +793,7 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, ...@@ -795,7 +793,7 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key,
} }
if (indir) if (indir)
for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
indir[i] = rss_cfg->rss_indirection_tbl[i]; indir[i] = rss_cfg->rss_indirection_tbl[i];
return 0; return 0;
...@@ -838,7 +836,7 @@ static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, ...@@ -838,7 +836,7 @@ static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir,
} }
/* update the shadow RSS table with user specified qids */ /* update the shadow RSS table with user specified qids */
for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
rss_cfg->rss_indirection_tbl[i] = indir[i]; rss_cfg->rss_indirection_tbl[i] = indir[i];
/* update the hardware */ /* update the hardware */
...@@ -2482,8 +2480,9 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev, bool en) ...@@ -2482,8 +2480,9 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev, bool en)
return ret; return ret;
} }
static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev) static int hclgevf_rss_init_cfg(struct hclgevf_dev *hdev)
{ {
u16 rss_ind_tbl_size = hdev->ae_dev->dev_specs.rss_ind_tbl_size;
struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg;
struct hclgevf_rss_tuple_cfg *tuple_sets; struct hclgevf_rss_tuple_cfg *tuple_sets;
u32 i; u32 i;
...@@ -2492,7 +2491,16 @@ static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev) ...@@ -2492,7 +2491,16 @@ static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev)
rss_cfg->rss_size = hdev->nic.kinfo.rss_size; rss_cfg->rss_size = hdev->nic.kinfo.rss_size;
tuple_sets = &rss_cfg->rss_tuple_sets; tuple_sets = &rss_cfg->rss_tuple_sets;
if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
u8 *rss_ind_tbl;
rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE;
rss_ind_tbl = devm_kcalloc(&hdev->pdev->dev, rss_ind_tbl_size,
sizeof(*rss_ind_tbl), GFP_KERNEL);
if (!rss_ind_tbl)
return -ENOMEM;
rss_cfg->rss_indirection_tbl = rss_ind_tbl;
memcpy(rss_cfg->rss_hash_key, hclgevf_hash_key, memcpy(rss_cfg->rss_hash_key, hclgevf_hash_key,
HCLGEVF_RSS_KEY_SIZE); HCLGEVF_RSS_KEY_SIZE);
...@@ -2510,8 +2518,10 @@ static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev) ...@@ -2510,8 +2518,10 @@ static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev)
} }
/* Initialize RSS indirect table */ /* Initialize RSS indirect table */
for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) for (i = 0; i < rss_ind_tbl_size; i++)
rss_cfg->rss_indirection_tbl[i] = i % rss_cfg->rss_size; rss_cfg->rss_indirection_tbl[i] = i % rss_cfg->rss_size;
return 0;
} }
static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
...@@ -3266,7 +3276,12 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) ...@@ -3266,7 +3276,12 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
goto err_config; goto err_config;
/* Initialize RSS for this VF */ /* Initialize RSS for this VF */
hclgevf_rss_init_cfg(hdev); ret = hclgevf_rss_init_cfg(hdev);
if (ret) {
dev_err(&pdev->dev, "failed to init rss cfg, ret = %d\n", ret);
goto err_config;
}
ret = hclgevf_rss_init_hw(hdev); ret = hclgevf_rss_init_hw(hdev);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
...@@ -3444,11 +3459,12 @@ static int hclgevf_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, ...@@ -3444,11 +3459,12 @@ static int hclgevf_set_channels(struct hnae3_handle *handle, u32 new_tqps_num,
goto out; goto out;
/* Reinitializes the rss indirect table according to the new RSS size */ /* Reinitializes the rss indirect table according to the new RSS size */
rss_indir = kcalloc(HCLGEVF_RSS_IND_TBL_SIZE, sizeof(u32), GFP_KERNEL); rss_indir = kcalloc(hdev->ae_dev->dev_specs.rss_ind_tbl_size,
sizeof(u32), GFP_KERNEL);
if (!rss_indir) if (!rss_indir)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
rss_indir[i] = i % kinfo->rss_size; rss_indir[i] = i % kinfo->rss_size;
hdev->rss_cfg.rss_size = kinfo->rss_size; hdev->rss_cfg.rss_size = kinfo->rss_size;
...@@ -3687,7 +3703,6 @@ static const struct hnae3_ae_ops hclgevf_ops = { ...@@ -3687,7 +3703,6 @@ static const struct hnae3_ae_ops hclgevf_ops = {
.get_strings = hclgevf_get_strings, .get_strings = hclgevf_get_strings,
.get_sset_count = hclgevf_get_sset_count, .get_sset_count = hclgevf_get_sset_count,
.get_rss_key_size = hclgevf_get_rss_key_size, .get_rss_key_size = hclgevf_get_rss_key_size,
.get_rss_indir_size = hclgevf_get_rss_indir_size,
.get_rss = hclgevf_get_rss, .get_rss = hclgevf_get_rss,
.set_rss = hclgevf_set_rss, .set_rss = hclgevf_set_rss,
.get_rss_tuple = hclgevf_get_rss_tuple, .get_rss_tuple = hclgevf_get_rss_tuple,
......
...@@ -113,8 +113,7 @@ ...@@ -113,8 +113,7 @@
#define HCLGEVF_RSS_HASH_ALGO_SIMPLE 1 #define HCLGEVF_RSS_HASH_ALGO_SIMPLE 1
#define HCLGEVF_RSS_HASH_ALGO_SYMMETRIC 2 #define HCLGEVF_RSS_HASH_ALGO_SYMMETRIC 2
#define HCLGEVF_RSS_HASH_ALGO_MASK 0xf #define HCLGEVF_RSS_HASH_ALGO_MASK 0xf
#define HCLGEVF_RSS_CFG_TBL_NUM \
(HCLGEVF_RSS_IND_TBL_SIZE / HCLGEVF_RSS_CFG_TBL_SIZE)
#define HCLGEVF_RSS_INPUT_TUPLE_OTHER GENMASK(3, 0) #define HCLGEVF_RSS_INPUT_TUPLE_OTHER GENMASK(3, 0)
#define HCLGEVF_RSS_INPUT_TUPLE_SCTP GENMASK(4, 0) #define HCLGEVF_RSS_INPUT_TUPLE_SCTP GENMASK(4, 0)
#define HCLGEVF_D_PORT_BIT BIT(0) #define HCLGEVF_D_PORT_BIT BIT(0)
...@@ -217,7 +216,8 @@ struct hclgevf_rss_cfg { ...@@ -217,7 +216,8 @@ struct hclgevf_rss_cfg {
u32 hash_algo; u32 hash_algo;
u32 rss_size; u32 rss_size;
u8 hw_tc_map; u8 hw_tc_map;
u8 rss_indirection_tbl[HCLGEVF_RSS_IND_TBL_SIZE]; /* shadow table */ /* shadow table */
u8 *rss_indirection_tbl;
struct hclgevf_rss_tuple_cfg rss_tuple_sets; struct hclgevf_rss_tuple_cfg rss_tuple_sets;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment