[dpdk-dev,v2,25/32] app/testpmd: handle i40e in VF VLAN filter command

Message ID 1481081535-37448-26-git-send-email-wenzhuo.lu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
checkpatch/checkpatch success coding style OK

Commit Message

Wenzhuo Lu Dec. 7, 2016, 3:32 a.m. UTC
  modify set_vf_rx_vlan function to handle the i40e PMD.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/config.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Dec. 13, 2016, 1:40 p.m. UTC | #1
Hi Wenzhuo,

On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> modify set_vf_rx_vlan function to handle the i40e PMD.
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---

Latest applied patches [1] conflict with some testpmd patches of this
patchset.

Can you please rebase this patchset on top of the latest next-net?

[1]
http://dpdk.org/dev/patchwork/patch/17896 - 17902

Thanks,
ferruh

>  app/test-pmd/config.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 36c47ab..0368dc6 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -92,6 +92,9 @@
>  #include <rte_ethdev.h>
>  #include <rte_string_fns.h>
>  #include <rte_cycles.h>
> +#ifdef RTE_LIBRTE_I40E_PMD
> +#include <rte_pmd_i40e.h>
> +#endif
>  
>  #include "testpmd.h"
>  
> @@ -2349,12 +2352,24 @@ struct igb_ring_desc_16_bytes {
>  set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
>  {
>  	int diag;
> +	struct rte_eth_dev_info dev_info;
>  
>  	if (port_id_is_invalid(port_id, ENABLED_WARN))
>  		return;
>  	if (vlan_id_is_invalid(vlan_id))
>  		return;
> -	diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
> +
> +	rte_eth_dev_info_get(port_id, &dev_info);
> +
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	if (strstr(dev_info.driver_name, "i40e") != NULL)
> +		diag = rte_pmd_i40e_set_vf_vlan_filter(port_id, vlan_id,
> +						       vf_mask, on);
> +	else
> +#endif
> +		diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id,
> +						      vf_mask, on);
> +
>  	if (diag == 0)
>  		return;
>  	printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
>
  
Wenzhuo Lu Dec. 14, 2016, 12:42 a.m. UTC | #2
Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, December 13, 2016 9:41 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Iremonger, Bernard
> Subject: Re: [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN
> filter command
> 
> Hi Wenzhuo,
> 
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > modify set_vf_rx_vlan function to handle the i40e PMD.
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> 
> Latest applied patches [1] conflict with some testpmd patches of this patchset.
> 
> Can you please rebase this patchset on top of the latest next-net?
Sure, we'll rework this series of patches based on the newest next-net.

> 
> [1]
> http://dpdk.org/dev/patchwork/patch/17896 - 17902
> 
> Thanks,
> ferruh
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36c47ab..0368dc6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -92,6 +92,9 @@ 
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
+#ifdef RTE_LIBRTE_I40E_PMD
+#include <rte_pmd_i40e.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2349,12 +2352,24 @@  struct igb_ring_desc_16_bytes {
 set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 {
 	int diag;
+	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (vlan_id_is_invalid(vlan_id))
 		return;
-	diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+
+	rte_eth_dev_info_get(port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		diag = rte_pmd_i40e_set_vf_vlan_filter(port_id, vlan_id,
+						       vf_mask, on);
+	else
+#endif
+		diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id,
+						      vf_mask, on);
+
 	if (diag == 0)
 		return;
 	printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "