Skip to content

Commit

Permalink
net/hns3: support RSS
Browse files Browse the repository at this point in the history
This patch adds support for RSS of hns3 PMD driver. It included the
follow functions:
In file hns3_rss.c:
1) Set/query hash key, rss_hf by .rss_hash_update/.rss_hash_conf_get ops
   callback functions.
2) Set/query redirection table by .reta_update/.reta_query. ops callback
   functions.
3) Set/query hash algorithm by .filter_ctrl ops callback function when
   the 'filter_type' is RTE_ETH_FILTER_HASH.

In file hns3_flow.c:
1) Set hash key, rss_hf, redirection table and algorithm by .create ops
   callback function.
2) Disable RSS by .destroy or .flush ops callback function.
3) Check the effectiveness of the RSS's configuration by .validate ops
   callback function.

Signed-off-by: Hao Chen <chenhao164@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
xavierhw authored and Ferruh Yigit committed Oct 7, 2019
1 parent fcba820 commit c37ca66
Show file tree
Hide file tree
Showing 9 changed files with 1,190 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/guides/nics/features/hns3.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Link status = Y
MTU update = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
RSS hash = Y
RSS key update = Y
RSS reta update = Y
Flow director = Y
Flow API = Y
FW version = Y
Expand Down
1 change: 1 addition & 0 deletions drivers/net/hns3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LIBABIVER := 1
#
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_cmd.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_rss.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_fdir.c

Expand Down
11 changes: 11 additions & 0 deletions drivers/net/hns3/hns3_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,10 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)

info->vmdq_queue_num = 0;

info->reta_size = HNS3_RSS_IND_TBL_SIZE;
info->hash_key_size = HNS3_RSS_KEY_SIZE;
info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT;

info->default_rxportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE;
info->default_txportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE;
info->default_rxportconf.nb_queues = HNS3_DEFAULT_PORT_CONF_QUEUES_NUM;
Expand Down Expand Up @@ -2572,6 +2576,8 @@ hns3_init_pf(struct rte_eth_dev *eth_dev)
goto err_hw_init;
}

hns3_set_default_rss_args(hw);

return 0;

err_hw_init:
Expand All @@ -2597,6 +2603,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev)

PMD_INIT_FUNC_TRACE();

hns3_rss_uninit(hns);
hns3_fdir_filter_uninit(hns);
hns3_uninit_umv_space(hw);
hns3_cmd_uninit(hw);
Expand Down Expand Up @@ -2630,6 +2637,10 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
.mac_addr_set = hns3_set_default_mac_addr,
.set_mc_addr_list = hns3_set_mc_mac_addr_list,
.link_update = hns3_dev_link_update,
.rss_hash_update = hns3_dev_rss_hash_update,
.rss_hash_conf_get = hns3_dev_rss_hash_conf_get,
.reta_update = hns3_dev_rss_reta_update,
.reta_query = hns3_dev_rss_reta_query,
.filter_ctrl = hns3_dev_filter_ctrl,
};

Expand Down
4 changes: 4 additions & 0 deletions drivers/net/hns3/hns3_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <rte_alarm.h>

#include "hns3_cmd.h"
#include "hns3_rss.h"
#include "hns3_fdir.h"

/* Vendor ID */
Expand Down Expand Up @@ -346,6 +347,9 @@ struct hns3_hw {
struct rte_ether_addr mc_addrs[HNS3_MC_MACADDR_NUM];
int mc_addrs_num; /* Multicast mac addresses number */

/* The configuration info of RSS */
struct hns3_rss_conf rss_info;

uint8_t num_tc; /* Total number of enabled TCs */
uint8_t hw_tc_map;
enum hns3_fc_mode current_mode;
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/hns3/hns3_fdir.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,25 @@ struct hns3_fdir_rule_ele {
struct hns3_fdir_rule fdir_conf;
};

/* rss filter list structure */
struct hns3_rss_conf_ele {
TAILQ_ENTRY(hns3_rss_conf_ele) entries;
struct hns3_rss_conf filter_info;
};

/* hns3_flow memory list structure */
struct hns3_flow_mem {
TAILQ_ENTRY(hns3_flow_mem) entries;
struct rte_flow *flow;
};

TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele);
TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);

struct hns3_process_private {
struct hns3_fdir_rule_list fdir_list;
struct hns3_rss_filter_list filter_rss_list;
struct hns3_flow_mem_list flow_list;
};

Expand Down
Loading

0 comments on commit c37ca66

Please sign in to comment.