ethdev: tunnel offload model
Quoted 241 lines · Gregory Etelson
From: Eli Britstein <[email protected]>
rte_flowAPI provides the building blocks for vendor-agnostic flow classification offloads. Therte_flow"patterns" and "actions" primitives are fine-grained, thus enabling DPDK applications the flexibility to offload network stacks and complex pipelines. Applications wishing to offload tunneled traffic are required to use therte_flowprimitives, such as group, meta, mark, tag, and others to model their high-level objects. The hardware model design for high-level software objects is not trivial. Furthermore, an optimal design is often vendor-specific.When hardware offloads tunneled traffic in multi-group logic, partially offloaded packets may arrive to the application after they were modified in hardware. In this case, the application may need to restore the original packet headers. Consider the following sequence:
The application decaps a packet in one group and jumps to a second group where it tries to match on a 5-tuple, that will miss and send the packet to the application. In this case, the application does not receive the original packet but a modified one. Also, in this case, the application cannot match on the outer header fields, such as VXLAN vni and 5-tuple.There are several possible ways to use
rte_flow"patterns" and "actions" to resolve the issues above. For example:
1 Mapping headers to a hardware registers using the rte_flow_action_mark/rte_flow_action_tag/rte_flow_set_meta objects. 2 Apply the decap only at the last offload stage after all the "patterns" were matched and the packet will be fully offloaded. Every approach has its pros and cons and is highly dependent on the hardware vendor. For example, some hardware may have a limited number of registers while other hardware could not support inner actions and must decap before accessing inner headers.The tunnel offload model resolves these issues. The model goals are:
1 Provide a unified application API to offload tunneled traffic that is capable to match on outer headers after decap.
2 Allow the application to restore the outer header of partially offloaded packets.The tunnel offload model does not introduce new elements to the existing RTE flow model and is implemented as a set of helper functions.
For the application to work with the tunnel offload API it has to adjust flow rules in multi-table tunnel offload in the following way:
1 Remove explicit call to decap action and replace it with PMD actions obtained fromrte_flow_tunnel_decap_and_set()helper.
2 Add PMD items obtained fromrte_flow_tunnel_match()helper to all other rules in the tunnel offload sequence.VXLAN Code example:
Assume application needs to do inner NAT on the VXLAN packet. The first rule in group 0:
flow create <port id> ingress group 0
pattern eth / ipv4 / udp dst is 4789 / vxlan / end actions {pmd actions} / jump group 3 / endThe first VXLAN packet that arrives matches the rule in group 0 and jumps to group 3. In group 3 the packet will miss since there is no flow to match and will be sent to the application. Application will call
rte_flow_get_restore_info()to get the packet outer header.Application will insert a new rule in group 3 to match outer and inner headers:
flow create <port id> ingress group 3
pattern {pmd items} / eth / ipv4 dst is 172.10.10.1 /
udp dst 4789 / vxlan vni is 10 /
ipv4 dst is 184.1.2.3 / end
actionsset_ipv4_dst186.1.1.1 / queue index 3 / endResulting of the rules will be that VXLAN packet with vni=10, outer IPv4 dst=172.10.10.1 and inner IPv4 dst=184.1.2.3 will be received decapped on queue 3 with IPv4 dst=186.1.1.1
Note: The packet in group 3 is considered decapped. All actions in that group will be done on the header that was inner before decap. The application may specify an outer header to be matched on. It's PMD responsibility to translate these items to outer metadata.
API usage:
/**
* 1. Initiate RTE flow tunnel object
*/
const structrte_flow_tunneltunnel = {
.type =RTE_FLOW_ITEM_TYPE_VXLAN,
.tun_id = 10,
}/**
* 2. Obtain PMD tunnel actions
*
*pmd_actionsis an intermediate variable application uses to
* compile actions array
*/
structrte_flow_action**pmd_actions; rte_flow_tunnel_decap_and_set(&tunnel,&pmd_actions,&num_pmd_actions, &error);/**
* 3. offload the first rule
* matching on VXLAN traffic and jumps to group 3
* (implicitly decaps packet)
*/app_actions= jump group 3rule_items=app_items; /** eth / ipv4 / udp / vxlan */rule_actions= {pmd_actions,app_actions}; attr.group = 0;flow_1= rte_flow_create(port_id, &attr,rule_items, rule_actions, &error);/**
* 4. after flow creation application does not need to keep the
* tunnel action resources.
*/
rte_flow_tunnel_action_release(port_id,pmd_actions,num_pmd_actions);/**
* 5. After partially offloaded packet miss because there was no
* matching rule handle miss on group 3
*/
structrte_flow_restore_infoinfo;rte_flow_get_restore_info(port_id, mbuf, &info, &error);/**
* 6. Offload NAT rule:
*/app_items= { eth / ipv4 dst is 172.10.10.1 / udp dst 4789 /vxlan vni is 10 / ipv4 dst is 184.1.2.3 }
app_actions= {set_ipv4_dst186.1.1.1 / queue index 3 }rte_flow_tunnel_match(&info.tunnel,
&pmd_items,&num_pmd_items, &error);
rule_items= {pmd_items,app_items};rule_actions=app_actions;
attr.group = info.group_id;flow_2= rte_flow_create(port_id, &attr,rule_items, rule_actions, &error);/**
* 7. Release PMD items after rule creation
*/
rte_flow_tunnel_item_release(port_id,pmd_items, num_pmd_items);References
1. https://mails.dpdk.org/archives/dev/2020-June/index.htmlSigned-off-by Eli Britstein <[email protected]>Signed-off-by Gregory Etelson <[email protected]>Acked-by Ori Kam <[email protected]>---
v5:
* rebase to next-netv6:
* update the patch comment
* update tunnel offload section inrte_flow.rst--- doc/guides/prog_guide/rte_flow.rst | 78 +++++++++ doc/guides/rel_notes/release_20_11.rst | 5 + lib/librte_ethdev/rte_ethdev_version.map | 5 + lib/librte_ethdev/rte_flow.c | 112 +++++++++++++ lib/librte_ethdev/rte_flow.h | 195 +++++++++++++++++++++++ lib/librte_ethdev/rte_flow_driver.h | 32 ++++ 6 files changed, 427 insertions(+)doc/guides/prog_guide/rte_flow.rst +60
-0@@ -3131,6 +3131,84 @@ operations include: - Duplication of a complete flow rule description. - Pattern item or action name retrieval. +Tunneled traffic offload +~~~~~~~~~~~~~~~~~~~~~~~~ + +rte_flow API provides the building blocks for vendor-agnostic flow +classification offloads. The rte_flow "patterns" and "actions" +primitives are fine-grained, thus enabling DPDK applications the +flexibility to offload network stacks and complex pipelines. +Applications wishing to offload tunneled traffic are required to use +the rte_flow primitives, such as group, meta, mark, tag, and others to +model their high-level objects. The hardware model design for +high-level software objects is not trivial. Furthermore, an optimal +design is often vendor-specific. + +When hardware offloads tunneled traffic in multi-group logic, +partially offloaded packets may arrive to the application after they +were modified in hardware. In this case, the application may need to +restore the original packet headers. Consider the following sequence: +The application decaps a packet in one group and jumps to a second +group where it tries to match on a 5-tuple, that will miss and send +the packet to the application. In this case, the application does not +receive the original packet but a modified one. Also, in this case, +the application cannot match on the outer header fields, such as VXLAN +vni and 5-tuple. + +There are several possible ways to use rte_flow "patterns" and +"actions" to resolve the issues above. For example: + +1 Mapping headers to a hardware registers using the +rte_flow_action_mark/rte_flow_action_tag/rte_flow_set_meta objects. + +2 Apply the decap only at the last offload stage after all the +"patterns" were matched and the packet will be fully offloaded. + +Every approach has its pros and cons and is highly dependent on the +hardware vendor. For example, some hardware may have a limited number +of registers while other hardware could not support inner actions and +must decap before accessing inner headers. + +The tunnel offload model resolves these issues. The model goals are: + +1 Provide a unified application API to offload tunneled traffic that +is capable to match on outer headers after decap. + +2 Allow the application to restore the outer header of partially +offloaded packets. + +The tunnel offload model does not introduce new elements to the +existing RTE flow model and is implemented as a set of helper +functions. + +For the application to work with the tunnel offload API it +has to adjust flow rules in multi-table tunnel offload in the +following way: + +1 Remove explicit call to decap action and replace it with PMD actions +obtained from rte_flow_tunnel_decap_and_set() helper. + +2 Add PMD items obtained from rte_flow_tunnel_match() helper to all +other rules in the tunnel offload sequence. +
doc/guides/prog_guide/rte_flow.rst operations include: · line 3203
Quoted 10 lines
doc/guides/prog_guide/rte_flow.rst +10
-0+The model requirements: + +Software application must initialize +rte_tunnel object with tunnel parameters before calling +rte_flow_tunnel_decap_set() & rte_flow_tunnel_match(). + +PMD actions array obtained in rte_flow_tunnel_decap_set() must be +released by application with rte_flow_action_release() call. + +PMD items array obtained with rte_flow_tunnel_match() must be released
Should be rte_flow_tunnel_item_release ?
Quoted 381 lines
doc/guides/prog_guide/rte_flow.rst +8
-0+by application with rte_flow_item_release() call. Application can +release PMD items and actions after rule was created. However, if the +application needs to create additional rule for the same tunnel it +will need to obtain PMD items again. + +Application cannot destroy rte_tunnel object before it releases all +PMD actions & PMD items referencing that tunnel. + Caveats -------doc/guides/rel_notes/release_20_11.rst +5
-0@@ -121,6 +121,11 @@ New Features * Flow rule verification was updated to accept private PMD items and actions. +* **Added generic API to offload tunneled traffic and restore missed packet.** + + * Added a new hardware independent helper API to RTE flow library that + offloads tunneled traffic and restores missed packets. + * **Updated Cisco enic driver.** * Added support for VF representors with single-queue Tx/Rx and flow APIlib/librte_ethdev/rte_ethdev_version.map +5
-0@@ -239,6 +239,11 @@ EXPERIMENTAL { rte_flow_shared_action_destroy; rte_flow_shared_action_query; rte_flow_shared_action_update; + rte_flow_tunnel_decap_set; + rte_flow_tunnel_match; + rte_flow_get_restore_info; + rte_flow_tunnel_action_decap_release; + rte_flow_tunnel_item_release; }; INTERNAL {lib/librte_ethdev/rte_flow.c +112
-0@@ -1143,3 +1143,115 @@ rte_flow_shared_action_query(uint16_t port_id, data, error);return flow_err (port_id, ret, error); } + +int +rte_flow_tunnel_decap_set (uint16_t port_id, +struct rte_flow_tunnel *tunnel, +struct rte_flow_action **actions, +uint32_t *num_of_actions, +struct rte_flow_error *error) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +const struct rte_flow_ops *ops =rte_flow_ops_get (port_id, error); + +if (unlikely (!ops)) +return -rte_errno; +if (likely (!!ops->tunnel_decap_set)) { +return flow_err (port_id, + ops->tunnel_decap_set (dev, tunnel, actions, + num_of_actions, error), + error); + } +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,rte_strerror (ENOTSUP )); +} + +int +rte_flow_tunnel_match (uint16_t port_id, +struct rte_flow_tunnel *tunnel, +struct rte_flow_item **items, +uint32_t *num_of_items, +struct rte_flow_error *error) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +const struct rte_flow_ops *ops =rte_flow_ops_get (port_id, error); + +if (unlikely (!ops)) +return -rte_errno; +if (likely (!!ops->tunnel_match)) { +return flow_err (port_id, + ops->tunnel_match (dev, tunnel, items, + num_of_items, error), + error); + } +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,rte_strerror (ENOTSUP )); +} + +int +rte_flow_get_restore_info (uint16_t port_id, +struct rte_mbuf *m, +struct rte_flow_restore_info *restore_info, +struct rte_flow_error *error) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +const struct rte_flow_ops *ops =rte_flow_ops_get (port_id, error); + +if (unlikely (!ops)) +return -rte_errno; +if (likely (!!ops->get_restore_info)) { +return flow_err (port_id, + ops->get_restore_info (dev, m, restore_info, + error), + error); + } +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,rte_strerror (ENOTSUP )); +} + +int +rte_flow_tunnel_action_decap_release (uint16_t port_id, +struct rte_flow_action *actions, +uint32_t num_of_actions, +struct rte_flow_error *error) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +const struct rte_flow_ops *ops =rte_flow_ops_get (port_id, error); + +if (unlikely (!ops)) +return -rte_errno; +if (likely (!!ops->action_release)) { +return flow_err (port_id, + ops->action_release (dev, actions, + num_of_actions, error), + error); + } +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,rte_strerror (ENOTSUP )); +} + +int +rte_flow_tunnel_item_release (uint16_t port_id, +struct rte_flow_item *items, +uint32_t num_of_items, +struct rte_flow_error *error) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +const struct rte_flow_ops *ops =rte_flow_ops_get (port_id, error); + +if (unlikely (!ops)) +return -rte_errno; +if (likely (!!ops->item_release)) { +return flow_err (port_id, + ops->item_release (dev, items, + num_of_items, error), + error); + } +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,rte_strerror (ENOTSUP )); +}lib/librte_ethdev/rte_flow.h +195
-0@@ -3620,6 +3620,201 @@ rte_flow_shared_action_query(uint16_t port_id,void *data, struct rte_flow_error *error); +/* Tunnel has a type and the key information. */ +struct rte_flow_tunnel { +/** +* Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN, +* RTE_FLOW_ITEM_TYPE_NVGRE etc. +*/ +enum rte_flow_item_type type; +uint64_t tun_id;/**< Tunnel identification. */ + + RTE_STD_C11 + union { +struct { +rte_be32_t src_addr;/**< IPv4 source address. */ +rte_be32_t dst_addr;/**< IPv4 destination address. */ + } ipv4; +struct { +uint8_t src_addr[16 ];/**< IPv6 source address. */ +uint8_t dst_addr[16 ];/**< IPv6 destination address. */ + } ipv6; + }; +rte_be16_t tp_src;/**< Tunnel port source. */ +rte_be16_t tp_dst;/**< Tunnel port destination. */ +uint16_t tun_flags;/**< Tunnel flags. */ + +bool is_ipv6;/**< True for valid IPv6 fields. Otherwise IPv4. */ + +/** +* the following members are required to restore packet +* after miss +*/ +uint8_t tos;/**< TOS for IPv4, TC for IPv6. */ +uint8_t ttl;/**< TTL for IPv4, HL for IPv6. */ +uint32_t label;/**< Flow Label for IPv6. */ +}; + +/** +* Indicate that the packet has a tunnel. +*/ +#define RTE_FLOW_RESTORE_INFO_TUNNEL (1ULL << 0) + +/** +* Indicate that the packet has a non decapsulated tunnel header. +*/ +#define RTE_FLOW_RESTORE_INFO_ENCAPSULATED (1ULL << 1) + +/** +* Indicate that the packet has a group_id. +*/ +#define RTE_FLOW_RESTORE_INFO_GROUP_ID (1ULL << 2) + +/** +* Restore information structure to communicate the current packet processing +* state when some of the processing pipeline is done in hardware and should +* continue in software. +*/ +struct rte_flow_restore_info { +/** +* Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of +* other fields in struct rte_flow_restore_info. +*/ +uint64_t flags; +uint32_t group_id;/**< Group ID where packed missed */ +struct rte_flow_tunnel tunnel;/**< Tunnel information. */ +}; + +/** +* Allocate an array of actions to be used in rte_flow_create, to implement +* tunnel-decap-set for the given tunnel. +* Sample usage: +* actions vxlan_decap / tunnel-decap-set(tunnel properties) / +* jump group 0 / end +* +* @param port_id +* Port identifier of Ethernet device. +* @param[in] tunnel +* Tunnel properties. +* @param[out] actions +* Array of actions to be allocated by the PMD. This array should be +* concatenated with the actions array provided to rte_flow_create. +* @param[out] num_of_actions +* Number of actions allocated. +* @param[out] error +* Perform verbose error reporting if not NULL. PMDs initialize this +* structure in case of error only. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +__rte_experimental +int +rte_flow_tunnel_decap_set (uint16_t port_id, +struct rte_flow_tunnel *tunnel, +struct rte_flow_action **actions, +uint32_t *num_of_actions, +struct rte_flow_error *error); + +/** +* Allocate an array of items to be used in rte_flow_create, to implement +* tunnel-match for the given tunnel. +* Sample usage: +* pattern tunnel-match(tunnel properties) / outer-header-matches / +* inner-header-matches / end +* +* @param port_id +* Port identifier of Ethernet device. +* @param[in] tunnel +* Tunnel properties. +* @param[out] items +* Array of items to be allocated by the PMD. This array should be +* concatenated with the items array provided to rte_flow_create. +* @param[out] num_of_items +* Number of items allocated. +* @param[out] error +* Perform verbose error reporting if not NULL. PMDs initialize this +* structure in case of error only. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +__rte_experimental +int +rte_flow_tunnel_match (uint16_t port_id, +struct rte_flow_tunnel *tunnel, +struct rte_flow_item **items, +uint32_t *num_of_items, +struct rte_flow_error *error); + +/** +* Populate the current packet processing state, if exists, for the given mbuf. +* +* @param port_id +* Port identifier of Ethernet device. +* @param[in] m +* Mbuf struct. +* @param[out] info +* Restore information. Upon success contains the HW state. +* @param[out] error +* Perform verbose error reporting if not NULL. PMDs initialize this +* structure in case of error only. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +__rte_experimental +int +rte_flow_get_restore_info (uint16_t port_id, +struct rte_mbuf *m, +struct rte_flow_restore_info *info, +struct rte_flow_error *error); + +/** +* Release the action array as allocated by rte_flow_tunnel_decap_set. +* +* @param port_id +* Port identifier of Ethernet device. +* @param[in] actions +* Array of actions to be released. +* @param[in] num_of_actions +* Number of elements in actions array. +* @param[out] error +* Perform verbose error reporting if not NULL. PMDs initialize this +* structure in case of error only. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +__rte_experimental +int +rte_flow_tunnel_action_decap_release (uint16_t port_id, +struct rte_flow_action *actions, +uint32_t num_of_actions, +struct rte_flow_error *error); + +/** +* Release the item array as allocated by rte_flow_tunnel_match. +* +* @param port_id +* Port identifier of Ethernet device. +* @param[in] items +* Array of items to be released. +* @param[in] num_of_items +* Number of elements in item array. +* @param[out] error +* Perform verbose error reporting if not NULL. PMDs initialize this +* structure in case of error only. +* +* @return +* 0 on success, a negative errno value otherwise and rte_errno is set. +*/ +__rte_experimental +int +rte_flow_tunnel_item_release (uint16_t port_id, +struct rte_flow_item *items, +uint32_t num_of_items, +struct rte_flow_error *error);#ifdef __cplusplus }#endif lib/librte_ethdev/rte_flow_driver.h +4
-0@@ -131,6 +131,38 @@ struct rte_flow_ops {const struct rte_flow_shared_action *shared_action, void *data, struct rte_flow_error *error); +/** See rte_flow_tunnel_decap_set() */ + int (*tunnel_decap_set) + (struct rte_eth_dev *dev, + struct rte_flow_tunnel *tunnel,
lib/librte_ethdev/rte_flow_driver.h struct rte_flow_ops { · line 147
Quoted 10 lines
lib/librte_ethdev/rte_flow_driver.h +10
-0+struct rte_flow_action **pmd_actions, + uint32_t *num_of_actions, + struct rte_flow_error *err); +/** See rte_flow_tunnel_match() */ +int (*tunnel_match) + (struct rte_eth_dev *dev, +struct rte_flow_tunnel *tunnel, +struct rte_flow_item **pmd_items, +uint32_t *num_of_items, +struct rte_flow_error *err);
Should be rte_flow_get_restore_info
lib/librte_ethdev/rte_flow_driver.h struct rte_flow_ops { · line 153
Quoted 5 lines
lib/librte_ethdev/rte_flow_driver.h +5
-0+ /** See rte_flow_get_rte_flow_restore_info() */> + int (*get_restore_info) + (struct rte_eth_dev *dev, + struct rte_mbuf *m, + struct rte_flow_restore_info *info, + struct rte_flow_error *err);
Should be rte_flow_tunnel_action_decap_release
lib/librte_ethdev/rte_flow_driver.h struct rte_flow_ops { · line 159
Quoted 6 lines
lib/librte_ethdev/rte_flow_driver.h +6
-0+/** See rte_flow_action_tunnel_decap_release() */ +int (*action_release) + (struct rte_eth_dev *dev, +struct rte_flow_action *pmd_actions, +uint32_t num_of_actions, +struct rte_flow_error *err);
Should rte_flow_tunnel_item_release?
lib/librte_ethdev/rte_flow_driver.h struct rte_flow_ops { · line 168
Quoted 10 lines
lib/librte_ethdev/rte_flow_driver.h +6
-0+/** See rte_flow_item_release() */ +int (*item_release) + (struct rte_eth_dev *dev, +struct rte_flow_item *pmd_items, +uint32_t num_of_items, +struct rte_flow_error *err); };/**
ABI Changes Acked-by: Ray Kinsella <[email protected]>
Hi Gregory, Eli,
Quoted 3 lines · Gregory Etelson
Applications wishing to offload tunneled traffic are required to use the
rte_flowprimitives, such as group, meta, mark, tag, and others to model their high-level objects. The hardware model design for
As far as I understand, the model is an abstraction of sorts, and the quoted lines provide examples of primitives which applications would have to use if the model did not exist.
Looking at the implementation, I don't quite discern any means to let the application query PMD-specific values of "rte_flow_attr". In example, the PMD may need to enforce "transfer=1" both for the "tunnel set" rule and for "tunnel match" one. What if "group" and "priority" values also need to be implicitly controlled by the PMD for the tunnel offload rules?
Have you considered adding an abstraction for "rte_flow_attr" in terms of this model?
Quoted 2 lines
The first VXLAN packet that arrives matches the rule in group 0 and jumps to group 3. In group 3 the packet will miss since there is no
This example considers jumping from group 0 to group 3. First of all, it's unclear whether this model intentionally lets the application choose group values freely (see my question above) or simply lacks an interface to let the application use values enforced by the PMD (if any). Secondly, given the fact that existing description of "rte_flow_attr" does not shed any light on how groups are ordered by default, when no JUMPs are configured (it only explains how priority levels are ordered within the given group but not how groups are ordered), it's unclear whether the model intentionally permits the application to jump between arbitrary groups (in example, from 0 to 3) and not necessarily between, say, 0 to 1. More to that, it's unclear whether the model lets the application jump from, say, group 0 to the very same group, 0 ("recirculation") or not. Or is the "recirculation" is in fact the main scenario in the model? Could you please elaborate on the model's expectations of groups?
Thank you.
Signature · 1 line
Ivan M
02/03/2021 10:22, Ivan Malov:
Quoted 40 lines
Hi Gregory, Eli,
Quoted 3 lines · Gregory Etelson
Applications wishing to offload tunneled traffic are required to use the
rte_flowprimitives, such as group, meta, mark, tag, and others to model their high-level objects. The hardware model design forAs far as I understand, the model is an abstraction of sorts, and the quoted lines provide examples of primitives which applications would have to use if the model did not exist.
Looking at the implementation, I don't quite discern any means to let the application query PMD-specific values of "
rte_flow_attr". In example, the PMD may need to enforce "transfer=1" both for the "tunnel set" rule and for "tunnel match" one. What if "group" and "priority" values also need to be implicitly controlled by the PMD for the tunnel offload rules?Have you considered adding an abstraction for "
rte_flow_attr" in terms of this model?Quoted 2 lines
The first VXLAN packet that arrives matches the rule in group 0 and jumps to group 3. In group 3 the packet will miss since there is no
This example considers jumping from group 0 to group 3. First of all, it's unclear whether this model intentionally lets the application choose group values freely (see my question above) or simply lacks an interface to let the application use values enforced by the PMD (if any). Secondly, given the fact that existing description of "
rte_flow_attr" does not shed any light on how groups are ordered by default, when no JUMPs are configured (it only explains how priority levels are ordered within the given group but not how groups are ordered), it's unclear whether the model intentionally permits the application to jump between arbitrary groups (in example, from 0 to 3) and not necessarily between, say, 0 to 1. More to that, it's unclear whether the model lets the application jump from, say, group 0 to the very same group, 0 ("recirculation") or not. Or is the "recirculation" is in fact the main scenario in the model? Could you please elaborate on the model's expectations of groups?
Quoted 1 line
Thank you.
Given the questions, I think the discussion should be concluded (when done) with a patch updating the API description. Thanks for the questions and clarifications to come :)
Hi,
Could someone please also clarify the meaning (from PMD standpoint and from application's standpoint) of the 64-bit field "tun_id" in "rte_flow_tunnel"? The current comment reads: "Tunnel identification", which is quite ambiguous, not to mention the fact that it simply expands the field's name. Does this ID have anything to do with VXLAN's VNI (which is 24-bit field)?
As far as I can learn from the testpmd patch series, this field gets printed only if it's non-zero. Hmm. A special value of sorts? Maybe clarify this, too?
Thank you.
Quoted 49 lines · Thomas Monjalon
02/03/2021 10:22, Ivan Malov:
Quoted 40 lines
Hi Gregory, Eli,
Quoted 3 lines · Gregory Etelson
Applications wishing to offload tunneled traffic are required to use the
rte_flowprimitives, such as group, meta, mark, tag, and others to model their high-level objects. The hardware model design forAs far as I understand, the model is an abstraction of sorts, and the quoted lines provide examples of primitives which applications would have to use if the model did not exist.
Looking at the implementation, I don't quite discern any means to let the application query PMD-specific values of "
rte_flow_attr". In example, the PMD may need to enforce "transfer=1" both for the "tunnel set" rule and for "tunnel match" one. What if "group" and "priority" values also need to be implicitly controlled by the PMD for the tunnel offload rules?Have you considered adding an abstraction for "
rte_flow_attr" in terms of this model?Quoted 2 lines
The first VXLAN packet that arrives matches the rule in group 0 and jumps to group 3. In group 3 the packet will miss since there is no
This example considers jumping from group 0 to group 3. First of all, it's unclear whether this model intentionally lets the application choose group values freely (see my question above) or simply lacks an interface to let the application use values enforced by the PMD (if any). Secondly, given the fact that existing description of "
rte_flow_attr" does not shed any light on how groups are ordered by default, when no JUMPs are configured (it only explains how priority levels are ordered within the given group but not how groups are ordered), it's unclear whether the model intentionally permits the application to jump between arbitrary groups (in example, from 0 to 3) and not necessarily between, say, 0 to 1. More to that, it's unclear whether the model lets the application jump from, say, group 0 to the very same group, 0 ("recirculation") or not. Or is the "recirculation" is in fact the main scenario in the model? Could you please elaborate on the model's expectations of groups?Quoted 1 line
Thank you.
Given the questions, I think the discussion should be concluded (when done) with a patch updating the API description. Thanks for the questions and clarifications to come :)
Signature · 1 line
Ivan M
Quoted 3 lines · Ivan Malov
Hi,
Could someone please also clarify the meaning (from PMD standpoint and from application's standpoint) of the 64-bit field "
tun_id" in "rte_flow_tunnel"? The current comment reads: "Tunnel identification", which is quite ambiguous, not to mention the fact that it simply expands the field's name. Does this ID have anything to do with VXLAN's VNI (which is 24-bit field)?
rte_flow_tunnel struct is the tunnel details communicated between the application and PMD when applying flows, and from the PMD to the application upon miss.
The fields in it are porting of the kernel's 'struct ip_tunnel_key'. See https://elixir.bootlin.com/linux/latest/source/include/net/ip_tunnels.h#L40
Regarding 'tun_id' - yes. In case of VXLAN tunnel it stores the VNI.
Quoted 56 lines
As far as I can learn from the testpmd patch series, this field gets printed only if it's non-zero. Hmm. A special value of sorts? Maybe clarify this, too?
Thank you.
Quoted 49 lines · Thomas Monjalon
02/03/2021 10:22, Ivan Malov:
Quoted 40 lines
Hi Gregory, Eli,
On 16/10/2020 15:51, Gregory Etelson wrote:
> Applications wishing to offload tunneled traffic are required to use > therte_flowprimitives, such as group, meta, mark, tag, and others to > model their high-level objects. The hardware model design forAs far as I understand, the model is an abstraction of sorts, and the quoted lines provide examples of primitives which applications would have to use if the model did not exist.
Looking at the implementation, I don't quite discern any means to let the application query PMD-specific values of "
rte_flow_attr". In example, the PMD may need to enforce "transfer=1" both for the "tunnel set" rule and for "tunnel match" one. What if "group" and "priority" values also need to be implicitly controlled by the PMD for the tunnel offload rules?Have you considered adding an abstraction for "
rte_flow_attr" in terms of this model?> The first VXLAN packet that arrives matches the rule in group 0 and > jumps to group 3. In group 3 the packet will miss since there is no
This example considers jumping from group 0 to group 3. First of all, it's unclear whether this model intentionally lets the application choose group values freely (see my question above) or simply lacks an interface to let the application use values enforced by the PMD (if any). Secondly, given the fact that existing description of "
rte_flow_attr" does not shed any light on how groups are ordered by default, when no JUMPs are configured (it only explains how priority levels are ordered within the given group but not how groups are ordered), it's unclear whether the model intentionally permits the application to jump between arbitrary groups (in example, from 0 to 3) and not necessarily between, say, 0 to 1. More to that, it's unclear whether the model lets the application jump from, say, group 0 to the very same group, 0 ("recirculation") or not. Or is the "recirculation" is in fact the main scenario in the model? Could you please elaborate on the model's expectations of groups?Quoted 1 line
Thank you.
Given the questions, I think the discussion should be concluded (when done) with a patch updating the API description. Thanks for the questions and clarifications to come :)
Hello,
Please find my answers below.
Regards,
Gregory
Quoted 21 lines
External email: Use caution opening links or attachments
Hi Gregory, Eli,
Quoted 1 line · Gregory Etelson
Applications wishing to offload tunneled traffic are required to use > the
rte_flowprimitives, such as group, meta, mark, tag, and others to > model their high-level objects. The hardware model design forAs far as I understand, the model is an abstraction of sorts, and the quoted lines provide examples of primitives which applications would have to use if the model did not exist.
Looking at the implementation, I don't quite discern any means to let the application query PMD-specific values of "
rte_flow_attr". In example, the PMD may need to enforce "transfer=1" both for the "tunnel set" rule and for "tunnel match" one. What if "group" and "priority"
values also need to be implicitly controlled by the PMD for the tunnel offload rules?
Quoted 3 lines
Have you considered adding an abstraction for "
rte_flow_attr" in terms of this model?
Tunnel offload introduces application model to recover packet outer headers after partial miss. We were able to build the model with addition of rte_flow_tunnel_decap_set & rte_flow_tunnel_match functions only. Please note, that except from returning private flow rule elements, these functions can provide internal PMD hints on tunnel flow rules processing. PMD can use these hints with addition of private PMD rule elements to modify any part of incoming tunnel flow rule - attributes, items or actions, to implement the model according to hardware specifications.
Quoted 18 lines
Quoted 1 line
The first VXLAN packet that arrives matches the rule in group 0 and >
jumps to group 3. In group 3 the packet will miss since there is no
This example considers jumping from group 0 to group 3. First of all, it's unclear whether this model intentionally lets the application choose group values freely (see my question above) or simply lacks an interface to let the application use values enforced by the PMD (if any). Secondly, given the fact that existing description of "
rte_flow_attr" does not shed any light on how groups are ordered by default, when no JUMPs are configured (it only explains how priority levels are ordered within the given group but not how groups are ordered), it's unclear whether the model intentionally permits the application to jump between arbitrary groups (in example, from 0 to 3) and not necessarily between, say, 0 to 1. More to that, it's unclear whether the model lets the application jump from, say, group 0 to the very same group, 0 ("recirculation") or not. Or is the "recirculation"
is in fact the main scenario in the model? Could you please elaborate on the model's expectations of groups?
The model has no limitation on application group selection. Application can use any group value in jump action destination, including the same one as was used for flow creation.
Quoted 4 lines
Thank you.
--
Ivan M
PATCH v8 3/3 app/testpmd: add commands for tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* Create application tunnel:
flow tunnel create <port> type <tunnel type>
On success, the command creates application tunnel object and returns the tunnel descriptor. Tunnel descriptor is used in subsequent flow creation commands to reference the tunnel.
* Create tunnel steering flow rule:tunnel_set <tunnel descriptor> parameter used with steering rule template.
* Create tunnel matching flow rule:tunnel_match <tunnel descriptor> used with matching rule template.
* If tunnel steering rule was offloaded, outer header of a partially offloaded packet is restored after miss.
Example:
test packet=
<Ether dst=24:8a:07:8d:ae:d6 src=50:6b:4b:cc:fc:e2 type=IPv4 | <IP version=4 ihl=5 proto=udp src=1.1.1.1 dst=1.1.1.10 | <UDP sport=4789 dport=4789 len=58 chksum=0x7f7b |
<VXLAN NextProtocol=Ethernet vni=0x0 |
<Ether dst=24:aa:aa:aa:aa:d6 src=50:bb:bb:bb:bb:e2 type=IPv4 | <IP version=4 ihl=5 proto=icmp src=2.2.2.2 dst=2.2.2.200 | <ICMP type=echo-request code=0 chksum=0xf7ff id=0x0 seq=0x0 |>>>>>>>
Quoted 1 line
Quoted 1 line
Quoted 1 line
len(packet)
92
testpmd> flow flush 0
testpmd> port 0/queue 0: received 1 packets src=50:6B:4B:CC:FC:E2 - dst=24:8A:07:8D:AE:D6 - type=0x0800 - length=92
testpmd> flow tunnel 0 type vxlan
port 0: flow tunnel #1 type vxlan
testpmd> flow create 0 ingress group 0 tunnel_set 1
pattern eth /ipv4 / udp dst is 4789 / vxlan / end actions jump group 0 / end
Flow rule #0 created
testpmd> port 0/queue 0: received 1 packets
tunnel restore info: - vxlan tunnel - outer header present # <--
src=50:6B:4B:CC:FC:E2 - dst=24:8A:07:8D:AE:D6 - type=0x0800 -
length=92
testpmd> flow create 0 ingress group 0 tunnel_match 1
pattern eth / ipv4 / udp dst is 4789 / vxlan / eth / ipv4 / end
actions set_mac_dst mac_addr 02:CA:FE:CA:FA:80 / queue index 0 / end
Flow rule #1 created
testpmd> port 0/queue 0: received 1 packets
src=50:BB:BB:BB:BB:E2 - dst=02:CA:FE:CA:FA:80 - type=0x0800 -
length=42
* Destroy flow tunnel
flow tunnel destroy <port> id <tunnel id>
* Show existing flow tunnels
flow tunnel list <port>
---
v2:
* introduce testpmd support for tunnel offload API
v3:
* update flow tunnel commands
v5:
* rebase to next-net
v7:
* resolve "%lu" differences in ubuntu 32 & 64
v8:
* use PRIu64 for general cast to uint64_t
--- app/test-pmd/cmdline_flow.c | 170 ++++++++++++- app/test-pmd/config.c | 252 +++++++++++++++++++- app/test-pmd/testpmd.c | 5 +- app/test-pmd/testpmd.h | 34 ++- app/test-pmd/util.c | 35 ++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 49 ++++ 6 files changed, 532 insertions(+), 13 deletions(-)
app/test-pmd/cmdline_flow.c +166 -4
@@ -74,6 +74,14 @@ enum index {LIST ,AGED ,ISOLATE , +TUNNEL , + +/* Tunnel arguments. */ +TUNNEL_CREATE , +TUNNEL_CREATE_TYPE , +TUNNEL_LIST , +TUNNEL_DESTROY , +TUNNEL_DESTROY_ID ,/* Destroy arguments. */ DESTROY_RULE,
@@ -93,6 +101,8 @@ enum index {INGRESS ,EGRESS ,TRANSFER , +TUNNEL_SET , +TUNNEL_MATCH ,/* Shared action arguments */ SHARED_ACTION_CREATE,
@@ -713,6 +723,7 @@ struct buffer { } sa;/* Shared action query arguments */ struct {struct rte_flow_attr attr; +struct tunnel_ops tunnel_ops;struct rte_flow_item *pattern;struct rte_flow_action *actions;uint32_t pattern_n;
@@ -789,10 +800,32 @@ static const enum index next_vc_attr[] = {INGRESS ,EGRESS ,TRANSFER , +TUNNEL_SET , +TUNNEL_MATCH ,PATTERN , ZERO, }; +static const enum index tunnel_create_attr[] = { +TUNNEL_CREATE , +TUNNEL_CREATE_TYPE , +END , +ZERO , +}; + +static const enum index tunnel_destroy_attr[] = { +TUNNEL_DESTROY , +TUNNEL_DESTROY_ID , +END , +ZERO , +}; + +static const enum index tunnel_list_attr[] = { +TUNNEL_LIST , +END , +ZERO , +}; +static const enum index next_destroy_attr[] = {DESTROY_RULE , END,
@@ -1643,6 +1676,9 @@ static int parse_aged(struct context *, const struct token *,static int parse_isolate (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int ); +static int parse_tunnel (struct context *,const struct token *, +const char *,unsigned int , +void *,unsigned int );static int parse_int (struct context *,const struct token *,const char *,unsigned int ,void *,unsigned int );
@@ -1844,7 +1880,8 @@ static const struct token token_list[] = { LIST,AGED ,QUERY , - ISOLATE)), +ISOLATE , + TUNNEL)), .call = parse_init, },/* Top-level command. */
@@ -1955,6 +1992,49 @@ static const struct token token_list[] = { ARGS_ENTRY(struct buffer, port)), .call = parse_isolate, }, + [TUNNEL] = { + .name ="tunnel" , + .help ="new tunnel API" , + .next =NEXT (NEXT_ENTRY + (TUNNEL_CREATE ,TUNNEL_LIST ,TUNNEL_DESTROY )), + .call = parse_tunnel, + }, + /* Tunnel arguments. */ + [TUNNEL_CREATE ] = { + .name ="create" , + .help ="create new tunnel object" , + .next =NEXT (tunnel_create_attr,NEXT_ENTRY (PORT_ID )), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_tunnel, + }, + [TUNNEL_CREATE_TYPE ] = { + .name ="type" , + .help ="create new tunnel" , + .next =NEXT (tunnel_create_attr,NEXT_ENTRY (FILE_PATH )), + .args = ARGS(ARGS_ENTRY(struct tunnel_ops, type)), + .call = parse_tunnel, + }, + [TUNNEL_DESTROY ] = { + .name ="destroy" , + .help ="destroy tunel" , + .next =NEXT (tunnel_destroy_attr,NEXT_ENTRY (PORT_ID )), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_tunnel, + }, + [TUNNEL_DESTROY_ID ] = { + .name ="id" , + .help ="tunnel identifier to testroy" , + .next =NEXT (tunnel_destroy_attr,NEXT_ENTRY (UNSIGNED )), + .args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)), + .call = parse_tunnel, + }, + [TUNNEL_LIST ] = { + .name ="list" , + .help ="list existing tunnels" , + .next =NEXT (tunnel_list_attr,NEXT_ENTRY (PORT_ID )), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_tunnel, + }, /* Destroy arguments. */ [DESTROY_RULE ] = { .name ="rule" ,
@@ -2018,6 +2098,20 @@ static const struct token token_list[] = { .next = NEXT(next_vc_attr), .call = parse_vc, }, + [TUNNEL_SET] = { + .name = "tunnel_set", + .help = "tunnel steer rule", + .next = NEXT(next_vc_attr, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)), + .call = parse_vc, + }, + [TUNNEL_MATCH] = { + .name = "tunnel_match", + .help = "tunnel match rule", + .next = NEXT(next_vc_attr, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)), + .call = parse_vc, + },/* Validate/create pattern. */ [PATTERN] = { .name = "pattern",
@@ -4495,12 +4589,28 @@ parse_vc(struct context *ctx, const struct token *token,return len; } ctx->objdata =0 ; - ctx->object = &out->args.vc.attr; +switch (ctx->curr) { +default : + ctx->object = &out->args.vc.attr; +break ; +case TUNNEL_SET : +case TUNNEL_MATCH : + ctx->object = &out->args.vc.tunnel_ops; +break ; + } ctx->objmask =NULL ;switch (ctx->curr) {case GROUP :case PRIORITY :return len; +case TUNNEL_SET : + out->args.vc.tunnel_ops.enabled =1 ; + out->args.vc.tunnel_ops.actions =1 ; +return len; +case TUNNEL_MATCH : + out->args.vc.tunnel_ops.enabled =1 ; + out->args.vc.tunnel_ops.items =1 ; +return len;case INGRESS : out->args.vc.attr.ingress =1 ;return len;
@@ -6108,6 +6218,47 @@ parse_isolate(struct context *ctx, const struct token *token,return len; } +static int +parse_tunnel (struct context *ctx,const struct token *token, +const char *str,unsigned int len, +void *buf,unsigned int size) +{ +struct buffer *out = buf; + +/* Token name must match. */ +if (parse_default (ctx, token, str, len,NULL ,0 ) <0 ) +return -1 ; +/* Nothing else to do if there is no buffer. */ +if (!out) +return len; +if (!out->command) { +if (ctx->curr !=TUNNEL ) +return -1 ; +if (sizeof (*out) > size) +return -1 ; + out->command = ctx->curr; + ctx->objdata =0 ; + ctx->object = out; + ctx->objmask =NULL ; + }else { +switch (ctx->curr) { +default : +break ; +case TUNNEL_CREATE : +case TUNNEL_DESTROY : +case TUNNEL_LIST : + out->command = ctx->curr; +break ; +case TUNNEL_CREATE_TYPE : +case TUNNEL_DESTROY_ID : + ctx->object = &out->args.vc.tunnel_ops; +break ; + } + } + +return len; +} +/** * Parse signed/unsigned integers 8 to 64-bit long. *
@@ -7148,11 +7299,13 @@ cmd_flow_parsed(const struct buffer *in)break ;case VALIDATE :port_flow_validate (in->port, &in->args.vc.attr, - in->args.vc.pattern, in->args.vc.actions); + in->args.vc.pattern, in->args.vc.actions, + &in->args.vc.tunnel_ops);break ;case CREATE :port_flow_create (in->port, &in->args.vc.attr, - in->args.vc.pattern, in->args.vc.actions); + in->args.vc.pattern, in->args.vc.actions, + &in->args.vc.tunnel_ops);break ;case DESTROY : port_flow_destroy(in->port, in->args.destroy.rule_n,
@@ -7178,6 +7331,15 @@ cmd_flow_parsed(const struct buffer *in)case AGED :port_flow_aged (in->port, in->args.aged.destroy);break ; +case TUNNEL_CREATE : +port_flow_tunnel_create (in->port, &in->args.vc.tunnel_ops); +break ; +case TUNNEL_DESTROY : +port_flow_tunnel_destroy (in->port, in->args.vc.tunnel_ops.id); +break ; +case TUNNEL_LIST : +port_flow_tunnel_list (in->port); +break ;default :break ; }
app/test-pmd/config.c +248 -4
313 lines not on this page · raw message
app/test-pmd/testpmd.c +4 -1
@@ -3684,6 +3684,8 @@ init_port_dcb_config(portid_t pid,static void init_port (void ) { +int i; +/* Configuration of Ethernet ports. */ ports = rte_zmalloc("testpmd: ports", sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
@@ -3693,7 +3695,8 @@ init_port(void)"rte_zmalloc(%d struct rte_port) failed\n" , RTE_MAX_ETHPORTS); } - +for (i =0 ; i <RTE_MAX_ETHPORTS ; i++) +LIST_INIT (&ports[i].flow_tunnel_list);/* Initialize ports NUMA structures */ memset (port_numa,NUMA_NO_CONFIG ,RTE_MAX_ETHPORTS );memset (rxring_numa,NUMA_NO_CONFIG ,RTE_MAX_ETHPORTS );
app/test-pmd/testpmd.h +32 -2
@@ -12,6 +12,7 @@#include <rte_gro.h> #include <rte_gso.h> #include <cmdline.h> +#include <sys/queue.h> #define RTE_PORT_ALL (~(portid_t)0x0)
@@ -150,6 +151,26 @@ struct port_shared_action {struct rte_flow_shared_action *action;/**< Shared action handle. */ }; +struct port_flow_tunnel { +LIST_ENTRY (port_flow_tunnel) chain; +struct rte_flow_action *pmd_actions; +struct rte_flow_item *pmd_items; +uint32_t id; +uint32_t num_pmd_actions; +uint32_t num_pmd_items; +struct rte_flow_tunnel tunnel; +struct rte_flow_action *actions; +struct rte_flow_item *items; +}; + +struct tunnel_ops { +uint32_t id; +char type[16 ]; +uint32_t enabled:1 ; +uint32_t actions:1 ; +uint32_t items:1 ; +}; +/** * The data structure associated with each port. */
@@ -182,6 +203,7 @@ struct rte_port {struct port_flow *flow_list;/**< Associated flows. */ struct port_shared_action *actions_list;/**< Associated shared actions. */ + LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT +1 ];const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT +1 ];/**< metadata value to insert in Tx packets. */
@@ -773,11 +795,13 @@ int port_shared_action_update(portid_t port_id, uint32_t id,int port_flow_validate (portid_t port_id,const struct rte_flow_attr *attr,const struct rte_flow_item *pattern, -const struct rte_flow_action *actions); +const struct rte_flow_action *actions, +const struct tunnel_ops *tunnel_ops);int port_flow_create (portid_t port_id,const struct rte_flow_attr *attr,const struct rte_flow_item *pattern, -const struct rte_flow_action *actions); +const struct rte_flow_action *actions, +const struct tunnel_ops *tunnel_ops);int port_shared_action_query (portid_t port_id,uint32_t id);void update_age_action_context (const struct rte_flow_action *actions,struct port_flow *pf);
@@ -788,6 +812,12 @@ int port_flow_query(portid_t port_id, uint32_t rule, const struct rte_flow_action *action);void port_flow_list (portid_t port_id,uint32_t n,const uint32_t *group);void port_flow_aged (portid_t port_id,uint8_t destroy); +const char *port_flow_tunnel_type (struct rte_flow_tunnel *tunnel); +struct port_flow_tunnel * +port_flow_locate_tunnel (uint16_t port_id,struct rte_flow_tunnel *tun); +void port_flow_tunnel_list (portid_t port_id); +void port_flow_tunnel_destroy (portid_t port_id,uint32_t tunnel_id); +void port_flow_tunnel_create (portid_t port_id,const struct tunnel_ops *ops);int port_flow_isolate (portid_t port_id,int set);void rx_ring_desc_display (portid_t port_id,queueid_t rxq_id,uint16_t rxd_id);
app/test-pmd/util.c +33 -2
@@ -48,18 +48,49 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], is_rx ?"received" :"sent" , (unsigned int) nb_pkts);for (i =0 ; i < nb_pkts; i++) { +int ret; +struct rte_flow_error error; +struct rte_flow_restore_info info = {0 , }; + mb = pkts[i]; eth_hdr =rte_pktmbuf_read (mb,0 ,sizeof (_eth_hdr), &_eth_hdr); eth_type =RTE_BE_TO_CPU_16 (eth_hdr->ether_type); - ol_flags = mb->ol_flags; packet_type = mb->packet_type; is_encapsulation =RTE_ETH_IS_TUNNEL_PKT (packet_type); - + ret =rte_flow_get_restore_info (port_id, mb, &info, &error); +if (!ret) { +printf ("restore info:" ); +if (info.flags &RTE_FLOW_RESTORE_INFO_TUNNEL ) { +struct port_flow_tunnel *port_tunnel; + + port_tunnel =port_flow_locate_tunnel + (port_id, &info.tunnel); +printf (" - tunnel" ); +if (port_tunnel) +printf (" #%u" , port_tunnel->id); +else +printf (" %s" ,"-none-" ); +printf (" type %s" , +port_flow_tunnel_type (&info.tunnel)); + }else { +printf (" - no tunnel info" ); + } +if (info.flags &RTE_FLOW_RESTORE_INFO_ENCAPSULATED ) +printf (" - outer header present" ); +else +printf (" - no outer header" ); +if (info.flags &RTE_FLOW_RESTORE_INFO_GROUP_ID ) +printf (" - miss group %u" , info.group_id); +else +printf (" - no miss group" ); +printf ("\n" ); + }print_ether_addr (" src=" , ð_hdr->s_addr);print_ether_addr (" - dst=" , ð_hdr->d_addr);printf (" - type=0x%04x - length=%u - nb_segs=%d" , eth_type, (unsigned int ) mb->pkt_len, (int )mb->nb_segs); + ol_flags = mb->ol_flags;if (ol_flags &PKT_RX_RSS_HASH ) {printf (" - RSS hash=0x%x" , (unsigned int ) mb->hash.rss);printf (" - RSS queue=0x%x" , (unsigned int ) queue);
doc/guides/testpmd_app_ug/testpmd_funcs.rst +49 -0
73 lines not on this page · raw message
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH v8 0/3] Tunnel Offload API
In reply to Gregory EtelsonQuoted 23 lines · Gregory Etelson
Tunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headersduring entire offload procedure;- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.v2:
* documentation updates
* MLX5 PMD implementation for tunnel offload
* testpmd updates for tunnel offloadv3:
* documentation updates
* MLX5 PMD updates
* testpmd updatesv4:
* updated patch: allow negative values in flow rule typesv5:
* rebase to next-net
Quoted 8 lines
v6:
* update tunnel offload API documentationv7:
* testpmd: resolve "%lu" differences in ubuntu 32 & 64v8:
* testpmd: use PRIu64 for general cast touint64_t
Ahh, I thought build issue solved in v7 already with 'PRIu64' but it seems not.
I will drop the v7 and get this one.
Quoted 22 lines
Eli Britstein (1):
ethdev: tunnel offload modelGregory Etelson (2):
ethdev: allow negative values in flow rule types app/testpmd: add commands for tunnel offload APIapp/test-pmd/cmdline_flow.c | 170 ++++++++++++- app/test-pmd/config.c | 252 +++++++++++++++++++- app/test-pmd/testpmd.c | 5 +- app/test-pmd/testpmd.h | 34 ++- app/test-pmd/util.c | 35 ++- doc/guides/prog_guide/rte_flow.rst | 81 +++++++ doc/guides/rel_notes/release_20_11.rst | 10 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 49 ++++ lib/librte_ethdev/rte_ethdev_version.map | 5 + lib/librte_ethdev/rte_flow.c | 140 ++++++++++- lib/librte_ethdev/rte_flow.h | 195 +++++++++++++++ lib/librte_ethdev/rte_flow_driver.h | 32 +++ 12 files changed, 989 insertions(+), 19 deletions(-)
Re: [dpdk-dev] [PATCH v8 0/3] Tunnel Offload API
Quoted 30 lines · Ferruh Yigit
Quoted 29 lines · Gregory Etelson
Tunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.v2:
* documentation updates
* MLX5 PMD implementation for tunnel offload
* testpmd updates for tunnel offloadv3:
* documentation updates
* MLX5 PMD updates
* testpmd updatesv4:
* updated patch: allow negative values in flow rule typesv5:
* rebase to next-netv6:
* update tunnel offload API documentationv7:
* testpmd: resolve "%lu" differences in ubuntu 32 & 64
Quoted 15 lines
Quoted 2 lines
v8:
* testpmd: use PRIu64 for general cast touint64_tAhh, I thought build issue solved in v7 already with 'PRIu64' but it seems not.
I will drop the v7 and get this one.
Quoted 8 lines
Eli Britstein (1):
ethdev: tunnel offload modelGregory Etelson (2):
ethdev: allow negative values in flow rule types app/testpmd: add commands for tunnel offload API
Series applied to dpdk-next-net/main, thanks.
(v7 dropped and patchwork status updated)
PATCH 1/1 ethdev: rename tunnel offload callbacks
In reply to Gregory Etelsonrename new rte_flow ops callbacks to emphasize relation to tunnel offload API.
--- lib/librte_ethdev/rte_flow.c | 13 +++++++------ lib/librte_ethdev/rte_flow_driver.h | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-)
lib/librte_ethdev/rte_flow.c +7 -6
@@ -1223,10 +1223,11 @@ rte_flow_tunnel_action_decap_release(uint16_t port_id,if (unlikely (!ops))return -rte_errno; -if (likely (!!ops->action_release)) { +if (likely (!!ops->tunnel_action_decap_release)) {return flow_err (port_id, - ops->action_release (dev, actions, - num_of_actions, error), + ops->tunnel_action_decap_release (dev, actions, + num_of_actions, + error), error); } return rte_flow_error_set(error, ENOTSUP,
@@ -1245,10 +1246,10 @@ rte_flow_tunnel_item_release(uint16_t port_id,if (unlikely (!ops))return -rte_errno; -if (likely (!!ops->item_release)) { +if (likely (!!ops->tunnel_item_release)) {return flow_err (port_id, - ops->item_release (dev, items, - num_of_items, error), + ops->tunnel_item_release (dev, items, + num_of_items, error), error); } return rte_flow_error_set(error, ENOTSUP,
lib/librte_ethdev/rte_flow_driver.h +2 -2
@@ -152,13 +152,13 @@ struct rte_flow_ops {struct rte_flow_restore_info *info, struct rte_flow_error *err);/** See rte_flow_action_tunnel_decap_release() */ -int (*action_release) +int (*tunnel_action_decap_release) (struct rte_eth_dev *dev,struct rte_flow_action *pmd_actions,uint32_t num_of_actions,struct rte_flow_error *err);/** See rte_flow_item_release() */ - int (*item_release) + int (*tunnel_item_release) (struct rte_eth_dev *dev, struct rte_flow_item *pmd_items, uint32_t num_of_items,
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH] ethdev: rename tunnel offload callbacks
Quoted 15 lines · Gregory Etelson
rename new
rte_flowops callbacks to emphasize relation to tunnel offload API.Signed-off-by Gregory Etelson <[email protected]>Acked-by Ori Kam <[email protected]>--- lib/librte_ethdev/rte_flow.c | 13 +++++++------ lib/librte_ethdev/rte_flow_driver.h | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-)lib/librte_ethdev/rte_flow.c +0
-0
lib/librte_ethdev/rte_flow.c rte_flow_tunnel_action_decap_release(uint16_t port_id, · line 1226
Quoted 5 lines
lib/librte_ethdev/rte_flow.c +1
-1@@ -1223,10 +1223,11 @@ rte_flow_tunnel_action_decap_release(uint16_t port_id,if (unlikely (!ops))return -rte_errno; -if (likely (!!ops->action_release)) { +if (likely (!!ops->tunnel_action_decap_release)) {
+1 to rename.
Kinsella, Ray
Acked-byRe: [dpdk-dev] [PATCH] ethdev: rename tunnel offload callbacks
Quoted 23 lines · Ferruh Yigit
Quoted 15 lines · Gregory Etelson
rename new
rte_flowops callbacks to emphasize relation to tunnel offload API.Signed-off-by Gregory Etelson <[email protected]>Acked-by Ori Kam <[email protected]>---
lib/librte_ethdev/rte_flow.c | 13 +++++++------lib/librte_ethdev/rte_flow_driver.h| 4 ++--2 files changed, 9 insertions(+), 8 deletions(-)lib/librte_ethdev/rte_flow.c +0
-0lib/librte_ethdev/rte_flow.c rte_flow_tunnel_action_decap_release(uint16_t port_id, · line 1225
Quoted 4 lines
lib/librte_ethdev/rte_flow.c +1
-1@@ -1223,10 +1223,11 @@ rte_flow_tunnel_action_decap_release(uint16_t port_id, if (unlikely(!ops)) return -rte_errno; - if (likely(!!ops->action_release)) { + if (likely(!!ops->tunnel_action_decap_release)) {+1 to rename.
Quoted 1 line
Acked-by Ferruh Yigit <[email protected]>
Thomas Monjalon
AppliedRe: [dpdk-dev] [PATCH] ethdev: rename tunnel offload callbacks
19/10/2020 11:56, Kinsella, Ray:
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · Gregory Etelson
Quoted 3 lines
rename new
rte_flowops callbacks to emphasize relation to tunnel offload API.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Gregory Etelson <[email protected]>Acked-by Ori Kam <[email protected]>+1 to rename.
Acked-by Ferruh Yigit <[email protected]>Acked-by Ray Kinsella <[email protected]>
Applied, thanks
PATCH 1/1 net/mlx5: implement tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* tunnel_offload PMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 680 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 170 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 248 +++++++++-- 8 files changed, 1081 insertions(+), 51 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
@@ -831,6 +831,9 @@ Driver options 24 bits. The actual supported width can be retrieved in runtime by series of rte_flow_validate() trials. + - 3, this engages tunnel offload mode. In E-Switch configuration, that + mode implicitly activates ``dv_xmeta_en=1``. + +------+-----------+-----------+-------------+-------------+ | Mode | ``MARK`` | ``META`` | ``META`` Tx | FDB/Through | +======+===========+===========+=============+=============+
drivers/net/mlx5/linux/mlx5_os.c +18 -0
@@ -298,6 +298,12 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop(); }#endif +if (!sh->tunnel_hub) + err =mlx5_alloc_tunnel_hub (sh); +if (err) { +DRV_LOG (ERR ,"mlx5_alloc_tunnel_hub failed err=%d" , err); + goto error; + }if (priv->config.reclaim_mode ==MLX5_RCM_AGGR ) { mlx5_glue->dr_reclaim_domain_memory (sh->rx_domain,1 ); mlx5_glue->dr_reclaim_domain_memory (sh->tx_domain,1 );
@@ -344,6 +350,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv);return err; }
@@ -405,6 +415,10 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv); }
@@ -708,6 +722,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno)); goto error; } +if (config->dv_miss_info) { +if (switch_info->master || switch_info->representor) + config->dv_xmeta_en =MLX5_XMETA_MODE_META16 ; + }mlx5_malloc_mem_select (config->sys_mem_en); sh =mlx5_alloc_shared_dev_ctx (spawn, config);if (!sh)
drivers/net/mlx5/mlx5.c +6 -2
@@ -1621,13 +1621,17 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_DV_XMETA_EN , key) ==0 ) {if (tmp !=MLX5_XMETA_MODE_LEGACY && tmp !=MLX5_XMETA_MODE_META16 && - tmp !=MLX5_XMETA_MODE_META32 ) { + tmp !=MLX5_XMETA_MODE_META32 && + tmp !=MLX5_XMETA_MODE_MISS_INFO ) {DRV_LOG (ERR ,"invalid extensive " "metadata parameter" ); rte_errno =EINVAL ;return -rte_errno; } - config->dv_xmeta_en = tmp; +if (tmp !=MLX5_XMETA_MODE_MISS_INFO ) + config->dv_xmeta_en = tmp; +else + config->dv_miss_info =1 ; }else if (strcmp (MLX5_LACP_BY_USER , key) ==0 ) { config->lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) {
drivers/net/mlx5/mlx5.h +3 -0
@@ -208,6 +208,7 @@ struct mlx5_dev_config { unsigned int rt_timestamp:1; /* realtime timestamp format. */ unsigned int sys_mem_en:1; /* The default memory allocator. */ unsigned int decap_en:1; /* Whether decap will be used or not. */ + unsigned int dv_miss_info:1; /* restore packet after partial hw miss */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ unsigned int stride_num_n;/* Number of strides. */
@@ -634,6 +635,8 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; +struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ +struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */
drivers/net/mlx5/mlx5_defs.h +2 -0
@@ -165,6 +165,8 @@#define MLX5_XMETA_MODE_LEGACY 0#define MLX5_XMETA_MODE_META16 1#define MLX5_XMETA_MODE_META32 2 +/* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ +#define MLX5_XMETA_MODE_MISS_INFO 3/* MLX5_TX_DB_NC supported values. */ #define MLX5_TXDB_CACHED 0
drivers/net/mlx5/mlx5_flow.c +660 -20
775 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +167 -3
228 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +222 -26
389 lines not on this page · raw message
Signature · 1 line
2.28.0
PATCH v2 1/1 net/mlx5: implement tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* tunnel_offload PMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.
---
v2:
* fix rebase conflicts
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 682 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 170 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 252 ++++++++++-- 8 files changed, 1085 insertions(+), 53 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
@@ -831,6 +831,9 @@ Driver options 24 bits. The actual supported width can be retrieved in runtime by series of rte_flow_validate() trials. + - 3, this engages tunnel offload mode. In E-Switch configuration, that + mode implicitly activates ``dv_xmeta_en=1``. + +------+-----------+-----------+-------------+-------------+ | Mode | ``MARK`` | ``META`` | ``META`` Tx | FDB/Through | +======+===========+===========+=============+=============+
drivers/net/mlx5/linux/mlx5_os.c +18 -0
@@ -291,6 +291,12 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop(); }#endif +if (!sh->tunnel_hub) + err =mlx5_alloc_tunnel_hub (sh); +if (err) { +DRV_LOG (ERR ,"mlx5_alloc_tunnel_hub failed err=%d" , err); + goto error; + }if (priv->config.reclaim_mode ==MLX5_RCM_AGGR ) { mlx5_glue->dr_reclaim_domain_memory (sh->rx_domain,1 ); mlx5_glue->dr_reclaim_domain_memory (sh->tx_domain,1 );
@@ -335,6 +341,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv);return err; }
@@ -391,6 +401,10 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv); }
@@ -733,6 +747,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno)); goto error; } +if (config->dv_miss_info) { +if (switch_info->master || switch_info->representor) + config->dv_xmeta_en =MLX5_XMETA_MODE_META16 ; + }mlx5_malloc_mem_select (config->sys_mem_en); sh =mlx5_alloc_shared_dev_ctx (spawn, config);if (!sh)
drivers/net/mlx5/mlx5.c +6 -2
@@ -1618,13 +1618,17 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_DV_XMETA_EN , key) ==0 ) {if (tmp !=MLX5_XMETA_MODE_LEGACY && tmp !=MLX5_XMETA_MODE_META16 && - tmp !=MLX5_XMETA_MODE_META32 ) { + tmp !=MLX5_XMETA_MODE_META32 && + tmp !=MLX5_XMETA_MODE_MISS_INFO ) {DRV_LOG (ERR ,"invalid extensive " "metadata parameter" ); rte_errno =EINVAL ;return -rte_errno; } - config->dv_xmeta_en = tmp; +if (tmp !=MLX5_XMETA_MODE_MISS_INFO ) + config->dv_xmeta_en = tmp; +else + config->dv_miss_info =1 ; }else if (strcmp (MLX5_LACP_BY_USER , key) ==0 ) { config->lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) {
drivers/net/mlx5/mlx5.h +3 -0
@@ -208,6 +208,7 @@ struct mlx5_dev_config { unsigned int rt_timestamp:1; /* realtime timestamp format. */ unsigned int sys_mem_en:1; /* The default memory allocator. */ unsigned int decap_en:1; /* Whether decap will be used or not. */ + unsigned int dv_miss_info:1; /* restore packet after partial hw miss */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ unsigned int stride_num_n;/* Number of strides. */
@@ -644,6 +645,8 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; +struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ +struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */
drivers/net/mlx5/mlx5_defs.h +2 -0
@@ -165,6 +165,8 @@#define MLX5_XMETA_MODE_LEGACY 0#define MLX5_XMETA_MODE_META16 1#define MLX5_XMETA_MODE_META32 2 +/* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ +#define MLX5_XMETA_MODE_MISS_INFO 3/* MLX5_TX_DB_NC supported values. */ #define MLX5_TXDB_CACHED 0
drivers/net/mlx5/mlx5_flow.c +662 -20
777 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +167 -3
228 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +224 -28
401 lines not on this page · raw message
Signature · 1 line
2.28.0
PATCH v3 1/1 net/mlx5: implement tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* tunnel_offload PMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.
---
v2:
* fix rebase conflicts
v3:
* remove unised variables
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 682 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 170 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 254 ++++++++++-- 8 files changed, 1087 insertions(+), 53 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
@@ -831,6 +831,9 @@ Driver options 24 bits. The actual supported width can be retrieved in runtime by series of rte_flow_validate() trials. + - 3, this engages tunnel offload mode. In E-Switch configuration, that + mode implicitly activates ``dv_xmeta_en=1``. + +------+-----------+-----------+-------------+-------------+ | Mode | ``MARK`` | ``META`` | ``META`` Tx | FDB/Through | +======+===========+===========+=============+=============+
drivers/net/mlx5/linux/mlx5_os.c +18 -0
@@ -291,6 +291,12 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop(); }#endif +if (!sh->tunnel_hub) + err =mlx5_alloc_tunnel_hub (sh); +if (err) { +DRV_LOG (ERR ,"mlx5_alloc_tunnel_hub failed err=%d" , err); + goto error; + }if (priv->config.reclaim_mode ==MLX5_RCM_AGGR ) { mlx5_glue->dr_reclaim_domain_memory (sh->rx_domain,1 ); mlx5_glue->dr_reclaim_domain_memory (sh->tx_domain,1 );
@@ -335,6 +341,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv);return err; }
@@ -391,6 +401,10 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv); }
@@ -733,6 +747,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno)); goto error; } +if (config->dv_miss_info) { +if (switch_info->master || switch_info->representor) + config->dv_xmeta_en =MLX5_XMETA_MODE_META16 ; + }mlx5_malloc_mem_select (config->sys_mem_en); sh =mlx5_alloc_shared_dev_ctx (spawn, config);if (!sh)
drivers/net/mlx5/mlx5.c +6 -2
@@ -1618,13 +1618,17 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_DV_XMETA_EN , key) ==0 ) {if (tmp !=MLX5_XMETA_MODE_LEGACY && tmp !=MLX5_XMETA_MODE_META16 && - tmp !=MLX5_XMETA_MODE_META32 ) { + tmp !=MLX5_XMETA_MODE_META32 && + tmp !=MLX5_XMETA_MODE_MISS_INFO ) {DRV_LOG (ERR ,"invalid extensive " "metadata parameter" ); rte_errno =EINVAL ;return -rte_errno; } - config->dv_xmeta_en = tmp; +if (tmp !=MLX5_XMETA_MODE_MISS_INFO ) + config->dv_xmeta_en = tmp; +else + config->dv_miss_info =1 ; }else if (strcmp (MLX5_LACP_BY_USER , key) ==0 ) { config->lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) {
drivers/net/mlx5/mlx5.h +3 -0
@@ -208,6 +208,7 @@ struct mlx5_dev_config { unsigned int rt_timestamp:1; /* realtime timestamp format. */ unsigned int sys_mem_en:1; /* The default memory allocator. */ unsigned int decap_en:1; /* Whether decap will be used or not. */ + unsigned int dv_miss_info:1; /* restore packet after partial hw miss */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ unsigned int stride_num_n;/* Number of strides. */
@@ -644,6 +645,8 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; +struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ +struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */
drivers/net/mlx5/mlx5_defs.h +2 -0
@@ -165,6 +165,8 @@#define MLX5_XMETA_MODE_LEGACY 0#define MLX5_XMETA_MODE_META16 1#define MLX5_XMETA_MODE_META32 2 +/* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ +#define MLX5_XMETA_MODE_MISS_INFO 3/* MLX5_TX_DB_NC supported values. */ #define MLX5_TXDB_CACHED 0
drivers/net/mlx5/mlx5_flow.c +662 -20
777 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +167 -3
228 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +226 -28
409 lines not on this page · raw message
Signature · 1 line
2.28.0
PATCH v4 1/1 net/mlx5: implement tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* tunnel_offload PMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.
---
v2:
* fix rebase conflicts
v3:
* remove unised variables
v4:
* use RTE_SET_USED()
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 682 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 170 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 254 ++++++++++-- 8 files changed, 1087 insertions(+), 53 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
@@ -831,6 +831,9 @@ Driver options 24 bits. The actual supported width can be retrieved in runtime by series of rte_flow_validate() trials. + - 3, this engages tunnel offload mode. In E-Switch configuration, that + mode implicitly activates ``dv_xmeta_en=1``. + +------+-----------+-----------+-------------+-------------+ | Mode | ``MARK`` | ``META`` | ``META`` Tx | FDB/Through | +======+===========+===========+=============+=============+
drivers/net/mlx5/linux/mlx5_os.c +18 -0
@@ -291,6 +291,12 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop(); }#endif +if (!sh->tunnel_hub) + err =mlx5_alloc_tunnel_hub (sh); +if (err) { +DRV_LOG (ERR ,"mlx5_alloc_tunnel_hub failed err=%d" , err); + goto error; + }if (priv->config.reclaim_mode ==MLX5_RCM_AGGR ) { mlx5_glue->dr_reclaim_domain_memory (sh->rx_domain,1 ); mlx5_glue->dr_reclaim_domain_memory (sh->tx_domain,1 );
@@ -335,6 +341,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv);return err; }
@@ -391,6 +401,10 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv); }
@@ -733,6 +747,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno)); goto error; } +if (config->dv_miss_info) { +if (switch_info->master || switch_info->representor) + config->dv_xmeta_en =MLX5_XMETA_MODE_META16 ; + }mlx5_malloc_mem_select (config->sys_mem_en); sh =mlx5_alloc_shared_dev_ctx (spawn, config);if (!sh)
drivers/net/mlx5/mlx5.c +6 -2
@@ -1618,13 +1618,17 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_DV_XMETA_EN , key) ==0 ) {if (tmp !=MLX5_XMETA_MODE_LEGACY && tmp !=MLX5_XMETA_MODE_META16 && - tmp !=MLX5_XMETA_MODE_META32 ) { + tmp !=MLX5_XMETA_MODE_META32 && + tmp !=MLX5_XMETA_MODE_MISS_INFO ) {DRV_LOG (ERR ,"invalid extensive " "metadata parameter" ); rte_errno =EINVAL ;return -rte_errno; } - config->dv_xmeta_en = tmp; +if (tmp !=MLX5_XMETA_MODE_MISS_INFO ) + config->dv_xmeta_en = tmp; +else + config->dv_miss_info =1 ; }else if (strcmp (MLX5_LACP_BY_USER , key) ==0 ) { config->lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) {
drivers/net/mlx5/mlx5.h +3 -0
@@ -208,6 +208,7 @@ struct mlx5_dev_config { unsigned int rt_timestamp:1; /* realtime timestamp format. */ unsigned int sys_mem_en:1; /* The default memory allocator. */ unsigned int decap_en:1; /* Whether decap will be used or not. */ + unsigned int dv_miss_info:1; /* restore packet after partial hw miss */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ unsigned int stride_num_n;/* Number of strides. */
@@ -644,6 +645,8 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; +struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ +struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */
drivers/net/mlx5/mlx5_defs.h +2 -0
@@ -165,6 +165,8 @@#define MLX5_XMETA_MODE_LEGACY 0#define MLX5_XMETA_MODE_META16 1#define MLX5_XMETA_MODE_META32 2 +/* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ +#define MLX5_XMETA_MODE_MISS_INFO 3/* MLX5_TX_DB_NC supported values. */ #define MLX5_TXDB_CACHED 0
drivers/net/mlx5/mlx5_flow.c +662 -20
777 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +167 -3
228 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +226 -28
409 lines not on this page · raw message
Signature · 1 line
2.28.0
PATCH v5 1/1 net/mlx5: implement tunnel offload API
In reply to Gregory EtelsonTunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* tunnel_offload PMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 681 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 171 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 254 ++++++++++-- 8 files changed, 1086 insertions(+), 54 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
@@ -788,6 +788,9 @@ Driver options 24 bits. The actual supported width can be retrieved in runtime by series of rte_flow_validate() trials. + - 3, this engages tunnel offload mode. In E-Switch configuration, that + mode implicitly activates ``dv_xmeta_en=1``. + +------+-----------+-----------+-------------+-------------+ | Mode | ``MARK`` | ``META`` | ``META`` Tx | FDB/Through | +======+===========+===========+=============+=============+
drivers/net/mlx5/linux/mlx5_os.c +18 -0
@@ -291,6 +291,12 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop(); }#endif +if (!sh->tunnel_hub) + err =mlx5_alloc_tunnel_hub (sh); +if (err) { +DRV_LOG (ERR ,"mlx5_alloc_tunnel_hub failed err=%d" , err); + goto error; + }if (priv->config.reclaim_mode ==MLX5_RCM_AGGR ) { mlx5_glue->dr_reclaim_domain_memory (sh->rx_domain,1 ); mlx5_glue->dr_reclaim_domain_memory (sh->tx_domain,1 );
@@ -335,6 +341,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv);return err; }
@@ -391,6 +401,10 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_hlist_destroy (sh->tag_table,NULL ,NULL ); sh->tag_table =NULL ; } +if (sh->tunnel_hub) { +mlx5_release_tunnel_hub (sh, priv->dev_port); + sh->tunnel_hub =NULL ; + }mlx5_free_table_hash_list (priv); }
@@ -733,6 +747,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno)); goto error; } +if (config->dv_miss_info) { +if (switch_info->master || switch_info->representor) + config->dv_xmeta_en =MLX5_XMETA_MODE_META16 ; + }mlx5_malloc_mem_select (config->sys_mem_en); sh =mlx5_alloc_shared_dev_ctx (spawn, config);if (!sh)
drivers/net/mlx5/mlx5.c +6 -2
@@ -1619,13 +1619,17 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_DV_XMETA_EN , key) ==0 ) {if (tmp !=MLX5_XMETA_MODE_LEGACY && tmp !=MLX5_XMETA_MODE_META16 && - tmp !=MLX5_XMETA_MODE_META32 ) { + tmp !=MLX5_XMETA_MODE_META32 && + tmp !=MLX5_XMETA_MODE_MISS_INFO ) {DRV_LOG (ERR ,"invalid extensive " "metadata parameter" ); rte_errno =EINVAL ;return -rte_errno; } - config->dv_xmeta_en = tmp; +if (tmp !=MLX5_XMETA_MODE_MISS_INFO ) + config->dv_xmeta_en = tmp; +else + config->dv_miss_info =1 ; }else if (strcmp (MLX5_LACP_BY_USER , key) ==0 ) { config->lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) {
drivers/net/mlx5/mlx5.h +3 -0
@@ -208,6 +208,7 @@ struct mlx5_dev_config { unsigned int rt_timestamp:1; /* realtime timestamp format. */ unsigned int sys_mem_en:1; /* The default memory allocator. */ unsigned int decap_en:1; /* Whether decap will be used or not. */ + unsigned int dv_miss_info:1; /* restore packet after partial hw miss */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ unsigned int stride_num_n;/* Number of strides. */
@@ -644,6 +645,8 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; +struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ +struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */
drivers/net/mlx5/mlx5_defs.h +2 -0
@@ -165,6 +165,8 @@#define MLX5_XMETA_MODE_LEGACY 0#define MLX5_XMETA_MODE_META16 1#define MLX5_XMETA_MODE_META32 2 +/* Provide info on patrial hw miss. Implies MLX5_XMETA_MODE_META16 */ +#define MLX5_XMETA_MODE_MISS_INFO 3/* MLX5_TX_DB_NC supported values. */ #define MLX5_TXDB_CACHED 0
drivers/net/mlx5/mlx5_flow.c +661 -20
779 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +167 -4
235 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +226 -28
409 lines not on this page · raw message
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH v5] net/mlx5: implement tunnel offload API
Hi,
Quoted 24 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Sunday, October 25, 2020 4:08 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Eli Britstein <[email protected]>; Oz Shlomo <[email protected]>; Slava Ovsiienko <[email protected]>; Shahaf Shuler <[email protected]>
Subject: [PATCH v5] net/mlx5: implement tunnel offload APITunnel Offload API provides hardware independent, unified model to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.Implementation details:
*tunnel_offloadPMD parameter must be set to 1 to enable the feature.
* application cannot use MARK and META flow actions whith tunnel.
* offload JUMP action is restricted to steering tunnel rule only.Signed-off-by Gregory Etelson <[email protected]>
Quoted 12 lines
--- doc/guides/nics/mlx5.rst | 3 + drivers/net/mlx5/linux/mlx5_os.c | 18 + drivers/net/mlx5/mlx5.c | 8 +- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_defs.h | 2 + drivers/net/mlx5/mlx5_flow.c | 681 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow.h | 171 +++++++- drivers/net/mlx5/mlx5_flow_dv.c | 254 ++++++++++-- 8 files changed, 1086 insertions(+), 54 deletions(-)
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
PATCH 1/1 net/mlx5: tunnel offload code cleanup
In reply to Gregory EtelsonRemove unused reference to rte_hash structure from PMD tunnel offload code.
--- drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_flow.c | 1 - 2 files changed, 2 deletions(-)
drivers/net/mlx5/mlx5.h +0 -1
@@ -648,7 +648,6 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; -struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */
drivers/net/mlx5/mlx5_flow.c +0 -1
@@ -19,7 +19,6 @@#include <rte_flow_driver.h> #include <rte_malloc.h> #include <rte_ip.h> -#include <rte_hash.h> #include <mlx5_glue.h> #include <mlx5_devx_cmds.h>
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH] net/mlx5: tunnel offload code cleanup
Quoted 10 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, October 27, 2020 18:12
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Eli Britstein <[email protected]>; Oz Shlomo <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: tunnel offload code cleanup
Quoted 4 lines
Remove unused reference to
rte_hashstructure from PMD tunnel offload code.Signed-off-by Gregory Etelson <[email protected]>
Re: [dpdk-dev] [PATCH] net/mlx5: tunnel offload code cleanup
In reply to Gregory EtelsonHi,
Quoted 10 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, October 27, 2020 6:12 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Eli Britstein <[email protected]>; Oz Shlomo <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: tunnel offload code cleanup
Quoted 3 lines
Remove unused reference to
rte_hashstructure from PMD tunnel offload code.
Added missing fixes line:
Quoted 32 lines
Signed-off-by Gregory Etelson <[email protected]>--- drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_flow.c | 1 - 2 files changed, 2 deletions(-)drivers/net/mlx5/mlx5.h +0
-1@@ -648,7 +648,6 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; -struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ drivers/net/mlx5/mlx5.h +0
-0void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ drivers/net/mlx5/mlx5_flow.c +0
-2@@ -19,7 +19,6 @@#include <rte_flow_driver.h> #include <rte_malloc.h> #include <rte_ip.h> -#include <rte_hash.h> #include <mlx5_glue.h> #include <mlx5_devx_cmds.h> --
Quoted 1 line
2.28.0
Patch applied to next-net-mlx, @[email protected],
Can you kindly squash it into relevant commit in next-net ?
Kindest regards
Raslan Darawsheh
Re: [dpdk-dev] [PATCH] net/mlx5: tunnel offload code cleanup
Quoted 47 lines · Raslan Darawsheh
Hi,
Quoted 10 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, October 27, 2020 6:12 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Eli Britstein <[email protected]>; Oz Shlomo <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: tunnel offload code cleanupQuoted 3 lines
Remove unused reference to
rte_hashstructure from PMD tunnel offload code.Added missing fixes line:
Fixes dc67aa65c698 ("net/mlx5: implement tunnel offload API")Quoted 29 lines
Signed-off-by Gregory Etelson <[email protected]>--- drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_flow.c | 1 - 2 files changed, 2 deletions(-)drivers/net/mlx5/mlx5.h +0
-1@@ -648,7 +648,6 @@ struct mlx5_dev_ctx_shared {/* UAR same-page access control required in 32bit implementations. */ #endif struct mlx5_hlist *flow_tbls; -struct rte_hash *flow_tbl_map;/* app group-to-flow table map */ struct mlx5_flow_tunnel_hub *tunnel_hub;/* Direct Rules tables for FDB, NIC TX+RX */ drivers/net/mlx5/mlx5.h +0
-0void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ drivers/net/mlx5/mlx5_flow.c +0
-1@@ -19,7 +19,6 @@#include <rte_flow_driver.h> #include <rte_malloc.h> #include <rte_ip.h> -#include <rte_hash.h>
Quoted 8 lines
Quoted 4 lines
drivers/net/mlx5/mlx5_flow.c +0
-1#include <mlx5_glue.h> #include <mlx5_devx_cmds.h> --2.28.0
Patch applied to next-net-mlx, @[email protected],
Can you kindly squash it into relevant commit in next-net ?
Done, squashed it into relevant commit in next-net/main, thanks.
PATCH 1/1 net/mlx5: fix tunnel flow destroy
In reply to Gregory EtelsonFlow destructor tired to access flow related resources after the flow object memory was already released and crashed dpdk process.
The patch moves flow memory release to the end of destructor.
--- drivers/net/mlx5/mlx5_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +1 -1
@@ -5935,7 +5935,6 @@ flow_list_destroy(struct rte_eth_dev *dev, uint32_t *list,mlx5_free (priv_fdir_flow); } } -mlx5_ipool_free (priv->sh->ipool[MLX5_IPOOL_RTE_FLOW ], flow_idx);if (flow->tunnel) {struct mlx5_flow_tunnel *tunnel; tunnel =mlx5_find_tunnel_id (dev, flow->tunnel_id);
@@ -5943,6 +5942,7 @@ flow_list_destroy(struct rte_eth_dev *dev, uint32_t *list,if (!__atomic_sub_fetch (&tunnel->refctn,1 , __ATOMIC_RELAXED))mlx5_flow_tunnel_free (dev, tunnel); } +mlx5_ipool_free (priv->sh->ipool[MLX5_IPOOL_RTE_FLOW ], flow_idx); }/**
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH] net/mlx5: fix tunnel flow destroy
Hi,
Quoted 10 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Wednesday, October 28, 2020 6:58 AM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Eli Britstein <[email protected]>; Oz Shlomo <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: fix tunnel flow destroy
Quoted 5 lines
Flow destructor tired to access flow related resources after the flow object memory was already released and crashed dpdk process.
The patch moves flow memory release to the end of destructor.
Added missing:
drivers/net/mlx5/mlx5_flow.c
Quoted 7 lines
Signed-off-by Gregory Etelson <[email protected]>Acked-by Matan Azrad <[email protected]>--- drivers/net/mlx5/mlx5_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mlx5/mlx5_flow.c +0
-0
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh