DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback
@ 2017-11-20  4:05 Yanglong Wu
  2017-12-11  3:22 ` Peng, Yuan
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Yanglong Wu @ 2017-11-20  4:05 UTC (permalink / raw)
  To: dev; +Cc: Yanglong Wu

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

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  1 +
 drivers/net/i40e/i40e_ethdev.c          | 12 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index c36da2a32..8171f877b 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2128,6 +2128,7 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
 /* Set Loopback mode (0x0618) */
 struct i40e_aqc_set_lb_mode {
 	__le16	lb_mode;
+#define I40E_AQ_LB_MODE_NONE   0x0
 #define I40E_AQ_LB_PHY_LOCAL	0x01
 #define I40E_AQ_LB_PHY_REMOTE	0x02
 #define I40E_AQ_LB_MAC_LOCAL	0x04
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f40c463aa..2e6aa9d0d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2048,6 +2048,17 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	/* Enable mac loopback mode */
+	if (hw->mac.type == I40E_MAC_XL710 &&
+	    (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(INFO, "fail to set loopback link");
+			goto err_up;
+		}
+	}
+
 	/* Apply link configure */
 	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
 				ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
-- 
2.11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback
  2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback Yanglong Wu
@ 2017-12-11  3:22 ` Peng, Yuan
  2017-12-18  3:05 ` Zhang, Helin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Peng, Yuan @ 2017-12-11  3:22 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Wu, Yanglong

Tested-by: Peng,Yuan<yuan.peng@intel.com>

- Tested Branch: dpdk master dpdk-17.11-rc1
- Tested Commit: 87607f45bdecc31c33e9b7666b918dc685a10093
- OS: 4.4.0-62-generic
- GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Ethernet Controller XL710 for 40GbE QSFP+ [8086:1583]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 2cases, 2passed, 0 failed

- Prerequisites command / instruction:
 Two 40Gb Ethernet ports of the DUT are directly connected and link is up.

- Case:
Case1: loopback mode
enable loopback mode:
In dpdk/test/test/test_pmd_perf.c
set::
    .lpbk_mode=1
    #define MAX_TRAFFIC_BURST              32
then make test
start test::
    ./test/test/test -c f -n 4 -- -i
    RTE>>pmd_perf_autotest
The final output of the test will be matrix of average cycles of IO used per
packet, and "Test OK" is printed out.
the peer port can't receive any packet.

case2: physical link mode
disable lookback mode:
In dpdk/test/test/test_pmd_perf.c
set::
    .lpbk_mode=0
    #define MAX_TRAFFIC_BURST              32
then make test
start test::
    ./test/test/test -c f -n 4 -- -i
    RTE>>pmd_perf_autotest
there is not "Test OK" presented.
the peer port can receive all the 32 packets.

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
Sent: Monday, November 20, 2017 12:06 PM
To: dev@dpdk.org
Cc: Wu, Yanglong <yanglong.wu@intel.com>
Subject: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback

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

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  1 +
 drivers/net/i40e/i40e_ethdev.c          | 12 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index c36da2a32..8171f877b 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2128,6 +2128,7 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
 /* Set Loopback mode (0x0618) */
 struct i40e_aqc_set_lb_mode {
 	__le16	lb_mode;
+#define I40E_AQ_LB_MODE_NONE   0x0
 #define I40E_AQ_LB_PHY_LOCAL	0x01
 #define I40E_AQ_LB_PHY_REMOTE	0x02
 #define I40E_AQ_LB_MAC_LOCAL	0x04
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f40c463aa..2e6aa9d0d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2048,6 +2048,17 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	/* Enable mac loopback mode */
+	if (hw->mac.type == I40E_MAC_XL710 &&
+	    (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(INFO, "fail to set loopback link");
+			goto err_up;
+		}
+	}
+
 	/* Apply link configure */
 	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
 				ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
--
2.11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback
  2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback 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 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
  3 siblings, 0 replies; 12+ messages in thread
From: Zhang, Helin @ 2017-12-18  3:05 UTC (permalink / raw)
  To: Wu, Yanglong, Xing, Beilei, Zhang, Qi Z, Wu, Jingjing; +Cc: Wu, Yanglong, dev

Hi Yanglong

It seems your patch cannot be applied on my system. Please do a check on your patch.
In addition, please make sure your local git repo was cloned from the right sub-tree.
e.g. 'git clone http://dpdk.org/git/next/dpdk-next-net-intel'

Hi maintainers

I need your comments, ACK or NACK. Thanks!

Regards,
Helin

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> Sent: Monday, November 20, 2017 12:06 PM
> To: dev@dpdk.org
> Cc: Wu, Yanglong
> Subject: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback
> 
> According to loopback mode, setup loopback link or not.
> If loopback link is setted, packets will be sent to rx_q from tx_q
> directly.Loopback mode can be used to support testing task.
> 
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  drivers/net/i40e/base/i40e_adminq_cmd.h |  1 +
>  drivers/net/i40e/i40e_ethdev.c          | 12 +++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h
> b/drivers/net/i40e/base/i40e_adminq_cmd.h
> index c36da2a32..8171f877b 100644
> --- a/drivers/net/i40e/base/i40e_adminq_cmd.h
> +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
> @@ -2128,6 +2128,7 @@
> I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
>  /* Set Loopback mode (0x0618) */
>  struct i40e_aqc_set_lb_mode {
>  	__le16	lb_mode;
> +#define I40E_AQ_LB_MODE_NONE   0x0
>  #define I40E_AQ_LB_PHY_LOCAL	0x01
>  #define I40E_AQ_LB_PHY_REMOTE	0x02
>  #define I40E_AQ_LB_MAC_LOCAL	0x04
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index f40c463aa..2e6aa9d0d 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2048,6 +2048,17 @@ i40e_dev_start(struct rte_eth_dev *dev)
>  		}
>  	}
> 
> +	/* Enable mac loopback mode */
> +	if (hw->mac.type == I40E_MAC_XL710 &&
> +	    (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(INFO, "fail to set loopback link");
> +			goto err_up;
> +		}
> +	}
> +
>  	/* Apply link configure */
>  	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
>  				ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G
> |
> --
> 2.11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback
  2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback 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 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
  3 siblings, 0 replies; 12+ messages in thread
From: Xing, Beilei @ 2017-12-18  6:09 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Wu, Yanglong



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> Sent: Monday, November 20, 2017 12:06 PM
> To: dev@dpdk.org
> Cc: Wu, Yanglong <yanglong.wu@intel.com>
> Subject: [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback

"i40e" in the title can be omitted.

> 
> According to loopback mode, setup loopback link or not.
> If loopback link is setted, packets will be sent to rx_q from tx_q
> directly.Loopback mode can be used to support testing task.
> 
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  drivers/net/i40e/base/i40e_adminq_cmd.h |  1 +
>  drivers/net/i40e/i40e_ethdev.c          | 12 +++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h
> b/drivers/net/i40e/base/i40e_adminq_cmd.h
> index c36da2a32..8171f877b 100644
> --- a/drivers/net/i40e/base/i40e_adminq_cmd.h
> +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
> @@ -2128,6 +2128,7 @@
> I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
>  /* Set Loopback mode (0x0618) */
>  struct i40e_aqc_set_lb_mode {
>  	__le16	lb_mode;
> +#define I40E_AQ_LB_MODE_NONE   0x0


Don't define it in base code, can move it to i40e PMD.

>  #define I40E_AQ_LB_PHY_LOCAL	0x01
>  #define I40E_AQ_LB_PHY_REMOTE	0x02
>  #define I40E_AQ_LB_MAC_LOCAL	0x04
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index f40c463aa..2e6aa9d0d 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2048,6 +2048,17 @@ i40e_dev_start(struct rte_eth_dev *dev)
>  		}
>  	}
> 
> +	/* Enable mac loopback mode */
> +	if (hw->mac.type == I40E_MAC_XL710 &&

Only I40E_MAC_XL710 supports loopback mode?

> +	    (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(INFO, "fail to set loopback link");

Better to use 'ERR' to replace 'INFO'.

> +			goto err_up;
> +		}
> +	}
> +
>  	/* Apply link configure */
>  	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
>  				ETH_LINK_SPEED_1G |
> ETH_LINK_SPEED_10G |
> --
> 2.11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH v2] net/i40e: support mac loopback
  2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback Yanglong Wu
                   ` (2 preceding siblings ...)
  2017-12-18  6:09 ` Xing, Beilei
@ 2017-12-20  7:29 ` Yanglong Wu
  2017-12-20  8:09   ` Zhang, Helin
                     ` (2 more replies)
  3 siblings, 3 replies; 12+ messages in thread
From: Yanglong Wu @ 2017-12-20  7:29 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, helin.zhang, yuan.peng, Yanglong Wu

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/i40e: support mac loopback
  2017-12-20  7:29 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
@ 2017-12-20  8:09   ` Zhang, Helin
  2017-12-20 12:24   ` Peng, Yuan
  2017-12-22  4:44   ` [dpdk-dev] [PATCH v3] " Yanglong Wu
  2 siblings, 0 replies; 12+ messages in thread
From: Zhang, Helin @ 2017-12-20  8:09 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Xing, Beilei, Peng, Yuan

Doc update is needed. /Helin

> -----Original Message-----
> From: Wu, Yanglong
> Sent: Wednesday, December 20, 2017 3:29 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei; Zhang, Helin; Peng, Yuan; Wu, Yanglong
> Subject: [PATCH v2] net/i40e: support mac loopback
> 
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/i40e: support mac loopback
  2017-12-20  7:29 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
  2017-12-20  8:09   ` Zhang, Helin
@ 2017-12-20 12:24   ` Peng, Yuan
  2017-12-22  4:44   ` [dpdk-dev] [PATCH v3] " Yanglong Wu
  2 siblings, 0 replies; 12+ messages in thread
From: Peng, Yuan @ 2017-12-20 12:24 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Xing, Beilei, Zhang, Helin

Tested-by: Peng,Yuan<yuan.peng@intel.com>

- Tested Branch: dpdk master
- Tested Commit: e976052a1106153c93c802e5ffd2f6c8a29f239f
- OS: 4.4.0-62-generic
- GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Ethernet Controller XL710 for 40GbE QSFP+ [8086:1583]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 2cases, 2passed, 0 failed

- Prerequisites command / instruction:
 Two 40Gb Ethernet ports of the DUT are directly connected and link is up.

- Case:
Case1: loopback mode
enable loopback mode:
In dpdk/test/test/test_pmd_perf.c
set::
    .lpbk_mode=1
    #define MAX_TRAFFIC_BURST              32
then make test
    ./usertools/dpdk-devbind.py -b igb_uio 05:00.0
start test::
    ./test/test/test -c f -n 4 -- -i
    RTE>>pmd_perf_autotest
The final output of the test will be matrix of average cycles of IO used per packet, and "Test OK" is printed out.
the peer port can't receive any packet.

case2: physical link mode
disable lookback mode:
In dpdk/test/test/test_pmd_perf.c
set::
    .lpbk_mode=0
    #define MAX_TRAFFIC_BURST              32
then make test
start test::
    ./test/test/test -c f -n 4 -- -i
    RTE>>pmd_perf_autotest
there is not "Test OK" presented.
the peer port can receive all the 32 packets.

When run the two test cases on XXV710 with same dpdk version, the cases passed too. 

-----Original Message-----
From: Wu, Yanglong 
Sent: Wednesday, December 20, 2017 3:29 PM
To: dev@dpdk.org
Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Helin <helin.zhang@intel.com>; Peng, Yuan <yuan.peng@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
Subject: [PATCH v2] net/i40e: support mac loopback

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH v3] net/i40e: support mac loopback
  2017-12-20  7:29 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
  2017-12-20  8:09   ` Zhang, Helin
  2017-12-20 12:24   ` Peng, Yuan
@ 2017-12-22  4:44   ` Yanglong Wu
  2018-01-02  2:28     ` [dpdk-dev] [PATCH v4] " Yanglong Wu
  2 siblings, 1 reply; 12+ messages in thread
From: Yanglong Wu @ 2017-12-22  4:44 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, helin.zhang, Yanglong Wu

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
---
v3:
update release DOC
---
 doc/guides/rel_notes/release_18_02.rst |  6 ++++++
 drivers/net/i40e/i40e_ethdev.c         | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev.h         |  3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst
index 24b67bb8b..1bd747b49 100644
--- a/doc/guides/rel_notes/release_18_02.rst
+++ b/doc/guides/rel_notes/release_18_02.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added a mac loopback function for the FVL.**
+
+  Added a mac loopback function for the FVL in order to support test
+  task asked by users. According to device configuration, it will
+  setup TX->RX loopback link or not. If loopback link is setted,
+  packets in tx will be sent to rx directly.
 
 API Changes
 -----------
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH v4] net/i40e: support mac loopback
  2017-12-22  4:44   ` [dpdk-dev] [PATCH v3] " Yanglong Wu
@ 2018-01-02  2:28     ` Yanglong Wu
  2018-01-02  2:41       ` [dpdk-dev] [PATCH v5] " Yanglong Wu
  0 siblings, 1 reply; 12+ messages in thread
From: Yanglong Wu @ 2018-01-02  2:28 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Yanglong Wu

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
---
v3:
update release DOC
---
v4:
remove 'FVL'
---
 doc/guides/rel_notes/release_18_02.rst |  6 ++++++
 drivers/net/i40e/i40e_ethdev.c         | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev.h         |  3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst
index 24b67bb8b..81be184db 100644
--- a/doc/guides/rel_notes/release_18_02.rst
+++ b/doc/guides/rel_notes/release_18_02.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added a mac loopback function for the i40e.**
+
+  Add a mac loopback function for the i40e in order to support test 
+  task asked by users. According to device configuration, it will 
+  setup TX->RX loopback link or not. If loopback link is setted, 
+  packets in tx will be sent to rx directly.
 
 API Changes
 -----------
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH v5] net/i40e: support mac loopback
  2018-01-02  2:28     ` [dpdk-dev] [PATCH v4] " Yanglong Wu
@ 2018-01-02  2:41       ` Yanglong Wu
  2018-01-02  2:47         ` Xing, Beilei
  0 siblings, 1 reply; 12+ messages in thread
From: Yanglong Wu @ 2018-01-02  2:41 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Yanglong Wu

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
---
v3:
update release DOC
---
v4:
remove 'FVL'
---
v5:
fix coding style isssue
---
 doc/guides/rel_notes/release_18_02.rst |  6 ++++++
 drivers/net/i40e/i40e_ethdev.c         | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev.h         |  3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst
index 24b67bb8b..81be184db 100644
--- a/doc/guides/rel_notes/release_18_02.rst
+++ b/doc/guides/rel_notes/release_18_02.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added a mac loopback function for the i40e.**
+
+  Add a mac loopback function for the i40e in order to support test
+  task asked by users. According to device configuration, it will
+  setup TX->RX loopback link or not. If loopback link is setted,
+  packets in tx will be sent to rx directly.
 
 API Changes
 -----------
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/i40e: support mac loopback
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Xing, Beilei @ 2018-01-02  2:47 UTC (permalink / raw)
  To: Wu, Yanglong, dev


> -----Original Message-----
> From: Wu, Yanglong
> Sent: Tuesday, January 2, 2018 10:41 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>
> Subject: [PATCH v5] net/i40e: support mac loopback
> 
> 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>

Acked-by: Beilei Xing <beilei.xing@intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH v5] net/i40e: support mac loopback
  2018-01-02  2:47         ` Xing, Beilei
@ 2018-01-07 10:28           ` Zhang, Helin
  0 siblings, 0 replies; 12+ messages in thread
From: Zhang, Helin @ 2018-01-07 10:28 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Yanglong, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xing, Beilei
> Sent: Tuesday, January 2, 2018 10:47 AM
> To: Wu, Yanglong; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5] net/i40e: support mac loopback
> 
> 
> > -----Original Message-----
> > From: Wu, Yanglong
> > Sent: Tuesday, January 2, 2018 10:41 AM
> > To: dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Yanglong
> > <yanglong.wu@intel.com>
> > Subject: [PATCH v5] net/i40e: support mac loopback
> >
> > 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>
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>
Applied to dpdk-next-net-intel, with minor word changes. Thanks!

/Helin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-01-07 10:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-20  4:05 [dpdk-dev] [PATCH] net/i40e: i40e support mac loopback 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 ` [dpdk-dev] [PATCH v2] net/i40e: " Yanglong Wu
2017-12-20  8:09   ` 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

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).