@@ -383,6 +383,7 @@ static bool process_negotiation_response(
383
383
info -> max_frmr_depth * PAGE_SIZE );
384
384
info -> max_frmr_depth = sp -> max_read_write_size / PAGE_SIZE ;
385
385
386
+ sc -> recv_io .expected = SMBDIRECT_EXPECT_DATA_TRANSFER ;
386
387
return true;
387
388
}
388
389
@@ -408,7 +409,6 @@ static void smbd_post_send_credits(struct work_struct *work)
408
409
if (!response )
409
410
break ;
410
411
411
- response -> type = SMBD_TRANSFER_DATA ;
412
412
response -> first_segment = false;
413
413
rc = smbd_post_recv (info , response );
414
414
if (rc ) {
@@ -445,10 +445,11 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
445
445
struct smbd_response * response =
446
446
container_of (wc -> wr_cqe , struct smbd_response , cqe );
447
447
struct smbd_connection * info = response -> info ;
448
+ struct smbdirect_socket * sc = & info -> socket ;
448
449
int data_length = 0 ;
449
450
450
451
log_rdma_recv (INFO , "response=0x%p type=%d wc status=%d wc opcode %d byte_len=%d pkey_index=%u\n" ,
451
- response , response -> type , wc -> status , wc -> opcode ,
452
+ response , sc -> recv_io . expected , wc -> status , wc -> opcode ,
452
453
wc -> byte_len , wc -> pkey_index );
453
454
454
455
if (wc -> status != IB_WC_SUCCESS || wc -> opcode != IB_WC_RECV ) {
@@ -463,9 +464,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
463
464
response -> sge .length ,
464
465
DMA_FROM_DEVICE );
465
466
466
- switch (response -> type ) {
467
+ switch (sc -> recv_io . expected ) {
467
468
/* SMBD negotiation response */
468
- case SMBD_NEGOTIATE_RESP :
469
+ case SMBDIRECT_EXPECT_NEGOTIATE_REP :
469
470
dump_smbdirect_negotiate_resp (smbd_response_payload (response ));
470
471
info -> full_packet_received = true;
471
472
info -> negotiate_done =
@@ -475,7 +476,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
475
476
return ;
476
477
477
478
/* SMBD data transfer packet */
478
- case SMBD_TRANSFER_DATA :
479
+ case SMBDIRECT_EXPECT_DATA_TRANSFER :
479
480
data_transfer = smbd_response_payload (response );
480
481
data_length = le32_to_cpu (data_transfer -> data_length );
481
482
@@ -526,13 +527,17 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
526
527
put_receive_buffer (info , response );
527
528
528
529
return ;
530
+
531
+ case SMBDIRECT_EXPECT_NEGOTIATE_REQ :
532
+ /* Only server... */
533
+ break ;
529
534
}
530
535
531
536
/*
532
537
* This is an internal error!
533
538
*/
534
- log_rdma_recv (ERR , "unexpected response type=%d\n" , response -> type );
535
- WARN_ON_ONCE (response -> type != SMBD_TRANSFER_DATA );
539
+ log_rdma_recv (ERR , "unexpected response type=%d\n" , sc -> recv_io . expected );
540
+ WARN_ON_ONCE (sc -> recv_io . expected != SMBDIRECT_EXPECT_DATA_TRANSFER );
536
541
error :
537
542
put_receive_buffer (info , response );
538
543
smbd_disconnect_rdma_connection (info );
@@ -1067,10 +1072,11 @@ static int smbd_post_recv(
1067
1072
/* Perform SMBD negotiate according to [MS-SMBD] 3.1.5.2 */
1068
1073
static int smbd_negotiate (struct smbd_connection * info )
1069
1074
{
1075
+ struct smbdirect_socket * sc = & info -> socket ;
1070
1076
int rc ;
1071
1077
struct smbd_response * response = get_receive_buffer (info );
1072
1078
1073
- response -> type = SMBD_NEGOTIATE_RESP ;
1079
+ sc -> recv_io . expected = SMBDIRECT_EXPECT_NEGOTIATE_REP ;
1074
1080
rc = smbd_post_recv (info , response );
1075
1081
log_rdma_event (INFO , "smbd_post_recv rc=%d iov.addr=0x%llx iov.length=%u iov.lkey=0x%x\n" ,
1076
1082
rc , response -> sge .addr ,
0 commit comments