[dpdk-dev,v1,2/5] app/testpmd: use ixgbe public functions
diff mbox

Message ID 1481282878-26176-3-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Bernard Iremonger Dec. 9, 2016, 11:27 a.m. UTC
Use the the following ixgbe public functions:

rte_pmd_ixgbe_set_vf_rate_limit
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c |  2 +-
 app/test-pmd/config.c  | 31 +++++++++++--------------------
 2 files changed, 12 insertions(+), 21 deletions(-)

Comments

Ferruh Yigit Dec. 9, 2016, 11:56 a.m. UTC | #1
On 12/9/2016 11:27 AM, Bernard Iremonger wrote:
> Use the the following ixgbe public functions:
> 
> rte_pmd_ixgbe_set_vf_rate_limit
> rte_pmd_ixgbe_set_vf_rx
> rte_pmd_ixgbe_set_vf_rxmode
> rte_pmd_ixgbe_set_vf_tx
> rte_pmd_ixgbe_set_vf_vlan_filter
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>

<...>

> @@ -2388,23 +2391,11 @@ int
>  set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
>  {
>  	int diag;
> -	struct rte_eth_link link;
> -
> -	if (q_msk == 0)
> -		return 0;
>  
> -	if (port_id_is_invalid(port_id, ENABLED_WARN))
> -		return 1;
> -	rte_eth_link_get_nowait(port_id, &link);
> -	if (rate > link.link_speed) {
> -		printf("Invalid rate value:%u bigger than link speed: %u\n",
> -			rate, link.link_speed);
> -		return 1;
> -	}

Why these changes required? Isn't only change is location and naming of
the ...set_vf_rate_limit() ?

> -	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
> +	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
>  	if (diag == 0)
>  		return diag;
> -	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
> +	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
>  		port_id, diag);
>  	return diag;
>  }
>
Bernard Iremonger Dec. 9, 2016, 12:08 p.m. UTC | #2
Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, December 9, 2016 11:57 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>;
> thomas.monjalon@6wind.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v1 2/5] app/testpmd: use ixgbe public
> functions
> 
> On 12/9/2016 11:27 AM, Bernard Iremonger wrote:
> > Use the the following ixgbe public functions:
> >
> > rte_pmd_ixgbe_set_vf_rate_limit
> > rte_pmd_ixgbe_set_vf_rx
> > rte_pmd_ixgbe_set_vf_rxmode
> > rte_pmd_ixgbe_set_vf_tx
> > rte_pmd_ixgbe_set_vf_vlan_filter
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> 
> <...>
> 
> > @@ -2388,23 +2391,11 @@ int
> >  set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
> > uint64_t q_msk)  {
> >  	int diag;
> > -	struct rte_eth_link link;
> > -
> > -	if (q_msk == 0)
> > -		return 0;
> >
> > -	if (port_id_is_invalid(port_id, ENABLED_WARN))
> > -		return 1;
> > -	rte_eth_link_get_nowait(port_id, &link);
> > -	if (rate > link.link_speed) {
> > -		printf("Invalid rate value:%u bigger than link speed: %u\n",
> > -			rate, link.link_speed);
> > -		return 1;
> > -	}
> 
> Why these changes required? Isn't only change is location and naming of the
> ...set_vf_rate_limit() ?

This change is a cleanup as the parameter checking is now done in rte_pmd_ixgbe_set_vf_rate_limit().
It was not possible to test the parameter checking in rte_pmd_ixgbe_set_vf_rate_limit() if the parameters were checked in  the set_vf_rate_limit() function.

> 
> > -	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
> > +	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
> >  	if (diag == 0)
> >  		return diag;
> > -	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
> > +	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed
> > +diag=%d\n",
> >  		port_id, diag);
> >  	return diag;
> >  }
> >

Regards,

Bernard.

Patch
diff mbox

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d03a592..12f799b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6708,7 +6708,7 @@  cmd_set_vf_rxmode_parsed(void *parsed_result,
 			rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
 	}
 
-	ret = rte_eth_dev_set_vf_rxmode(res->port_id,res->vf_id,rx_mode,(uint8_t)is_on);
+	ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
 	if (ret < 0)
 		printf("bad VF receive mode parameter, return code = %d \n",
 		ret);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8cf537d..ea129db 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_IXGBE_PMD
+#include <rte_pmd_ixgbe.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2332,16 +2335,16 @@  set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (is_rx)
-		diag = rte_eth_dev_set_vf_rx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
 	else
-		diag = rte_eth_dev_set_vf_tx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
 	if (diag == 0)
 		return;
 	if(is_rx)
-		printf("rte_eth_dev_set_vf_rx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 	else
-		printf("rte_eth_dev_set_vf_tx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 
 }
@@ -2355,10 +2358,10 @@  set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 		return;
 	if (vlan_id_is_invalid(vlan_id))
 		return;
-	diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+	diag = rte_pmd_ixgbe_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 "
+	printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
 	       "diag=%d\n", port_id, diag);
 }
 
@@ -2388,23 +2391,11 @@  int
 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 {
 	int diag;
-	struct rte_eth_link link;
-
-	if (q_msk == 0)
-		return 0;
 
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return 1;
-	rte_eth_link_get_nowait(port_id, &link);
-	if (rate > link.link_speed) {
-		printf("Invalid rate value:%u bigger than link speed: %u\n",
-			rate, link.link_speed);
-		return 1;
-	}
-	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
+	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
 	if (diag == 0)
 		return diag;
-	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
+	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }