From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <qian.q.xu@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id E5CF03990
 for <dev@dpdk.org>; Mon, 28 Mar 2016 04:23:48 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga104.fm.intel.com with ESMTP; 27 Mar 2016 19:23:47 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.24,404,1455004800"; d="scan'208";a="74228400"
Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206])
 by fmsmga004.fm.intel.com with ESMTP; 27 Mar 2016 19:23:47 -0700
Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by
 FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Sun, 27 Mar 2016 19:23:47 -0700
Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by
 fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Sun, 27 Mar 2016 19:23:46 -0700
Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.232]) by
 SHSMSX151.ccr.corp.intel.com ([169.254.3.18]) with mapi id 14.03.0248.002;
 Mon, 28 Mar 2016 10:23:44 +0800
From: "Xu, Qian Q" <qian.q.xu@intel.com>
To: "Tao, Zhe" <zhe.tao@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Tao, Zhe" <zhe.tao@intel.com>, "Wu, Jingjing" <jingjing.wu@intel.com>
Thread-Topic: [dpdk-dev] [PATCH 1/3 v7] i40e: support floating VEB config
Thread-Index: AQHRhnJWtOOijFIeK0e1qiHpocXxDp9uInBg
Date: Mon, 28 Mar 2016 02:23:44 +0000
Message-ID: <82F45D86ADE5454A95A89742C8D1410E0321438F@shsmsx102.ccr.corp.intel.com>
References: <1458816499-705-1-git-send-email-zhe.tao@intel.com>
 <1458895321-21896-1-git-send-email-zhe.tao@intel.com>
 <1458895321-21896-2-git-send-email-zhe.tao@intel.com>
In-Reply-To: <1458895321-21896-2-git-send-email-zhe.tao@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWExZmRjZTUtMjIwZi00NTAxLWFmN2UtMmYyOGExNzljYzlhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Imh0RVU4RGlGSmRpcGdWbXFJMm92bVwvSmdwRlQ4TmpzbmphaEorbjVpVjU4PSJ9
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
Subject: Re: [dpdk-dev] [PATCH 1/3 v7] i40e: support floating VEB config
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 28 Mar 2016 02:23:49 -0000

Tested-by: Qian Xu <qian.q.xu@intel.com>

- Test Commit: 8f6f24342281f59de0df7bd976a32f714d39b9a9
- OS/Kernel: Fedora 21/4.1.13
- GCC: gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
- CPU: Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10
- NIC: Intel(R) Ethernet Controller X710 for 10GbE SFP+
- Total 2 cases, 2 passed, 0 failed.=20

Test Case5: Floating VEB Inter-VM VF-VF=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Summary: DPDK PF, then create 2VFs and 2VMs, assign one VF to one VM, say V=
F1 in VM1, VF2 in VM2, and make PF link down(the cable can be pluged out). =
VFs in VMs are running dpdk testpmd, send traffic to VF1, and set the packe=
t's DEST MAC to VF2, check if VF2 can receive the packets. Check Inter-VM V=
F-VF MAC switch when PF is link down as well as up.

Details:=20

1. Start VM1 with VF1, VM2 with VF2, see the prerequisite part.=20
2. In the host, run testpmd with floating parameters and make the link down=
::

    ./testpmd -c 0x3 -n 4 -w 8c:00.0,enable_floating=3D1 -- -i
    testpmd> port stop all
    testpmd> show port info all

3. In VM1, run testpmd::

    ./testpmd -c 0x3 -n 4 -- -i=20
    testpmd>set mac fwd
    testpmd>set promisc off all
    testpmd>start
  =20
   In VM2, run testpmd::

    ./testpmd -c 0x3 -n 4 -- -i --eth-peer=3D0, VF1's MAC
    testpmd>set mac fwd
    testpmd>set promisc off all
    testpmd>start

  =20
4. Send 100 packets to VF1's MAC address, check if VF2 can get 100 packets.=
 Also check the PF's port stats, and there should be no packets RX/TX at PF=
 port.=20

5. In the host, run testpmd with floating parameters and keep the link up, =
then do step3 and step4, PF should have no RX/TX packets even when link is =
up::
  =20
    ./testpmc -c 0xc0000 -n 4 --floating -- -i
    testpmd> port start all
    testpmd> show port info all
   =20

Test Case6: Floating VEB Inter-VM VF traffic can't be out of NIC
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

DPDK PF, then create 1VF, assign VF1 to VM1, send traffic from VF1 to outsi=
de world, then check outside world will not see any traffic.

Details:=20

1. Start VM1 with VF1, see the prerequisite part.=20
2. In the host, run testpmd with floating parameters.
  =20
   ./testpmd -c 0x3 -n 4 -w 8c:00.0,enable_floating=3D1 -- -i
3. In VM1, run testpmd, ::

   ./testpmd -c 0x3 -n 4 -- -i --eth-peer=3D0,pf_mac_addr
   testpmd>set fwd txonly
   testpmd>start
  =20
 =20
4. At PF side, check the port stats to see if there is any RX/TX packets, a=
nd also check the traffic generator side(e.g: IXIA ports or another port co=
nnected to the DUT port) to ensure no packets.=20


Thanks
Qian


-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhe Tao
Sent: Friday, March 25, 2016 4:42 PM
To: dev@dpdk.org
Cc: Tao, Zhe; Wu, Jingjing
Subject: [dpdk-dev] [PATCH 1/3 v7] i40e: support floating VEB config

Add the new floating related argument option in the devarg.
Using this parameter, all the samples can decide whether to use legacy VEB/=
VEPA or floating VEB.
To enable this feature, the user should pass a devargs parameter to the EAL=
 like "-w 84:00.0,enable_floating=3D1", and the application will make sure =
the PMD will use the floating VEB feature for all the VFs created by this P=
F device.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 44 ++++++++++++++++++++++++++++++++++++++=
++++
 drivers/net/i40e/i40e_ethdev.h |  6 ++++++
 2 files changed, 50 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.=
c index 6fdae57..01f1d3d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -739,6 +739,44 @@ i40e_add_tx_flow_control_drop_filter(struct i40e_pf *p=
f)
 				  " frames from VSIs.");
 }
=20
+static int i40e_check_floating_handler(__rte_unused const char *key,
+				       const char *value,
+				       __rte_unused void *opaque)
+{
+	if (strcmp(value, "1"))
+		return -1;
+
+	return 0;
+}
+
+static int
+i40e_check_floating(struct rte_devargs *devargs) {
+	struct rte_kvargs *kvlist;
+	const char *floating_key =3D "enable_floating";
+
+	if (devargs =3D=3D NULL)
+		return 0;
+
+	kvlist =3D rte_kvargs_parse(devargs->args, NULL);
+	if (kvlist =3D=3D NULL)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, floating_key)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	/* Floating is enabled when there's key-value pair: enable_floating=3D1 *=
/
+	if (rte_kvargs_process(kvlist, floating_key,
+			       i40e_check_floating_handler, NULL) < 0) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	rte_kvargs_free(kvlist);
+
+	return 1;
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)  { @@ -829,6 +867,12 @@ eth_i40=
e_dev_init(struct rte_eth_dev *dev)
 		     ((hw->nvm.version >> 4) & 0xff),
 		     (hw->nvm.version & 0xf), hw->nvm.eetrack);
=20
+	/* Need the special FW version support floating VEB */
+	if (hw->aq.fw_maj_ver >=3D FLOATING_FW_MAJ) {
+		pf->floating =3D i40e_check_floating(pci_dev->devargs);
+	} else {
+		pf->floating =3D false;
+	}
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
=20
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.=
h index 1c75672..7dc6936 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -36,6 +36,7 @@
=20
 #include <rte_eth_ctrl.h>
 #include <rte_time.h>
+#include <rte_kvargs.h>
=20
 #define I40E_VLAN_TAG_SIZE        4
=20
@@ -171,6 +172,10 @@ enum i40e_flxpld_layer_idx {  #define I40E_QUEUE_ITR_I=
NTERVAL_DEFAULT 32 /* 32 us */
 #define I40E_QUEUE_ITR_INTERVAL_MAX     8160 /* 8160 us */
=20
+/* Special FW support this floating VEB feature */ #define=20
+FLOATING_FW_MAJ 5 #define FLOATING_FW_MIN 0
+
 struct i40e_adapter;
=20
 /**
@@ -446,6 +451,7 @@ struct i40e_pf {
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
+	uint16_t floating; /* The flag to use the floating VEB */
 };
=20
 enum pending_msg {
--
2.1.4