net/mlx5: enable more shared code on Windows
Use macro HAVE_INFINIBAND_VERBS_H to successfully compile files both under Linux and Windows (or any non Linux in general). Under Windows this macro: 1. Hides Verbs references. 2. Exposes required DV structs that are under ifdefs related to rdma core. Linux code under definitions such as #ifdef HAVE_IBV_FLOW_DV_SUPPORT is required unconditionally under Windows however those definitions are never effective without rdma-core presence. Therefore update the #ifdef condition to consider HAVE_INFINIBAND_VERBS_H as well (undefined macro when running without an rdma-core library). For example: -#ifdef HAVE_IBV_FLOW_DV_SUPPORT +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) Signed-off-by: Ophir Munk <ophirmu@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
parent
1d194496b9
commit
f1ae0b3590
@ -187,7 +187,7 @@ static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =
|
||||
static pthread_mutex_t mlx5_dev_ctx_list_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
[MLX5_IPOOL_DECAP_ENCAP] = {
|
||||
.size = sizeof(struct mlx5_flow_dv_encap_decap_resource),
|
||||
.trunk_size = 64,
|
||||
@ -1148,7 +1148,7 @@ mlx5_alloc_table_hash_list(struct mlx5_priv *priv __rte_unused)
|
||||
{
|
||||
int err = 0;
|
||||
/* Tables are only used in DV and DR modes. */
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
struct mlx5_dev_ctx_shared *sh = priv->sh;
|
||||
char s[MLX5_HLIST_NAMESIZE];
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define MLX5_SH(dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh)
|
||||
|
||||
enum mlx5_ipool_index {
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
MLX5_IPOOL_DECAP_ENCAP = 0, /* Pool for encap/decap resource. */
|
||||
MLX5_IPOOL_PUSH_VLAN, /* Pool for push vlan resource. */
|
||||
MLX5_IPOOL_TAG, /* Pool for tag resource. */
|
||||
@ -833,7 +833,7 @@ struct mlx5_hrxq {
|
||||
void *qp; /* Verbs queue pair. */
|
||||
struct mlx5_devx_obj *tir; /* DevX TIR object. */
|
||||
};
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
void *action; /* DV QP action pointer. */
|
||||
#endif
|
||||
uint64_t hash_fields; /* Verbs Hash fields. */
|
||||
|
@ -941,7 +941,7 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
|
||||
rte_errno = errno;
|
||||
goto error;
|
||||
}
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
if (mlx5_flow_os_create_flow_action_dest_devx_tir(hrxq->tir,
|
||||
&hrxq->action)) {
|
||||
rte_errno = errno;
|
||||
@ -1111,7 +1111,7 @@ mlx5_txq_obj_hairpin_new(struct rte_eth_dev *dev, uint16_t idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET
|
||||
#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
/**
|
||||
* Release DevX SQ resources.
|
||||
*
|
||||
@ -1421,7 +1421,7 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx)
|
||||
|
||||
if (txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN)
|
||||
return mlx5_txq_obj_hairpin_new(dev, idx);
|
||||
#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET
|
||||
#if !defined(HAVE_MLX5DV_DEVX_UAR_OFFSET) && defined(HAVE_INFINIBAND_VERBS_H)
|
||||
DRV_LOG(ERR, "Port %u Tx queue %u cannot create with DevX, no UAR.",
|
||||
dev->data->port_id, idx);
|
||||
rte_errno = ENOMEM;
|
||||
@ -1522,7 +1522,7 @@ mlx5_txq_devx_obj_release(struct mlx5_txq_obj *txq_obj)
|
||||
if (txq_obj->txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN) {
|
||||
if (txq_obj->tis)
|
||||
claim_zero(mlx5_devx_cmd_destroy(txq_obj->tis));
|
||||
#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET
|
||||
#if defined(HAVE_MLX5DV_DEVX_UAR_OFFSET) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
} else {
|
||||
mlx5_txq_release_devx_resources(txq_obj);
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ const struct mlx5_flow_driver_ops mlx5_flow_null_drv_ops;
|
||||
|
||||
const struct mlx5_flow_driver_ops *flow_drv_ops[] = {
|
||||
[MLX5_FLOW_TYPE_MIN] = &mlx5_flow_null_drv_ops,
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
[MLX5_FLOW_TYPE_DV] = &mlx5_flow_dv_drv_ops,
|
||||
#endif
|
||||
[MLX5_FLOW_TYPE_VERBS] = &mlx5_flow_verbs_drv_ops,
|
||||
|
@ -600,12 +600,6 @@ struct mlx5_flow_dv_dest_array_resource {
|
||||
/**< Action resources. */
|
||||
};
|
||||
|
||||
/* Verbs specification header. */
|
||||
struct ibv_spec_header {
|
||||
enum ibv_flow_spec_type type;
|
||||
uint16_t size;
|
||||
};
|
||||
|
||||
/* PMD flow priority for tunnel */
|
||||
#define MLX5_TUNNEL_PRIO_GET(rss_desc) \
|
||||
((rss_desc)->level >= 2 ? MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4)
|
||||
@ -652,7 +646,7 @@ struct mlx5_flow_handle {
|
||||
uint32_t rix_srss;
|
||||
/**< Indicates shared RSS fate action. */
|
||||
};
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
struct mlx5_flow_handle_dv dvh;
|
||||
#endif
|
||||
} __rte_packed;
|
||||
@ -662,7 +656,7 @@ struct mlx5_flow_handle {
|
||||
* structure in Verbs. No DV flows attributes will be accessed.
|
||||
* Macro offsetof() could also be used here.
|
||||
*/
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
#define MLX5_FLOW_HANDLE_VERBS_SIZE \
|
||||
(sizeof(struct mlx5_flow_handle) - sizeof(struct mlx5_flow_handle_dv))
|
||||
#else
|
||||
@ -700,6 +694,7 @@ struct mlx5_flow_dv_workspace {
|
||||
/**< Pointer to the destination array resource. */
|
||||
};
|
||||
|
||||
#ifdef HAVE_INFINIBAND_VERBS_H
|
||||
/*
|
||||
* Maximal Verbs flow specifications & actions size.
|
||||
* Some elements are mutually exclusive, but enough space should be allocated.
|
||||
@ -756,6 +751,7 @@ struct mlx5_flow_verbs_workspace {
|
||||
uint8_t specs[MLX5_VERBS_MAX_SPEC_ACT_SIZE];
|
||||
/**< Specifications & actions buffer of verbs flow. */
|
||||
};
|
||||
#endif /* HAVE_INFINIBAND_VERBS_H */
|
||||
|
||||
/** Maximal number of device sub-flows supported. */
|
||||
#define MLX5_NUM_MAX_DEV_FLOWS 32
|
||||
@ -773,10 +769,12 @@ struct mlx5_flow {
|
||||
uint8_t skip_scale:1;
|
||||
/**< 1 if skip the scale the table with factor. */
|
||||
union {
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
struct mlx5_flow_dv_workspace dv;
|
||||
#endif
|
||||
#ifdef HAVE_INFINIBAND_VERBS_H
|
||||
struct mlx5_flow_verbs_workspace verbs;
|
||||
#endif
|
||||
};
|
||||
struct mlx5_flow_handle *handle;
|
||||
uint32_t handle_idx; /* Index of the mlx5 flow handle memory. */
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "mlx5_rxtx.h"
|
||||
#include "rte_pmd_mlx5.h"
|
||||
|
||||
#ifdef HAVE_IBV_FLOW_DV_SUPPORT
|
||||
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
|
||||
|
||||
#ifndef HAVE_IBV_FLOW_DEVX_COUNTERS
|
||||
#define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0
|
||||
|
@ -39,6 +39,12 @@ static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX] = {
|
||||
{ 9, 10, 11 }, { 12, 13, 14 },
|
||||
};
|
||||
|
||||
/* Verbs specification header. */
|
||||
struct ibv_spec_header {
|
||||
enum ibv_flow_spec_type type;
|
||||
uint16_t size;
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover the maximum number of priority available.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user