lkml.org 
[lkml]   [2017]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [[PATCH v1] 21/37] [CIFS] SMBD: Implement API for upper layer to receive data
Date
> -----Original Message-----
> From: linux-cifs-owner@vger.kernel.org [mailto:linux-cifs-
> owner@vger.kernel.org] On Behalf Of Long Li
> Sent: Wednesday, August 2, 2017 4:11 PM
> To: Steve French <sfrench@samba.org>; linux-cifs@vger.kernel.org; samba-
> technical@lists.samba.org; linux-kernel@vger.kernel.org
> Cc: Long Li <longli@microsoft.com>
> Subject: [[PATCH v1] 21/37] [CIFS] SMBD: Implement API for upper layer to
> receive data
>
> /*
> + * Read data from receive reassembly queue
> + * All the incoming data packets are placed in reassembly queue
> + * buf: the buffer to read data into
> + * size: the length of data to read
> + * return value: actual data read
> + */
> +int cifs_rdma_read(struct cifs_rdma_info *info, char *buf, unsigned int size)
> +{
>...
> + spin_lock_irqsave(&info->reassembly_queue_lock, flags);
> + log_cifs_read("size=%d info->reassembly_data_length=%d\n", size,
> + atomic_read(&info->reassembly_data_length));
> + if (atomic_read(&info->reassembly_data_length) >= size) {

If the reassembly queue is protected by a lock, why is an atomic_read() of
its length needed?

> + // this is for reading rfc1002 length
> + if (response->first_segment && size==4) {
> + unsigned int rfc1002_len =
> + data_length + remaining_data_length;
> + *((__be32*)buf) = cpu_to_be32(rfc1002_len);
> + data_read = 4;
> + response->first_segment = false;
> + log_cifs_read("returning rfc1002 length %d\n",
> + rfc1002_len);
> + goto read_rfc1002_done;
> + }

I am totally confused. What does RFC1002 framing have to do with
receiving an SMB Direct packet???

> +
> + to_copy = min_t(int, data_length - offset, to_read);
> + memcpy(
> + buf + data_read,
> + (char*)data_transfer + data_offset + offset,
> + to_copy);

Is it really necessary to perform all these data copies, especially under the
reassembly_queue spinlock? This seems quite inefficient. Can the receive
buffers not be loaned out and chained logically?

Tom.

\
 
 \ /
  Last update: 2017-08-14 22:58    [W:0.505 / U:5.444 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site