diff mbox

[v3,02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants

Message ID 20170829192915.26251-3-longli@exchange.microsoft.com (mailing list archive)
State New, archived
Headers show

Commit Message

Long Li Aug. 29, 2017, 7:28 p.m. UTC
From: Long Li <longli@microsoft.com>

To prepare for protocol implementation, add constants and user-configurable
values in the SMBDirect protocol.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/smbdirect.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/cifs/smbdirect.h | 20 ++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 fs/cifs/smbdirect.c
 create mode 100644 fs/cifs/smbdirect.h

Comments

Pavel Shilovsky Aug. 29, 2017, 10:44 p.m. UTC | #1
2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> From: Long Li <longli@microsoft.com>
>
> To prepare for protocol implementation, add constants and user-configurable
> values in the SMBDirect protocol.
>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  fs/cifs/smbdirect.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  fs/cifs/smbdirect.h | 20 ++++++++++++++
>  2 files changed, 98 insertions(+)
>  create mode 100644 fs/cifs/smbdirect.c
>  create mode 100644 fs/cifs/smbdirect.h
>
> diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
> new file mode 100644
> index 0000000..d785bc1
> --- /dev/null
> +++ b/fs/cifs/smbdirect.c
> @@ -0,0 +1,78 @@
> +/*
> + *   Copyright (C) 2017, Microsoft Corporation.
> + *
> + *   Author(s): Long Li <longli@microsoft.com>
> + *
> + *   This program is free software;  you can redistribute it and/or modify
> + *   it under the terms of the GNU General Public License as published by
> + *   the Free Software Foundation; either version 2 of the License, or
> + *   (at your option) any later version.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + */
> +#include <linux/module.h>
> +#include "smbdirect.h"
> +#include "cifs_debug.h"
> +
> +/* SMBD version number */
> +#define SMBD_V1        0x0100
> +
> +/* Port numbers for SMBD transport */
> +#define SMB_PORT       445
> +#define SMBD_PORT      5445
> +
> +/* Address lookup and resolve timeout in ms */
> +#define RDMA_RESOLVE_TIMEOUT   5000
> +
> +/* SMBD negotiation timeout in seconds */
> +#define SMBD_NEGOTIATE_TIMEOUT 120
> +
> +/* SMBD minimum receive size and fragmented sized defined in [MS-SMBD] */
> +#define SMBD_MIN_RECEIVE_SIZE          128
> +#define SMBD_MIN_FRAGMENTED_SIZE       131072
> +
> +/*
> + * Default maximum number of RDMA read/write outstanding on this connection
> + * This value is possibly decreased during QP creation on hardware limit
> + */
> +#define SMBD_CM_RESPONDER_RESOURCES    32
> +
> +/* Maximum number of retries on data transfer operations */
> +#define SMBD_CM_RETRY                  6
> +/* No need to retry on Receiver Not Ready since SMBD manages credits */
> +#define SMBD_CM_RNR_RETRY              0
> +
> +/*
> + * User configurable initial values per SMBD transport connection
> + * as defined in [MS-SMBD] 3.1.1.1
> + * Those may change after a SMBD negotiation
> + */

Since these value are per transport connection, why they are global?
Shouldn't they be inside a some structure that is created for a
particular connection? Also the constants below should be defines.

> +/* The local peer's maximum number of credits to grant to the peer */
> +static int receive_credit_max = 255;
> +/* The remote peer's credit request of local peer */
> +static int send_credit_target = 255;
> +/* The maximum single message size can be sent to remote peer */
> +static int max_send_size = 1364;
> +/*  The maximum fragmented upper-layer payload receive size supported */
> +static int max_fragmented_recv_size = 1024 * 1024;
> +/*  The maximum single-message size which can be received */
> +static int max_receive_size = 8192;
> +
> +/* The timeout to initiate send of a keepalive message on idle */
> +static int keep_alive_interval = 120;
> +
> +/*
> + * User configurable initial values for RDMA transport
> + * The actual values used may be lower and are limited to hardware capabilities
> + */
> +/* Default maximum number of SGEs in a RDMA send/recv */
> +static int max_send_sge = SMBDIRECT_MAX_SGE;
> +static int max_recv_sge = SMBDIRECT_MAX_SGE;
> +/* Default maximum number of SGEs in a RDMA write/read */
> +static int max_frmr_depth = 2048;
> +
> +/* If payload is less than this byte, use RDMA send/recv not read/write */
> +static int rdma_readwrite_threshold = 4096;
> diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h
> new file mode 100644
> index 0000000..06eeb0b
> --- /dev/null
> +++ b/fs/cifs/smbdirect.h
> @@ -0,0 +1,20 @@
> +/*
> + *   Copyright (C) 2017, Microsoft Corporation.
> + *
> + *   Author(s): Long Li <longli@microsoft.com>
> + *
> + *   This program is free software;  you can redistribute it and/or modify
> + *   it under the terms of the GNU General Public License as published by
> + *   the Free Software Foundation; either version 2 of the License, or
> + *   (at your option) any later version.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + */
> +#ifndef _SMBDIRECT_H
> +#define _SMBDIRECT_H
> +
> +#define SMBDIRECT_MAX_SGE      16
> +#endif
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Long Li Aug. 29, 2017, 11 p.m. UTC | #2
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBQYXZlbCBTaGlsb3Zza3kgW21h
aWx0bzpwaWFzdHJ5eXlAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBBdWd1c3QgMjksIDIw
MTcgMzo0NSBQTQ0KPiBUbzogTG9uZyBMaSA8bG9uZ2xpQG1pY3Jvc29mdC5jb20+DQo+IENjOiBT
dGV2ZSBGcmVuY2gg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ID4NCj4gaHR0cHM6
Ly9uYTAxLnNhZmVsaW5rcy5wcm90ZWN0aW9uLm91dGxvb2suY29tLz91cmw9aHR0cCUzQSUyRiUy
RnZnZXIuaw0KPiA+IGVybmVsLm9yZyUyRm1ham9yZG9tby0NCj4gaW5mby5odG1sJmRhdGE9MDIl
N0MwMSU3Q2xvbmdsaSU0MG1pY3Jvc29mdC5jb20lDQo+ID4NCj4gN0MwNDhhYWE5MGMwNTc0OGVl
MzZhODA4ZDRlZjJmOTU2NCU3QzcyZjk4OGJmODZmMTQxYWY5MWFiMmQ3Y2QwMTFkDQo+IGI0NyUN
Cj4gPg0KPiA3QzElN0MwJTdDNjM2Mzk2NDM1MDM1NjYwNTk0JnNkYXRhPXFkWTRDd2paNzRXN0Fk
cVRWa2xwbzhYbFdGSTYNCj4gZnhaOXkzaQ0KPiA+IGZQeVBRJTJGY2clM0QmcmVzZXJ2ZWQ9MA0K
PiANCj4gDQo+IA0KPiAtLQ0KPiBCZXN0IHJlZ2FyZHMsDQo+IFBhdmVsIFNoaWxvdnNreQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Shilovsky Aug. 30, 2017, 6:19 p.m. UTC | #3
2017-08-29 16:00 GMT-07:00 Long Li <longli@microsoft.com>:
>> -----Original Message-----
>> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
>> Sent: Tuesday, August 29, 2017 3:45 PM
>> To: Long Li <longli@microsoft.com>
>> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
>> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
>> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
>> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
>> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>;
>> Long Li <longli@microsoft.com>
>> Subject: Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and
>> transport constants
>>
>> 2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
>> > From: Long Li <longli@microsoft.com>
>> >
>> > To prepare for protocol implementation, add constants and
>> > user-configurable values in the SMBDirect protocol.
>> >
>> > Signed-off-by: Long Li <longli@microsoft.com>
>> > ---
>> >  fs/cifs/smbdirect.c | 78
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  fs/cifs/smbdirect.h | 20 ++++++++++++++
>> >  2 files changed, 98 insertions(+)
>> >  create mode 100644 fs/cifs/smbdirect.c  create mode 100644
>> > fs/cifs/smbdirect.h
>> >
>> > diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c new file mode
>> > 100644 index 0000000..d785bc1
>> > --- /dev/null
>> > +++ b/fs/cifs/smbdirect.c
>> > @@ -0,0 +1,78 @@
>> > +/*
>> > + *   Copyright (C) 2017, Microsoft Corporation.
>> > + *
>> > + *   Author(s): Long Li <longli@microsoft.com>
>> > + *
>> > + *   This program is free software;  you can redistribute it and/or modify
>> > + *   it under the terms of the GNU General Public License as published by
>> > + *   the Free Software Foundation; either version 2 of the License, or
>> > + *   (at your option) any later version.
>> > + *
>> > + *   This program is distributed in the hope that it will be useful,
>> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
>> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
>> > + *   the GNU General Public License for more details.
>> > + */
>> > +#include <linux/module.h>
>> > +#include "smbdirect.h"
>> > +#include "cifs_debug.h"
>> > +
>> > +/* SMBD version number */
>> > +#define SMBD_V1        0x0100
>> > +
>> > +/* Port numbers for SMBD transport */
>> > +#define SMB_PORT       445
>> > +#define SMBD_PORT      5445
>> > +
>> > +/* Address lookup and resolve timeout in ms */
>> > +#define RDMA_RESOLVE_TIMEOUT   5000
>> > +
>> > +/* SMBD negotiation timeout in seconds */ #define
>> > +SMBD_NEGOTIATE_TIMEOUT 120
>> > +
>> > +/* SMBD minimum receive size and fragmented sized defined in [MS-
>> SMBD] */
>> > +#define SMBD_MIN_RECEIVE_SIZE          128
>> > +#define SMBD_MIN_FRAGMENTED_SIZE       131072
>> > +
>> > +/*
>> > + * Default maximum number of RDMA read/write outstanding on this
>> > +connection
>> > + * This value is possibly decreased during QP creation on hardware
>> > +limit  */
>> > +#define SMBD_CM_RESPONDER_RESOURCES    32
>> > +
>> > +/* Maximum number of retries on data transfer operations */
>> > +#define SMBD_CM_RETRY                  6
>> > +/* No need to retry on Receiver Not Ready since SMBD manages credits
>> */
>> > +#define SMBD_CM_RNR_RETRY              0
>> > +
>> > +/*
>> > + * User configurable initial values per SMBD transport connection
>> > + * as defined in [MS-SMBD] 3.1.1.1
>> > + * Those may change after a SMBD negotiation  */
>>
>> Since these value are per transport connection, why they are global?
>> Shouldn't they be inside a some structure that is created for a particular
>> connection? Also the constants below should be defines.
>
> Those are configurable initial values (default values) for all connections.
>
> Each connection has its own values based on those initial values. But connection-based values can change after negotiation is done, or after RDMA hardware capabilities are probed.

If these are configurable values, let's add a way to actually
configure them. Through /proc?

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Long Li Aug. 30, 2017, 6:24 p.m. UTC | #4
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBQYXZlbCBTaGlsb3Zza3kgW21h
aWx0bzpwaWFzdHJ5eXlAZ21haWwuY29tXQ0KPiBTZW50OiBXZWRuZXNkYXksIEF1Z3VzdCAzMCwg
MjAxNyAxMToxOSBBTQ0KPiBUbzogTG9uZyBMaSA8bG9uZ2xpQG1pY3Jvc29mdC5jb20+DQo+IENj
OiBTdGV2ZSBGcmVuY2ggPHNmcmVuY2hAc2FtYmEub3JnPjsgbGludXgtY2lmcyA8bGludXgtDQo+
IGNpZnNAdmdlci5rZXJuZWwub3JnPjsgc2F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SB3YXkgdG8gYWN0dWFsbHkgY29uZmlndXJlIHRoZW0uDQo+IFRocm91
Z2ggL3Byb2M/DQoNCllvdSBtZWFuIHB1dHRpbmcgdGhlbSBpbiAvcHJvYy9mcy9jaWZzPw0KDQpP
ciBob3cgYWJvdXQgbW9kdWxlX3BhcmFtPw0KDQo+IA0KPiAtLQ0KPiBCZXN0IHJlZ2FyZHMsDQo+
IFBhdmVsIFNoaWxvdnNreQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Shilovsky Aug. 30, 2017, 6:30 p.m. UTC | #5
2017-08-30 11:24 GMT-07:00 Long Li <longli@microsoft.com>:
>> -----Original Message-----
>> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
>> Sent: Wednesday, August 30, 2017 11:19 AM
>> To: Long Li <longli@microsoft.com>
>> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
>> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
>> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
>> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
>> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>
>> Subject: Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and
>> transport constants
>>
>> 2017-08-29 16:00 GMT-07:00 Long Li <longli@microsoft.com>:
>> >> -----Original Message-----
>> >> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
>> >> Sent: Tuesday, August 29, 2017 3:45 PM
>> >> To: Long Li <longli@microsoft.com>
>> >> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
>> >> cifs@vger.kernel.org>; samba-technical
>> >> <samba-technical@lists.samba.org>;
>> >> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
>> >> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom
>> >> Talpey <ttalpey@microsoft.com>; Matthew Wilcox
>> >> <mawilcox@microsoft.com>; Long Li <longli@microsoft.com>
>> >> Subject: Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and
>> >> transport constants
>> >>
>> >> 2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
>> >> > From: Long Li <longli@microsoft.com>
>> >> >
>> >> > To prepare for protocol implementation, add constants and
>> >> > user-configurable values in the SMBDirect protocol.
>> >> >
>> >> > Signed-off-by: Long Li <longli@microsoft.com>
>> >> > ---
>> >> >  fs/cifs/smbdirect.c | 78
>> >> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >> >  fs/cifs/smbdirect.h | 20 ++++++++++++++
>> >> >  2 files changed, 98 insertions(+)
>> >> >  create mode 100644 fs/cifs/smbdirect.c  create mode 100644
>> >> > fs/cifs/smbdirect.h
>> >> >
>> >> > diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c new file
>> >> > mode
>> >> > 100644 index 0000000..d785bc1
>> >> > --- /dev/null
>> >> > +++ b/fs/cifs/smbdirect.c
>> >> > @@ -0,0 +1,78 @@
>> >> > +/*
>> >> > + *   Copyright (C) 2017, Microsoft Corporation.
>> >> > + *
>> >> > + *   Author(s): Long Li <longli@microsoft.com>
>> >> > + *
>> >> > + *   This program is free software;  you can redistribute it and/or modify
>> >> > + *   it under the terms of the GNU General Public License as published
>> by
>> >> > + *   the Free Software Foundation; either version 2 of the License, or
>> >> > + *   (at your option) any later version.
>> >> > + *
>> >> > + *   This program is distributed in the hope that it will be useful,
>> >> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty
>> of
>> >> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
>> >> > + *   the GNU General Public License for more details.
>> >> > + */
>> >> > +#include <linux/module.h>
>> >> > +#include "smbdirect.h"
>> >> > +#include "cifs_debug.h"
>> >> > +
>> >> > +/* SMBD version number */
>> >> > +#define SMBD_V1        0x0100
>> >> > +
>> >> > +/* Port numbers for SMBD transport */
>> >> > +#define SMB_PORT       445
>> >> > +#define SMBD_PORT      5445
>> >> > +
>> >> > +/* Address lookup and resolve timeout in ms */
>> >> > +#define RDMA_RESOLVE_TIMEOUT   5000
>> >> > +
>> >> > +/* SMBD negotiation timeout in seconds */ #define
>> >> > +SMBD_NEGOTIATE_TIMEOUT 120
>> >> > +
>> >> > +/* SMBD minimum receive size and fragmented sized defined in [MS-
>> >> SMBD] */
>> >> > +#define SMBD_MIN_RECEIVE_SIZE          128
>> >> > +#define SMBD_MIN_FRAGMENTED_SIZE       131072
>> >> > +
>> >> > +/*
>> >> > + * Default maximum number of RDMA read/write outstanding on this
>> >> > +connection
>> >> > + * This value is possibly decreased during QP creation on hardware
>> >> > +limit  */
>> >> > +#define SMBD_CM_RESPONDER_RESOURCES    32
>> >> > +
>> >> > +/* Maximum number of retries on data transfer operations */
>> >> > +#define SMBD_CM_RETRY                  6
>> >> > +/* No need to retry on Receiver Not Ready since SMBD manages
>> >> > +credits
>> >> */
>> >> > +#define SMBD_CM_RNR_RETRY              0
>> >> > +
>> >> > +/*
>> >> > + * User configurable initial values per SMBD transport connection
>> >> > + * as defined in [MS-SMBD] 3.1.1.1
>> >> > + * Those may change after a SMBD negotiation  */
>> >>
>> >> Since these value are per transport connection, why they are global?
>> >> Shouldn't they be inside a some structure that is created for a
>> >> particular connection? Also the constants below should be defines.
>> >
>> > Those are configurable initial values (default values) for all connections.
>> >
>> > Each connection has its own values based on those initial values. But
>> connection-based values can change after negotiation is done, or after
>> RDMA hardware capabilities are probed.
>>
>> If these are configurable values, let's add a way to actually configure them.
>> Through /proc?
>
> You mean putting them in /proc/fs/cifs?
>
> Or how about module_param?

I am ok with either way. If it is safe to change them without
reloading the module let's do /proc/fs/cifs which would make it easier
to use. Otherwise - module_param is also good.

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve French Sept. 1, 2017, 3:48 p.m. UTC | #6
Probably easier to configure in /proc/fs/cifs than as module param

On Wed, Aug 30, 2017 at 1:30 PM, Pavel Shilovsky via samba-technical
<samba-technical@lists.samba.org> wrote:
> 2017-08-30 11:24 GMT-07:00 Long Li <longli@microsoft.com>:
>>> -----Original Message-----
>>> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
>>> Sent: Wednesday, August 30, 2017 11:19 AM
>>> To: Long Li <longli@microsoft.com>
>>> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
>>> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
>>> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
>>> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
>>> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>
>>> Subject: Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and
>>> transport constants
>>>
>>> 2017-08-29 16:00 GMT-07:00 Long Li <longli@microsoft.com>:
>>> >> -----Original Message-----
>>> >> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
>>> >> Sent: Tuesday, August 29, 2017 3:45 PM
>>> >> To: Long Li <longli@microsoft.com>
>>> >> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
>>> >> cifs@vger.kernel.org>; samba-technical
>>> >> <samba-technical@lists.samba.org>;
>>> >> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
>>> >> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom
>>> >> Talpey <ttalpey@microsoft.com>; Matthew Wilcox
>>> >> <mawilcox@microsoft.com>; Long Li <longli@microsoft.com>
>>> >> Subject: Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and
>>> >> transport constants
>>> >>
>>> >> 2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
>>> >> > From: Long Li <longli@microsoft.com>
>>> >> >
>>> >> > To prepare for protocol implementation, add constants and
>>> >> > user-configurable values in the SMBDirect protocol.
>>> >> >
>>> >> > Signed-off-by: Long Li <longli@microsoft.com>
>>> >> > ---
>>> >> >  fs/cifs/smbdirect.c | 78
>>> >> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> >> >  fs/cifs/smbdirect.h | 20 ++++++++++++++
>>> >> >  2 files changed, 98 insertions(+)
>>> >> >  create mode 100644 fs/cifs/smbdirect.c  create mode 100644
>>> >> > fs/cifs/smbdirect.h
>>> >> >
>>> >> > diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c new file
>>> >> > mode
>>> >> > 100644 index 0000000..d785bc1
>>> >> > --- /dev/null
>>> >> > +++ b/fs/cifs/smbdirect.c
>>> >> > @@ -0,0 +1,78 @@
>>> >> > +/*
>>> >> > + *   Copyright (C) 2017, Microsoft Corporation.
>>> >> > + *
>>> >> > + *   Author(s): Long Li <longli@microsoft.com>
>>> >> > + *
>>> >> > + *   This program is free software;  you can redistribute it and/or modify
>>> >> > + *   it under the terms of the GNU General Public License as published
>>> by
>>> >> > + *   the Free Software Foundation; either version 2 of the License, or
>>> >> > + *   (at your option) any later version.
>>> >> > + *
>>> >> > + *   This program is distributed in the hope that it will be useful,
>>> >> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty
>>> of
>>> >> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
>>> >> > + *   the GNU General Public License for more details.
>>> >> > + */
>>> >> > +#include <linux/module.h>
>>> >> > +#include "smbdirect.h"
>>> >> > +#include "cifs_debug.h"
>>> >> > +
>>> >> > +/* SMBD version number */
>>> >> > +#define SMBD_V1        0x0100
>>> >> > +
>>> >> > +/* Port numbers for SMBD transport */
>>> >> > +#define SMB_PORT       445
>>> >> > +#define SMBD_PORT      5445
>>> >> > +
>>> >> > +/* Address lookup and resolve timeout in ms */
>>> >> > +#define RDMA_RESOLVE_TIMEOUT   5000
>>> >> > +
>>> >> > +/* SMBD negotiation timeout in seconds */ #define
>>> >> > +SMBD_NEGOTIATE_TIMEOUT 120
>>> >> > +
>>> >> > +/* SMBD minimum receive size and fragmented sized defined in [MS-
>>> >> SMBD] */
>>> >> > +#define SMBD_MIN_RECEIVE_SIZE          128
>>> >> > +#define SMBD_MIN_FRAGMENTED_SIZE       131072
>>> >> > +
>>> >> > +/*
>>> >> > + * Default maximum number of RDMA read/write outstanding on this
>>> >> > +connection
>>> >> > + * This value is possibly decreased during QP creation on hardware
>>> >> > +limit  */
>>> >> > +#define SMBD_CM_RESPONDER_RESOURCES    32
>>> >> > +
>>> >> > +/* Maximum number of retries on data transfer operations */
>>> >> > +#define SMBD_CM_RETRY                  6
>>> >> > +/* No need to retry on Receiver Not Ready since SMBD manages
>>> >> > +credits
>>> >> */
>>> >> > +#define SMBD_CM_RNR_RETRY              0
>>> >> > +
>>> >> > +/*
>>> >> > + * User configurable initial values per SMBD transport connection
>>> >> > + * as defined in [MS-SMBD] 3.1.1.1
>>> >> > + * Those may change after a SMBD negotiation  */
>>> >>
>>> >> Since these value are per transport connection, why they are global?
>>> >> Shouldn't they be inside a some structure that is created for a
>>> >> particular connection? Also the constants below should be defines.
>>> >
>>> > Those are configurable initial values (default values) for all connections.
>>> >
>>> > Each connection has its own values based on those initial values. But
>>> connection-based values can change after negotiation is done, or after
>>> RDMA hardware capabilities are probed.
>>>
>>> If these are configurable values, let's add a way to actually configure them.
>>> Through /proc?
>>
>> You mean putting them in /proc/fs/cifs?
>>
>> Or how about module_param?
>
> I am ok with either way. If it is safe to change them without
> reloading the module let's do /proc/fs/cifs which would make it easier
> to use. Otherwise - module_param is also good.
>
> --
> Best regards,
> Pavel Shilovsky
>
diff mbox

Patch

diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
new file mode 100644
index 0000000..d785bc1
--- /dev/null
+++ b/fs/cifs/smbdirect.c
@@ -0,0 +1,78 @@ 
+/*
+ *   Copyright (C) 2017, Microsoft Corporation.
+ *
+ *   Author(s): Long Li <longli@microsoft.com>
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ */
+#include <linux/module.h>
+#include "smbdirect.h"
+#include "cifs_debug.h"
+
+/* SMBD version number */
+#define SMBD_V1	0x0100
+
+/* Port numbers for SMBD transport */
+#define SMB_PORT	445
+#define SMBD_PORT	5445
+
+/* Address lookup and resolve timeout in ms */
+#define RDMA_RESOLVE_TIMEOUT	5000
+
+/* SMBD negotiation timeout in seconds */
+#define SMBD_NEGOTIATE_TIMEOUT	120
+
+/* SMBD minimum receive size and fragmented sized defined in [MS-SMBD] */
+#define SMBD_MIN_RECEIVE_SIZE		128
+#define SMBD_MIN_FRAGMENTED_SIZE	131072
+
+/*
+ * Default maximum number of RDMA read/write outstanding on this connection
+ * This value is possibly decreased during QP creation on hardware limit
+ */
+#define SMBD_CM_RESPONDER_RESOURCES	32
+
+/* Maximum number of retries on data transfer operations */
+#define SMBD_CM_RETRY			6
+/* No need to retry on Receiver Not Ready since SMBD manages credits */
+#define SMBD_CM_RNR_RETRY		0
+
+/*
+ * User configurable initial values per SMBD transport connection
+ * as defined in [MS-SMBD] 3.1.1.1
+ * Those may change after a SMBD negotiation
+ */
+/* The local peer's maximum number of credits to grant to the peer */
+static int receive_credit_max = 255;
+/* The remote peer's credit request of local peer */
+static int send_credit_target = 255;
+/* The maximum single message size can be sent to remote peer */
+static int max_send_size = 1364;
+/*  The maximum fragmented upper-layer payload receive size supported */
+static int max_fragmented_recv_size = 1024 * 1024;
+/*  The maximum single-message size which can be received */
+static int max_receive_size = 8192;
+
+/* The timeout to initiate send of a keepalive message on idle */
+static int keep_alive_interval = 120;
+
+/*
+ * User configurable initial values for RDMA transport
+ * The actual values used may be lower and are limited to hardware capabilities
+ */
+/* Default maximum number of SGEs in a RDMA send/recv */
+static int max_send_sge = SMBDIRECT_MAX_SGE;
+static int max_recv_sge = SMBDIRECT_MAX_SGE;
+/* Default maximum number of SGEs in a RDMA write/read */
+static int max_frmr_depth = 2048;
+
+/* If payload is less than this byte, use RDMA send/recv not read/write */
+static int rdma_readwrite_threshold = 4096;
diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h
new file mode 100644
index 0000000..06eeb0b
--- /dev/null
+++ b/fs/cifs/smbdirect.h
@@ -0,0 +1,20 @@ 
+/*
+ *   Copyright (C) 2017, Microsoft Corporation.
+ *
+ *   Author(s): Long Li <longli@microsoft.com>
+ *
+ *   This program is free software;  you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ */
+#ifndef _SMBDIRECT_H
+#define _SMBDIRECT_H
+
+#define SMBDIRECT_MAX_SGE	16
+#endif