From nobody Wed Nov 22 01:51:56 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SZkkh5xpxz51W9Y; Wed, 22 Nov 2023 01:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SZkkh4sh5z3HXq; Wed, 22 Nov 2023 01:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zMsZnUZwWUCtbvf19RQJzjT1QyafrK3ZIEqM68WkWYc=; b=QNClTR2REl7hCpbY8KcSXkDTdAeYHEAJrV4cvBl3GMlg7ONZpOtFcV2LrvVw1mtyHC4JTE zWuBr9CF8ZKoRLWhQB2vwArtp3gKDnmdkkfTPl2RtZC4LfJsEYezYu1fGj9m9PDTpgldev Bv2nh8PV4hL6K6e+Fagj1uHwn1VH3Et7eRAKfLwZMRwEVQTreeIVywTAe/3y2Tg+DwNiUw Oz4EFot3a1975PYXhJ29RVC6wGpGFwEGvd5Vu+rE/1gbRwD4wtPQ2okzoL5KPetVKDpcuE uvzKUQzBwEAYBS4UWdO5Q7nJyFLrn2f+rhYbwwiVuGYhsMntTr58KG0RWA3e3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zMsZnUZwWUCtbvf19RQJzjT1QyafrK3ZIEqM68WkWYc=; b=Cj0Ww8pBzUOiuwGg11Mfz2MGE6LWypzZIJVpqI42J0blOX4PR3kRmEWma9pTCnN2rIWY/a OATMpVgHGZJq8IFgsl2ovqcGiQloh/zVYS5AqZzZAi/Dy2NNDC48oOYuHvmmzJ2z5biufW WsUDKq9+W2H0UQbWBKWUQ1QYyw2vpc6pAuSSdecWcqUMTajyW6gG9L0sJXMFmZ+YeXssCa VBdTOSovjca713b4bNTuUZOoFqLDoLD0wbEEHGmSHYMvXpLv5giADf4R6WDsJYrzEitxsR e6uOEULSXOfKbb9aWEkJtC8FKwXxRFgevqDyom8uhSMSL+cAotAdnFi+S1eoow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700617916; a=rsa-sha256; cv=none; b=hG/SngsCDtM+Zhv83vXDqQ0ev8+1GVJz9mFR4hBvs+ZNmR+9/ZlH3TklPdZazvA1zNOgvV ff9Kgh8JRUwQcZAFdYkT2X1H97PpweagHcnio0EpHWDhyRn5pIFhjsh6KLvkdmUR8cJ8zj SPfQnu8YF7cX44YN+PVskrn3AUxjAiXAFTb1eMCPCARk+ccHgRFHa+HIFDjdmXdvEyLdVR fW/6LkXpnqHrXd6A55RGNwUmP+xFxhvbxjRKZdXl4kbMadi5mLj5KCiVt8AVlDDUJ1gc6y FlLPasX8P0JMCUcsBqPUZ/aAg2D9aL6Ts9V6v7M68+1KhBGbbQQzXy6ekIc1lw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SZkkh3btpz10HC; Wed, 22 Nov 2023 01:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AM1puaH077328; Wed, 22 Nov 2023 01:51:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AM1pudu077325; Wed, 22 Nov 2023 01:51:56 GMT (envelope-from git) Date: Wed, 22 Nov 2023 01:51:56 GMT Message-Id: <202311220151.3AM1pudu077325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4c6a46cea41b - stable/14 - net/mlx5: Fix auto group size calculation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4c6a46cea41b236f9b06e702e8491055dddc7d4c Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4c6a46cea41b236f9b06e702e8491055dddc7d4c commit 4c6a46cea41b236f9b06e702e8491055dddc7d4c Author: Mark Bloch AuthorDate: 2023-02-19 14:05:16 +0000 Commit: Konstantin Belousov CommitDate: 2023-11-22 01:40:28 +0000 net/mlx5: Fix auto group size calculation (cherry picked from commit 04db54fe4309e896c4c80baadbcc47b171722027) --- sys/dev/mlx5/mlx5_core/fs_core.h | 1 + sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/fs_core.h b/sys/dev/mlx5/mlx5_core/fs_core.h index 3eae7868833f..dc619fc2d2db 100644 --- a/sys/dev/mlx5/mlx5_core/fs_core.h +++ b/sys/dev/mlx5/mlx5_core/fs_core.h @@ -97,6 +97,7 @@ struct mlx5_flow_table { struct { bool active; unsigned int max_types; + unsigned int group_size; unsigned int num_types; } autogroup; unsigned int max_fte; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 60353e4b3d5b..b59373d48730 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -918,6 +918,9 @@ struct mlx5_flow_table *mlx5_create_auto_grouped_flow_table(struct mlx5_flow_nam ft->autogroup.active = true; ft->autogroup.max_types = max_num_groups; + /* We save place for flow groups in addition to max types */ + ft->autogroup.group_size = ft->max_fte / (max_num_groups + 1); + if (is_shared_prio) ft->shared_refcount = 1; @@ -1066,6 +1069,7 @@ static struct mlx5_flow_group *fs_create_fg(struct mlx5_core_dev *dev, int refcount) { struct mlx5_flow_group *fg; + unsigned int group_size; int err; char name[20]; @@ -1073,6 +1077,8 @@ static struct mlx5_flow_group *fs_create_fg(struct mlx5_core_dev *dev, if (IS_ERR(fg)) return fg; + group_size = MLX5_GET(create_flow_group_in, fg_in, end_flow_index) - + MLX5_GET(create_flow_group_in, fg_in, start_flow_index) + 1; err = mlx5_cmd_fs_create_fg(dev, fg_in, ft->vport, ft->type, ft->id, &fg->id); @@ -1080,7 +1086,8 @@ static struct mlx5_flow_group *fs_create_fg(struct mlx5_core_dev *dev, goto free_fg; mutex_lock(&ft->base.lock); - if (ft->autogroup.active) + + if (ft->autogroup.active && group_size == ft->autogroup.group_size) ft->autogroup.num_types++; snprintf(name, sizeof(name), "group_%u", fg->id); @@ -1125,7 +1132,7 @@ static void fs_del_fg(struct mlx5_flow_group *fg) dev = fs_get_dev(&parent_ft->base); WARN_ON(!dev); - if (parent_ft->autogroup.active) + if (parent_ft->autogroup.active && fg->max_ftes == parent_ft->autogroup.group_size) parent_ft->autogroup.num_types--; if (mlx5_cmd_fs_destroy_fg(dev, parent_ft->vport, @@ -1432,7 +1439,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft, if (ft->autogroup.num_types < ft->autogroup.max_types) - group_size = ft->max_fte / (ft->autogroup.max_types + 1); + group_size = ft->autogroup.group_size; else group_size = 1;