From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8942AC31E5B for ; Tue, 18 Jun 2019 01:50:37 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 1BA0120657 for ; Tue, 18 Jun 2019 01:50:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BA0120657 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 333381BF8D; Tue, 18 Jun 2019 03:50:36 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 427D71BF89 for ; Tue, 18 Jun 2019 03:50:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jun 2019 18:50:33 -0700 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 17 Jun 2019 18:50:32 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 17 Jun 2019 18:50:32 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 17 Jun 2019 18:50:32 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.87]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.225]) with mapi id 14.03.0439.000; Tue, 18 Jun 2019 09:50:30 +0800 From: "Xing, Beilei" To: "Zhao1, Wei" , "Yang, Qiming" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] net/ice: enable switch filter Thread-Index: AQHVIPPfYoAShQcBukqY4GuVsGD8OaafONxQ///S74CAAaEtQA== Date: Tue, 18 Jun 2019 01:50:29 +0000 Message-ID: <94479800C636CB44BD422CB454846E013CDE62C6@SHSMSX101.ccr.corp.intel.com> References: <1559552722-8970-1-git-send-email-qiming.yang@intel.com> <20190612075029.109914-1-qiming.yang@intel.com> <20190612075029.109914-2-qiming.yang@intel.com> <94479800C636CB44BD422CB454846E013CDE5B2E@SHSMSX101.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/ice: enable switch filter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Wei, > -----Original Message----- > From: Zhao1, Wei > Sent: Monday, June 17, 2019 4:52 PM > To: Xing, Beilei ; Yang, Qiming > ; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/ice: enable switch filter >=20 > Hi , Beilei >=20 >=20 > > -----Original Message----- > > From: Xing, Beilei > > Sent: Monday, June 17, 2019 1:27 PM > > To: Yang, Qiming ; dev@dpdk.org > > Cc: Zhao1, Wei > > Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/ice: enable switch filter > > > > > > > > ... > > > > > + > > > +/* By now ice switch filter action code implement only > > > +* supports QUEUE or DROP. > > > +*/ > > > +static int > > > +ice_parse_switch_action(struct ice_pf *pf, > > > + const struct rte_flow_action *actions, > > > + struct rte_flow_error *error, > > > + struct ice_adv_rule_info *rule_info) { > > > + struct ice_hw *hw =3D ICE_PF_TO_HW(pf); > > > + struct ice_vsi *vsi =3D pf->main_vsi; > > > + const struct rte_flow_action *act; > > > + const struct rte_flow_action_queue *act_q; > > > + uint16_t base_queue, index =3D 0; > > > + uint32_t reg; > > > + > > > + /* Check if the first non-void action is QUEUE or DROP. */ > > > + NEXT_ITEM_OF_ACTION(act, actions, index); > > > + if (act->type !=3D RTE_FLOW_ACTION_TYPE_QUEUE && > > > + act->type !=3D RTE_FLOW_ACTION_TYPE_DROP) { > > > + rte_flow_error_set(error, EINVAL, > > > RTE_FLOW_ERROR_TYPE_ACTION, > > > + act, "Not supported action."); > > > + return -rte_errno; > > > + } > > > + reg =3D ICE_READ_REG(hw, PFLAN_RX_QALLOC); > > > + if (reg & PFLAN_RX_QALLOC_VALID_M) { > > > + base_queue =3D reg & PFLAN_RX_QALLOC_FIRSTQ_M; > > > + } else { > > > + rte_flow_error_set(error, EINVAL, > > > + RTE_FLOW_ERROR_TYPE_ACTION, > > > + act, "Invalid queue register"); > > > + return -rte_errno; > > > + } > > > + if (act->type =3D=3D RTE_FLOW_ACTION_TYPE_QUEUE) { > > > + act_q =3D act->conf; > > > + rule_info->sw_act.fltr_act =3D ICE_FWD_TO_Q; > > > + rule_info->sw_act.fwd_id.q_id =3D base_queue + act_q->index; > > > + if (act_q->index >=3D pf->dev_data->nb_rx_queues) { > > > + rte_flow_error_set(error, EINVAL, > > > + RTE_FLOW_ERROR_TYPE_ACTION, > > > + act, "Invalid queue ID for" > > > + " switch filter."); > > > + return -rte_errno; > > > + } > > > + } else { > > > + rule_info->sw_act.fltr_act =3D ICE_DROP_PACKET; > > > + } > > > + > > > + rule_info->sw_act.vsi_handle =3D vsi->idx; > > > + rule_info->rx =3D 1; > > > + rule_info->sw_act.src =3D vsi->idx; > > > + > > > + /* Check if the next non-void item is END */ > > > + index++; > > > + NEXT_ITEM_OF_ACTION(act, actions, index); > > > + if (act->type !=3D RTE_FLOW_ACTION_TYPE_END) { > > > + rte_flow_error_set(error, EINVAL, > > > RTE_FLOW_ERROR_TYPE_ACTION, > > > + act, "Not supported action."); > > > + return -rte_errno; > > > + } > > > + > > > + return 0; > > > +} > > > > > > How about use supported array to replace NEXT_ITEM_OF_ACTION? Just > > like pattern. >=20 > This seems no need to change, i40e also implement in this way. Code in I40e is not perfect, we can try to improve our PMD in new driver.=20 I think supported array is more clear and friendly, what do you think?