* [dts] [PATCH] add vlan filter script to VF daemon suite
@ 2017-04-11 0:09 Xueqin Lin
2017-04-20 6:49 ` Liu, Yong
0 siblings, 1 reply; 3+ messages in thread
From: Xueqin Lin @ 2017-04-11 0:09 UTC (permalink / raw)
To: dts; +Cc: Xueqin Lin
---
tests/TestSuite_vf_daemon.py | 55 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py
index 62532af..692e41c 100644
--- a/tests/TestSuite_vf_daemon.py
+++ b/tests/TestSuite_vf_daemon.py
@@ -634,6 +634,61 @@ class Testvf_daemon(TestCase):
self.vm0_testpmd.quit()
self.dut_testpmd.quit()
+
+ def test_vlan_filter(self):
+ """
+ Add/Remove vlan filter for a VF from PF
+ """
+ self.dut_testpmd.start_testpmd("Default", "--port-topology=chained")
+ self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--port-topology=chained')
+
+ self.vm0_testpmd.execute_cmd('set fwd rxonly')
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+ self.vm0_testpmd.execute_cmd('start')
+
+ wrong_mac = '9E:AC:72:49:43:11'
+ out = self.send_and_pmdout(wrong_mac)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to receive untagged packet!!!")
+ random_vlan = random.randint(1, MAX_VLAN - 1)
+ out = self.send_and_pmdout(wrong_mac, random_vlan)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to receive packet with vlan id!!!")
+ self.verify("VLAN tci=%s" % hex(random_vlan) in out,
+ "Failed to receive packet with vlan id!!!")
+ random_vlan = random.randint(1, MAX_VLAN - 1)
+ rx_vlans = [1, random_vlan, MAX_VLAN]
+ for rx_vlan in rx_vlans:
+ self.dut_testpmd.execute_cmd('rx_vlan add %s port 0 vf 1'% rx_vlan)
+ time.sleep(1)
+ out = self.send_and_pmdout(wrong_mac, rx_vlan)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to enable vlan filter!!!")
+ self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
+ "Failed to receive packet with vlan id!!!")
+
+ wrong_rx_vlan = (rx_vlan + 2) % 4095
+ out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan)
+ self.verify("dst=%s" % wrong_mac not in out,
+ "Failed to enable vlan filter!!!")
+ self.dut_testpmd.execute_cmd('rx_vlan rm %s port 0 vf 1'% rx_vlan)
+ out = self.send_and_pmdout(wrong_mac, rx_vlan)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to disable vlan filter!!!")
+ self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
+ "Failed to receive packet with vlan id!!!")
+ out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to disable vlan filter!!!")
+ self.verify("VLAN tci=%s" % hex(wrong_rx_vlan) in out,
+ "Failed to receive packet with vlan id!!!")
+
+ out = self.send_and_pmdout(wrong_mac)
+ self.verify("dst=%s" % wrong_mac in out,
+ "Failed to receive untagged packet!!!")
+
+ self.vm0_testpmd.quit()
+ self.dut_testpmd.quit()
def tear_down(self):
--
2.5.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH] add vlan filter script to VF daemon suite
2017-04-11 0:09 [dts] [PATCH] add vlan filter script to VF daemon suite Xueqin Lin
@ 2017-04-20 6:49 ` Liu, Yong
2017-04-20 9:14 ` Lin, Xueqin
0 siblings, 1 reply; 3+ messages in thread
From: Liu, Yong @ 2017-04-20 6:49 UTC (permalink / raw)
To: Xueqin Lin, dts
Xueqin,
One question about the way calculate wrong vlan id. Why it is generated
by correct vlan plus 2 and then mod 4095?
I think ( vlan + 1 ) % 4096 will be more suitable.
Thanks,
Marvin
On 04/11/2017 08:09 AM, Xueqin Lin wrote:
> + for rx_vlan in rx_vlans:
> + self.dut_testpmd.execute_cmd('rx_vlan add %s port 0 vf 1'% rx_vlan)
> + time.sleep(1)
> + out = self.send_and_pmdout(wrong_mac, rx_vlan)
> + self.verify("dst=%s" % wrong_mac in out,
> + "Failed to enable vlan filter!!!")
> + self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
> + "Failed to receive packet with vlan id!!!")
> +
> + wrong_rx_vlan = (rx_vlan + 2) % 4095
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH] add vlan filter script to VF daemon suite
2017-04-20 6:49 ` Liu, Yong
@ 2017-04-20 9:14 ` Lin, Xueqin
0 siblings, 0 replies; 3+ messages in thread
From: Lin, Xueqin @ 2017-04-20 9:14 UTC (permalink / raw)
To: Liu, Yong, dts
Hi Marvin,
Vlan id 0 is equal to untagged packet for this case, need to avoid using vlan id 0.
rx_vlans = [1, random_vlan, MAX_VLAN]
MAX_VLAN is must option, ( vlan + 1 ) % 4096 will be 0.
I will fix it and add more condition to avoid using 0.
Thanks for review.
Best regards,
Xueqin
-----Original Message-----
From: Liu, Yong
Sent: Thursday, April 20, 2017 2:49 PM
To: Lin, Xueqin <xueqin.lin@intel.com>; dts@dpdk.org
Subject: Re: [dts] [PATCH] add vlan filter script to VF daemon suite
Xueqin,
One question about the way calculate wrong vlan id. Why it is generated by correct vlan plus 2 and then mod 4095?
I think ( vlan + 1 ) % 4096 will be more suitable.
Thanks,
Marvin
On 04/11/2017 08:09 AM, Xueqin Lin wrote:
> + for rx_vlan in rx_vlans:
> + self.dut_testpmd.execute_cmd('rx_vlan add %s port 0 vf 1'% rx_vlan)
> + time.sleep(1)
> + out = self.send_and_pmdout(wrong_mac, rx_vlan)
> + self.verify("dst=%s" % wrong_mac in out,
> + "Failed to enable vlan filter!!!")
> + self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
> + "Failed to receive packet with vlan id!!!")
> +
> + wrong_rx_vlan = (rx_vlan + 2) % 4095
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-20 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 0:09 [dts] [PATCH] add vlan filter script to VF daemon suite Xueqin Lin
2017-04-20 6:49 ` Liu, Yong
2017-04-20 9:14 ` Lin, Xueqin
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).