Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp958877imw; Fri, 15 Jul 2022 16:50:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uoCXLoQAq1eMNKb5ECq+SCiDMidY4FB6VPD5VvzhhO+Z/osmaJX0m9T7Wt9tP4ohj0AL2m X-Received: by 2002:a17:90b:1643:b0:1f0:2094:57db with SMTP id il3-20020a17090b164300b001f0209457dbmr18273984pjb.140.1657929032703; Fri, 15 Jul 2022 16:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657929032; cv=none; d=google.com; s=arc-20160816; b=tcMwyGT6aU+MIiWnIjIzZ6sTdG/Cq4moG6/zM8AV14PHf0fF7nhy1w8kXz44Jq4u5s XLO0G7wUDrfBYJQ/66LodKxqwB+jLi2S9rD99oHFLTFGb7lYmfiURAlgSa67V/pdZ5/j 15wbt3mTS/tu4P9zgodb7DU0B6UWss/8rk8Xn+wPzIZrF0yPP80O/AYzpwlGAxK8OsXQ CRVEnPmWOwLN7gfXHf0OlDlRcK+4l8crbMyD5i0dC0zUpuj7LXtGK5IM05j9uP58B7tj OlwRyZ+stbDyHzosQ/TsmtX1VaWuS/W3FDsL3qSmioS/w9sFW9DcYsnFhzYJYhJ74Yr9 SwXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:date:from:references:in-reply-to :message-id:dkim-signature; bh=HRgmsvyQc5R1HqZKiatrCeJDIA/6CkbTdpYiY2zKJhY=; b=vkw/+GC4u6NIukksq1RQmQZerhiUBoQZ1ExATBgwgQ8O+VH0K28CiAFr0w+ZoH3nLq xn2XbZhmVd9skvZMWU1pAixB2LNeFReFdkBHihxB9g2uNvmWsS/vbqbN6lQLZGiOpGCE Rc2vGhj6h9AFlLarm0B4ApCIiCZiev4/w/1MkZQ5eULLPO5CAA8zC9boLX93GuG4RxPW ubXOjqIHIiS7DDG04HAUkRe4v+KbheabY9QtvmK1XXtbSdEbROLlDMHiuOBjib4RUQ3z 1Zdp/Pxt7C08pM0XPfI2/drCIgTbU8qzCD6VXMbEyQOwM+tG0kQpky6ITSNrTzSjsSx8 EQ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crudebyte.com header.s=lizzy header.b=Rq8UrFXi; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb10-20020a17090b4a4a00b001ecdcd18eb7si6300757pjb.154.2022.07.15.16.50.15; Fri, 15 Jul 2022 16:50:32 -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; dkim=pass header.i=@crudebyte.com header.s=lizzy header.b=Rq8UrFXi; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232683AbiGOX0a (ORCPT + 99 others); Fri, 15 Jul 2022 19:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232224AbiGOX0N (ORCPT ); Fri, 15 Jul 2022 19:26:13 -0400 X-Greylist: delayed 3800 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Jul 2022 16:25:49 PDT Received: from lizzy.crudebyte.com (lizzy.crudebyte.com [91.194.90.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07B8951D4 for ; Fri, 15 Jul 2022 16:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=HRgmsvyQc5R1HqZKiatrCeJDIA/6CkbTdpYiY2zKJhY=; b=Rq8Ur FXiEZjgbvLBKHRYMhXFkV36zqPA0exg1NpNzlek1Qkbup154jUInbQ9KzFnnAy1DZXMM0f6Zdih1H yEatOg4iZF+fb66Ivo+CwYQC5E1xXOs7j5SzlJdTACI3dNU5CKPefBhW+oZ8gWbhvw9kr+D51TTnD RpSY+x6d03BH0xsxW1urFLmbBUXcDxa1vlf35WynvV4nTzlxKEcUQCf6S8ViCVsajA6H1QV4mWpCK RkGrHAdsXxZW5nsXy1Qz8wHhoaN/vwXuA6e8AXh2nG8TdI7eFBvQzme4idLIRfeoxXWGL0IkVOQ2Q 64hJ8faeq+AMHRjCE8Uzta1nrbiOQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 15 Jul 2022 23:32:20 +0200 Subject: [PATCH v6 04/11] net/9p: add trans_maxsize to struct p9_client To: v9fs-developer@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet , Eric Van Hensbergen , Latchesar Ionkov , Nikolay Kichukov X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 This new field 'trans_maxsize' optionally allows transport to update it to reflect the actual maximum msize supported by allocated transport channel. Signed-off-by: Christian Schoenebeck --- include/net/9p/client.h | 2 ++ net/9p/client.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index ec1d1706f43c..f5718057fca4 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -87,6 +87,7 @@ struct p9_req_t { * struct p9_client - per client instance state * @lock: protect @fids and @reqs * @msize: maximum data size negotiated by protocol + * @trans_maxsize: actual maximum msize supported by transport channel * @proto_version: 9P protocol version to use * @trans_mod: module API instantiated with this client * @status: connection state @@ -101,6 +102,7 @@ struct p9_req_t { struct p9_client { spinlock_t lock; unsigned int msize; + unsigned int trans_maxsize; unsigned char proto_version; struct p9_trans_module *trans_mod; enum p9_trans_status status; diff --git a/net/9p/client.c b/net/9p/client.c index 8bba0d9cf975..20054addd81b 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -1031,6 +1031,14 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) goto free_client; } + /* + * transport will get a chance to increase trans_maxsize (if + * necessary) and it may update trans_maxsize in create() function + * below accordingly to reflect the actual maximum size supported by + * the allocated transport channel + */ + clnt->trans_maxsize = clnt->trans_mod->maxsize; + p9_debug(P9_DEBUG_MUX, "clnt %p trans %p msize %d protocol %d\n", clnt, clnt->trans_mod, clnt->msize, clnt->proto_version); @@ -1038,8 +1046,8 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) if (err) goto put_trans; - if (clnt->msize > clnt->trans_mod->maxsize) { - clnt->msize = clnt->trans_mod->maxsize; + if (clnt->msize > clnt->trans_maxsize) { + clnt->msize = clnt->trans_maxsize; pr_info("Limiting 'msize' to %d as this is the maximum " "supported by transport %s\n", clnt->msize, clnt->trans_mod->name -- 2.30.2