net/mlx5: support UDP tunnel adding
[dpdk.git] / drivers / net / mlx5 / mlx5.h
index 5c40091..ab2e79c 100644 (file)
@@ -195,9 +195,6 @@ TAILQ_HEAD(mlx5_flows, rte_flow);
 #define MLX5_LRO_SUPPORTED(dev) \
        (((struct mlx5_priv *)((dev)->data->dev_private))->config.lro.supported)
 
-#define MLX5_LRO_ENABLED(dev) \
-       ((dev)->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO)
-
 /* LRO configurations structure. */
 struct mlx5_lro_config {
        uint32_t supported:1; /* Whether LRO is supported. */
@@ -358,6 +355,30 @@ enum mlx5_verbs_alloc_type {
        MLX5_VERBS_ALLOC_TYPE_RX_QUEUE,
 };
 
+/* VLAN netdev for VLAN workaround. */
+struct mlx5_vlan_dev {
+       uint32_t refcnt;
+       uint32_t ifindex; /**< Own interface index. */
+};
+
+/* Structure for VF VLAN workaround. */
+struct mlx5_vf_vlan {
+       uint32_t tag:12;
+       uint32_t created:1;
+};
+
+/*
+ * Array of VLAN devices created on the base of VF
+ * used for workaround in virtual environments.
+ */
+struct mlx5_vlan_vmwa_context {
+       int nl_socket;
+       uint32_t nl_sn;
+       uint32_t vf_ifindex;
+       struct rte_eth_dev *dev;
+       struct mlx5_vlan_dev vlan_dev[4096];
+};
+
 /**
  * Verbs allocator needs a context to know in the callback which kind of
  * resources it is allocating.
@@ -492,8 +513,8 @@ struct mlx5_flow_tbl_resource {
        rte_atomic32_t refcnt; /**< Reference counter. */
 };
 
-#define MLX5_MAX_TABLES 1024
-#define MLX5_MAX_TABLES_FDB 32
+#define MLX5_MAX_TABLES 0xffff
+#define MLX5_MAX_TABLES_FDB 0xffff
 #define MLX5_GROUP_FACTOR 1
 
 #define MLX5_DBR_PAGE_SIZE 4096 /* Must be >= 512. */
@@ -548,8 +569,8 @@ struct mlx5_ibv_shared {
        /* RX Direct Rules tables. */
        void *tx_domain; /* TX Direct Rules name space handle. */
        struct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];
+       /* TX Direct Rules tables. */
        void *esw_drop_action; /* Pointer to DR E-Switch drop action. */
-       /* TX Direct Rules tables/ */
        LIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;
        LIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;
        LIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;
@@ -634,6 +655,7 @@ struct mlx5_priv {
        int nl_socket_route; /* Netlink socket (NETLINK_ROUTE). */
        uint32_t nl_sn; /* Netlink message sequence number. */
        LIST_HEAD(dbrpage, mlx5_devx_dbr_page) dbrpgs; /* Door-bell pages. */
+       struct mlx5_vlan_vmwa_context *vmwa_context; /* VLAN WA context. */
 #ifndef RTE_ARCH_64
        rte_spinlock_t uar_lock_cq; /* CQs share a common distinct UAR */
        rte_spinlock_t uar_lock[MLX5_UAR_PAGE_NUM_MAX];
@@ -652,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 */
 
@@ -833,6 +857,14 @@ unsigned int mlx5_nl_ifindex(int nl, const char *name, uint32_t pindex);
 int mlx5_nl_switch_info(int nl, unsigned int ifindex,
                        struct mlx5_switch_info *info);
 
+struct mlx5_vlan_vmwa_context *mlx5_vlan_vmwa_init(struct rte_eth_dev *dev,
+                                                  uint32_t ifindex);
+void mlx5_vlan_vmwa_exit(struct mlx5_vlan_vmwa_context *ctx);
+void mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,
+                           struct mlx5_vf_vlan *vf_vlan);
+void mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,
+                           struct mlx5_vf_vlan *vf_vlan);
+
 /* mlx5_devx_cmds.c */
 
 struct mlx5_devx_obj *mlx5_devx_cmd_flow_counter_alloc(struct ibv_context *ctx,