Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp2131lqj; Wed, 10 Apr 2024 01:43:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoRCfxVNX7wROCHOBb1CjE7TtYhawguMTJxpvBosrbWrvRnPafDtvwhenDvFLrCaX3rv0o11zsCyM5/+HcAF8z2/aY1TOAupBsXfH3kA== X-Google-Smtp-Source: AGHT+IHdirbIzVO8ncKnea46K6mOaV3siExC3qFSQLw5EA6W0aF9bHABA6JyQXM95jWl3AReVhEB X-Received: by 2002:a50:d50e:0:b0:56b:f5ae:c6b2 with SMTP id u14-20020a50d50e000000b0056bf5aec6b2mr1321718edi.13.1712738607855; Wed, 10 Apr 2024 01:43:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712738607; cv=pass; d=google.com; s=arc-20160816; b=QwBVlIm7stgH4T+AKHKa30VeTG4rX2uMgUP2G9WI4BBr3zQzQIp53qSUkUpV1eQS28 XZKKfkQEe1DjVvmtoziJ7Ob/uuKdf+lAdeatJnoSor7oU5fgR5cgZBgYPJT4eFiKF0w/ PI8tFT5qpXzcgFHFZbnXnRU7PT0zqbA3qmguPDjxklRHDnvRGTYO2CIAf1H210vgKL/h TuAXa5TIjOfYgGjufgh2whgL1y4vjIAxB9zF1liGDvKvGGPKIETAHDKAksSsy4CPy21M uv4pdBQgRNG7uqaXupDLqrYbKUAeaj6JSsfnQGTeJK4HEyCr7XwnKwtiZnvbAZtUDDKj U8UQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=9N4q+oLGK9k6KLGhVJcDkPU1rDuX/lRFIqa9J41UoxY=; fh=ujksmUrBEjpGhQjWbrjZMx9PDXUXbYR/j4y8MAq1x1o=; b=EO1TR1oWU3TpP/Xc6a+VQW0iSmfKpPXuyQ4Z/9ue5Ixqb9bj9+ZHKKn9zBn0JGvzlF eMKfGECOuWHYkqa2Kk7GjXmBN7jcRpJkwbEgjHNUHREk0XiYGkF9hYxRBbl2VqUaUFhp G9YPEvE4wQ0RxIItVK+MjQrbQDAzd/tg5O/ImZv/Dth3iLPMIePrrjPTes91SHRSnOCL Ru87M/HeRAGVmzFsipgPj8NZ2PzQiFDSga2Kps7MfSvRtRKe8qJni5UXVXsRMOmdSh8r Ny/ZNbdXR6Lcm3JJWvQ7ZQCICNRnBmbnlLS1qJuVc/XA63iNxTWD38oP4n/0axGEpSQ8 Itiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VI4G85Vb; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-138185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t1-20020a50d701000000b00568d7c22d4asi5804272edi.277.2024.04.10.01.43.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 01:43:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VI4G85Vb; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-138185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 678D71F22028 for ; Wed, 10 Apr 2024 08:43:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCBFD156C61; Wed, 10 Apr 2024 08:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="VI4G85Vb" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E5AD154C0B; Wed, 10 Apr 2024 08:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712738560; cv=none; b=EBzXObd4H5pMOEGHofy/+EO3nrOksT/PDfUaKqEKauuGwCeTjXmT79/xV7x6mzNU1/yIFqiZInZHlr1Pw8+CWPz73m3FC0lvB6XcWaiZoytJeffn+E3GmgmO1qLOCiGfuUQbrAhRh3hoVem8F/Y/amXM4I/71BiFu9aIr8/j6QQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712738560; c=relaxed/simple; bh=hbSVyZ3kKFZF5CHaA43SBpkQYfyXXseK4sm8AXa/AJA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZJXFcr6Rqxngc/7lzO01mirhXD7DWmxR3Y8IqljDDxpuyLSGuErLAxym0+QeTp18PAUBDPNNgW7Xgw+VjF1vnehVYKTHrruKzwQbF5WQ4CzEze8WBcajkEN1i37hjKKhKpRn1C1p7jM7Nmg84RxDOo0b8VxBRwf0mPkRitK1Tik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=VI4G85Vb; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id B08BE20EB201; Wed, 10 Apr 2024 01:42:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B08BE20EB201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1712738557; bh=9N4q+oLGK9k6KLGhVJcDkPU1rDuX/lRFIqa9J41UoxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VI4G85VbGDC9o117uSNLkvhdifyvvZzkc4AwKwiMcQ3nQZxE+5AQ35yPL60SqsdVL VdM/oVtAcSvKVqbPZ7zz6j0+Ehvl9JmV9QGZOtpfDa4Lv4Y3zLTCYSWXD7fFaXsStj uj6+KYzQtmC9vqwQJ3rxEBbkZf+Q0yKRX3ZVIKVc= From: Konstantin Taranov To: kotaranov@microsoft.com, sharmaajay@microsoft.com, longli@microsoft.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-next v3 3/6] RDMA/mana_ib: implement port parameters Date: Wed, 10 Apr 2024 01:42:28 -0700 Message-Id: <1712738551-22075-4-git-send-email-kotaranov@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1712738551-22075-1-git-send-email-kotaranov@linux.microsoft.com> References: <1712738551-22075-1-git-send-email-kotaranov@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Konstantin Taranov Implement port parameters for RNIC: 1) extend query_port() method 2) implement get_link_layer() 3) implement query_pkey() Only port 1 can store GIDs. Signed-off-by: Konstantin Taranov --- drivers/infiniband/hw/mana/device.c | 2 ++ drivers/infiniband/hw/mana/main.c | 37 +++++++++++++++++++++++++++- drivers/infiniband/hw/mana/mana_ib.h | 4 +++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c index a98a04ff92e5..47547a962b19 100644 --- a/drivers/infiniband/hw/mana/device.c +++ b/drivers/infiniband/hw/mana/device.c @@ -29,12 +29,14 @@ static const struct ib_device_ops mana_ib_dev_ops = { .destroy_rwq_ind_table = mana_ib_destroy_rwq_ind_table, .destroy_wq = mana_ib_destroy_wq, .disassociate_ucontext = mana_ib_disassociate_ucontext, + .get_link_layer = mana_ib_get_link_layer, .get_port_immutable = mana_ib_get_port_immutable, .mmap = mana_ib_mmap, .modify_qp = mana_ib_modify_qp, .modify_wq = mana_ib_modify_wq, .query_device = mana_ib_query_device, .query_gid = mana_ib_query_gid, + .query_pkey = mana_ib_query_pkey, .query_port = mana_ib_query_port, .reg_user_mr = mana_ib_reg_user_mr, diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index aa3cac8d3edb..29550f2173ff 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -557,7 +557,42 @@ int mana_ib_query_device(struct ib_device *ibdev, struct ib_device_attr *props, int mana_ib_query_port(struct ib_device *ibdev, u32 port, struct ib_port_attr *props) { - /* This version doesn't return port properties */ + struct net_device *ndev = mana_ib_get_netdev(ibdev, port); + + if (!ndev) + return -EINVAL; + + memset(props, 0, sizeof(*props)); + props->max_mtu = IB_MTU_4096; + props->active_mtu = ib_mtu_int_to_enum(ndev->mtu); + + if (netif_carrier_ok(ndev) && netif_running(ndev)) { + props->state = IB_PORT_ACTIVE; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; + } else { + props->state = IB_PORT_DOWN; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; + } + + props->active_width = IB_WIDTH_4X; + props->active_speed = IB_SPEED_EDR; + props->pkey_tbl_len = 1; + if (port == 1) + props->gid_tbl_len = 16; + + return 0; +} + +enum rdma_link_layer mana_ib_get_link_layer(struct ib_device *device, u32 port_num) +{ + return IB_LINK_LAYER_ETHERNET; +} + +int mana_ib_query_pkey(struct ib_device *ibdev, u32 port, u16 index, u16 *pkey) +{ + if (index != 0) + return -EINVAL; + *pkey = IB_DEFAULT_PKEY_FULL; return 0; } diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index 842f9c63a495..b9117cbc7629 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -266,4 +266,8 @@ void mana_ib_destroy_eqs(struct mana_ib_dev *mdev); int mana_ib_gd_create_rnic_adapter(struct mana_ib_dev *mdev); int mana_ib_gd_destroy_rnic_adapter(struct mana_ib_dev *mdev); + +int mana_ib_query_pkey(struct ib_device *ibdev, u32 port, u16 index, u16 *pkey); + +enum rdma_link_layer mana_ib_get_link_layer(struct ib_device *device, u32 port_num); #endif -- 2.43.0