【微知】Mellanox驱动中UAR是什么?Mkey是什么作用是什么?TPT机制是什么?MPT表是什么?

UAR

UAR(User Access Region),用户访问区域

a memory region that can be mapped directly to an un-trusted application by the OS and can be addressed by non-privileged code
The HCA provides a memory region that can be mapped directly to an un-trusted application by the OS and can be addressed by non-privileged code. This region is used to allow unprivileged applications to access needed HCA resources, such as ringing DoorBells, from userspace. Each process should get a distinct page mapped to this region to access HCA for data path operation, thereby isolating HCA access between the processes

Memory key

网卡设备将VA获取PA是使用memory key的地址空间标识符来处理。

The device translates the given virtual address to a physical address using the given memory key as an address space identifier. Memory protection checks are done in this stage.

在这里插入图片描述
Mkey用于在MTT表中根据VA查询PA,
在这里插入图片描述

地址转换流举例:
在这里插入图片描述

TPT

Translation and Protection (TPT)是网卡上的几个机制。传输和保护机制。

MPT表

Memory Protection Table(MPT)就是存的Mkey

Mkey创建流程

通过CREATE_MKEY的 cmd下发来创建。

Memory Key object is initialized (created) by the privileged SW entity using the CREATE_MKEY command.

这里的key本质就是键值对Key-value的key,不是钥匙,而是键值。
Mkey是用来地址转换查询的index。所以叫mkey。

为了注册一个内存区域,软件应该分配和配置MKey context,配置方式是下发ALLOC_MKEY命令给网卡,并且穿点MKey的参数,最后由硬件分配的Mkey的handle(一个数字)会传递给命令下发的返回接收数据里面。相反的,如果要de-register一个Memory Region,软件应该下发DEALLOC_MKEY,并且根据Mkey的handle来指定。

PTP相关的Mkey命令

在这里插入图片描述

创建Mkey

CREATE_MKEY – Create MKey Entry 创建MKey实体,用来生成新的Mkeys。
软件使用一个input mailbox来传递MKey object到硬件,硬件提供一个Mkey的index作为输出的参数给软件。这个index也就是Mkey的handle,软件用它作为后期访问这个object的index。

input struct

他的input struct格式:
在这里插入图片描述
可以看到代码中定义input mailbox的数据结构:
在这里插入图片描述

output struct

硬件返回给软件的output struct结构:
在这里插入图片描述

以及output mailbox的结构:其中关键点就是 mkey_index
在这里插入图片描述

删除Mkey

删除Mkey是下发DESTROY_MKEY的命令
input结构是关键点指定opcode之后,执行mkey_index
在这里插入图片描述
硬件的返回(output)的结构是:(可以看到关键点是status装填,以及syndrome的错误信息)
在这里插入图片描述

再看OFED中如何创建Mkey以及获取返回数据的

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值