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 867B541E89; Tue, 14 Mar 2023 04:10:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65C42410D1; Tue, 14 Mar 2023 04:10:56 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A5FE040F16 for ; Tue, 14 Mar 2023 04:10:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678763454; x=1710299454; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=w8hPnIkwATCRm8loeHVGkcYKux67v9f9cOP3ESinplQ=; b=Ckr9vR+f1J9Q/fQNuU6AUO6bJXFkQ0HXWjflCtdFeSobsq0KbH2ULosF pxSLy/F8RqUSc+q/R4kW4uwClC+ghsFoet4TFsBj1CEnGYuXeSXk0QG/O 9KfvI488wwllnNmOdj155q/7XT5D9rplFw+5iR1dEEjgWx5BHVSwwn84x Y2KFjA+VEA9PLpjrYta5xPTJYFNI2XLr+yDtWQxvAjC1ScT9nNiE0j+hM q9C7n4hhn8GXvMUfZ0cjexTIxTg7QbwN52I9Nmu/ZNpjSkyW//uL5rSbl ZtqujS6DUQObBdVArfmYo+yMiXEeV9GAQ6Dv1FdSrl1DaFmfTbERTXpJ5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="338863871" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="338863871" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 20:10:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="747843532" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="747843532" Received: from dpdk-wenjing-01.sh.intel.com ([10.67.119.244]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2023 20:10:51 -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] net/i4oe: fix MAC loopback on X722 Date: Mon, 13 Mar 2023 23:05:44 -0400 Message-Id: <20230314030544.6664-1-wenjing.qiao@intel.com> X-Mailer: git-send-email 2.25.1 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