diff --git a/tests/TestSuite_ice_iavf_fdir.py b/tests/TestSuite_ice_iavf_fdir.py
index d6ca832a..453b36cb 100644
--- a/tests/TestSuite_ice_iavf_fdir.py
+++ b/tests/TestSuite_ice_iavf_fdir.py
@@ -10283,166 +10283,167 @@ class TestICEIAVFFdir(TestCase):
         self.session_third.send_expect("ifconfig %s up" % self.pf1_intf, "# ", 15)
         time.sleep(1)
 
-        # send matched packets
-        self.tester.scapy_append(
-            'sendp([%s], iface="%s")' % (pkts["pf"][0], self.tester_iface0)
-        )
-        self.tester.scapy_append(
-            'sendp([%s], iface="%s")' % (pkts["pf"][1], self.tester_iface1)
-        )
-        self.tester.scapy_execute()
-        time.sleep(1)
-
-        out_pf0 = self.session_third.send_expect("ethtool -S %s" % self.pf0_intf, "# ")
-        self.verify(
-            "rx_queue_1_packets: 1" in out_pf0,
-            "the packet is not redirected to expected queue of pf0",
-        )
-        out_pf1 = self.session_third.send_expect("ethtool -S %s" % self.pf1_intf, "# ")
-        self.verify("rx_dropped: 1" in out_pf1, "the packet is not dropped pf1")
-
-        out_vf00 = self.send_pkts_getouput(pkts["matched"][0])
-        rfc.check_iavf_fdir_mark(
-            out_vf00, pkt_num=1, check_param={"port_id": 0, "queue": [2, 3]}, stats=True
-        )
-        out_vf01 = self.send_pkts_getouput(pkts["matched"][1])
-        rfc.check_iavf_fdir_mark(
-            out_vf01,
-            pkt_num=1,
-            check_param={"port_id": 1, "queue": 6, "mark_id": 0},
-            stats=True,
-        )
-
-        self.send_packets(pkts["matched"][2], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf10 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf10,
-            pkt_num=1,
-            check_param={"port_id": 0, "queue": 6, "mark_id": 1},
-            stats=True,
-        )
+        try:
+            # send matched packets
+            self.tester.scapy_append(
+                'sendp([%s], iface="%s")' % (pkts["pf"][0], self.tester_iface0)
+            )
+            self.tester.scapy_append(
+                'sendp([%s], iface="%s")' % (pkts["pf"][1], self.tester_iface1)
+            )
+            self.tester.scapy_execute()
+            time.sleep(1)
 
-        self.send_packets(pkts["matched"][3], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf11 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=True
-        )
+            out_pf0 = self.session_third.send_expect("ethtool -S %s" % self.pf0_intf, "# ")
+            self.verify(
+                "rx_queue_1_packets: 1" in out_pf0,
+                "the packet is not redirected to expected queue of pf0",
+            )
+            out_pf1 = self.session_third.send_expect("ethtool -S %s" % self.pf1_intf, "# ")
+            self.verify("rx_dropped: 1" in out_pf1, "the packet is not dropped pf1")
 
-        # send mismatched packets
-        out_vf00 = self.send_pkts_getouput(pkts["mismatched"][0])
-        rfc.check_iavf_fdir_mark(
-            out_vf00,
-            pkt_num=1,
-            check_param={"port_id": 0, "queue": [2, 3]},
-            stats=False,
-        )
-        out_vf01 = self.send_pkts_getouput(pkts["mismatched"][1])
-        rfc.check_iavf_fdir_mark(
-            out_vf01,
-            pkt_num=1,
-            check_param={"port_id": 1, "queue": 6, "mark_id": 0},
-            stats=False,
-        )
+            out_vf00 = self.send_pkts_getouput(pkts["matched"][0])
+            rfc.check_iavf_fdir_mark(
+                out_vf00, pkt_num=1, check_param={"port_id": 0, "queue": [2, 3]}, stats=True
+            )
+            out_vf01 = self.send_pkts_getouput(pkts["matched"][1])
+            rfc.check_iavf_fdir_mark(
+                out_vf01,
+                pkt_num=1,
+                check_param={"port_id": 1, "queue": 6, "mark_id": 0},
+                stats=True,
+            )
 
-        self.send_packets(pkts["mismatched"][2], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf10 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf10,
-            pkt_num=1,
-            check_param={"port_id": 0, "queue": 6, "mark_id": 1},
-            stats=False,
-        )
+            self.send_packets(pkts["matched"][2], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf10 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf10,
+                pkt_num=1,
+                check_param={"port_id": 0, "queue": 6, "mark_id": 1},
+                stats=True,
+            )
 
-        self.send_packets(pkts["mismatched"][3], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf11 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=False
-        )
+            self.send_packets(pkts["matched"][3], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf11 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=True
+            )
 
-        # flush all the rules
-        self.dut.send_expect("flow flush 0", "testpmd> ")
-        self.dut.send_expect("flow flush 1", "testpmd> ")
-        self.session_secondary.send_expect("flow flush 0", "testpmd> ")
-        self.session_secondary.send_expect("flow flush 1", "testpmd> ")
+            # send mismatched packets
+            out_vf00 = self.send_pkts_getouput(pkts["mismatched"][0])
+            rfc.check_iavf_fdir_mark(
+                out_vf00,
+                pkt_num=1,
+                check_param={"port_id": 0, "queue": [2, 3]},
+                stats=False,
+            )
+            out_vf01 = self.send_pkts_getouput(pkts["mismatched"][1])
+            rfc.check_iavf_fdir_mark(
+                out_vf01,
+                pkt_num=1,
+                check_param={"port_id": 1, "queue": 6, "mark_id": 0},
+                stats=False,
+            )
 
-        self.session_third.send_expect(
-            "ethtool -N %s delete %d" % (self.pf0_intf, int(m0.group(1))), "# "
-        )
-        self.session_third.send_expect(
-            "ethtool -N %s delete %d" % (self.pf1_intf, int(m1.group(1))), "# "
-        )
-        self.session_third.send_expect(
-            "ethtool -n %s" % (self.pf0_intf), "Total 0 rules"
-        )
-        self.session_third.send_expect(
-            "ethtool -n %s" % (self.pf1_intf), "Total 0 rules"
-        )
+            self.send_packets(pkts["mismatched"][2], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf10 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf10,
+                pkt_num=1,
+                check_param={"port_id": 0, "queue": 6, "mark_id": 1},
+                stats=False,
+            )
 
-        # send matched packets
-        self.tester.scapy_append(
-            'sendp([%s], iface="%s")' % (pkts["pf"][0], self.tester_iface0)
-        )
-        self.tester.scapy_append(
-            'sendp([%s], iface="%s")' % (pkts["pf"][1], self.tester_iface1)
-        )
-        self.tester.scapy_execute()
+            self.send_packets(pkts["mismatched"][3], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf11 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=False
+            )
 
-        out_pf0 = self.session_third.send_expect("ethtool -S %s" % self.pf0_intf, "# ")
-        self.verify("rx_queue_1_packets: 1" in out_pf0, "the rule is not destroyed")
-        out_pf1 = self.session_third.send_expect("ethtool -S %s" % self.pf1_intf, "# ")
-        self.verify("rx_dropped: 1" in out_pf1, "the packet is dropped by pf1")
+            # flush all the rules
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+            self.dut.send_expect("flow flush 1", "testpmd> ")
+            self.session_secondary.send_expect("flow flush 0", "testpmd> ")
+            self.session_secondary.send_expect("flow flush 1", "testpmd> ")
 
-        # send mismatched packets
-        out_vf00 = self.send_pkts_getouput(pkts["matched"][0])
-        rfc.check_iavf_fdir_mark(
-            out_vf00,
-            pkt_num=1,
-            check_param={"port_id": 0, "queue": [2, 3]},
-            stats=False,
-        )
-        out_vf01 = self.send_pkts_getouput(pkts["matched"][1])
-        rfc.check_iavf_fdir_mark(
-            out_vf01,
-            pkt_num=1,
-            check_param={"port_id": 1, "queue": 6, "mark_id": 0},
-            stats=False,
-        )
+            self.session_third.send_expect(
+                "ethtool -N %s delete %d" % (self.pf0_intf, int(m0.group(1))), "# "
+            )
+            self.session_third.send_expect(
+                "ethtool -N %s delete %d" % (self.pf1_intf, int(m1.group(1))), "# "
+            )
+            self.session_third.send_expect(
+                "ethtool -n %s" % (self.pf0_intf), "Total 0 rules"
+            )
+            self.session_third.send_expect(
+                "ethtool -n %s" % (self.pf1_intf), "Total 0 rules"
+            )
 
-        self.send_packets(pkts["matched"][2], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf10 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf10,
-            pkt_num=1,
-            check_param={"port_id": 0, "queue": 6, "mark_id": 1},
-            stats=False,
-        )
+            # send matched packets
+            self.tester.scapy_append(
+                'sendp([%s], iface="%s")' % (pkts["pf"][0], self.tester_iface0)
+            )
+            self.tester.scapy_append(
+                'sendp([%s], iface="%s")' % (pkts["pf"][1], self.tester_iface1)
+            )
+            self.tester.scapy_execute()
+
+            out_pf0 = self.session_third.send_expect("ethtool -S %s" % self.pf0_intf, "# ")
+            self.verify("rx_queue_1_packets: 1" in out_pf0, "the rule is not destroyed")
+            out_pf1 = self.session_third.send_expect("ethtool -S %s" % self.pf1_intf, "# ")
+            self.verify("rx_dropped: 1" in out_pf1, "the packet is dropped by pf1")
+
+            # send mismatched packets
+            out_vf00 = self.send_pkts_getouput(pkts["matched"][0])
+            rfc.check_iavf_fdir_mark(
+                out_vf00,
+                pkt_num=1,
+                check_param={"port_id": 0, "queue": [2, 3]},
+                stats=False,
+            )
+            out_vf01 = self.send_pkts_getouput(pkts["matched"][1])
+            rfc.check_iavf_fdir_mark(
+                out_vf01,
+                pkt_num=1,
+                check_param={"port_id": 1, "queue": 6, "mark_id": 0},
+                stats=False,
+            )
 
-        self.send_packets(pkts["matched"][3], pf_id=1)
-        out_info = self.session_secondary.get_session_before(timeout=2)
-        out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
-        out_vf11 = out_info + out_pkt
-        self.session_secondary.send_expect("start", "testpmd> ")
-        rfc.check_iavf_fdir_mark(
-            out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=False
-        )
+            self.send_packets(pkts["matched"][2], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf10 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf10,
+                pkt_num=1,
+                check_param={"port_id": 0, "queue": 6, "mark_id": 1},
+                stats=False,
+            )
 
-        self.dut.close_session(self.session_secondary)
-        self.dut.close_session(self.session_third)
+            self.send_packets(pkts["matched"][3], pf_id=1)
+            out_info = self.session_secondary.get_session_before(timeout=2)
+            out_pkt = self.session_secondary.send_expect("stop", "testpmd> ")
+            out_vf11 = out_info + out_pkt
+            self.session_secondary.send_expect("start", "testpmd> ")
+            rfc.check_iavf_fdir_mark(
+                out_vf11, pkt_num=1, check_param={"port_id": 1, "drop": 1}, stats=False
+            )
+        finally:
+            self.dut.close_session(self.session_secondary)
+            self.dut.close_session(self.session_third)
 
     @skip_unsupported_pkg(["os default", "wireless"])
     def test_maxnum_128_profiles(self):
