Project

General

Profile

Bug #2936

FIONBIO cause ksocket_recvmsg speed down?

Added by eric zhang almost 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2012-06-26
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

i have one kernel module run in two units. one unit act client and one act server. client send the message to server and server receive message. inorder to no block when accept in server unit, i set the FIONBIO before accept and after listen, but after set the FIONBIO flag, the send and recv bytes just half of the normal. ksocket_recvmsg and ksocket_sendmsg all use MSG_WAITALL flag.

if don't set FIONBIO flag, the speed is 800MB~1000MB, if set, the speed is about 450MB . the units has 10Gb nic.

client:
struct msghdr msg;
bzero(&msg, sizeof(struct msghdr));
struct iovec iov;
bzero(&iov, sizeof(struct iovec));
*sent = 0;
//caddr_t buf = (caddr_t)client_buf;
msg.msg_flags = MSG_DONTWAIT;
msg.msg_name = NULL;
iov.iov_base = p;
iov.iov_len = g_send_size;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
int flag = msg.msg_flags;
DPRINTK;
ret = ksocket_sendmsg(conn->con_sock, &msg, flag, sent, CRED);

server:
struct msghdr msg;
bzero(&msg, sizeof(struct msghdr));
struct iovec iov;
bzero(&iov, sizeof(struct iovec));
*sizep = 0;

//buf = server_buf;
msg.msg_flags = MSG_DONTWAIT;
msg.msg_name = NULL;
iov.iov_base = p;
iov.iov_len = 40960;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
int flag = msg.msg_flags;
size_t sent = 0;
ret = ksocket_recvmsg(conn->con_sock, &msg, flag, sizep, CRED());

server sock create:
ret = ksocket_socket(&sock, AF_INET, SOCK_STREAM, IPPROTO_TCP, KSOCKET_SLEEP, CRED);
if (ret != VICM_SUCCESS|| sock == NULL) {
DPRINTK;
goto FAIL;
}

ret = ksocket_bind(sock, (struct sockaddr *)&svaddr, sizeof(svaddr), CRED());
if (ret != VICM_SUCCESS) {
DPRINTK(ERR, "server bind addr error %d\n", ret);
ksocket_close(sock, CRED());
goto FAIL;
}
ret = ksocket_listen(sock, VICM_COMM_MAX_CONN, CRED());
if (ret != VICM_SUCCESS) {
DPRINTK(ERR, "server listen error %d\n", ret);
ksocket_close(sock, CRED());
goto FAIL;
}
val = sizeof(on);
ret = ksocket_ioctl(sock, FIONBIO, (intptr_t)&on, &val, CRED());
if (ret != VICM_SUCCESS) {
DPRINTK(ERR, "set FIONBIO error %d\n", ret);
ksocket_close(sock, CRED());
goto FAIL;
}

No data to display

Also available in: Atom PDF