summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouie.long <longyu805@163.com>2018-03-16 15:11:22 +0800
committerlouie.long <longyu805@163.com>2018-03-16 15:11:22 +0800
commit8450089d5aa09e1c4de4b5701f5210b8f8f7dfdc (patch)
tree0e3355000104c8822775d4a3607615ad9c70ade9
parentca7bc608e72076dba0b9db50b473ab0d0d18c0e6 (diff)
[NFVBENCH-74] packet payload length without vlan
fix packet playload length without vlan tag, ensure that the minimum packet size is 64 bytes with or without the vlan tag Change-Id: Iabea46756905e3b16791436642cdca58ec8fed6f Signed-off-by: louie.long <longyu805@163.com>
-rw-r--r--nfvbench/traffic_gen/trex.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index e42afce..1e7c133 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -136,13 +136,16 @@ class TRex(AbstractTrafficGenerator):
return result
def create_pkt(self, stream_cfg, l2frame_size):
- # 46 = 14 (Ethernet II) + 4 (CRC Checksum) + 20 (IPv4) + 8 (UDP)
- payload = 'x' * (max(64, int(l2frame_size)) - 46)
pkt_base = Ether(src=stream_cfg['mac_src'], dst=stream_cfg['mac_dst'])
if stream_cfg['vlan_tag'] is not None:
+ # 50 = 14 (Ethernet II) + 4 (Vlan tag) + 4 (CRC Checksum) + 20 (IPv4) + 8 (UDP)
pkt_base /= Dot1Q(vlan=stream_cfg['vlan_tag'])
+ payload = 'x' * (max(64, int(l2frame_size)) - 50)
+ else:
+ # 46 = 14 (Ethernet II) + 4 (CRC Checksum) + 20 (IPv4) + 8 (UDP)
+ payload = 'x' * (max(64, int(l2frame_size)) - 46)
udp_args = {}
if stream_cfg['udp_src_port']: