From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8DFC3137C for ; Thu, 3 Mar 2016 08:14:45 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2016 23:14:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,531,1449561600"; d="scan'208";a="58923594" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 02 Mar 2016 23:14:44 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 2 Mar 2016 23:14:44 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 2 Mar 2016 23:14:43 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.232]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.24]) with mapi id 14.03.0248.002; Thu, 3 Mar 2016 15:14:36 +0800 From: "Lu, Wenzhuo" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Thread-Index: AQHRTD7Bd8nYadIt2UyXfG1/UUQlJJ9HoAMA Date: Thu, 3 Mar 2016 07:14:36 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC090903437553@shsmsx102.ccr.corp.intel.com> References: <1452496044-17524-1-git-send-email-wenzhuo.lu@intel.com> <1452496044-17524-2-git-send-email-wenzhuo.lu@intel.com> <533710CFB86FA344BFBF2D6802E6028622F5BD7A@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E6028622F5BD7A@SHSMSX101.ccr.corp.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 1/4] ixgbe: support UDP tunnel add/del 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: Thu, 03 Mar 2016 07:14:46 -0000 Hi Michael, > -----Original Message----- > From: Qiu, Michael > Sent: Thursday, March 3, 2016 2:58 PM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del >=20 > On 1/11/2016 3:08 PM, Wenzhuo Lu wrote: > > Add UDP tunnel add/del support on ixgbe. Now it only support VxLAN > > port configuration. > > Although the VxLAN port has a default value 4789, it can be changed. > > We support VxLAN port configuration to meet the change. > > Note, the default value of VxLAN port in ixgbe NICs is 0. So please > > set it when using VxLAN off-load. > > > > Signed-off-by: Wenzhuo Lu > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 93 > > ++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 93 insertions(+) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 4c4c6df..381cbad 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct > rte_eth_dev *dev, > > struct timespec *timestamp); > > static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, > > const struct timespec *timestamp); > > +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel); > static int > > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel); > > > > /* > > * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 > > +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops =3D { > > .timesync_adjust_time =3D ixgbe_timesync_adjust_time, > > .timesync_read_time =3D ixgbe_timesync_read_time, > > .timesync_write_time =3D ixgbe_timesync_write_time, > > + .udp_tunnel_add =3D ixgbe_dev_udp_tunnel_add, > > + .udp_tunnel_del =3D ixgbe_dev_udp_tunnel_del, > > }; > > > > /* > > @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, > > return 0; > > } > > > > +#define DEFAULT_VXLAN_PORT 4789 > > + > > +/* on x550, there's only one register for VxLAN UDP port. > > + * So, we cannot add or del the port. We only update it. > > + */ > > +static int > > +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, > > + uint16_t port) > > +{ > > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); > > + IXGBE_WRITE_FLUSH(hw); > > + > > + return 0; > > +} > > + > > +/* Add UDP tunneling port */ > > +static int > > +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel) { > > + int ret =3D 0; > > + struct ixgbe_hw *hw =3D > > +IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + > > + if (hw->mac.type !=3D ixgbe_mac_X550 && > > + hw->mac.type !=3D ixgbe_mac_X550EM_x) { > > + return -ENOTSUP; > > + } > > + > > + if (udp_tunnel =3D=3D NULL) > > + return -EINVAL; > > + > > + switch (udp_tunnel->prot_type) { > > + case RTE_TUNNEL_TYPE_VXLAN: > > + /* cannot add a port, update the port value */ > > + ret =3D ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); > > + break; > > + > > + case RTE_TUNNEL_TYPE_GENEVE: > > + case RTE_TUNNEL_TYPE_TEREDO: > > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > > + ret =3D -1; > > + break; > > + > > + default: > > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > > + ret =3D -1; > > + break; > > + } > > + > > + return ret; > > +} > > + > > +/* Remove UDP tunneling port */ > > +static int > > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel) { > > + int ret =3D 0; > > + struct ixgbe_hw *hw =3D > > +IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + > > + if (hw->mac.type !=3D ixgbe_mac_X550 && > > + hw->mac.type !=3D ixgbe_mac_X550EM_x) { > > + return -ENOTSUP; > > + } > > + > > + if (udp_tunnel =3D=3D NULL) > > + return -EINVAL; > > + > > + switch (udp_tunnel->prot_type) { > > + case RTE_TUNNEL_TYPE_VXLAN: > > + /* cannot del the port, reset it to default */ > > + ret =3D ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); > > + break; > > + case RTE_TUNNEL_TYPE_GENEVE: > > + case RTE_TUNNEL_TYPE_TEREDO: > > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > > + ret =3D -1; >=20 > Better to use the -EINVAL or other, mixed style always not good. Good suggestion, thanks. I'll change it. >=20 > Thanks, > Michael > > + break; > > + default: > > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > > + ret =3D -1; > > + break; > > + } > > + > > + return ret; > > +} > > + > > static struct rte_driver rte_ixgbe_driver =3D { > > .type =3D PMD_PDEV, > > .init =3D rte_ixgbe_pmd_init,