src/dpdk/drivers/net/hns3/hns3_flow.c
static int
hns3_parse_rss_filter(struct rte_eth_dev *dev,
		      const struct rte_flow_action *actions,
		      struct rte_flow_error *error)
{
	struct hns3_adapter *hns = dev->data->dev_private;
	struct hns3_hw *hw = &hns->hw;
	struct hns3_rss_conf *rss_conf = &hw->rss_info;
	const struct rte_flow_action_rss *rss;
	const struct rte_flow_action *act;
	uint32_t act_index = 0;
	uint16_t n;

	NEXT_ITEM_OF_ACTION(act, actions, act_index);
	rss = act->conf;

	if (rss == NULL) {
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  act, "no valid queues");
	}

	if (rss->queue_num > RTE_DIM(rss_conf->queue))
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "queue number configured exceeds "
					  "queue buffer size driver supported");

	for (n = 0; n < rss->queue_num; n++) {
		if (rss->queue[n] < hw->alloc_rss_size)
			continue;
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "queue id must be less than queue number allocated to a TC");
	}

	if (!(rss->types & HNS3_ETH_RSS_SUPPORT) && rss->types)
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  act,
					  "Flow types is unsupported by "
					  "hns3's RSS");
	if (rss->func >= RTE_ETH_HASH_FUNCTION_MAX)
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "RSS hash func are not supported");
	if (rss->level)
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "a nonzero RSS encapsulation level is not supported");
	if (rss->key_len && rss->key_len != RTE_DIM(rss_conf->key))
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "RSS hash key must be exactly 40 bytes");

	if (!hns3_rss_input_tuple_supported(hw, rss))
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  &rss->types,
					  "input RSS types are not supported");

	act_index++;

	/* Check if the next not void action is END */
	NEXT_ITEM_OF_ACTION(act, actions, act_index);
	if (act->type != RTE_FLOW_ACTION_TYPE_END) {
		memset(rss_conf, 0, sizeof(struct hns3_rss_conf));
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION,
					  act, "Not supported action.");
	}

	return 0;
}
/*
 * This function is used to parse rss action validatation.
 */
This function is used to parse rss action validatation.
This function is used to parse rss action validatation .
static int
hns3_parse_rss_filter(struct rte_eth_dev *dev,
		      const struct rte_flow_action *actions,
		      struct rte_flow_error *error)
{
	struct hns3_adapter *hns = dev->data->dev_private;
	struct hns3_hw *hw = &hns->hw;
	struct hns3_rss_conf *rss_conf = &hw->rss_info;
	const struct rte_flow_action_rss *rss;
	const struct rte_flow_action *act;
	uint32_t act_index = 0;
	uint16_t n;
	NEXT_ITEM_OF_ACTION(act, actions, act_index);
	rss = act->conf;
	if (rss == NULL) {
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  act, "no valid queues");
	}
	if (rss->queue_num > RTE_DIM(rss_conf->queue))
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "queue number configured exceeds "
					  "queue buffer size driver supported");
	for (n = 0; n < rss->queue_num; n++) {
		if (rss->queue[n] < hw->alloc_rss_size)
			continue;
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "queue id must be less than queue number allocated to a TC");
	}
	if (!(rss->types & HNS3_ETH_RSS_SUPPORT) && rss->types)
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  act,
					  "Flow types is unsupported by "
					  "hns3's RSS");
	if (rss->func >= RTE_ETH_HASH_FUNCTION_MAX)
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "RSS hash func are not supported");
	if (rss->level)
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "a nonzero RSS encapsulation level is not supported");
	if (rss->key_len && rss->key_len != RTE_DIM(rss_conf->key))
		return rte_flow_error_set(error, ENOTSUP,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, act,
					  "RSS hash key must be exactly 40 bytes");
	if (!hns3_rss_input_tuple_supported(hw, rss))
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
					  &rss->types,
					  "input RSS types are not supported");
	act_index++;
	NEXT_ITEM_OF_ACTION(act, actions, act_index);
	if (act->type != RTE_FLOW_ACTION_TYPE_END) {
		memset(rss_conf, 0, sizeof(struct hns3_rss_conf));
		return rte_flow_error_set(error, EINVAL,
					  RTE_FLOW_ERROR_TYPE_ACTION,
					  act, "Not supported action.");
	}
	return 0;
}
static int hns3_parse_rss_filter ( struct rte_eth_dev * dev , const struct rte_flow_action * actions , struct rte_flow_error * error ) { struct hns3_adapter * hns = dev -> data -> dev_private ; struct hns3_hw * hw = & hns -> hw ; struct hns3_rss_conf * rss_conf = & hw -> rss_info ; const struct rte_flow_action_rss * rss ; const struct rte_flow_action * act ; uint32_t act_index = 0 ; uint16_t n ; NEXT_ITEM_OF_ACTION ( act , actions , act_index ) ; rss = act -> conf ; if ( rss == NULL ) { return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " ) ; } if ( rss -> queue_num > RTE_DIM ( rss_conf -> queue ) ) return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " " " ) ; for ( n = 0 ; n < rss -> queue_num ; n ++ ) { if ( rss -> queue [ n ] < hw -> alloc_rss_size ) continue ; return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " ) ; } if ( ! ( rss -> types & HNS3_ETH_RSS_SUPPORT ) && rss -> types ) return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " " " ) ; if ( rss -> func >= RTE_ETH_HASH_FUNCTION_MAX ) return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " ) ; if ( rss -> level ) return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " ) ; if ( rss -> key_len && rss -> key_len != RTE_DIM ( rss_conf -> key ) ) return rte_flow_error_set ( error , ENOTSUP , RTE_FLOW_ERROR_TYPE_ACTION_CONF , act , " " ) ; if ( ! hns3_rss_input_tuple_supported ( hw , rss ) ) return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ACTION_CONF , & rss -> types , " " ) ; act_index ++ ; NEXT_ITEM_OF_ACTION ( act , actions , act_index ) ; if ( act -> type != RTE_FLOW_ACTION_TYPE_END ) { memset ( rss_conf , 0 , sizeof ( struct hns3_rss_conf ) ) ; return rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ACTION , act , " " ) ; } return 0 ; }
This function is used to parse rss action validatation.
This function is used to parse rss action validatation .
/* Check if the next not void action is END */