Commit 7347255e authored by Jie Wang's avatar Jie Wang Committed by David S. Miller

net: hns3: refactor PF rss get APIs with new common rss get APIs

This patch firstly uses new rss parameter struct(hclge_comm_rss_cfg) as
child member of hclge_dev and deletes the original child rss parameter
members in vport. All the vport child rss parameter members used in PF rss
module is modified according to the new hclge_comm_rss_cfg.

Secondly PF rss get APIs are refactored to use new common rss get APIs. The
old rss get APIs in PF are deleted.
Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1bfd6682
...@@ -203,7 +203,7 @@ static int hclge_map_update(struct hclge_dev *hdev) ...@@ -203,7 +203,7 @@ static int hclge_map_update(struct hclge_dev *hdev)
if (ret) if (ret)
return ret; return ret;
hclge_rss_indir_init_cfg(hdev); hclge_comm_rss_indir_init_cfg(hdev->ae_dev, &hdev->rss_cfg);
return hclge_rss_init_hw(hdev); return hclge_rss_init_hw(hdev);
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "hclge_cmd.h" #include "hclge_cmd.h"
#include "hclge_ptp.h" #include "hclge_ptp.h"
#include "hnae3.h" #include "hnae3.h"
#include "hclge_comm_rss.h"
#define HCLGE_MOD_VERSION "1.0" #define HCLGE_MOD_VERSION "1.0"
#define HCLGE_DRIVER_NAME "hclge" #define HCLGE_DRIVER_NAME "hclge"
...@@ -968,6 +969,7 @@ struct hclge_dev { ...@@ -968,6 +969,7 @@ struct hclge_dev {
cpumask_t affinity_mask; cpumask_t affinity_mask;
struct hclge_ptp *ptp; struct hclge_ptp *ptp;
struct devlink *devlink; struct devlink *devlink;
struct hclge_comm_rss_cfg rss_cfg;
}; };
/* VPort level vlan tag configuration for TX direction */ /* VPort level vlan tag configuration for TX direction */
...@@ -994,17 +996,6 @@ struct hclge_rx_vtag_cfg { ...@@ -994,17 +996,6 @@ struct hclge_rx_vtag_cfg {
bool strip_tag2_discard_en; /* Outer vlan tag discard for BD enable */ bool strip_tag2_discard_en; /* Outer vlan tag discard for BD enable */
}; };
struct hclge_rss_tuple_cfg {
u8 ipv4_tcp_en;
u8 ipv4_udp_en;
u8 ipv4_sctp_en;
u8 ipv4_fragment_en;
u8 ipv6_tcp_en;
u8 ipv6_udp_en;
u8 ipv6_sctp_en;
u8 ipv6_fragment_en;
};
enum HCLGE_VPORT_STATE { enum HCLGE_VPORT_STATE {
HCLGE_VPORT_STATE_ALIVE, HCLGE_VPORT_STATE_ALIVE,
HCLGE_VPORT_STATE_MAC_TBL_CHANGE, HCLGE_VPORT_STATE_MAC_TBL_CHANGE,
...@@ -1038,15 +1029,6 @@ struct hclge_vf_info { ...@@ -1038,15 +1029,6 @@ struct hclge_vf_info {
struct hclge_vport { struct hclge_vport {
u16 alloc_tqps; /* Allocated Tx/Rx queues */ u16 alloc_tqps; /* Allocated Tx/Rx queues */
u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */
/* User configured lookup table entries */
u16 *rss_indirection_tbl;
int rss_algo; /* User configured hash algorithm */
/* User configured rss tuple sets */
struct hclge_rss_tuple_cfg rss_tuple_sets;
u16 alloc_rss_size;
u16 qs_offset; u16 qs_offset;
u32 bw_limit; /* VSI BW Limit (0 = disabled) */ u32 bw_limit; /* VSI BW Limit (0 = disabled) */
u8 dwrr; u8 dwrr;
...@@ -1125,7 +1107,6 @@ int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable); ...@@ -1125,7 +1107,6 @@ int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable);
int hclge_buffer_alloc(struct hclge_dev *hdev); int hclge_buffer_alloc(struct hclge_dev *hdev);
int hclge_rss_init_hw(struct hclge_dev *hdev); int hclge_rss_init_hw(struct hclge_dev *hdev);
void hclge_rss_indir_init_cfg(struct hclge_dev *hdev);
void hclge_mbx_handler(struct hclge_dev *hdev); void hclge_mbx_handler(struct hclge_dev *hdev);
int hclge_reset_tqp(struct hnae3_handle *handle); int hclge_reset_tqp(struct hnae3_handle *handle);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "hclge_main.h" #include "hclge_main.h"
#include "hclge_mbx.h" #include "hclge_mbx.h"
#include "hnae3.h" #include "hnae3.h"
#include "hclge_comm_rss.h"
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include "hclge_trace.h" #include "hclge_trace.h"
...@@ -612,15 +613,17 @@ static void hclge_get_rss_key(struct hclge_vport *vport, ...@@ -612,15 +613,17 @@ static void hclge_get_rss_key(struct hclge_vport *vport,
{ {
#define HCLGE_RSS_MBX_RESP_LEN 8 #define HCLGE_RSS_MBX_RESP_LEN 8
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_comm_rss_cfg *rss_cfg;
u8 index; u8 index;
index = mbx_req->msg.data[0]; index = mbx_req->msg.data[0];
rss_cfg = &hdev->rss_cfg;
/* Check the query index of rss_hash_key from VF, make sure no /* Check the query index of rss_hash_key from VF, make sure no
* more than the size of rss_hash_key. * more than the size of rss_hash_key.
*/ */
if (((index + 1) * HCLGE_RSS_MBX_RESP_LEN) > if (((index + 1) * HCLGE_RSS_MBX_RESP_LEN) >
sizeof(vport[0].rss_hash_key)) { sizeof(rss_cfg->rss_hash_key)) {
dev_warn(&hdev->pdev->dev, dev_warn(&hdev->pdev->dev,
"failed to get the rss hash key, the index(%u) invalid !\n", "failed to get the rss hash key, the index(%u) invalid !\n",
index); index);
...@@ -628,7 +631,7 @@ static void hclge_get_rss_key(struct hclge_vport *vport, ...@@ -628,7 +631,7 @@ static void hclge_get_rss_key(struct hclge_vport *vport,
} }
memcpy(resp_msg->data, memcpy(resp_msg->data,
&hdev->vport[0].rss_hash_key[index * HCLGE_RSS_MBX_RESP_LEN], &rss_cfg->rss_hash_key[index * HCLGE_RSS_MBX_RESP_LEN],
HCLGE_RSS_MBX_RESP_LEN); HCLGE_RSS_MBX_RESP_LEN);
resp_msg->len = HCLGE_RSS_MBX_RESP_LEN; resp_msg->len = HCLGE_RSS_MBX_RESP_LEN;
} }
......
...@@ -678,8 +678,8 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) ...@@ -678,8 +678,8 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
hclge_tm_update_kinfo_rss_size(vport); hclge_tm_update_kinfo_rss_size(vport);
kinfo->num_tqps = hclge_vport_get_tqp_num(vport); kinfo->num_tqps = hclge_vport_get_tqp_num(vport);
vport->dwrr = 100; /* 100 percent as init */ vport->dwrr = 100; /* 100 percent as init */
vport->alloc_rss_size = kinfo->rss_size;
vport->bw_limit = hdev->tm_info.pg_info[0].bw_limit; vport->bw_limit = hdev->tm_info.pg_info[0].bw_limit;
hdev->rss_cfg.rss_size = kinfo->rss_size;
/* when enable mqprio, the tc_info has been updated. */ /* when enable mqprio, the tc_info has been updated. */
if (kinfo->tc_info.mqprio_active) if (kinfo->tc_info.mqprio_active)
......
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