src/dpdk/lib/librte_ethdev/rte_flow.c
int
rte_flow_conv(enum rte_flow_conv_op op,
	      void *dst,
	      size_t size,
	      const void *src,
	      struct rte_flow_error *error)
{
	switch (op) {
		const struct rte_flow_attr *attr;

	case RTE_FLOW_CONV_OP_NONE:
		return 0;
	case RTE_FLOW_CONV_OP_ATTR:
		attr = src;
		if (size > sizeof(*attr))
			size = sizeof(*attr);
		rte_memcpy(dst, attr, size);
		return sizeof(*attr);
	case RTE_FLOW_CONV_OP_ITEM:
		return rte_flow_conv_pattern(dst, size, src, 1, error);
	case RTE_FLOW_CONV_OP_ACTION:
		return rte_flow_conv_actions(dst, size, src, 1, error);
	case RTE_FLOW_CONV_OP_PATTERN:
		return rte_flow_conv_pattern(dst, size, src, 0, error);
	case RTE_FLOW_CONV_OP_ACTIONS:
		return rte_flow_conv_actions(dst, size, src, 0, error);
	case RTE_FLOW_CONV_OP_RULE:
		return rte_flow_conv_rule(dst, size, src, error);
	case RTE_FLOW_CONV_OP_ITEM_NAME:
		return rte_flow_conv_name(0, 0, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ACTION_NAME:
		return rte_flow_conv_name(1, 0, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ITEM_NAME_PTR:
		return rte_flow_conv_name(0, 1, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ACTION_NAME_PTR:
		return rte_flow_conv_name(1, 1, dst, size, src, error);
	}
	return rte_flow_error_set
		(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
		 "unknown object conversion operation");
}
/** Helper function to convert flow API objects. */
Helper function to convert flow API objects.
Helper function to convert flow API objects .
int
rte_flow_conv(enum rte_flow_conv_op op,
	      void *dst,
	      size_t size,
	      const void *src,
	      struct rte_flow_error *error)
{
	switch (op) {
		const struct rte_flow_attr *attr;
	case RTE_FLOW_CONV_OP_NONE:
		return 0;
	case RTE_FLOW_CONV_OP_ATTR:
		attr = src;
		if (size > sizeof(*attr))
			size = sizeof(*attr);
		rte_memcpy(dst, attr, size);
		return sizeof(*attr);
	case RTE_FLOW_CONV_OP_ITEM:
		return rte_flow_conv_pattern(dst, size, src, 1, error);
	case RTE_FLOW_CONV_OP_ACTION:
		return rte_flow_conv_actions(dst, size, src, 1, error);
	case RTE_FLOW_CONV_OP_PATTERN:
		return rte_flow_conv_pattern(dst, size, src, 0, error);
	case RTE_FLOW_CONV_OP_ACTIONS:
		return rte_flow_conv_actions(dst, size, src, 0, error);
	case RTE_FLOW_CONV_OP_RULE:
		return rte_flow_conv_rule(dst, size, src, error);
	case RTE_FLOW_CONV_OP_ITEM_NAME:
		return rte_flow_conv_name(0, 0, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ACTION_NAME:
		return rte_flow_conv_name(1, 0, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ITEM_NAME_PTR:
		return rte_flow_conv_name(0, 1, dst, size, src, error);
	case RTE_FLOW_CONV_OP_ACTION_NAME_PTR:
		return rte_flow_conv_name(1, 1, dst, size, src, error);
	}
	return rte_flow_error_set
		(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
		 "unknown object conversion operation");
}
int rte_flow_conv ( enum rte_flow_conv_op op , void * dst , size_t size , const void * src , struct rte_flow_error * error ) { switch ( op ) { const struct rte_flow_attr * attr ; case RTE_FLOW_CONV_OP_NONE : return 0 ; case RTE_FLOW_CONV_OP_ATTR : attr = src ; if ( size > sizeof ( * attr ) ) size = sizeof ( * attr ) ; rte_memcpy ( dst , attr , size ) ; return sizeof ( * attr ) ; case RTE_FLOW_CONV_OP_ITEM : return rte_flow_conv_pattern ( dst , size , src , 1 , error ) ; case RTE_FLOW_CONV_OP_ACTION : return rte_flow_conv_actions ( dst , size , src , 1 , error ) ; case RTE_FLOW_CONV_OP_PATTERN : return rte_flow_conv_pattern ( dst , size , src , 0 , error ) ; case RTE_FLOW_CONV_OP_ACTIONS : return rte_flow_conv_actions ( dst , size , src , 0 , error ) ; case RTE_FLOW_CONV_OP_RULE : return rte_flow_conv_rule ( dst , size , src , error ) ; case RTE_FLOW_CONV_OP_ITEM_NAME : return rte_flow_conv_name ( 0 , 0 , dst , size , src , error ) ; case RTE_FLOW_CONV_OP_ACTION_NAME : return rte_flow_conv_name ( 1 , 0 , dst , size , src , error ) ; case RTE_FLOW_CONV_OP_ITEM_NAME_PTR : return rte_flow_conv_name ( 0 , 1 , dst , size , src , error ) ; case RTE_FLOW_CONV_OP_ACTION_NAME_PTR : return rte_flow_conv_name ( 1 , 1 , dst , size , src , error ) ; } return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_UNSPECIFIED , NULL , " " ) ; }
Helper function to convert flow API objects.
Helper function to convert flow API objects .