From: Ziyang Xuan <xuanziyang2@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <xuanziyang2@huawei.com>,
<waterman.cao@huawei.com>, <shahar.belkar@huawei.com>,
<luoxianjun@huawei.com>, <tanya.brokhman@huawei.com>,
<wulike1@huawei.com>, <zhouguoyang@huawei.com>,
Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
Subject: [dpdk-dev] [PATCH v1 11/15] net/hinic: flush fdir filter
Date: Fri, 6 Sep 2019 20:54:10 +0800 [thread overview]
Message-ID: <5e23d39bbdfbbb784147e3c24cc5233d2453f573.1567773212.git.xuanziyang2@huawei.com> (raw)
In-Reply-To: <cover.1567773211.git.xuanziyang2@huawei.com>
From: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
Supports to flush fdir filter.
Destroy all flow rules associated with a port on hinic.
Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>
---
drivers/net/hinic/base/hinic_pmd_niccfg.c | 11 +-
drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++
drivers/net/hinic/hinic_pmd_ethdev.h | 3 +
drivers/net/hinic/hinic_pmd_flow.c | 273 ++++++++++++++++++++++--------
4 files changed, 231 insertions(+), 72 deletions(-)
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
index 1f504b0..1de016c 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
@@ -1522,7 +1522,7 @@ int hinic_set_fdir_filter(void *hwdev, u8 filter_type, u8 qid, u8 type_enable,
if (hinic_func_type(hwdev) == TYPE_VF) {
PMD_DRV_LOG(WARNING, "VF don't support FDIR");
- return 0;
+ return -EINVAL;
}
memset(&port_filer_cmd, 0, sizeof(port_filer_cmd));
@@ -1560,7 +1560,7 @@ int hinic_set_normal_filter(void *hwdev, u8 qid, u8 normal_type_enable,
if (hinic_func_type(hwdev) == TYPE_VF) {
PMD_DRV_LOG(WARNING, "VF don't support FDIR");
- return 0;
+ return -EINVAL;
}
memset(&port_filer_cmd, 0, sizeof(port_filer_cmd));
@@ -1599,7 +1599,7 @@ int hinic_set_fdir_tcam(void *hwdev, u16 type_mask,
if (hinic_func_type(hwdev) == TYPE_VF) {
PMD_DRV_LOG(WARNING, "VF don't support set Tcam table");
- return 0;
+ return -EINVAL;
}
memset(&port_tcam_cmd, 0, sizeof(port_tcam_cmd));
@@ -1632,6 +1632,11 @@ int hinic_clear_fdir_tcam(void *hwdev, u16 type_mask)
if (!hwdev)
return -EINVAL;
+ if (hinic_func_type(hwdev) == TYPE_VF) {
+ PMD_DRV_LOG(WARNING, "VF don't support FDIR");
+ return -EINVAL;
+ }
+
memset(&port_tcam_cmd, 0, sizeof(port_tcam_cmd));
port_tcam_cmd.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
port_tcam_cmd.tcam_index = type_mask;
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 7b6feff..6a58e27 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -334,6 +334,9 @@ static int hinic_dev_configure(struct rte_eth_dev *dev)
return err;
}
+ /*clear fdir filter flag in function table*/
+ hinic_free_fdir_filter(nic_dev);
+
return HINIC_OK;
}
@@ -1101,6 +1104,8 @@ static void hinic_dev_stop(struct rte_eth_dev *dev)
/* clean root context */
hinic_free_qp_ctxts(nic_dev->hwdev);
+ hinic_free_fdir_filter(nic_dev);
+
/* free mbuf */
hinic_free_all_rx_mbuf(dev);
hinic_free_all_tx_mbuf(dev);
@@ -2769,6 +2774,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pci_dev;
struct rte_ether_addr *eth_addr;
struct hinic_nic_dev *nic_dev;
+ struct hinic_filter_info *filter_info;
u32 mac_size;
int rc;
@@ -2860,6 +2866,16 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
}
hinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
+ /* initialize filter info */
+ filter_info = &nic_dev->filter;
+ memset(filter_info, 0, sizeof(struct hinic_filter_info));
+ /* initialize 5tuple filter list */
+ TAILQ_INIT(&filter_info->fivetuple_list);
+ TAILQ_INIT(&nic_dev->filter_ntuple_list);
+ TAILQ_INIT(&nic_dev->filter_ethertype_list);
+ TAILQ_INIT(&nic_dev->filter_fdir_rule_list);
+ TAILQ_INIT(&nic_dev->hinic_flow_list);
+
hinic_set_bit(HINIC_DEV_INIT, &nic_dev->dev_status);
PMD_DRV_LOG(INFO, "Initialize %s in primary successfully",
eth_dev->data->name);
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
index 802f7ae..41385f4 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.h
+++ b/drivers/net/hinic/hinic_pmd_ethdev.h
@@ -141,6 +141,7 @@ struct hinic_flow_mem {
TAILQ_HEAD(hinic_ethertype_filter_list, hinic_ethertype_filter_ele);
TAILQ_HEAD(hinic_fdir_rule_filter_list, hinic_fdir_rule_ele);
TAILQ_HEAD(hinic_flow_mem_list, hinic_flow_mem);
+
extern const struct rte_flow_ops hinic_flow_ops;
/* hinic nic_device */
@@ -183,4 +184,6 @@ struct hinic_nic_dev {
struct hinic_flow_mem_list hinic_flow_list;
};
+void hinic_free_fdir_filter(struct hinic_nic_dev *nic_dev);
+
#endif /* _HINIC_PMD_ETHDEV_H_ */
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
index 886231b..9fb4d75 100644
--- a/drivers/net/hinic/hinic_pmd_flow.c
+++ b/drivers/net/hinic/hinic_pmd_flow.c
@@ -103,7 +103,7 @@ struct hinic_fdir_info {
*/
static inline const struct rte_flow_item *
next_no_void_pattern(const struct rte_flow_item pattern[],
- const struct rte_flow_item *cur)
+ const struct rte_flow_item *cur)
{
const struct rte_flow_item *next =
cur ? cur + 1 : &pattern[0];
@@ -116,7 +116,7 @@ struct hinic_fdir_info {
static inline const struct rte_flow_action *
next_no_void_action(const struct rte_flow_action actions[],
- const struct rte_flow_action *cur)
+ const struct rte_flow_action *cur)
{
const struct rte_flow_action *next =
cur ? cur + 1 : &actions[0];
@@ -128,7 +128,7 @@ struct hinic_fdir_info {
}
static int hinic_check_ethertype_attr_ele(const struct rte_flow_attr *attr,
- struct rte_flow_error *error)
+ struct rte_flow_error *error)
{
/* Must be input direction */
if (!attr->ingress) {
@@ -163,9 +163,9 @@ static int hinic_check_ethertype_attr_ele(const struct rte_flow_attr *attr,
}
static int hinic_check_filter_arg(const struct rte_flow_attr *attr,
- const struct rte_flow_item *pattern,
- const struct rte_flow_action *actions,
- struct rte_flow_error *error)
+ const struct rte_flow_item *pattern,
+ const struct rte_flow_action *actions,
+ struct rte_flow_error *error)
{
if (!pattern) {
rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
@@ -190,7 +190,7 @@ static int hinic_check_filter_arg(const struct rte_flow_attr *attr,
}
static int hinic_check_ethertype_first_item(const struct rte_flow_item *item,
- struct rte_flow_error *error)
+ struct rte_flow_error *error)
{
/* The first non-void item should be MAC */
if (item->type != RTE_FLOW_ITEM_TYPE_ETH) {
@@ -220,10 +220,10 @@ static int hinic_check_ethertype_first_item(const struct rte_flow_item *item,
static int
hinic_parse_ethertype_aciton(const struct rte_flow_action *actions,
- const struct rte_flow_action *act,
- const struct rte_flow_action_queue *act_q,
- struct rte_eth_ethertype_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_action *act,
+ const struct rte_flow_action_queue *act_q,
+ struct rte_eth_ethertype_filter *filter,
+ struct rte_flow_error *error)
{
/* Parse action */
act = next_no_void_action(actions, NULL);
@@ -260,10 +260,10 @@ static int hinic_check_ethertype_first_item(const struct rte_flow_item *item,
*/
static int
cons_parse_ethertype_filter(const struct rte_flow_attr *attr,
- const struct rte_flow_item *pattern,
- const struct rte_flow_action *actions,
- struct rte_eth_ethertype_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_item *pattern,
+ const struct rte_flow_action *actions,
+ struct rte_eth_ethertype_filter *filter,
+ struct rte_flow_error *error)
{
const struct rte_flow_item *item;
const struct rte_flow_action *act = NULL;
@@ -329,11 +329,11 @@ static int hinic_check_ethertype_first_item(const struct rte_flow_item *item,
static int
hinic_parse_ethertype_filter(struct rte_eth_dev *dev,
- const struct rte_flow_attr *attr,
- const struct rte_flow_item pattern[],
- const struct rte_flow_action actions[],
- struct rte_eth_ethertype_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_attr *attr,
+ const struct rte_flow_item pattern[],
+ const struct rte_flow_action actions[],
+ struct rte_eth_ethertype_filter *filter,
+ struct rte_flow_error *error)
{
if (cons_parse_ethertype_filter(attr, pattern, actions, filter, error))
return -rte_errno;
@@ -386,8 +386,8 @@ static int hinic_check_ethertype_first_item(const struct rte_flow_item *item,
}
static int hinic_check_ntuple_attr_ele(const struct rte_flow_attr *attr,
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
/* must be input direction */
if (!attr->ingress) {
@@ -425,9 +425,9 @@ static int hinic_check_ntuple_attr_ele(const struct rte_flow_attr *attr,
static int
hinic_check_ntuple_act_ele(__rte_unused const struct rte_flow_item *item,
- const struct rte_flow_action actions[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_action actions[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
const struct rte_flow_action *act;
/**
@@ -459,8 +459,8 @@ static int hinic_check_ntuple_attr_ele(const struct rte_flow_attr *attr,
}
static int hinic_ntuple_item_check_ether(const struct rte_flow_item **ipv4_item,
- const struct rte_flow_item pattern[],
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct rte_flow_error *error)
{
const struct rte_flow_item *item;
@@ -508,9 +508,9 @@ static int hinic_ntuple_item_check_ether(const struct rte_flow_item **ipv4_item,
static int
hinic_ntuple_item_check_ipv4(const struct rte_flow_item **in_out_item,
- const struct rte_flow_item pattern[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
const struct rte_flow_item_ipv4 *ipv4_spec;
const struct rte_flow_item_ipv4 *ipv4_mask;
@@ -564,9 +564,9 @@ static int hinic_ntuple_item_check_ether(const struct rte_flow_item **ipv4_item,
}
static int hinic_ntuple_item_check_l4(const struct rte_flow_item **in_out_item,
- const struct rte_flow_item pattern[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
const struct rte_flow_item_tcp *tcp_spec;
const struct rte_flow_item_tcp *tcp_mask;
@@ -664,8 +664,8 @@ static int hinic_ntuple_item_check_l4(const struct rte_flow_item **in_out_item,
}
static int hinic_ntuple_item_check_end(const struct rte_flow_item *item,
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
/* Check if the next not void item is END */
if (item->type != RTE_FLOW_ITEM_TYPE_END) {
@@ -679,9 +679,9 @@ static int hinic_ntuple_item_check_end(const struct rte_flow_item *item,
}
static int hinic_check_ntuple_item_ele(const struct rte_flow_item *item,
- const struct rte_flow_item pattern[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
if (hinic_ntuple_item_check_ether(&item, pattern, error) ||
hinic_ntuple_item_check_ipv4(&item, pattern, filter, error) ||
@@ -722,10 +722,10 @@ static int hinic_check_ntuple_item_ele(const struct rte_flow_item *item,
*/
static int
cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
- const struct rte_flow_item pattern[],
- const struct rte_flow_action actions[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ const struct rte_flow_action actions[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
const struct rte_flow_item *item = NULL;
@@ -746,11 +746,11 @@ static int hinic_check_ntuple_item_ele(const struct rte_flow_item *item,
static int
hinic_parse_ntuple_filter(struct rte_eth_dev *dev,
- const struct rte_flow_attr *attr,
- const struct rte_flow_item pattern[],
- const struct rte_flow_action actions[],
- struct rte_eth_ntuple_filter *filter,
- struct rte_flow_error *error)
+ const struct rte_flow_attr *attr,
+ const struct rte_flow_item pattern[],
+ const struct rte_flow_action actions[],
+ struct rte_eth_ntuple_filter *filter,
+ struct rte_flow_error *error)
{
int ret;
@@ -786,8 +786,8 @@ static int hinic_check_ntuple_item_ele(const struct rte_flow_item *item,
}
static int hinic_normal_item_check_ether(const struct rte_flow_item **ip_item,
- const struct rte_flow_item pattern[],
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct rte_flow_error *error)
{
const struct rte_flow_item *item;
@@ -836,9 +836,9 @@ static int hinic_normal_item_check_ether(const struct rte_flow_item **ip_item,
}
static int hinic_normal_item_check_ip(const struct rte_flow_item **in_out_item,
- const struct rte_flow_item pattern[],
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
const struct rte_flow_item_ipv4 *ipv4_spec;
const struct rte_flow_item_ipv4 *ipv4_mask;
@@ -912,9 +912,9 @@ static int hinic_normal_item_check_ip(const struct rte_flow_item **in_out_item,
}
static int hinic_normal_item_check_l4(const struct rte_flow_item **in_out_item,
- const struct rte_flow_item pattern[],
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
const struct rte_flow_item_tcp *tcp_spec;
const struct rte_flow_item_tcp *tcp_mask;
@@ -1023,8 +1023,8 @@ static int hinic_normal_item_check_l4(const struct rte_flow_item **in_out_item,
}
static int hinic_normal_item_check_end(const struct rte_flow_item *item,
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
/* check if the next not void item is END */
if (item->type != RTE_FLOW_ITEM_TYPE_END) {
@@ -1039,9 +1039,9 @@ static int hinic_normal_item_check_end(const struct rte_flow_item *item,
}
static int hinic_check_normal_item_ele(const struct rte_flow_item *item,
- const struct rte_flow_item pattern[],
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ const struct rte_flow_item pattern[],
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
if (hinic_normal_item_check_ether(&item, pattern, error) ||
hinic_normal_item_check_ip(&item, pattern, rule, error) ||
@@ -1053,8 +1053,8 @@ static int hinic_check_normal_item_ele(const struct rte_flow_item *item,
}
static int hinic_check_normal_attr_ele(const struct rte_flow_attr *attr,
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
/* must be input direction */
if (!attr->ingress) {
@@ -1087,9 +1087,9 @@ static int hinic_check_normal_attr_ele(const struct rte_flow_attr *attr,
}
static int hinic_check_normal_act_ele(const struct rte_flow_item *item,
- const struct rte_flow_action actions[],
- struct hinic_fdir_rule *rule,
- struct rte_flow_error *error)
+ const struct rte_flow_action actions[],
+ struct hinic_fdir_rule *rule,
+ struct rte_flow_error *error)
{
const struct rte_flow_action *act;
@@ -1191,10 +1191,10 @@ static int hinic_check_normal_act_ele(const struct rte_flow_item *item,
* the HW. Because there can be no enough room for the rule.
*/
static int hinic_flow_validate(struct rte_eth_dev *dev,
- const struct rte_flow_attr *attr,
- const struct rte_flow_item pattern[],
- const struct rte_flow_action actions[],
- struct rte_flow_error *error)
+ const struct rte_flow_attr *attr,
+ const struct rte_flow_item pattern[],
+ const struct rte_flow_action actions[],
+ struct rte_flow_error *error)
{
struct rte_eth_ethertype_filter ethertype_filter;
struct rte_eth_ntuple_filter ntuple_filter;
@@ -1449,6 +1449,35 @@ static int hinic_set_vrrp_tcam(struct hinic_nic_dev *nic_dev)
&vrrp_rule, &vrrp_action);
}
+void hinic_free_fdir_filter(struct hinic_nic_dev *nic_dev)
+{
+ struct hinic_filter_info *filter_info =
+ HINIC_DEV_PRIVATE_TO_FILTER_INFO(nic_dev);
+
+ if (hinic_func_type(nic_dev->hwdev) == TYPE_VF) {
+ PMD_DRV_LOG(WARNING, "VF don't support set Tcam table");
+ return;
+ }
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_BGPD_DPORT_TYPE)))
+ hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_DPORT);
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_BGPD_SPORT_TYPE)))
+ hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_SPORT);
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_VRRP_TYPE)))
+ hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_VRRP);
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_LACP_TYPE)))
+ hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_LACP);
+
+ hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
+}
+
static int
hinic_filter_info_init(struct hinic_5tuple_filter *filter,
struct hinic_filter_info *filter_info)
@@ -2234,10 +2263,116 @@ static int hinic_flow_destroy(struct rte_eth_dev *dev,
return ret;
}
+/* remove all the n-tuple filters */
+static void hinic_clear_all_ntuple_filter(struct rte_eth_dev *dev)
+{
+ struct hinic_filter_info *filter_info =
+ HINIC_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+ struct hinic_5tuple_filter *p_5tuple;
+
+ while ((p_5tuple = TAILQ_FIRST(&filter_info->fivetuple_list)))
+ hinic_remove_5tuple_filter(dev, p_5tuple);
+}
+
+/* remove all the ether type filters */
+static void hinic_clear_all_ethertype_filter(struct rte_eth_dev *dev)
+{
+ struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+ struct hinic_filter_info *filter_info =
+ HINIC_DEV_PRIVATE_TO_FILTER_INFO(nic_dev);
+ int ret = 0;
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_LACP_TYPE))) {
+ (void)hinic_ethertype_filter_remove(filter_info,
+ HINIC_PKT_TYPE_FIND_ID(PKT_LACP_TYPE));
+ ret = hinic_set_fdir_filter(nic_dev->hwdev, PKT_LACP_TYPE,
+ filter_info->qid, false, true);
+
+ (void)hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_LACP);
+ }
+
+ if (filter_info->type_mask &
+ (1 << HINIC_PKT_TYPE_FIND_ID(PKT_ARP_TYPE))) {
+ (void)hinic_ethertype_filter_remove(filter_info,
+ HINIC_PKT_TYPE_FIND_ID(PKT_ARP_TYPE));
+ ret = hinic_set_fdir_filter(nic_dev->hwdev, PKT_ARP_TYPE,
+ filter_info->qid, false, true);
+ }
+
+ if (ret)
+ PMD_DRV_LOG(ERR, "Clear ethertype failed, filter type: 0x%x",
+ filter_info->pkt_type);
+}
+
+/* remove all the ether type filters */
+static void hinic_clear_all_fdir_filter(struct rte_eth_dev *dev)
+{
+ struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+ (void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
+}
+
+static void hinic_filterlist_flush(struct rte_eth_dev *dev)
+{
+ struct hinic_ntuple_filter_ele *ntuple_filter_ptr;
+ struct hinic_ethertype_filter_ele *ethertype_filter_ptr;
+ struct hinic_fdir_rule_ele *fdir_rule_ptr;
+ struct hinic_flow_mem *hinic_flow_mem_ptr;
+ struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+ while ((ntuple_filter_ptr =
+ TAILQ_FIRST(&nic_dev->filter_ntuple_list))) {
+ TAILQ_REMOVE(&nic_dev->filter_ntuple_list, ntuple_filter_ptr,
+ entries);
+ rte_free(ntuple_filter_ptr);
+ }
+
+ while ((ethertype_filter_ptr =
+ TAILQ_FIRST(&nic_dev->filter_ethertype_list))) {
+ TAILQ_REMOVE(&nic_dev->filter_ethertype_list,
+ ethertype_filter_ptr,
+ entries);
+ rte_free(ethertype_filter_ptr);
+ }
+
+ while ((fdir_rule_ptr =
+ TAILQ_FIRST(&nic_dev->filter_fdir_rule_list))) {
+ TAILQ_REMOVE(&nic_dev->filter_fdir_rule_list, fdir_rule_ptr,
+ entries);
+ rte_free(fdir_rule_ptr);
+ }
+
+ while ((hinic_flow_mem_ptr =
+ TAILQ_FIRST(&nic_dev->hinic_flow_list))) {
+ TAILQ_REMOVE(&nic_dev->hinic_flow_list, hinic_flow_mem_ptr,
+ entries);
+ rte_free(hinic_flow_mem_ptr->flow);
+ rte_free(hinic_flow_mem_ptr);
+ }
+}
+
+/* Destroy all flow rules associated with a port on hinic. */
+static int hinic_flow_flush(struct rte_eth_dev *dev,
+ __rte_unused struct rte_flow_error *error)
+{
+ struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+ hinic_clear_all_ntuple_filter(dev);
+ hinic_clear_all_ethertype_filter(dev);
+ hinic_clear_all_fdir_filter(dev);
+ hinic_filterlist_flush(dev);
+
+ PMD_DRV_LOG(INFO, "Flush flow succed, func_id: 0x%x",
+ hinic_global_func_id(nic_dev->hwdev));
+ return 0;
+}
+
const struct rte_flow_ops hinic_flow_ops = {
.validate = hinic_flow_validate,
.create = hinic_flow_create,
.destroy = hinic_flow_destroy,
+ .flush = hinic_flow_flush,
};
/*lint -e{10}*/
--
1.8.3.1
next prev parent reply other threads:[~2019-09-06 12:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 12:49 [dpdk-dev] [PATCH v1 00/15] Add advanced features for Huawei hinic pmd Ziyang Xuan
2019-09-06 12:49 ` [dpdk-dev] [PATCH v1 01/15] net/hinic/base: add mbox command channel for SRIOV Ziyang Xuan
2019-09-06 12:50 ` [dpdk-dev] [PATCH v1 02/15] net/hinic/base: add HW interfaces of SRIOV Ziyang Xuan
2019-09-06 12:50 ` [dpdk-dev] [PATCH v1 03/15] net/hinic: add VF PMD operation interfaces Ziyang Xuan
2019-09-06 12:51 ` [dpdk-dev] [PATCH v1 04/15] net/hinic: add VLAN filter and offload Ziyang Xuan
2019-09-06 12:51 ` [dpdk-dev] [PATCH v1 05/15] net/hinic: add allmulticast mode and MTU set Ziyang Xuan
2019-09-06 12:52 ` [dpdk-dev] [PATCH v1 06/15] net/hinic: add unicast and multicast MAC set Ziyang Xuan
2019-09-06 12:52 ` [dpdk-dev] [PATCH v1 07/15] net/hinic: add fdir config interface Ziyang Xuan
2019-09-06 12:52 ` [dpdk-dev] [PATCH v1 08/15] net/hinic: add fdir validate flow operations Ziyang Xuan
2019-09-06 12:53 ` [dpdk-dev] [PATCH v1 09/15] net/hinic: create and destroy ntuple filter Ziyang Xuan
2019-09-06 12:53 ` [dpdk-dev] [PATCH v1 10/15] net/hinic: create and destroy fdir filter Ziyang Xuan
2019-09-06 12:54 ` Ziyang Xuan [this message]
2019-09-06 12:54 ` [dpdk-dev] [PATCH v1 12/15] net/hinic: set link down and up Ziyang Xuan
2019-09-06 12:55 ` [dpdk-dev] [PATCH v1 13/15] net/hinic: support inner L3 checksum offload Ziyang Xuan
2019-09-06 12:55 ` [dpdk-dev] [PATCH v1 14/15] net/hinic: support LRO offload Ziyang Xuan
2019-09-06 12:56 ` [dpdk-dev] [PATCH v1 15/15] net/hinic: add hinic PMD doc files Ziyang Xuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e23d39bbdfbbb784147e3c24cc5233d2453f573.1567773212.git.xuanziyang2@huawei.com \
--to=xuanziyang2@huawei.com \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=luoxianjun@huawei.com \
--cc=shahar.belkar@huawei.com \
--cc=tanya.brokhman@huawei.com \
--cc=waterman.cao@huawei.com \
--cc=wulike1@huawei.com \
--cc=zhouguoyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).