From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E81902C53 for ; Mon, 7 Mar 2016 04:29:10 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 06 Mar 2016 19:29:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,549,1449561600"; d="scan'208";a="931043451" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 06 Mar 2016 19:29:09 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Mar 2016 19:29:09 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Mar 2016 19:29:08 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.132]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.18]) with mapi id 14.03.0248.002; Mon, 7 Mar 2016 11:29:06 +0800 From: "Wu, Jingjing" To: "Lu, Wenzhuo" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v5 5/7] lib/librte_ether: support new l2 tunnel operation Thread-Index: AQHReBs177Tz4efrYkePvdDQgrnsE59NUXnw Date: Mon, 7 Mar 2016 03:29:05 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F8DCF2EC@SHSMSX104.ccr.corp.intel.com> References: <1454051035-25757-1-git-send-email-wenzhuo.lu@intel.com> <1457318568-28797-1-git-send-email-wenzhuo.lu@intel.com> <1457318568-28797-6-git-send-email-wenzhuo.lu@intel.com> In-Reply-To: <1457318568-28797-6-git-send-email-wenzhuo.lu@intel.com> 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 v5 5/7] lib/librte_ether: support new l2 tunnel operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2016 03:29:11 -0000 Hi, wenzhuo > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Monday, March 07, 2016 10:43 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v5 5/7] lib/librte_ether: support new l2 tunne= l > operation >=20 > Add functions to support the new l2 tunnel operation. > 1, Insertion and stripping for l2 tunnel tag. > 2, Forwarding the packets to a pool based on l2 tunnel tag. >=20 > Signed-off-by: Wenzhuo Lu > --- > lib/librte_ether/rte_ethdev.c | 183 > ++++++++++++++++++++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 214 > ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 397 insertions(+) >=20 > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c > index c5c12cb..6bc19d4 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -3298,3 +3298,186 @@ rte_eth_dev_l2_tunnel_disable(uint8_t port_id, > -ENOTSUP); > return (*dev->dev_ops->l2_tunnel_disable)(dev, l2_tunnel_type); } > + > +int > +rte_eth_dev_l2_tunnel_insertion_enable(uint8_t port_id, > + struct rte_eth_l2_tunnel *l2_tunnel, > + uint16_t vf_id) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + if (l2_tunnel =3D=3D NULL) { > + RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n"); > + return -EINVAL; > + } > + > + if (l2_tunnel->l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_insertion_enable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_insertion_enable)(dev, > + l2_tunnel, > + vf_id); > +} > + > +int > +rte_eth_dev_l2_tunnel_insertion_disable(uint8_t port_id, > + enum rte_eth_l2_tunnel_type > + l2_tunnel_type, > + uint16_t vf_id) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + if (l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_insertion_disable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_insertion_disable)(dev, > + l2_tunnel_type, > + vf_id); > +} > + > +int > +rte_eth_dev_l2_tunnel_stripping_enable(uint8_t port_id, > + enum rte_eth_l2_tunnel_type > + l2_tunnel_type) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + if (l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_stripping_enable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_stripping_enable)(dev, > + l2_tunnel_type); > +} > + > +int > +rte_eth_dev_l2_tunnel_stripping_disable(uint8_t port_id, > + enum rte_eth_l2_tunnel_type > + l2_tunnel_type) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + if (l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_stripping_disable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_stripping_disable)(dev, > + l2_tunnel_type); > +} > + > +int > +rte_eth_dev_l2_tunnel_forwarding_enable(uint8_t port_id, > + enum rte_eth_l2_tunnel_type > + l2_tunnel_type) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + if (l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_forwarding_enable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_forwarding_enable)(dev, > + l2_tunnel_type); > +} > + > +int > +rte_eth_dev_l2_tunnel_forwarding_disable(uint8_t port_id, > + enum rte_eth_l2_tunnel_type > + l2_tunnel_type) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + if (l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_forwarding_disable, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_forwarding_disable)(dev, > + l2_tunnel_type); > +} > + How about to merge the above six APIs rte_eth_dev_l2_tunnel_XXX_enable/disa= ble to one, may call rte_eth_dev_l2_tunnel_offload_set? Just like the rte_eth_dev_set_vlan_offload. > +int > +rte_eth_dev_l2_tunnel_filter_add(uint8_t port_id, > + struct rte_eth_l2_tunnel *l2_tunnel, > + uint32_t pool) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + if (l2_tunnel =3D=3D NULL) { > + RTE_PMD_DEBUG_TRACE("Invalid l2_tunnel parameter\n"); > + return -EINVAL; > + } > + > + if (l2_tunnel->l2_tunnel_type >=3D RTE_L2_TUNNEL_TYPE_MAX) { > + RTE_PMD_DEBUG_TRACE("Invalid l2 tunnel type\n"); > + return -EINVAL; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >l2_tunnel_filter_add, > + -ENOTSUP); > + return (*dev->dev_ops->l2_tunnel_filter_add)(dev, > + l2_tunnel, > + pool); > +} Pool is used here, but vf_id is used above. Suggest to put such arguments i= nto structure, maybe in l2_tunnel. Thanks Jingjing