net/ice: enable eCPRI tunnel port configure in DCF
authorJeff Guo <jia.guo@intel.com>
Wed, 20 Jan 2021 10:07:04 +0000 (18:07 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:07 +0000 (18:16 +0100)
Add eCPRI tunnel port add and rm ops to configure eCPRI UDP tunnel port
in "Device Config Function" (DCF).

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
doc/guides/rel_notes/release_21_02.rst
drivers/net/ice/ice_dcf_ethdev.c

index 9e0f4c9..a6bbfac 100644 (file)
@@ -94,7 +94,10 @@ New Features
 
 * **Updated Intel ice driver.**
 
+  Updated the Intel ice driver with new features and improvements, including:
+
   * Added Double VLAN support for DCF switch QinQ filtering.
+  * Added support for UDP dynamic port assignment for eCPRI tunnel in DCF.
 
 * **Updated Mellanox mlx5 driver.**
 
index 86f70cf..e077229 100644 (file)
 #include "ice_dcf_ethdev.h"
 #include "ice_rxtx.h"
 
+static int
+ice_dcf_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+                               struct rte_eth_udp_tunnel *udp_tunnel);
+static int
+ice_dcf_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+                               struct rte_eth_udp_tunnel *udp_tunnel);
+
 static uint16_t
 ice_dcf_recv_pkts(__rte_unused void *rx_queue,
                  __rte_unused struct rte_mbuf **bufs,
@@ -898,6 +905,64 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
        return 0;
 }
 
+/* Add UDP tunneling port */
+static int
+ice_dcf_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+                               struct rte_eth_udp_tunnel *udp_tunnel)
+{
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+       struct ice_adapter *parent_adapter = &adapter->parent;
+       struct ice_hw *parent_hw = &parent_adapter->hw;
+       int ret = 0;
+
+       if (!udp_tunnel)
+               return -EINVAL;
+
+       switch (udp_tunnel->prot_type) {
+       case RTE_TUNNEL_TYPE_VXLAN:
+               ret = ice_create_tunnel(parent_hw, TNL_VXLAN,
+                                       udp_tunnel->udp_port);
+               break;
+       case RTE_TUNNEL_TYPE_ECPRI:
+               ret = ice_create_tunnel(parent_hw, TNL_ECPRI,
+                                       udp_tunnel->udp_port);
+               break;
+       default:
+               PMD_DRV_LOG(ERR, "Invalid tunnel type");
+               ret = -EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
+/* Delete UDP tunneling port */
+static int
+ice_dcf_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+                               struct rte_eth_udp_tunnel *udp_tunnel)
+{
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+       struct ice_adapter *parent_adapter = &adapter->parent;
+       struct ice_hw *parent_hw = &parent_adapter->hw;
+       int ret = 0;
+
+       if (!udp_tunnel)
+               return -EINVAL;
+
+       switch (udp_tunnel->prot_type) {
+       case RTE_TUNNEL_TYPE_VXLAN:
+       case RTE_TUNNEL_TYPE_ECPRI:
+               ret = ice_destroy_tunnel(parent_hw, udp_tunnel->udp_port, 0);
+               break;
+       default:
+               PMD_DRV_LOG(ERR, "Invalid tunnel type");
+               ret = -EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
 static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
        .dev_start               = ice_dcf_dev_start,
        .dev_stop                = ice_dcf_dev_stop,
@@ -920,6 +985,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
        .allmulticast_enable     = ice_dcf_dev_allmulticast_enable,
        .allmulticast_disable    = ice_dcf_dev_allmulticast_disable,
        .filter_ctrl             = ice_dcf_dev_filter_ctrl,
+       .udp_tunnel_port_add     = ice_dcf_dev_udp_tunnel_port_add,
+       .udp_tunnel_port_del     = ice_dcf_dev_udp_tunnel_port_del,
 };
 
 static int