X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcommon%2Fmlx5%2Fwindows%2Fmlx5_common_os.h;h=ba166412cc9dabdaf4e1e9ebb1737decfa20430e;hb=b0f5afab16c1971aa8bfd2075d69d0b272f28778;hp=cce7c88c6af95b485776124fc547e5fd47874431;hpb=9b7d7440e82b8cd9d77b9e3abeb87530799baeb4;p=dpdk.git diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h index cce7c88c6a..ba166412cc 100644 --- a/drivers/common/mlx5/windows/mlx5_common_os.h +++ b/drivers/common/mlx5/windows/mlx5_common_os.h @@ -7,9 +7,13 @@ #include +#include + #include "mlx5_autoconf.h" #include "mlx5_glue.h" #include "mlx5_malloc.h" +#include "mlx5_common_mr.h" +#include "mlx5_win_ext.h" /** * This API allocates aligned or non-aligned memory. The free can be on either @@ -48,4 +52,103 @@ mlx5_os_free(void *addr) { _aligned_free(addr); } + +/** + * Get fd. Given a pointer to DevX channel object of type + * 'struct mlx5dv_devx_event_channel*' - return its fd. + * Under Windows it is a stub. + * + * @param[in] channel + * Pointer to channel object. + * + * @return + * 0 + */ +static inline int +mlx5_os_get_devx_channel_fd(void *channel) +{ + if (!channel) + return 0; + return 0; +} + +/** + * Get device name. Given a device pointer - return a + * pointer to the corresponding device name. + * + * @param[in] dev + * Pointer to device. + * + * @return + * Pointer to device name if dev is valid, NULL otherwise. + */ +static inline const char * +mlx5_os_get_dev_device_name(void *dev) +{ + if (!dev) + return NULL; + return ((struct devx_device *)dev)->name; +} + +/** + * Get device name. Given a context pointer - return a + * pointer to the corresponding device name. + * + * @param[in] ctx + * Pointer to context. + * + * @return + * Pointer to device name if ctx is valid, NULL otherwise. + */ +static inline const char * +mlx5_os_get_ctx_device_name(void *ctx) +{ + if (!ctx) + return NULL; + return ((mlx5_context_st *)ctx)->mlx5_dev.name; +} + +/** + * Get a device path name. Given acontext pointer - return a + * pointer to the corresponding device path name. + * + * @param[in] ctx + * Pointer to context. + * + * @return + * Pointer to device path name if ctx is valid, NULL otherwise. + */ + +static inline const char * +mlx5_os_get_ctx_device_path(void *ctx) +{ + if (!ctx) + return NULL; + return ((mlx5_context_st *)ctx)->mlx5_dev.dev_pnp_id; +} + +/** + * Get umem id. Given a pointer to umem object of type return its id. + * + * @param[in] umem + * Pointer to umem object. + * + * @return + * The umem id if umem is valid, 0 otherwise. + */ +static inline uint32_t +mlx5_os_get_umem_id(void *umem) +{ + if (!umem) + return 0; + return ((struct mlx5_devx_umem *)umem)->umem_id; +} + +void *mlx5_os_alloc_pd(void *ctx); +int mlx5_os_dealloc_pd(void *pd); +void *mlx5_os_umem_reg(void *ctx, void *addr, size_t size, uint32_t access); +int mlx5_os_umem_dereg(void *pumem); +int mlx5_os_reg_mr(void *pd, + void *addr, size_t length, struct mlx5_pmd_mr *pmd_mr); +void mlx5_os_dereg_mr(struct mlx5_pmd_mr *pmd_mr); #endif /* RTE_PMD_MLX5_COMMON_OS_H_ */