描述

ibv_query_port()返回RDMA设备上下文(context)的端口的属性。
这是struct ibv_port_attr的完整描述:

Name Protocol Description
state IB/IBoE/iWARP

逻辑端口状态。它可以是下列枚举值之一:

  • IBV_PORT_NOP - 保留值, 不应该出现
  • IBV_PORT_DOWN - 逻辑链接已断开。端口的物理链路未up。在这种状态下,链路层将丢弃递送给它的所有数据包。
  • IBV_PORT_INIT - 逻辑链接正在初始化。端口的物理链路已建立,但SM尚未配置逻辑链路。在这种状态下,链路层只能接收和发送SMP和流控制链路数据包,递交给它的其他类型的数据包将被丢弃
  • IBV_PORT_ARMED - 逻辑链接已布防(Logical link is Armed)。端口的物理链路已建立,但SM尚未完全配置逻辑链路。在这种状态下,链路层可以接收和发送SMP和流控制链路数据包,可以接收其他类型的数据包,但是会丢弃非SMP数据包以进行发送。(but discards non SMP packets for sending)
  • IBV_PORT_ACTIVE - 逻辑链接是活动的。链路层可以发送和接收所有数据包类型
  • IBV_PORT_ACTIVE_DEFER - 逻辑链接处于“活动延迟”状态。逻辑链接为活动,但物理链接出现故障。如果错误在超时之前恢复,则逻辑链接将返回到IBV_PORT_ACTIVE,否则它将移动到IBV_PORT_DOWN

(If the error will be recovered within a timeout, the logical link will return to IBV_PORT_ACTIVE, otherwise it will move to IBV_PORT_DOWN

max_mtu IB/IBoE/iWARP

该端口支持的最大MTU。它可以是下列枚举值之一:

  • IBV_MTU_256 - MTU is 256 bytes
  • IBV_MTU_512 - MTU is 512 bytes
  • IBV_MTU_1024 - MTU is 1024 bytes
  • IBV_MTU_2048 - MTU is 2048 bytes
  • IBV_MTU_4096 - MTU is 4096 bytes
active_mtu IB/IBoE/iWARP

Active maximum MTU enabled on this port to transmit and receive. It can be one of the following enumerated values which specified for max_mtu. This value specify the maximum message size that can be configured in UC/RC QPs and the maximum message size that an UD QP can transmit

在此端口上启用的最大活动MTU进行发送和接收。它可以是为max_mtu指定的以下枚举值之一。此值指定可以在UC / RC QP中配置的最大消息大小以及UD QP可以传输的最大消息大小

gid_tbl_len IB/IBoE/iWARP Length of the Source GID Table of this port
port_cap_flags IB/IBoE/iWARP Port's supported capabilities as bitwise ORed of the following numeric values since those values aren't enumerated:

  • 1 << 1   - Indication that the SM that manages the subnet sending the packets from this port
  • 1 << 10 - Indication that there is an SM which isn't active in this port
  • 1 << 17 - Indication that an SNMP Tunneling agent is listening on this port
  • 1 << 19 - Indication that a Device Management agent is listening on this port
  • 1 << 20 - Indication that a Vendor specific agent is listening on this port
  • 1 << 25 - Indication that this port capable of generating the IBV_EVENT_CLIENT_REREGISTER asynchronous event
max_msg_sz IB/IBoE/iWARP Maximum message size supported by this port
bad_pkey_cntr IB/IBoE Bad P_Key counter of the port, if supported by the device (IBV_DEVICE_BAD_PKEY_CNTR is set in dev_cap.device_cap_flags)
qkey_viol_cntr IB/IBoE Q_Key violations packets of the port, if supported by the device (IBV_DEVICE_BAD_QKEY_CNTR is set in dev_cap.device_cap_flags)
pkey_tbl_len IB/IBoE*/iWARP* Length of the partition table of this port
lid IB The base LID of this port, valid only if state is IBV_PORT_ARMED or IBV_PORT_ACTIVE
sm_lid IB The LID of the SM that manages this port
lmc IB Port LID mask of this port (used in multipath), valid only if state is IBV_PORT_ARMED or IBV_PORT_ACTIVE
max_vl_num IB The maximum number of VLs supported by this port. There isn't any enumeration of this value, and the numeric value can be one of the following:

  • 1 - 1 VL: VL0
  • 2 - 2 VLs: VL0, VL1
  • 3 - 4 VLs: VL0 - VL3
  • 4 - 8 VLs: VL0 - VL7
  • 5 - 15 VLs: VL0 - VL14
sm_sl IB The SL of the SM that manages this port
subnet_timeout IB Specifies the maximum expected subnet propagation delay, which depends upon the configuration of the switches, to reach any other port in the subnet and also used to determine the maximum rate which SubnTrap()s can be sent from this port.
The duration of time is calculated based on: 
init_type_reply IB Value configured by the SM prior to changing the port to IBV_PORT_ACTIVE or IBV_PORT_ARMED state that indicates the type of initialization performed, if supported by the device (IBV_DEVICE_INIT_TYPE is set in dev_cap.device_cap_flags)
active_width IB/IBoE*/iWARP* The active link width of this port. There isn't any enumeration of this value, and the numeric value can be one of the following:

  • 1 - 1x
  • 2 - 4x
  • 4 - 8x
  • 8 - 12x
active_speed IB/IBoE*/iWARP* The active link speed of this port. There isn't any enumeration of this value, and the numeric value can be one of the following:

  • 1 - 2.5 Gbps
  • 2 - 5.0 Gbps
  • 4 - 10.0 Gbps
  • 8 - 10.0 Gbps
  • 16 - 14.0 Gbps
  • 32 - 25.0 Gbps
phys_state IB The physical link status. There isn't any enumeration for this value, and the numeric value can be one of the following:

  • 1 - Sleep: The port drives its output to quiescent levels and does not respond to received data. In this state, the link is deactivated  without powering off the port
  • 2 - Polling: The port transmits training sequences and responds to receive training sequences.
  • 3 - Disabled: The port drives its output to quiescent levels and does not respond to receive data
  • 4 - PortConfigurationTraining: Both transmitter and receive active and the port is attempting to configure and transition to the LinkUp state
  • 5 - LinkUp: The port is available to send and receive packets
  • 6 - LinkErrorRecovery: Port attempts to re-synchronize the link and return it to normal operation
  • 7 - Phytest: Port allows the transmitter and received circuitry to be tested by external test equipment for compliance with the transmitter and receiver specifications
link_layer IB/IBoE/iWARP The link layer protocol used by this port. It can be one of the following enumerated values:

  • IBV_LINK_LAYER_UNSPECIFIED - Legacy value, used to indicate that the link layer protocol is InfiniBand
  • IBV_LINK_LAYER_INFINIBAND - Link layer protocol is InfiniBand
  • IBV_LINK_LAYER_ETHERNET - Link layer protocol is Ethernet, thus IBoE (or RoCE) can be used

* supported, but not really relevant

Most of the port attributes, returned by ibv_query_port(), aren't constant and may be changed, mainly by the SM (in InfiniBand), or by the Hardware. It is highly recommended avoiding saving the result of this query, or to flush them when a new SM (re)configures the subnet.

Parameters

Name Direction Description
context in RDMA device context, that was returned from ibv_open_device()
port_num in Port number to query, values can be [1..dev_cap.phys_port_cnt]
port_attr out Port attributes

Return Values

Value Description
0 On success
errno On failure
EINVAL port_num is invalid
ENOMEM Out of memory

Examples

Query a port attributes:

struct ibv_port_attr port_attr;
int port_num = 1;rc = ibv_query_port(ctx, port_num, &port_attr);
if (rc) {fprintf(stderr, "Error, failed to query port %d attributes in device '%s'\n",port_num, ibv_get_device_name(ctx->device));return -1;
}

show_port_attr.c

FAQs

I'm using iWarp/IBoE, do I need all of the values that ibv_query_port() returns?

No. Check the protocol columns, to understand which attributes are relevant for you.

I'm using IB, do I need all of the values that ibv_query_port() returns?

No. There are fields that you will use more often (such as state), some you may use when debugging problems (the counters) and some of them are informative for other services.

Calling every time to ibv_query_port() when I need a port attribute takes time, can I cache some of the attributes?

Actually, yes. The attributes, which indicates the port supported attributes (such as supported table length and capabilities) won't change, but others, which are configured by the SM, state and counters may change.

In InfiniBand, if you want, you can cache the returned structure and query it only when an unaffiliated asynchronous event occurred (this will be discussed later on in other posts).

【verbs】ibv_query_port()相关推荐

  1. 【verbs】ibv_get_cq_event|ibv_ack_cq_events()

    目录 ibv_get_cq_event 概要 描述 返回值 提示 ibv_ack_cq_events 描述 参数 返回值 例子 常见问题 ibv_get_cq_event ibv_get_cq_eve ...

  2. 【verbs】ibv_get_async_event()

    原文:ibv_get_async_event() - RDMAmojo RDMAmojo 描述 ibv_get_async_event() 读取 RDMA 设备上下文context的下一个异步事件. ...

  3. 【verbs】ibv_create_comp_channel()

    原文:ibv_create_comp_channel() - RDMAmojo RDMAmojo 描述 ibv_create_comp_channel() 为 RDMA 设备上下文创建完成事件通道. ...

  4. 【verbs】ibv_req_notify_cq()

    ibv_req_notify_cq() - RDMAmojo RDMAmojo 描述 ibv_req_notify_cq() 在完成队列 (CQ) 上请求Completion Notification ...

  5. 【RDMA】12. RDMA之Verbs|OFED

    目录 verbs源码 相关名词解释 Verbs API是什么 设计Verbs API的原因 Verbs API所包含的内容 使用Verbs API编写RDMA应用程序 官方示例程序 参考文献 [RDM ...

  6. 【RDMA】RDMA编程 和相关资料

    目录 RDMA的学习环境搭建 RDMA与socket的类比 RDMA编程流程 RDMA编程2 RDMA学习路线总结 简介--什么是rdma 编程环境 推荐编程库 编程参考手册 相关资料和代码参考 rd ...

  7. 【推荐】LSI(latent semantic indexing) 完美教程

    [推荐]LSI(latent semantic indexing) 完美教程 "instead of lecturing about SVD I want to show you how t ...

  8. 【写作】Texlive和Texmaker学习

    前言 最近要看一些论文做一下笔记,所以准备使用一下比较流行的Texlive和Texmaker写一下.其实CSDN的Markdown也是不错滴. 首先国际惯例,贴几个地址: Texlive镜像下载地址: ...

  9. 【RDMA】19. RDMA之iWARP Soft-iWARP

    [RDMA]RDMA 学习资料总目录_bandaoyu的博客-CSDN博客SavirRDMA 分享1. RDMA概述https://blog.csdn.net/bandaoyu/article/det ...

  10. 【RDMA】14. RDMA之Memory Window

    [RDMA]RDMA 学习资料总目录_bandaoyu的笔记-CSDN博客SavirRDMA 分享1. RDMA概述https://blog.csdn.net/bandaoyu/article/det ...

最新文章

  1. 最强 Android Studio 使用小技巧和快捷键
  2. Jquery中css()方法获取边框长度
  3. Python re 模块findall() 函数返回值展现方式详解
  4. excel判断字符串包含另一个字符串_【前端冷知识】如何正确判断一个字符串是数值?...
  5. 【MFC系列2】Win32项目转换为MFC项目
  6. 初级算法-12.反转字符串
  7. python转换函数使用_Python Socket模块中的IP转换函数
  8. 编译:ffmpeg,精简ffmpeg.exe
  9. ios 自定义View 卡片滑动切换效果
  10. 01-SpringMVC 原理
  11. 各种类型变量的定义以及赋值
  12. HTML - 脚本JavaScript
  13. ELK详解(七)——Kibana部署
  14. Linux局域网传输文件
  15. 解决eclipse在编辑时字体变成繁体字的问题
  16. IPv4向IPv6转换的几种技术分析
  17. 萌新的51之旅——串口通信(2)
  18. 竞品分析 | 百词斩竞品分析报告
  19. 【总结整理】产品经理技术
  20. Sketchup 程序自动化(二)Ruby 基础、单位转换

热门文章

  1. BetterBackdoor多功能后门工具的部署
  2. excel打不开xlsx文件怎么办?
  3. 【iOS】一个方法读取图片中的二维码信息
  4. 一种特殊的魔方阵解法
  5. java正整数分解因数_java如何将一个正整数分解质因数
  6. Qt Moc及信号-槽源代码解析
  7. 狂神说Swagger笔记
  8. 用户主页个性域名技术实现
  9. 【实习日报】2019年6月下半月 前端开发实习工作日报汇总
  10. tp6 的unique验证