From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D3801A055D; Fri, 19 Feb 2021 13:56:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A72816090E; Fri, 19 Feb 2021 13:56:58 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 6D5A316090B for ; Fri, 19 Feb 2021 13:56:57 +0100 (CET) IronPort-SDR: 3CDkWHS6sZs8sMIGyaGksi9rX62frEASAMHzr41ug1VkQUqFnRP3juMERz0K39yckuzimJ25yu Fm4knIY1Amow== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="183892142" X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="183892142" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 04:56:55 -0800 IronPort-SDR: eMuIz95i/2yyUSCMdHW0Qkxl8cigUjOfaOu2FbgqBTusPpfYNIGdarcn6qqRypjjhQyvsatKpL 6rwQCtJM8nag== X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="386900752" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.251.55]) ([10.213.251.55]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 04:56:53 -0800 To: Steve Yang , dev@dpdk.org Cc: jia.guo@intel.com, haiyue.wang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com, orika@nvidia.com, murphyx.yang@intel.com References: <20201014084131.72035-1-simonx.lu@intel.com> <20201103082809.41149-1-stevex.yang@intel.com> <20201103082809.41149-3-stevex.yang@intel.com> From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Fri, 19 Feb 2021 12:56:52 +0000 MIME-Version: 1.0 In-Reply-To: <20201103082809.41149-3-stevex.yang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [RFC v2 2/6] net/i40e: define the mirror filter parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/3/2020 8:28 AM, Steve Yang wrote: > Define the sample filter parser for mirror, it will divide to two phases, > the one is sample attributions pattern parsing, and the mirror config > will be filled in according to pattern type VF/PF/VLAN when sample ratio > is 1. > The another is sample action parsing that the port id of mirror config > will be filled in according to action type VF/PF. > > Signed-off-by: Steve Yang <...> > +#define GET_VLAN_ID_FROM_TCI(vlan_item, default_vid) \ > + ((vlan_item) ? ntohs(vlan_item->tci) & 0x0fff : (default_vid)) > + 'ntohs' usage is breaking the windows build (i40e is now build for windows) because of missing header, can you please prefer: I40E_NTOHS() <...> > + if (attr->group) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ATTR_GROUP, > + attr, "Not support group."); > + return -rte_errno; > + } > + if (attr->transfer) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, > + attr, "Not support group."); copy/paste error in the error msg. <...> > +static int > +i40e_flow_parse_sample_action(struct rte_eth_dev *dev, > + const struct rte_flow_action *actions, > + struct rte_flow_error *error, > + union i40e_filter_t *filter) > +{ > + struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > + const struct rte_flow_action *act; > + struct i40e_mirror_rule_conf *mirror_config = &filter->mirror_conf; > + uint16_t *dst_vsi_seid = &mirror_config->dst_vsi_seid; > + uint32_t index = 0; > + > + NEXT_ITEM_OF_ACTION(act, actions, index); > + if (act->type != RTE_FLOW_ACTION_TYPE_SAMPLE) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, act, > + "Not supported action."); > + return -rte_errno; > + } > + Is above check required, isn't this function called only if the action type is 'sample' > + if (((const struct rte_flow_action_sample *)act->conf)->ratio != 1) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, > + "Invalid ratio for mirror action"); So, only "ratio == 1" is supported, better to highlight this in the error message. > + return -rte_errno; > + } > + > + index++; > + NEXT_ITEM_OF_ACTION(act, actions, index); > + > + if (act->type == RTE_FLOW_ACTION_TYPE_PORT_ID) { > + const struct rte_flow_action_port_id *conf = > + (const struct rte_flow_action_port_id *)act->conf; > + > + if (!conf->id) { > + *dst_vsi_seid = pf->main_vsi_seid; > + } else if (conf->id <= pf->vf_num) { > + *dst_vsi_seid = pf->vfs[conf->id - 1].vsi->seid; > + } else { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, > + "Invalid port id mirror 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, > + "Only support pf or vf parameter item."); So, only 'PORT_ID' is supported. Can you please add comment on both "i40e_flow_parse_sample_attr_pattern" & "i40e_flow_parse_sample_action" to document these restrictions, or expectation? It both helps to understand what to expect without diving deep into the code and documents intention which can help finding any possible coding error.