From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0E4151B225 for ; Fri, 22 Dec 2017 05:46:11 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Dec 2017 20:46:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,439,1508828400"; d="scan'208";a="4338587" Received: from wuyanglong.sh.intel.com ([10.67.111.98]) by fmsmga007.fm.intel.com with ESMTP; 21 Dec 2017 20:46:09 -0800 From: Yanglong Wu To: dev@dpdk.org Cc: beilei.xing@intel.com, helin.zhang@intel.com, Yanglong Wu Date: Fri, 22 Dec 2017 12:44:58 +0800 Message-Id: <20171222044458.121311-1-yanglong.wu@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171220072915.118907-1-yanglong.wu@intel.com> References: <20171220072915.118907-1-yanglong.wu@intel.com> Subject: [dpdk-dev] [PATCH v3] net/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: Fri, 22 Dec 2017 04:46:12 -0000 According to loopback mode, setup loopback link or not. If loopback link is setted, packets in tx will be sent to rx directly. Loopback mode can be used to support testing task Signed-off-by: Yanglong Wu --- v2: fix coding style issue --- v3: update release DOC --- doc/guides/rel_notes/release_18_02.rst | 6 ++++++ drivers/net/i40e/i40e_ethdev.c | 10 ++++++++++ drivers/net/i40e/i40e_ethdev.h | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst index 24b67bb8b..1bd747b49 100644 --- a/doc/guides/rel_notes/release_18_02.rst +++ b/doc/guides/rel_notes/release_18_02.rst @@ -41,6 +41,12 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added a mac loopback function for the FVL.** + + Added a mac loopback function for the FVL in order to support test + task asked by users. According to device configuration, it will + setup TX->RX loopback link or not. If loopback link is setted, + packets in tx will be sent to rx directly. API Changes ----------- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 0739f65a8..e8bdb335a 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2047,6 +2047,16 @@ i40e_dev_start(struct rte_eth_dev *dev) true, NULL); } } + + /* Enable mac loopback mode */ + if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE || + dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_PHY_LOCAL) { + ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL); + if (ret != I40E_SUCCESS) { + PMD_DRV_LOG(ERR, "fail to set loopback link"); + goto err_up; + } + } /* Apply link configure */ if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index cd67453d1..2ad9858e4 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -61,7 +61,8 @@ #define I40E_NUM_MACADDR_MAX 64 /* Maximum number of VFs */ #define I40E_MAX_VF 128 - +/*flag of no loopback*/ +#define I40E_AQ_LB_MODE_NONE 0x0 /* * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements. -- 2.11.0