diff mbox series

app/testpmd: add PF and VF targets to flow action type sample

Message ID 20201221054636.4574-1-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series app/testpmd: add PF and VF targets to flow action type sample | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

psatheesh@marvell.com Dec. 21, 2020, 5:46 a.m. UTC
From: Satheesh Paul <psatheesh@marvell.com>

Add support to specify PF or VF as targets in "set sample_actions"
command.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---

The changes add support for below usecases.

1. Sample mirror to PF
testpmd>set sample_actions 0 / pf / end
#pkts to VF id 2 will be mirrored to the PF
testpmd>flow create 0 ingress pattern eth / end actions sample ratio 1 \
        index 0 / vf id 2 / end

2. Sample mirror to VF
testpmd>set sample_actions 1 / vf id 1 / end
#pkts to VF id 2 will be mirrored to VF id 1
testpmd>flow create 0 ingress pattern eth / end actions sample ratio 1 \
        index 1 / vf id 2 / end

 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Ferruh Yigit Jan. 27, 2021, 4:47 p.m. UTC | #1
On 12/21/2020 5:46 AM, psatheesh@marvell.com wrote:
> From: Satheesh Paul <psatheesh@marvell.com>
> 
> Add support to specify PF or VF as targets in "set sample_actions"
> command.
> 
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>

Hi Ori,

Can you please support reviewing this patch?
Ori Kam Jan. 31, 2021, 8:53 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: psatheesh@marvell.com <psatheesh@marvell.com>
> Sent: Monday, December 21, 2020 7:47 AM
> 
> From: Satheesh Paul <psatheesh@marvell.com>
> 
> Add support to specify PF or VF as targets in "set sample_actions"
> command.
> 
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> ---
> 
> The changes add support for below usecases.
> 
> 1. Sample mirror to PF
> testpmd>set sample_actions 0 / pf / end
> #pkts to VF id 2 will be mirrored to the PF
> testpmd>flow create 0 ingress pattern eth / end actions sample ratio 1 \
>         index 0 / vf id 2 / end
> 
> 2. Sample mirror to VF
> testpmd>set sample_actions 1 / vf id 1 / end
> #pkts to VF id 2 will be mirrored to VF id 1
> testpmd>flow create 0 ingress pattern eth / end actions sample ratio 1 \
>         index 1 / vf id 2 / end
> 
>  app/test-pmd/cmdline_flow.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 585cab98b..12f2b1664 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -560,6 +560,7 @@ struct rte_flow_action_queue
> sample_queue[RAW_SAMPLE_CONFS_MAX_NUM];
>  struct rte_flow_action_count
> sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
>  struct rte_flow_action_port_id
> sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
>  struct rte_flow_action_raw_encap
> sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
> +struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
> 
>  /** Maximum number of subsequent tokens and arguments on the stack. */
>  #define CTX_STACK_SIZE 16
> @@ -7558,6 +7559,14 @@ cmd_set_raw_parsed_sample(const struct buffer
> *in)
>  				(const void *)action->conf, size);
>  			action->conf = &sample_port_id[idx];
>  			break;
> +		case RTE_FLOW_ACTION_TYPE_PF:
> +			break;
> +		case RTE_FLOW_ACTION_TYPE_VF:
> +			size = sizeof(struct rte_flow_action_vf);
> +			rte_memcpy(&sample_vf[idx],
> +			(const void *)action->conf, size);
> +			action->conf = &sample_vf[idx];
> +			break;
>  		default:
>  			printf("Error - Not supported action\n");
>  			return;
> --
> 2.25.4
Acked-by: Ori Kam <orika@nvidia.com>

Best,
Ori
Ferruh Yigit Feb. 2, 2021, 9:14 a.m. UTC | #3
On 1/31/2021 8:53 AM, Ori Kam wrote:
> Hi,
> 
>> -----Original Message-----
>> From: psatheesh@marvell.com <psatheesh@marvell.com>
>> Sent: Monday, December 21, 2020 7:47 AM
>>
>> From: Satheesh Paul <psatheesh@marvell.com>
>>
>> Add support to specify PF or VF as targets in "set sample_actions"
>> command.
>>
>> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> 
> Acked-by: Ori Kam <orika@nvidia.com>
> 

Applied to dpdk-next-net/main, thanks.
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 585cab98b..12f2b1664 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -560,6 +560,7 @@  struct rte_flow_action_queue sample_queue[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
 #define CTX_STACK_SIZE 16
@@ -7558,6 +7559,14 @@  cmd_set_raw_parsed_sample(const struct buffer *in)
 				(const void *)action->conf, size);
 			action->conf = &sample_port_id[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_PF:
+			break;
+		case RTE_FLOW_ACTION_TYPE_VF:
+			size = sizeof(struct rte_flow_action_vf);
+			rte_memcpy(&sample_vf[idx],
+			(const void *)action->conf, size);
+			action->conf = &sample_vf[idx];
+			break;
 		default:
 			printf("Error - Not supported action\n");
 			return;