Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp359289imi; Thu, 21 Jul 2022 02:18:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sJBlyDtlUk22UJY1UiNdehG4efe5uYh1PzD0dKxE6eY/2dzJkNEWHTnf2wAxx5ZeI1ecGw X-Received: by 2002:a63:541:0:b0:419:aea5:eff9 with SMTP id 62-20020a630541000000b00419aea5eff9mr33532138pgf.291.1658395133084; Thu, 21 Jul 2022 02:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658395133; cv=none; d=google.com; s=arc-20160816; b=BkkaqvuH7N5ILXQ4voketQQVpP7fh3hbvKhmCCnHTRLTcfFjLVFQFU9K43Wx8uVn46 GGUgmwgQkVFjKt1MEaUZoheEHp+M7GN1+bOM2gZVglGo07GD0vtU+5FN9wxNn2px9dT1 vG1k7ZAUKBvbhGVN69oZ7DSyEGTV8uqDPtLYsJ09rORpSpxbdOSmSeNJwrXBCdpGWUkA cycZ3/PitRtD0otQHMXjza1GtXgJLxu/ZXsnmeFrD21Uem7/0lfh/LKUwBeUuOCzmoaT JtUuAoyPVvOAThukS2i0vtLeyk/6apNBC6yvONJO5haxaGPw+UT9KUwOBG66xwE7wGlf 6gsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=EbdxWTFkefH+1weDK7ilXEE+RRncdPVZYQd6MjgVlnY=; b=jOExCZQHhP+E4BDbbJI6HKdN+f7ud/37Raaz/NHErkME2fH78NDWC80VO3f754mHR8 EJcfefI60FiTbUl3YXf65b8C1tI8e52JmUsWdYQzPl+nO1aOLuiYC7ZO+LAp21taS2iB fYIYgD/UpS86jPC0a3r94PyzdLeR2IOkrMmCuoNQ9Ck7+j0jqLLq6Pha3jlyNZhp8//R NH8c3UnBK2HfU83DzWDPeNGa9OBnrRPlf5AOcSD6CTEpFbMfwQCE82llFrkoqbPRe6lE ZfP9BbartbcOQCZrZm8kSwMfrOTsMe998OQOU7odS3Nhp41lOGnib07D/SDwtch1S7rv gIfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a63040f000000b003fcf1182db5si1552253pge.530.2022.07.21.02.18.38; Thu, 21 Jul 2022 02:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232385AbiGUJRR (ORCPT + 99 others); Thu, 21 Jul 2022 05:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbiGUJRQ (ORCPT ); Thu, 21 Jul 2022 05:17:16 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 729222B1B6; Thu, 21 Jul 2022 02:17:09 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=chengyou@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0VK.Qu92_1658395024; Received: from 192.168.0.4(mailfrom:chengyou@linux.alibaba.com fp:SMTPD_---0VK.Qu92_1658395024) by smtp.aliyun-inc.com; Thu, 21 Jul 2022 17:17:06 +0800 Message-ID: Date: Thu, 21 Jul 2022 17:17:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Cheng Xu Subject: Re: [Patch v4 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter To: longli@microsoft.com, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , Leon Romanovsky , edumazet@google.com, shiraz.saleem@intel.com, Ajay Sharma Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org References: <1655345240-26411-1-git-send-email-longli@linuxonhyperv.com> <1655345240-26411-13-git-send-email-longli@linuxonhyperv.com> Content-Language: en-US In-Reply-To: <1655345240-26411-13-git-send-email-longli@linuxonhyperv.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/16/22 10:07 AM, longli@linuxonhyperv.com wrote: > From: Long Li > <...> > + > +static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, > + struct ib_qp_init_attr *attr, > + struct ib_udata *udata) > +{ > + struct mana_ib_pd *pd = container_of(ibpd, struct mana_ib_pd, ibpd); > + struct mana_ib_qp *qp = container_of(ibqp, struct mana_ib_qp, ibqp); > + struct mana_ib_dev *mdev = > + container_of(ibpd->device, struct mana_ib_dev, ib_dev); > + struct mana_ib_cq *send_cq = > + container_of(attr->send_cq, struct mana_ib_cq, ibcq); > + struct ib_ucontext *ib_ucontext = ibpd->uobject->context; > + struct mana_ib_create_qp_resp resp = {}; > + struct mana_ib_ucontext *mana_ucontext; > + struct gdma_dev *gd = mdev->gdma_dev; > + struct mana_ib_create_qp ucmd = {}; > + struct mana_obj_spec wq_spec = {}; > + struct mana_obj_spec cq_spec = {}; > + struct mana_port_context *mpc; > + struct mana_context *mc; > + struct net_device *ndev; > + struct ib_umem *umem; > + int err; > + u32 port; > + > + mana_ucontext = > + container_of(ib_ucontext, struct mana_ib_ucontext, ibucontext); > + mc = gd->driver_data; > + > + if (udata->inlen < sizeof(ucmd)) > + return -EINVAL; > + > + err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd), udata->inlen)); > + if (err) { > + ibdev_dbg(&mdev->ib_dev, > + "Failed to copy from udata create qp-raw, %d\n", err); > + return -EFAULT; > + } > + > + /* IB ports start with 1, MANA Ethernet ports start with 0 */ > + port = ucmd.port; > + if (ucmd.port > mc->num_ports) > + return -EINVAL; > + > + if (attr->cap.max_send_wr > MAX_SEND_BUFFERS_PER_QUEUE) { > + ibdev_dbg(&mdev->ib_dev, > + "Requested max_send_wr %d exceeding limit\n", > + attr->cap.max_send_wr); > + return -EINVAL; > + } > + > + if (attr->cap.max_send_sge > MAX_TX_WQE_SGL_ENTRIES) { > + ibdev_dbg(&mdev->ib_dev, > + "Requested max_send_sge %d exceeding limit\n", > + attr->cap.max_send_sge); > + return -EINVAL; > + } > + > + ndev = mc->ports[port - 1]; > + mpc = netdev_priv(ndev); > + ibdev_dbg(&mdev->ib_dev, "port %u ndev %p mpc %p\n", port, ndev, mpc); > + > + err = mana_ib_cfg_vport(mdev, port - 1, pd, mana_ucontext->doorbell); > + if (err) > + return -ENODEV; > + > + qp->port = port; > + > + ibdev_dbg(&mdev->ib_dev, "ucmd sq_buf_addr 0x%llx port %u\n", > + ucmd.sq_buf_addr, ucmd.port); > + > + umem = ib_umem_get(ibpd->device, ucmd.sq_buf_addr, ucmd.sq_buf_size, > + IB_ACCESS_LOCAL_WRITE); > + if (IS_ERR(umem)) { > + err = PTR_ERR(umem); > + ibdev_dbg(&mdev->ib_dev, > + "Failed to get umem for create qp-raw, err %d\n", > + err); > + goto err_free_vport; > + } > + qp->sq_umem = umem; > + > + err = mana_ib_gd_create_dma_region(mdev, qp->sq_umem, > + &qp->sq_gdma_region, PAGE_SIZE); > + if (err) { > + ibdev_err(&mdev->ib_dev, > + "Failed to create dma region for create qp-raw, %d\n", > + err); It is better not print in userspace-triggered paths. There are also same issues in other paths. Thanks, Cheng Xu