From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59D95A057B; Thu, 2 Apr 2020 11:32:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A42D12BAF; Thu, 2 Apr 2020 11:32:04 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A6ABF2BAF for ; Thu, 2 Apr 2020 11:32:02 +0200 (CEST) IronPort-SDR: FXlFLFaEVMP5o/DKs3v08q7/kDDnJ1KxDfrvqJmhd5S2ciFVPF+c/53b8Cf4JEfTQEMFd4AktD k2sv5M0zRoQQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 02:32:01 -0700 IronPort-SDR: G1HCREIp269eZT15bqEtCTeGKgQJ9f7Lt9ImzQDyjFk2sdJ2lr1KjB2arPeeac1ag39e3Jx00Y 8jBS7lYxz1Jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,335,1580803200"; d="scan'208";a="423064695" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 02 Apr 2020 02:32:01 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 2 Apr 2020 02:31:57 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 2 Apr 2020 17:31:55 +0800 Received: from shsmsx606.ccr.corp.intel.com ([10.109.6.216]) by SHSMSX606.ccr.corp.intel.com ([10.109.6.216]) with mapi id 15.01.1713.004; Thu, 2 Apr 2020 17:31:55 +0800 From: "Lu, Nannan" To: "Zhao1, Wei" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Peng, Yuan" , "Fu, Qi" , "Wang, Haiyue" Thread-Topic: [PATCH v2 02/13] net/ice: support for more PPPoE input set Thread-Index: AQHWCL1nRmgnUB34pkWgfic8B4qtb6hlkUUg Date: Thu, 2 Apr 2020 09:31:55 +0000 Message-ID: <6ed0ef470fab467ebda1bf6ab0ec53b5@intel.com> References: <20200313020806.21654-1-wei.zhao1@intel.com> <20200402064620.47668-1-wei.zhao1@intel.com> <20200402064620.47668-3-wei.zhao1@intel.com> In-Reply-To: <20200402064620.47668-3-wei.zhao1@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 02/13] net/ice: support for more PPPoE input set 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" PPPOE session id Tested-by: Lu, Nannan -----Original Message----- From: Zhao1, Wei=20 Sent: Thursday, April 2, 2020 2:46 PM To: dev@dpdk.org Cc: Zhang, Qi Z ; Peng, Yuan ; L= u, Nannan ; Fu, Qi ; Wang, Haiyue ; Zhao1, Wei Subject: [PATCH v2 02/13] net/ice: support for more PPPoE input set This patch add more support for PPPoE packet, it enable swicth filter to di= rect PPPoE packet base on session id and PPP protocol type. Signed-off-by: Wei Zhao --- drivers/net/ice/ice_generic_flow.c | 13 +++++ drivers/net/ice/ice_generi= c_flow.h | 9 ++++ drivers/net/ice/ice_switch_filter.c | 82 +++++++++++++= ++++++++++++++-- 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_gener= ic_flow.c index c0420797e..0fdc7e617 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1122,12 +1122,25 @@ enum rte_flow_item_type pattern_eth_pppoes[] =3D { RTE_FLOW_ITEM_TYPE_PPPOES, RTE_FLOW_ITEM_TYPE_END, }; +enum rte_flow_item_type pattern_eth_pppoes_proto[] =3D { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_PPPOES, + RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID, + RTE_FLOW_ITEM_TYPE_END, +}; enum rte_flow_item_type pattern_eth_vlan_pppoes[] =3D { RTE_FLOW_ITEM_TYPE_ETH, RTE_FLOW_ITEM_TYPE_VLAN, RTE_FLOW_ITEM_TYPE_PPPOES, RTE_FLOW_ITEM_TYPE_END, }; +enum rte_flow_item_type pattern_eth_vlan_pppoes_proto[] =3D { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_VLAN, + RTE_FLOW_ITEM_TYPE_PPPOES, + RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID, + RTE_FLOW_ITEM_TYPE_END, +}; enum rte_flow_item_type pattern_eth_qinq_pppoes[] =3D { RTE_FLOW_ITEM_TYPE_ETH, RTE_FLOW_ITEM_TYPE_VLAN, diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_gener= ic_flow.h index ede6ec824..3361ecbd9 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -30,6 +30,7 @@ #define ICE_PROT_VXLAN (1ULL << 19) #define ICE_PROT_NVGRE (1ULL << 20) #define ICE_PROT_GTPU (1ULL << 21) +#define ICE_PROT_PPPOE_S (1ULL << 22) =20 /* field */ =20 @@ -49,6 +50,8 @@ #define ICE_NVGRE_TNI (1ULL << 50) #define ICE_GTPU_TEID (1ULL << 49) #define ICE_GTPU_QFI (1ULL << 48) +#define ICE_PPPOE_SESSION (1ULL << 47) +#define ICE_PPPOE_PROTO (1ULL << 46) =20 /* input set */ =20 @@ -177,6 +180,10 @@ (ICE_PROT_GTPU | ICE_GTPU_TEID) #define ICE_INSET_GTPU_QFI \ (ICE_PROT_GTPU | ICE_GTPU_QFI) +#define ICE_INSET_PPPOE_SESSION \ + (ICE_PROT_PPPOE_S | ICE_PPPOE_SESSION) #define ICE_INSET_PPPOE_PROTO \ + (ICE_PROT_PPPOE_S | ICE_PPPOE_PROTO) =20 /* empty pattern */ extern enum rte_flow_item_type pattern_empty[]; @@ -349,7 +356,9 @@ extern= enum rte_flow_item_type pattern_eth_pppoed[]; extern enum rte_flow_item_t= ype pattern_eth_vlan_pppoed[]; extern enum rte_flow_item_type pattern_eth_= qinq_pppoed[]; extern enum rte_flow_item_type pattern_eth_pppoes[]; +extern enum rte_flow_item_type pattern_eth_pppoes_proto[]; extern enum rte_flow_item_type pattern_eth_vlan_pppoes[]; +extern enum rte_flow_item_type pattern_eth_vlan_pppoes_proto[]; extern enum rte_flow_item_type pattern_eth_qinq_pppoes[]; extern enum rte= _flow_item_type pattern_eth_pppoes_ipv4[]; extern enum rte_flow_item_type = pattern_eth_vlan_pppoes_ipv4[]; diff --git a/drivers/net/ice/ice_switch_fil= ter.c b/drivers/net/ice/ice_switch_filter.c index 4db8f1471..add66e683 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -87,7 +87,11 @@ ICE_INSET_TUN_IPV4_TOS) #define ICE_SW_INSET_MAC_PPPOE ( \ ICE_INSET_VLAN_OUTER | ICE_INSET_VLAN_INNER | \ - ICE_INSET_DMAC | ICE_INSET_ETHERTYPE) + ICE_INSET_DMAC | ICE_INSET_ETHERTYPE | ICE_INSET_PPPOE_SESSION)=20 +#define ICE_SW_INSET_MAC_PPPOE_PROTO ( \ + ICE_INSET_VLAN_OUTER | ICE_INSET_VLAN_INNER | \ + ICE_INSET_DMAC | ICE_INSET_ETHERTYPE | ICE_INSET_PPPOE_SESSION | \ + ICE_INSET_PPPOE_PROTO) =20 struct sw_meta { struct ice_adv_lkup_elem *list; @@ -135,6 +139,10 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[]= =3D { ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE}, {pattern_eth_vlan_pppoes, ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE}, + {pattern_eth_pppoes_proto, + ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE}, + {pattern_eth_vlan_pppoes_proto, + ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE}, }; =20 static struct @@ -316,12 +324,15 @@ ice_switch_inset_get(const struct rte_flow_item patte= rn[], const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask; const struct rte_flow_item_vlan *vlan_spec, *vlan_mask; const struct rte_flow_item_pppoe *pppoe_spec, *pppoe_mask; + const struct rte_flow_item_pppoe_proto_id *pppoe_proto_spec, + *pppoe_proto_mask; uint8_t ipv6_addr_mask[16] =3D { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint64_t input_set =3D ICE_INSET_NONE; uint16_t j, t =3D 0; uint16_t tunnel_valid =3D 0; + uint16_t pppoe_valid =3D 0; =20 =20 for (item =3D pattern; item->type !=3D @@ -885,14 +896,75 @@ ice_switch_inset_get(const struct rte_flow_item patte= rn[], pppoe_mask =3D item->mask; /* Check if PPPoE item is used to describe protocol. * If yes, both spec and mask should be NULL. + * If no, both spec and mask shouldn't be NULL. */ - if (pppoe_spec || pppoe_mask) { + if ((!pppoe_spec && pppoe_mask) || + (pppoe_spec && !pppoe_mask)) { rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM, - item, - "Invalid pppoe item"); + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid pppoe item"); return 0; } + if (pppoe_spec && pppoe_mask) { + /* Check pppoe mask and update input set */ + if (pppoe_mask->length || + pppoe_mask->code || + pppoe_mask->version_type) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid pppoe mask"); + return 0; + } + list[t].type =3D ICE_PPPOE; + if (pppoe_mask->session_id =3D=3D UINT16_MAX) { + list[t].h_u.pppoe_hdr.session_id =3D + pppoe_spec->session_id; + list[t].m_u.pppoe_hdr.session_id =3D + UINT16_MAX; + input_set |=3D ICE_INSET_PPPOE_SESSION; + } + t++; + pppoe_valid =3D 1; + } else if (!pppoe_spec && !pppoe_mask) { + list[t].type =3D ICE_PPPOE; + } + + break; + + case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: + pppoe_proto_spec =3D item->spec; + pppoe_proto_mask =3D item->mask; + /* Check if PPPoE optional proto_id item + * is used to describe protocol. + * If yes, both spec and mask should be NULL. + * If no, both spec and mask shouldn't be NULL. + */ + if ((!pppoe_proto_spec && pppoe_proto_mask) || + (pppoe_proto_spec && !pppoe_proto_mask)) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid pppoe proto item"); + return 0; + } + if (pppoe_proto_spec && pppoe_proto_mask) { + if (pppoe_valid) + t--; + list[t].type =3D ICE_PPPOE; + if (pppoe_proto_mask->proto_id =3D=3D UINT16_MAX) { + list[t].h_u.pppoe_hdr.ppp_prot_id =3D + pppoe_proto_spec->proto_id; + list[t].m_u.pppoe_hdr.ppp_prot_id =3D + UINT16_MAX; + input_set |=3D ICE_INSET_PPPOE_PROTO; + } + t++; + } else if (!pppoe_proto_spec && !pppoe_proto_mask) { + list[t].type =3D ICE_PPPOE; + } + break; =20 case RTE_FLOW_ITEM_TYPE_VOID: -- 2.19.1