[PATCH 2/2] smb: server: correct value for smb_direct_max_fragmented_recv_size

Stefan Metzmacher metze at samba.org
Fri Feb 6 15:15:48 UTC 2026


Am 06.02.26 um 16:09 schrieb Namjae Jeon:
>> -/*  The maximum fragmented upper-layer payload receive size supported */
>> -static int smb_direct_max_fragmented_recv_size = 1024 * 1024;
>> +/*
>> + * The maximum fragmented upper-layer payload receive size supported
>> + *
>> + * Assume max_payload_per_credit is
>> + * smb_direct_receive_credit_max - 24 = 1340
>> + *
>> + * The maximum number would be
>> + * smb_direct_receive_credit_max * max_payload_per_credit
>> + *
>> + *                       1340 * 255 = 341700 (0x536C4)
>> + *
>> + * The minimum value from the spec is 131072 (0x20000)
>> + *
>> + * For now we use the logic we used before:
>> + *                 (1364 * 255) / 2 = 173910 (0x2A756)
>> + */
>> +static int smb_direct_max_fragmented_recv_size = (1364 * 255) / 2;
>>
>>   /*  The maximum single-message size which can be received */
>>   static int smb_direct_max_receive_size = 1364;
>> @@ -2531,6 +2546,29 @@ static int smb_direct_prepare(struct ksmbd_transport *t)
>>                                    le32_to_cpu(req->max_receive_size));
>>          sp->max_fragmented_send_size =
>>                  le32_to_cpu(req->max_fragmented_size);
>> +       /*
>> +        * The maximum fragmented upper-layer payload receive size supported
>> +        *
>> +        * Assume max_payload_per_credit is
>> +        * smb_direct_receive_credit_max - 24 = 1340
>> +        *
>> +        * The maximum number would be
>> +        * smb_direct_receive_credit_max * max_payload_per_credit
>> +        *
>> +        *                       1340 * 255 = 341700 (0x536C4)
>> +        *
>> +        * The minimum value from the spec is 131072 (0x20000)
>> +        *
>> +        * For now we use the logic we used before:
>> +        *                 (1364 * 255) / 2 = 173910 (0x2A756)
> These comments explaining the calculation is currently duplicated in
> both the global variable declaration and inside smb_direct_prepare().

Yes, that's exactly what I wanted.

In my smbdirect.ko patches smb_direct_prepare() will be removed
and the comment moves to smbdirect_accept.c where there's no
direct link between them anymore.

I'd also like to keep this in order to remind me that
we need a more useful solution to this.

Windows offers a max fragmented size of 1048576 (0x100000)

metze




More information about the samba-technical mailing list