@@ -173,8 +173,8 @@ static void smbd_disconnect_rdma_work(struct work_struct *work)
173173 disable_work (& sc -> disconnect_work );
174174 disable_work (& sc -> recv_io .posted .refill_work );
175175 disable_work (& info -> mr_recovery_work );
176- disable_work (& info -> send_immediate_work );
177- disable_delayed_work (& info -> idle_timer_work );
176+ disable_work (& sc -> idle . immediate_work );
177+ disable_delayed_work (& sc -> idle . timer_work );
178178
179179 switch (sc -> status ) {
180180 case SMBDIRECT_SOCKET_NEGOTIATE_NEEDED :
@@ -571,7 +571,7 @@ static void smbd_post_send_credits(struct work_struct *work)
571571 if (atomic_read (& sc -> recv_io .credits .count ) <
572572 sc -> recv_io .credits .target - 1 ) {
573573 log_keep_alive (INFO , "schedule send of an empty message\n" );
574- queue_work (info -> workqueue , & info -> send_immediate_work );
574+ queue_work (info -> workqueue , & sc -> idle . immediate_work );
575575 }
576576}
577577
@@ -614,8 +614,8 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
614614 * Reset timer to the keepalive interval in
615615 * order to trigger our next keepalive message.
616616 */
617- info -> keep_alive_requested = KEEP_ALIVE_NONE ;
618- mod_delayed_work (info -> workqueue , & info -> idle_timer_work ,
617+ sc -> idle . keepalive = SMBDIRECT_KEEPALIVE_NONE ;
618+ mod_delayed_work (info -> workqueue , & sc -> idle . timer_work ,
619619 msecs_to_jiffies (sp -> keepalive_interval_msec ));
620620
621621 switch (sc -> recv_io .expected ) {
@@ -696,7 +696,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
696696 if (le16_to_cpu (data_transfer -> flags ) &
697697 SMBDIRECT_FLAG_RESPONSE_REQUESTED ) {
698698 log_keep_alive (INFO , "schedule send of immediate response\n" );
699- queue_work (info -> workqueue , & info -> send_immediate_work );
699+ queue_work (info -> workqueue , & sc -> idle . immediate_work );
700700 }
701701
702702 /*
@@ -998,13 +998,13 @@ static int manage_keep_alive_before_sending(struct smbd_connection *info)
998998 struct smbdirect_socket * sc = & info -> socket ;
999999 struct smbdirect_socket_parameters * sp = & sc -> parameters ;
10001000
1001- if (info -> keep_alive_requested == KEEP_ALIVE_PENDING ) {
1002- info -> keep_alive_requested = KEEP_ALIVE_SENT ;
1001+ if (sc -> idle . keepalive == SMBDIRECT_KEEPALIVE_PENDING ) {
1002+ sc -> idle . keepalive = SMBDIRECT_KEEPALIVE_SENT ;
10031003 /*
10041004 * Now use the keepalive timeout (instead of keepalive interval)
10051005 * in order to wait for a response
10061006 */
1007- mod_delayed_work (info -> workqueue , & info -> idle_timer_work ,
1007+ mod_delayed_work (info -> workqueue , & sc -> idle . timer_work ,
10081008 msecs_to_jiffies (sp -> keepalive_timeout_msec ));
10091009 return 1 ;
10101010 }
@@ -1471,9 +1471,10 @@ static void destroy_receive_buffers(struct smbd_connection *info)
14711471
14721472static void send_immediate_empty_message (struct work_struct * work )
14731473{
1474+ struct smbdirect_socket * sc =
1475+ container_of (work , struct smbdirect_socket , idle .immediate_work );
14741476 struct smbd_connection * info =
1475- container_of (work , struct smbd_connection , send_immediate_work );
1476- struct smbdirect_socket * sc = & info -> socket ;
1477+ container_of (sc , struct smbd_connection , socket );
14771478
14781479 if (sc -> status != SMBDIRECT_SOCKET_CONNECTED )
14791480 return ;
@@ -1485,16 +1486,16 @@ static void send_immediate_empty_message(struct work_struct *work)
14851486/* Implement idle connection timer [MS-SMBD] 3.1.6.2 */
14861487static void idle_connection_timer (struct work_struct * work )
14871488{
1488- struct smbd_connection * info = container_of (
1489- work , struct smbd_connection ,
1490- idle_timer_work .work );
1491- struct smbdirect_socket * sc = & info -> socket ;
1489+ struct smbdirect_socket * sc =
1490+ container_of (work , struct smbdirect_socket , idle .timer_work .work );
14921491 struct smbdirect_socket_parameters * sp = & sc -> parameters ;
1492+ struct smbd_connection * info =
1493+ container_of (sc , struct smbd_connection , socket );
14931494
1494- if (info -> keep_alive_requested != KEEP_ALIVE_NONE ) {
1495+ if (sc -> idle . keepalive != SMBDIRECT_KEEPALIVE_NONE ) {
14951496 log_keep_alive (ERR ,
1496- "error status info->keep_alive_requested =%d\n" ,
1497- info -> keep_alive_requested );
1497+ "error status sc->idle.keepalive =%d\n" ,
1498+ sc -> idle . keepalive );
14981499 smbd_disconnect_rdma_connection (info );
14991500 return ;
15001501 }
@@ -1506,11 +1507,11 @@ static void idle_connection_timer(struct work_struct *work)
15061507 * Now use the keepalive timeout (instead of keepalive interval)
15071508 * in order to wait for a response
15081509 */
1509- info -> keep_alive_requested = KEEP_ALIVE_PENDING ;
1510- mod_delayed_work (info -> workqueue , & info -> idle_timer_work ,
1510+ sc -> idle . keepalive = SMBDIRECT_KEEPALIVE_PENDING ;
1511+ mod_delayed_work (info -> workqueue , & sc -> idle . timer_work ,
15111512 msecs_to_jiffies (sp -> keepalive_timeout_msec ));
15121513 log_keep_alive (INFO , "schedule send of empty idle message\n" );
1513- queue_work (info -> workqueue , & info -> send_immediate_work );
1514+ queue_work (info -> workqueue , & sc -> idle . immediate_work );
15141515}
15151516
15161517/*
@@ -1552,9 +1553,9 @@ void smbd_destroy(struct TCP_Server_Info *server)
15521553 sc -> ib .qp = NULL ;
15531554
15541555 log_rdma_event (INFO , "cancelling idle timer\n" );
1555- disable_delayed_work_sync (& info -> idle_timer_work );
1556+ disable_delayed_work_sync (& sc -> idle . timer_work );
15561557 log_rdma_event (INFO , "cancelling send immediate work\n" );
1557- disable_work_sync (& info -> send_immediate_work );
1558+ disable_work_sync (& sc -> idle . immediate_work );
15581559
15591560 /* It's not possible for upper layer to get to reassembly */
15601561 log_rdma_event (INFO , "drain the reassembly queue\n" );
@@ -1898,14 +1899,14 @@ static struct smbd_connection *_smbd_get_connection(
18981899 goto allocate_cache_failed ;
18991900 }
19001901
1901- INIT_WORK (& info -> send_immediate_work , send_immediate_empty_message );
1902- INIT_DELAYED_WORK (& info -> idle_timer_work , idle_connection_timer );
1902+ INIT_WORK (& sc -> idle . immediate_work , send_immediate_empty_message );
1903+ INIT_DELAYED_WORK (& sc -> idle . timer_work , idle_connection_timer );
19031904 /*
1904- * start with the negotiate timeout and KEEP_ALIVE_PENDING
1905+ * start with the negotiate timeout and SMBDIRECT_KEEPALIVE_PENDING
19051906 * so that the timer will cause a disconnect.
19061907 */
1907- info -> keep_alive_requested = KEEP_ALIVE_PENDING ;
1908- mod_delayed_work (info -> workqueue , & info -> idle_timer_work ,
1908+ sc -> idle . keepalive = SMBDIRECT_KEEPALIVE_PENDING ;
1909+ mod_delayed_work (info -> workqueue , & sc -> idle . timer_work ,
19091910 msecs_to_jiffies (sp -> negotiate_timeout_msec ));
19101911
19111912 INIT_WORK (& sc -> recv_io .posted .refill_work , smbd_post_send_credits );
@@ -1931,7 +1932,7 @@ static struct smbd_connection *_smbd_get_connection(
19311932 return NULL ;
19321933
19331934negotiation_failed :
1934- disable_delayed_work_sync (& info -> idle_timer_work );
1935+ disable_delayed_work_sync (& sc -> idle . timer_work );
19351936 destroy_caches_and_workqueue (info );
19361937 sc -> status = SMBDIRECT_SOCKET_NEGOTIATE_FAILED ;
19371938 rdma_disconnect (sc -> rdma .cm_id );
0 commit comments