diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 495871394e..ff384ade42 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -51,6 +51,7 @@ enum index {
 	/* Sub-leve commands. */
 	SET_RAW_ENCAP,
 	SET_RAW_DECAP,
+	SET_RAW_INDEX,
 
 	/* Top-level command. */
 	FLOW,
@@ -297,6 +298,10 @@ enum index {
 	ACTION_DEC_TCP_ACK_VALUE,
 	ACTION_RAW_ENCAP,
 	ACTION_RAW_DECAP,
+	ACTION_RAW_ENCAP_INDEX,
+	ACTION_RAW_ENCAP_INDEX_VALUE,
+	ACTION_RAW_DECAP_INDEX,
+	ACTION_RAW_DECAP_INDEX_VALUE,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -320,6 +325,7 @@ struct action_rss_data {
 #define ACTION_VXLAN_ENCAP_ITEMS_NUM 6
 
 #define ACTION_RAW_ENCAP_MAX_DATA 128
+#define RAW_ENCAP_CONFS_MAX_NUM 8
 
 /** Storage for struct rte_flow_action_raw_encap. */
 struct raw_encap_conf {
@@ -328,7 +334,7 @@ struct raw_encap_conf {
 	size_t size;
 };
 
-struct raw_encap_conf raw_encap_conf = {.size = 0};
+struct raw_encap_conf raw_encap_confs[RAW_ENCAP_CONFS_MAX_NUM];
 
 /** Storage for struct rte_flow_action_raw_decap. */
 struct raw_decap_conf {
@@ -336,7 +342,7 @@ struct raw_decap_conf {
 	size_t size;
 };
 
-struct raw_decap_conf raw_decap_conf = {.size = 0};
+struct raw_decap_conf raw_decap_confs[RAW_ENCAP_CONFS_MAX_NUM];
 
 /** Storage for struct rte_flow_action_vxlan_encap including external data. */
 struct action_vxlan_encap_data {
@@ -376,12 +382,14 @@ struct action_raw_encap_data {
 	struct rte_flow_action_raw_encap conf;
 	uint8_t data[ACTION_RAW_ENCAP_MAX_DATA];
 	uint8_t preserve[ACTION_RAW_ENCAP_MAX_DATA];
+	uint16_t idx;
 };
 
 /** Storage for struct rte_flow_action_raw_decap including external data. */
 struct action_raw_decap_data {
 	struct rte_flow_action_raw_decap conf;
 	uint8_t data[ACTION_RAW_ENCAP_MAX_DATA];
+	uint16_t idx;
 };
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
@@ -1143,6 +1151,18 @@ static const enum index action_dec_tcp_ack[] = {
 	ZERO,
 };
 
+static const enum index action_raw_encap[] = {
+	ACTION_RAW_ENCAP_INDEX,
+	ACTION_NEXT,
+	ZERO,
+};
+
+static const enum index action_raw_decap[] = {
+	ACTION_RAW_DECAP_INDEX,
+	ACTION_NEXT,
+	ZERO,
+};
+
 static int parse_set_raw_encap_decap(struct context *, const struct token *,
 				     const char *, unsigned int,
 				     void *, unsigned int);
@@ -1201,6 +1221,12 @@ static int parse_vc_action_raw_encap(struct context *,
 static int parse_vc_action_raw_decap(struct context *,
 				     const struct token *, const char *,
 				     unsigned int, void *, unsigned int);
+static int parse_vc_action_raw_encap_index(struct context *,
+					   const struct token *, const char *,
+					   unsigned int, void *, unsigned int);
+static int parse_vc_action_raw_decap_index(struct context *,
+					   const struct token *, const char *,
+					   unsigned int, void *, unsigned int);
 static int parse_destroy(struct context *, const struct token *,
 			 const char *, unsigned int,
 			 void *, unsigned int);
@@ -3095,18 +3121,41 @@ static const struct token token_list[] = {
 		.name = "raw_encap",
 		.help = "encapsulation data, defined by set raw_encap",
 		.priv = PRIV_ACTION(RAW_ENCAP,
-			sizeof(struct rte_flow_action_raw_encap)),
-		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+			sizeof(struct action_raw_encap_data)),
+		.next = NEXT(action_raw_encap),
 		.call = parse_vc_action_raw_encap,
 	},
+	[ACTION_RAW_ENCAP_INDEX] = {
+		.name = "index",
+		.help = "the index of raw_encap_confs",
+		.next = NEXT(NEXT_ENTRY(ACTION_RAW_ENCAP_INDEX_VALUE)),
+	},
+	[ACTION_RAW_ENCAP_INDEX_VALUE] = {
+		.name = "{index}",
+		.help = "the index value",
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+		.call = parse_vc_action_raw_encap_index,
+	},
 	[ACTION_RAW_DECAP] = {
 		.name = "raw_decap",
 		.help = "decapsulation data, defined by set raw_encap",
 		.priv = PRIV_ACTION(RAW_DECAP,
-			sizeof(struct rte_flow_action_raw_decap)),
-		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+			sizeof(struct action_raw_decap_data)),
+		.next = NEXT(action_raw_decap),
 		.call = parse_vc_action_raw_decap,
 	},
+	[ACTION_RAW_DECAP_INDEX] = {
+		.name = "index",
+		.help = "the index of raw_decap_confs",
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+		.call = parse_vc_action_raw_decap_index,
+	},
+	[ACTION_RAW_DECAP_INDEX_VALUE] = {
+		.name = "{index}",
+		.help = "the index value",
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+		.call = parse_vc_action_raw_decap_index,
+	},
 	/* Top level command. */
 	[SET] = {
 		.name = "set",
@@ -3121,14 +3170,21 @@ static const struct token token_list[] = {
 	[SET_RAW_ENCAP] = {
 		.name = "raw_encap",
 		.help = "set raw encap data",
-		.next = NEXT(next_item),
+		.next = NEXT(next_item, NEXT_ENTRY(SET_RAW_INDEX)),
+		.args = ARGS(ARGS_ENTRY(struct buffer, port)),
 		.call = parse_set_raw_encap_decap,
 	},
 	[SET_RAW_DECAP] = {
 		.name = "raw_decap",
 		.help = "set raw decap data",
-		.next = NEXT(next_item),
+		.next = NEXT(next_item, NEXT_ENTRY(SET_RAW_INDEX)),
 		.call = parse_set_raw_encap_decap,
+	},
+	[SET_RAW_INDEX] = {
+		.name = "{raw_index}",
+		.help = "index of raw_enca/raw_decap data",
+		.call = parse_port,
+		.comp = comp_none,
 	}
 };
 
@@ -4423,6 +4479,92 @@ parse_vc_action_mplsoudp_decap(struct context *ctx, const struct token *token,
 	return ret;
 }
 
+static int
+parse_vc_action_raw_decap_index(struct context *ctx, const struct token *token,
+				const char *str, unsigned int len, void *buf,
+				unsigned int size)
+{
+	struct action_raw_decap_data *action_raw_decap_data;
+	struct rte_flow_action *action;
+	const struct arg *arg;
+	struct buffer *out = buf;
+	uint8_t *data = NULL;
+	int ret;
+	uint16_t idx;
+
+	RTE_SET_USED(token);
+	RTE_SET_USED(buf);
+	RTE_SET_USED(size);
+	arg = ARGS_ENTRY_ARB_BOUNDED
+		(offsetof(struct action_raw_decap_data, idx),
+		 sizeof(((struct action_raw_decap_data *)0)->idx),
+		 0, RAW_ENCAP_CONFS_MAX_NUM);
+	if (push_args(ctx, arg))
+		return -1;
+	ret = parse_int(ctx, token, str, len, NULL, 0);
+	if (ret < 0) {
+		pop_args(ctx);
+		return -1;
+	}
+	if (!ctx->object)
+		return len;
+	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
+	action_raw_decap_data = ctx->object;
+	idx = action_raw_decap_data->idx;
+	/* data stored from tail of data buffer */
+	data = (uint8_t *)&(raw_decap_confs[idx].data) +
+		ACTION_RAW_ENCAP_MAX_DATA - raw_decap_confs[idx].size;
+	action_raw_decap_data->conf.data = data;
+	action_raw_decap_data->conf.size = raw_decap_confs[idx].size;
+	action->conf = &action_raw_decap_data->conf;
+	return len;
+}
+
+
+static int
+parse_vc_action_raw_encap_index(struct context *ctx, const struct token *token,
+				const char *str, unsigned int len, void *buf,
+				unsigned int size)
+{
+	struct action_raw_encap_data *action_raw_encap_data;
+	struct rte_flow_action *action;
+	const struct arg *arg;
+	struct buffer *out = buf;
+	uint8_t *data = NULL;
+	int ret;
+	uint16_t idx;
+
+	RTE_SET_USED(token);
+	RTE_SET_USED(buf);
+	RTE_SET_USED(size);
+	if (ctx->curr != ACTION_RAW_ENCAP_INDEX_VALUE)
+		return -1;
+	arg = ARGS_ENTRY_ARB_BOUNDED
+		(offsetof(struct action_raw_encap_data, idx),
+		 sizeof(((struct action_raw_encap_data *)0)->idx),
+		 0, RAW_ENCAP_CONFS_MAX_NUM);
+	if (push_args(ctx, arg))
+		return -1;
+	ret = parse_int(ctx, token, str, len, NULL, 0);
+	if (ret < 0) {
+		pop_args(ctx);
+		return -1;
+	}
+	if (!ctx->object)
+		return len;
+	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
+	action_raw_encap_data = ctx->object;
+	idx = action_raw_encap_data->idx;
+	/* data stored from tail of data buffer */
+	data = (uint8_t *)&(raw_encap_confs[idx].data) +
+		ACTION_RAW_ENCAP_MAX_DATA - raw_encap_confs[idx].size;
+	action_raw_encap_data->conf.data = data;
+	action_raw_encap_data->conf.size = raw_encap_confs[idx].size;
+	action_raw_encap_data->conf.preserve = NULL;
+	action->conf = &action_raw_encap_data->conf;
+	return len;
+}
+
 static int
 parse_vc_action_raw_encap(struct context *ctx, const struct token *token,
 			  const char *str, unsigned int len, void *buf,
@@ -4430,7 +4572,7 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token,
 {
 	struct buffer *out = buf;
 	struct rte_flow_action *action;
-	struct rte_flow_action_raw_encap *action_raw_encap_conf = NULL;
+	struct action_raw_encap_data *action_raw_encap_data = NULL;
 	uint8_t *data = NULL;
 	int ret;
 
@@ -4447,14 +4589,14 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token,
 	ctx->object = out->args.vc.data;
 	ctx->objmask = NULL;
 	/* Copy the headers to the buffer. */
-	action_raw_encap_conf = ctx->object;
+	action_raw_encap_data = ctx->object;
 	/* data stored from tail of data buffer */
-	data = (uint8_t *)&(raw_encap_conf.data) +
-		ACTION_RAW_ENCAP_MAX_DATA - raw_encap_conf.size;
-	action_raw_encap_conf->data = data;
-	action_raw_encap_conf->preserve = NULL;
-	action_raw_encap_conf->size = raw_encap_conf.size;
-	action->conf = action_raw_encap_conf;
+	data = (uint8_t *)&(raw_encap_confs[0].data) +
+		ACTION_RAW_ENCAP_MAX_DATA - raw_encap_confs[0].size;
+	action_raw_encap_data->conf.data = data;
+	action_raw_encap_data->conf.preserve = NULL;
+	action_raw_encap_data->conf.size = raw_encap_confs[0].size;
+	action->conf = &action_raw_encap_data->conf;
 	return ret;
 }
 
@@ -4465,7 +4607,7 @@ parse_vc_action_raw_decap(struct context *ctx, const struct token *token,
 {
 	struct buffer *out = buf;
 	struct rte_flow_action *action;
-	struct rte_flow_action_raw_decap *action_raw_decap_conf = NULL;
+	struct action_raw_decap_data *action_raw_decap_data = NULL;
 	uint8_t *data = NULL;
 	int ret;
 
@@ -4482,13 +4624,13 @@ parse_vc_action_raw_decap(struct context *ctx, const struct token *token,
 	ctx->object = out->args.vc.data;
 	ctx->objmask = NULL;
 	/* Copy the headers to the buffer. */
-	action_raw_decap_conf = ctx->object;
+	action_raw_decap_data = ctx->object;
 	/* data stored from tail of data buffer */
-	data = (uint8_t *)&(raw_decap_conf.data) +
-		ACTION_RAW_ENCAP_MAX_DATA - raw_decap_conf.size;
-	action_raw_decap_conf->data = data;
-	action_raw_decap_conf->size = raw_decap_conf.size;
-	action->conf = action_raw_decap_conf;
+	data = (uint8_t *)&(raw_decap_confs[0].data) +
+		ACTION_RAW_ENCAP_MAX_DATA - raw_decap_confs[0].size;
+	action_raw_decap_data->conf.data = data;
+	action_raw_decap_data->conf.size = raw_decap_confs[0].size;
+	action->conf = &action_raw_decap_data->conf;
 	return ret;
 }
 
@@ -5167,6 +5309,7 @@ parse_set_raw_encap_decap(struct context *ctx, const struct token *token,
 		return -1;
 	ctx->objdata = 0;
 	ctx->objmask = NULL;
+	ctx->object = out;
 	if (!out->command)
 		return -1;
 	out->command = ctx->curr;
@@ -5777,15 +5920,16 @@ cmd_set_raw_parsed(const struct buffer *in)
 	size_t *total_size = NULL;
 	uint16_t upper_layer = 0;
 	uint16_t proto = 0;
+	uint16_t idx = in->port; /* We borrow port field as index */
 
 	RTE_ASSERT(in->command == SET_RAW_ENCAP ||
 		   in->command == SET_RAW_DECAP);
 	if (in->command == SET_RAW_ENCAP) {
-		total_size = &raw_encap_conf.size;
-		data = (uint8_t *)&raw_encap_conf.data;
+		total_size = &raw_encap_confs[idx].size;
+		data = (uint8_t *)&raw_encap_confs[idx].data;
 	} else {
-		total_size = &raw_decap_conf.size;
-		data = (uint8_t *)&raw_decap_conf.data;
+		total_size = &raw_decap_confs[idx].size;
+		data = (uint8_t *)&raw_decap_confs[idx].data;
 	}
 	*total_size = 0;
 	memset(data, 0x00, ACTION_RAW_ENCAP_MAX_DATA);
