From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beilei Xing Subject: [PATCH v2] net/i40e: update actions for FDIR Date: Thu, 1 Jun 2017 07:47:30 +0800 Message-ID: <1496274450-1887-1-git-send-email-beilei.xing@intel.com> References: <1495853160-36691-1-git-send-email-beilei.xing@intel.com> Cc: dev@dpdk.org To: jingjing.wu@intel.com Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id BE48E2BD8 for ; Wed, 31 May 2017 12:51:52 +0200 (CEST) In-Reply-To: <1495853160-36691-1-git-send-email-beilei.xing@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit adds support of FLAG action and PASSTHRU action for flow director. Signed-off-by: Beilei Xing --- v2 changes: -Add support of PASSTHRU action. -Refine code. drivers/net/i40e/i40e_flow.c | 74 ++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 218ece1..9fcf8bd 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2797,55 +2797,61 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev, const struct rte_flow_action_mark *mark_spec; uint32_t index = 0; - /* Check if the first non-void action is QUEUE or DROP. */ + /* Check if the first non-void action is QUEUE or DROP or PASSTHRU. */ NEXT_ITEM_OF_ACTION(act, actions, index); - if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE && - act->type != RTE_FLOW_ACTION_TYPE_DROP) { - rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, - act, "Invalid action."); - return -rte_errno; - } - - act_q = (const struct rte_flow_action_queue *)act->conf; - filter->action.flex_off = 0; - if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) + switch (act->type) { + case RTE_FLOW_ACTION_TYPE_QUEUE: + act_q = (const struct rte_flow_action_queue *)act->conf; + filter->action.rx_queue = act_q->index; + if (filter->action.rx_queue >= pf->dev_data->nb_rx_queues) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "Invalid queue ID for FDIR."); + return -rte_errno; + } filter->action.behavior = RTE_ETH_FDIR_ACCEPT; - else + break; + case RTE_FLOW_ACTION_TYPE_DROP: filter->action.behavior = RTE_ETH_FDIR_REJECT; - - filter->action.report_status = RTE_ETH_FDIR_REPORT_ID; - filter->action.rx_queue = act_q->index; - - if (filter->action.rx_queue >= pf->dev_data->nb_rx_queues) { + break; + case RTE_FLOW_ACTION_TYPE_PASSTHRU: + filter->action.behavior = RTE_ETH_FDIR_PASSTHRU; + break; + default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, - "Invalid queue ID for FDIR."); + "Invalid action."); return -rte_errno; } - /* Check if the next non-void item is MARK or END. */ + /* Check if the next non-void item is MARK or FLAG or END. */ index++; NEXT_ITEM_OF_ACTION(act, actions, index); - if (act->type != RTE_FLOW_ACTION_TYPE_MARK && - act->type != RTE_FLOW_ACTION_TYPE_END) { + switch (act->type) { + case RTE_FLOW_ACTION_TYPE_MARK: + mark_spec = (const struct rte_flow_action_mark *)act->conf; + filter->action.report_status = RTE_ETH_FDIR_REPORT_ID; + filter->soft_id = mark_spec->id; + break; + case RTE_FLOW_ACTION_TYPE_FLAG: + filter->action.report_status = RTE_ETH_FDIR_NO_REPORT_STATUS; + break; + case RTE_FLOW_ACTION_TYPE_END: + return 0; + default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, "Invalid action."); return -rte_errno; } - if (act->type == RTE_FLOW_ACTION_TYPE_MARK) { - mark_spec = (const struct rte_flow_action_mark *)act->conf; - filter->soft_id = mark_spec->id; - - /* Check if the next non-void item is END */ - index++; - NEXT_ITEM_OF_ACTION(act, actions, index); - if (act->type != RTE_FLOW_ACTION_TYPE_END) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, "Invalid action."); - return -rte_errno; - } + /* Check if the next non-void item is END */ + index++; + NEXT_ITEM_OF_ACTION(act, actions, index); + if (act->type != RTE_FLOW_ACTION_TYPE_END) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + act, "Invalid action."); + return -rte_errno; } return 0; -- 2.5.5