uint16_t send_credit_target;
uint16_t send_credits;
uint16_t receive_credit_max;
+ uint16_t receive_posted;
uint16_t receive_credit_target;
uint16_t receive_credits;
uint32_t keep_alive_internal;
const struct smb_direct_io *io,
const char *location, const char *func)
{
- DEBUG(0,("%s:%s: IO[%p] CREDITS: RMAX[%u] RTARGET[%u] R[%u] RSIZE[%u] "
+ DEBUG(0,("%s:%s: IO[%p] CREDITS: RMAX[%u] RPOSTED[%u] RTARGET[%u] R[%u] RSIZE[%u] "
"STARGET[%u] S[%u] SSIZE[%u] MF[%u] MRW[%u]\n",
location, reason, io, //"",//func,
c->state.receive_credit_max,
+ c->state.receive_posted,
c->state.receive_credit_target,
c->state.receive_credits,
c->state.max_receive_size,
}
for (io = c->r2s.idle; io != NULL; io = io->next) {
+//DEBUG(0,("%s:%s: POST RECV[%p]\n", __location__, __func__, io));
+ c->state.receive_posted += 1;
smb_direct_connection_debug_credits(c, "POST_RECV", io, __location__, __func__);
if (io->next == NULL) {
io->recv_wr.next = NULL;
break;
}
-DEBUG(0,("%s:%s: POST RECV[%p]\n", __location__, __func__, io));
io->recv_wr.next = &io->next->recv_wr;
}
flags |= SMB_DIRECT_RESPONSE_REQUESTED;
}
- granted = c->state.receive_credit_max;
+ granted = c->state.receive_posted;
granted -= c->state.receive_credits;
granted = MIN(granted, c->state.receive_credit_target);
c->state.receive_credits += granted;
DEBUG(0,("%s:%s: KEEP posted[%p] ready[%p] idle[%p]\n",
__location__, __func__, c->s2r.posted, c->s2r.ready, c->s2r.idle));
+
+ errno = 0;
+ ret = smb_direct_connection_post_recv(c);
+ if (ret != 0) {
+ NTSTATUS status;
+ status = map_nt_error_from_unix_common(errno);
+ DEBUG(0,("%s:%s: ret[%d] errno[%d] status[%s]\n",
+ __location__, __FUNCTION__, ret, errno, nt_errstr(status)));
+ return ret;
+ }
+
smb_direct_connection_debug_credits(c, "post_keep", NULL, __location__, __func__);
+
if (c->s2r.posted != NULL) {
DEBUG(0,("%s:%s: KEEP skip...(posted)\n", __location__, __func__));
return 0;
}
+ if (c->state.receive_posted > 0) {
+DEBUG(0,("%s:%s: KEEP skip...(no RECV posted)\n", __location__, __func__));
+ return 0;
+ }
+
if (c->s2r.ready != NULL) {
DEBUG(0,("%s:%s: KEEP skip...(ready)\n", __location__, __func__));
return 0;
}
if (c->s2r.idle == NULL) {
-//DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+DEBUG(0,("%s:%s: KEEP skip...(no idle)\n", __location__, __func__));
return 0;
}
DLIST_ADD_END(c->s2r.ready, io);
smb_direct_connection_debug_credits(c, "POST_KEEP", io, __location__, __func__);
- ret = smb_direct_connection_post_io(c);
+ ret = smb_direct_connection_post_send(c);
if (ret != 0) {
NTSTATUS status;
status = map_nt_error_from_unix_common(errno);
SSVAL(neg_send->data, 0x04, 0x0100);
SSVAL(neg_send->data, 0x06, 0x0000);
- credits_granted = c->state.receive_credit_max;
+ credits_granted = c->state.receive_posted;
credits_granted -= c->state.receive_credits;
credits_granted = MIN(credits_granted, c->state.receive_credit_target);
c->state.receive_credits += credits_granted;
data_offset = IVAL(io->smbd_hdr, 0x0C);
io->data_length = IVAL(io->smbd_hdr, 0x10);
+ c->state.receive_posted -= 1;
c->state.receive_credits -= 1;
c->state.receive_credit_target = credits_requested;