DPDK patches and discussions
 help / color / mirror / Atom feed
From: alvinx.zhang@intel.com
To: dev@dpdk.org
Cc: xiaolong.ye@intel.com
Subject: [dpdk-dev] [PATCH v4 10/11] net/igc: implement MAC-loopback mode
Date: Wed, 15 Apr 2020 16:48:09 +0800	[thread overview]
Message-ID: <20200415084810.20816-11-alvinx.zhang@intel.com> (raw)
In-Reply-To: <20200415084810.20816-1-alvinx.zhang@intel.com>

From: Alvin Zhang <alvinx.zhang@intel.com>

enable mac-loopback mode.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 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 e2e427c..ef507c2 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);
@@ -1060,6 +1070,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 8f78f00..e6fa619 100644
--- a/drivers/net/igc/igc_txrx.c
+++ b/drivers/net/igc/igc_txrx.c
@@ -1142,6 +1142,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


  parent reply	other threads:[~2020-04-15  8:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  6:30 [dpdk-dev] [PATCH v3 00/11] igc pmd alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 01/11] net/igc: add igc PMD alvinx.zhang
2020-04-13 15:19   ` Stephen Hemminger
2020-04-15  8:47   ` [dpdk-dev] [PATCH v4 00/11] " alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 01/11] net/igc: add " alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 02/11] net/igc: support device initialization alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 03/11] net/igc: implement device base ops alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 04/11] net/igc: support reception and transmission of packets alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 05/11] net/igc: enable statistics alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 06/11] net/igc: enable Rx queue interrupts alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 07/11] net/igc: implement flow control ops alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 08/11] net/igc: implement RSS API alvinx.zhang
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 09/11] net/igc: implement feature of VLAN alvinx.zhang
2020-04-15  8:48     ` alvinx.zhang [this message]
2020-04-15  8:48     ` [dpdk-dev] [PATCH v4 11/11] net/igc: implement flow API alvinx.zhang
2020-04-15 11:14     ` [dpdk-dev] [PATCH v4 00/11] igc PMD Ferruh Yigit
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 02/11] net/igc: support device initialization alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 03/11] net/igc: implement device base ops alvinx.zhang
2020-04-13 15:23   ` Stephen Hemminger
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 04/11] net/igc: support reception and transmission of packets alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 05/11] net/igc: enable statistics alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 06/11] net/igc: enable Rx queue interrupts alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 07/11] net/igc: implement flow control ops alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 08/11] net/igc: implement RSS API alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 09/11] net/igc: implement feature of VLAN alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 10/11] net/igc: implement MAC-loopback mode alvinx.zhang
2020-04-13  6:30 ` [dpdk-dev] [PATCH v3 11/11] net/igc: implement flow API alvinx.zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200415084810.20816-11-alvinx.zhang@intel.com \
    --to=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).