mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
smb: client: make use of smbdirect_connection_reassembly_{append,first}_recv_io()
These are exact copies of enqueue_reassembly() and _get_first_reassembly(). Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher <metze@samba.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
927183cdbe
commit
018ed87aa5
|
|
@ -26,12 +26,6 @@ const struct smbdirect_socket_parameters *smbd_get_parameters(struct smbd_connec
|
|||
static int allocate_receive_buffers(struct smbdirect_socket *sc, int num_buf);
|
||||
static void destroy_receive_buffers(struct smbdirect_socket *sc);
|
||||
|
||||
static void enqueue_reassembly(
|
||||
struct smbdirect_socket *sc,
|
||||
struct smbdirect_recv_io *response, int data_length);
|
||||
static struct smbdirect_recv_io *_get_first_reassembly(
|
||||
struct smbdirect_socket *sc);
|
||||
|
||||
static int smbd_post_send(struct smbdirect_socket *sc,
|
||||
struct smbdirect_send_batch *batch,
|
||||
struct smbdirect_send_io *request);
|
||||
|
|
@ -794,7 +788,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
sc->recv_io.credits.target > old_recv_credit_target)
|
||||
queue_work(sc->workqueue, &sc->recv_io.posted.refill_work);
|
||||
|
||||
enqueue_reassembly(sc, response, data_length);
|
||||
smbdirect_connection_reassembly_append_recv_io(sc, response, data_length);
|
||||
wake_up(&sc->recv_io.reassembly.wait_queue);
|
||||
} else
|
||||
smbdirect_connection_put_recv_io(response);
|
||||
|
|
@ -1605,55 +1599,6 @@ static int smbd_negotiate(struct smbdirect_socket *sc)
|
|||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement Connection.FragmentReassemblyBuffer defined in [MS-SMBD] 3.1.1.1
|
||||
* This is a queue for reassembling upper layer payload and present to upper
|
||||
* layer. All the inncoming payload go to the reassembly queue, regardless of
|
||||
* if reassembly is required. The uuper layer code reads from the queue for all
|
||||
* incoming payloads.
|
||||
* Put a received packet to the reassembly queue
|
||||
* response: the packet received
|
||||
* data_length: the size of payload in this packet
|
||||
*/
|
||||
static void enqueue_reassembly(
|
||||
struct smbdirect_socket *sc,
|
||||
struct smbdirect_recv_io *response,
|
||||
int data_length)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&sc->recv_io.reassembly.lock, flags);
|
||||
list_add_tail(&response->list, &sc->recv_io.reassembly.list);
|
||||
sc->recv_io.reassembly.queue_length++;
|
||||
/*
|
||||
* Make sure reassembly_data_length is updated after list and
|
||||
* reassembly_queue_length are updated. On the dequeue side
|
||||
* reassembly_data_length is checked without a lock to determine
|
||||
* if reassembly_queue_length and list is up to date
|
||||
*/
|
||||
virt_wmb();
|
||||
sc->recv_io.reassembly.data_length += data_length;
|
||||
spin_unlock_irqrestore(&sc->recv_io.reassembly.lock, flags);
|
||||
sc->statistics.enqueue_reassembly_queue++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the first entry at the front of reassembly queue
|
||||
* Caller is responsible for locking
|
||||
* return value: the first entry if any, NULL if queue is empty
|
||||
*/
|
||||
static struct smbdirect_recv_io *_get_first_reassembly(struct smbdirect_socket *sc)
|
||||
{
|
||||
struct smbdirect_recv_io *ret = NULL;
|
||||
|
||||
if (!list_empty(&sc->recv_io.reassembly.list)) {
|
||||
ret = list_first_entry(
|
||||
&sc->recv_io.reassembly.list,
|
||||
struct smbdirect_recv_io, list);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Preallocate all receive buffer on transport establishment */
|
||||
static int allocate_receive_buffers(struct smbdirect_socket *sc, int num_buf)
|
||||
{
|
||||
|
|
@ -1789,7 +1734,7 @@ void smbd_destroy(struct TCP_Server_Info *server)
|
|||
log_rdma_event(INFO, "drain the reassembly queue\n");
|
||||
do {
|
||||
spin_lock_irqsave(&sc->recv_io.reassembly.lock, flags);
|
||||
response = _get_first_reassembly(sc);
|
||||
response = smbdirect_connection_reassembly_first_recv_io(sc);
|
||||
if (response) {
|
||||
list_del(&response->list);
|
||||
spin_unlock_irqrestore(
|
||||
|
|
@ -2270,7 +2215,7 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
|||
/*
|
||||
* Need to make sure reassembly_data_length is read before
|
||||
* reading reassembly_queue_length and calling
|
||||
* _get_first_reassembly. This call is lock free
|
||||
* smbdirect_connection_reassembly_first_recv_io. This call is lock free
|
||||
* as we never read at the end of the queue which are being
|
||||
* updated in SOFTIRQ as more data is received
|
||||
*/
|
||||
|
|
@ -2280,7 +2225,7 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
|||
to_read = size;
|
||||
offset = sc->recv_io.reassembly.first_entry_offset;
|
||||
while (data_read < size) {
|
||||
response = _get_first_reassembly(sc);
|
||||
response = smbdirect_connection_reassembly_first_recv_io(sc);
|
||||
data_transfer = smbdirect_recv_io_payload(response);
|
||||
data_length = le32_to_cpu(data_transfer->data_length);
|
||||
remaining_data_length =
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user