git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus/fslmc: update MC FW to 10.28
[dpdk.git]
/
drivers
/
net
/
hns3
/
hns3_rss.c
diff --git
a/drivers/net/hns3/hns3_rss.c
b/drivers/net/hns3/hns3_rss.c
index
a8b8143
..
3a81e90
100644
(file)
--- a/
drivers/net/hns3/hns3_rss.c
+++ b/
drivers/net/hns3/hns3_rss.c
@@
-1,13
+1,10
@@
/* SPDX-License-Identifier: BSD-3-Clause
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018-20
19 His
ilicon Limited.
+ * Copyright(c) 2018-20
21 HiS
ilicon Limited.
*/
*/
-#include <stdbool.h>
#include <rte_ethdev.h>
#include <rte_io.h>
#include <rte_malloc.h>
#include <rte_ethdev.h>
#include <rte_io.h>
#include <rte_malloc.h>
-#include <rte_memcpy.h>
-#include <rte_spinlock.h>
#include "hns3_ethdev.h"
#include "hns3_logs.h"
#include "hns3_ethdev.h"
#include "hns3_logs.h"
@@
-61,8
+58,10
@@
enum hns3_tuple_field {
HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D,
HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S,
HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D,
HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S,
- /* IPV6_UDP ENABLE FIELD */
- HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D = 50,
+ /* IPV6_SCTP ENABLE FIELD */
+ HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D = 48,
+ HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S,
+ HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D,
HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S,
HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER,
HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S,
HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER,
@@
-133,6
+132,10
@@
static const struct {
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) },
{ ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L3_DST_ONLY,
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) },
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) },
{ ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L3_DST_ONLY,
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) },
+ { ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L4_SRC_ONLY,
+ BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) },
+ { ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L4_DST_ONLY,
+ BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) },
{ ETH_RSS_NONFRAG_IPV6_OTHER | ETH_RSS_L3_SRC_ONLY,
BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) },
{ ETH_RSS_NONFRAG_IPV6_OTHER | ETH_RSS_L3_DST_ONLY,
{ ETH_RSS_NONFRAG_IPV6_OTHER | ETH_RSS_L3_SRC_ONLY,
BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) },
{ ETH_RSS_NONFRAG_IPV6_OTHER | ETH_RSS_L3_DST_ONLY,
@@
-177,6
+180,8
@@
static const struct {
BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) },
{ ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) |
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) |
BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) },
{ ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) |
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) |
+ BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) |
+ BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) |
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) },
{ ETH_RSS_NONFRAG_IPV6_OTHER,
BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) |
BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) },
{ ETH_RSS_NONFRAG_IPV6_OTHER,
BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) |
@@
-188,7
+193,7
@@
static const struct {
* Used to set algorithm, key_offset and hash key of rss.
*/
int
* Used to set algorithm, key_offset and hash key of rss.
*/
int
-hns3_
set_rss
_algo_key(struct hns3_hw *hw, const uint8_t *key)
+hns3_
rss_set
_algo_key(struct hns3_hw *hw, const uint8_t *key)
{
#define HNS3_KEY_OFFSET_MAX 3
#define HNS3_SET_HASH_KEY_BYTE_FOUR 2
{
#define HNS3_KEY_OFFSET_MAX 3
#define HNS3_SET_HASH_KEY_BYTE_FOUR 2
@@
-240,7
+245,7
@@
hns3_set_rss_algo_key(struct hns3_hw *hw, const uint8_t *key)
* Used to configure the tuple selection for RSS hash input.
*/
static int
* Used to configure the tuple selection for RSS hash input.
*/
static int
-hns3_
set_rss
_input_tuple(struct hns3_hw *hw)
+hns3_
rss_set
_input_tuple(struct hns3_hw *hw)
{
struct hns3_rss_conf *rss_config = &hw->rss_info;
struct hns3_rss_input_tuple_cmd *req;
{
struct hns3_rss_conf *rss_config = &hw->rss_info;
struct hns3_rss_input_tuple_cmd *req;
@@
-307,7
+312,7
@@
hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, uint16_t size)
/* Update redirection table of hw */
memcpy(hw->rss_info.rss_indirection_tbl, indir,
/* Update redirection table of hw */
memcpy(hw->rss_info.rss_indirection_tbl, indir,
- sizeof(
hw->rss_info.rss_indirection_tbl)
);
+ sizeof(
uint16_t) * size
);
return 0;
}
return 0;
}
@@
-319,13
+324,13
@@
hns3_rss_reset_indir_table(struct hns3_hw *hw)
int ret;
lut = rte_zmalloc("hns3_rss_lut",
int ret;
lut = rte_zmalloc("hns3_rss_lut",
-
HNS3_RSS_IND_TBL_SIZE
* sizeof(uint16_t), 0);
+
hw->rss_ind_tbl_size
* sizeof(uint16_t), 0);
if (lut == NULL) {
hns3_err(hw, "No hns3_rss_lut memory can be allocated");
return -ENOMEM;
}
if (lut == NULL) {
hns3_err(hw, "No hns3_rss_lut memory can be allocated");
return -ENOMEM;
}
- ret = hns3_set_rss_indir_table(hw, lut,
HNS3_RSS_IND_TBL_SIZE
);
+ ret = hns3_set_rss_indir_table(hw, lut,
hw->rss_ind_tbl_size
);
if (ret)
hns3_err(hw, "RSS uninit indir table failed: %d", ret);
rte_free(lut);
if (ret)
hns3_err(hw, "RSS uninit indir table failed: %d", ret);
rte_free(lut);
@@
-423,7
+428,7
@@
hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
} else if (rss_hf && rss_cfg->conf.types == 0) {
/* Enable RSS, restore indirection table by hw's config */
ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
} else if (rss_hf && rss_cfg->conf.types == 0) {
/* Enable RSS, restore indirection table by hw's config */
ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
-
HNS3_RSS_IND_TBL_SIZE
);
+
hw->rss_ind_tbl_size
);
if (ret)
goto conf_err;
}
if (ret)
goto conf_err;
}
@@
-438,7
+443,7
@@
hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
ret = -EINVAL;
goto conf_err;
}
ret = -EINVAL;
goto conf_err;
}
- ret = hns3_
set_rss
_algo_key(hw, key);
+ ret = hns3_
rss_set
_algo_key(hw, key);
if (ret)
goto conf_err;
}
if (ret)
goto conf_err;
}
@@
-500,30
+505,29
@@
hns3_dev_rss_reta_update(struct rte_eth_dev *dev,
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
- uint16_t i
, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */
- uint16_t i
ndirection_tbl[HNS3_RSS_IND_TBL_SIZE]
;
- uint16_t i
dx, shift, allow_rss_queues
;
+ uint16_t i
ndirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX];
+ uint16_t i
dx, shift
;
+ uint16_t i;
int ret;
int ret;
- if (reta_size !=
indir_size || reta_size > ETH_RSS_RETA_SIZE_512
) {
+ if (reta_size !=
hw->rss_ind_tbl_size
) {
hns3_err(hw, "The size of hash lookup table configured (%u)"
"doesn't match the number hardware can supported"
hns3_err(hw, "The size of hash lookup table configured (%u)"
"doesn't match the number hardware can supported"
- "(%u)", reta_size,
indir
_size);
+ "(%u)", reta_size,
hw->rss_ind_tbl
_size);
return -EINVAL;
}
rte_spinlock_lock(&hw->lock);
memcpy(indirection_tbl, rss_cfg->rss_indirection_tbl,
sizeof(rss_cfg->rss_indirection_tbl));
return -EINVAL;
}
rte_spinlock_lock(&hw->lock);
memcpy(indirection_tbl, rss_cfg->rss_indirection_tbl,
sizeof(rss_cfg->rss_indirection_tbl));
- allow_rss_queues = RTE_MIN(dev->data->nb_rx_queues, hw->rss_size_max);
for (i = 0; i < reta_size; i++) {
idx = i / RTE_RETA_GROUP_SIZE;
shift = i % RTE_RETA_GROUP_SIZE;
for (i = 0; i < reta_size; i++) {
idx = i / RTE_RETA_GROUP_SIZE;
shift = i % RTE_RETA_GROUP_SIZE;
- if (reta_conf[idx].reta[shift] >=
allow_rss_queues
) {
+ if (reta_conf[idx].reta[shift] >=
hw->alloc_rss_size
) {
rte_spinlock_unlock(&hw->lock);
rte_spinlock_unlock(&hw->lock);
- hns3_err(hw, "
Invalid queue id(%u) to be set in
"
- "
redirection table, max number of rss "
-
"queues: %u",
reta_conf[idx].reta[shift],
-
allow_rss_queues
);
+ hns3_err(hw, "
queue id(%u) set to redirection table
"
+ "
exceeds queue number(%u) allocated to a TC",
+ reta_conf[idx].reta[shift],
+
hw->alloc_rss_size
);
return -EINVAL;
}
return -EINVAL;
}
@@
-532,7
+536,7
@@
hns3_dev_rss_reta_update(struct rte_eth_dev *dev,
}
ret = hns3_set_rss_indir_table(hw, indirection_tbl,
}
ret = hns3_set_rss_indir_table(hw, indirection_tbl,
-
HNS3_RSS_IND_TBL_SIZE
);
+
hw->rss_ind_tbl_size
);
rte_spinlock_unlock(&hw->lock);
return ret;
rte_spinlock_unlock(&hw->lock);
return ret;
@@
-557,13
+561,13
@@
hns3_dev_rss_reta_query(struct rte_eth_dev *dev,
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
- uint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */
uint16_t idx, shift;
uint16_t idx, shift;
+ uint16_t i;
- if (reta_size !=
indir_size || reta_size > ETH_RSS_RETA_SIZE_512
) {
+ if (reta_size !=
hw->rss_ind_tbl_size
) {
hns3_err(hw, "The size of hash lookup table configured (%u)"
" doesn't match the number hardware can supported"
hns3_err(hw, "The size of hash lookup table configured (%u)"
" doesn't match the number hardware can supported"
- "(%u)", reta_size,
indir
_size);
+ "(%u)", reta_size,
hw->rss_ind_tbl
_size);
return -EINVAL;
}
rte_spinlock_lock(&hw->lock);
return -EINVAL;
}
rte_spinlock_lock(&hw->lock);
@@
-629,16
+633,11
@@
hns3_set_rss_tc_mode(struct hns3_hw *hw)
static void
hns3_rss_tuple_uninit(struct hns3_hw *hw)
{
static void
hns3_rss_tuple_uninit(struct hns3_hw *hw)
{
- struct hns3_rss_input_tuple_cmd *req;
struct hns3_cmd_desc desc;
int ret;
hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false);
struct hns3_cmd_desc desc;
int ret;
hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false);
- req = (struct hns3_rss_input_tuple_cmd *)desc.data;
-
- memset(req, 0, sizeof(struct hns3_rss_tuple_cfg));
-
ret = hns3_cmd_send(hw, &desc, 1);
if (ret) {
hns3_err(hw, "RSS uninit tuple failed %d", ret);
ret = hns3_cmd_send(hw, &desc, 1);
if (ret) {
hns3_err(hw, "RSS uninit tuple failed %d", ret);
@@
-650,7
+649,7
@@
hns3_rss_tuple_uninit(struct hns3_hw *hw)
* Set the default rss configuration in the init of driver.
*/
void
* Set the default rss configuration in the init of driver.
*/
void
-hns3_
set_default_rss
_args(struct hns3_hw *hw)
+hns3_
rss_set_default
_args(struct hns3_hw *hw)
{
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
uint16_t queue_num = hw->alloc_rss_size;
{
struct hns3_rss_conf *rss_cfg = &hw->rss_info;
uint16_t queue_num = hw->alloc_rss_size;
@@
-663,7
+662,7
@@
hns3_set_default_rss_args(struct hns3_hw *hw)
memcpy(rss_cfg->key, hns3_hash_key, HNS3_RSS_KEY_SIZE);
/* Initialize RSS indirection table */
memcpy(rss_cfg->key, hns3_hash_key, HNS3_RSS_KEY_SIZE);
/* Initialize RSS indirection table */
- for (i = 0; i <
HNS3_RSS_IND_TBL_SIZE
; i++)
+ for (i = 0; i <
hw->rss_ind_tbl_size
; i++)
rss_cfg->rss_indirection_tbl[i] = i % queue_num;
}
rss_cfg->rss_indirection_tbl[i] = i % queue_num;
}
@@
-697,12
+696,12
@@
hns3_config_rss(struct hns3_adapter *hns)
hns3_rss_uninit(hns);
/* Configure RSS hash algorithm and hash key offset */
hns3_rss_uninit(hns);
/* Configure RSS hash algorithm and hash key offset */
- ret = hns3_
set_rss
_algo_key(hw, hash_key);
+ ret = hns3_
rss_set
_algo_key(hw, hash_key);
if (ret)
return ret;
/* Configure the tuple selection for RSS hash input */
if (ret)
return ret;
/* Configure the tuple selection for RSS hash input */
- ret = hns3_
set_rss
_input_tuple(hw);
+ ret = hns3_
rss_set
_input_tuple(hw);
if (ret)
return ret;
if (ret)
return ret;
@@
-712,7
+711,7
@@
hns3_config_rss(struct hns3_adapter *hns)
*/
if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) {
ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
*/
if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) {
ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,
-
HNS3_RSS_IND_TBL_SIZE
);
+
hw->rss_ind_tbl_size
);
if (ret)
goto rss_tuple_uninit;
}
if (ret)
goto rss_tuple_uninit;
}