From: Oleksandr Kolomeiets <okl-...@napatech.com>

Add high-level interfaces for the deinitialization of the flow filter.

Signed-off-by: Oleksandr Kolomeiets <okl-...@napatech.com>
---
 drivers/net/ntnic/adapter/nt4ga_adapter.c | 17 +++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h         |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/net/ntnic/adapter/nt4ga_adapter.c 
b/drivers/net/ntnic/adapter/nt4ga_adapter.c
index 4105a6eb5a..fd90f31abd 100644
--- a/drivers/net/ntnic/adapter/nt4ga_adapter.c
+++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c
@@ -217,12 +217,29 @@ static int nt4ga_adapter_init(struct adapter_info_s 
*p_adapter_info)
 
 static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info)
 {
+       const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+       if (flow_filter_ops == NULL)
+               NT_LOG(ERR, NTNIC, "%s: flow_filter module uninitialized\n", 
__func__);
+
        fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
        int i;
        int res = -1;
 
        stop_monitor_tasks(-1);
 
+       /* Nt4ga Deinit Filter */
+       nt4ga_filter_t *p_filter = &p_adapter_info->nt4ga_filter;
+
+       if (flow_filter_ops != NULL) {
+               res = 
flow_filter_ops->flow_filter_done(p_filter->mp_flow_device);
+
+               if (res != 0) {
+                       NT_LOG(ERR, NTNIC, "Cannot deinitialize filter\n");
+                       return res;
+               }
+       }
+
        nthw_fpga_shutdown(&p_adapter_info->fpga_info);
 
        /* Rac rab reset flip flop */
diff --git a/drivers/net/ntnic/ntnic_mod_reg.h 
b/drivers/net/ntnic/ntnic_mod_reg.h
index 6dd6240c6f..fd9e595f50 100644
--- a/drivers/net/ntnic/ntnic_mod_reg.h
+++ b/drivers/net/ntnic/ntnic_mod_reg.h
@@ -121,6 +121,7 @@ void rst9563_ops_init(void);
 struct flow_filter_ops {
        int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev 
**p_flow_device,
                int adapter_no);
+       int (*flow_filter_done)(struct flow_nic_dev *dev);
 };
 
 const struct flow_filter_ops *get_flow_filter_ops(void);
-- 
2.45.0

Reply via email to