From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 01E6E2BCE for ; Fri, 4 Mar 2016 02:08:35 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 03 Mar 2016 17:08:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,533,1449561600"; d="scan'208";a="59507278" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 03 Mar 2016 17:08:31 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 3 Mar 2016 17:08:30 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.24]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.42]) with mapi id 14.03.0248.002; Fri, 4 Mar 2016 09:07:52 +0800 From: "Liu, Yong" To: gowrishankar Thread-Topic: [dts] [PATCH 4/9] framework: enable connect X3 support Thread-Index: AQHRcH8T1X5kTw/HKUCHYTuvSBpVDp9EiSlwgAJUiICAAaUTMA== Date: Fri, 4 Mar 2016 01:07:51 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E1450172E@SHSMSX103.ccr.corp.intel.com> References: <1456481834-10027-1-git-send-email-gowrishankar.m@linux.vnet.ibm.com> <1456481834-10027-5-git-send-email-gowrishankar.m@linux.vnet.ibm.com> <86228AFD5BCD8E4EBFD2B90117B5E81E144FF148@SHSMSX103.ccr.corp.intel.com> <56D7EE85.5040407@linux.vnet.ibm.com> In-Reply-To: <56D7EE85.5040407@linux.vnet.ibm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDU2NDcxZGQtOGIxMi00ZmZkLTgzNmQtNTRkZjE1ZmZiY2IwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlNvN2doYkkyR3JVZk5iU1FGaHhwRHRuU1FWZnZJemJROHdSOTJqYm9UU009In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: dts Subject: Re: [dts] [PATCH 4/9] framework: enable connect X3 support X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 01:08:36 -0000 Thanks, Gowrishankar. There's no more comments from me. > -----Original Message----- > From: gowrishankar [mailto:gowrishankar.m@linux.vnet.ibm.com] > Sent: Thursday, March 03, 2016 3:58 PM > To: Liu, Yong > Cc: dts > Subject: Re: [dts] [PATCH 4/9] framework: enable connect X3 support >=20 > On Tuesday 01 March 2016 06:47 PM, Liu, Yong wrote: > > Hi Gowrishankar, > > > >> -----Original Message----- > >> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Gowrishankar > >> Sent: Friday, February 26, 2016 6:17 PM > >> To: dts > >> Subject: [dts] [PATCH 4/9] framework: enable connect X3 support > >> > >> Connect X3 dual port adapter shares single pci device ID. This limits > dts > >> frame- > >> work to use both the ports for the tests. With this patch, a new > >> attribute also > >> to refer second interface in such single pci port lookup is introduced= . > >> Added > >> supporting APIs to derive this second interface and its MAC addresses > >> whereever > >> needed. > >> > >> Signed-off-by: Gowrishankar > >> --- > >> framework/dut.py | 25 +++++++++++++++++-------- > >> framework/settings.py | 2 ++ > >> framework/tester.py | 26 ++++++++++++++++++++++++++ > >> nics/net_device.py | 27 +++++++++++++++++++++++++++ > >> 4 files changed, 72 insertions(+), 8 deletions(-) > >> > >> diff --git a/framework/dut.py b/framework/dut.py > >> index ff40fac..41605a3 100644 > >> --- a/framework/dut.py > >> +++ b/framework/dut.py > >> @@ -569,15 +569,12 @@ class Dut(Crb): > >> > >> for port_info in self.ports_info: > >> port =3D port_info['port'] > >> - intf =3D port.get_interface_name() > >> - if "No such file" in intf: > >> - self.logger.info("DUT: [%s] %s" % (pci_bus, > >> unknow_interface)) > >> - continue > >> + intf =3D port_info['intf'] > > Here is to strip NIC kernel interface after bind it to kernel driver. > > When in scan_port function, nic information may unavailable for kernel > driver not bound. > > So macaddress and interface should strip in rescan_port function. >=20 > Sure, I will add this check. >=20 > >> out =3D self.send_expect("ip link show %s" % intf, "# ") > >> if "DOWN" in out: > >> self.send_expect("ip link set %s up" % intf, "# ") > >> time.sleep(5) > >> - macaddr =3D port.get_mac_addr() > >> + macaddr =3D port_info['mac'] > >> out =3D self.send_expect("ip -family inet6 address show > dev %s > >> | awk '/inet6/ { print $2 }'" > >> % intf, "# ") > >> ipv6 =3D out.split('/')[0] > >> @@ -585,8 +582,6 @@ class Dut(Crb): > >> if ":" not in ipv6: > >> ipv6 =3D "Not connected" > >> > >> - port_info['mac'] =3D macaddr > >> - port_info['intf'] =3D intf > >> port_info['ipv6'] =3D ipv6 > >> > >> def rescan_ports_uncached_freebsd(self): > >> @@ -689,10 +684,24 @@ class Dut(Crb): > >> devfun_id =3D addr_array[2] > >> > >> port =3D GetNicObj(self, domain_id, bus_id, devfun_id) > >> + intf =3D port.get_interface_name() > >> + macaddr =3D port.get_mac_addr() > >> + numa =3D port.socket > >> + # store the port info to port mapping > >> + self.ports_info.append( > >> + {'port': port, 'pci': pci_bus, 'type': pci_id, 'numa'= : > >> numa, > >> + 'intf': intf, 'mac': macaddr}) > >> + > >> + if not port.get_interface_peer(): > >> + continue > >> + > >> + intf =3D port.get_interface_peer() > >> + macaddr =3D port.get_peer_mac_addr() > >> numa =3D port.socket > >> # store the port info to port mapping > >> self.ports_info.append( > >> - {'port': port, 'pci': pci_bus, 'type': pci_id, 'numa'= : > >> numa}) > >> + {'port': port, 'pci': pci_bus, 'type': pci_id, 'numa'= : > >> numa, > >> + 'intf': intf, 'mac': macaddr}) > >> > >> def scan_ports_uncached_freebsd(self): > >> """ > >> diff --git a/framework/settings.py b/framework/settings.py > >> index 068afce..f3e3b9a 100644 > >> --- a/framework/settings.py > >> +++ b/framework/settings.py > >> @@ -78,6 +78,7 @@ NICS =3D { > >> 'fortpark':'8086:374c', > >> 'fvl10g_vf':'8086:154c', > >> 'atwood': '8086:15d5', > >> + 'ConnectX3':'15b3:1003', > >> 'ConnectX4':'15b3:1013', > >> 'boulderrapid': '8086:15d0', > >> } > >> @@ -114,6 +115,7 @@ DRIVERS =3D { > >> 'fortpark':'i40e', > >> 'fvl10g_vf':'i40evf', > >> 'atwood': 'fm10k', > >> + 'ConnectX3':'mlx4_core', > >> 'ConnectX4':'mlx5_core', > >> 'boulderrapid': 'fm10k', > >> } > >> diff --git a/framework/tester.py b/framework/tester.py > >> index 1d69355..87ee298 100644 > >> --- a/framework/tester.py > >> +++ b/framework/tester.py > >> @@ -207,6 +207,10 @@ class Tester(Crb): > >> itf =3D port.get_interface_name() > >> self.enable_ipv6(itf) > >> self.send_expect("ifconfig %s up" % itf, "# ") > >> + if port.get_interface_peer(): > >> + itf =3D port.get_interface_peer() > >> + self.enable_ipv6(itf) > >> + self.send_expect("ifconfig %s up" % itf, "# ") > >> > >> except Exception as e: > >> self.logger.error(" !!! Restore ITF: " + e.message) > >> @@ -220,6 +224,9 @@ class Tester(Crb): > >> port =3D GetNicObj(self, addr_array[0], addr_array[1= ], > >> addr_array[2]) > >> itf =3D port.get_interface_name() > >> self.enable_promisc(itf) > >> + if port.get_interface_peer(): > >> + itf =3D port.get_interface_peer() > >> + self.enable_promisc(itf) > >> except Exception as e: > >> pass > >> > >> @@ -314,6 +321,25 @@ class Tester(Crb): > >> 'mac': macaddr, > >> 'ipv6': ipv6}) > >> > >> + # return if port is not connect x3 > >> + if not port.get_interface_peer(): > >> + continue > >> + > >> + intf =3D port.get_interface_peer() > >> + > >> + self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id, > >> intf)) > >> + macaddr =3D port.get_peer_mac_addr() > >> + > >> + ipv6 =3D port.get_ipv6_addr() > >> + > >> + # store the port info to port mapping > >> + self.ports_info.append({'port': port, > >> + 'pci': pci_bus, > >> + 'type': pci_id, > >> + 'intf': intf, > >> + 'mac': macaddr, > >> + 'ipv6': ipv6}) > >> + > >> def send_ping6(self, localPort, ipv6, mac): > >> """ > >> Send ping6 packet from local port with destination ipv6 > address. > >> diff --git a/nics/net_device.py b/nics/net_device.py > >> index a9127cb..b0fee34 100644 > >> --- a/nics/net_device.py > >> +++ b/nics/net_device.py > >> @@ -150,9 +150,21 @@ class NetDevice(object): > >> self.intf_name =3D 'N/A' > >> else: > >> self.intf_name =3D out > >> + self.intf_peer =3D None > >> + > >> + # not a complete fix for CX3. > >> + if len(out.split()) > 1 and self.default_driver =3D=3D > 'mlx4_core': > >> + self.intf_name =3D out.split()[0] > >> + self.intf_peer =3D out.split()[1] > >> > >> return self.intf_name > >> > >> + def get_interface_peer(self): > >> + """ > >> + Get interface name of second port of this pci device. > >> + """ > >> + return self.intf_peer > >> + > > In DTS, word "peer" has been designated for tester port which connected > to dut port. > > Suggest change another word for the second port. >=20 > I got it. I would rather call it "interface 2" to avoid confusion. >=20 > get_interface2_name(), get_intf2_mac_addr() and self.intf2_name are more > correct I hope. >=20 > Thank you for the review. If there are no other changes, I can send > version 2 of patches with above correction. >=20 > Regards, > Gowrishankar >=20 > > > >> def get_interface_name_linux(self, domain_id, bus_id, devfun_id, > >> driver): > >> """ > >> Get interface name of specified pci device on linux. > >> @@ -242,6 +254,18 @@ class NetDevice(object): > >> else: > >> return out > >> > >> + @nic_has_driver > >> + def get_peer_mac_addr(self): > >> + """ > >> + Get mac address of peer of specified pci device. > >> + """ > >> + get_mac_addr =3D getattr(self, 'get_mac_addr_%s' % > >> self.__get_os_type()) > >> + out =3D get_mac_addr(self.get_interface_peer(), self.domain_i= d, > >> self.bus_id, self.devfun_id, self.current_driver) > >> + if "No such file or directory" in out: > >> + return 'N/A' > >> + else: > >> + return out > >> + > >> def get_mac_addr_linux(self, intf, domain_id, bus_id, devfun_id, > >> driver): > >> """ > >> Get mac address of specified pci device on linux. > >> @@ -733,6 +757,9 @@ class NetDevice(object): > >> if driver =3D=3D self.default_driver: > >> itf =3D self.get_interface_name() > >> self.__send_expect("ifconfig %s up" % itf, "# ") > >> + if self.get_interface_peer(): > >> + itf =3D self.get_interface_peer() > >> + self.__send_expect("ifconfig %s up" % itf, "# ") > >> > >> def bind_driver_linux_pci_stub(self, domain_id, bus_id, > devfun_id): > >> """ > >> -- > >> 1.7.10.4 > > > >