uint8_t *key_x, uint8_t *key_y)
{
uint16_t meta_data = 0;
- uint16_t port_number;
+ uint32_t port_number;
uint8_t cur_pos = 0;
uint8_t tuple_size;
uint8_t shift_bits;
rule->key_conf.spec.tunnel_type ? 1 : 0);
cur_pos += tuple_size;
} else if (i == VLAN_NUMBER) {
- uint8_t vlan_tag;
+ uint32_t vlan_tag;
uint8_t vlan_num;
if (rule->key_conf.spec.tunnel_type == 0)
vlan_num = rule->key_conf.vlan_num;
return hns3_fd_ad_config(hw, ad_data.ad_id, &ad_data);
}
+static int hns3_fd_clear_all_rules(struct hns3_hw *hw, uint32_t rule_num)
+{
+ uint32_t i;
+ int ret;
+
+ for (i = 0; i < rule_num; i++) {
+ ret = hns3_fd_tcam_config(hw, true, i, NULL, false);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
int hns3_fdir_filter_init(struct hns3_adapter *hns)
{
struct hns3_pf *pf = &hns->pf;
.hash_func = rte_hash_crc,
.hash_func_init_val = 0,
};
+ int ret;
+
+ ret = hns3_fd_clear_all_rules(&hns->hw, rule_num);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Clear all fd rules fail! ret = %d", ret);
+ return ret;
+ }
fdir_hash_params.socket_id = rte_socket_id();
TAILQ_INIT(&fdir_info->fdir_list);
if (ret < 0) {
rte_spinlock_unlock(&fdir_info->flows_lock);
hns3_err(hw, "Hash table full? err:%d(%s)!", ret,
- strerror(ret));
+ strerror(-ret));
return ret;
}
false);
if (ret)
hns3_err(hw, "Failed to delete fdir: %d src_ip:%x "
- "dst_ip:%x src_port:%d dst_port:%d",
+ "dst_ip:%x src_port:%d dst_port:%d ret = %d",
rule->location,
rule->key_conf.spec.src_ip[IP_ADDR_KEY_ID],
rule->key_conf.spec.dst_ip[IP_ADDR_KEY_ID],
rule->key_conf.spec.src_port,
- rule->key_conf.spec.dst_port);
+ rule->key_conf.spec.dst_port, ret);
else
hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf);
rte_spinlock_unlock(&fdir_info->flows_lock);
if (ret) {
hns3_err(hw, "Failed to config fdir: %d src_ip:%x dst_ip:%x "
- "src_port:%d dst_port:%d",
+ "src_port:%d dst_port:%d ret = %d",
rule->location,
rule->key_conf.spec.src_ip[IP_ADDR_KEY_ID],
rule->key_conf.spec.dst_ip[IP_ADDR_KEY_ID],
rule->key_conf.spec.src_port,
- rule->key_conf.spec.dst_port);
+ rule->key_conf.spec.dst_port, ret);
(void)hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf);
}
}
if (ret) {
- hns3_err(hw, "Fail to delete FDIR filter!");
+ hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret);
ret = -EIO;
}
return ret;
}
if (err) {
- hns3_err(hw, "Fail to restore FDIR filter!");
+ hns3_err(hw, "Fail to restore FDIR filter, ret = %d", ret);
return -EIO;
}
return 0;