From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id EDBE7A046B
	for <public@inbox.dpdk.org>; Wed, 26 Jun 2019 09:07:59 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id BEE6E5B3E;
	Wed, 26 Jun 2019 09:07:59 +0200 (CEST)
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126])
 by dpdk.org (Postfix) with ESMTP id B26592C2B
 for <dev@dpdk.org>; Wed, 26 Jun 2019 09:07:57 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 26 Jun 2019 00:07:56 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.63,418,1557212400"; d="scan'208";a="164258218"
Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201])
 by orsmga003.jf.intel.com with ESMTP; 26 Jun 2019 00:07:56 -0700
Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by
 FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Wed, 26 Jun 2019 00:07:56 -0700
Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by
 FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Wed, 26 Jun 2019 00:07:55 -0700
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.87]) by
 SHSMSX104.ccr.corp.intel.com ([169.254.5.185]) with mapi id 14.03.0439.000;
 Wed, 26 Jun 2019 15:07:54 +0800
From: "Xing, Beilei" <beilei.xing@intel.com>
To: "Yang, Qiming" <qiming.yang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Yang, Qiming" <qiming.yang@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v7 3/3] net/ice: add UDP tunnel port support
Thread-Index: AQHVKyJY3dczRCeMFUi8iZZZCxtF1qathQsA
Date: Wed, 26 Jun 2019 07:07:53 +0000
Message-ID: <94479800C636CB44BD422CB454846E013CDEA802@SHSMSX101.ccr.corp.intel.com>
References: <1559552722-8970-1-git-send-email-qiming.yang@intel.com>
 <20190625064815.3337-1-qiming.yang@intel.com>
 <20190625064815.3337-4-qiming.yang@intel.com>
In-Reply-To: <20190625064815.3337-4-qiming.yang@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 v7 3/3] net/ice: add UDP tunnel port support
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiming Yang
> Sent: Tuesday, June 25, 2019 2:48 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>
> Subject: [dpdk-dev] [PATCH v7 3/3] net/ice: add UDP tunnel port support
>=20
> Enabled UDP tunnel port add and delete functions.
>=20
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 54
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>=20
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c =
index
> 8ee06d1..949d293 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -88,6 +88,10 @@ static int ice_dev_filter_ctrl(struct rte_eth_dev *dev=
,
>  			enum rte_filter_type filter_type,
>  			enum rte_filter_op filter_op,
>  			void *arg);
> +static int ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
> +			struct rte_eth_udp_tunnel *udp_tunnel); static int
> +ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
> +			struct rte_eth_udp_tunnel *udp_tunnel);
>=20
>  static const struct rte_pci_id pci_id_ice_map[] =3D {
>  	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID,
> ICE_DEV_ID_E810C_BACKPLANE) }, @@ -147,6 +151,8 @@ static const struct
> eth_dev_ops ice_eth_dev_ops =3D {
>  	.xstats_get_names             =3D ice_xstats_get_names,
>  	.xstats_reset                 =3D ice_stats_reset,
>  	.filter_ctrl                  =3D ice_dev_filter_ctrl,
> +	.udp_tunnel_port_add          =3D ice_dev_udp_tunnel_port_add,
> +	.udp_tunnel_port_del          =3D ice_dev_udp_tunnel_port_del,
>  };
>=20
>  /* store statistics names and its offset in stats structure */ @@ -3665,=
6
> +3671,54 @@ ice_dev_filter_ctrl(struct rte_eth_dev *dev,
>  	return ret;
>  }
>=20
> +/* Add UDP tunneling port */
> +static int
> +ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
> +			     struct rte_eth_udp_tunnel *udp_tunnel) {
> +	int ret =3D 0;
> +	struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	if (udp_tunnel =3D=3D NULL)
> +		return -EINVAL;
> +
> +	switch (udp_tunnel->prot_type) {
> +	case RTE_TUNNEL_TYPE_VXLAN:
> +		ret =3D ice_create_tunnel(hw, TNL_VXLAN, udp_tunnel-
> >udp_port);
> +		break;
> +	default:
> +		PMD_DRV_LOG(ERR, "Invalid tunnel type");
> +		ret =3D -1;

How about return -EINVAL here?

> +		break;
> +	}
> +
> +	return ret;
> +}
> +
> +/* Delete UDP tunneling port */
> +static int
> +ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
> +			     struct rte_eth_udp_tunnel *udp_tunnel) {
> +	int ret =3D 0;
> +	struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	if (udp_tunnel =3D=3D NULL)
> +		return -EINVAL;
> +
> +	switch (udp_tunnel->prot_type) {
> +	case RTE_TUNNEL_TYPE_VXLAN:
> +		ret =3D ice_destroy_tunnel(hw, udp_tunnel->udp_port, 0);
> +		break;
> +	default:
> +		PMD_DRV_LOG(ERR, "Invalid tunnel type");
> +		ret =3D -1;
Ditto.

> +		break;
> +	}
> +
> +	return ret;
> +}
> +
>  static int
>  ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  	      struct rte_pci_device *pci_dev)
> --
> 2.9.5