From patchwork Tue Nov 3 07:18:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93581C388F9 for ; Tue, 3 Nov 2020 14:12:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E9BC22243 for ; Tue, 3 Nov 2020 14:12:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ONFaDRvi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729634AbgKCOM5 (ORCPT ); Tue, 3 Nov 2020 09:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729248AbgKCOLt (ORCPT ); Tue, 3 Nov 2020 09:11:49 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2CEC0613D1 for ; Tue, 3 Nov 2020 06:11:49 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id y14so14271253pfp.13 for ; Tue, 03 Nov 2020 06:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EUMy7Zq/F/BENdHKHHaH6mRJFyN2oA04ziP7UtBR00k=; b=ONFaDRviNEWYSgCY4HnBIyGtLVZQQdfI+TaXP4O3j+snSYKij4RX3+eD2qhMXWAcFg E9tc1h5zBvupQ9forIImlWCuwXi8om4V9O2vqLmSexZ6eRmNEBx77bNd2pw9q5nVFW+2 iGXy0FJacZyBTeIyOPMKk0EPDLA78JuttTCtc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EUMy7Zq/F/BENdHKHHaH6mRJFyN2oA04ziP7UtBR00k=; b=AhVlhVjOKeYREsfmcIrR8c6mwtbDCU2dMGYIj0OtJDwAxGXu7kmzeciYTn7xd/JeBU DHxQI9qJjRNdGScahRC5ujvOdMlg0baDC5NamlfXoazLK396JL96Odj4XrQKVpXTtbgq 1CxbMX0WdqRdshXcj1ZwEt/POhQmOKQKlwPSBLi14YuQ3M9PunAEyIq4n9xk5Vo5tRqN ZoS3ESY2LW8CCkgewoK7/TKGhnV8f8o4XBYRJDhsFefOmllhjZfIFRGIO1ksLUJCl25/ qFHN2Q0jxI62Q5phiKiFDwVKA7agj+P+QgtUWImjO7cdhQo0PCO8m+9/k26pP6Itge/G LjbA== X-Gm-Message-State: AOAM533KfTvh1ody/cIBGfEzruNh/lKwPcOb4VhyV7lIGbFj9tBmVTBE io9DDrWDG+L3zYoUhVOYh+6R/A== X-Google-Smtp-Source: ABdhPJyNsgeo5p08Ruv90PKkCbLlOxm3tADTSwlYgWNXT5vkuvTn15rdwfPhu0UM2M870V2pz0/F6g== X-Received: by 2002:a17:90a:6c61:: with SMTP id x88mr4197999pjj.13.1604412708631; Tue, 03 Nov 2020 06:11:48 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.11.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:11:47 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Muneendra Subject: [PATCH v3 01/19] cgroup: Added cgroup_get_from_kernfs_id Date: Tue, 3 Nov 2020 12:48:05 +0530 Message-Id: <1604387903-20006-2-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new function cgroup_get_from_kernfs_id to retrieve the cgroup associated with cgroup id. It takes cgroupid as an argument and returns cgrp and on failure it returns NULL. Exported the same as this can be used by blk-cgorup.c Added function declaration of cgroup_get_from_kernfs_id in cgorup.h Exported the cgroup_get_e_css Signed-off-by: Muneendra Acked-by: Tejun Heo --- v3: Exported the cgroup_get_e_css v2: New patch --- include/linux/cgroup.h | 6 ++++++ kernel/cgroup/cgroup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 618838c48313..1741f02a41d6 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -696,6 +696,7 @@ static inline void cgroup_kthread_ready(void) } void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen); +struct cgroup *cgroup_get_from_kernfs_id(u64 id); #else /* !CONFIG_CGROUPS */ struct cgroup_subsys_state; @@ -743,6 +744,11 @@ static inline bool task_under_cgroup_hierarchy(struct task_struct *task, static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) {} + +static struct cgroup *cgroup_get_from_kernfs_id(u64 id) +{ + return NULL; +} #endif /* !CONFIG_CGROUPS */ #ifdef CONFIG_CGROUPS diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index dd247747ec14..53046deeb9ca 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -580,6 +580,7 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp, rcu_read_unlock(); return css; } +EXPORT_SYMBOL_GPL(cgroup_get_e_css); static void cgroup_get_live(struct cgroup *cgrp) { @@ -5803,6 +5804,31 @@ void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) kernfs_put(kn); } +/* + * cgroup_get_from_kernfs_id : get the cgroup associated with cgroup id + * @id: cgroup id + * On success it returns the cgrp on failure it returns NULL + */ +struct cgroup *cgroup_get_from_kernfs_id(u64 id) +{ + struct kernfs_node *kn; + struct cgroup *cgrp = NULL; + + mutex_lock(&cgroup_mutex); + kn = kernfs_find_and_get_node_by_id(cgrp_dfl_root.kf_root, id); + if (!kn) + goto out_unlock; + + cgrp = kn->priv; + if (cgroup_is_dead(cgrp) || !cgroup_tryget(cgrp)) + cgrp = NULL; + kernfs_put(kn); +out_unlock: + mutex_unlock(&cgroup_mutex); + return cgrp; +} +EXPORT_SYMBOL_GPL(cgroup_get_from_kernfs_id); + /* * proc_cgroup_show() * - Print task's cgroup paths into seq_file, one line for each hierarchy From patchwork Tue Nov 3 07:18:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBAA2C55179 for ; Tue, 3 Nov 2020 14:12:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 851C622264 for ; Tue, 3 Nov 2020 14:12:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="DYG3980Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729631AbgKCOM4 (ORCPT ); Tue, 3 Nov 2020 09:12:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729574AbgKCOL4 (ORCPT ); Tue, 3 Nov 2020 09:11:56 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F2DAC0613D1 for ; Tue, 3 Nov 2020 06:11:56 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id e7so14262809pfn.12 for ; Tue, 03 Nov 2020 06:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w7CE0cxjC01o2eVLK4UsKW4yh3w6IbG1Xvq7VjIHFfE=; b=DYG3980ZxCyYVXcMUa5yyXHJ2GqREvjUePSbgBGN4Lx5tJqH/7D2D7FWVUuvTbUyEj KdwfNGKPCuOUX1VthNRIf6YQz15+aOakgrpo/b5yIK4i4ggwPUBa9nEH2JUnvHZoC0UA LNqQIAylhugIZCSmnLoljdjjRnJ+MW9JKT/4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w7CE0cxjC01o2eVLK4UsKW4yh3w6IbG1Xvq7VjIHFfE=; b=IvcZ+zetBQDocOcu0l6kF0xFrsXPScvDuQPhql91cD/k2nTADMvZfZbeWNAOa3DVzE Ua8WpPixqix3Sr57R4KpJimddjlnmzDt8nlExK2CqBsNaMCf1d52ERs8UqAFn7a6ZrLT QJZUQHjwc0iT5gB8ok9kV1eav0Tx07bEHZnR3sNVdL1jchhN2KnvJ5xzksaikz0vXCaO NkUu6B4E6/dAIH3anMoekJHPcFe3huG36LYxw0qQAAcYE8BuotWy9swH51iP4ZqFxBU0 6/F4qw4GSYETb8/JbdhNOqxrPRPRQPKFtb28bpkbci1nqRCTxUOheWpLnuIJvONwqS+C 5raA== X-Gm-Message-State: AOAM53140FA9z4YE7vimfp91VCdG1e3WOY3VEM5OjQMv5knjrTXjOvmz ybgh6MJ+bL7yWHEwh0Cj++G23A== X-Google-Smtp-Source: ABdhPJypbfxV4UjJ5AVrnbIV69EoLJwvAfmkbg/us8J/wtAd8akA7c98//sN9xy+1W7oXsGP5LgLkQ== X-Received: by 2002:a17:90b:3505:: with SMTP id ls5mr3892847pjb.134.1604412716072; Tue, 03 Nov 2020 06:11:56 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.11.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:11:55 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Muneendra Subject: [PATCH v3 03/19] nvme: Added a newsysfs attribute appid_store Date: Tue, 3 Nov 2020 12:48:07 +0530 Message-Id: <1604387903-20006-4-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new sysfs attribute appid_store under /sys/class/fc/fc_udev_device/* With this new interface the user can set the application identfier in the blkcg associted with cgroup id. Once the application identifer has set with this interface it allows identification of traffic sources at an individual cgroup based Applications (ex:virtual machine (VM))level in both host and fabric infrastructure(FC). Below is the interface provided to set the app_id echo ":" >> /sys/class/fc/fc_udev_device/appid_store echo "457E:100000109b521d27" >> /sys/class/fc/fc_udev_device/appid_store Signed-off-by: Muneendra --- v3: Replaced blkcg_set_app_identifier function with blkcg_set_fc_appid v2: New Patch --- drivers/nvme/host/fc.c | 73 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index eae43bb444e0..6d6cc06fd54a 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -9,7 +9,7 @@ #include #include #include - +#include #include "nvme.h" #include "fabrics.h" #include @@ -3768,10 +3768,81 @@ static ssize_t nvme_fc_nvme_discovery_store(struct device *dev, return count; } + +/*parse the Cgroup id from a buf and returns the length of cgrpid*/ +static int fc_parse_cgrpid(const char *buf, u64 *id) +{ + char cgrp_id[16+1]; + int cgrpid_len, j; + + memset(cgrp_id, 0x0, sizeof(cgrp_id)); + for (cgrpid_len = 0, j = 0; cgrpid_len < 17; cgrpid_len++) { + if (buf[cgrpid_len] != ':') + cgrp_id[cgrpid_len] = buf[cgrpid_len]; + else { + j = 1; + break; + } + } + if (!j) + return -EINVAL; + if (kstrtou64(cgrp_id, 16, id) < 0) + return -EINVAL; + return cgrpid_len; +} + +/* + * fc_update_appid :parses and updates the appid in the blkcg associated with + * cgroupid. + * @buf: buf contains both cgrpid and appid info + * @count: size of the buffer + */ +static int fc_update_appid(const char *buf, size_t count) +{ + u64 cgrp_id; + int appid_len = 0; + int cgrpid_len = 0; + char app_id[APPID_LEN]; + int ret = 0; + + if (buf[count-1] == '\n') + count--; + + if ((count > (16+1+APPID_LEN)) || (!strchr(buf, ':'))) + return -EINVAL; + + cgrpid_len = fc_parse_cgrpid(buf, &cgrp_id); + if (cgrpid_len < 0) + return -EINVAL; + /*appid len is count - cgrpid_len -1 (: + \n) */ + appid_len = count - cgrpid_len - 1; + if (appid_len > APPID_LEN) + return -EINVAL; + + memset(app_id, 0x0, sizeof(app_id)); + memcpy(app_id, &buf[cgrpid_len+1], appid_len); + ret = blkcg_set_app_identifier(app_id, cgrp_id, sizeof(app_id)); + if (ret < 0) + return ret; + return count; +} + +static ssize_t fc_appid_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + int ret = 0; + + ret = fc_update_appid(buf, count); + if (ret < 0) + return -EINVAL; + return count; +} static DEVICE_ATTR(nvme_discovery, 0200, NULL, nvme_fc_nvme_discovery_store); +static DEVICE_ATTR(appid_store, 0200, NULL, fc_appid_store); static struct attribute *nvme_fc_attrs[] = { &dev_attr_nvme_discovery.attr, + &dev_attr_appid_store.attr, NULL }; From patchwork Tue Nov 3 07:18:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03957C55178 for ; Tue, 3 Nov 2020 14:12:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA2F522370 for ; Tue, 3 Nov 2020 14:12:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="fs1zc5DD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729624AbgKCOMx (ORCPT ); Tue, 3 Nov 2020 09:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729579AbgKCOMD (ORCPT ); Tue, 3 Nov 2020 09:12:03 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5733C0613D1 for ; Tue, 3 Nov 2020 06:12:03 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id g12so13773466pgm.8 for ; Tue, 03 Nov 2020 06:12:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mkEHQfd3kShudm1V4soGyWUgQkd3UQoXe4Be/jwZGrw=; b=fs1zc5DDn8cc2Eb8OvwqzclrsZpPPV8DrupOYp6rcaTikVCP5JsTqIKupztHv/uOCx b3sQ4QMkHnypBR2VB5rwLk1qsntH1bV9pxstE5NgixYlitwmFFizisXaftT9jf52xqQF AmC4CtcikJ11LY2PTmcjeho12qbxz2kPdz73U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mkEHQfd3kShudm1V4soGyWUgQkd3UQoXe4Be/jwZGrw=; b=cQ/FNk096aqCKtcJV+Xb+f90jN/DfhIFxAWCX8+/RNLcTODml3vHSVB4qyZsXtll52 57RuMTBNEm9onxxLgRhnmATanZvXC5vnEBuspQsobv7VH5yyYsiKQL3xuyQYMXYMMrJg nY6yagJS4JU2u1mh+tWk1g+YZEzonP3qSx02wSU2lbO90aJ0AZQgBMeTFSiENvLWo8Lq DTC/Pg6K5vu24qn1l+q/rDGvzmLERdwgzeCnehCzMkEjcvS9kbsMZqc+yfSw7c8hlOZS hsBepHim+LVy5EMaS4E8vk3RA975p37GURBYuE9p1wh2zO3xg6gDpMl8rMDUPghar7bG ZwWA== X-Gm-Message-State: AOAM531JO9QN0xXdxlnGpajhHH2tzyPXnfJKqT71iGAyvx8gkc4YuNj5 VPR9XhRmBfCv8m1vK2dz6q8qmA== X-Google-Smtp-Source: ABdhPJwkwMXvFcwfB6d73SczEgxSHF4XLzj33s/lFdu5axPK/qPvY5++dOieJnyj2wJUvmh1rUhZrQ== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr3984738pjq.76.1604412723309; Tue, 03 Nov 2020 06:12:03 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:02 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 05/19] lpfc: vmid: API to check if VMID is enabled. Date: Tue, 3 Nov 2020 12:48:09 +0530 Message-Id: <1604387903-20006-6-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava This API will determine if VMID is enabled by the user or not. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 8f0062d2b891..a62e985aa180 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1506,3 +1506,27 @@ static const char *routine(enum enum_name table_key) \ } \ return name; \ } + +/** + * lpfc_is_vmid_enabled - returns if VMID is enabled for either switch types + * @phba: Pointer to HBA context object. + * + * Relationship between the enable, target support and if vmid tag is required + * for the particular combination + * --------------------------------------------------- + * Switch Enable Flag Target Support VMID Needed + * --------------------------------------------------- + * App Id 0 NA N + * App Id 1 0 N + * App Id 1 1 Y + * Pr Tag 0 NA N + * Pr Tag 1 0 N + * Pr Tag 1 1 Y + * Pr Tag 2 * Y + --------------------------------------------------- + * + **/ +static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba) +{ + return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging; +} From patchwork Tue Nov 3 07:18:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1791C5517A for ; Tue, 3 Nov 2020 14:12:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AECFC22280 for ; Tue, 3 Nov 2020 14:12:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bnbJP6gb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729494AbgKCOMo (ORCPT ); Tue, 3 Nov 2020 09:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbgKCOMH (ORCPT ); Tue, 3 Nov 2020 09:12:07 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAC56C0613D1 for ; Tue, 3 Nov 2020 06:12:07 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id h6so13780969pgk.4 for ; Tue, 03 Nov 2020 06:12:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VX83513ww3Q3TdlXq7HgGTbTsrjjYuO/dKFgK/oTnuE=; b=bnbJP6gbmuqUhQaQU0VpDU48siG8Fxe/1e87jn8LESWSniH+fa2QypmPq4DhEFWkGF 1K+dq3Y4RKUlrpzeafYPYlDe/zu3SwshCI4XAZ0Vfb/IKApHv0Odl/sY+++vaDFEOAcO Wt59pDOt+UC2msqN3cmLTZ+rcKA2ngfCWiN2c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VX83513ww3Q3TdlXq7HgGTbTsrjjYuO/dKFgK/oTnuE=; b=Vol77m89y3gyLTaAZkKU3VLxBOaHzdmx6oZi6yY0B0O8isKMLZ49bwzNU3sNOQmKwf 9MTX6XLJVk1Spe3SE9pgdAXMwMvwx2O2qTzO9NPUP4nsyR1TgM2dK6T8Wce5a38PXYMn gJwb0G04XFWaRRFluCW5zLavlux+tSBfWKqLaYwEpso2Voqx1nDv9Z7enC5XTxI/dA9j 9AUAYwv6861naiBICt4BfvS9Z1swmTlu4XP4usk4xaXHdpsEtxiwTTGzTgov8S+aXw2F nHRDctToeHL4jeiIl/CZmkyMw0g/kMR5xIesANrLxqM10GdpjOAEc4dBibzQBosIDC99 ak/w== X-Gm-Message-State: AOAM530aV16NkV3H7zXwrNVqTlqfOfPk1b4ZjzyzAa7EA6AHgGdYMB2U e+ru0fl8193gj4IaQsyWtsKLODdkiuK0jlmW X-Google-Smtp-Source: ABdhPJxG8OwDs78n+LJf0hkaGQqu8cXm9VQGDixB5Sm6ioQdilCvnTTdQQYnjB4gaXTkv51OfXkcbQ== X-Received: by 2002:a17:90b:4c43:: with SMTP id np3mr4111798pjb.28.1604412727264; Tue, 03 Nov 2020 06:12:07 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:06 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 06/19] lpfc: vmid: Supplementary data structures for vmid Date: Tue, 3 Nov 2020 12:48:10 +0530 Message-Id: <1604387903-20006-7-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava This patch adds additional data structures for supporting the two versions of vmid implementation. First type uses app header while the other types uses priority tagging mechanism. These data structures are used mostly for ELS and CT commands for the two vmid implementation. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_hw.h | 124 ++++++++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_sli.h | 8 +++ 3 files changed, 129 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 482e4a888dae..c38313ee17dd 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h @@ -113,6 +113,7 @@ struct lpfc_nodelist { uint8_t nlp_fcp_info; /* class info, bits 0-3 */ #define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */ u8 nlp_nvme_info; /* NVME NSLER Support */ + u8 vmid_support; /* destination VMID support */ #define NLP_NVME_NSLER 0x1 /* NVME NSLER device */ uint16_t nlp_usg_map; /* ndlp management usage bitmap */ diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index c20034b3101c..c6b252fbea40 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -275,6 +275,7 @@ struct lpfc_sli_ct_request { #define SLI_CT_ACCESS_DENIED 0x10 #define SLI_CT_INVALID_PORT_ID 0x11 #define SLI_CT_DATABASE_EMPTY 0x12 +#define SLI_CT_APP_ID_NOT_AVAILABLE 0x40 /* * Name Server Command Codes @@ -400,16 +401,16 @@ struct csp { uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ uint16_t multicast:1; /* FC Word 1, bit 25 */ - uint16_t broadcast:1; /* FC Word 1, bit 24 */ + u16 app_hdr_support:1; /* FC Word 1, bit 24 */ - uint16_t huntgroup:1; /* FC Word 1, bit 23 */ + uint16_t priority_tagging:1; /* FC Word 1, bit 23 */ uint16_t simplex:1; /* FC Word 1, bit 22 */ uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ uint16_t dhd:1; /* FC Word 1, bit 18 */ uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */ uint16_t payloadlength:1; /* FC Word 1, bit 16 */ #else /* __LITTLE_ENDIAN_BITFIELD */ - uint16_t broadcast:1; /* FC Word 1, bit 24 */ + u16 app_hdr_support:1; /* FC Word 1, bit 24 */ uint16_t multicast:1; /* FC Word 1, bit 25 */ uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ @@ -423,7 +424,7 @@ struct csp { uint16_t dhd:1; /* FC Word 1, bit 18 */ uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ uint16_t simplex:1; /* FC Word 1, bit 22 */ - uint16_t huntgroup:1; /* FC Word 1, bit 23 */ + uint16_t priority_tagging:1; /* FC Word 1, bit 23 */ #endif uint8_t bbRcvSizeMsb; /* Upper nibble is reserved */ @@ -607,6 +608,8 @@ struct fc_vft_header { #define ELS_CMD_LIRR 0x7A000000 #define ELS_CMD_LCB 0x81000000 #define ELS_CMD_FPIN 0x16000000 +#define ELS_CMD_QFPA 0xB0000000 +#define ELS_CMD_UVEM 0xB1000000 #else /* __LITTLE_ENDIAN_BITFIELD */ #define ELS_CMD_MASK 0xffff #define ELS_RSP_MASK 0xff @@ -649,6 +652,8 @@ struct fc_vft_header { #define ELS_CMD_LIRR 0x7A #define ELS_CMD_LCB 0x81 #define ELS_CMD_FPIN ELS_FPIN +#define ELS_CMD_QFPA 0xB0 +#define ELS_CMD_UVEM 0xB1 #endif /* @@ -1317,6 +1322,117 @@ struct fc_rdp_res_frame { }; +/* UVEM */ + +#define LPFC_UVEM_SIZE 60 +#define LPFC_UVEM_VEM_ID_DESC_SIZE 16 +#define LPFC_UVEM_VE_MAP_DESC_SIZE 20 + +#define VEM_ID_DESC_TAG 0x0001000A +struct lpfc_vem_id_desc { + u32 tag; + u32 length; + u8 vem_id[16]; +}; + +#define LPFC_QFPA_SIZE 4 + +#define INSTANTIATED_VE_DESC_TAG 0x0001000B +struct instantiated_ve_desc { + u32 tag; + u32 length; + u8 global_vem_id[16]; + u32 word6; +#define lpfc_instantiated_local_id_SHIFT 0 +#define lpfc_instantiated_local_id_MASK 0x000000ff +#define lpfc_instantiated_local_id_WORD word6 +#define lpfc_instantiated_nport_id_SHIFT 8 +#define lpfc_instantiated_nport_id_MASK 0x00ffffff +#define lpfc_instantiated_nport_id_WORD word6 +}; + +#define DEINSTANTIATED_VE_DESC_TAG 0x0001000C +struct deinstantiated_ve_desc { + u32 tag; + u32 length; + u8 global_vem_id[16]; + u32 word6; +#define lpfc_deinstantiated_nport_id_SHIFT 0 +#define lpfc_deinstantiated_nport_id_MASK 0x000000ff +#define lpfc_deinstantiated_nport_id_WORD word6 +#define lpfc_deinstantiated_local_id_SHIFT 24 +#define lpfc_deinstantiated_local_id_MASK 0x00ffffff +#define lpfc_deinstantiated_local_id_WORD word6 +}; + +/* Query Fabric Priority Allocation Response */ +#define LPFC_PRIORITY_RANGE_DESC_SIZE 12 + +struct priority_range_desc { + u32 tag; + u32 length; + u8 lo_range; + u8 hi_range; + u8 qos_priority; + u8 local_ve_id; +}; + +struct fc_qfpa_res { + u32 reply_sequence; /* LS_ACC or LS_RJT */ + u32 length; /* FC Word 1 */ + struct priority_range_desc desc[1]; +}; + +/* Application Server command code */ +/* VMID */ + +#define SLI_CT_APP_SEV_Subtypes 0x20 /* Application Server subtype */ + +#define SLI_CTAS_GAPPIA_ENT 0x0100 /* Get Application Identifier */ +#define SLI_CTAS_GALLAPPIA 0x0101 /* Get All Application Identifier */ +#define SLI_CTAS_GALLAPPIA_ID 0x0102 /* Get All Application Identifier */ + /* for Nport */ +#define SLI_CTAS_GAPPIA_IDAPP 0x0103 /* Get Application Identifier */ + /* for Nport */ +#define SLI_CTAS_RAPP_IDENT 0x0200 /* Register Application Identifier */ +#define SLI_CTAS_DAPP_IDENT 0x0300 /* Deregister Application */ + /* Identifier */ +#define SLI_CTAS_DALLAPP_ID 0x0301 /* Deregister All Application */ + /* Identifier */ + +struct entity_id_object { + u8 entity_id_len; + u8 entity_id[255]; /* VM UUID */ +}; + +struct app_id_object { + u32 port_id; + u32 app_id; + struct entity_id_object obj; +}; + +struct lpfc_vmid_rapp_ident_list { + u32 no_of_objects; + struct entity_id_object obj[1]; +}; + +struct lpfc_vmid_dapp_ident_list { + u32 no_of_objects; + struct entity_id_object obj[1]; +}; + +#define GALLAPPIA_ID_LAST 0x80 +struct lpfc_vmid_gallapp_ident_list { + u8 control; + u8 reserved[3]; + struct app_id_object app_id; +}; + +#define RAPP_IDENT_OFFSET (offsetof(struct lpfc_sli_ct_request, un) + 4) +#define DAPP_IDENT_OFFSET (offsetof(struct lpfc_sli_ct_request, un) + 4) +#define GALLAPPIA_ID_SIZE (offsetof(struct lpfc_sli_ct_request, un) + 4) +#define DALLAPP_ID_SIZE (offsetof(struct lpfc_sli_ct_request, un) + 4) + /******** FDMI ********/ /* lpfc_sli_ct_request defines the CT_IU preamble for FDMI commands */ diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 93d976ea8c5d..6dd45885df4f 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -35,6 +35,12 @@ typedef enum _lpfc_ctx_cmd { LPFC_CTX_HOST } lpfc_ctx_cmd; +union lpfc_vmid_iocb_tag { + u32 app_id; + u8 cs_ctl_vmid; + struct lpfc_vmid_context *vmid_context; /* UVEM context information */ +}; + struct lpfc_cq_event { struct list_head list; uint16_t hdwq; @@ -100,6 +106,7 @@ struct lpfc_iocbq { #define LPFC_IO_NVME 0x200000 /* NVME FCP command */ #define LPFC_IO_NVME_LS 0x400000 /* NVME LS command */ #define LPFC_IO_NVMET 0x800000 /* NVMET command */ +#define LPFC_IO_VMID 0x1000000 /* VMID tagged IO */ uint32_t drvrTimeout; /* driver timeout in seconds */ struct lpfc_vport *vport;/* virtual port pointer */ @@ -114,6 +121,7 @@ struct lpfc_iocbq { struct lpfc_node_rrq *rrq; } context_un; + union lpfc_vmid_iocb_tag vmid_tag; void (*fabric_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, struct lpfc_iocbq *); void (*wait_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, From patchwork Tue Nov 3 07:18:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315368 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D0E8C55178 for ; Tue, 3 Nov 2020 14:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40820223AB for ; Tue, 3 Nov 2020 14:12:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="cCzmcIYc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729612AbgKCOMk (ORCPT ); Tue, 3 Nov 2020 09:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729429AbgKCOML (ORCPT ); Tue, 3 Nov 2020 09:12:11 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C615C0613D1 for ; Tue, 3 Nov 2020 06:12:11 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id z3so7914353pfz.6 for ; Tue, 03 Nov 2020 06:12:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MGgexGhFFtI686jxaiBmnSO4jBkuhzzDm6lAoXYk2oE=; b=cCzmcIYcEQ3D3GurrOR0a5wkZd49qbbX5vd8lLqaf5upYOC7o+iEiHHmn8taX1j9Ml 12UMHOZzJejPEKSjGkHPgkI5CBLrAO4mmqNjb8PrdiswzD9gOqaak+PiHY9gn3nfDWib BP+2QtY/0inKDW8k9N23UlL9NLKUi1nxLQRk4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MGgexGhFFtI686jxaiBmnSO4jBkuhzzDm6lAoXYk2oE=; b=OqIJPbBWkImqOH7PJDpeJuly8QdimHgkEiAodYSR5241YQEswoLLIe9ZJnI2BMyMr2 M3XYGaLhh6tDNFkcVauwYrWXr1U1P/YG3PiGM1mLZlyoNTL+agXhu8m43mVVr+wpinZY UzbA4Y5/ljVXp1S+uWma4krxkaU+/KMYdm9RUlEifVvN48WSptwb5YyLj+p8DUFHqQxs aHFfCvuTV4lGph7rNVJfmnra7l2U+AlSIfe7EfOTmkPj218W6Rd9inNS3Ud4+lyjjDV3 twuhqBhOvxtIZBGo9AxuRj7MWiNbkpWrhFDqKyye3cMfmttZO1Bv2PPGwk+Yhr02Qb6c KzDA== X-Gm-Message-State: AOAM531aKNOry1ICnpRR687WmuCNUbo73XcPZI9oe0FFbIB0DWWfV1IQ KeId3IBFoLCEpAiyf/in86O6lA== X-Google-Smtp-Source: ABdhPJxFZ5ZgvIw6G8fi8DFWscxSU5GoNnKlNZFxqFE+jF6J7Zaw2LpdLYUbG7AhbxCkB6DGs94z6Q== X-Received: by 2002:a17:90a:1903:: with SMTP id 3mr4185753pjg.74.1604412730982; Tue, 03 Nov 2020 06:12:10 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:10 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 07/19] lpfc: vmid: Forward declarations for APIs Date: Tue, 3 Nov 2020 12:48:11 +0530 Message-Id: <1604387903-20006-8-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava This patch contains the forward declarations of commonly used APIs which are used outside the scope of the file. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_crtn.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 782f6f76f18a..74ca5860ca8e 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -600,3 +600,14 @@ extern int lpfc_enable_nvmet_cnt; extern unsigned long long lpfc_enable_nvmet[]; extern int lpfc_no_hba_reset_cnt; extern unsigned long lpfc_no_hba_reset[]; + +/* vmid interface */ +int lpfc_vmid_uvem(struct lpfc_vport *vport, struct lpfc_vmid *vmid, bool ins); +u32 lpfc_vmid_get_cs_ctl(struct lpfc_vport *vport); +int lpfc_vmid_cmd(struct lpfc_vport *vport, + int cmdcode, struct lpfc_vmid *vmid); +int lpfc_vmid_hash_fn(char *vmid, int len); +struct lpfc_vmid *lpfc_get_vmid_from_hastable(struct lpfc_vport *vport, + u32 hash, u8 *buf); +void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); +int lpfc_issue_els_qfpa(struct lpfc_vport *vport); From patchwork Tue Nov 3 07:18:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF84FC388F7 for ; Tue, 3 Nov 2020 14:12:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AC7922264 for ; Tue, 3 Nov 2020 14:12:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UKB2Af88" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729591AbgKCOM0 (ORCPT ); Tue, 3 Nov 2020 09:12:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729588AbgKCOMW (ORCPT ); Tue, 3 Nov 2020 09:12:22 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95686C0613D1 for ; Tue, 3 Nov 2020 06:12:22 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 133so14286683pfx.11 for ; Tue, 03 Nov 2020 06:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8vrORrXCsAR6Glho/loXYcgKj4ha70MDRn0GD/4Axqc=; b=UKB2Af88V4x0rQKNv1iamKbMQVyzMI6nYJEr9+fS7q31b+EgwMZgHIUFNaGN9lk11J 0Em641lb9DSF0GYP5KPH6yLUDOUvyxZQuXALCrzEtF678gu8gYUty577wF9adYKhY9E+ 45b0MOTK758f7j0uTt6kvW+Ehkyqc4DWrbVfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8vrORrXCsAR6Glho/loXYcgKj4ha70MDRn0GD/4Axqc=; b=A9e5YYaclFlI9HyIMMEYAhbl3/POvMN4T5aby9kkPx91X/kJBnIfZHbX5RXJF9FnIL rNFZSzzZr090CZRHvTN2UrKnkvxEldIVwviUQhFS9Fi91vsFvg5sGb4/6mpMZGtk1CC9 UjirS/M/8xOAOYdskEdu8sWO1nkHDs3HywFZl3Ed3M8pdYXnvyBoBB0hKA+/tedHqY6v FshGM7Kizth3mZaNTgwYg4xaatR5EWDCd6dmCtEzFj1jgIqQilVKKduwCXhGrxICGYni hkoRgdJ73FOjCahOkwqKwrAFPJQbYL4KQoTD1Mi1+cvSn6GK1pUQG7LBVK0siwORs8Rp 6NEA== X-Gm-Message-State: AOAM530MZmNMQtcHQ3NUjO1EuDSOwjhsV0Cr2GrNwqvSoG1sGdy/h3En CyI0MoVuhuQlRTtlsGkiOc/N2kRFMRoiHUBn X-Google-Smtp-Source: ABdhPJw2B1U/RFZzcq87v6qVJXehAK0CH5cJDhVUiYY33U11fOGhxq3sF53oY3kkvfK9NRBDKdi7qw== X-Received: by 2002:a62:a10a:0:b029:154:fd62:ba90 with SMTP id b10-20020a62a10a0000b0290154fd62ba90mr26231551pff.62.1604412741969; Tue, 03 Nov 2020 06:12:21 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:21 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 10/19] lpfc: vmid: vmid resource allocation Date: Tue, 3 Nov 2020 12:48:14 +0530 Message-Id: <1604387903-20006-11-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava This patch allocates the resource for vmid and checks if the firmware supports the feature or not. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_init.c | 64 +++++++++++++++++++++++++++++++++++ drivers/scsi/lpfc/lpfc_mbox.c | 6 ++++ drivers/scsi/lpfc/lpfc_sli.c | 9 +++++ 3 files changed, 79 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index ca25e54bb782..e32d69515586 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -4284,6 +4284,62 @@ lpfc_get_wwpn(struct lpfc_hba *phba) return rol64(wwn, 32); } +/** + * lpfc_vmid_res_alloc - Allocates resources for VMID + * @phba: pointer to lpfc hba data structure. + * @vport: pointer to vport data structure + * + * This routine allocated the resources needed for the vmid. + * + * Return codes + * 0 on Succeess + * Non-0 on Failure + */ +u8 +lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport) +{ + u16 i; + + /* vmid feature is supported only on SLI4 */ + if (phba->sli_rev == LPFC_SLI_REV3) { + phba->cfg_vmid_app_header = 0; + phba->cfg_vmid_priority_tagging = 0; + } + + /* if enabled, then allocated the resources */ + if (lpfc_is_vmid_enabled(phba)) { + vport->vmid = + kmalloc_array(phba->cfg_max_vmid, sizeof(struct lpfc_vmid), + GFP_KERNEL); + if (!vport->vmid) + return 1; + + memset(vport->vmid, 0, + phba->cfg_max_vmid * sizeof(struct lpfc_vmid)); + + rwlock_init(&vport->vmid_lock); + + /* setting the VMID parameters for the vport */ + vport->vmid_priority_tagging = phba->cfg_vmid_priority_tagging; + vport->vmid_inactivity_timeout = + phba->cfg_vmid_inactivity_timeout; + vport->max_vmid = phba->cfg_max_vmid; + vport->cur_vmid_cnt = 0; + + for (i = 0; i < LPFC_VMID_HASH_SIZE; i++) + vport->hash_table[i] = NULL; + + vport->vmid_priority_range = bitmap_zalloc + (LPFC_VMID_MAX_PRIORITY_RANGE, GFP_KERNEL); + + if (!vport->vmid_priority_range) { + kfree(vport->vmid); + return 1; + } + } + return 0; +} + /** * lpfc_create_port - Create an FC port * @phba: pointer to lpfc hba data structure. @@ -4439,6 +4495,12 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) vport->port_type, shost->sg_tablesize, phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); + /* allocate the resources for vmid */ + rc = lpfc_vmid_res_alloc(phba, vport); + + if (rc) + goto out; + /* Initialize all internally managed lists. */ INIT_LIST_HEAD(&vport->fc_nodes); INIT_LIST_HEAD(&vport->rcv_buffer_list); @@ -4463,6 +4525,8 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) return vport; out_put_shost: + kfree(vport->vmid); + bitmap_free(vport->vmid_priority_range); scsi_host_put(shost); out: return NULL; diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 3414ffcb26fe..78a9b9baecf3 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -2100,6 +2100,12 @@ lpfc_request_features(struct lpfc_hba *phba, struct lpfcMboxq *mboxq) bf_set(lpfc_mbx_rq_ftr_rq_iaab, &mboxq->u.mqe.un.req_ftrs, 0); bf_set(lpfc_mbx_rq_ftr_rq_iaar, &mboxq->u.mqe.un.req_ftrs, 0); } + + /* Enable Application Services Header for apphedr VMID */ + if (phba->cfg_vmid_app_header) { + bf_set(lpfc_mbx_rq_ftr_rq_ashdr, &mboxq->u.mqe.un.req_ftrs, 1); + bf_set(lpfc_ftr_ashdr, &phba->sli4_hba.sli4_flags, 1); + } return; } diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 4cd7ded656b7..51b99b7beaf9 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7558,6 +7558,15 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) goto out_free_mbox; } + /* Disable vmid if app header is not supported */ + if (phba->cfg_vmid_app_header && !(bf_get(lpfc_mbx_rq_ftr_rsp_ashdr, + &mqe->un.req_ftrs))) { + bf_set(lpfc_ftr_ashdr, &phba->sli4_hba.sli4_flags, 0); + phba->cfg_vmid_app_header = 0; + lpfc_printf_log(phba, KERN_DEBUG, LOG_SLI, + "1242 vmid feature not supported"); + } + /* * The port must support FCP initiator mode as this is the * only mode running in the host. From patchwork Tue Nov 3 07:18:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4E7C2D0A3 for ; Tue, 3 Nov 2020 14:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19E3822243 for ; Tue, 3 Nov 2020 14:12:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ayYzWUJi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbgKCOM0 (ORCPT ); Tue, 3 Nov 2020 09:12:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729590AbgKCOM0 (ORCPT ); Tue, 3 Nov 2020 09:12:26 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C227C0613D1 for ; Tue, 3 Nov 2020 06:12:26 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 13so14293588pfy.4 for ; Tue, 03 Nov 2020 06:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xUVhHko56DiKH7nnv+nrZi563MaWvoG/GXDOrL8t/cY=; b=ayYzWUJipBIBtDhx86BKthEr4UmFWbjOB9H3aN+0gihXNb/3SwbCgTAlUU+XzlDKhU mffABPQgmSpVRgF324elyEfObXNVwJKV0KbYODiLTYmuT0Wxpw/fr6gvkUxYw2oqy1WK hvrfBw6tVV1Cu2ooLNyNBxwzGsHNf1Hx9df+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xUVhHko56DiKH7nnv+nrZi563MaWvoG/GXDOrL8t/cY=; b=gJLo3C3dE/nURTtPiOClA8yV86/Ha5gHTMaObd/MXgeyRSYLxIUhyl8IKh2o3SSphW I9UCegglGv2aOQyIjbGQAgknvEW6aauf0B3OZ4ieYKBARBZ+tE+1QLcbjLSDyvPhGDHP 0L+//JObi5BtJxiWpQ8rrR4U8v0X6is88gsxnMFP01F64OkwIT6cEDAU2T29WxCvzxI2 1hzrrZeXIU0mRx8nzUBE5OuhdANFVcmC0NBQmx4vtRN3z41C+nTdPFOHiXDFqIFSJqbK wOo9T0sS2j4d1ryJraX2sr3sX3ZUOVJHZ01i2GlSR61olx+sUQlgdJ+AKUIBhnhv1kur Zw8w== X-Gm-Message-State: AOAM530toTaNZDCF53TVRfh8Av70rAq0uUPLO2sGS+1lGIzdoiaBJjqT y1v/mIedmDlX5N8pFHfILOV8+Q== X-Google-Smtp-Source: ABdhPJxBcRy1IzeQYF7vAdLqwng0L4j6+eT2ctGGtkf3R1v+POJ5yTh/zVMARIdFjodWccmN8ylDfw== X-Received: by 2002:a17:90a:62c1:: with SMTP id k1mr4154706pjs.135.1604412745513; Tue, 03 Nov 2020 06:12:25 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:24 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 11/19] lpfc: vmid: cleanup vmid resources Date: Tue, 3 Nov 2020 12:48:15 +0530 Message-Id: <1604387903-20006-12-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava The patch cleans up the vmid resources and stops the timer. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_init.c | 4 ++++ drivers/scsi/lpfc/lpfc_scsi.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index e32d69515586..88777875f4b8 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -2843,6 +2843,10 @@ lpfc_cleanup(struct lpfc_vport *vport) if (phba->link_state > LPFC_LINK_DOWN) lpfc_port_link_failure(vport); + /* cleanup vmid resources */ + if (lpfc_is_vmid_enabled(phba)) + lpfc_vmid_vport_cleanup(vport); + list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { if (!NLP_CHK_NODE_ACT(ndlp)) { ndlp = lpfc_enable_node(vport, ndlp, diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 5e802c8b22a9..7bc1fd69b715 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4711,6 +4711,27 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) return 0; } +/* + * lpfc_vmid_vport_cleanup - cleans up the resources associated with a vports + * @vport: The virtual port for which this call is being executed. + */ +void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport) +{ + /* delete the timer */ + if (vport->port_type == LPFC_PHYSICAL_PORT) + del_timer_sync(&vport->phba->inactive_vmid_poll); + + /* free the resources */ + kfree(vport->qfpa_res); + kfree(vport->vmid_priority.vmid_range); + kfree(vport->vmid); + + /* reset variables */ + vport->qfpa_res = NULL; + vport->vmid_priority.vmid_range = NULL; + vport->vmid = NULL; + vport->cur_vmid_cnt = 0; +} /** * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point From patchwork Tue Nov 3 07:18:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDB27C388F9 for ; Tue, 3 Nov 2020 14:12:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A60122243 for ; Tue, 3 Nov 2020 14:12:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="VGO1dPvQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbgKCOMi (ORCPT ); Tue, 3 Nov 2020 09:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729596AbgKCOMe (ORCPT ); Tue, 3 Nov 2020 09:12:34 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B7CC0613D1 for ; Tue, 3 Nov 2020 06:12:33 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id b3so14321486pfo.2 for ; Tue, 03 Nov 2020 06:12:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=se3zNtM3Z0IrVFuyYaWWrTIfgWP8zpUoSWiOEs2F3OQ=; b=VGO1dPvQ+wDJd7c2TmB6CHPpRYkvbpZSXeU3OsNghmjaAcQIKjsgXjtagLaQAe0yFH g7aSwUeRJLIolGU3ifwHyAC0jVYT5Z1t0EB0BJznsabZ5vLlhl2/eCrxXyFfTPmCXDZV 01ue4kql7wLg6Mqfw4eByiwhzBeogQuDnYbHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=se3zNtM3Z0IrVFuyYaWWrTIfgWP8zpUoSWiOEs2F3OQ=; b=aAMPEImZa/9wFf85GKRMsl60kHREvR0jKOFoTMKdiaAxqI9BbniegCCICyZxdgGR3D htTgEwES+nXxfjcCVqWtS84xDqUlc0qkbDGtdE6+slv1v1H/GdUuQY+ZCUBdzgUp7IJN eQnZTW/KpFtOdG4+MBRAys+fLX2apzoevEabtKeAPLiLqQl/nBrTPBXXnzPDnClbulIs uak4MJkO5lR7mGi8NPz0CLNSn60FAYOtDBMaRcKYqyoznnEWmYTwAMqWoQv+vcZ/tCJz lEFMoYMUzYB2AlRxm2U2eZNLA9e21ptTLhbXaTd2f8JIZhkDN5U451Lu84RqhCduZ3ky c3oQ== X-Gm-Message-State: AOAM5310u4itAf4VoRDaXn3AabGfuQzG6FlU0ymgL+3wnD+fjd2fxv+Q sfESTzVZ0xBpyBn1rNUcMXdzCA== X-Google-Smtp-Source: ABdhPJxplIM4J6XSeHZHKmouwkgPiwaxUO6v93pOvnD+sPyG9DhCKDuU4FXFiyorKGMUDxLeYD8pvQ== X-Received: by 2002:a17:90a:7522:: with SMTP id q31mr4160467pjk.158.1604412753325; Tue, 03 Nov 2020 06:12:33 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:31 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 13/19] lpfc: vmid: Functions to manage vmids Date: Tue, 3 Nov 2020 12:48:17 +0530 Message-Id: <1604387903-20006-14-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava This patch contains the routines to save, retrieve and remove the vmids from the data structure. A hash table is used to save the vmids and the corresponding UUIDs associated with the application/VMs. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_scsi.c | 139 ++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 7bc1fd69b715..e5a1056cc575 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -4485,6 +4486,144 @@ void lpfc_poll_timeout(struct timer_list *t) } } +/* + * lpfc_get_vmid_from_hastable - search the UUID in the hash table + * @vport: The virtual port for which this call is being executed. + * @hash: calculated hash value + * @buf: uuid associated with the VE + * Returns the vmid entry associated with the UUID + * Make sure to acquire the appropriate lock before invoking this routine. + */ +struct lpfc_vmid *lpfc_get_vmid_from_hastable(struct lpfc_vport *vport, + u32 hash, u8 *buf) +{ + struct lpfc_vmid *vmp; + u16 count = 0; + + while (count < LPFC_VMID_HASH_SIZE) { + vmp = vport->hash_table[hash]; + if (vmp) { + if (strncmp(&vmp->host_vmid[0], buf, 16) == 0) + return vmp; + } else { + return NULL; + } + /* search the next available slot and continue till entry */ + /* is found */ + count++; + hash++; + + /* or the end is reached */ + if (hash == LPFC_VMID_HASH_SIZE) + hash = 0; + } + return NULL; +} + +/* + * lpfc_put_vmid_from_hastable - put the VMID in the hash table + * @vport: The virtual port for which this call is being executed. + * @hash - calculated hash value + * @vmp: Pointer to a VMID entry representing a VM sending IO + * + * This routine will insert the newly acquired vmid entity in the hash table. + * Make sure to acquire the appropriate lock before invoking this routine. + */ +int +lpfc_put_vmid_in_hashtable(struct lpfc_vport *vport, u32 hash, + struct lpfc_vmid *vmp) +{ + int count = 0; + + while (count < LPFC_VMID_HASH_SIZE) { + if (!vport->hash_table[hash]) { + vport->hash_table[hash] = vmp; + vmp->hash_index = hash; + return 1; + } + /* if the slot is already occupied, a collision has occurred. */ + /* Store in the next available slot */ + count++; + hash++; + /* table is full */ + if (hash == LPFC_VMID_HASH_SIZE) + hash = 0; + } + return 0; +} + +/* + * lpfc_vmid_hash_fn- creates a hash value of the UUID + * @uuid: uuid associated with the VE + * @len: length of the UUID + * Returns the calculated hash value + */ +int lpfc_vmid_hash_fn(char *vmid, int len) +{ + int c; + int hash = 0; + + if (len == 0) + return 0; + while (len--) { + c = *vmid++; + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + + hash = (hash + (c << LPFC_VMID_HASH_SHIFT) + + (c >> LPFC_VMID_HASH_SHIFT)) * 19; + } + + return hash & LPFC_VMID_HASH_MASK; +} + +/* + * lpfc_vmid_update_entry - update the vmid entry in the hash table + * @vport: The virtual port for which this call is being executed. + * @cmd: address of scsi cmmd descriptor + * @vmp: Pointer to a VMID entry representing a VM sending IO + * @tag: VMID tag + */ +void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd + *cmd, struct lpfc_vmid *vmp, + union lpfc_vmid_io_tag *tag) +{ + u64 *lta; + + if (vport->vmid_priority_tagging) + tag->cs_ctl_vmid = vmp->un.cs_ctl_vmid; + else + tag->app_id = vmp->un.app_id; + + if (cmd->sc_data_direction == DMA_TO_DEVICE) + vmp->io_wr_cnt++; + else + vmp->io_rd_cnt++; + + /* update the last access timestamp in the table */ + lta = per_cpu_ptr(vmp->last_io_time, raw_smp_processor_id()); + *lta = jiffies; +} + +void lpfc_vmid_assign_cs_ctl(struct lpfc_vport *vport, struct lpfc_vmid *vmid) +{ + u32 hash; + struct lpfc_vmid *pvmid; + + if (vport->port_type == LPFC_PHYSICAL_PORT) { + vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); + } else { + hash = lpfc_vmid_hash_fn(vmid->host_vmid, vmid->vmid_len); + pvmid = + lpfc_get_vmid_from_hastable(vport->phba->pport, hash, + vmid->host_vmid); + if (!pvmid) + vmid->un.cs_ctl_vmid = pvmid->un.cs_ctl_vmid; + else + vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); + } +} + /** * lpfc_queuecommand - scsi_host_template queuecommand entry point * @cmnd: Pointer to scsi_cmnd data structure. From patchwork Tue Nov 3 07:18:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87884C388F7 for ; Tue, 3 Nov 2020 14:12:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24BDB22243 for ; Tue, 3 Nov 2020 14:12:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="CFFWmVWr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729606AbgKCOMo (ORCPT ); Tue, 3 Nov 2020 09:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729582AbgKCOMh (ORCPT ); Tue, 3 Nov 2020 09:12:37 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BF19C0613D1 for ; Tue, 3 Nov 2020 06:12:37 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 133so14287336pfx.11 for ; Tue, 03 Nov 2020 06:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DMpnbUYM0Vuchuz5E7cz7tYIeEQgQDhm5GLQSw1OIuU=; b=CFFWmVWr/gYzDFqIXudcwVrzWnDqmL8YZilOvz//CiRPupWq5Gtsn/GhRCnYExvAL1 9zVxfABCfhIGwrFbf/LvLJHC6GJcDsw+rHKYeVw9cN5JeTFJRXhY0E3hbdbpUv+56q9J hWRobUtA4/bAsShqpWwDGOvO6y3J7vqArzQw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DMpnbUYM0Vuchuz5E7cz7tYIeEQgQDhm5GLQSw1OIuU=; b=oDqbbtodbk6FYmW0qMjiKF5DyNCdPAHdKOGWkC1yf1H6x3xcKtw/y01dpM6BHoooIN EU0Y76JLHq6vWY9XK3nyDjDdHIrtLZLDy8XvUlsGUhcsMaF//dBXmDlP3Kd/3YWCfuJL 7KxDKU0d57Mm/brqB4/XvAL5/gH78PVil1LqEUJ7YhhzXTSdM+c1n5ZBJc2nFh9B4Dh6 9C02OTHDKOsbbjrDwYOqi+kavHN6NPt12LR4dxWaueib2ESdFwNgQcHfAe/g9PNYwRPd DC5F64cInDndiSVy019VDihabRoG/D25RMjLDbvZD0F3ABcDBtC7H+UhY/lGh7qpTtbs ehfg== X-Gm-Message-State: AOAM5327rSkyPewyZtJ5DlsWQgOaxifLCr4ttRUhiyxI6r0tYghiaVfh 8Iaz/QAQT99SW9CEFxf90SngT88cQ18Gvevb X-Google-Smtp-Source: ABdhPJw6UqtYlHkprgjk7/L1utXOnXZ1sktb2rSjVXX2xJqOfph6F4be7UyUelLhQIBEA9OVBPraBg== X-Received: by 2002:a17:90b:602:: with SMTP id gb2mr3952715pjb.12.1604412756865; Tue, 03 Nov 2020 06:12:36 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:36 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 14/19] lpfc: vmid: Implements CT commands for appid. Date: Tue, 3 Nov 2020 12:48:18 +0530 Message-Id: <1604387903-20006-15-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava The patch implements CT commands for registering and deregistering the appid for the application. Also, a small change in decrementing the ndlp ref counter has been added. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue Removed redundant code due to changes since last submit --- drivers/scsi/lpfc/lpfc_ct.c | 249 ++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index c201686d3815..691f78340f26 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -3406,3 +3406,252 @@ lpfc_decode_firmware_rev(struct lpfc_hba *phba, char *fwrevision, int flag) } return; } + +void +lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, + struct lpfc_iocbq *rspiocb) +{ + struct lpfc_vport *vport = cmdiocb->vport; + struct lpfc_dmabuf *inp = cmdiocb->context1; + struct lpfc_dmabuf *outp = cmdiocb->context2; + struct lpfc_sli_ct_request *ctcmd = inp->virt; + struct lpfc_sli_ct_request *ctrsp = outp->virt; + u16 rsp = ctrsp->CommandResponse.bits.CmdRsp; + struct app_id_object *app; + u32 cmd, hash; + struct lpfc_vmid *vmp; + u8 *data = outp->virt; + int i; + + cmd = be16_to_cpu(ctcmd->CommandResponse.bits.CmdRsp); + if (cmd == SLI_CTAS_DALLAPP_ID) + lpfc_ct_free_iocb(phba, cmdiocb); + + if (lpfc_els_chk_latt(vport) || rspiocb->iocb.ulpStatus) { + if (cmd != SLI_CTAS_DALLAPP_ID) + return; + } + /* Check for a CT LS_RJT response */ + if (rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { + if (cmd != SLI_CTAS_DALLAPP_ID) + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "3306 VMID FS_RJT Data: x%x %x %x\n", + cmd, ctrsp->ReasonCode, ctrsp->Explanation); + if ((cmd != SLI_CTAS_DALLAPP_ID) || + (ctrsp->ReasonCode != SLI_CT_UNABLE_TO_PERFORM_REQ) || + (ctrsp->Explanation != SLI_CT_APP_ID_NOT_AVAILABLE)) { + /* If DALLAPP_ID failed retry later */ + if (cmd == SLI_CTAS_DALLAPP_ID) + vport->load_flag |= FC_DEREGISTER_ALL_APP_ID; + return; + } + } + + switch (cmd) { + case SLI_CTAS_RAPP_IDENT: + app = (struct app_id_object *)(RAPP_IDENT_OFFSET + data); + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "6712 RAPP_IDENT app id %d port id %x id\n" + "len %d\n", be32_to_cpu(app->app_id), + be32_to_cpu(app->port_id), + app->obj.entity_id_len); + + if (app->obj.entity_id_len == 0 || app->port_id == 0) + return; + + hash = lpfc_vmid_hash_fn(app->obj.entity_id, + app->obj.entity_id_len); + vmp = lpfc_get_vmid_from_hastable(vport, hash, + app->obj.entity_id); + if (vmp) { + vmp->un.app_id = be32_to_cpu(app->app_id); + vmp->flag |= LPFC_VMID_REGISTERED; + vmp->flag &= ~LPFC_VMID_REQ_REGISTER; + /* Set IN USE flag */ + vport->vmid_flag |= LPFC_VMID_IN_USE; + } else { + lpfc_printf_vlog(vport, KERN_DEBUG, + LOG_DISCOVERY, "6901 No entry found\n" + "%s hash %d\n", app->obj.entity_id, + hash); + } + break; + case SLI_CTAS_DAPP_IDENT: + app = (struct app_id_object *)(DAPP_IDENT_OFFSET + data); + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "6713 DAPP_IDENT app id %d port id %x", + cpu_to_be32(app->app_id), + cpu_to_be32(app->port_id)); + break; + case SLI_CTAS_DALLAPP_ID: + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "8856 Deregistered all app ids"); + for (i = 0; i < phba->cfg_max_vmid; i++) { + vmp = &vport->vmid[i]; + if (vmp->flag != LPFC_VMID_SLOT_FREE) + memset(vmp, 0, sizeof(struct lpfc_vmid)); + } + for (i = 0; i < LPFC_VMID_HASH_SIZE; i++) + vport->hash_table[i] = NULL; + vport->load_flag |= FC_ALLOW_VMID; + break; + default: + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "8857 Invalid command code"); + } +} + +/** + * lpfc_vmid_cmd - Build and send a FDMI cmd to the specified NPort + * @vport: pointer to a host virtual N_Port data structure. + * @ndlp: ndlp to send FDMI cmd to (if NULL use FDMI_DID) + * cmdcode: FDMI command to send + * mask: Mask of HBA or PORT Attributes to send + * + * Builds and sends a FDMI command using the CT subsystem. + */ +int +lpfc_vmid_cmd(struct lpfc_vport *vport, + int cmdcode, struct lpfc_vmid *vmid) +{ + struct lpfc_hba *phba = vport->phba; + struct lpfc_dmabuf *mp, *bmp; + struct lpfc_sli_ct_request *ctreq; + struct ulp_bde64 *bpl; + u32 size; + u32 rsp_size; + u8 *data; + struct lpfc_vmid_rapp_ident_list *rap; + struct lpfc_vmid_dapp_ident_list *dap; + u8 retry = 0; + struct lpfc_nodelist *ndlp; + + void (*cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, + struct lpfc_iocbq *rspiocb); + + ndlp = lpfc_findnode_did(vport, FDMI_DID); + if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) + return 0; + + cmpl = lpfc_cmpl_ct_cmd_vmid; + + /* fill in BDEs for command */ + /* Allocate buffer for command payload */ + mp = kmalloc(sizeof(*mp), GFP_KERNEL); + if (!mp) + goto vmid_free_mp_exit; + + mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); + if (!mp->virt) + goto vmid_free_mp_virt_exit; + + /* Allocate buffer for Buffer ptr list */ + bmp = kmalloc(sizeof(*bmp), GFP_KERNEL); + if (!bmp) + goto vmid_free_bmp_exit; + + bmp->virt = lpfc_mbuf_alloc(phba, 0, &bmp->phys); + if (!bmp->virt) + goto vmid_free_bmp_virt_exit; + + INIT_LIST_HEAD(&mp->list); + INIT_LIST_HEAD(&bmp->list); + + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0218 VMID Request Data: x%x x%x x%x", + vport->fc_flag, vport->port_state, cmdcode); + ctreq = (struct lpfc_sli_ct_request *)mp->virt; + data = mp->virt; + /* First populate the CT_IU preamble */ + memset(data, 0, LPFC_BPL_SIZE); + ctreq->RevisionId.bits.Revision = SLI_CT_REVISION; + ctreq->RevisionId.bits.InId = 0; + + ctreq->FsType = SLI_CT_MANAGEMENT_SERVICE; + ctreq->FsSubType = SLI_CT_APP_SEV_Subtypes; + + ctreq->CommandResponse.bits.CmdRsp = cpu_to_be16(cmdcode); + rsp_size = LPFC_BPL_SIZE; + size = 0; + + switch (cmdcode) { + case SLI_CTAS_RAPP_IDENT: + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "1329 RAPP_IDENT for %s", vmid->host_vmid); + ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); + rap = (struct lpfc_vmid_rapp_ident_list *) + (DAPP_IDENT_OFFSET + data); + rap->no_of_objects = cpu_to_be32(1); + rap->obj[0].entity_id_len = vmid->vmid_len; + memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len); + size = RAPP_IDENT_OFFSET + + sizeof(struct lpfc_vmid_rapp_ident_list); + retry = 1; + break; + + case SLI_CTAS_GALLAPPIA_ID: + ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); + size = GALLAPPIA_ID_SIZE; + break; + + case SLI_CTAS_DAPP_IDENT: + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "1469 DAPP_IDENT for %s", vmid->host_vmid); + ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); + dap = (struct lpfc_vmid_dapp_ident_list *) + (DAPP_IDENT_OFFSET + data); + dap->no_of_objects = cpu_to_be32(1); + dap->obj[0].entity_id_len = vmid->vmid_len; + memcpy(dap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len); + size = DAPP_IDENT_OFFSET + + sizeof(struct lpfc_vmid_dapp_ident_list); + vmid->flag &= ~LPFC_VMID_REGISTERED; + retry = 1; + break; + + case SLI_CTAS_DALLAPP_ID: + ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); + size = DALLAPP_ID_SIZE; + break; + + default: + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "7062 VMID cmdcode x%x not supported", + cmdcode); + goto vmid_free_all_mem; + } + + ctreq->CommandResponse.bits.Size = cpu_to_be16(rsp_size); + + bpl = (struct ulp_bde64 *)bmp->virt; + bpl->addrHigh = putPaddrHigh(mp->phys); + bpl->addrLow = putPaddrLow(mp->phys); + bpl->tus.f.bdeFlags = 0; + bpl->tus.f.bdeSize = size; + + /* The lpfc_ct_cmd/lpfc_get_req shall increment ndlp reference count + * to hold ndlp reference for the corresponding callback function. + */ + if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) + return 0; + + /* Decrement ndlp reference count to release ndlp reference held + * for the failed command's callback function. + */ + lpfc_nlp_put(ndlp); + + vmid_free_all_mem: + lpfc_mbuf_free(phba, bmp->virt, bmp->phys); + vmid_free_bmp_virt_exit: + kfree(bmp); + vmid_free_bmp_exit: + lpfc_mbuf_free(phba, mp->virt, mp->phys); + vmid_free_mp_virt_exit: + kfree(mp); + vmid_free_mp_exit: + + /* Issue FDMI request failed */ + lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, + "0244 Issue FDMI request failed Data: x%x", cmdcode); + return 1; +} From patchwork Tue Nov 3 07:18:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C73F3C388F9 for ; Tue, 3 Nov 2020 14:13:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75B2E22243 for ; Tue, 3 Nov 2020 14:13:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="af7HsCCN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729555AbgKCONB (ORCPT ); Tue, 3 Nov 2020 09:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729617AbgKCOMz (ORCPT ); Tue, 3 Nov 2020 09:12:55 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE164C0613D1 for ; Tue, 3 Nov 2020 06:12:54 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id t22so8603052plr.9 for ; Tue, 03 Nov 2020 06:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=f/kmT9+arFzHAyJJEiQ7WPvpGEEU+SzQHKLyKO8+6wM=; b=af7HsCCNBhp/QUiUIe+JIZ+kFsIlsyrmL8JmrytW6FUJaYA5g08EiUMEr+FCy+ft7H 2a01Xb+SmZ0FtK4dBbOWwpxDvYj3UDqd4/mgFJBu3dZZ1w4oUw6wQYqVfW/iMw1JrWBZ Kk1Mvh8P6in9G+hY+ZINDST/bu7omqQ4UXIkY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=f/kmT9+arFzHAyJJEiQ7WPvpGEEU+SzQHKLyKO8+6wM=; b=IjrbwjouOCCl2w4Ak4c4q6l9aW/5hO1pZr5R3ibYiB8NzOuIma+O/fhuD17hpB1cNj 5bJkVIbFnYVg1VTxjIxSxUl6h7+LYlSl81H/rqD7qYvJmPpj6Pco6w9mkB44sDbfTXxv JYoh9f8J0HWbaY4fM/hCLiweydboZZDX0LXNarJTYNIBQgUFFhBar7CiI78siPVXqAng ul00xJQnjcct81qxjlOH2Q3+AH9eY4lgPTC+vLeEIF6CK9iLugE5zmbJcm1H7SU9EAdV D1N3MKszcNv6CCzvZyGUe/t5cNvVqDwsV7MQgnAYvIMyLSpRMaeUFPmdI3cQ1JXdSXrm CLqA== X-Gm-Message-State: AOAM533fmKdjZULRHY8kVmQE40aEaH+cHM3F6DGyD20R/ame1Ptgbo4A qhTFKLaARD0/dk4rOfaecPNWnA== X-Google-Smtp-Source: ABdhPJzY6ceXNf/hsBCYCemuSXJs5OEqW43H2snokDmZ7K965SUGQtmy3vNHtcrGfEooonX5aUs64g== X-Received: by 2002:a17:902:ea8c:b029:d6:e179:2097 with SMTP id x12-20020a170902ea8cb02900d6e1792097mr3390202plb.70.1604412774329; Tue, 03 Nov 2020 06:12:54 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:53 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Muneendra Subject: [PATCH v3 19/19] scsi: Made changes in Kconfig to select BLK_CGROUP_FC_APPID Date: Tue, 3 Nov 2020 12:48:23 +0530 Message-Id: <1604387903-20006-20-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Made changes in Kconfig to select BLK_CGROUP_FC_APPID under SCSI_FC_ATTRS Signed-off-by: Muneendra Reported-by: kernel test robot Reported-by: kernel test robot Reported-by: kernel test robot --- v3: New patch --- drivers/scsi/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 701b61ec76ee..de142ced9e14 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -230,6 +230,7 @@ config SCSI_FC_ATTRS depends on SCSI && NET select BLK_DEV_BSGLIB select SCSI_NETLINK + select BLK_CGROUP_FC_APPID help If you wish to export transport-specific information about each attached FiberChannel device to sysfs, say Y.