From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 16F352B8B for ; Mon, 20 Nov 2017 05:05:38 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2017 20:05:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,424,1505804400"; d="scan'208";a="178269631" Received: from wuyanglong.sh.intel.com ([10.67.111.131]) by fmsmga006.fm.intel.com with ESMTP; 19 Nov 2017 20:05:36 -0800 From: Yanglong Wu To: dev@dpdk.org Cc: Yanglong Wu Date: Mon, 20 Nov 2017 12:05:31 +0800 Message-Id: <20171120040531.152695-1-yanglong.wu@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [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, 20 Nov 2017 04:05:39 -0000 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/base/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) } } + /* Enable mac loopback mode */ + if (hw->mac.type == I40E_MAC_XL710 && + (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(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