DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yanglong Wu <yanglong.wu@intel.com>
To: dev@dpdk.org
Cc: beilei.xing@intel.com, helin.zhang@intel.com,
	yuan.peng@intel.com, Yanglong Wu <yanglong.wu@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: support mac loopback
Date: Wed, 20 Dec 2017 15:29:15 +0800	[thread overview]
Message-ID: <20171220072915.118907-1-yanglong.wu@intel.com> (raw)
In-Reply-To: <20171120040531.152695-1-yanglong.wu@intel.com>

According to loopback mode, setup loopback link or not.
If loopback link is setted, packets in tx will be sent to rx directly.
Loopback mode can be used to support testing task

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
v2:
fix coding style issue
---
 drivers/net/i40e/i40e_ethdev.c | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev.h |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 0739f65a8..e8bdb335a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2047,6 +2047,16 @@ i40e_dev_start(struct rte_eth_dev *dev)
 						     true, NULL);
 		}
 	}
+
+	/* 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 (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(ERR, "fail to set loopback link");
+			goto err_up;
+		}
+	}
 
 	/* Apply link configure */
 	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index cd67453d1..2ad9858e4 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -61,7 +61,8 @@
 #define I40E_NUM_MACADDR_MAX       64
 /* Maximum number of VFs */
 #define I40E_MAX_VF               128
-
+/*flag of no loopback*/
+#define I40E_AQ_LB_MODE_NONE	  0x0
 /*
  * vlan_id is a 12 bit number.
  * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
-- 
2.11.0

  parent reply	other threads:[~2017-12-20  7:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e " Yanglong Wu
2017-12-11  3:22 ` Peng, Yuan
2017-12-18  3:05 ` Zhang, Helin
2017-12-18  6:09 ` Xing, Beilei
2017-12-20  7:29 ` Yanglong Wu [this message]
2017-12-20  8:09   ` [dpdk-dev] [PATCH v2] net/i40e: " Zhang, Helin
2017-12-20 12:24   ` Peng, Yuan
2017-12-22  4:44   ` [dpdk-dev] [PATCH v3] " Yanglong Wu
2018-01-02  2:28     ` [dpdk-dev] [PATCH v4] " Yanglong Wu
2018-01-02  2:41       ` [dpdk-dev] [PATCH v5] " Yanglong Wu
2018-01-02  2:47         ` Xing, Beilei
2018-01-07 10:28           ` Zhang, Helin

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=20171220072915.118907-1-yanglong.wu@intel.com \
    --to=yanglong.wu@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=yuan.peng@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).