From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 9C63F1D7 for ; Mon, 11 Dec 2017 04:22:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2017 19:22:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,391,1508828400"; d="scan'208";a="185519518" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 10 Dec 2017 19:22:55 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Dec 2017 19:22:54 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Dec 2017 19:22:54 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Mon, 11 Dec 2017 11:22:52 +0800 From: "Peng, Yuan" To: "Wu, Yanglong" , "dev@dpdk.org" CC: "Wu, Yanglong" Thread-Topic: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback Thread-Index: AQHTYbTqfr53BDBBxUChsUMyYbhN0KM9mWKQ Date: Mon, 11 Dec 2017 03:22:52 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEA3746085B@SHSMSX103.ccr.corp.intel.com> References: <20171120040531.152695-1-yanglong.wu@intel.com> In-Reply-To: <20171120040531.152695-1-yanglong.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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] net/i40e: i40e support mac loopback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 03:22:57 -0000 Tested-by: Peng,Yuan - Tested Branch: dpdk master dpdk-17.11-rc1 - Tested Commit: 87607f45bdecc31c33e9b7666b918dc685a10093 - OS: 4.4.0-62-generic - GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 - CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz - NIC: Intel Corporation Ethernet Controller XL710 for 40GbE QSFP+ [8086:15= 83] - Default x86_64-native-linuxapp-gcc configuration - Prerequisites: - Total 2cases, 2passed, 0 failed - Prerequisites command / instruction: Two 40Gb Ethernet ports of the DUT are directly connected and link is up. - Case: Case1: loopback mode enable loopback mode: In dpdk/test/test/test_pmd_perf.c set:: .lpbk_mode=3D1 #define MAX_TRAFFIC_BURST 32 then make test start test:: ./test/test/test -c f -n 4 -- -i RTE>>pmd_perf_autotest The final output of the test will be matrix of average cycles of IO used pe= r packet, and "Test OK" is printed out. the peer port can't receive any packet. case2: physical link mode disable lookback mode: In dpdk/test/test/test_pmd_perf.c set:: .lpbk_mode=3D0 #define MAX_TRAFFIC_BURST 32 then make test start test:: ./test/test/test -c f -n 4 -- -i RTE>>pmd_perf_autotest there is not "Test OK" presented. the peer port can receive all the 32 packets. -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu Sent: Monday, November 20, 2017 12:06 PM To: dev@dpdk.org Cc: Wu, Yanglong Subject: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback According to loopback mode, setup loopback link or not. If loopback link is setted, packets will be sent to rx_q from tx_q directly= .Loopback mode can be used to support testing task. Signed-off-by: Yanglong Wu --- drivers/net/i40e/base/i40e_adminq_cmd.h | 1 + drivers/net/i40e/i40e_ethdev.c | 12 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/bas= e/i40e_adminq_cmd.h index c36da2a32..8171f877b 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -2128,6 +2128,7 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg); /* Set Loopback mode (0x0618) */ struct i40e_aqc_set_lb_mode { __le16 lb_mode; +#define I40E_AQ_LB_MODE_NONE 0x0 #define I40E_AQ_LB_PHY_LOCAL 0x01 #define I40E_AQ_LB_PHY_REMOTE 0x02 #define I40E_AQ_LB_MAC_LOCAL 0x04 diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index f40c463aa..2e6aa9d0d 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2048,6 +2048,17 @@ i40e_dev_start(struct rte_eth_dev *dev) } } =20 + /* Enable mac loopback mode */ + if (hw->mac.type =3D=3D I40E_MAC_XL710 && + (dev->data->dev_conf.lpbk_mode =3D=3D I40E_AQ_LB_MODE_NONE || + dev->data->dev_conf.lpbk_mode =3D=3D I40E_AQ_LB_PHY_LOCAL)) { + ret =3D i40e_aq_set_lb_modes(hw, + dev->data->dev_conf.lpbk_mode, NULL); + if (ret !=3D I40E_SUCCESS) { + PMD_DRV_LOG(INFO, "fail to set loopback link"); + goto err_up; + } + } + /* Apply link configure */ if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G | -- 2.11.0