C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2088|回复: 0

[资料下载] WLS共享内存 学习资料 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2020-8-20
发表于 2021-4-12 11:06:39 |显示全部楼层
本帖最后由 13651314181 于 2021-4-12 11:08 编辑

来源于:
https://www.cnblogs.com/xuperior/p/14585356.html
来源:
https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-phy/en/latest/wls-lib.html
Wls_lib是英特尔开元的一个无线服务库,支撑实现gNb或eNb的应用程序使用的共享内存和缓冲区管理。该库使用DPDK、libhugetlbfs和pthreads,通过从DPDK的角度共享相同的内存区域,在二级应用程序、API转换器模块和一级应用程序之间提供无内存的数据交换。
Project ResourcesThe source code is avalable from the Linux Foundation Gerrit server:https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=summary  ---- 可以自选一个snapshot查看源码实现
https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git

Library Functions 基本库函数
WLS_Open() and WLS_Open_Dual() that open a single or dual wls instance interface and registers the instance with the kernel space driver.
WLS_Close(), WLS_Close1() closes the wls instance and deregisters it from the kernel space driver.
WLS_Ready(), WLS_Ready1() checks state of remote peer of WLS interface and returns 1 if remote peer is available.
WLS_Alloc() allocates a memory block for data exchange shared memory. This block uses hugepages.
WLS_Free() frees memory block for data exchange shared memory.
WLS_Put(), WLS_Put1() puts memory block (or group of blocks) allocated from WLS memory into the interface for transfer to remote peer.
WLS_Check(), WLS_Check1() checks if there are memory blocks with data from remote peer and returns number of blocks available for “get” operation.
WLS_Get(), WLS_Get1() gets memory block from interface received from remote peer. Function is a non-blocking operation and returns NULL if no blocks available.
WLS_Wait(), WLS_Wait1() waits for new memory block from remote peer. This Function is a blocking call and returns number of blocks received.
WLS_WakeUp(), WLS_WakeUp1() performs “wakeup” notification to remote peer to unblock “wait” operations pending.
WLS_Get(), WLS_Get1() gets a memory block from the interface received from remote peer. This Function is blocking operation and waits till next memory block from remote peer.
WLS_VA2PA() converts virtual address (VA) to physical address (PA).
WLS_PA2VA() converts physical address (PA) to virtual address (VA).
WLS_EnqueueBlock(), WLS_EnqueueBlock1() This function is used by a master or secondary master to provide memory blocks to a slave for next slave to master (sec master) transfer of data.
WLS_NumBlocks() returns number of current available blocks provided by master for a new transfer of data from the slave.
The _1() functions are only needed when using the WLS_Open_Dual().
Building and InstallationRetrieve the source files from the Linux Foundation Gerrit server:https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=summary
  • cd wls_lib
  • wls_lib$ ./build.sh xclean
  • wls_lib$ ./build.sh
The shared library is available at wls_lib/lib
This library is used by the ODUHIGH, shin layer implementing a 5G FAPI to IAPI translator and the ODULOW components.
Please define an environment variable DIR_WIRELESS_WLS with the path to the root folder of the wls_lib as it is needed for the fapi_5g build process.
编译依赖DPDK,需要编译好DPDK lib提供基本的rte静态库和头文件。

下载最新的节点,看看里面都用了啥?
phy-81a0969.tar.gz

wls_lib 下 Makefile
ifeq ($(RTE_SDK),)   #依赖dpdk的编译结果
$(error "Please define RTE_SDK environment variable")
endif
# Default target, can be overridden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-icc   # 默认英特尔的 ICC 大家可以设置成 gcc
RTE_OUTPUT = ${PWD}
include $(RTE_SDK)/mk/rte.vars.mk
SRCS-y := wls_lib_dpdk.c syslib.c  # 实现代码都在这2个C文件中
SHARED = libwls.so  # 输出动态库
CFLAGS +=-Wall -fstack-protector
EXTRA_CFLAGS +=-g
include $(RTE_SDK)/mk/rte.extshared.mk  #依赖dpdk的环境变量设置
##############################################################
wls_initialize
初始化由 RTE_PROC_PRIMARY 进程实行

rte_memzone_reserve_aligned
多申请sizeof(wls_drv_ctx_t)保存上下文信息;该wls_drv_ctx_t信息是保存在数据位尾部分
pthread_mutexattr_init(&attr);
pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
if (ret = pthread_mutex_init(&mng_ctx->mng_mutex, &attr)) {
PLIB_ERR("Failed to initialize mng_mutex %d\n", ret);
pthread_mutexattr_destroy(&attr);
return ret;
}
pthread_mutexattr_destroy(&attr);

pWls_us=wls_create_us_ctx
初始化队列
SFL_DefQueue(&pUsCtx->ul_free_block_pq, pUsCtx->ul_free_block_storage,
UL_FREE_BLOCK_QUEUE_SIZE * sizeof (void*));
WLS_MsgDefineQueue(&pUsCtx->get_queue, pUsCtx->get_storage, WLS_GET_QUEUE_N_ELEMENTS, 0);
WLS_MsgDefineQueue(&pUsCtx->put_queue, pUsCtx->put_storage, WLS_PUT_QUEUE_N_ELEMENTS, 0);

sem_init(&pUs_priv->sema.sem
pWls_us 返回给用户




举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-16 17:48 , Processed in 0.268238 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图