コード例 #1
0
ファイル: QemuUtils.py プロジェクト: nidhyanandhan/csit
    def create_kernelvm_config_testpmd_mac(self, **kwargs):
        """Create QEMU testpmd-mac command line.

        :param kwargs: Key-value pairs to construct command line parameters.
        :type kwargs: dict
        """
        pmd_max_pkt_len = u"9200" if kwargs[u"jumbo_frames"] else u"1518"
        testpmd_cmd = DpdkUtil.get_testpmd_cmdline(
            eal_corelist=f"0-{self._opt.get(u'smp') - 1}",
            eal_driver=False,
            eal_pci_whitelist0=u"0000:00:06.0",
            eal_pci_whitelist1=u"0000:00:07.0",
            eal_in_memory=True,
            pmd_num_mbufs=16384,
            pmd_fwd_mode=u"mac",
            pmd_nb_ports=u"2",
            pmd_portmask=u"0x3",
            pmd_max_pkt_len=pmd_max_pkt_len,
            pmd_mbuf_size=u"16384",
            pmd_eth_peer_0=f"0,{kwargs[u'vif1_mac']}",
            pmd_eth_peer_1=f"1,{kwargs[u'vif2_mac']}",
            pmd_rxq=kwargs[u"queues"],
            pmd_txq=kwargs[u"queues"],
            pmd_tx_offloads=u"0x0",
            pmd_nb_cores=str(self._opt.get(u"smp") - 1))

        self._opt[u"vnf_bin"] = f"{self._testpmd_path}/{testpmd_cmd}"
コード例 #2
0
ファイル: QemuUtils.py プロジェクト: preym17/csit
    def create_kernelvm_config_testpmd_mac(self, **kwargs):
        """Create QEMU testpmd-mac command line.

        :param kwargs: Key-value pairs to construct command line parameters.
        :type kwargs: dict
        """
        testpmd_path = ('{path}/{arch}-native-linuxapp-gcc/app'.
                        format(path=Constants.QEMU_VM_DPDK,
                               arch=Topology.get_node_arch(self._node)))
        testpmd_cmd = DpdkUtil.get_testpmd_cmdline(
            eal_corelist='0-{smp}'.format(smp=self._opt.get('smp') - 1),
            eal_driver=False,
            eal_in_memory=True,
            pmd_num_mbufs=16384,
            pmd_fwd_mode='mac',
            pmd_eth_peer_0='0,{mac}'.format(mac=kwargs['vif1_mac']),
            pmd_eth_peer_1='1,{mac}'.format(mac=kwargs['vif2_mac']),
            pmd_rxq=kwargs['queues'],
            pmd_txq=kwargs['queues'],
            pmd_tx_offloads=False,
            pmd_disable_hw_vlan=False,
            pmd_max_pkt_len=9200 if kwargs['jumbo_frames'] else None,
            pmd_nb_cores=str(self._opt.get('smp') - 1))

        self._opt['vnf_bin'] = ('{testpmd_path}/{testpmd_cmd}'.
                                format(testpmd_path=testpmd_path,
                                       testpmd_cmd=testpmd_cmd))
コード例 #3
0
    def start_testpmd(
            node, if1, if2, lcores_list, nb_cores, queue_nums,
            jumbo_frames, rxq_size=1024, txq_size=1024):
        """
        Execute the testpmd on the DUT node.

        :param node: DUT node.
        :param if1: The test link interface 1.
        :param if2: The test link interface 2.
        :param lcores_list: The DPDK run cores.
        :param nb_cores: The cores number for the forwarding.
        :param queue_nums: The queues number for the NIC.
        :param jumbo_frames: Indication if the jumbo frames are used (True) or
            not (False).
        :param rxq_size: RXQ size. Default=1024.
        :param txq_size: TXQ size. Default=1024.
        :type node: dict
        :type if1: str
        :type if2: str
        :type lcores_list: str
        :type nb_cores: str
        :type queue_nums: str
        :type jumbo_frames: bool
        :type rxq_size: int
        :type txq_size: int
        :raises RuntimeError: If the script "run_testpmd.sh" fails.
        """
        if node[u"type"] == NodeType.DUT:
            if_pci0 = Topology.get_interface_pci_addr(node, if1)
            if_pci1 = Topology.get_interface_pci_addr(node, if2)

            pmd_max_pkt_len = u"9200" if jumbo_frames else u"1518"
            testpmd_args = DpdkUtil.get_testpmd_args(
                eal_corelist=f"1,{lcores_list}",
                eal_driver=False,
                eal_pci_whitelist0=if_pci0,
                eal_pci_whitelist1=if_pci1,
                eal_in_memory=True,
                pmd_num_mbufs=16384,
                pmd_fwd_mode=u"io",
                pmd_nb_ports=u"2",
                pmd_portmask=u"0x3",
                pmd_max_pkt_len=pmd_max_pkt_len,
                pmd_mbuf_size=u"16384",
                pmd_rxd=rxq_size,
                pmd_txd=txq_size,
                pmd_rxq=queue_nums,
                pmd_txq=queue_nums,
                pmd_nb_cores=nb_cores,
                pmd_disable_link_check=True,
                pmd_auto_start=True,
                pmd_numa=True
            )

            command = f"{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_LIB_SH}"\
                f"/entry/run_testpmd.sh \"{testpmd_args}\""
            message = f"Failed to execute testpmd at node {node['host']}"
            exec_cmd_no_error(node, command, timeout=1800, message=message)
コード例 #4
0
ファイル: L3fwdTest.py プロジェクト: 0Martin/csit
    def start_l3fwd(
            nodes, node, if1, if2, lcores_list, nb_cores, queue_nums,
            jumbo_frames):
        """
        Execute the l3fwd on the dut_node.

        :param nodes: All the nodes info in the topology file.
        :param node: DUT node.
        :param if1: The test link interface 1.
        :param if2: The test link interface 2.
        :param lcores_list: The lcore list string for the l3fwd routing
        :param nb_cores: The cores number for the forwarding
        :param queue_nums: The queues number for the NIC
        :param jumbo_frames: Indication if the jumbo frames are used (True) or
                             not (False).
        :type nodes: dict
        :type node: dict
        :type if1: str
        :type if2: str
        :type lcores_list: str
        :type nb_cores: str
        :type queue_nums: str
        :type jumbo_frames: bool
        """
        if node[u"type"] == NodeType.DUT:
            adj_mac0, adj_mac1, if_pci0, if_pci1 = L3fwdTest.get_adj_mac(
                nodes, node, if1, if2
            )

            list_cores = [int(item) for item in lcores_list.split(u",")]

            # prepare the port config param
            nb_cores = int(nb_cores)
            index = 0
            port_config = ''
            for port in range(0, 2):
                for queue in range(0, int(queue_nums)):
                    index = 0 if nb_cores == 1 else index
                    port_config += f"({port}, {queue}, {list_cores[index]}),"
                    index += 1

            if jumbo_frames:
                l3fwd_args = DpdkUtil.get_l3fwd_args(
                    eal_corelist=f"0,{lcores_list}",
                    eal_driver=False,
                    eal_pci_whitelist0=if_pci0,
                    eal_pci_whitelist1=if_pci1,
                    eal_in_memory=True,
                    pmd_config=f"\\\"{port_config.rstrip(u',')}\\\"",
                    pmd_eth_dest_0=f"\\\"0,{adj_mac0}\\\"",
                    pmd_eth_dest_1=f"\\\"1,{adj_mac1}\\\"",
                    pmd_parse_ptype=True,
                    pmd_enable_jumbo=jumbo_frames,
                    pmd_max_pkt_len=jumbo_frames
                )
            else:
                l3fwd_args = DpdkUtil.get_l3fwd_args(
                    eal_corelist=f"0,{lcores_list}",
                    eal_driver=False,
                    eal_pci_whitelist0=if_pci0,
                    eal_pci_whitelist1=if_pci1,
                    eal_in_memory=True,
                    pmd_config=f"\\\"{port_config.rstrip(u',')}\\\"",
                    pmd_eth_dest_0=f"\\\"0,{adj_mac0}\\\"",
                    pmd_eth_dest_1=f"\\\"1,{adj_mac1}\\\"",
                    pmd_parse_ptype=True
                )

            command = f"{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_LIB_SH}"\
                f"/entry/run_l3fwd.sh \"{l3fwd_args} -P -L -p 0x3\""
            message = f"Failed to execute l3fwd test at node {node['host']}"
            exec_cmd_no_error(node, command, timeout=1800, message=message)