numam-dpdk/drivers/common/mlx5/mlx5_common_devx.h
David Marchand 1094dd940e cleanup compat header inclusions
With symbols going though experimental/stable stages, we accumulated
a lot of discrepancies about inclusion of the rte_compat.h header.

Some headers are including it where unneeded, while others rely on
implicit inclusion.

Fix unneeded inclusions:
$ git grep -l include..rte_compat.h |
  xargs grep -LE '__rte_(internal|experimental)' |
  xargs sed -i -e '/#include..rte_compat.h/d'

Fix missing inclusion, by inserting rte_compat.h before the first
inclusion of a DPDK header:
$ git grep -lE '__rte_(internal|experimental)' |
  xargs grep -L include..rte_compat.h |
  xargs sed -i -e \
    '0,/#include..\(rte_\|.*pmd.h.$\)/{
      s/\(#include..\(rte_\|.*pmd.h.$\)\)/#include <rte_compat.h>\n\1/
    }'

Fix missing inclusion, by inserting rte_compat.h after the last
inclusion of a non DPDK header:
$ for file in $(git grep -lE '__rte_(internal|experimental)' |
  xargs grep -L include..rte_compat.h); do
    tac $file > $file.$$
    sed -i -e \
      '0,/#include../{
        s/\(#include..*$\)/#include <rte_compat.h>\n\n\1/
      }' $file.$$
    tac $file.$$ > $file
    rm $file.$$
  done

Fix missing inclusion, by inserting rte_compat.h after the header guard:
$ git grep -lE '__rte_(internal|experimental)' |
  xargs grep -L include..rte_compat.h |
  xargs sed -i -e \
    '0,/#define/{
      s/\(#define .*$\)/\1\n\n#include <rte_compat.h>/
    }'

And finally, exclude rte_compat.h itself.
$ git checkout lib/eal/include/rte_compat.h

At the end of all this, we have a clean tree:
$ git grep -lE '__rte_(internal|experimental)' |
  xargs grep -L include..rte_compat.h
buildtools/check-symbols.sh
devtools/checkpatches.sh
doc/guides/contributing/abi_policy.rst
doc/guides/rel_notes/release_20_11.rst
lib/eal/include/rte_compat.h

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-15 08:39:14 +01:00

109 lines
2.9 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2020 Mellanox Technologies, Ltd
*/
#ifndef RTE_PMD_MLX5_COMMON_DEVX_H_
#define RTE_PMD_MLX5_COMMON_DEVX_H_
#include "mlx5_devx_cmds.h"
#include <rte_compat.h>
/* The standard page size */
#define MLX5_LOG_PAGE_SIZE 12
/* DevX Completion Queue structure. */
struct mlx5_devx_cq {
struct mlx5_devx_obj *cq; /* The CQ DevX object. */
void *umem_obj; /* The CQ umem object. */
union {
volatile void *umem_buf;
volatile struct mlx5_cqe *cqes; /* The CQ ring buffer. */
};
volatile uint32_t *db_rec; /* The CQ doorbell record. */
};
/* DevX Send Queue structure. */
struct mlx5_devx_sq {
struct mlx5_devx_obj *sq; /* The SQ DevX object. */
void *umem_obj; /* The SQ umem object. */
union {
volatile void *umem_buf;
volatile struct mlx5_wqe *wqes; /* The SQ ring buffer. */
volatile struct mlx5_aso_wqe *aso_wqes;
};
volatile uint32_t *db_rec; /* The SQ doorbell record. */
};
/* DevX Queue Pair structure. */
struct mlx5_devx_qp {
struct mlx5_devx_obj *qp; /* The QP DevX object. */
void *umem_obj; /* The QP umem object. */
union {
void *umem_buf;
struct mlx5_wqe *wqes; /* The QP ring buffer. */
struct mlx5_aso_wqe *aso_wqes;
};
volatile uint32_t *db_rec; /* The QP doorbell record. */
};
/* DevX Receive Queue resource structure. */
struct mlx5_devx_wq_res {
void *umem_obj; /* The RQ umem object. */
volatile void *umem_buf;
volatile uint32_t *db_rec; /* The RQ doorbell record. */
};
/* DevX Receive Memory Pool structure. */
struct mlx5_devx_rmp {
struct mlx5_devx_obj *rmp; /* The RMP DevX object. */
uint32_t ref_cnt; /* Reference count. */
struct mlx5_devx_wq_res wq;
};
/* DevX Receive Queue structure. */
struct mlx5_devx_rq {
struct mlx5_devx_obj *rq; /* The RQ DevX object. */
struct mlx5_devx_rmp *rmp; /* Shared RQ RMP object. */
struct mlx5_devx_wq_res wq; /* WQ resource of standalone RQ. */
};
/* mlx5_common_devx.c */
__rte_internal
void mlx5_devx_cq_destroy(struct mlx5_devx_cq *cq);
__rte_internal
int mlx5_devx_cq_create(void *ctx, struct mlx5_devx_cq *cq_obj,
uint16_t log_desc_n,
struct mlx5_devx_cq_attr *attr, int socket);
__rte_internal
void mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq);
__rte_internal
int mlx5_devx_sq_create(void *ctx, struct mlx5_devx_sq *sq_obj,
uint16_t log_wqbb_n,
struct mlx5_devx_create_sq_attr *attr, int socket);
__rte_internal
void mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp);
__rte_internal
int mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj,
uint32_t queue_size,
struct mlx5_devx_qp_attr *attr, int socket);
__rte_internal
void mlx5_devx_rq_destroy(struct mlx5_devx_rq *rq);
__rte_internal
int mlx5_devx_rq_create(void *ctx, struct mlx5_devx_rq *rq_obj,
uint32_t wqe_size, uint16_t log_wqbb_n,
struct mlx5_devx_create_rq_attr *attr, int socket);
__rte_internal
int mlx5_devx_qp2rts(struct mlx5_devx_qp *qp, uint32_t remote_qp_id);
#endif /* RTE_PMD_MLX5_COMMON_DEVX_H_ */