提交 30714f1f 编写于 作者: S shenhao 提交者: Yang Yingliang

net: hns3: clean up some coding style issue

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

--------------------------------------------

An enum type parameter is passed to hclge_set_fd_key_config(),
so "stage" should be declared as "enum".

Parameter of "tuple_size" is from "key_length", which with type of
"u8", so modify "tuple_size" to "u8" would be modre better

This patch also cleanup some unnecessary blank lines, redundant
parentheses.
Signed-off-by: NGuojia Liao <liaoguojia@huawei.com>
Signed-off-by: Nshenhao <shenhao21@huawei.com>
Reviewed-by: NZhong Zhaohui <zhongzhaohui@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2f745103
......@@ -4943,7 +4943,8 @@ static int hclge_get_fd_allocation(struct hclge_dev *hdev,
return ret;
}
static int hclge_set_fd_key_config(struct hclge_dev *hdev, int stage_num)
static int hclge_set_fd_key_config(struct hclge_dev *hdev,
enum HCLGE_FD_STAGE stage_num)
{
struct hclge_set_fd_key_config_cmd *req;
struct hclge_fd_key_cfg *stage;
......@@ -5286,8 +5287,9 @@ static int hclge_config_key(struct hclge_dev *hdev, u8 stage,
u8 key_x[MAX_KEY_BYTES], key_y[MAX_KEY_BYTES];
u8 *cur_key_x, *cur_key_y;
unsigned int i;
int ret, tuple_size;
int ret;
u8 meta_data_region;
u8 tuple_size;
memset(key_x, 0, sizeof(key_x));
memset(key_y, 0, sizeof(key_y));
......@@ -5505,7 +5507,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev,
struct ethtool_rx_flow_spec *fs,
u32 *unused_tuple)
{
if ((fs->flow_type & FLOW_EXT)) {
if (fs->flow_type & FLOW_EXT) {
if (fs->h_ext.vlan_etype)
return -EOPNOTSUPP;
if (!fs->h_ext.vlan_tci)
......@@ -5526,7 +5528,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev,
if (is_zero_ether_addr(fs->h_ext.h_dest))
*unused_tuple |= BIT(INNER_DST_MAC);
else
*unused_tuple &= ~(BIT(INNER_DST_MAC));
*unused_tuple &= ~BIT(INNER_DST_MAC);
}
return 0;
......@@ -5797,7 +5799,7 @@ static int hclge_fd_get_tuple(struct hclge_dev *hdev,
break;
}
if ((fs->flow_type & FLOW_EXT)) {
if (fs->flow_type & FLOW_EXT) {
rule->tuples.vlan_tag1 = be16_to_cpu(fs->h_ext.vlan_tci);
rule->tuples_mask.vlan_tag1 = be16_to_cpu(fs->m_ext.vlan_tci);
}
......@@ -5908,7 +5910,6 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
}
rule->flow_type = fs->flow_type;
rule->location = fs->location;
rule->unused_tuple = unused;
rule->vf_id = dst_vport_id;
......@@ -6407,14 +6408,12 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
bit_id = find_first_zero_bit(hdev->fd_bmap, MAX_FD_FILTER_NUM);
if (bit_id >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) {
spin_unlock_bh(&hdev->fd_rule_lock);
return -ENOSPC;
}
rule = kzalloc(sizeof(*rule), GFP_ATOMIC);
if (!rule) {
spin_unlock_bh(&hdev->fd_rule_lock);
return -ENOMEM;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册