@@ -224,7 +224,7 @@ static int smbd_conn_upcall(
224
224
225
225
sc -> status = SMBDIRECT_SOCKET_DISCONNECTED ;
226
226
wake_up_interruptible (& info -> disconn_wait );
227
- wake_up_interruptible (& info -> wait_reassembly_queue );
227
+ wake_up_interruptible (& sc -> recv_io . reassembly . wait_queue );
228
228
wake_up_interruptible_all (& info -> wait_send_queue );
229
229
break ;
230
230
@@ -470,7 +470,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
470
470
/* SMBD negotiation response */
471
471
case SMBDIRECT_EXPECT_NEGOTIATE_REP :
472
472
dump_smbdirect_negotiate_resp (smbdirect_recv_io_payload (response ));
473
- info -> full_packet_received = true;
473
+ sc -> recv_io . reassembly . full_packet_received = true;
474
474
info -> negotiate_done =
475
475
process_negotiation_response (response , wc -> byte_len );
476
476
put_receive_buffer (info , response );
@@ -483,13 +483,13 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
483
483
data_length = le32_to_cpu (data_transfer -> data_length );
484
484
485
485
if (data_length ) {
486
- if (info -> full_packet_received )
486
+ if (sc -> recv_io . reassembly . full_packet_received )
487
487
response -> first_segment = true;
488
488
489
489
if (le32_to_cpu (data_transfer -> remaining_data_length ))
490
- info -> full_packet_received = false;
490
+ sc -> recv_io . reassembly . full_packet_received = false;
491
491
else
492
- info -> full_packet_received = true;
492
+ sc -> recv_io . reassembly . full_packet_received = true;
493
493
}
494
494
495
495
atomic_dec (& info -> receive_credits );
@@ -524,7 +524,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
524
524
*/
525
525
if (data_length ) {
526
526
enqueue_reassembly (info , response , data_length );
527
- wake_up_interruptible (& info -> wait_reassembly_queue );
527
+ wake_up_interruptible (& sc -> recv_io . reassembly . wait_queue );
528
528
} else
529
529
put_receive_buffer (info , response );
530
530
@@ -1124,18 +1124,20 @@ static void enqueue_reassembly(
1124
1124
struct smbdirect_recv_io * response ,
1125
1125
int data_length )
1126
1126
{
1127
- spin_lock (& info -> reassembly_queue_lock );
1128
- list_add_tail (& response -> list , & info -> reassembly_queue );
1129
- info -> reassembly_queue_length ++ ;
1127
+ struct smbdirect_socket * sc = & info -> socket ;
1128
+
1129
+ spin_lock (& sc -> recv_io .reassembly .lock );
1130
+ list_add_tail (& response -> list , & sc -> recv_io .reassembly .list );
1131
+ sc -> recv_io .reassembly .queue_length ++ ;
1130
1132
/*
1131
1133
* Make sure reassembly_data_length is updated after list and
1132
1134
* reassembly_queue_length are updated. On the dequeue side
1133
1135
* reassembly_data_length is checked without a lock to determine
1134
1136
* if reassembly_queue_length and list is up to date
1135
1137
*/
1136
1138
virt_wmb ();
1137
- info -> reassembly_data_length += data_length ;
1138
- spin_unlock (& info -> reassembly_queue_lock );
1139
+ sc -> recv_io . reassembly . data_length += data_length ;
1140
+ spin_unlock (& sc -> recv_io . reassembly . lock );
1139
1141
info -> count_reassembly_queue ++ ;
1140
1142
info -> count_enqueue_reassembly_queue ++ ;
1141
1143
}
@@ -1147,11 +1149,12 @@ static void enqueue_reassembly(
1147
1149
*/
1148
1150
static struct smbdirect_recv_io * _get_first_reassembly (struct smbd_connection * info )
1149
1151
{
1152
+ struct smbdirect_socket * sc = & info -> socket ;
1150
1153
struct smbdirect_recv_io * ret = NULL ;
1151
1154
1152
- if (!list_empty (& info -> reassembly_queue )) {
1155
+ if (!list_empty (& sc -> recv_io . reassembly . list )) {
1153
1156
ret = list_first_entry (
1154
- & info -> reassembly_queue ,
1157
+ & sc -> recv_io . reassembly . list ,
1155
1158
struct smbdirect_recv_io , list );
1156
1159
}
1157
1160
return ret ;
@@ -1219,10 +1222,10 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
1219
1222
struct smbdirect_recv_io * response ;
1220
1223
int i ;
1221
1224
1222
- INIT_LIST_HEAD (& info -> reassembly_queue );
1223
- spin_lock_init (& info -> reassembly_queue_lock );
1224
- info -> reassembly_data_length = 0 ;
1225
- info -> reassembly_queue_length = 0 ;
1225
+ INIT_LIST_HEAD (& sc -> recv_io . reassembly . list );
1226
+ spin_lock_init (& sc -> recv_io . reassembly . lock );
1227
+ sc -> recv_io . reassembly . data_length = 0 ;
1228
+ sc -> recv_io . reassembly . queue_length = 0 ;
1226
1229
1227
1230
INIT_LIST_HEAD (& sc -> recv_io .free .list );
1228
1231
spin_lock_init (& sc -> recv_io .free .lock );
@@ -1333,18 +1336,18 @@ void smbd_destroy(struct TCP_Server_Info *server)
1333
1336
/* It's not possible for upper layer to get to reassembly */
1334
1337
log_rdma_event (INFO , "drain the reassembly queue\n" );
1335
1338
do {
1336
- spin_lock_irqsave (& info -> reassembly_queue_lock , flags );
1339
+ spin_lock_irqsave (& sc -> recv_io . reassembly . lock , flags );
1337
1340
response = _get_first_reassembly (info );
1338
1341
if (response ) {
1339
1342
list_del (& response -> list );
1340
1343
spin_unlock_irqrestore (
1341
- & info -> reassembly_queue_lock , flags );
1344
+ & sc -> recv_io . reassembly . lock , flags );
1342
1345
put_receive_buffer (info , response );
1343
1346
} else
1344
1347
spin_unlock_irqrestore (
1345
- & info -> reassembly_queue_lock , flags );
1348
+ & sc -> recv_io . reassembly . lock , flags );
1346
1349
} while (response );
1347
- info -> reassembly_data_length = 0 ;
1350
+ sc -> recv_io . reassembly . data_length = 0 ;
1348
1351
1349
1352
log_rdma_event (INFO , "free receive buffers\n" );
1350
1353
wait_event (info -> wait_receive_queues ,
@@ -1639,7 +1642,7 @@ static struct smbd_connection *_smbd_get_connection(
1639
1642
1640
1643
init_waitqueue_head (& info -> conn_wait );
1641
1644
init_waitqueue_head (& info -> disconn_wait );
1642
- init_waitqueue_head (& info -> wait_reassembly_queue );
1645
+ init_waitqueue_head (& sc -> recv_io . reassembly . wait_queue );
1643
1646
rc = rdma_connect (sc -> rdma .cm_id , & conn_param );
1644
1647
if (rc ) {
1645
1648
log_rdma_event (ERR , "rdma_connect() failed with %i\n" , rc );
@@ -1776,9 +1779,9 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
1776
1779
* the only one reading from the front of the queue. The transport
1777
1780
* may add more entries to the back of the queue at the same time
1778
1781
*/
1779
- log_read (INFO , "size=%zd info->reassembly_data_length =%d\n" , size ,
1780
- info -> reassembly_data_length );
1781
- if (info -> reassembly_data_length >= size ) {
1782
+ log_read (INFO , "size=%zd sc->recv_io.reassembly.data_length =%d\n" , size ,
1783
+ sc -> recv_io . reassembly . data_length );
1784
+ if (sc -> recv_io . reassembly . data_length >= size ) {
1782
1785
int queue_length ;
1783
1786
int queue_removed = 0 ;
1784
1787
@@ -1790,10 +1793,10 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
1790
1793
* updated in SOFTIRQ as more data is received
1791
1794
*/
1792
1795
virt_rmb ();
1793
- queue_length = info -> reassembly_queue_length ;
1796
+ queue_length = sc -> recv_io . reassembly . queue_length ;
1794
1797
data_read = 0 ;
1795
1798
to_read = size ;
1796
- offset = info -> first_entry_offset ;
1799
+ offset = sc -> recv_io . reassembly . first_entry_offset ;
1797
1800
while (data_read < size ) {
1798
1801
response = _get_first_reassembly (info );
1799
1802
data_transfer = smbdirect_recv_io_payload (response );
@@ -1841,10 +1844,10 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
1841
1844
list_del (& response -> list );
1842
1845
else {
1843
1846
spin_lock_irq (
1844
- & info -> reassembly_queue_lock );
1847
+ & sc -> recv_io . reassembly . lock );
1845
1848
list_del (& response -> list );
1846
1849
spin_unlock_irq (
1847
- & info -> reassembly_queue_lock );
1850
+ & sc -> recv_io . reassembly . lock );
1848
1851
}
1849
1852
queue_removed ++ ;
1850
1853
info -> count_reassembly_queue -- ;
@@ -1863,23 +1866,23 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
1863
1866
to_read , data_read , offset );
1864
1867
}
1865
1868
1866
- spin_lock_irq (& info -> reassembly_queue_lock );
1867
- info -> reassembly_data_length -= data_read ;
1868
- info -> reassembly_queue_length -= queue_removed ;
1869
- spin_unlock_irq (& info -> reassembly_queue_lock );
1869
+ spin_lock_irq (& sc -> recv_io . reassembly . lock );
1870
+ sc -> recv_io . reassembly . data_length -= data_read ;
1871
+ sc -> recv_io . reassembly . queue_length -= queue_removed ;
1872
+ spin_unlock_irq (& sc -> recv_io . reassembly . lock );
1870
1873
1871
- info -> first_entry_offset = offset ;
1874
+ sc -> recv_io . reassembly . first_entry_offset = offset ;
1872
1875
log_read (INFO , "returning to thread data_read=%d reassembly_data_length=%d first_entry_offset=%d\n" ,
1873
- data_read , info -> reassembly_data_length ,
1874
- info -> first_entry_offset );
1876
+ data_read , sc -> recv_io . reassembly . data_length ,
1877
+ sc -> recv_io . reassembly . first_entry_offset );
1875
1878
read_rfc1002_done :
1876
1879
return data_read ;
1877
1880
}
1878
1881
1879
1882
log_read (INFO , "wait_event on more data\n" );
1880
1883
rc = wait_event_interruptible (
1881
- info -> wait_reassembly_queue ,
1882
- info -> reassembly_data_length >= size ||
1884
+ sc -> recv_io . reassembly . wait_queue ,
1885
+ sc -> recv_io . reassembly . data_length >= size ||
1883
1886
sc -> status != SMBDIRECT_SOCKET_CONNECTED );
1884
1887
/* Don't return any data if interrupted */
1885
1888
if (rc )
0 commit comments