From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91745A0577; Mon, 13 Apr 2020 08:34:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 319DE1C037; Mon, 13 Apr 2020 08:31:51 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 95EF51BF02 for ; Mon, 13 Apr 2020 08:31:46 +0200 (CEST) IronPort-SDR: jIrb/30E4QjP8ZAHeRxkeTjpe2QVak9BFoqCwl1ZcXYfN6mb0ntencKIZdm32duDjWxZTRB1So /rYSFBrJiyFA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2020 23:31:46 -0700 IronPort-SDR: rcJqiFYiRj3ezhQCE9sYa9ZkbSD8S3hrmC5DgYcUnVeSc9OrxIO9E0UdA0cQ18qfRsgHh+lCwL kdNnhuTQTz/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,377,1580803200"; d="scan'208";a="270987700" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by orsmga002.jf.intel.com with ESMTP; 12 Apr 2020 23:31:44 -0700 From: alvinx.zhang@intel.com To: dev@dpdk.org Cc: xiaolong.ye@intel.com, Alvin Zhang Date: Mon, 13 Apr 2020 14:30:36 +0800 Message-Id: <20200413063037.13728-11-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200413063037.13728-1-alvinx.zhang@intel.com> References: <20200413063037.13728-1-alvinx.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 10/11] net/igc: implement MAC-loopback mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Alvin Zhang enable mac-loopback mode. Signed-off-by: Alvin Zhang --- drivers/net/igc/igc_ethdev.c | 23 +++++++++++++++++++++++ drivers/net/igc/igc_txrx.c | 3 +++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index b176b6e..4d7c1e0 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -50,10 +50,17 @@ /* External VLAN Enable bit mask */ #define IGC_CTRL_EXT_EXT_VLAN (1u << 26) +/* Speed select */ +#define IGC_CTRL_SPEED_MASK (7u << 8) +#define IGC_CTRL_SPEED_2500 (6u << 8) + /* External VLAN Ether Type bit mask and shift */ #define IGC_VET_EXT 0xFFFF0000 #define IGC_VET_EXT_SHIFT 16 +/* Force EEE Auto-negotiation */ +#define IGC_EEER_EEE_FRC_AN (1u << 28) + /* Per Queue Good Packets Received Count */ #define IGC_PQGPRC(idx) (0x10010 + 0x100 * (idx)) /* Per Queue Good Octets Received Count */ @@ -635,6 +642,9 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev, /* disable all wake up */ IGC_WRITE_REG(hw, IGC_WUC, 0); + /* disable checking EEE operation in MAC loopback mode */ + igc_read_reg_check_clear_bits(hw, IGC_EEER, IGC_EEER_EEE_FRC_AN); + /* Set bit for Go Link disconnect */ igc_read_reg_check_set_bits(hw, IGC_82580_PHY_POWER_MGMT, IGC_82580_PM_GO_LINKD); @@ -1059,6 +1069,19 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev, eth_igc_rxtx_control(dev, true); eth_igc_link_update(dev, 0); + /* configure MAC-loopback mode */ + if (dev->data->dev_conf.lpbk_mode == 1) { + uint32_t reg_val; + + reg_val = IGC_READ_REG(hw, IGC_CTRL); + reg_val &= ~IGC_CTRL_SPEED_MASK; + reg_val |= IGC_CTRL_SLU | IGC_CTRL_FRCSPD | + IGC_CTRL_FRCDPX | IGC_CTRL_FD | IGC_CTRL_SPEED_2500; + IGC_WRITE_REG(hw, IGC_CTRL, reg_val); + + igc_read_reg_check_set_bits(hw, IGC_EEER, IGC_EEER_EEE_FRC_AN); + } + return 0; error_invalid_config: diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c index 177dd11..ceb5537 100644 --- a/drivers/net/igc/igc_txrx.c +++ b/drivers/net/igc/igc_txrx.c @@ -1140,6 +1140,9 @@ int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) IGC_RCTL_DPF | (hw->mac.mc_filter_type << IGC_RCTL_MO_SHIFT); + if (dev->data->dev_conf.lpbk_mode == 1) + rctl |= IGC_RCTL_LBM_MAC; + rctl &= ~(IGC_RCTL_HSEL_MSK | IGC_RCTL_CFIEN | IGC_RCTL_CFI | IGC_RCTL_PSP | IGC_RCTL_PMCF); -- 1.8.3.1