From patchwork Thu Jan 14 01:38:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenzhuo Lu X-Patchwork-Id: 9837 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C49B78E7F; Thu, 14 Jan 2016 02:38:48 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 09FF28E78 for ; Thu, 14 Jan 2016 02:38:46 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 13 Jan 2016 17:38:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,292,1449561600"; d="scan'208";a="890081451" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 13 Jan 2016 17:38:45 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u0E1chnI032122; Thu, 14 Jan 2016 09:38:43 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u0E1ceAf004570; Thu, 14 Jan 2016 09:38:42 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u0E1cedm004566; Thu, 14 Jan 2016 09:38:40 +0800 From: Wenzhuo Lu To: dev@dpdk.org Date: Thu, 14 Jan 2016 09:38:31 +0800 Message-Id: <1452735516-4527-2-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1452735516-4527-1-git-send-email-wenzhuo.lu@intel.com> References: <1452496044-17524-1-git-send-email-wenzhuo.lu@intel.com> <1452735516-4527-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..4e71e90 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6780,9 +6780,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ed971b4..74428f4 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1987,6 +1987,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -2010,6 +2032,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index bada8ad..2e064f4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3408,6 +3420,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3425,6 +3440,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device.