src/dpdk/lib/librte_ethdev/rte_flow.c
static int
rte_flow_conv_actions(struct rte_flow_action *dst,
		      const size_t size,
		      const struct rte_flow_action *src,
		      unsigned int num,
		      struct rte_flow_error *error)
{
	uintptr_t data = (uintptr_t)dst;
	size_t off;
	size_t ret;
	unsigned int i;

	for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) {
		/**
		 * allow PMD private flow action
		 */
		if (((int)src->type >= 0) &&
		    ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) ||
		    !rte_flow_desc_action[src->type].name))
			return rte_flow_error_set
				(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
				 src, "cannot convert unknown action type");
		if (size >= off + sizeof(*dst))
			*dst = (struct rte_flow_action){
				.type = src->type,
			};
		off += sizeof(*dst);
		if (!src->type)
			num = i + 1;
	}
	num = i;
	src -= num;
	dst -= num;
	do {
		if (src->conf) {
			off = RTE_ALIGN_CEIL(off, sizeof(double));
			ret = rte_flow_conv_action_conf
				((void *)(data + off),
				 size > off ? size - off : 0, src);
			if (size && size >= off + ret)
				dst->conf = (void *)(data + off);
			off += ret;
		}
		++src;
		++dst;
	} while (--num);
	return off;
}
/**
 * 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
 *   Perform verbose error reporting if not NULL.
 *
 * @return
 *   A positive value representing the number of bytes needed to store
 *   actions regardless of @p size on success (@p buf contents are truncated
 *   to @p size if not large enough), a negative errno value otherwise and
 *   rte_errno is set.
 */
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
Perform verbose error reporting if not NULL.

@return
A positive value representing the number of bytes needed to store
actions regardless of @p size on success (@p buf contents are truncated
to @p size if not large enough), a negative errno value otherwise and
rte_errno is set.
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 Perform verbose error reporting if not NULL . @return A positive value representing the number of bytes needed to store actions regardless of @p size on success ( @p buf contents are truncated to @p size if not large enough ) a negative errno value otherwise and rte_errno is set .
static int
rte_flow_conv_actions(struct rte_flow_action *dst,
		      const size_t size,
		      const struct rte_flow_action *src,
		      unsigned int num,
		      struct rte_flow_error *error)
{
	uintptr_t data = (uintptr_t)dst;
	size_t off;
	size_t ret;
	unsigned int i;
	for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) {
		if (((int)src->type >= 0) &&
		    ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) ||
		    !rte_flow_desc_action[src->type].name))
			return rte_flow_error_set
				(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
				 src, "cannot convert unknown action type");
		if (size >= off + sizeof(*dst))
			*dst = (struct rte_flow_action){
				.type = src->type,
			};
		off += sizeof(*dst);
		if (!src->type)
			num = i + 1;
	}
	num = i;
	src -= num;
	dst -= num;
	do {
		if (src->conf) {
			off = RTE_ALIGN_CEIL(off, sizeof(double));
			ret = rte_flow_conv_action_conf
				((void *)(data + off),
				 size > off ? size - off : 0, src);
			if (size && size >= off + ret)
				dst->conf = (void *)(data + off);
			off += ret;
		}
		++src;
		++dst;
	} while (--num);
	return off;
}
static int rte_flow_conv_actions ( struct rte_flow_action * dst , const size_t size , const struct rte_flow_action * src , unsigned int num , struct rte_flow_error * error ) { uintptr_t data = ( uintptr_t ) dst ; size_t off ; size_t ret ; unsigned int i ; for ( i = 0 , off = 0 ; ! num || i != num ; ++ i , ++ src , ++ dst ) { if ( ( ( int ) src -> type >= 0 ) && ( ( size_t ) src -> type >= RTE_DIM ( rte_flow_desc_action ) || ! rte_flow_desc_action [ src -> type ] . name ) ) return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ACTION , src , " " ) ; if ( size >= off + sizeof ( * dst ) ) * dst = ( struct rte_flow_action ) { . type = src -> type , } ; off += sizeof ( * dst ) ; if ( ! src -> type ) num = i + 1 ; } num = i ; src -= num ; dst -= num ; do { if ( src -> conf ) { off = RTE_ALIGN_CEIL ( off , sizeof ( double ) ) ; ret = rte_flow_conv_action_conf ( ( void * ) ( data + off ) , size > off ? size - off : 0 , src ) ; if ( size && size >= off + ret ) dst -> conf = ( void * ) ( data + off ) ; off += ret ; } ++ src ; ++ dst ; } while ( -- num ) ; return off ; }
Copy a list of actions.
Copy a list of actions .
/**
		 * allow PMD private flow action
		 */