diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-09-18 18:38:14 +0200 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-04-15 21:58:23 -0500 |
| commit | d5e2bdda493f10ccc8e7c3545f79e2505ee94dff (patch) | |
| tree | 14c2bdcc6e88ce690b64013fed2967e487be021f | |
| parent | ab8e9249e735f8801039f7eef7ca556d65f64b2b (diff) | |
smb: server: make use of smbdirect_connection_negotiate_rdma_resources()
It's good to have this logic in a central place, it will allow us
share more code soon.
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
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>
| -rw-r--r-- | fs/smb/server/transport_rdma.c | 62 |
1 files changed, 7 insertions, 55 deletions
diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c index b7672558676d..61c84d99acea 100644 --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -2307,66 +2307,18 @@ static int smb_direct_handle_connect_request(struct rdma_cm_id *new_cm_id, sc = &t->socket; sp = &sc->parameters; - peer_initiator_depth = event->param.conn.initiator_depth; - peer_responder_resources = event->param.conn.responder_resources; - if (rdma_protocol_iwarp(new_cm_id->device, new_cm_id->port_num) && - event->param.conn.private_data_len == 8) { - /* - * Legacy clients with only iWarp MPA v1 support - * need a private blob in order to negotiate - * the IRD/ORD values. - */ - const __be32 *ird_ord_hdr = event->param.conn.private_data; - u32 ird32 = be32_to_cpu(ird_ord_hdr[0]); - u32 ord32 = be32_to_cpu(ird_ord_hdr[1]); - - /* - * cifs.ko sends the legacy IRD/ORD negotiation - * event if iWarp MPA v2 was used. - * - * Here we check that the values match and only - * mark the client as legacy if they don't match. - */ - if ((u32)event->param.conn.initiator_depth != ird32 || - (u32)event->param.conn.responder_resources != ord32) { - /* - * There are broken clients (old cifs.ko) - * using little endian and also - * struct rdma_conn_param only uses u8 - * for initiator_depth and responder_resources, - * so we truncate the value to U8_MAX. - * - * smb_direct_accept_client() will then - * do the real negotiation in order to - * select the minimum between client and - * server. - */ - ird32 = min_t(u32, ird32, U8_MAX); - ord32 = min_t(u32, ord32, U8_MAX); - - sc->rdma.legacy_iwarp = true; - peer_initiator_depth = (u8)ird32; - peer_responder_resources = (u8)ord32; - } - } - /* * First set what the we as server are able to support */ sp->initiator_depth = min_t(u8, sp->initiator_depth, - new_cm_id->device->attrs.max_qp_rd_atom); + sc->ib.dev->attrs.max_qp_rd_atom); - /* - * negotiate the value by using the minimum - * between client and server if the client provided - * non 0 values. - */ - if (peer_initiator_depth != 0) - sp->initiator_depth = min_t(u8, sp->initiator_depth, - peer_initiator_depth); - if (peer_responder_resources != 0) - sp->responder_resources = min_t(u8, sp->responder_resources, - peer_responder_resources); + peer_initiator_depth = event->param.conn.initiator_depth; + peer_responder_resources = event->param.conn.responder_resources; + smbdirect_connection_negotiate_rdma_resources(sc, + peer_initiator_depth, + peer_responder_resources, + &event->param.conn); ret = smb_direct_connect(sc); if (ret) |
