Add new protocol header match support as below RTE_FLOW_ITEM_TYPE_GTP_PSC - matches a GTP PDU extension header (type is 0x85: PDU Session Container) RTE_FLOW_ITEM_TYPE_PPPOES - matches a PPPoE Session header. RTE_FLOW_ITEM_TYPE_PPPOED - matches a PPPoE Discovery stage header. Change-Id: I9da6f2c32aca5611ab5a7bb2699f2ad6d3071c59 Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- app/test-pmd/cmdline_flow.c | 80 +++++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 25 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++++ lib/librte_ethdev/rte_flow.c | 3 ++ lib/librte_ethdev/rte_flow.h | 71 +++++++++++++++++++++++++ 5 files changed, 189 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 495871394..79bce43e7 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -167,6 +167,13 @@ enum index { ITEM_GTP_TEID, ITEM_GTPC, ITEM_GTPU, + ITEM_GTP_PSC, + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO, ITEM_GENEVE, ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, @@ -651,6 +658,9 @@ static const enum index next_item[] = { ITEM_GTP, ITEM_GTPC, ITEM_GTPU, + ITEM_GTP_PSC, + ITEM_PPPOES, + ITEM_PPPOED, ITEM_GENEVE, ITEM_VXLAN_GPE, ITEM_ARP_ETH_IPV4, @@ -831,6 +841,20 @@ static const enum index item_gtp[] = { ZERO, }; +static const enum index item_gtp_psc[] = { + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_pppoe[] = { + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO, + ITEM_NEXT, + ZERO, +}; + static const enum index item_geneve[] = { ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, @@ -2108,6 +2132,56 @@ static const struct token token_list[] = { .next = NEXT(item_gtp), .call = parse_vc, }, + [ITEM_GTP_PSC] = { + .name = "gtp_psc", + .help = "match GTP extension header (type is 0x85)", + .priv = PRIV_ITEM(GTP_PSC, + sizeof(struct rte_flow_item_gtp_psc)), + .next = NEXT(item_gtp_psc), + .call = parse_vc, + }, + [ITEM_GTP_PSC_QFI] = { + .name = "qfi", + .help = "QoS flow identifier", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + qfi)), + }, + [ITEM_GTP_PSC_PDU_T] = { + .name = "pdu_t", + .help = "PDU type", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + pdu_type)), + }, + [ITEM_PPPOES] = { + .name = "pppoes", + .help = "match PPPoE Session header", + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOED] = { + .name = "pppoed", + .help = "match PPPoE Discovery stage header", + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOE_SEID] = { + .name = "seid", + .help = "Session identifier", + .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + session_id)), + }, + [ITEM_PPPOE_PROTO] = { + .name = "proto_id", + .help = "PPPOE protocol identifier", + .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + proto_id)), + }, [ITEM_GENEVE] = { .name = "geneve", .help = "match GENEVE header", @@ -5753,6 +5827,12 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_GTP: mask = &rte_flow_item_gtp_mask; break; + case RTE_FLOW_ITEM_TYPE_GTP_PSC: + mask = &rte_flow_item_gtp_psc_mask; + break; + case RTE_FLOW_ITEM_TYPE_PPPOES: + mask = &rte_flow_item_pppoe_mask; + break; case RTE_FLOW_ITEM_TYPE_ESP: mask = &rte_flow_item_esp_mask; break; diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 821b524b3..d09c42071 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1055,6 +1055,31 @@ flow rules. - ``teid``: tunnel endpoint identifier. - Default ``mask`` matches teid only. +Item: ``GTP_PSC`` +^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a GTP Extension header (type is 0x85). + +- ``pdu_type``: PDU type. +- ``qfi``: QoS flow identifier. +- Default ``mask`` matches QFI only. + +Item: ``PPPOES``, ``PPPOED`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPOE header. + +Note: PPPOES and PPPOED use the same structure. PPPOES and PPPOED item +are defined for a user-friendly API when creating PPPOE-Session and +PPPOE-Discovery flow rules. + +- ``v_t_flags``: version (4b), type (4b). +- ``code``: Message type. +- ``session_id``: Session identifier. +- ``length``: Payload length. +- ``proto_id``: PPP Protocol identifier. +- Default ``mask`` matches session_id,proto_id. + Item: ``ESP`` ^^^^^^^^^^^^^ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 313e0707e..0da36d5f1 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3904,6 +3904,16 @@ This section lists supported pattern items and their attributes, if any. - ``teid {unsigned}``: tunnel endpoint identifier. +- ``gtp_psc``: match GTPv1 entension header (type is 0x85). + + - ``pdu_type {unsigned}``: PDU type (0 or 1). + - ``qfi {unsigned}``: QoS flow identifier. + +- ``pppoes``, ``pppoed``: match PPPOE header. + + - ``session_id {unsigned}``: Session identifier. + - ``proto_id {unsigned}``: PPP Protocol identifier. + - ``geneve``: match GENEVE header. - ``vni {unsigned}``: virtual network identifier. diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..246390da3 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -59,6 +59,9 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)), + MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), + MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), MK_FLOW_ITEM(ESP, sizeof(struct rte_flow_item_esp)), MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)), MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)), diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b66bf1495..ad5e46190 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -328,6 +328,34 @@ enum rte_flow_item_type { */ RTE_FLOW_ITEM_TYPE_GTPU, + /** + * Matches a GTP PDU extension header (type is 0x85: + * PDU Session Container). + * + * Configure flow for GTP packets with extension header type 0x85. + * + * See struct rte_flow_item_gtp_psc. + */ + RTE_FLOW_ITEM_TYPE_GTP_PSC, + + /** + * Matches a PPPOE header. + * + * Configure flow for PPPoE Session packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOES, + + /** + * Matches a PPPOE header. + * + * Configure flow for PPPoE Discovery stage packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOED, + /** * Matches a ESP header. * @@ -922,6 +950,49 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_GTP_PSC. + * + * Matches a GTP-extension header + * (type is 0x85: PDU Session Container). + */ +struct rte_flow_item_gtp_psc { + uint8_t pdu_type; /**< PDU type (0 or 1). */ + uint8_t qfi; /**< QoS flow identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ +#ifndef __cplusplus +static const struct rte_flow_item_gtp_psc +rte_flow_item_gtp_psc_mask = { + .qfi = 0x3f, +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_PPPOE. + * + * Matches a PPPOE header. + */ +struct rte_flow_item_pppoe { + /** + * Version (4b), type (4b). + */ + uint8_t v_t_flags; + uint8_t code; /**< Message type. */ + rte_be16_t session_id; /**< Session identifier. */ + rte_be16_t length; /**< Payload length. */ + rte_be16_t proto_id; /**< PPP Protocol identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE. */ +#ifndef __cplusplus +static const struct rte_flow_item_pppoe rte_flow_item_pppoe_mask = { + .session_id = RTE_BE16(0xffff), + .proto_id = RTE_BE16(0xffff), +}; +#endif + /** * RTE_FLOW_ITEM_TYPE_ESP * -- 2.15.1
Add new protocol header match support as below RTE_FLOW_ITEM_TYPE_GTP_PSC - matches a GTP PDU extension header (type is 0x85: PDU Session Container) RTE_FLOW_ITEM_TYPE_PPPOES - matches a PPPoE Session header. RTE_FLOW_ITEM_TYPE_PPPOED - matches a PPPoE Discovery stage header. Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- --- v2: Remove Gerrit Change-Id's. --- app/test-pmd/cmdline_flow.c | 80 +++++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 25 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++++ lib/librte_ethdev/rte_flow.c | 3 ++ lib/librte_ethdev/rte_flow.h | 71 +++++++++++++++++++++++++ 5 files changed, 189 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 495871394..79bce43e7 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -167,6 +167,13 @@ enum index { ITEM_GTP_TEID, ITEM_GTPC, ITEM_GTPU, + ITEM_GTP_PSC, + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO, ITEM_GENEVE, ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, @@ -651,6 +658,9 @@ static const enum index next_item[] = { ITEM_GTP, ITEM_GTPC, ITEM_GTPU, + ITEM_GTP_PSC, + ITEM_PPPOES, + ITEM_PPPOED, ITEM_GENEVE, ITEM_VXLAN_GPE, ITEM_ARP_ETH_IPV4, @@ -831,6 +841,20 @@ static const enum index item_gtp[] = { ZERO, }; +static const enum index item_gtp_psc[] = { + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_pppoe[] = { + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO, + ITEM_NEXT, + ZERO, +}; + static const enum index item_geneve[] = { ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, @@ -2108,6 +2132,56 @@ static const struct token token_list[] = { .next = NEXT(item_gtp), .call = parse_vc, }, + [ITEM_GTP_PSC] = { + .name = "gtp_psc", + .help = "match GTP extension header (type is 0x85)", + .priv = PRIV_ITEM(GTP_PSC, + sizeof(struct rte_flow_item_gtp_psc)), + .next = NEXT(item_gtp_psc), + .call = parse_vc, + }, + [ITEM_GTP_PSC_QFI] = { + .name = "qfi", + .help = "QoS flow identifier", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + qfi)), + }, + [ITEM_GTP_PSC_PDU_T] = { + .name = "pdu_t", + .help = "PDU type", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + pdu_type)), + }, + [ITEM_PPPOES] = { + .name = "pppoes", + .help = "match PPPoE Session header", + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOED] = { + .name = "pppoed", + .help = "match PPPoE Discovery stage header", + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOE_SEID] = { + .name = "seid", + .help = "Session identifier", + .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + session_id)), + }, + [ITEM_PPPOE_PROTO] = { + .name = "proto_id", + .help = "PPPOE protocol identifier", + .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + proto_id)), + }, [ITEM_GENEVE] = { .name = "geneve", .help = "match GENEVE header", @@ -5753,6 +5827,12 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_GTP: mask = &rte_flow_item_gtp_mask; break; + case RTE_FLOW_ITEM_TYPE_GTP_PSC: + mask = &rte_flow_item_gtp_psc_mask; + break; + case RTE_FLOW_ITEM_TYPE_PPPOES: + mask = &rte_flow_item_pppoe_mask; + break; case RTE_FLOW_ITEM_TYPE_ESP: mask = &rte_flow_item_esp_mask; break; diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 821b524b3..d09c42071 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1055,6 +1055,31 @@ flow rules. - ``teid``: tunnel endpoint identifier. - Default ``mask`` matches teid only. +Item: ``GTP_PSC`` +^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a GTP Extension header (type is 0x85). + +- ``pdu_type``: PDU type. +- ``qfi``: QoS flow identifier. +- Default ``mask`` matches QFI only. + +Item: ``PPPOES``, ``PPPOED`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPOE header. + +Note: PPPOES and PPPOED use the same structure. PPPOES and PPPOED item +are defined for a user-friendly API when creating PPPOE-Session and +PPPOE-Discovery flow rules. + +- ``v_t_flags``: version (4b), type (4b). +- ``code``: Message type. +- ``session_id``: Session identifier. +- ``length``: Payload length. +- ``proto_id``: PPP Protocol identifier. +- Default ``mask`` matches session_id,proto_id. + Item: ``ESP`` ^^^^^^^^^^^^^ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 313e0707e..0da36d5f1 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3904,6 +3904,16 @@ This section lists supported pattern items and their attributes, if any. - ``teid {unsigned}``: tunnel endpoint identifier. +- ``gtp_psc``: match GTPv1 entension header (type is 0x85). + + - ``pdu_type {unsigned}``: PDU type (0 or 1). + - ``qfi {unsigned}``: QoS flow identifier. + +- ``pppoes``, ``pppoed``: match PPPOE header. + + - ``session_id {unsigned}``: Session identifier. + - ``proto_id {unsigned}``: PPP Protocol identifier. + - ``geneve``: match GENEVE header. - ``vni {unsigned}``: virtual network identifier. diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..246390da3 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -59,6 +59,9 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)), MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)), + MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), + MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), MK_FLOW_ITEM(ESP, sizeof(struct rte_flow_item_esp)), MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)), MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)), diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b66bf1495..ad5e46190 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -328,6 +328,34 @@ enum rte_flow_item_type { */ RTE_FLOW_ITEM_TYPE_GTPU, + /** + * Matches a GTP PDU extension header (type is 0x85: + * PDU Session Container). + * + * Configure flow for GTP packets with extension header type 0x85. + * + * See struct rte_flow_item_gtp_psc. + */ + RTE_FLOW_ITEM_TYPE_GTP_PSC, + + /** + * Matches a PPPOE header. + * + * Configure flow for PPPoE Session packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOES, + + /** + * Matches a PPPOE header. + * + * Configure flow for PPPoE Discovery stage packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOED, + /** * Matches a ESP header. * @@ -922,6 +950,49 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_GTP_PSC. + * + * Matches a GTP-extension header + * (type is 0x85: PDU Session Container). + */ +struct rte_flow_item_gtp_psc { + uint8_t pdu_type; /**< PDU type (0 or 1). */ + uint8_t qfi; /**< QoS flow identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ +#ifndef __cplusplus +static const struct rte_flow_item_gtp_psc +rte_flow_item_gtp_psc_mask = { + .qfi = 0x3f, +}; +#endif + +/** + * RTE_FLOW_ITEM_TYPE_PPPOE. + * + * Matches a PPPOE header. + */ +struct rte_flow_item_pppoe { + /** + * Version (4b), type (4b). + */ + uint8_t v_t_flags; + uint8_t code; /**< Message type. */ + rte_be16_t session_id; /**< Session identifier. */ + rte_be16_t length; /**< Payload length. */ + rte_be16_t proto_id; /**< PPP Protocol identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE. */ +#ifndef __cplusplus +static const struct rte_flow_item_pppoe rte_flow_item_pppoe_mask = { + .session_id = RTE_BE16(0xffff), + .proto_id = RTE_BE16(0xffff), +}; +#endif + /** * RTE_FLOW_ITEM_TYPE_ESP * -- 2.15.1
Hi Wang Ying, On Wed, Aug 14, 2019 at 11:24:30AM +0800, Wang Ying A wrote: > Add new protocol header match support as below > > RTE_FLOW_ITEM_TYPE_GTP_PSC > - matches a GTP PDU extension header (type is 0x85: > PDU Session Container) > RTE_FLOW_ITEM_TYPE_PPPOES > - matches a PPPoE Session header. > RTE_FLOW_ITEM_TYPE_PPPOED > - matches a PPPoE Discovery stage header. > > Signed-off-by: Wang Ying A <ying.a.wang@intel.com> OK, please split this patch, one for GTP and the other for PPPoE to make title less vague than "add more protocol support". For PPPoE, the distinction between session and discovery is not a bad idea but since discovery packets typically have a different format (tags in place of protocol), I'm not sure they should share a common structure. How about a single "PPPOE" item without proto_id to cover both session and discovery, then later add separate tag items on a needed basis for each possible/optional tag (e.g. PPPOE_TAG_SERVICE_NAME)? Likewise proto_id would be provided through a separate optional item if relevant (PPPOE_PROTO_ID). Such an approach is already used for IPV6 and IPV6_EXT. Another benefit is that applications could match PPPoE regardless of session or discovery when they do not care, while PPPOED/PPPOES make that distinction mandatory. Also by inserting new entries in the middle of the pattern items list, this patch breaks ABI. I think it's not on purpose, so please move them to the end (not grouping them with existing GTP stuff is fine, ABI compat is more important.) This must be reflected in rte_flow.h, rte_flow.c, testpmd and documentation. More nits below. > --- > --- > v2: Remove Gerrit Change-Id's. > --- > app/test-pmd/cmdline_flow.c | 80 +++++++++++++++++++++++++++++ > doc/guides/prog_guide/rte_flow.rst | 25 +++++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++++ > lib/librte_ethdev/rte_flow.c | 3 ++ > lib/librte_ethdev/rte_flow.h | 71 +++++++++++++++++++++++++ > 5 files changed, 189 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c [...] > + [ITEM_PPPOES] = { > + .name = "pppoes", > + .help = "match PPPoE Session header", Session => session > + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), > + .next = NEXT(item_pppoe), > + .call = parse_vc, > + }, > + [ITEM_PPPOED] = { > + .name = "pppoed", > + .help = "match PPPoE Discovery stage header", Discovery => discovery > + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), > + .next = NEXT(item_pppoe), > + .call = parse_vc, > + }, > + [ITEM_PPPOE_SEID] = { > + .name = "seid", > + .help = "Session identifier", Session => session [...] > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > index 821b524b3..d09c42071 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1055,6 +1055,31 @@ flow rules. > - ``teid``: tunnel endpoint identifier. > - Default ``mask`` matches teid only. > > +Item: ``GTP_PSC`` > +^^^^^^^^^^^^^^^^^^^^^^^ Too many "^^^"'s. [...] > +Item: ``PPPOES``, ``PPPOED`` > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Matches a PPPOE header. PPPOE => PPPoE > + > +Note: PPPOES and PPPOED use the same structure. PPPOES and PPPOED item item => items (or better, "pattern items") > +are defined for a user-friendly API when creating PPPOE-Session and > +PPPOE-Discovery flow rules. Super nit: use "PPPoE" when mentioning the protocol itself and "PPPOE" when mentioning the pattern item. > + > +- ``v_t_flags``: version (4b), type (4b). Why "flags"? I don't see any so you could name it "version_type" (same in documentation). > +- ``code``: Message type. Message => message > +- ``session_id``: Session identifier. Session => session > +- ``length``: Payload length. Payload => payload > +- ``proto_id``: PPP Protocol identifier. Protocol => protocol > +- Default ``mask`` matches session_id,proto_id. Missing space between session_id and proto_id. > + > Item: ``ESP`` > ^^^^^^^^^^^^^ > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 313e0707e..0da36d5f1 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3904,6 +3904,16 @@ This section lists supported pattern items and their attributes, if any. > > - ``teid {unsigned}``: tunnel endpoint identifier. > > +- ``gtp_psc``: match GTPv1 entension header (type is 0x85). > + > + - ``pdu_type {unsigned}``: PDU type (0 or 1). > + - ``qfi {unsigned}``: QoS flow identifier. > + > +- ``pppoes``, ``pppoed``: match PPPOE header. PPPOE => PPPoE [...] > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index b66bf1495..ad5e46190 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -328,6 +328,34 @@ enum rte_flow_item_type { > */ > RTE_FLOW_ITEM_TYPE_GTPU, > > + /** > + * Matches a GTP PDU extension header (type is 0x85: > + * PDU Session Container). Session Container => session container > + * > + * Configure flow for GTP packets with extension header type 0x85. > + * > + * See struct rte_flow_item_gtp_psc. > + */ > + RTE_FLOW_ITEM_TYPE_GTP_PSC, > + > + /** > + * Matches a PPPOE header. > + * > + * Configure flow for PPPoE Session packets. Session => session > + * > + * See struct rte_flow_item_pppoe. > + */ > + RTE_FLOW_ITEM_TYPE_PPPOES, > + > + /** > + * Matches a PPPOE header. > + * > + * Configure flow for PPPoE Discovery stage packets. Discovery => discovery > + * > + * See struct rte_flow_item_pppoe. > + */ > + RTE_FLOW_ITEM_TYPE_PPPOED, > + > /** > * Matches a ESP header. > * > @@ -922,6 +950,49 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { > }; > #endif > > +/** > + * RTE_FLOW_ITEM_TYPE_GTP_PSC. > + * > + * Matches a GTP-extension header > + * (type is 0x85: PDU Session Container). Session Container => session container (crusade against superfluous caps!) [...] > +/** > + * RTE_FLOW_ITEM_TYPE_PPPOE. > + * > + * Matches a PPPOE header. > + */ > +struct rte_flow_item_pppoe { > + /** > + * Version (4b), type (4b). > + */ > + uint8_t v_t_flags; v_t_flags => version_type > + uint8_t code; /**< Message type. */ > + rte_be16_t session_id; /**< Session identifier. */ > + rte_be16_t length; /**< Payload length. */ > + rte_be16_t proto_id; /**< PPP Protocol identifier. */ As discussed, I suggest dropping proto_id to make this a generic match for PPPoE. > +}; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE. */ > +#ifndef __cplusplus > +static const struct rte_flow_item_pppoe rte_flow_item_pppoe_mask = { > + .session_id = RTE_BE16(0xffff), > + .proto_id = RTE_BE16(0xffff), > +}; I think the default for PPPoE should be an empty mask that simply says "match PPPoE" since session_id only becomes known after negotiation and proto_id shouldn't be part of this object. -- Adrien Mazarguil 6WIND
> -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Wednesday, August 14, 2019 5:08 PM > To: Wang, Ying A <ying.a.wang@intel.com> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; > Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] ethdev: add more protocol support in flow > API > > Hi Wang Ying, > > On Wed, Aug 14, 2019 at 11:24:30AM +0800, Wang Ying A wrote: > > Add new protocol header match support as below > > > > RTE_FLOW_ITEM_TYPE_GTP_PSC > > - matches a GTP PDU extension header (type is 0x85: > > PDU Session Container) > > RTE_FLOW_ITEM_TYPE_PPPOES > > - matches a PPPoE Session header. > > RTE_FLOW_ITEM_TYPE_PPPOED > > - matches a PPPoE Discovery stage header. > > > > Signed-off-by: Wang Ying A <ying.a.wang@intel.com> > > OK, please split this patch, one for GTP and the other for PPPoE to make title > less vague than "add more protocol support". > > For PPPoE, the distinction between session and discovery is not a bad idea but > since discovery packets typically have a different format (tags in place of > protocol), I'm not sure they should share a common structure. > > How about a single "PPPOE" item without proto_id to cover both session and > discovery, then later add separate tag items on a needed basis for each > possible/optional tag (e.g. PPPOE_TAG_SERVICE_NAME)? Likewise proto_id > would be provided through a separate optional item if relevant > (PPPOE_PROTO_ID). PPPoE Discovery had PPPoE Session has different ethertype 0x8863 , 0x8864, so I think they should belong to separate match item,( image the case we only need to match a PPPoE Session flow but don't care what kind of protocol payload it have ) but I agree they should only share the common part of the header, then for PPPoED, it can append optional PPPoE Tag item(s) and for PPPoES , it can append optional PPPoE Protocol item(s) > Such an approach is already used for IPV6 and IPV6_EXT. > > Another benefit is that applications could match PPPoE regardless of session or > discovery when they do not care, while PPPOED/PPPOES make that distinction > mandatory. > > Also by inserting new entries in the middle of the pattern items list, this patch > breaks ABI. I think it's not on purpose, so please move them to the end (not > grouping them with existing GTP stuff is fine, ABI compat is more > important.) This must be reflected in rte_flow.h, rte_flow.c, testpmd and > documentation. > > More nits below. > > > --- > > --- > > v2: Remove Gerrit Change-Id's. > > --- > > app/test-pmd/cmdline_flow.c | 80 > +++++++++++++++++++++++++++++ > > doc/guides/prog_guide/rte_flow.rst | 25 +++++++++ > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++++ > > lib/librte_ethdev/rte_flow.c | 3 ++ > > lib/librte_ethdev/rte_flow.h | 71 > +++++++++++++++++++++++++ > > 5 files changed, 189 insertions(+) > > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > [...] > > + [ITEM_PPPOES] = { > > + .name = "pppoes", > > + .help = "match PPPoE Session header", > > Session => session > > > + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), > > + .next = NEXT(item_pppoe), > > + .call = parse_vc, > > + }, > > + [ITEM_PPPOED] = { > > + .name = "pppoed", > > + .help = "match PPPoE Discovery stage header", > > Discovery => discovery > > > + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), > > + .next = NEXT(item_pppoe), > > + .call = parse_vc, > > + }, > > + [ITEM_PPPOE_SEID] = { > > + .name = "seid", > > + .help = "Session identifier", > > Session => session > > [...] > > diff --git a/doc/guides/prog_guide/rte_flow.rst > > b/doc/guides/prog_guide/rte_flow.rst > > index 821b524b3..d09c42071 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -1055,6 +1055,31 @@ flow rules. > > - ``teid``: tunnel endpoint identifier. > > - Default ``mask`` matches teid only. > > > > +Item: ``GTP_PSC`` > > +^^^^^^^^^^^^^^^^^^^^^^^ > > Too many "^^^"'s. > > [...] > > +Item: ``PPPOES``, ``PPPOED`` > > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > + > > +Matches a PPPOE header. > > PPPOE => PPPoE > > > + > > +Note: PPPOES and PPPOED use the same structure. PPPOES and PPPOED > > +item > > item => items (or better, "pattern items") > > > +are defined for a user-friendly API when creating PPPOE-Session and > > +PPPOE-Discovery flow rules. > > Super nit: use "PPPoE" when mentioning the protocol itself and "PPPOE" when > mentioning the pattern item. > > > + > > +- ``v_t_flags``: version (4b), type (4b). > > Why "flags"? I don't see any so you could name it "version_type" (same in > documentation). > > > +- ``code``: Message type. > > Message => message > > > +- ``session_id``: Session identifier. > > Session => session > > > +- ``length``: Payload length. > > Payload => payload > > > +- ``proto_id``: PPP Protocol identifier. > > Protocol => protocol > > > +- Default ``mask`` matches session_id,proto_id. > > Missing space between session_id and proto_id. > > > + > > Item: ``ESP`` > > ^^^^^^^^^^^^^ > > > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > index 313e0707e..0da36d5f1 100644 > > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > @@ -3904,6 +3904,16 @@ This section lists supported pattern items and > their attributes, if any. > > > > - ``teid {unsigned}``: tunnel endpoint identifier. > > > > +- ``gtp_psc``: match GTPv1 entension header (type is 0x85). > > + > > + - ``pdu_type {unsigned}``: PDU type (0 or 1). > > + - ``qfi {unsigned}``: QoS flow identifier. > > + > > +- ``pppoes``, ``pppoed``: match PPPOE header. > > PPPOE => PPPoE > > [...] > > diff --git a/lib/librte_ethdev/rte_flow.h > > b/lib/librte_ethdev/rte_flow.h index b66bf1495..ad5e46190 100644 > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -328,6 +328,34 @@ enum rte_flow_item_type { > > */ > > RTE_FLOW_ITEM_TYPE_GTPU, > > > > + /** > > + * Matches a GTP PDU extension header (type is 0x85: > > + * PDU Session Container). > > Session Container => session container > > > + * > > + * Configure flow for GTP packets with extension header type 0x85. > > + * > > + * See struct rte_flow_item_gtp_psc. > > + */ > > + RTE_FLOW_ITEM_TYPE_GTP_PSC, > > + > > + /** > > + * Matches a PPPOE header. > > + * > > + * Configure flow for PPPoE Session packets. > > Session => session > > > + * > > + * See struct rte_flow_item_pppoe. > > + */ > > + RTE_FLOW_ITEM_TYPE_PPPOES, > > + > > + /** > > + * Matches a PPPOE header. > > + * > > + * Configure flow for PPPoE Discovery stage packets. > > Discovery => discovery > > > + * > > + * See struct rte_flow_item_pppoe. > > + */ > > + RTE_FLOW_ITEM_TYPE_PPPOED, > > + > > /** > > * Matches a ESP header. > > * > > @@ -922,6 +950,49 @@ static const struct rte_flow_item_gtp > > rte_flow_item_gtp_mask = { }; #endif > > > > +/** > > + * RTE_FLOW_ITEM_TYPE_GTP_PSC. > > + * > > + * Matches a GTP-extension header > > + * (type is 0x85: PDU Session Container). > > Session Container => session container > > (crusade against superfluous caps!) > > [...] > > +/** > > + * RTE_FLOW_ITEM_TYPE_PPPOE. > > + * > > + * Matches a PPPOE header. > > + */ > > +struct rte_flow_item_pppoe { > > + /** > > + * Version (4b), type (4b). > > + */ > > + uint8_t v_t_flags; > > v_t_flags => version_type > > > + uint8_t code; /**< Message type. */ > > + rte_be16_t session_id; /**< Session identifier. */ > > + rte_be16_t length; /**< Payload length. */ > > + rte_be16_t proto_id; /**< PPP Protocol identifier. */ > > As discussed, I suggest dropping proto_id to make this a generic match for > PPPoE. > > > +}; > > + > > +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE. */ #ifndef __cplusplus > > +static const struct rte_flow_item_pppoe rte_flow_item_pppoe_mask = { > > + .session_id = RTE_BE16(0xffff), > > + .proto_id = RTE_BE16(0xffff), > > +}; > > I think the default for PPPoE should be an empty mask that simply says "match > PPPoE" since session_id only becomes known after negotiation and proto_id > shouldn't be part of this object. > > -- > Adrien Mazarguil > 6WIND
patch 1/2: Add GTP extension header to flow API. patch 2/2: Add PPPoE to flow API. --- v3: Split original patch, one for GTP and the other for PPPoE. Add RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID for PPPoE session packets. v2: Remove Gerrit Change-Id's. --- Wang Ying A (2): ethdev: add GTP extension header to flow API ethdev: add PPPoE to flow API app/test-pmd/cmdline_flow.c | 87 ++++++++++++++++++++++++++- doc/guides/prog_guide/rte_flow.rst | 28 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++ lib/librte_ethdev/rte_flow.c | 5 ++ lib/librte_ethdev/rte_flow.h | 93 +++++++++++++++++++++++++++++ 5 files changed, 225 insertions(+), 1 deletion(-) -- 2.15.1
- RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP PDU extension header (PDU session container). Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- app/test-pmd/cmdline_flow.c | 36 +++++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 9 ++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++++ lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 27 ++++++++++++++++++++++ 5 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 495871394..944a3e852 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -196,6 +196,9 @@ enum index { ITEM_META_DATA, ITEM_GRE_KEY, ITEM_GRE_KEY_VALUE, + ITEM_GTP_PSC, + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, /* Validate/create actions. */ ACTIONS, @@ -663,6 +666,7 @@ static const enum index next_item[] = { ITEM_ICMP6_ND_OPT_TLA_ETH, ITEM_META, ITEM_GRE_KEY, + ITEM_GTP_PSC, END_SET, ZERO, }; @@ -902,6 +906,13 @@ static const enum index item_meta[] = { ZERO, }; +static const enum index item_gtp_psc[] = { + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -2331,6 +2342,28 @@ static const struct token token_list[] = { .next = NEXT(item_gre_key, NEXT_ENTRY(UNSIGNED), item_param), .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), }, + [ITEM_GTP_PSC] = { + .name = "gtp_psc", + .help = "match GTP extension header with type 0x85", + .priv = PRIV_ITEM(GTP_PSC, + sizeof(struct rte_flow_item_gtp_psc)), + .next = NEXT(item_gtp_psc), + .call = parse_vc, + }, + [ITEM_GTP_PSC_QFI] = { + .name = "qfi", + .help = "QoS flow identifier", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + qfi)), + }, + [ITEM_GTP_PSC_PDU_T] = { + .name = "pdu_t", + .help = "PDU type", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + pdu_type)), + }, /* Validate/create actions. */ [ACTIONS] = { @@ -5756,6 +5789,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_ESP: mask = &rte_flow_item_esp_mask; break; + case RTE_FLOW_ITEM_TYPE_GTP_PSC: + mask = &rte_flow_item_gtp_psc_mask; + break; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 821b524b3..7521a1ec4 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1205,6 +1205,15 @@ Matches an application specific 32 bit metadata item. - Default ``mask`` matches the specified metadata value. +Item: ``GTP_PSC`` +^^^^^^^^^^^^^^^^^ + +Matches a GTP PDU extension header with type 0x85. + +- ``pdu_type``: PDU type. +- ``qfi``: QoS flow identifier. +- Default ``mask`` matches QFI only. + .. _table_rte_flow_item_meta: .. table:: META diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 313e0707e..4f71ae234 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3955,6 +3955,11 @@ This section lists supported pattern items and their attributes, if any. - ``data {unsigned}``: metadata value. +- ``gtp_psc``: match GTP PDU extension header with type 0x85. + + - ``pdu_type {unsigned}``: PDU type. + - ``qfi {unsigned}``: QoS flow identifier. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..fb25219d1 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -75,6 +75,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)), MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), + MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b66bf1495..8bb37aafb 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -434,6 +434,15 @@ enum rte_flow_item_type { * @code rte_be32_t * @endcode */ RTE_FLOW_ITEM_TYPE_GRE_KEY, + + /** + * Matches a GTP extension header: PDU session container. + * + * Configure flow for GTP packets with extension header type 0x85. + * + * See struct rte_flow_item_gtp_psc. + */ + RTE_FLOW_ITEM_TYPE_GTP_PSC, }; /** @@ -1192,6 +1201,24 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_GTP_PSC. + * + * Matches a GTP PDU extension header with type 0x85. + */ +struct rte_flow_item_gtp_psc { + uint8_t pdu_type; /**< PDU type. */ + uint8_t qfi; /**< QoS flow identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ +#ifndef __cplusplus +static const struct rte_flow_item_gtp_psc +rte_flow_item_gtp_psc_mask = { + .qfi = 0x3f, +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.15.1
- RTE_FLOW_ITEM_TYPE_PPPOES: matches a PPPoE session header. - RTE_FLOW_ITEM_TYPE_PPPOED: matches a PPPoE discovery header. - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: matches a PPPoE session protocol identifier. Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- app/test-pmd/cmdline_flow.c | 51 +++++++++++++++++++++- doc/guides/prog_guide/rte_flow.rst | 19 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++ lib/librte_ethdev/rte_flow.c | 4 ++ lib/librte_ethdev/rte_flow.h | 66 +++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 944a3e852..a19fb65f2 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -199,6 +199,10 @@ enum index { ITEM_GTP_PSC, ITEM_GTP_PSC_QFI, ITEM_GTP_PSC_PDU_T, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO_ID, /* Validate/create actions. */ ACTIONS, @@ -667,6 +671,9 @@ static const enum index next_item[] = { ITEM_META, ITEM_GRE_KEY, ITEM_GTP_PSC, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_PROTO_ID, END_SET, ZERO, }; @@ -913,6 +920,18 @@ static const enum index item_gtp_psc[] = { ZERO, }; +static const enum index item_pppoe[] = { + ITEM_PPPOE_SEID, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_pppoe_proto_id[] = { + ITEM_PPPOE_PROTO_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -2364,7 +2383,35 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, pdu_type)), }, - + [ITEM_PPPOES] = { + .name = "pppoe", + .help = "match PPPoE session header", + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOED] = { + .name = "pppoe", + .help = "match PPPoE discovery header", + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoe), + .call = parse_vc, + }, + [ITEM_PPPOE_SEID] = { + .name = "seid", + .help = "session identifier", + .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + session_id)), + }, + [ITEM_PPPOE_PROTO_ID] = { + .name = "proto_id", + .help = "match PPPoE session protocol identifier", + .priv = PRIV_ITEM(PPPOE_PROTO_ID, + sizeof(struct rte_flow_item_pppoe_proto_id)), + .next = NEXT(item_pppoe_proto_id), + .call = parse_vc, + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -5792,6 +5839,8 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_GTP_PSC: mask = &rte_flow_item_gtp_psc_mask; break; + case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: + mask = &rte_flow_item_pppoe_proto_id_mask; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 7521a1ec4..ff6fb1186 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1214,6 +1214,25 @@ Matches a GTP PDU extension header with type 0x85. - ``qfi``: QoS flow identifier. - Default ``mask`` matches QFI only. +Item: ``PPPOES``, ``PPPOED`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPoE header. + +- ``version_type``: version (4b), type (4b). +- ``code``: message type. +- ``session_id``: session identifier. +- ``length``: payload length. + +Item: ``PPPOE_PROTO_ID`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPoE session protocol identifier. + +- ``proto_id``: PPP protocol identifier. +- Default ``mask`` matches proto_id only. + + .. _table_rte_flow_item_meta: .. table:: META diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 4f71ae234..bc2ebe7b1 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3960,6 +3960,14 @@ This section lists supported pattern items and their attributes, if any. - ``pdu_type {unsigned}``: PDU type. - ``qfi {unsigned}``: QoS flow identifier. +- ``pppoes``, ``pppoed``: match PPPoE header. + + - ``session_id {unsigned}``: session identifier. + +- ``pppoe_proto_id``: match PPPoE session protocol identifier. + + - ``proto_id {unsigned}``: PPP protocol identifier. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index fb25219d1..cc03b159f 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -76,6 +76,10 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), + MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOE_PROTO_ID, + sizeof(struct rte_flow_item_pppoe_proto_id)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 8bb37aafb..09d1db4b3 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -443,6 +443,33 @@ enum rte_flow_item_type { * See struct rte_flow_item_gtp_psc. */ RTE_FLOW_ITEM_TYPE_GTP_PSC, + + /** + * Matches a PPPoE header. + * + * Configure flow for PPPoE session packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOES, + + /** + * Matches a PPPoE header. + * + * Configure flow for PPPoE discovery packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOED, + + /** + * Matches a PPPoE optional proto_id field. + * + * It only applies to PPPoE session packets. + * + * See struct rte_flow_item_pppoe_proto_id. + */ + RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID, }; /** @@ -1219,6 +1246,45 @@ rte_flow_item_gtp_psc_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_PPPOE. + * + * Matches a PPPoE header. + */ +struct rte_flow_item_pppoe { + /** + * Version (4b), type (4b). + */ + uint8_t version_type; + uint8_t code; /**< Message type. */ + rte_be16_t session_id; /**< Session identifier. */ + rte_be16_t length; /**< Payload length. */ +}; + +/** + * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. + * + * Matches a PPPoE optional proto_id field. + * + * It only applies to PPPoE session packets. + * + * Normally preceded by any of: + * + * - RTE_FLOW_ITEM_TYPE_PPPOE + * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID + */ +struct rte_flow_item_pppoe_proto_id { + rte_be16_t proto_id; /**< PPP protocol identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */ +#ifndef __cplusplus +static const struct rte_flow_item_pppoe_proto_id +rte_flow_item_pppoe_proto_id_mask = { + .proto_id = RTE_BE16(0xffff), +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.15.1
patch 1/2: Add GTP extension header to flow API. patch 2/2: Add PPPoE to flow API. --- v4: Fix PPPoE testpmd cmdline issue. v3: Split original patch, one for GTP and the other for PPPoE. Add RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID for PPPoE session packets. v2: Remove Gerrit Change-Id's. --- Wang Ying A (2): ethdev: add GTP extension header to flow API ethdev: add PPPoE to flow API app/test-pmd/cmdline_flow.c | 93 ++++++++++++++++++++++++++++- doc/guides/prog_guide/rte_flow.rst | 28 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++ lib/librte_ethdev/rte_flow.c | 5 ++ lib/librte_ethdev/rte_flow.h | 93 +++++++++++++++++++++++++++++ 5 files changed, 231 insertions(+), 1 deletion(-) -- 2.15.1
- RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP PDU extension header (PDU session container). Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- app/test-pmd/cmdline_flow.c | 36 +++++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 9 ++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++++ lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 27 ++++++++++++++++++++++ 5 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 495871394..944a3e852 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -196,6 +196,9 @@ enum index { ITEM_META_DATA, ITEM_GRE_KEY, ITEM_GRE_KEY_VALUE, + ITEM_GTP_PSC, + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, /* Validate/create actions. */ ACTIONS, @@ -663,6 +666,7 @@ static const enum index next_item[] = { ITEM_ICMP6_ND_OPT_TLA_ETH, ITEM_META, ITEM_GRE_KEY, + ITEM_GTP_PSC, END_SET, ZERO, }; @@ -902,6 +906,13 @@ static const enum index item_meta[] = { ZERO, }; +static const enum index item_gtp_psc[] = { + ITEM_GTP_PSC_QFI, + ITEM_GTP_PSC_PDU_T, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -2331,6 +2342,28 @@ static const struct token token_list[] = { .next = NEXT(item_gre_key, NEXT_ENTRY(UNSIGNED), item_param), .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), }, + [ITEM_GTP_PSC] = { + .name = "gtp_psc", + .help = "match GTP extension header with type 0x85", + .priv = PRIV_ITEM(GTP_PSC, + sizeof(struct rte_flow_item_gtp_psc)), + .next = NEXT(item_gtp_psc), + .call = parse_vc, + }, + [ITEM_GTP_PSC_QFI] = { + .name = "qfi", + .help = "QoS flow identifier", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + qfi)), + }, + [ITEM_GTP_PSC_PDU_T] = { + .name = "pdu_t", + .help = "PDU type", + .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, + pdu_type)), + }, /* Validate/create actions. */ [ACTIONS] = { @@ -5756,6 +5789,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_ESP: mask = &rte_flow_item_esp_mask; break; + case RTE_FLOW_ITEM_TYPE_GTP_PSC: + mask = &rte_flow_item_gtp_psc_mask; + break; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 821b524b3..7521a1ec4 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1205,6 +1205,15 @@ Matches an application specific 32 bit metadata item. - Default ``mask`` matches the specified metadata value. +Item: ``GTP_PSC`` +^^^^^^^^^^^^^^^^^ + +Matches a GTP PDU extension header with type 0x85. + +- ``pdu_type``: PDU type. +- ``qfi``: QoS flow identifier. +- Default ``mask`` matches QFI only. + .. _table_rte_flow_item_meta: .. table:: META diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 313e0707e..4f71ae234 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3955,6 +3955,11 @@ This section lists supported pattern items and their attributes, if any. - ``data {unsigned}``: metadata value. +- ``gtp_psc``: match GTP PDU extension header with type 0x85. + + - ``pdu_type {unsigned}``: PDU type. + - ``qfi {unsigned}``: QoS flow identifier. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..fb25219d1 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -75,6 +75,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)), MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), + MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b66bf1495..8bb37aafb 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -434,6 +434,15 @@ enum rte_flow_item_type { * @code rte_be32_t * @endcode */ RTE_FLOW_ITEM_TYPE_GRE_KEY, + + /** + * Matches a GTP extension header: PDU session container. + * + * Configure flow for GTP packets with extension header type 0x85. + * + * See struct rte_flow_item_gtp_psc. + */ + RTE_FLOW_ITEM_TYPE_GTP_PSC, }; /** @@ -1192,6 +1201,24 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_GTP_PSC. + * + * Matches a GTP PDU extension header with type 0x85. + */ +struct rte_flow_item_gtp_psc { + uint8_t pdu_type; /**< PDU type. */ + uint8_t qfi; /**< QoS flow identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ +#ifndef __cplusplus +static const struct rte_flow_item_gtp_psc +rte_flow_item_gtp_psc_mask = { + .qfi = 0x3f, +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.15.1
- RTE_FLOW_ITEM_TYPE_PPPOES: matches a PPPoE session header. - RTE_FLOW_ITEM_TYPE_PPPOED: matches a PPPoE discovery header. - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: matches a PPPoE session protocol identifier. Signed-off-by: Wang Ying A <ying.a.wang@intel.com> --- app/test-pmd/cmdline_flow.c | 57 ++++++++++++++++++++++++- doc/guides/prog_guide/rte_flow.rst | 19 +++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++ lib/librte_ethdev/rte_flow.c | 4 ++ lib/librte_ethdev/rte_flow.h | 66 +++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 944a3e852..b91776299 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -199,6 +199,10 @@ enum index { ITEM_GTP_PSC, ITEM_GTP_PSC_QFI, ITEM_GTP_PSC_PDU_T, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_SEID, + ITEM_PPPOE_PROTO_ID, /* Validate/create actions. */ ACTIONS, @@ -667,6 +671,9 @@ static const enum index next_item[] = { ITEM_META, ITEM_GRE_KEY, ITEM_GTP_PSC, + ITEM_PPPOES, + ITEM_PPPOED, + ITEM_PPPOE_PROTO_ID, END_SET, ZERO, }; @@ -913,6 +920,24 @@ static const enum index item_gtp_psc[] = { ZERO, }; +static const enum index item_pppoed[] = { + ITEM_PPPOE_SEID, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_pppoes[] = { + ITEM_PPPOE_SEID, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_pppoe_proto_id[] = { + ITEM_PPPOE_PROTO_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -2364,7 +2389,35 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc, pdu_type)), }, - + [ITEM_PPPOES] = { + .name = "pppoes", + .help = "match PPPoE session header", + .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoes), + .call = parse_vc, + }, + [ITEM_PPPOED] = { + .name = "pppoed", + .help = "match PPPoE discovery header", + .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + .next = NEXT(item_pppoed), + .call = parse_vc, + }, + [ITEM_PPPOE_SEID] = { + .name = "seid", + .help = "session identifier", + .next = NEXT(item_pppoes, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe, + session_id)), + }, + [ITEM_PPPOE_PROTO_ID] = { + .name = "proto_id", + .help = "match PPPoE session protocol identifier", + .priv = PRIV_ITEM(PPPOE_PROTO_ID, + sizeof(struct rte_flow_item_pppoe_proto_id)), + .next = NEXT(item_pppoe_proto_id), + .call = parse_vc, + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -5792,6 +5845,8 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_GTP_PSC: mask = &rte_flow_item_gtp_psc_mask; break; + case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: + mask = &rte_flow_item_pppoe_proto_id_mask; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 7521a1ec4..ff6fb1186 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1214,6 +1214,25 @@ Matches a GTP PDU extension header with type 0x85. - ``qfi``: QoS flow identifier. - Default ``mask`` matches QFI only. +Item: ``PPPOES``, ``PPPOED`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPoE header. + +- ``version_type``: version (4b), type (4b). +- ``code``: message type. +- ``session_id``: session identifier. +- ``length``: payload length. + +Item: ``PPPOE_PROTO_ID`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a PPPoE session protocol identifier. + +- ``proto_id``: PPP protocol identifier. +- Default ``mask`` matches proto_id only. + + .. _table_rte_flow_item_meta: .. table:: META diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 4f71ae234..bc2ebe7b1 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3960,6 +3960,14 @@ This section lists supported pattern items and their attributes, if any. - ``pdu_type {unsigned}``: PDU type. - ``qfi {unsigned}``: QoS flow identifier. +- ``pppoes``, ``pppoed``: match PPPoE header. + + - ``session_id {unsigned}``: session identifier. + +- ``pppoe_proto_id``: match PPPoE session protocol identifier. + + - ``proto_id {unsigned}``: PPP protocol identifier. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index fb25219d1..cc03b159f 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -76,6 +76,10 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)), + MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)), + MK_FLOW_ITEM(PPPOE_PROTO_ID, + sizeof(struct rte_flow_item_pppoe_proto_id)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 8bb37aafb..09d1db4b3 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -443,6 +443,33 @@ enum rte_flow_item_type { * See struct rte_flow_item_gtp_psc. */ RTE_FLOW_ITEM_TYPE_GTP_PSC, + + /** + * Matches a PPPoE header. + * + * Configure flow for PPPoE session packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOES, + + /** + * Matches a PPPoE header. + * + * Configure flow for PPPoE discovery packets. + * + * See struct rte_flow_item_pppoe. + */ + RTE_FLOW_ITEM_TYPE_PPPOED, + + /** + * Matches a PPPoE optional proto_id field. + * + * It only applies to PPPoE session packets. + * + * See struct rte_flow_item_pppoe_proto_id. + */ + RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID, }; /** @@ -1219,6 +1246,45 @@ rte_flow_item_gtp_psc_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_PPPOE. + * + * Matches a PPPoE header. + */ +struct rte_flow_item_pppoe { + /** + * Version (4b), type (4b). + */ + uint8_t version_type; + uint8_t code; /**< Message type. */ + rte_be16_t session_id; /**< Session identifier. */ + rte_be16_t length; /**< Payload length. */ +}; + +/** + * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. + * + * Matches a PPPoE optional proto_id field. + * + * It only applies to PPPoE session packets. + * + * Normally preceded by any of: + * + * - RTE_FLOW_ITEM_TYPE_PPPOE + * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID + */ +struct rte_flow_item_pppoe_proto_id { + rte_be16_t proto_id; /**< PPP protocol identifier. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */ +#ifndef __cplusplus +static const struct rte_flow_item_pppoe_proto_id +rte_flow_item_pppoe_proto_id_mask = { + .proto_id = RTE_BE16(0xffff), +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.15.1
> -----Original Message-----
> From: Wang, Ying A
> Sent: Wednesday, August 28, 2019 2:01 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; adrien.mazarguil@6wind.com; Ye, Xiaolong
> <xiaolong.ye@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Wang,
> Ying A <ying.a.wang@intel.com>
> Subject: [PATCH v4 0/2] add GTP/PPPoE to flow API
>
> patch 1/2: Add GTP extension header to flow API.
> patch 2/2: Add PPPoE to flow API.
>
> ---
> v4: Fix PPPoE testpmd cmdline issue.
> v3: Split original patch, one for GTP and the other for PPPoE.
> Add RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID for PPPoE session
> packets.
> v2: Remove Gerrit Change-Id's.
> ---
>
> Wang Ying A (2):
> ethdev: add GTP extension header to flow API
> ethdev: add PPPoE to flow API
>
> app/test-pmd/cmdline_flow.c | 93
> ++++++++++++++++++++++++++++-
> doc/guides/prog_guide/rte_flow.rst | 28 +++++++++
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++
> lib/librte_ethdev/rte_flow.c | 5 ++
> lib/librte_ethdev/rte_flow.h | 93
> +++++++++++++++++++++++++++++
> 5 files changed, 231 insertions(+), 1 deletion(-)
>
> --
> 2.15.1
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wang Ying A
> Sent: Wednesday, August 28, 2019 9:01 AM
> To: qi.z.zhang@intel.com; ferruh.yigit@intel.com
> Cc: dev@dpdk.org; Adrien Mazarguil <adrien.mazarguil@6wind.com>;
> xiaolong.ye@intel.com; qiming.yang@intel.com; ying.a.wang@intel.com
> Subject: [dpdk-dev] [PATCH v4 1/2] ethdev: add GTP extension header to flow
> API
>
> - RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP
> PDU extension header (PDU session container).
>
> Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
> ---
Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori Kam
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wang Ying A
> Sent: Wednesday, August 28, 2019 9:01 AM
> To: qi.z.zhang@intel.com; ferruh.yigit@intel.com
> Cc: dev@dpdk.org; Adrien Mazarguil <adrien.mazarguil@6wind.com>;
> xiaolong.ye@intel.com; qiming.yang@intel.com; ying.a.wang@intel.com
> Subject: [dpdk-dev] [PATCH v4 2/2] ethdev: add PPPoE to flow API
>
> - RTE_FLOW_ITEM_TYPE_PPPOES: matches a PPPoE session header.
>
> - RTE_FLOW_ITEM_TYPE_PPPOED: matches a PPPoE discovery header.
>
> - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: matches a PPPoE session
> protocol identifier.
>
> Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
> ---
Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori Kam
On 9/24/2019 12:44 AM, Zhang, Qi Z wrote:
>
>
>> -----Original Message-----
>> From: Wang, Ying A
>> Sent: Wednesday, August 28, 2019 2:01 PM
>> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Cc: dev@dpdk.org; adrien.mazarguil@6wind.com; Ye, Xiaolong
>> <xiaolong.ye@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Wang,
>> Ying A <ying.a.wang@intel.com>
>> Subject: [PATCH v4 0/2] add GTP/PPPoE to flow API
>>
>> patch 1/2: Add GTP extension header to flow API.
>> patch 2/2: Add PPPoE to flow API.
>>
>> ---
>> v4: Fix PPPoE testpmd cmdline issue.
>> v3: Split original patch, one for GTP and the other for PPPoE.
>> Add RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID for PPPoE session
>> packets.
>> v2: Remove Gerrit Change-Id's.
>> ---
>>
>> Wang Ying A (2):
>> ethdev: add GTP extension header to flow API
>> ethdev: add PPPoE to flow API
>>
>> app/test-pmd/cmdline_flow.c | 93
>> ++++++++++++++++++++++++++++-
>> doc/guides/prog_guide/rte_flow.rst | 28 +++++++++
>> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 ++++
>> lib/librte_ethdev/rte_flow.c | 5 ++
>> lib/librte_ethdev/rte_flow.h | 93
>> +++++++++++++++++++++++++++++
>> 5 files changed, 231 insertions(+), 1 deletion(-)
>>
>> --
>> 2.15.1
>
> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
>
For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Series applied to dpdk-next-net/master, thanks.