net/mlx5: support adding a new UDP tunnel

Message ID 1566468943-30201-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: support adding a new UDP tunnel |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Raslan Darawsheh Aug. 22, 2019, 10:15 a.m. UTC
  This adds support for adding a new udp tunnel port
on a specific vxlan types.

currently we only support vxlan, vxlan-gpe on ports
4789, 4790 respectivly. without having to configure
anything in the NIC.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 26 ++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5.h |  2 ++
 2 files changed, 28 insertions(+)
  

Comments

Slava Ovsiienko Sept. 4, 2019, 2:46 p.m. UTC | #1
> -----Original Message-----
> From: Raslan Darawsheh <rasland@mellanox.com>
> Sent: Thursday, August 22, 2019 13:16
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; matana@mellanox.com
> Cc: Asaf Penso <asafp@mellanox.com>; dev@dpdk.org
> Subject: [PATCH] net/mlx5: support adding a new UDP tunnel
> 
> This adds support for adding a new udp tunnel port on a specific vxlan types.
> 
> currently we only support vxlan, vxlan-gpe on ports 4789, 4790 respectivly.
> without having to configure anything in the NIC.
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5.c | 26 ++++++++++++++++++++++++++
> drivers/net/mlx5/mlx5.h |  2 ++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> 962c0d5..dc7b10b 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -745,6 +745,31 @@ mlx5_free_verbs_buf(void *ptr, void *data
> __rte_unused)  }
> 
>  /**
> + * DPDK callback to add udp tunnel port
> + *
> + * @param[in] dev
> + *   A pointer to eth_dev
> + * @param[in] udp_tunnel
> + *   A pointer to udp tunnel
> + *
> + * @return
> + *   0 on valid udp ports and tunnels, -ENOTSUP otherwise.
> + */
> +int
> +mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev __rte_unused,
> +			 struct rte_eth_udp_tunnel *udp_tunnel) {
> +	assert(udp_tunnel != NULL);
> +	if (udp_tunnel->prot_type == RTE_TUNNEL_TYPE_VXLAN &&
> +	    udp_tunnel->udp_port == 4789)
> +		return 0;
> +	if (udp_tunnel->prot_type == RTE_TUNNEL_TYPE_VXLAN_GPE &&
> +	    udp_tunnel->udp_port == 4790)
> +		return 0;
> +	return -ENOTSUP;
> +}
> +
> +/**
>   * Initialize process private data structure.
>   *
>   * @param dev
> @@ -962,6 +987,7 @@ const struct eth_dev_ops mlx5_dev_ops = {
>  	.rx_queue_intr_enable = mlx5_rx_intr_enable,
>  	.rx_queue_intr_disable = mlx5_rx_intr_disable,
>  	.is_removed = mlx5_is_removed,
> +	.udp_tunnel_port_add  = mlx5_udp_tunnel_port_add,
>  };
> 
>  /* Available operations from secondary process. */ diff --git
> a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f559f83..fda9f5d
> 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -674,6 +674,8 @@ int64_t mlx5_get_dbr(struct rte_eth_dev *dev,
>  		     struct mlx5_devx_dbr_page **dbr_page);  int32_t
> mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id,
>  			 uint64_t offset);
> +int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev,
> +			      struct rte_eth_udp_tunnel *udp_tunnel);
> 
>  /* mlx5_ethdev.c */
> 
> --
> 2.7.4
  
Raslan Darawsheh Sept. 5, 2019, 10:37 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Raslan Darawsheh
> Sent: Thursday, August 22, 2019 1:16 PM
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; matana@mellanox.com
> Cc: Asaf Penso <asafp@mellanox.com>; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: support adding a new UDP tunnel
> 
> This adds support for adding a new udp tunnel port
> on a specific vxlan types.
> 
> currently we only support vxlan, vxlan-gpe on ports
> 4789, 4790 respectivly. without having to configure
> anything in the NIC.
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 962c0d5..dc7b10b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -745,6 +745,31 @@  mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)
 }
 
 /**
+ * DPDK callback to add udp tunnel port
+ *
+ * @param[in] dev
+ *   A pointer to eth_dev
+ * @param[in] udp_tunnel
+ *   A pointer to udp tunnel
+ *
+ * @return
+ *   0 on valid udp ports and tunnels, -ENOTSUP otherwise.
+ */
+int
+mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev __rte_unused,
+			 struct rte_eth_udp_tunnel *udp_tunnel)
+{
+	assert(udp_tunnel != NULL);
+	if (udp_tunnel->prot_type == RTE_TUNNEL_TYPE_VXLAN &&
+	    udp_tunnel->udp_port == 4789)
+		return 0;
+	if (udp_tunnel->prot_type == RTE_TUNNEL_TYPE_VXLAN_GPE &&
+	    udp_tunnel->udp_port == 4790)
+		return 0;
+	return -ENOTSUP;
+}
+
+/**
  * Initialize process private data structure.
  *
  * @param dev
@@ -962,6 +987,7 @@  const struct eth_dev_ops mlx5_dev_ops = {
 	.rx_queue_intr_enable = mlx5_rx_intr_enable,
 	.rx_queue_intr_disable = mlx5_rx_intr_disable,
 	.is_removed = mlx5_is_removed,
+	.udp_tunnel_port_add  = mlx5_udp_tunnel_port_add,
 };
 
 /* Available operations from secondary process. */
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index f559f83..fda9f5d 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -674,6 +674,8 @@  int64_t mlx5_get_dbr(struct rte_eth_dev *dev,
 		     struct mlx5_devx_dbr_page **dbr_page);
 int32_t mlx5_release_dbr(struct rte_eth_dev *dev, uint32_t umem_id,
 			 uint64_t offset);
+int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev,
+			      struct rte_eth_udp_tunnel *udp_tunnel);
 
 /* mlx5_ethdev.c */