From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4851A04A6; Wed, 9 Feb 2022 10:39:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A43D4115E; Wed, 9 Feb 2022 10:39:23 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 1230641101 for ; Wed, 9 Feb 2022 10:39:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644399561; x=1675935561; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pDz5sI1B8tZeojqhObvfPC9XaivGaPY6pgxTCR++EDQ=; b=L8tM4udu/BKeZLYIOuWy6O9H6fHZsYAvqifgcTfsuLDXIwGE3tqhyvv0 3TDLM4Z+OW6OU7iDM2eW/sA+Q+glU7aHitu8+zZc18/ImhATsgQrgnNal K9SKO65w6nP+MNYcsK4MFvj6U9EGmGs/QEBc0ivQiOPY42q4yydVY+e50 /d3cg+dYUrKvrFVFTydTLDx7eGhFWaY6CA/XW5moJ6fNcOg85C3q5hksA kV617aD3wQnCd7UK1wV9s72Xz19ijUI7y7QkfAC/JYzIoSMOAkvnTpQZI +zKeJaBwGQmU9JpbiE8VGt/YEEOrvBzfEHJxNRciAvLVTn4bEtkaJCb9i A==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="229137257" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="229137257" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 01:39:20 -0800 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="525925003" Received: from intel-cd-odc-gavin.cd.intel.com ([10.240.178.138]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 01:39:16 -0800 From: Jie Wang To: dev@dpdk.org Cc: stevex.yang@intel.com, orika@nvidia.com, aman.deep.singh@intel.com, ferruh.yigit@intel.com, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com, olivier.matz@6wind.com, Jie Wang Subject: [PATCH v5 3/6] app/testpmd: add 6 types of L2TPv2 message Date: Wed, 9 Feb 2022 17:38:54 +0800 Message-Id: <20220209093857.79364-4-jie1x.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220209093857.79364-1-jie1x.wang@intel.com> References: <20220208083849.510136-1-jie1x.wang@intel.com> <20220209093857.79364-1-jie1x.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds L2TPv2 control message and 5 types of data message support for testpmd. The added L2TPv2 message types are listed below: 1. L2TPv2 control 2. L2TPv2 3. L2TPv2 + length option 4. L2TPv2 + sequence option 5. L2TPv2 + offset option 6. L2TPv2 + length option + sequence option Signed-off-by: Jie Wang Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 313 ++++++++++++++++---- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 ++- lib/net/rte_l2tpv2.h | 13 + 3 files changed, 308 insertions(+), 53 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 7b56b1b0ff..e0c79d57a3 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -323,13 +323,30 @@ enum index { ITEM_FLEX_ITEM_HANDLE, ITEM_FLEX_PATTERN_HANDLE, ITEM_L2TPV2, - ITEM_L2TPV2_COMMON, - ITEM_L2TPV2_COMMON_TYPE, - ITEM_L2TPV2_COMMON_TYPE_DATA_L, - ITEM_L2TPV2_COMMON_TYPE_CTRL, + ITEM_L2TPV2_TYPE, + ITEM_L2TPV2_TYPE_DATA, + ITEM_L2TPV2_TYPE_DATA_L, + ITEM_L2TPV2_TYPE_DATA_S, + ITEM_L2TPV2_TYPE_DATA_O, + ITEM_L2TPV2_TYPE_DATA_L_S, + ITEM_L2TPV2_TYPE_CTRL, + ITEM_L2TPV2_MSG_DATA_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_SESSION_ID, ITEM_L2TPV2_MSG_DATA_L_LENGTH, ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID, ITEM_L2TPV2_MSG_DATA_L_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_S_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_S_NS, + ITEM_L2TPV2_MSG_DATA_S_NR, + ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_O_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_O_OFFSET, + ITEM_L2TPV2_MSG_DATA_L_S_LENGTH, + ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_L_S_NS, + ITEM_L2TPV2_MSG_DATA_L_S_NR, ITEM_L2TPV2_MSG_CTRL_LENGTH, ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID, ITEM_L2TPV2_MSG_CTRL_SESSION_ID, @@ -1451,19 +1468,70 @@ static const enum index item_flex[] = { }; static const enum index item_l2tpv2[] = { - ITEM_L2TPV2_COMMON, + ITEM_L2TPV2_TYPE, ITEM_NEXT, ZERO, }; -static const enum index item_l2tpv2_common[] = { - ITEM_L2TPV2_COMMON_TYPE, +static const enum index item_l2tpv2_type[] = { + ITEM_L2TPV2_TYPE_DATA, + ITEM_L2TPV2_TYPE_DATA_L, + ITEM_L2TPV2_TYPE_DATA_S, + ITEM_L2TPV2_TYPE_DATA_O, + ITEM_L2TPV2_TYPE_DATA_L_S, + ITEM_L2TPV2_TYPE_CTRL, ZERO, }; -static const enum index item_l2tpv2_common_type[] = { - ITEM_L2TPV2_COMMON_TYPE_DATA_L, - ITEM_L2TPV2_COMMON_TYPE_CTRL, +static const enum index item_l2tpv2_type_data[] = { + ITEM_L2TPV2_MSG_DATA_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_SESSION_ID, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_l2tpv2_type_data_l[] = { + ITEM_L2TPV2_MSG_DATA_L_LENGTH, + ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_L_SESSION_ID, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_l2tpv2_type_data_s[] = { + ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_S_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_S_NS, + ITEM_L2TPV2_MSG_DATA_S_NR, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_l2tpv2_type_data_o[] = { + ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_O_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_O_OFFSET, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_l2tpv2_type_data_l_s[] = { + ITEM_L2TPV2_MSG_DATA_L_S_LENGTH, + ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID, + ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID, + ITEM_L2TPV2_MSG_DATA_L_S_NS, + ITEM_L2TPV2_MSG_DATA_L_S_NR, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_l2tpv2_type_ctrl[] = { + ITEM_L2TPV2_MSG_CTRL_LENGTH, + ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID, + ITEM_L2TPV2_MSG_CTRL_SESSION_ID, + ITEM_L2TPV2_MSG_CTRL_NS, + ITEM_L2TPV2_MSG_CTRL_NR, + ITEM_NEXT, ZERO, }; @@ -3858,31 +3926,46 @@ static const struct token token_list[] = { .next = NEXT(item_l2tpv2), .call = parse_vc, }, - [ITEM_L2TPV2_COMMON] = { - .name = "common", - .help = "L2TPv2 common header", - .next = NEXT(item_l2tpv2_common), - }, - [ITEM_L2TPV2_COMMON_TYPE] = { + [ITEM_L2TPV2_TYPE] = { .name = "type", - .help = "type of common header", - .next = NEXT(item_l2tpv2_common_type), + .help = "type of l2tpv2", + .next = NEXT(item_l2tpv2_type), .args = ARGS(ARG_ENTRY_HTON(struct rte_flow_item_l2tpv2)), }, - [ITEM_L2TPV2_COMMON_TYPE_DATA_L] = { + [ITEM_L2TPV2_TYPE_DATA] = { + .name = "data", + .help = "Type #7: data message without any options", + .next = NEXT(item_l2tpv2_type_data), + .call = parse_vc_item_l2tpv2_type, + }, + [ITEM_L2TPV2_MSG_DATA_TUNNEL_ID] = { + .name = "tunnel_id", + .help = "tunnel identifier", + .next = NEXT(item_l2tpv2_type_data, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type7.tunnel_id)), + }, + [ITEM_L2TPV2_MSG_DATA_SESSION_ID] = { + .name = "session_id", + .help = "session identifier", + .next = NEXT(item_l2tpv2_type_data, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type7.session_id)), + }, + [ITEM_L2TPV2_TYPE_DATA_L] = { .name = "data_l", .help = "Type #6: data message with length option", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH, - ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID, - ITEM_L2TPV2_MSG_DATA_L_SESSION_ID, - ITEM_NEXT)), + .next = NEXT(item_l2tpv2_type_data_l), .call = parse_vc_item_l2tpv2_type, }, [ITEM_L2TPV2_MSG_DATA_L_LENGTH] = { .name = "length", .help = "message length", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_data_l, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3891,8 +3974,7 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID] = { .name = "tunnel_id", .help = "tunnel identifier", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_data_l, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3901,29 +3983,150 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_DATA_L_SESSION_ID] = { .name = "session_id", .help = "session identifier", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_SESSION_ID, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_data_l, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, hdr.type6.session_id)), }, - [ITEM_L2TPV2_COMMON_TYPE_CTRL] = { + [ITEM_L2TPV2_TYPE_DATA_S] = { + .name = "data_s", + .help = "Type #5: data message with ns, nr option", + .next = NEXT(item_l2tpv2_type_data_s), + .call = parse_vc_item_l2tpv2_type, + }, + [ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID] = { + .name = "tunnel_id", + .help = "tunnel identifier", + .next = NEXT(item_l2tpv2_type_data_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type5.tunnel_id)), + }, + [ITEM_L2TPV2_MSG_DATA_S_SESSION_ID] = { + .name = "session_id", + .help = "session identifier", + .next = NEXT(item_l2tpv2_type_data_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type5.session_id)), + }, + [ITEM_L2TPV2_MSG_DATA_S_NS] = { + .name = "ns", + .help = "sequence number for message", + .next = NEXT(item_l2tpv2_type_data_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type5.ns)), + }, + [ITEM_L2TPV2_MSG_DATA_S_NR] = { + .name = "nr", + .help = "sequence number for next receive message", + .next = NEXT(item_l2tpv2_type_data_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type5.nr)), + }, + [ITEM_L2TPV2_TYPE_DATA_O] = { + .name = "data_o", + .help = "Type #4: data message with offset option", + .next = NEXT(item_l2tpv2_type_data_o), + .call = parse_vc_item_l2tpv2_type, + }, + [ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID] = { + .name = "tunnel_id", + .help = "tunnel identifier", + .next = NEXT(item_l2tpv2_type_data_o, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type4.tunnel_id)), + }, + [ITEM_L2TPV2_MSG_DATA_O_SESSION_ID] = { + .name = "session_id", + .help = "session identifier", + .next = NEXT(item_l2tpv2_type_data_o, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type5.session_id)), + }, + [ITEM_L2TPV2_MSG_DATA_O_OFFSET] = { + .name = "offset_size", + .help = "the size of offset padding", + .next = NEXT(item_l2tpv2_type_data_o, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type4.offset_size)), + }, + [ITEM_L2TPV2_TYPE_DATA_L_S] = { + .name = "data_l_s", + .help = "Type #3: data message contains length, ns, nr " + "options", + .next = NEXT(item_l2tpv2_type_data_l_s), + .call = parse_vc_item_l2tpv2_type, + }, + [ITEM_L2TPV2_MSG_DATA_L_S_LENGTH] = { + .name = "length", + .help = "message length", + .next = NEXT(item_l2tpv2_type_data_l_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type3.length)), + }, + [ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID] = { + .name = "tunnel_id", + .help = "tunnel identifier", + .next = NEXT(item_l2tpv2_type_data_l_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type3.tunnel_id)), + }, + [ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID] = { + .name = "session_id", + .help = "session identifier", + .next = NEXT(item_l2tpv2_type_data_l_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type3.session_id)), + }, + [ITEM_L2TPV2_MSG_DATA_L_S_NS] = { + .name = "ns", + .help = "sequence number for message", + .next = NEXT(item_l2tpv2_type_data_l_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type3.ns)), + }, + [ITEM_L2TPV2_MSG_DATA_L_S_NR] = { + .name = "nr", + .help = "sequence number for next receive message", + .next = NEXT(item_l2tpv2_type_data_l_s, + NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, + hdr.type3.nr)), + }, + [ITEM_L2TPV2_TYPE_CTRL] = { .name = "control", - .help = "Type #3: conrtol message contains length, ns, nr options", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH, - ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID, - ITEM_L2TPV2_MSG_CTRL_SESSION_ID, - ITEM_L2TPV2_MSG_CTRL_NS, - ITEM_L2TPV2_MSG_CTRL_NR, - ITEM_NEXT)), + .help = "Type #3: conrtol message contains length, ns, nr " + "options", + .next = NEXT(item_l2tpv2_type_ctrl), .call = parse_vc_item_l2tpv2_type, }, [ITEM_L2TPV2_MSG_CTRL_LENGTH] = { .name = "length", .help = "message length", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_ctrl, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3932,8 +4135,7 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID] = { .name = "tunnel_id", .help = "tunnel identifier", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_ctrl, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3942,8 +4144,7 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_CTRL_SESSION_ID] = { .name = "session_id", .help = "session identifier", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_SESSION_ID, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_ctrl, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3952,8 +4153,7 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_CTRL_NS] = { .name = "ns", .help = "sequence number for message", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_ctrl, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -3962,8 +4162,7 @@ static const struct token token_list[] = { [ITEM_L2TPV2_MSG_CTRL_NR] = { .name = "nr", .help = "sequence number for next receive message", - .next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS, - ITEM_L2TPV2_COMMON, ITEM_NEXT), + .next = NEXT(item_l2tpv2_type_ctrl, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2, @@ -5904,11 +6103,23 @@ parse_vc_item_l2tpv2_type(struct context *ctx, const struct token *token, if (parse_default(ctx, token, str, len, NULL, 0) < 0) return -1; switch (ctx->curr) { - case ITEM_L2TPV2_COMMON_TYPE_DATA_L: - msg_type |= 0x4000; + case ITEM_L2TPV2_TYPE_DATA: + msg_type |= RTE_L2TPV2_MSG_TYPE_DATA; + break; + case ITEM_L2TPV2_TYPE_DATA_L: + msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L; + break; + case ITEM_L2TPV2_TYPE_DATA_S: + msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_S; + break; + case ITEM_L2TPV2_TYPE_DATA_O: + msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_O; + break; + case ITEM_L2TPV2_TYPE_DATA_L_S: + msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L_S; break; - case ITEM_L2TPV2_COMMON_TYPE_CTRL: - msg_type |= 0xC800; + case ITEM_L2TPV2_TYPE_CTRL: + msg_type |= RTE_L2TPV2_MSG_TYPE_CONTROL; break; default: return -1; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index f8adcb0a40..f957f2b0ab 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3857,6 +3857,7 @@ This section lists supported pattern items and their attributes, if any. - ``session_id {unsigned}``: L2TPv2 session identifier. - ``ns {unsigned}``: L2TPv2 option ns. - ``nr {unsigned}``: L2TPv2 option nr. + - ``offset_size {unsigned}``: L2TPv2 option offset. - ``ppp``: match PPP header. @@ -5090,11 +5091,19 @@ The meter policy action list: ``green -> green, yellow -> yellow, red -> red``. testpmd> create port meter 0 1 13 1 yes 0xffff 0 0 testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end -Sample PPPoL2TPv2oUDP RSS rules +Sample L2TPv2 RSS rules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -PPPoL2TPv2oUDP RSS rules can be created by the following commands:: +L2TPv2 RSS rules can be created by the following commands: +:: + + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control + / end actions rss types l2tpv2 end queues end / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end + actions rss types eth l2-src-only end queues end / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end + actions rss types l2tpv2 end queues end / end testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 / end actions rss types ipv4 end queues end / end testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6 @@ -5104,6 +5113,28 @@ PPPoL2TPv2oUDP RSS rules can be created by the following commands:: testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 / end actions rss types ipv6 end queues end / end +Sample L2TPv2 FDIR rules +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +L2TPv2 FDIR rules can be created by the following commands: + +:: + + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control + session_id is 0x1111 / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4 + / udp / l2tpv2 type data / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data + session_id is 0x1111 / ppp / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 + src is 10.0.0.1 / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 + dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 + / udp src is 22 / end actions queue index 3 / end + testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 + / tcp dst is 23 / end actions queue index 3 / end + Sample RAW rule ~~~~~~~~~~~~~~~ diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h index 1f3ad3f03c..d41123a504 100644 --- a/lib/net/rte_l2tpv2.h +++ b/lib/net/rte_l2tpv2.h @@ -78,6 +78,19 @@ extern "C" { #endif +/* + * L2TPv2 Message Type + */ +#define RTE_L2TPV2_MSG_TYPE_CONTROL 0xC802 +#define RTE_L2TPV2_MSG_TYPE_DATA 0x0002 +#define RTE_L2TPV2_MSG_TYPE_DATA_L 0x4002 +#define RTE_L2TPV2_MSG_TYPE_DATA_S 0x0802 +#define RTE_L2TPV2_MSG_TYPE_DATA_O 0x0202 +#define RTE_L2TPV2_MSG_TYPE_DATA_L_S 0x4802 +#define RTE_L2TPV2_MSG_TYPE_DATA_L_O 0x4202 +#define RTE_L2TPV2_MSG_TYPE_DATA_S_O 0x0A02 +#define RTE_L2TPV2_MSG_TYPE_DATA_L_S_O 0x4A02 + /** * L2TPv2 Common Header */ -- 2.25.1