From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 5/8] framework: net device object get from net_device module
Date: Sun, 13 Dec 2015 12:57:41 +0800 [thread overview]
Message-ID: <1449982664-4362-6-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1449982664-4362-1-git-send-email-yong.liu@intel.com>
From: Marvin Liu <yong.liu@intel.com>
All net device object will be retrieved from net_device module. If
there has been the object for required nic, net_device module will just
return it without re-initialized it.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dut.py b/framework/dut.py
index 2101fc8..fde5071 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -38,7 +38,7 @@ from config import PortConf
from settings import NICS, LOG_NAME_SEP
from ssh_connection import SSHConnection
from crb import Crb
-from net_device import NetDevice
+from net_device import GetNicObj
from virt_resource import VirtResource
from utils import RED
from uuid import uuid4
@@ -240,7 +240,7 @@ class Dut(Crb):
bus_id = addr_array[0]
devfun_id = addr_array[1]
- port = NetDevice(self, bus_id, devfun_id)
+ port = GetNicObj(self, bus_id, devfun_id)
self.send_expect('echo 0000:%s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind'
% (pci_bus, bus_id, devfun_id), '# ')
@@ -476,14 +476,6 @@ class Dut(Crb):
return self.ports_info[port_num]['numa']
- def get_port_info(self, pci):
- """
- return port info by pci id
- """
- for port_info in self.ports_info:
- if port_info['pci'] == pci:
- return port_info
-
def lcore_table_print(self, horizontal=False):
if not horizontal:
dts.results_table_add_header(['Socket', 'Core', 'Thread'])
@@ -631,7 +623,7 @@ class Dut(Crb):
return
for port_info in self.ports_info:
- port = NetDevice(self, port_info['pci'], port_info['type'])
+ port = GetNicObj(self, port_info['pci'], port_info['type'])
intf = port.get_interface_name()
self.logger.info("DUT cached: [000:%s %s] %s" % (port_info['pci'],
@@ -665,7 +657,7 @@ class Dut(Crb):
bus_id = addr_array[0]
devfun_id = addr_array[1]
- port = NetDevice(self, bus_id, devfun_id)
+ port = GetNicObj(self, bus_id, devfun_id)
numa = port.socket
# store the port info to port mapping
self.ports_info.append(
@@ -686,7 +678,7 @@ class Dut(Crb):
skipped))
continue
- port = NetDevice(self, pci_bus, '')
+ port = GetNicObj(self, pci_bus, '')
intf = port.get_interface_name()
macaddr = port.get_mac_addr()
@@ -734,13 +726,13 @@ class Dut(Crb):
sriov_vfs_pci = port.get_sriov_vfs_pci()
self.ports_info[port_id]['sriov_vfs_pci'] = sriov_vfs_pci
- # instantiate the VF with NetDevice
+ # instantiate the VF
vfs_port = []
for vf_pci in sriov_vfs_pci:
addr_array = vf_pci.split(':')
bus_id = addr_array[0]
devfun_id = addr_array[1]
- vf_port = NetDevice(self, bus_id, devfun_id)
+ vf_port = GetNicObj(self, bus_id, devfun_id)
vfs_port.append(vf_port)
self.ports_info[port_id]['vfs_port'] = vfs_port
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 8d0c5d9..1292d08 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -38,7 +38,7 @@ from config import PortConf
from settings import NICS, LOG_NAME_SEP, get_netdev
from project_dpdk import DPDKdut
from dut import Dut
-from net_device import NetDevice
+from net_device import GetNicObj
class VirtDut(DPDKdut):
@@ -252,7 +252,7 @@ class VirtDut(DPDKdut):
addr_array = pci_bus.split(':')
bus_id = addr_array[0]
devfun_id = addr_array[1]
- port = NetDevice(self, bus_id, devfun_id)
+ port = GetNicObj(self, bus_id, devfun_id)
itf = port.get_interface_name()
self.send_expect("ifconfig %s up" % itf, "# ")
time.sleep(30)
--
1.9.3
next prev parent reply other threads:[~2015-12-13 4:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-13 4:57 [dts] [RFC PATCH 0/8] support fm10k family nics Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 1/8] framework settings: rename nic_name_from_type to get_nic_name Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 2/8] framework crb: add function to retrieve port information Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 3/8] framework: create independent foler for nic modules Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 4/8] nics: add fm10k module for RedRockCanYou family nic Yong Liu
2015-12-13 4:57 ` Yong Liu [this message]
2015-12-13 4:57 ` [dts] [PATCH 6/8] framework dts: close netdevice related session after exit Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 7/8] conf: add sample for RedRockCanYou family nic Yong Liu
2015-12-13 4:57 ` [dts] [PATCH 8/8] framework project_dpdk: add extra setup after bind driver Yong Liu
2015-12-14 1:34 ` [dts] [RFC PATCH 0/8] support fm10k family nics Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449982664-4362-6-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).