From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF19C41E89; Tue, 14 Mar 2023 04:25:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D61A410D1; Tue, 14 Mar 2023 04:25:28 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 623D940F16 for ; Tue, 14 Mar 2023 04:25:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678764327; x=1710300327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w8hPnIkwATCRm8loeHVGkcYKux67v9f9cOP3ESinplQ=; b=VQ3DrXIYKsVtip6f3nbbS69F1Xd9BnID/Xk9hNfbM/0N2jUCYy3alPve jjp+wpALCARxPPor1mTM74xFhDYuiNFLrqdcscvULFrlH9RxGE+zGm28f VIxo5M93tNkLTBDX53YuyoJrUhsYo4JOi/VxnS86g7pIeyyAxHAbBa7Hn vadAdYWiAfyEOzTbIIxlcXOkG6SRPQxafvufEUy44eTJOomRGWFSBTKlD YvtwjhyfCf3Vn/tBnbl1o97eShpDijufBfB+pyeFmK3zPpouG9PzUMUHG hmCYhp27RRRFXUctiYaqJgY6DocrOEpUMrcQy+AyQ8FVvySn2LpNPJy+g Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="337345308" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="337345308" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 20:21:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="1008238231" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="1008238231" Received: from dpdk-wenjing-01.sh.intel.com ([10.67.119.244]) by fmsmga005.fm.intel.com with ESMTP; 13 Mar 2023 20:21:20 -0700 From: Wenjing Qiao To: Yuying.Zhang@intel.com, beilei.xing@intel.com Cc: dukaix.yuan@intel.com, dev@dpdk.org, Wenjing Qiao Subject: [PATCH v2] net/i40e: fix MAC loopback on X722 Date: Mon, 13 Mar 2023 23:16:19 -0400 Message-Id: <20230314031619.12057-1-wenjing.qiao@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230314030544.6664-1-wenjing.qiao@intel.com> References: <20230314030544.6664-1-wenjing.qiao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If enabling MAC loopback mode on X722 NIC, transmitted packets are not seen in the receive queue. The root cause is using wrong loopback mode bits. Correct it according to the X722 datasheet. Fixes: 3a838ab649df ("net/i40e: support MAC loopback") Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command") Signed-off-by: Wenjing Qiao --- drivers/net/i40e/i40e_ethdev.c | 17 ++++++++++++++--- drivers/net/i40e/i40e_ethdev.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index a982e42264..d742fd0d2b 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2415,10 +2415,21 @@ i40e_dev_start(struct rte_eth_dev *dev) } } + /* Disable mac loopback mode */ + if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE) { + ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MODE_NONE, NULL); + if (ret != I40E_SUCCESS) { + PMD_DRV_LOG(ERR, "fail to set loopback link"); + goto tx_err; + } + } + /* 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 (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_EN) { + if (hw->mac.type == I40E_MAC_X722) + ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC_LOCAL_X722, NULL); + else + ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC, NULL); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "fail to set loopback link"); goto tx_err; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 7c4cc44a27..9b806d130e 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -48,6 +48,9 @@ #define I40E_MAX_VF 128 /*flag of no loopback*/ #define I40E_AQ_LB_MODE_NONE 0x0 +#define I40E_AQ_LB_MODE_EN 0x01 +#define I40E_AQ_LB_MAC 0x01 +#define I40E_AQ_LB_MAC_LOCAL_X722 0x04 /* * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements. -- 2.25.1