* [dts] [PATCH 1/3] framework dut: add port stop when execution exit
@ 2016-01-20 1:47 Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 2/3] framework packet: support strip packet payload Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting Yong Liu
0 siblings, 2 replies; 3+ messages in thread
From: Yong Liu @ 2016-01-20 1:47 UTC (permalink / raw)
To: dts
Some nic like RRC required additional setup like testpoint start-up. So
when execution done, need call additional stop function.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dts.py b/framework/dts.py
index 2dd511b..1e60a01 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -341,6 +341,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario):
scene.destroy_scene()
scene = None
+ dut.stop_ports()
dut.restore_interfaces()
tester.restore_interfaces()
diff --git a/framework/dut.py b/framework/dut.py
index 178c35f..afb5204 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -225,6 +225,23 @@ class Dut(Crb):
self.send_expect("kldunload contigmem.ko", "#")
self.send_expect("kldload if_ixgbe.ko", "#", 20)
+ def stop_ports(self):
+ """
+ After all execution done, some special nic like fm10k should be stop
+ """
+ for port in self.ports_info:
+ pci_bus = port['pci']
+ pci_id = port['type']
+ # get device driver
+ driver = settings.get_nic_driver(pci_id)
+ if driver is not None:
+ # unbind device driver
+ addr_array = pci_bus.split(':')
+ bus_id = addr_array[0]
+ devfun_id = addr_array[1]
+ port = GetNicObj(self, bus_id, devfun_id)
+ port.stop()
+
def restore_interfaces_linux(self):
"""
Restore Linux interfaces.
@@ -824,7 +841,7 @@ class Dut(Crb):
dutpci = self.ports_info[dutPort]['pci']
if peer is not None:
for remotePort in range(len(self.tester.ports_info)):
- if self.tester.ports_info[remotePort]['pci'] == peer:
+ if self.tester.ports_info[remotePort]['pci'].lower() == peer.lower():
hits[remotePort] = True
self.ports_map[dutPort] = remotePort
break
diff --git a/nics/net_device.py b/nics/net_device.py
index 2b0517b..c3b3755 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -64,6 +64,9 @@ class NetDevice(object):
self.get_interface_name()
self.socket = self.get_nic_socket()
+ def stop(self):
+ pass
+
def close(self):
pass
--
2.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH 2/3] framework packet: support strip packet payload
2016-01-20 1:47 [dts] [PATCH 1/3] framework dut: add port stop when execution exit Yong Liu
@ 2016-01-20 1:47 ` Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting Yong Liu
1 sibling, 0 replies; 3+ messages in thread
From: Yong Liu @ 2016-01-20 1:47 UTC (permalink / raw)
To: dts
Add new function support strip packet payload according to layer. By now
only support strip L2/L3/L4 packet, not support tunnel packet.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/packet.py b/framework/packet.py
index aaa1dd0..a7853e9 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -322,6 +322,7 @@ class Packet(object):
'TIMESYNC': {'layers': ['ether', 'raw'], 'cfgload': False},
'ARP': {'layers': ['ether', 'arp'], 'cfgload': False},
'LLDP': {'layers': ['ether', 'lldp'], 'cfgload': False},
+ 'IP_RAW': {'layers': ['ether', 'ipv4', 'raw'], 'cfgload': True},
'TCP': {'layers': ['ether', 'ipv4', 'tcp', 'raw'], 'cfgload': True},
'UDP': {'layers': ['ether', 'ipv4', 'udp', 'raw'], 'cfgload': True},
'VLAN_UDP': {'layers': ['ether', 'dot1q', 'ipv4', 'udp', 'raw'], 'cfgload': True},
@@ -721,6 +722,23 @@ def compare_pktload(pkt1=None, pkt2=None, layer="L2"):
else:
return False
+def strip_pktload(pkt=None, layer="L2"):
+ if layer == "L2":
+ l_idx = 0
+ elif layer == "L3":
+ l_idx = 1
+ elif layer == "L4":
+ l_idx = 2
+ else:
+ l_idx = 0
+ try:
+ load = hexstr(str(pkt.pktgen.pkt.getlayer(l_idx)), onlyhex=1)
+ except:
+ # return pass when scapy failed to extract packet
+ load = ""
+
+ return load
+
###############################################################################
###############################################################################
if __name__ == "__main__":
--
2.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting
2016-01-20 1:47 [dts] [PATCH 1/3] framework dut: add port stop when execution exit Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 2/3] framework packet: support strip packet payload Yong Liu
@ 2016-01-20 1:47 ` Yong Liu
1 sibling, 0 replies; 3+ messages in thread
From: Yong Liu @ 2016-01-20 1:47 UTC (permalink / raw)
To: dts
1) Add basic rule to enhance RRC performance.
2) Add basic rule to redirect PEP to assigned EPL.
3) Support RRC rx/tx vlan function.
4) Support RRC jumboframe setting.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/nics/fm10k.py b/nics/fm10k.py
index ab35981..7d42814 100644
--- a/nics/fm10k.py
+++ b/nics/fm10k.py
@@ -29,7 +29,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
from crb import Crb
from config import PortConf, PORTCONF
from exception import PortConfigParseException
@@ -39,6 +38,44 @@ from net_device import NetDevice
DEF_PASSWD = 's'
TP_BINARY = 'TestPoint'
+FUNC_RULES = [
+ # disable cut through for jumbo frame case
+ 'set port config 20,22 tx_cut_through off',
+ # disable mac learning
+ 'set port config 0..22 learning off',
+ #redirect PEP0 to EPL0
+ 'create acl 0',
+ 'create acl-rule 0 0',
+ 'add acl-rule condition 0 0 src-port 20',
+ 'add acl-rule action 0 0 redirect 1',
+ 'add acl-rule action 0 0 count',
+ #redirect PEP1 to EPL1
+ 'create acl 1',
+ 'create acl-rule 1 0',
+ 'add acl-rule condition 1 0 src-port 22',
+ 'add acl-rule action 1 0 redirect 5',
+ 'add acl-rule action 1 0 count',
+ 'apply acl',
+ ]
+
+PERF_RULES = [
+ 'set port config 0..11 parser_cfg L4', # frame parser up to L4
+ # good for performance
+ 'set api attribute boolean api.paritySweeper.enable false',
+ 'reg dbg set 0 CM_SOFTDROP_WM 0x5f005f00 0 0',
+ 'reg dbg set 0 CM_SHARED_WM 0x5f00 0 0',
+ # rule for direct rx traffic
+ # mac filter will be useless, so only enable for perf
+ 'create acl-rule 0 1',
+ 'add acl-rule condition 0 1 src-port 1',
+ 'add acl-rule action 0 1 redirect 20',
+ 'add acl-rule action 0 1 count',
+ 'create acl-rule 1 1',
+ 'add acl-rule condition 1 1 src-port 5',
+ 'add acl-rule action 1 1 redirect 22',
+ 'add acl-rule action 1 1 count',
+ 'apply acl',
+ ]
class CtrlCrb(Crb):
"""
@@ -113,13 +150,29 @@ class RedRockCanyou(NetDevice):
# setup function should be called after bind to igb_uio
self.start_testpoint()
- def close(self):
+ def optimize_perf(self, peer0="", peer1=""):
+ # rule which can optimize performance
+ if self.sec_port is False:
+ # applied rules
+ for rule in PERF_RULES:
+ self.ctrl_crb.send_expect("%s" %rule, "<0>%")
+ # add default mac rule
+ self.ctrl_crb.send_expect("add mac %s 1 locked port 1" % peer0, "<0>%")
+ self.ctrl_crb.send_expect("add mac %s 1 locked port 5" % peer1, "<0>%")
+
+ def stop(self):
# second port do not need any operation
if self.sec_port:
return
# stop testpoint
self.stop_testpoint()
+
+ def close(self):
+ # second port do not need any operation
+ if self.sec_port:
+ return
+
# close session
if self.ctrl_crb.session:
self.ctrl_crb.session.close()
@@ -142,6 +195,8 @@ class RedRockCanyou(NetDevice):
command = TP_BINARY
self.ctrl_crb.send_expect("%s" % command, "<0>%", 120)
+ for rule in FUNC_RULES:
+ self.ctrl_crb.send_expect("%s" %rule, "<0>%")
def stop_testpoint(self):
"""
@@ -152,13 +207,34 @@ class RedRockCanyou(NetDevice):
def get_control(self):
return self.ctrl_crb
- def enable_vlan(self, vlan_id=0):
+ def add_vlan(self, vlan_id=0):
self.ctrl_crb.send_expect("create vlan %d" % vlan_id, "<0>%")
- self.ctrl_crb.send_expect("add vlan port %d 1,5,20,22" % vlan_id, "<0>%")
+ if self.sec_port:
+ self.ctrl_crb.send_expect("add vlan port %d 5,22" % vlan_id, "<0>%")
+ else:
+ self.ctrl_crb.send_expect("add vlan port %d 1,20" % vlan_id, "<0>%")
- def disable_vlan(self, vlan_id=0):
- self.ctrl_crb.send_expect("del vlan port %d 1,5,20,22" % vlan_id, "<0>%")
+ def delete_vlan(self, vlan_id=0):
+ if self.sec_port:
+ self.ctrl_crb.send_expect("del vlan port %d 5,22" % vlan_id, "<0>%")
+ else:
+ self.ctrl_crb.send_expect("del vlan port %d 1,20" % vlan_id, "<0>%")
self.ctrl_crb.send_expect("del vlan %d" % vlan_id, "<0>%")
- def enable_jumbo(self):
- NotImplemented
+ def add_txvlan(self, vlan_id=0):
+ if self.sec_port:
+ self.ctrl_crb.send_expect("set vlan tagging %d 5 tag" % vlan_id, "<0>%")
+ else:
+ self.ctrl_crb.send_expect("set vlan tagging %d 1 tag" % vlan_id, "<0>%")
+
+ def delete_txvlan(self, vlan_id=0):
+ if self.sec_port:
+ self.ctrl_crb.send_expect("set vlan tagging %d 5 untag" % vlan_id, "<0>%")
+ else:
+ self.ctrl_crb.send_expect("set vlan tagging %d 1 untag" % vlan_id, "<0>%")
+
+ def enable_jumbo(self, framesize=0):
+ if self.sec_port:
+ self.ctrl_crb.send_expect("set port config 5 max_frame_size %d" % framesize, "<0>%")
+ else:
+ self.ctrl_crb.send_expect("set port config 1 max_frame_size %d" % framesize, "<0>%")
--
2.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-20 1:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 1:47 [dts] [PATCH 1/3] framework dut: add port stop when execution exit Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 2/3] framework packet: support strip packet payload Yong Liu
2016-01-20 1:47 ` [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting Yong Liu
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).