From patchwork Tue Dec 16 15:02:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Wang X-Patchwork-Id: 5501011 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1DE3EBEEA8 for ; Tue, 16 Dec 2014 15:02:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF46B20A1A for ; Tue, 16 Dec 2014 15:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7780E20A1E for ; Tue, 16 Dec 2014 15:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751013AbaLPPCe (ORCPT ); Tue, 16 Dec 2014 10:02:34 -0500 Received: from mail-ie0-f172.google.com ([209.85.223.172]:34323 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936AbaLPPCe (ORCPT ); Tue, 16 Dec 2014 10:02:34 -0500 Received: by mail-ie0-f172.google.com with SMTP id tr6so13082253ieb.3 for ; Tue, 16 Dec 2014 07:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RRfSjlTTj3/Mg5XoLHdAdthY2bxctebagzlJy8naA7o=; b=Q5wHzT1G2M9ibeH1f3TBy8LvaGRLtlsZarYL1idY1+tYazIpSpiT05TZJx92a3XUlF F6o7zaLLGWnHjSnmRtAEr88OEnQ5v1e1IzMdtEP8kj264Et+YWndlmHtVz8sBUepm14G OBsKzQ7NEkrMoPmFzSWNtB+hqhcbxlG+49xw5S3DW68SMsvxA0TOCg5SWM7WZtSjgop/ X7h8FcPgjzZ34PJ/x0p5KXUXJnjwW8ihxkdp05uyHHFGTvcc46MWQ1SUT50SyB0EDYb7 Q7JUWwiWMA7qCvwSHntgSOYxVirS/m9MP14J7vtOwHKqzyg6hhvQZHbaqlAcOnG84+7G hGqg== MIME-Version: 1.0 X-Received: by 10.50.134.65 with SMTP id pi1mr2952200igb.32.1418742153312; Tue, 16 Dec 2014 07:02:33 -0800 (PST) Received: by 10.107.150.204 with HTTP; Tue, 16 Dec 2014 07:02:33 -0800 (PST) In-Reply-To: <20141216143242.GB4401@fholler.de> References: <20141216143242.GB4401@fholler.de> Date: Tue, 16 Dec 2014 16:02:33 +0100 Message-ID: Subject: Re: First byte of private_data transfered with rdma_connect() is always 0 From: Jack Wang To: Fabian Holler Cc: "linux-rdma@vger.kernel.org" Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Found the bug. commit 56e620c453f2588cfc9898a41b110477f6417a5d Author: Jack Wang Date: Tue Dec 16 15:44:17 2014 +0100 RDMA/cma: fix first byte overwritten for AF_IB If user attach private data for AF_IB, the first byte will be overwritten, because we always set the cma version no matter family is AF_IB, so move the version set inside if condition. Reported-by: Fabian Holler Signed-off-by: Jack Wang @@ -2632,6 +2632,7 @@ static int cma_format_hdr(void *hdr, struct rdma_id_private *id_priv) } else if (cma_family(id_priv) == AF_INET6) { struct sockaddr_in6 *src6, *dst6; + cma_hdr->cma_version = CMA_VERSION; src6 = (struct sockaddr_in6 *) cma_src_addr(id_priv); dst6 = (struct sockaddr_in6 *) cma_dst_addr(id_priv); 2014-12-16 15:32 GMT+01:00 Fabian Holler : > Hello, > > we are using the conn_param->private_data field to transfer data with the > rdma_connect() call to the server. > When it's done on a RDMA_PS_IB rdma_cm_id the first Byte of the > private_data, that is received by the server is _always_ 0. > When a RDMA_PS_TCP rdma_cm_id is used, the data is received correctly on the > server. > > We are using: > - kernel 3.14.13 > - Mellanox Technologies MT26428 HCA > - mlx4_0 driver > > I attached a simple client and server module to reproduce the behaviour. > Can somebody have a look? Is there a problem in our modules? Or is it a bug? > > ---------- > Connection establishment via GID (RDMA_PS_IB): > client: > # insmod client.ko gid_addr=fe80:0000:0000:0000:0002:c903:0010:c0f5 > [ 7328.586773] private_dataffff88022a263c50: 57 48 41 5a 20 55 50 20 53 45 52 56 45 52 3f 00 WHAZ UP SERVER?. > > server: > [ 1658.208238] private_dataffff8800b93e3bec: 00 48 41 5a 20 55 50 20 53 45 52 56 45 52 3f 00 .HAZ UP SERVER?. > [ 1658.208239] private_dataffff8800b93e3bfc: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1658.208241] private_dataffff8800b93e3c0c: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1658.208242] private_dataffff8800b93e3c1c: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1658.208244] private_dataffff8800b93e3c2c: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1658.208245] private_dataffff8800b93e3c3c: 00 00 00 00 00 00 00 00 00 00 00 00 ............ > > > Connection establishment via IPv4 address (RDMA_PS_TCP): > client: > # insmod client.ko ip_addr=10.50.100.62 > [ 7179.219773] private_dataffff88022a263c50: 57 48 41 5a 20 55 50 20 53 45 # 52 56 45 52 3f 00 WHAZ UP SERVER?. > > server: > [ 1508.840508] private_dataffff8800b8d25b90: 57 48 41 5a 20 55 50 20 53 45 52 56 45 52 3f 00 WHAZ UP SERVER?. > [ 1508.840509] private_dataffff8800b8d25ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1508.840511] private_dataffff8800b8d25bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > [ 1508.840512] private_dataffff8800b8d25bc0: 00 00 00 00 00 00 00 00 ........ > ---------- > > > thanks > > Fabian --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index d570030..22a22e2 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2618,10 +2618,10 @@ static int cma_format_hdr(void *hdr, struct rdma_id_private *id_priv) struct cma_hdr *cma_hdr; cma_hdr = hdr; - cma_hdr->cma_version = CMA_VERSION; if (cma_family(id_priv) == AF_INET) { struct sockaddr_in *src4, *dst4; + cma_hdr->cma_version = CMA_VERSION; src4 = (struct sockaddr_in *) cma_src_addr(id_priv); dst4 = (struct sockaddr_in *) cma_dst_addr(id_priv);