MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_flow_conv_actions

Function rte_flow_conv_actions

dpdk/lib/ethdev/rte_flow.c:914–969  ·  view source on GitHub ↗

* Copy a list of actions. * * @param[out] dst * Destination buffer. Can be NULL if @p size is zero. * @param size * Size of @p dst in bytes. * @param[in] src * Source actions. * @param num * Maximum number of actions to process from @p src or 0 to process the * entire list. In both cases, processing stops after * RTE_FLOW_ACTION_TYPE_END is encountered. * @param[out] error

Source from the content-addressed store, hash-verified

912 * rte_errno is set.
913 */
914static int
915rte_flow_conv_actions(struct rte_flow_action *dst,
916 const size_t size,
917 const struct rte_flow_action *src,
918 unsigned int num,
919 struct rte_flow_error *error)
920{
921 uintptr_t data = (uintptr_t)dst;
922 size_t off;
923 size_t ret;
924 unsigned int i;
925
926 for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) {
927 /**
928 * allow PMD private flow action
929 */
930 if (((int)src->type >= 0) &&
931 ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) ||
932 !rte_flow_desc_action[src->type].name))
933 return rte_flow_error_set
934 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
935 src, "cannot convert unknown action type");
936 if (size >= off + sizeof(*dst))
937 *dst = (struct rte_flow_action){
938 .type = src->type,
939 };
940 off += sizeof(*dst);
941 if (!src->type)
942 num = i + 1;
943 }
944 num = i;
945 src -= num;
946 dst -= num;
947 do {
948 if (src->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
949 /*
950 * Indirect action conf fills the indirect action
951 * handler. Copy the action handle directly instead
952 * of duplicating the pointer memory.
953 */
954 if (size)
955 dst->conf = src->conf;
956 } else if (src->conf) {
957 off = RTE_ALIGN_CEIL(off, sizeof(double));
958 ret = rte_flow_conv_action_conf
959 ((void *)(data + off),
960 size > off ? size - off : 0, src);
961 if (size && size >= off + ret)
962 dst->conf = (void *)(data + off);
963 off += ret;
964 }
965 ++src;
966 ++dst;
967 } while (--num);
968 return off;
969}
970
971/**

Callers 2

rte_flow_conv_ruleFunction · 0.85
rte_flow_convFunction · 0.85

Calls 2

rte_flow_error_setFunction · 0.85

Tested by

no test coverage detected