X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcommon%2Fmlx5%2Fwindows%2Fmlx5_common_os.h;h=3756e1959b408add0341873e1e795f4d48cdfebe;hb=9a4c36880704438a8801cf4c58a434b04007a91c;hp=decb5acd45259161a0d89657f6752a528de1fd11;hpb=1969ee4244057b9957787ad41fd884be253e05c1;p=dpdk.git diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h index decb5acd45..3756e1959b 100644 --- a/drivers/common/mlx5/windows/mlx5_common_os.h +++ b/drivers/common/mlx5/windows/mlx5_common_os.h @@ -6,10 +6,17 @@ #define RTE_PMD_MLX5_COMMON_OS_H_ #include +#include + +#include #include "mlx5_autoconf.h" #include "mlx5_glue.h" #include "mlx5_malloc.h" +#include "mlx5_common_mr.h" +#include "mlx5_win_ext.h" + +#define MLX5_BF_OFFSET 0x800 /** * This API allocates aligned or non-aligned memory. The free can be on either @@ -140,8 +147,118 @@ mlx5_os_get_umem_id(void *umem) return ((struct mlx5_devx_umem *)umem)->umem_id; } +/** + * Get mmap offset. Given a pointer to an DevX UAR object of type + * 'struct mlx5dv_devx_uar *' - return its mmap offset. + * In Windows, mmap_offset is unused. + * + * @param[in] uar + * Pointer to UAR object. + * + * @return + * 0 as mmap_offset is unused + */ +static inline off_t +mlx5_os_get_devx_uar_mmap_offset(void *uar) +{ + RTE_SET_USED(uar); + return 0; +} + +/** + * Get base addr pointer. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its base address. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The base address if UAR is valid, NULL otherwise. + */ +static inline void * +mlx5_os_get_devx_uar_base_addr(void *uar) +{ + if (!uar) + return NULL; + return ((devx_uar_handle *)uar)->uar_page; +} + +/** + * Get reg addr pointer. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its reg address. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The reg address if UAR is valid, NULL otherwise. + */ +static inline void * +mlx5_os_get_devx_uar_reg_addr(void *uar) +{ + if (!uar) + return NULL; + return ((char *)((devx_uar_handle *)uar)->uar_page) + MLX5_BF_OFFSET; +} + +/** + * Get page id. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its page id. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The page id if UAR is valid, 0 otherwise. + */ +static inline uint32_t +mlx5_os_get_devx_uar_page_id(void *uar) +{ + if (!uar) + return 0; + return ((devx_uar_handle *)uar)->uar_index; +} + +static inline void * +mlx5_os_devx_create_event_channel(void *ctx, int flags) +{ + (void)ctx; + (void)flags; + errno = ENOTSUP; + return NULL; +} + +static inline void +mlx5_os_devx_destroy_event_channel(void *eventc) +{ + (void)eventc; +} + +static inline int +mlx5_os_devx_subscribe_devx_event(void *eventc, + void *obj, + uint16_t events_sz, uint16_t events_num[], + uint64_t cookie) +{ + (void)eventc; + (void)obj; + (void)events_sz; + (void)events_num; + (void)cookie; + return -ENOTSUP; +} + +__rte_internal void *mlx5_os_alloc_pd(void *ctx); +__rte_internal int mlx5_os_dealloc_pd(void *pd); +__rte_internal void *mlx5_os_umem_reg(void *ctx, void *addr, size_t size, uint32_t access); +__rte_internal int mlx5_os_umem_dereg(void *pumem); +__rte_internal +int mlx5_os_reg_mr(void *pd, + void *addr, size_t length, struct mlx5_pmd_mr *pmd_mr); +__rte_internal +void mlx5_os_dereg_mr(struct mlx5_pmd_mr *pmd_mr); #endif /* RTE_PMD_MLX5_COMMON_OS_H_ */