[V1] tests/TestSuite_af_xdp_2:fixed save pcap file failed
diff mbox series

Message ID 20201022090937.28791-1-weix.xie@intel.com
State Accepted
Headers show
Series
  • [V1] tests/TestSuite_af_xdp_2:fixed save pcap file failed
Related show

Commit Message

Xie, WeiX Oct. 22, 2020, 9:09 a.m. UTC
*AF_XDP pmd is enable by default with meson build method, and remove rebuild steps.
*Fixed pcap file is empty.

Signed-off-by: Xie wei <weix.xie@intel.com>
---
 tests/TestSuite_af_xdp_2.py | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

Comments

Xie, WeiX Oct. 22, 2020, 9:19 a.m. UTC | #1
Tested-by:  Xie,WeiX < weix.xie@intel.com>

Regards,
Xie Wei

> -----Original Message-----
> From: Xie wei [mailto:weix.xie@intel.com]
> Sent: Thursday, October 22, 2020 5:10 PM
> To: dts@dpdk.org
> Cc: Xie, WeiX <weix.xie@intel.com>
> Subject: [dts][PATCH V1] tests/TestSuite_af_xdp_2:fixed save pcap file
> failed
> 
> *AF_XDP pmd is enable by default with meson build method, and remove
> rebuild steps.
> *Fixed pcap file is empty.
> 
> Signed-off-by: Xie wei <weix.xie@intel.com>
> ---
>  tests/TestSuite_af_xdp_2.py | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/TestSuite_af_xdp_2.py b/tests/TestSuite_af_xdp_2.py
> index 4586c9d5..40a3d416 100644
> --- a/tests/TestSuite_af_xdp_2.py
> +++ b/tests/TestSuite_af_xdp_2.py
> @@ -67,29 +67,21 @@ class TestAfXdp(TestCase):
>          self.base_dir = self.dut.base_dir.replace('~', '/root')
>          self.pktgen_helper = PacketGeneratorHelper()
> 
> -        self.prepare_dpdk()
>          self.dut.restore_interfaces()
>          self.irqs_set = self.dut.new_session(suite="irqs-set")
> 
>      def set_up(self):
>          pass
> 
> -    def prepare_dpdk(self):
> -        self.dut.send_expect(
> -            "sed -i
> 's/CONFIG_RTE_LIBRTE_PMD_AF_XDP=n$/CONFIG_RTE_LIBRTE_PMD_AF_
> XDP=y/' config/common_base", "# ")
> -        self.dut.set_build_options({'RTE_LIBRTE_PMD_AF_XDP': 'y'})
> -        self.dut.build_install_dpdk(self.dut.target)
> -
>      def set_port_queue(self, intf):
>          self.dut.send_expect("ethtool -L %s combined %d" % (intf,
> self.nb_cores/self.port_num), "# ")
> 
>      def config_stream(self, rx_port, frame_size):
> -        payload = frame_size - self.header_size
>          tgen_input = []
> 
>          dst_mac = self.dut.get_mac_address(self.dut_ports[rx_port])
> -        flow = 'Ether(dst="%s")/IP(dst="192.168.%d.1",
> proto=255)/UDP()/("X"*%d)' % (dst_mac, rx_port+1, payload)
> -        pkt = Packet(pkt_str=flow)
> +        pkt = Packet(pkt_len=frame_size)
> +        pkt.config_layers([('ether', {'dst': dst_mac}), ('ipv4',
> + {'dst':"192.168.%d.1" % (rx_port+1), 'proto': 255})])
>          pcap = os.path.join(self.out_path, "af_xdp_%d_%d_%d.pcap" %
>                  (self.port_num, rx_port, frame_size))
>          pkt.save_pcapfile(None, pcap)
> @@ -98,12 +90,11 @@ class TestAfXdp(TestCase):
>          return tgen_input
> 
>      def config_rule_stream(self, rule_index, frame_size):
> -        payload = frame_size - self.header_size
>          tgen_input = []
> 
>          rule = self.rule[rule_index]
> -        flow = 'Ether()/IP()/UDP(sport=%d, dport=%d)/("X"*%d)' % (rule[-2],
> rule[-1], payload)
> -        pkt = Packet(pkt_str=flow)
> +        pkt = Packet(pkt_len=frame_size)
> +        pkt.config_layers([('udp', {'src': rule[-2], 'dst':
> + rule[-1]})])
>          pcap = os.path.join(self.out_path, "af_xdp_%d_%d.pcap" %
>                  (rule[-2], frame_size))
>          pkt.save_pcapfile(None, pcap)
> @@ -432,7 +423,3 @@ class TestAfXdp(TestCase):
> 
>      def tear_down_all(self):
>          self.dut.kill_all()
> -        self.dut.send_expect(
> -            "sed -i
> 's/CONFIG_RTE_LIBRTE_PMD_AF_XDP=y$/CONFIG_RTE_LIBRTE_PMD_AF_X
> DP=n/' config/common_base", "# ")
> -        self.dut.set_build_options({'RTE_LIBRTE_PMD_AF_XDP': 'n'})
> -        self.dut.build_install_dpdk(self.dut.target)
> --
> 2.17.1
Ma, LihongX Oct. 29, 2020, 8:52 a.m. UTC | #2
Acked-by: Lihong Ma<lihongx.ma@intel.com>

Regards,
Ma,lihong

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Xie wei
> Sent: Thursday, October 22, 2020 5:10 PM
> To: dts@dpdk.org
> Cc: Xie, WeiX <weix.xie@intel.com>
> Subject: [dts] [PATCH V1] tests/TestSuite_af_xdp_2:fixed save pcap file
> failed
> 
> *AF_XDP pmd is enable by default with meson build method, and remove
> rebuild steps.
> *Fixed pcap file is empty.
> 
> Signed-off-by: Xie wei <weix.xie@intel.com>
> ---
Tu, Lijuan Nov. 3, 2020, 2:04 a.m. UTC | #3
> > *AF_XDP pmd is enable by default with meson build method, and remove
> > rebuild steps.
> > *Fixed pcap file is empty.
> >
> > Signed-off-by: Xie wei <weix.xie@intel.com>
> Acked-by: Lihong Ma<lihongx.ma@intel.com>

Applied
Tu, Lijuan Nov. 3, 2020, 2:06 a.m. UTC | #4
> > *AF_XDP pmd is enable by default with meson build method, and remove
> > rebuild steps.
> > *Fixed pcap file is empty.
> >
> > Signed-off-by: Xie wei <weix.xie@intel.com>
> Acked-by: Lihong Ma<lihongx.ma@intel.com>

Applied

Patch
diff mbox series

diff --git a/tests/TestSuite_af_xdp_2.py b/tests/TestSuite_af_xdp_2.py
index 4586c9d5..40a3d416 100644
--- a/tests/TestSuite_af_xdp_2.py
+++ b/tests/TestSuite_af_xdp_2.py
@@ -67,29 +67,21 @@  class TestAfXdp(TestCase):
         self.base_dir = self.dut.base_dir.replace('~', '/root')
         self.pktgen_helper = PacketGeneratorHelper()
 
-        self.prepare_dpdk()
         self.dut.restore_interfaces()
         self.irqs_set = self.dut.new_session(suite="irqs-set")
 
     def set_up(self):
         pass
 
-    def prepare_dpdk(self):
-        self.dut.send_expect(
-            "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AF_XDP=n$/CONFIG_RTE_LIBRTE_PMD_AF_XDP=y/' config/common_base", "# ")
-        self.dut.set_build_options({'RTE_LIBRTE_PMD_AF_XDP': 'y'})
-        self.dut.build_install_dpdk(self.dut.target)
-
     def set_port_queue(self, intf):
         self.dut.send_expect("ethtool -L %s combined %d" % (intf, self.nb_cores/self.port_num), "# ")
 
     def config_stream(self, rx_port, frame_size):
-        payload = frame_size - self.header_size
         tgen_input = []
 
         dst_mac = self.dut.get_mac_address(self.dut_ports[rx_port])
-        flow = 'Ether(dst="%s")/IP(dst="192.168.%d.1", proto=255)/UDP()/("X"*%d)' % (dst_mac, rx_port+1, payload)
-        pkt = Packet(pkt_str=flow)
+        pkt = Packet(pkt_len=frame_size)
+        pkt.config_layers([('ether', {'dst': dst_mac}), ('ipv4', {'dst':"192.168.%d.1" % (rx_port+1), 'proto': 255})])
         pcap = os.path.join(self.out_path, "af_xdp_%d_%d_%d.pcap" %
                 (self.port_num, rx_port, frame_size))
         pkt.save_pcapfile(None, pcap)
@@ -98,12 +90,11 @@  class TestAfXdp(TestCase):
         return tgen_input
 
     def config_rule_stream(self, rule_index, frame_size):
-        payload = frame_size - self.header_size
         tgen_input = []
 
         rule = self.rule[rule_index]
-        flow = 'Ether()/IP()/UDP(sport=%d, dport=%d)/("X"*%d)' % (rule[-2], rule[-1], payload)
-        pkt = Packet(pkt_str=flow)
+        pkt = Packet(pkt_len=frame_size)
+        pkt.config_layers([('udp', {'src': rule[-2], 'dst': rule[-1]})])
         pcap = os.path.join(self.out_path, "af_xdp_%d_%d.pcap" %
                 (rule[-2], frame_size))
         pkt.save_pcapfile(None, pcap)
@@ -432,7 +423,3 @@  class TestAfXdp(TestCase):
 
     def tear_down_all(self):
         self.dut.kill_all()
-        self.dut.send_expect(
-            "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AF_XDP=y$/CONFIG_RTE_LIBRTE_PMD_AF_XDP=n/' config/common_base", "# ")
-        self.dut.set_build_options({'RTE_LIBRTE_PMD_AF_XDP': 'n'})
-        self.dut.build_install_dpdk(self.dut.target)