[中英对照] How to flush a Work Queue?

来源: http://www.rdmamojo.com/2013/07/13/how-to-flush-a-work-queue/ 


When one wishes to stop the outstanding Work Requests from being processed, flushing the Work Queues may be useful. The most common reason for doing this is to reclaim the memory buffers that the Work Requests refer to. Another reason is to stop working with specific Work Queues (for example, stop sending/receiving data by a specific local QP).

当希望停止正在处理中的但是悬而未决的WR时,对工作队列(WQ)进行刷新可能是有用的。这样做的最常见的原因是回收工作请求(WR)引用的内存缓冲区。另一个原因是停止使用特定的工作队列(例如,停止发送/接收数据,通过一个特定的本地QP)。

Once Work Requests were posted to a Work Queue, one cannot know what is their status (until the Work Completions for them were polled):

一旦工作请求(WR)被放置到工作队列(WQ), 那么就无从知道WR的状态(除非去对应的完成队列(CQ)中轮询WR):

o Maybe for some of them, the processing hasn't started

也许一些WR还没有开始执行

o Maybe for some of them, the processing has started, but wasn't completed

也许一些WR已经开始执行了,但是还没有完成

o Maybe for some of them, the processing was completed, but the Work Completion for them weren't polled yet

也许一些WR已经执行完成了,但是还没有去完成队列里轮寻它们

Flushing a Work Queue will only take care of Work Requests that weren't completed. Only Work Queue(s) can be flushed and not a specific Work Requests.

刷新工作队列只关注那些没有完成的WR。只有工作队列(WQ)可以被刷新,而不是特定的工作请求(WR)被刷新。

In this post, we will describe how to flush the Work Requests in the Send and in the Receive Queues.

在本文中,我们将描述如何刷新发送/接收队列里的WR。

Flushing a Send Queue | 刷新发送队列

The Work Requests in the Send Queue initiate data transfer either from local to remote memory or backwards (depends on the used opcode).

在发送队列(SQ)中的工作请求(WR i.e. WQE)开始一个数据传输, 从本地内存到远端内存或者相反(取决于使用的操作码)。

When one flushes the Send Queue, he doesn't know what is the status of the outstanding Work Requests in it and he should be ready for the case that part (or all) of them were completed.

当刷新发送队列(SQ)的时候,并不知道那些悬而未决的工作请求(WR)的状态。可能部分WR已经完成了,也可能全部WR都完成了。

In order to flush the Send Queue, one should call ibv_modify_qp() and move the QP to the Error state.

为了刷新发送队列(SQ),需要调用ibv_modify_qp(),然后将QP移动到错误状态。

This action will flush all of the Work Requests in the Send Queue that weren't completed and for each of them a Work Completion with the "Flushed in Error" status will be generated.

这一操作将刷新发送队列(SQ)里的所有未完成的WR, 对这些WR中的每一个WR,都将生成一个工作完成(WC, i.e. CQE), 对应的状态为"Flushed in Error"。

The Send Queue may be flushed if the QP will be transferred by the RDMA device to the Error state (in RC QP) or to the Send Queue Error state (in UC and UD QPs) because of an error in the Send Queue.

发送队列(SQ)可能被刷新,如果RDMA设备将QP转换到错误状态(在RC QP中)或者发送队列错误状态(在UC和UD QP中), 由于在发送队列(SQ)中存在一个错误。

Flushing a Receive Queue of a QP which isn't associated with an SRQ | 刷新接收队列,没有QP被关联到共享的接收队列(SRQ)

The Work Requests in the Receive Queue specify to which memory buffers the incoming messages to this QP, that consume a Receive Request, will be written.

接收队列里的WR指定哪些内存缓冲区要被写入, 当这个QP中进来的消息消费了一个接收请求(RR)的时候。

When one flushes the Receive Queue, he doesn't know what is the status of the outstanding Work Requests in it and he should be ready for the case that part (or all) of them were completed.

当刷新接收队列(RQ)的时候,并不知道那些悬而未决的工作请求(WR)的状态。可能部分WR已经完成了,也可能全部WR都完成了。

In order to flush a Receive Queue in a QP that isn't associated with an SRQ, one should call ibv_modify_qp() and move the QP to the Error state.

为了刷新没有QP被关联到SRQ的接收队列(SQ),需要调用ibv_modify_qp(),然后将QP移动到错误状态。

This action will flush all of the Work Requests in the Receive Queue that weren't completed and for each of them a Work Completion with the "Flushed in Error" status will be generated.

这一操作将刷新接收队列(RQ)里的所有未完成的WR, 对这些WR中的每一个WR,都将生成一个工作完成(WC, i.e. CQE), 对应的状态为"Flushed in Error"。

The Receive Queue may be flushed if the QP, from any transport type, will be transferred by the RDMA device to the Error state.

接收队列可以被刷新,对任何传输类型的QP都可以,将通过RDMA设备被转移到错误状态。

Flushing a Receive Queue of a QP which is associated with an SRQ | 刷新接收队列,有QP被关联到共享的接收队列(SRQ)

The Work Requests in the Receive Queue specify to which memory buffers the incoming messages to any QP, which is associated with the SRQ, that consume a Receive Request will be written.

接收队列里的WR指定哪些内存缓冲区要被写入, 当关联到SQP中的任何一个QP中进来的消息消费了一个接收请求(RR)的时候。

When one flushes the Receive Queue, he doesn't know what is the status of the outstanding Work Requests in it and he should be ready for the case that part (or all) of them were completed.

当刷新接收队列(RQ)的时候,并不知道那些悬而未决的工作请求(WR)的状态。可能部分WR已经完成了,也可能全部WR都完成了。

In order to flush the Receive Queue in a QP that is associated with an SRQ, one should call ibv_modify_qp() and move the QP to the Error state.

为了刷新有QP被关联到SRQ的接收队列(SQ),需要调用ibv_modify_qp(),然后将QP移动到错误状态。

This action will flush all of the Work Requests in the QP's Receive Queue that were fetched from the SRQ and their processing wasn't completed. For each of them a Work Completion with the "Flushed in Error" status will be generated.

这一行为将刷新QP的RQ中所有的WR, 这些WR来自SRQ, 而且处理尚未完成。 对这些WR中的每一个WR,都将生成一个工作完成(WC, i.e. CQE), 对应的状态为"Flushed in Error"。

The Receive Queue may be flushed if the QP, from any transport type, will be transferred by the RDMA device to the Error state.

接收队列可以被刷新,对任何传输类型的QP都可以,将通过RDMA设备被转移到错误状态。

The SRQ itself cannot be flushed and the posted Receive Requests in it cannot be reclaimed. One possible workaround for this can be to associate a QP with this SRQ and consume all of the WRs from this SRQ by sending messages with an opcode that consumes a Receive Request.

SRQ本身不能被刷新,放置到它上面的接收请求(RR)不能被回收。 一个可能的解决方法是可以关联一个QP到这个SRQ上,和通过发送消息消耗掉SRQ上所有的WR(发送的每一条消息都有opcode,消费一条RR)。


09/24/2017 Sun

你可能感兴趣的:([中英对照] How to flush a Work Queue?)