iser: aggregate ack completion queue (CQ) events
Signed-off-by: wanghonghao <wanghonghao@bytedance.com>
This commit is contained in:
@@ -189,6 +189,7 @@ struct iser_conn {
|
|||||||
uint32_t num_rx_descs;
|
uint32_t num_rx_descs;
|
||||||
unsigned int rx_desc_head;
|
unsigned int rx_desc_head;
|
||||||
|
|
||||||
|
unsigned int cq_nevents;
|
||||||
int post_recv_buf_count;
|
int post_recv_buf_count;
|
||||||
int qp_max_recv_dtos;
|
int qp_max_recv_dtos;
|
||||||
int min_posted_rx;
|
int min_posted_rx;
|
||||||
|
|||||||
13
lib/iser.c
13
lib/iser.c
@@ -33,6 +33,7 @@
|
|||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -444,6 +445,10 @@ iser_free_iser_conn_res(struct iser_conn *iser_conn, bool destroy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iser_conn->cq) {
|
if (iser_conn->cq) {
|
||||||
|
if (iser_conn->cq_nevents > 0) {
|
||||||
|
ibv_ack_cq_events(iser_conn->cq, iser_conn->cq_nevents);
|
||||||
|
iser_conn->cq_nevents = 0;
|
||||||
|
}
|
||||||
ret = ibv_destroy_cq(iser_conn->cq);
|
ret = ibv_destroy_cq(iser_conn->cq);
|
||||||
if (ret)
|
if (ret)
|
||||||
iscsi_set_error(iscsi, "Failed to destroy cq");
|
iscsi_set_error(iscsi, "Failed to destroy cq");
|
||||||
@@ -1132,6 +1137,7 @@ static int iser_addr_handler(struct rdma_cm_id *cma_id) {
|
|||||||
iscsi_set_error(iscsi, "Failed to create cq\n");
|
iscsi_set_error(iscsi, "Failed to create cq\n");
|
||||||
goto pd_error;
|
goto pd_error;
|
||||||
}
|
}
|
||||||
|
iser_conn->cq_nevents = 0;
|
||||||
|
|
||||||
if (ibv_req_notify_cq(iser_conn->cq, 0)) {
|
if (ibv_req_notify_cq(iser_conn->cq, 0)) {
|
||||||
iscsi_set_error(iscsi, "ibv_req_notify_cq failed\n");
|
iscsi_set_error(iscsi, "ibv_req_notify_cq failed\n");
|
||||||
@@ -1514,8 +1520,11 @@ static int cq_handle(struct iser_conn *iser_conn)
|
|||||||
|
|
||||||
ret = ibv_req_notify_cq(iser_conn->cq, 0);
|
ret = ibv_req_notify_cq(iser_conn->cq, 0);
|
||||||
|
|
||||||
/* TODO: aggregate ack cq event for efficiency */
|
if (++iser_conn->cq_nevents >= INT_MAX) {
|
||||||
ibv_ack_cq_events(iser_conn->cq, 1);
|
ibv_ack_cq_events(iser_conn->cq, iser_conn->cq_nevents);
|
||||||
|
iser_conn->cq_nevents = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
iscsi_set_error(iscsi, "failed notify or ack CQ");
|
iscsi_set_error(iscsi, "failed notify or ack CQ");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user