From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3448F1B5F4 for ; Fri, 3 Nov 2017 09:38:11 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2017 01:38:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,337,1505804400"; d="scan'208";a="331599847" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 03 Nov 2017 01:38:10 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Nov 2017 01:38:11 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Nov 2017 01:38:10 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Fri, 3 Nov 2017 16:38:08 +0800 From: "Peng, Yuan" To: "Zhao1, Wei" , "dev@dpdk.org" CC: "Zhao1, Wei" Thread-Topic: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel Thread-Index: AQHTVHhxFTy8wjSWRkWUeXnG0djx/KMCVMnA Date: Fri, 3 Nov 2017 08:38:08 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEA3745422D@SHSMSX103.ccr.corp.intel.com> References: <1509691215-40203-1-git-send-email-wei.zhao1@intel.com> <1509694718-62620-1-git-send-email-wei.zhao1@intel.com> In-Reply-To: <1509694718-62620-1-git-send-email-wei.zhao1@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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 v4] net/ixgbe: fix filter parser error in L2 tunnel 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: , X-List-Received-Date: Fri, 03 Nov 2017 08:38:12 -0000 Tested-by: Peng Yuan - Tested Branch: dpdk-master - Tested Commit: commit 6fb00f8baefa03b9cfd1b2dfc1787258b8459601 - OS: 4.8.6-300.fc25.x86_64 - GCC: gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) - CPU: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz - NIC: X552/X557-AT 10GBASE-T [8086:15ad] - Default x86_64-native-linuxapp-gcc configuration - Prerequisites: - Total 1 cases, 1 passed, 0 failed Hardware: dut: 10.240.176.192 tester: 10.240.176.191 X552/X557-AT 10g*2 Test steps: Bind pf to igb_uio: ./usertools/dpdk-devbind.py -b igb_uio 03:00.0 add two vfs on dpdk pf, then bind the vfs to vfio-pci: echo 2 >/sys/bus/pci/devices/0000:03:00.0/max_vfs ./usertools/dpdk-devbind.py -b vfio-pci 03:10.0 03:10.2 Start testpmd: ./x86_64-native-linuxapp-gcc/app/testpmd -c 1f -n 4 -m 1024 -w 03:00.0 --fi= le-prefix=3Dpf - -i --rxq=3D4 --txq=3D4=20 testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start testpmd> port config 0 l2-tunnel E-tag enable testpmd> E-tag set forwarding on port 0 ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4 -w 03:10.0 --file-pre= fix=3Dvf0 -m 1024 - -i --rxq=3D4 --txq=3D4 --disable-rss=20 testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf00 -n 4 -w 03:10.2 --file-pr= efix=3Dvf1 -m 1024 - -i --rxq=3D4 --txq=3D4 --disable-rss =20 testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start 1. create filter rules, testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1309 / end act= ions vf id 0 / end =20 Flow rule #0 created =20 testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1308 / end act= ions vf id 1 / end =20 Flow rule #1 created testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1307 / end act= ions pf / end Flow rule #2 created 2. send packets: pkt1 =3D Ether(dst=3D"00:11:22:33:44:55")/Dot1BR(GRP=3D0x1, ECIDbase=3D0x30= 9)/Raw('x' * 20) pkt2 =3D Ether(dst=3D"00:11:22:33:44:55")/Dot1BR(GRP=3D0x1, ECIDbase=3D0x30= 8)/Raw('x' * 20) pkt3 =3D Ether(dst=3D"00:11:22:33:44:55")/Dot1BR(GRP=3D0x1, ECIDbase=3D0x30= 7)/Raw('x' * 20) pkt4 =3D Ether(dst=3D"00:11:22:33:44:55")/Dot1BR(GRP=3D0x2, ECIDbase=3D0x30= 9)/Raw('x' * 20) verify pkt1 to vf0 queue0, pkt2 to vf1 queue0, pkt3 to pf queue 0, pkt4 can= 't received by pf and vfs. -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao Sent: Friday, November 3, 2017 3:39 PM To: dev@dpdk.org Cc: Zhao1, Wei Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tun= nel The action for L2 tunnel should be VF or PF, not QUEUE. Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter") Signed-off-by: Wei Zhao Acked-by: Wei Dai --- v2: -add vf id check. v3: -add action support for PF. v4: -fix action type check error --- drivers/net/ixgbe/ixgbe_flow.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.= c index 82fc705..8bbc8b9 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -1095,7 +1095,7 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev, * The first not void item can be E_TAG. * The next not void item must be END. * action: - * The first not void action should be QUEUE. + * The first not void action should be VF or PF. * The next not void action should be END. * pattern example: * ITEM Spec Mask @@ -1106,7 +1106,8 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev, * item->last should be NULL. */ static int -cons_parse_l2_tn_filter(const struct rte_flow_attr *attr, +cons_parse_l2_tn_filter(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_eth_l2_tunnel_conf *filter, @@ -1116,7 +1117,8 @@ cons_parse= _l2_tn_filter(const struct rte_flow_attr *attr, const struct rte_flow_item_e_tag *e_tag_spec; const struct rte_flow_item_e_tag *e_tag_mask; const struct rte_flow_action *act; - const struct rte_flow_action_queue *act_q; + const struct rte_flow_action_vf *act_vf; + struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); =20 if (!pattern) { rte_flow_error_set(error, EINVAL, @@ -1224,9 +1226,10 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *= attr, return -rte_errno; } =20 - /* check if the first not void action is QUEUE. */ + /* check if the first not void action is VF or PF. */ act =3D next_no_void_action(actions, NULL); - if (act->type !=3D RTE_FLOW_ACTION_TYPE_QUEUE) { + if (act->type !=3D RTE_FLOW_ACTION_TYPE_VF && + act->type !=3D RTE_FLOW_ACTION_TYPE_PF) { memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1234,8 +1237,12 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *= attr, return -rte_errno; } =20 - act_q =3D (const struct rte_flow_action_queue *)act->conf; - filter->pool =3D act_q->index; + if (act->type =3D=3D RTE_FLOW_ACTION_TYPE_VF) { + act_vf =3D (const struct rte_flow_action_vf *)act->conf; + filter->pool =3D act_vf->id; + } else { + filter->pool =3D pci_dev->max_vfs; + } =20 /* check if the next not void item is END */ act =3D next_no_void_action(actions, act); @@ -1260,8 +1267,10 @@ ixgbe_p= arse_l2_tn_filter(struct rte_eth_dev *dev, { int ret =3D 0; struct ixgbe_hw *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); + uint16_t vf_num; =20 - ret =3D cons_parse_l2_tn_filter(attr, pattern, + ret =3D cons_parse_l2_tn_filter(dev, attr, pattern, actions, l2_tn_filter, error); =20 if (hw->mac.type !=3D ixgbe_mac_X550 && @@ -1274,7 +1283,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, return -rte_errno; } =20 - if (l2_tn_filter->pool >=3D dev->data->nb_rx_queues) + vf_num =3D pci_dev->max_vfs; + + if (l2_tn_filter->pool > vf_num) return -rte_errno; =20 return ret; -- 2.7.4