MCPcopy Index your code
hub / github.com/F-Stack/f-stack / rte_flow_conv_rule

Function rte_flow_conv_rule

dpdk/lib/ethdev/rte_flow.c:992–1040  ·  view source on GitHub ↗

* Copy flow rule components. * * This comprises the flow rule descriptor itself, attributes, pattern and * actions list. NULL components in @p src are skipped. * * @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 flow rule descriptor. * @param[out] error * Perform verbose error reporting if

Source from the content-addressed store, hash-verified

990 * negative errno value otherwise and rte_errno is set.
991 */
992static int
993rte_flow_conv_rule(struct rte_flow_conv_rule *dst,
994 const size_t size,
995 const struct rte_flow_conv_rule *src,
996 struct rte_flow_error *error)
997{
998 size_t off;
999 int ret;
1000
1001 rte_memcpy(dst,
1002 (&(struct rte_flow_conv_rule){
1003 .attr = NULL,
1004 .pattern = NULL,
1005 .actions = NULL,
1006 }),
1007 size > sizeof(*dst) ? sizeof(*dst) : size);
1008 off = sizeof(*dst);
1009 if (src->attr_ro) {
1010 off = RTE_ALIGN_CEIL(off, sizeof(double));
1011 if (size && size >= off + sizeof(*dst->attr))
1012 dst->attr = rte_memcpy
1013 ((void *)((uintptr_t)dst + off),
1014 src->attr_ro, sizeof(*dst->attr));
1015 off += sizeof(*dst->attr);
1016 }
1017 if (src->pattern_ro) {
1018 off = RTE_ALIGN_CEIL(off, sizeof(double));
1019 ret = rte_flow_conv_pattern((void *)((uintptr_t)dst + off),
1020 size > off ? size - off : 0,
1021 src->pattern_ro, 0, error);
1022 if (ret < 0)
1023 return ret;
1024 if (size && size >= off + (size_t)ret)
1025 dst->pattern = (void *)((uintptr_t)dst + off);
1026 off += ret;
1027 }
1028 if (src->actions_ro) {
1029 off = RTE_ALIGN_CEIL(off, sizeof(double));
1030 ret = rte_flow_conv_actions((void *)((uintptr_t)dst + off),
1031 size > off ? size - off : 0,
1032 src->actions_ro, 0, error);
1033 if (ret < 0)
1034 return ret;
1035 if (size >= off + (size_t)ret)
1036 dst->actions = (void *)((uintptr_t)dst + off);
1037 off += ret;
1038 }
1039 return off;
1040}
1041
1042/**
1043 * Retrieve the name of a pattern item/action type.

Callers 1

rte_flow_convFunction · 0.70

Calls 3

rte_flow_conv_patternFunction · 0.85
rte_flow_conv_actionsFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected