From patchwork Mon Jul 29 21:12:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A66EF912 for ; Mon, 29 Jul 2019 21:13:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96A4D285F2 for ; Mon, 29 Jul 2019 21:13:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A88028758; Mon, 29 Jul 2019 21:13:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B7EB285F2 for ; Mon, 29 Jul 2019 21:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387510AbfG2VM6 (ORCPT ); Mon, 29 Jul 2019 17:12:58 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388394AbfG2VM6 (ORCPT ); Mon, 29 Jul 2019 17:12:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXtr4Lo+g/rtvL/dp9ArL1Vw5WsjPLCH8gYpdmYGp5GAEh7gfton3sVq75Qq0kwY9WVb0tKJbuQOlF/WK9ij7NH2WpL7xa2YqZ+SZpS2zMsX0owHiv8fu4Amgi6nLH8eql8VaA43PhVBUkF3yelKpmWuHZLQ5vyJEIZRK2u4uk0bCuCr63Pq7SJ5hSn+O6J4Rqhz/FSPb5wKzkx5qHA+mAGLSbRN9rvZTmuMGqu58utG5bVFXwNRNPCbFcAKWyPZw/bmowg6LGFevPOVfQVrjYu6E5WiNu15iblolo4hOH8mNfkpFMWopPycwqDLV1UuwlaG4b3ELOwJ6YLggMM3hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xTe5Bncinkzetcge/gKTMlm7NypFzMfsd4lJlCVJJpg=; b=edkRcR/ln4DeCMM7GP3woeSHAw3wK/DDpqjTFVGbZpYO8c0NTQEfvdCgq/F13wwYQIAz5tNHFUi3VEkJEOFIE06oMQq5pLl6/77Xa6V1XI+29oOucDhccgjdQgJ4EBbA++A1ayFf02UEmW1WueYOD1z9ab4kTrm1TWgBvaxgK71UdrpY8uRw1hqwu1YrheLqkRUeLe9MOTPWAXGsDi4b3X09H/kGglu5XZAxiT7RS9L01v9PtdxhBHPwtGS84Xab0vmUX1TroFa2ay354m+x3MEZFcKnnmVq6t33mMEPwy5OWeTqzrWihy0YmcGoheq+WvAFxDO/KFXpa94DGR8GvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xTe5Bncinkzetcge/gKTMlm7NypFzMfsd4lJlCVJJpg=; b=KwBDgTGutmMaiy61Pdy/Y4MvwjeE8tCS6x3dTJyvQR1m2tXyW3k2qKSdBB4RS+MCWE2t2L9OTOLvUtSdy8t/+sRt41n//h1N41h5DSL6/IrVHSeWLcJGx6RfV65d1YbufcSz54hHn1lSFgkTZjOYeZDaEpRSAlrM6h1os/ZPCvk= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:12:52 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:12:52 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Gavi Teitz , Vlad Buslov Subject: [PATCH mlx5-next 01/11] net/mlx5: Refactor and optimize flow counter bulk query Thread-Topic: [PATCH mlx5-next 01/11] net/mlx5: Refactor and optimize flow counter bulk query Thread-Index: AQHVRlJiyiCMNupJjUmwDc2HU7YCxg== Date: Mon, 29 Jul 2019 21:12:52 +0000 Message-ID: <20190729211209.14772-2-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dbf5aac4-3246-44ef-24d7-08d71469847f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1728; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(54906003)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(30864003)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: I3WGPh2Ua4HuDN3dDtd1twXboT4WhavgJEoq8Z9ZVa6F3x4mlc72tUsiyahhAvP3Oz4bobUy0EsHRUJAm5iG7IPlcAYktSw5ECZ9/KAFWmdFagLZ77BISkfW8djXANsZfivUESBfz8yZbFOEOR07AmZD1laBADmjBcdKdWJjXsiXAEFkb6V1i4Yv6+1POzjmGjRQVaOuO/MuJhxF0wUrQNgh2nekuVB1xoW2qPFOcuFwVNUpGznacEd0B05F/9f8yD0ot7LxlQZnyxLm0DNrH+TxGn3Usw8RxCs4cGIkUhKJo2Ky1RbC64W87OziJ42cG0oamGs2suDoDLFgac7GP0LBlt6U9FmLcXXNcLknvqCxnw6xc32NsHWQTJaJkRx5CsY+9f+KRdhmpIJFzHZbDEwjhA9baG/wOZHBQn1t6VE= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbf5aac4-3246-44ef-24d7-08d71469847f X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:12:52.6619 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gavi Teitz Towards introducing the ability to allocate bulks of flow counters, refactor the flow counter bulk query process, removing functions and structs whose names indicated being used for flow counter bulk allocation FW commands, despite them actually only being used to support bulk querying, and migrate their functionality to correctly named functions in their natural location, fs_counters.c. Additionally, optimize the bulk query process by: * Extracting the memory used for the query to mlx5_fc_stats so that it is only allocated once, and not for each bulk query. * Querying all the counters in one function call. Signed-off-by: Gavi Teitz Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 61 ++------- .../net/ethernet/mellanox/mlx5/core/fs_cmd.h | 13 +- .../ethernet/mellanox/mlx5/core/fs_counters.c | 125 ++++++++++-------- include/linux/mlx5/driver.h | 1 + 4 files changed, 81 insertions(+), 119 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c index 7ac1249eadc3..51f6972f4c70 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c @@ -615,67 +615,24 @@ int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id, return 0; } -struct mlx5_cmd_fc_bulk { - u32 id; - int num; - int outlen; - u32 out[0]; -}; - -struct mlx5_cmd_fc_bulk * -mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u32 id, int num) +int mlx5_cmd_fc_get_bulk_query_out_len(int bulk_len) { - struct mlx5_cmd_fc_bulk *b; - int outlen = - MLX5_ST_SZ_BYTES(query_flow_counter_out) + - MLX5_ST_SZ_BYTES(traffic_counter) * num; - - b = kzalloc(sizeof(*b) + outlen, GFP_KERNEL); - if (!b) - return NULL; - - b->id = id; - b->num = num; - b->outlen = outlen; - - return b; + return MLX5_ST_SZ_BYTES(query_flow_counter_out) + + MLX5_ST_SZ_BYTES(traffic_counter) * bulk_len; } -void mlx5_cmd_fc_bulk_free(struct mlx5_cmd_fc_bulk *b) -{ - kfree(b); -} - -int -mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, struct mlx5_cmd_fc_bulk *b) +int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, + u32 *out) { + int outlen = mlx5_cmd_fc_get_bulk_query_out_len(bulk_len); u32 in[MLX5_ST_SZ_DW(query_flow_counter_in)] = {0}; MLX5_SET(query_flow_counter_in, in, opcode, MLX5_CMD_OP_QUERY_FLOW_COUNTER); MLX5_SET(query_flow_counter_in, in, op_mod, 0); - MLX5_SET(query_flow_counter_in, in, flow_counter_id, b->id); - MLX5_SET(query_flow_counter_in, in, num_of_counters, b->num); - return mlx5_cmd_exec(dev, in, sizeof(in), b->out, b->outlen); -} - -void mlx5_cmd_fc_bulk_get(struct mlx5_core_dev *dev, - struct mlx5_cmd_fc_bulk *b, u32 id, - u64 *packets, u64 *bytes) -{ - int index = id - b->id; - void *stats; - - if (index < 0 || index >= b->num) { - mlx5_core_warn(dev, "Flow counter id (0x%x) out of range (0x%x..0x%x). Counter ignored.\n", - id, b->id, b->id + b->num - 1); - return; - } - - stats = MLX5_ADDR_OF(query_flow_counter_out, b->out, - flow_statistics[index]); - *packets = MLX5_GET64(traffic_counter, stats, packets); - *bytes = MLX5_GET64(traffic_counter, stats, octets); + MLX5_SET(query_flow_counter_in, in, flow_counter_id, base_id); + MLX5_SET(query_flow_counter_in, in, num_of_counters, bulk_len); + return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); } int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h index e340f9af2f5a..db49eabba98d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h @@ -82,16 +82,9 @@ int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id); int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id, u64 *packets, u64 *bytes); -struct mlx5_cmd_fc_bulk; - -struct mlx5_cmd_fc_bulk * -mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u32 id, int num); -void mlx5_cmd_fc_bulk_free(struct mlx5_cmd_fc_bulk *b); -int -mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, struct mlx5_cmd_fc_bulk *b); -void mlx5_cmd_fc_bulk_get(struct mlx5_core_dev *dev, - struct mlx5_cmd_fc_bulk *b, u32 id, - u64 *packets, u64 *bytes); +int mlx5_cmd_fc_get_bulk_query_out_len(int bulk_len); +int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, + u32 *out); const struct mlx5_flow_cmds *mlx5_fs_cmd_get_default(enum fs_flow_table_type type); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c index b3762123a69c..067a4b56498b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c @@ -75,7 +75,7 @@ struct mlx5_fc { * access to counter list: * - create (user context) * - mlx5_fc_create() only adds to an addlist to be used by - * mlx5_fc_stats_query_work(). addlist is a lockless single linked list + * mlx5_fc_stats_work(). addlist is a lockless single linked list * that doesn't require any additional synchronization when adding single * node. * - spawn thread to do the actual destroy @@ -136,72 +136,69 @@ static void mlx5_fc_stats_remove(struct mlx5_core_dev *dev, spin_unlock(&fc_stats->counters_idr_lock); } -/* The function returns the last counter that was queried so the caller - * function can continue calling it till all counters are queried. - */ -static struct mlx5_fc *mlx5_fc_stats_query(struct mlx5_core_dev *dev, - struct mlx5_fc *first, - u32 last_id) +static int get_max_bulk_query_len(struct mlx5_core_dev *dev) { - struct mlx5_fc_stats *fc_stats = &dev->priv.fc_stats; - struct mlx5_fc *counter = NULL; - struct mlx5_cmd_fc_bulk *b; - bool more = false; - u32 afirst_id; - int num; - int err; + return min_t(int, MLX5_SW_MAX_COUNTERS_BULK, + (1 << MLX5_CAP_GEN(dev, log_max_flow_counter_bulk))); +} - int max_bulk = min_t(int, MLX5_SW_MAX_COUNTERS_BULK, - (1 << MLX5_CAP_GEN(dev, log_max_flow_counter_bulk))); +static void update_counter_cache(int index, u32 *bulk_raw_data, + struct mlx5_fc_cache *cache) +{ + void *stats = MLX5_ADDR_OF(query_flow_counter_out, bulk_raw_data, + flow_statistics[index]); + u64 packets = MLX5_GET64(traffic_counter, stats, packets); + u64 bytes = MLX5_GET64(traffic_counter, stats, octets); - /* first id must be aligned to 4 when using bulk query */ - afirst_id = first->id & ~0x3; + if (cache->packets == packets) + return; - /* number of counters to query inc. the last counter */ - num = ALIGN(last_id - afirst_id + 1, 4); - if (num > max_bulk) { - num = max_bulk; - last_id = afirst_id + num - 1; - } + cache->packets = packets; + cache->bytes = bytes; + cache->lastuse = jiffies; +} - b = mlx5_cmd_fc_bulk_alloc(dev, afirst_id, num); - if (!b) { - mlx5_core_err(dev, "Error allocating resources for bulk query\n"); - return NULL; - } +static void mlx5_fc_stats_query_counter_range(struct mlx5_core_dev *dev, + struct mlx5_fc *first, + u32 last_id) +{ + struct mlx5_fc_stats *fc_stats = &dev->priv.fc_stats; + bool query_more_counters = (first->id <= last_id); + int max_bulk_len = get_max_bulk_query_len(dev); + u32 *data = fc_stats->bulk_query_out; + struct mlx5_fc *counter = first; + u32 bulk_base_id; + int bulk_len; + int err; - err = mlx5_cmd_fc_bulk_query(dev, b); - if (err) { - mlx5_core_err(dev, "Error doing bulk query: %d\n", err); - goto out; - } + while (query_more_counters) { + /* first id must be aligned to 4 when using bulk query */ + bulk_base_id = counter->id & ~0x3; - counter = first; - list_for_each_entry_from(counter, &fc_stats->counters, list) { - struct mlx5_fc_cache *c = &counter->cache; - u64 packets; - u64 bytes; + /* number of counters to query inc. the last counter */ + bulk_len = min_t(int, max_bulk_len, + ALIGN(last_id - bulk_base_id + 1, 4)); - if (counter->id > last_id) { - more = true; - break; + err = mlx5_cmd_fc_bulk_query(dev, bulk_base_id, bulk_len, + data); + if (err) { + mlx5_core_err(dev, "Error doing bulk query: %d\n", err); + return; } + query_more_counters = false; - mlx5_cmd_fc_bulk_get(dev, b, - counter->id, &packets, &bytes); + list_for_each_entry_from(counter, &fc_stats->counters, list) { + int counter_index = counter->id - bulk_base_id; + struct mlx5_fc_cache *cache = &counter->cache; - if (c->packets == packets) - continue; + if (counter->id >= bulk_base_id + bulk_len) { + query_more_counters = true; + break; + } - c->packets = packets; - c->bytes = bytes; - c->lastuse = jiffies; + update_counter_cache(counter_index, data, cache); + } } - -out: - mlx5_cmd_fc_bulk_free(b); - - return more ? counter : NULL; } static void mlx5_free_fc(struct mlx5_core_dev *dev, @@ -244,8 +241,8 @@ static void mlx5_fc_stats_work(struct work_struct *work) counter = list_first_entry(&fc_stats->counters, struct mlx5_fc, list); - while (counter) - counter = mlx5_fc_stats_query(dev, counter, last->id); + if (counter) + mlx5_fc_stats_query_counter_range(dev, counter, last->id); fc_stats->next_query = now + fc_stats->sampling_interval; } @@ -324,6 +321,8 @@ EXPORT_SYMBOL(mlx5_fc_destroy); int mlx5_init_fc_stats(struct mlx5_core_dev *dev) { struct mlx5_fc_stats *fc_stats = &dev->priv.fc_stats; + int max_bulk_len; + int max_out_len; spin_lock_init(&fc_stats->counters_idr_lock); idr_init(&fc_stats->counters_idr); @@ -331,14 +330,24 @@ int mlx5_init_fc_stats(struct mlx5_core_dev *dev) init_llist_head(&fc_stats->addlist); init_llist_head(&fc_stats->dellist); + max_bulk_len = get_max_bulk_query_len(dev); + max_out_len = mlx5_cmd_fc_get_bulk_query_out_len(max_bulk_len); + fc_stats->bulk_query_out = kzalloc(max_out_len, GFP_KERNEL); + if (!fc_stats->bulk_query_out) + return -ENOMEM; + fc_stats->wq = create_singlethread_workqueue("mlx5_fc"); if (!fc_stats->wq) - return -ENOMEM; + goto err_wq_create; fc_stats->sampling_interval = MLX5_FC_STATS_PERIOD; INIT_DELAYED_WORK(&fc_stats->work, mlx5_fc_stats_work); return 0; + +err_wq_create: + kfree(fc_stats->bulk_query_out); + return -ENOMEM; } void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev) @@ -352,6 +361,8 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev) destroy_workqueue(dev->priv.fc_stats.wq); dev->priv.fc_stats.wq = NULL; + kfree(fc_stats->bulk_query_out); + idr_destroy(&fc_stats->counters_idr); tmplist = llist_del_all(&fc_stats->addlist); diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 0e6da1840c7d..267b2bc0ca4a 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -488,6 +488,7 @@ struct mlx5_fc_stats { struct delayed_work work; unsigned long next_query; unsigned long sampling_interval; /* jiffies */ + u32 *bulk_query_out; }; struct mlx5_events; From patchwork Mon Jul 29 21:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38E81112C for ; Mon, 29 Jul 2019 21:13:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AFDC285F2 for ; Mon, 29 Jul 2019 21:13:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F56128758; Mon, 29 Jul 2019 21:13:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97C5F285F2 for ; Mon, 29 Jul 2019 21:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388435AbfG2VNB (ORCPT ); Mon, 29 Jul 2019 17:13:01 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388415AbfG2VNB (ORCPT ); Mon, 29 Jul 2019 17:13:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CHvdlfa4pQaAkcWipZm2Rh7Z4XXztQV2XlYF2YI4fHzUa70g2I07uQl90SagGTl4P9gn9vvBpntbZDAyr91JHTszJyUhP0hLwiBruGGEGuTCDqaBo/YmXlN9mhdPyCma/B28JQGwHS2pt8honYMuLfHpzKo8boiXWxRkOmRWUH2z1/MniWeoV8aV3AsTiF0Cb0p68A443x+NB1UMRnxvHNYSdMr1aJkYSK3salptHr8NwS47DbyKfnV0YOJI5DohA8qr2KJ1UxtlbG5hUq3qTdb+fEwzVGWFx5QlZI+ulJlCjF4BTPliETvCjMQN+NTeeELkizzKwbMW9k7U+LMqyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zd58+mrw/Hm5qU8twYSx9ViD4FRzW2EDClHRct0eOzg=; b=QNjbYdm6PNIi6IEaBjiEdx8k+3XHWma6RstTKF2CuJw6Kh2Y+X+p3oOijqUYZhmK2lguTWHGGUi6bRKkE8H5EnVh3KzrfJeQA3963LL+g+D4ZMw796qy0aB7hlggOokkrjD5NtDxSBXgS5Mc1dBfCwp4/Yr29ZPFPNt6RDRCu0BWsRAc5Zx8fwwgxNEmLZqOzPMs+IAOhcxKGEGj0XRs/ur9gY8YZpBr96V037ZvtYY9RrnZtZawrCHkwy5/Qitevj9oZxfdkrzOTYb2SozCe/iPM3cjYb2A9Vh1pbRQFGylKhwyp9WXMZFf+ykp/tmgfNVLxpNxwP6KQrU+aBYXkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zd58+mrw/Hm5qU8twYSx9ViD4FRzW2EDClHRct0eOzg=; b=VAVxbxPa5uR6xOrMIFKxxUO3P/NTvpHwC0TFkGhvgvDeSACuQLYre6Evvt3UMiVKGqo3hk1ScnIzUZwCnY+4LSmolSJEctDPDB4pMJl0P9bx6o/6uK1L2CxtMQ6W5vval1iHBPzR1ojU6+NohW0121BTayth6QdvXE/jrJUAk/U= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:12:54 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:12:54 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Gavi Teitz , Vlad Buslov Subject: [PATCH mlx5-next 02/11] net/mlx5: Add flow counter bulk allocation hardware bits and command Thread-Topic: [PATCH mlx5-next 02/11] net/mlx5: Add flow counter bulk allocation hardware bits and command Thread-Index: AQHVRlJjzIz4a/kgFESfERMyVLc2wQ== Date: Mon, 29 Jul 2019 21:12:54 +0000 Message-ID: <20190729211209.14772-3-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b84c1f6e-7016-4228-2e26-08d7146985c2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(54906003)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Ke4mZPSSCQp1X3PEjZQ0TegPX9WIEoeqBm9QJaRh9Qb6q0nhDUsB6XcbKefvnOUbDoloO8jGpToXftUcplv1k5xK+3mrB6kkZHfmDuRfIc2QyY8a43SMxJK1SoXXuVDYrDKwG6X9fssFIZot3iF174mwnGSyNjti7wBg/c7itMR0BXyj0ZgLRF7SbZ7R+Hg1Dfzpb2wqlqrp59AkHJp12E5uKswAjcxXSI9nIMlZYIsK+A9Zr5qtftWsKSFuU+L0b6CfJvEZSRaKIoDpcPFvbXvq0ZuXU9z96oWweVvXobCfNDRfENlFvFf5DogPZVMTABpMwcFIAtYFt0fgNsVjfBHa/iBG9k2+fIndp5Qaj1d9A/YkSnlm38dXHIaQQ8Y5h6PPZYqxGiGho0eQ/hudEy3ShlMzJLasCD7ashDFhYg= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b84c1f6e-7016-4228-2e26-08d7146985c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:12:54.7650 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gavi Teitz Add a handle to invoke the new FW capability of allocating a bulk of flow counters. Signed-off-by: Gavi Teitz Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 10 ++++++++- .../net/ethernet/mellanox/mlx5/core/fs_cmd.h | 3 +++ include/linux/mlx5/mlx5_ifc.h | 21 +++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c index 51f6972f4c70..b84a225bbe86 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c @@ -566,7 +566,9 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns, return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } -int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) +int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, + enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask, + u32 *id) { u32 in[MLX5_ST_SZ_DW(alloc_flow_counter_in)] = {0}; u32 out[MLX5_ST_SZ_DW(alloc_flow_counter_out)] = {0}; @@ -574,6 +576,7 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) MLX5_SET(alloc_flow_counter_in, in, opcode, MLX5_CMD_OP_ALLOC_FLOW_COUNTER); + MLX5_SET(alloc_flow_counter_in, in, flow_counter_bulk, alloc_bitmask); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (!err) @@ -581,6 +584,11 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) return err; } +int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) +{ + return mlx5_cmd_fc_bulk_alloc(dev, 0, id); +} + int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id) { u32 in[MLX5_ST_SZ_DW(dealloc_flow_counter_in)] = {0}; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h index db49eabba98d..bc4606306009 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h @@ -78,6 +78,9 @@ struct mlx5_flow_cmds { }; int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id); +int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, + enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask, + u32 *id); int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id); int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id, u64 *packets, u64 *bytes); diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index b3d5752657d9..196987f14a3f 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -1040,6 +1040,21 @@ enum { MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1, }; +#define MLX5_FC_BULK_SIZE_FACTOR 128 + +enum mlx5_fc_bulk_alloc_bitmask { + MLX5_FC_BULK_128 = (1 << 0), + MLX5_FC_BULK_256 = (1 << 1), + MLX5_FC_BULK_512 = (1 << 2), + MLX5_FC_BULK_1024 = (1 << 3), + MLX5_FC_BULK_2048 = (1 << 4), + MLX5_FC_BULK_4096 = (1 << 5), + MLX5_FC_BULK_8192 = (1 << 6), + MLX5_FC_BULK_16384 = (1 << 7), +}; + +#define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum)) + struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_at_0[0x30]; u8 vhca_id[0x10]; @@ -1244,7 +1259,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_at_2e0[0x7]; u8 max_qp_mcg[0x19]; - u8 reserved_at_300[0x18]; + u8 reserved_at_300[0x10]; + u8 flow_counter_bulk_alloc[0x8]; u8 log_max_mcg[0x8]; u8 reserved_at_320[0x3]; @@ -7815,7 +7831,8 @@ struct mlx5_ifc_alloc_flow_counter_in_bits { u8 reserved_at_20[0x10]; u8 op_mod[0x10]; - u8 reserved_at_40[0x40]; + u8 reserved_at_40[0x38]; + u8 flow_counter_bulk[0x8]; }; struct mlx5_ifc_add_vxlan_udp_dport_out_bits { From patchwork Mon Jul 29 21:12:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D662D912 for ; Mon, 29 Jul 2019 21:13:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8F5B285F2 for ; Mon, 29 Jul 2019 21:13:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD05628758; Mon, 29 Jul 2019 21:13:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66808285F2 for ; Mon, 29 Jul 2019 21:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388450AbfG2VNE (ORCPT ); Mon, 29 Jul 2019 17:13:04 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388434AbfG2VND (ORCPT ); Mon, 29 Jul 2019 17:13:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F7VphGLL5c9yVnVV274twOIeoE/njfQTzT/lc6sz7gRfacnNMzVvCzg2ixePJiKteKlEC6MkrKt8cMALbbT/djRcM4MCiCL0rVbO0serJfz2J5uyLslHC5ZpQ0NvxUvi17YVGKTxh7yf8HOJOB1tHKzm6WV3Bj3gyAx7yHHtWjrN/KsNhQwxDpWV2XYS44L1tqabq9Ex/swy6vWb20zucWd61eRI0G8b1tMiNB0m4DNWC/uyUB/iTzl7DwO/GTyXksbFxCdelGTgh2ztzwFPLtW7hmFxD9wxWh54vY83JQGqS1b5kOoBtc5MqE/NPu5Rwo/y2Ptis74m5w/xXs/L3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k0gsSeQB57OWaAojMa+b9EC5sVfUG/zQQuw62dmp8ic=; b=DIP6KwsEV+TDvepz4aeiMJqSKwd2kzmC4YBrRMdzFaJ6JjNdVUksc1k8GsXFGmWTZqllVYOixqxK0sSthLZn4NNcSUfT8eC8tvmoKeQeVQxTnTy5NdSG2OnryRJaXH0D54T/yrzBuYORWkrf64OnLIhuZHT9WBRtSxnz2Y1WAOapH9fsALiVpBeMkjLzUZ+LbJM6xc8dQcADUFUxF+WguQSmOZZzc7GHTEc/XJTGpzpDrVbZ1eFY4Ek3QjefEAhpmftiwFhTqqXv5Olt2LuLrIyKlxey0JElVKfnABfxg86iG5RPrM34O+36OjkLTOE98Pfolr+PO4poO3KbHLIDjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k0gsSeQB57OWaAojMa+b9EC5sVfUG/zQQuw62dmp8ic=; b=Ob0J6CC9dzbzuLyXxrERVR4r5RlqgkEn0fvHcW1wwB1cr0cz6fvVjFxD3/47onaHpzN91Um33N8RS9pfwspEqlm+GUh1r6TfQcac9dT+ov8cO6B7Epsdh9zbERrSDm921XmgB0ZK7JI21W6EhR1AhHBRAJok5skuwuEVr0lrB/4= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:12:56 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:12:56 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" Subject: [PATCH mlx5-next 03/11] net/mlx5: Fix offset of tisc bits reserved field Thread-Topic: [PATCH mlx5-next 03/11] net/mlx5: Fix offset of tisc bits reserved field Thread-Index: AQHVRlJkqMfsMXBx6EWTMCn5TNPjqA== Date: Mon, 29 Jul 2019 21:12:56 +0000 Message-ID: <20190729211209.14772-4-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7b3bdc9a-2d4f-42e4-9998-08d7146986be x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:843; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(4744005)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 7bB33Zudg8wP5P1GmYZh0Q8+lOBYz25FowJR2ldEP6fiH0Wiiw+Pkspp31hi1jmON5L1KZmOTRZmuvdHrE+MyJqbAGoQ4PQ/Rh/DZ8WDzcoNs/eJRog0Ak2zyKzVrozqWIBzCfWiL25iAOPSPL7KKYHD1Vgvfd/oYMc4okC8r/DG6b9BlK9JC25dV+bQHIHZTqP6Qgskndeufa/RChBlUqL484ov0uxUKQXJUrxwhAEO/XdrlPzAmGPFQLqzheklb70obmFnMbSJTNVVnr0NAO8zmJ7Sri8NFbFCX5XgqJWPatYZgDd5mK6oftA0ZkanmLYI3O5UtXGzdUpUDJt/t1T3Izw0BWC2imEdJf+W1IhgmA08E0gLu6KmozFY39CE7oppvFGgZb1uetrmR0H3o4sk2GneWNAMvCYcU7DU/Fs= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b3bdc9a-2d4f-42e4-9998-08d7146986be X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:12:56.4442 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP First reserved field is off by one instead of reserved_at_1 it should be reserved_at_2, fix that. Fixes: a12ff35e0fb7 ("net/mlx5: Introduce TLS TX offload hardware bits and structures") Signed-off-by: Saeed Mahameed Reviewed-by: Leon Romanovsky --- include/linux/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 196987f14a3f..9265c84ad353 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -2782,7 +2782,7 @@ struct mlx5_ifc_traffic_counter_bits { struct mlx5_ifc_tisc_bits { u8 strict_lag_tx_port_affinity[0x1]; u8 tls_en[0x1]; - u8 reserved_at_1[0x2]; + u8 reserved_at_2[0x2]; u8 lag_tx_port_affinity[0x04]; u8 reserved_at_8[0x4]; From patchwork Mon Jul 29 21:12:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07F00112C for ; Mon, 29 Jul 2019 21:13:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED198285F2 for ; Mon, 29 Jul 2019 21:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E199628758; Mon, 29 Jul 2019 21:13:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836C5285F2 for ; Mon, 29 Jul 2019 21:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388474AbfG2VNT (ORCPT ); Mon, 29 Jul 2019 17:13:19 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388449AbfG2VNS (ORCPT ); Mon, 29 Jul 2019 17:13:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=grdB0GKovN+Cv6xDTV3J0ozQk9pW1JlCf6raDtHEg3SHLr80LOCi1++oMMnPfgdF8XnjNOx+SG83hc97Pt10mV1PQABCQXXUVwkFrWW1ac2WQHUmoqa0sRg6N6KHwWbGm+GclmLfdc37ecYeb0ch3Iep6O0G4YGfjTzHjTWDIP8TkIg4zNzeVDrlawrl0DIU7oKuO1Kr/iFIFcmds6MmJrp9a1SGxhzzOY7EeK8fV1OqmO98s/ChKU1XPEdXw0UVusUPXQGM6lY9HllTbaHZf2BDemfO144qmM9LFSuq8F7S1LVZ/W8qFr+n2hqyk/tuBo4PTAHggMMESYrkgZ82Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8m8el9CZYJwtKwDuMiM/I8qzbt3V7RWpFPcpSX+OMcU=; b=QmTMPr1nohiVs2SJ8ROchZwtK2pb25PaeL5876SPFPmc16zQkq1Cyu1auRK3R8rIta79VERY57YMUa9YfZEkQPaLjMg41HisbY2RX5jd0TdxrPKS+c52USMtzUaqcKnp8q39t+4NBCsfEwqHz/oWaIsqs3sIaLREEqjU1+QVv9AweRKy05ka1oJMXaNK4OXj3wZ+H52SJX58BWXQM+8mAfT6DDIdyuGaxCKAMTjW+sACqQ2j0BuHdVGdsF/N3ZUwPasGMLna9klO50GuKGIItYw7MHq5M4HOvdx4Vp8zqCZ2t2NMaeUFAhGZ80JvX2Kq5wUVmOifNNXn/y/Wam2o2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8m8el9CZYJwtKwDuMiM/I8qzbt3V7RWpFPcpSX+OMcU=; b=HtCE6ToW0LghJlVq7eC4/8zVjz8Cm4mIs3ZQqNfMkIF0IDY787u8JHgaqyShfDXy4b1mx1m+3SM+207r23nD1vcu9IkUv7Hhe9ABvtYhaU9CkWwWYpr/O6n0U8f8rlfuDJs3zMN6k5QJWHH61SXufoeocdzFTV5DeKajMe/MuRU= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:12:58 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:12:58 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 04/11] net/mlx5: Make load_one() and unload_one() symmetric Thread-Topic: [PATCH mlx5-next 04/11] net/mlx5: Make load_one() and unload_one() symmetric Thread-Index: AQHVRlJlDvaQzr4jf0W0UiiDRpTtBA== Date: Mon, 29 Jul 2019 21:12:58 +0000 Message-ID: <20190729211209.14772-5-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1808e248-b549-40f0-a8b4-08d7146987db x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:425; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: So9VoMVabro420hw2EzCiSCvwvZZ0rp+t9sKGWdoieHlvLfnjHcPLo5OOKlIw8Q21UmHUhemH3rAJc3uYQ3iA3ngNxK/MezCpcxkJlxovnZUzYh3g7F/FZh4QjEdiNGze55aLL68d9farVuQmGSkleYQ18JfPuneX5u0R7aSBVAl3Us+k14Qj+OwUr09TaWruUVH/mDbeFWtMjpG5uQLgSemueOlw0kWMzHJKBwpyGwE5WD1kVvHHun6JpXrcBzcoqb7CyxuvhiLaiskJH8UPIwHULhU6PJUFvc+70Ugs0HsX2AC1uROotIEghPAAOksQ4ysBwFTInJrlapiOE3dtqXFBz8GuawMZLLIKe/mYQ6EDt9zbZSlvFO+wxHnIpd6TevyRk5E2W6WZ08CI9ktx5k4Oxe9q5Al4toN9xR72bM= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1808e248-b549-40f0-a8b4-08d7146987db X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:12:58.4613 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit Currently mlx5_load_one() perform device registration using mlx5_register_device(). But mlx5_unload_one() doesn't unregister. Make them symmetric by doing device unregistration in mlx5_unload_one(). Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index b15b27a497fc..fa0e991f1983 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1217,8 +1217,10 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup) { int err = 0; - if (cleanup) + if (cleanup) { + mlx5_unregister_device(dev); mlx5_drain_health_wq(dev); + } mutex_lock(&dev->intf_state_mutex); if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { @@ -1369,7 +1371,6 @@ static void remove_one(struct pci_dev *pdev) mlx5_crdump_disable(dev); mlx5_devlink_unregister(devlink); - mlx5_unregister_device(dev); if (mlx5_unload_one(dev, true)) { mlx5_core_err(dev, "mlx5_unload_one failed\n"); From patchwork Mon Jul 29 21:13:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEFA5112C for ; Mon, 29 Jul 2019 21:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD621285F2 for ; Mon, 29 Jul 2019 21:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAFB728758; Mon, 29 Jul 2019 21:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4914C285F2 for ; Mon, 29 Jul 2019 21:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388361AbfG2VNR (ORCPT ); Mon, 29 Jul 2019 17:13:17 -0400 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:5933 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387803AbfG2VNR (ORCPT ); Mon, 29 Jul 2019 17:13:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hteXCrKIFq0Gy6wFppLXkaAjzgHvbH/pJEnTW2qkKqMqUyEB4fXiD49+lIPcn7LZ8CSgGeucBtWVPg/r8FEQ8ZjZoXwuh1/WDsaieWQGQzO8BFDijK1E0H+8KEaB3ATI9MjRFImgdn7dFjhwuXr5GBkIEA6rY1r0moxXtEmDSvA+9CGrd7l0ZValQQhVLjuGVfV+MrBxlJ7aA62IsIBDppVTMt6eM+D8QyvT/wUnPF/u6/dWEQgp/SM4hv6igIU/YzEJ1ys1MRn3EbiYWx4zig0WYtFUfZfCYAZU49X1RufATkt0YP5exz+S6XtehQHO9oMwQoUE+dGSUNNPW54jmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Aa7SrWt4Izf5ymGltyfrSyvzDbJcO4Z5hiwC/1R2fpI=; b=QcjT+YaQSW+74OUqc+huM2Nzwo6m5e2ZFomSwLLyQjs7ReTlJodDtVQZ4xgKpSo3x1nlfikkCOqAQVc3RtypFer7zlqQ8DVEhItcs+MyyYgU8pGyPCkJOUFp+QOCNBQFzg4PtUJah7tWY4wS5pzsmL0pHZ+rrMcdhfLEgYZGElXckGmHr7pL73lj5bTKlPylYFLE5GCaPDFA0OQRFgMjMX57UQDqHAZIo+JamvqMY9dXyElG+/Bkg6NCZcrCqo2aFC0xeuljYfZ/fTiX90ZDlkcpkq9UDIT8wBfNqyhjPAPztqKxyO0ErHP6AU8dMW9lwaOwMRPuUAvSBX+1I2bcTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Aa7SrWt4Izf5ymGltyfrSyvzDbJcO4Z5hiwC/1R2fpI=; b=ewirsGBQX6qOle95+eRCxG31WNe/pDM+oPTKtlg6XckSKcSZEXS6Dt3AaGTtmZtoawTVSXQMzmI0W0PtfXsrr1vDDFiudMHmOZDT8OsYOawDfl0SFrt4ZzaH4HM4jlZ0Fr/S1S3w/IUE9uCODFQvjAZTVehpVucTj59NcaAw8hE= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:00 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:00 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Eli Cohen , Paul Blakey Subject: [PATCH mlx5-next 05/11] net/mlx5: E-Switch, Verify support QoS element type Thread-Topic: [PATCH mlx5-next 05/11] net/mlx5: E-Switch, Verify support QoS element type Thread-Index: AQHVRlJmWxzTFuXbIkyV0t86aZ45Yw== Date: Mon, 29 Jul 2019 21:13:00 +0000 Message-ID: <20190729211209.14772-6-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e3d35eb0-af05-45ac-707c-08d71469892a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1169; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(54906003)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: LEtvU0tJ2rc4Twr8I1+drpf2lUCk6l/N/ZcIo6FYiOa7+lZGGYLQ8FCzDNflOXUkDs0O8275ts3bGtWkfZSMZeyFTSejlKY/qFz3UT1roboMQxsxLukFGDeQ6OsywOmdLt7xlXfTDneXdyUkKAWTUgNLJG4PDVQ0Lb6s/139r6G4HwsbUwUucoGkeu6pbHnr5RSmYUOko4zE63PHQ3MRmLPNawunou8/ZsjNpXnyQRepEd/cvAmdpzrwdadTVzqr3CNf1o9BtcMrFEjZm+C77BRsaNfghix8vtxAX34iB5Bo0djd+HjIQG+lDrzuqXOap7npaMq4/MYYa7FuYoAtYqof5NgFpE+6yg7DXtqYg4bVKYXPwr6Lkw6nm/qO3ZyaPFtZbhhYIc/YsKG5sFmeMTGFZnLBfN80hLVwWR96vxs= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3d35eb0-af05-45ac-707c-08d71469892a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:00.3115 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eli Cohen Check if firmware supports the requested element type before attempting to create the element type. In addition, explicitly specify the request element type and tsar type. Signed-off-by: Eli Cohen Reviewed-by: Paul Blakey Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 31 +++++++++++++++++++ include/linux/mlx5/mlx5_ifc.h | 7 +++++ 2 files changed, 38 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 1f3891fde2eb..2927fa1da92f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1393,19 +1393,50 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, return err; } +static bool element_type_supported(struct mlx5_eswitch *esw, int type) +{ + struct mlx5_core_dev *dev = esw->dev = esw->dev; + + switch (type) { + case SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_TASR; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_VPORT; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_VPORT_TC; + case SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC: + return MLX5_CAP_QOS(dev, esw_element_type) & + ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC; + } + return false; +} + /* Vport QoS management */ static int esw_create_tsar(struct mlx5_eswitch *esw) { u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; struct mlx5_core_dev *dev = esw->dev; + __be32 *attr; int err; if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) return 0; + if (!element_type_supported(esw, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR)) + return 0; + if (esw->qos.enabled) return -EEXIST; + MLX5_SET(scheduling_context, tsar_ctx, element_type, + SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); + + attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes); + *attr = cpu_to_be32(TSAR_ELEMENT_TSAR_TYPE_DWRR << 16); + err = mlx5_create_scheduling_element_cmd(dev, SCHEDULING_HIERARCHY_E_SWITCH, tsar_ctx, diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 9265c84ad353..30d15e80bcc7 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -2957,6 +2957,13 @@ enum { SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC = 0x3, }; +enum { + ELEMENT_TYPE_CAP_MASK_TASR = 1 << 0, + ELEMENT_TYPE_CAP_MASK_VPORT = 1 << 1, + ELEMENT_TYPE_CAP_MASK_VPORT_TC = 1 << 2, + ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC = 1 << 3, +}; + struct mlx5_ifc_scheduling_context_bits { u8 element_type[0x8]; u8 reserved_at_8[0x18]; From patchwork Mon Jul 29 21:13:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55C9F912 for ; Mon, 29 Jul 2019 21:13:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48075285F2 for ; Mon, 29 Jul 2019 21:13:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C91E28758; Mon, 29 Jul 2019 21:13:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B2F285F2 for ; Mon, 29 Jul 2019 21:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388449AbfG2VNV (ORCPT ); Mon, 29 Jul 2019 17:13:21 -0400 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:5933 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388459AbfG2VNU (ORCPT ); Mon, 29 Jul 2019 17:13:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3P4qwlUIQSov6SBmdJPDJsrI0ba4AXpI/1xzSZoml9wFjWmfWB9hijaiR8MrgCcGeuaHTanV/88BT01TESyRedveqa39o27KhW+2w1+VW9o5ac49cyoCzx6ezwAtPK9cJCzADe9zerVSJqxQ9aTwz/32ZBfNJku1s4cMaVqlo7yU070w+P6f1svInv5Hc4vrTAetx/fmUlwSFelxBKzYHACrmdmviBAIeMRcumqZBSusEw9iW2bUEDYK3PNWsTNc7G3zj6p8b08VS7VtWosjFq+LO0cH9g3Phj1gjJ2LeqNiYy9vLXwXtDufU4TO510XxSSLuFVRXzBFYeEFFFf+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i3jamkuzNEYKahh/SX/5f8LamiiC4uvE+wEEMvNnFew=; b=hyGRz3wn6eVfgw15Vqb7x3KUzRJTwOG8CgKJIw1lo28oVH0tJvslze/LebsuN7Vcqz4dFj9yt2qANd+/1PAFwfTIfbbLmzcgHkJ+CamvFQL6bAu/FIiE6JO4LRMBOkhQA0Jz4DUnusQkBJjqQvG7yiXiiyUw6t5WGBmhoRRnw3686ccE57HU4WrNWspbFEnoz46xitl2crnxB9jxG6arYBzBEdozWDiGpZKB5U3Nn+GwlFh2/kMGSLGHynB87gjjDOurChQ7qwR3XQl8FO4xv+VwVKnChUSFW5tMnZ+3HcS9yc4cuxr8Hqgx0PhyhmOZOFX+Yj6iByCBGR4bBNEyKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i3jamkuzNEYKahh/SX/5f8LamiiC4uvE+wEEMvNnFew=; b=FXGHdfsl+elxTAI5px0fW+adopkyPh8uloSsphH7aeg500Ph6Huikdl8adi05dU9xnhKkQPxS7rlR2/+0tZASmSvql+gzudij1EoA2yxLDcEoXep5o/mI2sMs8pKT0x8aLvUh4AWKMrJxhQLuQtCdJr384SBJ3bV0EaY6nWsLEM= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:02 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:02 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 06/11] net/mlx5: E-switch, Combine metadata enable/disable functionality Thread-Topic: [PATCH mlx5-next 06/11] net/mlx5: E-switch, Combine metadata enable/disable functionality Thread-Index: AQHVRlJoA7QYAf7F/0W6b2yLCTanpg== Date: Mon, 29 Jul 2019 21:13:02 +0000 Message-ID: <20190729211209.14772-7-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5d0ce755-71bf-4640-e663-08d714698a68 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: DAia1iMLjjDi8Px+E89vk+9WqqOhnxVOwkaT994718kr1czDsqdyWbNTG3lXrzLw9E/NcNkAZGe7+IIyDyz++cdcUVhpTtrIW4fwpo7dGvjzbqgnvuIkC/DuyFoQPkagVIYDRrMlb0T1bV6sauNU84uxRqF7WQj9LDt1gBAjOdnecEFpl6clNPiBPq8S7QF7NbTUKfn99OmLsCFpLS4iDaRyhYTfLrC0yzwT4uRtjK6ckALyBIEFGCofzULcyE2IJHRXhHNKwYq21I6z6JmBBC3sq7zcSYeEL+zyXWHzgnI3Ro+ODm6p+0Q3Y7eB2GhrMzUNFBEpKAbxJ/s9r5SjjBEuat+XFA7m5LRdd2P9zn7U8sWPio+e1+QdFWtZIC27lpMbMWMYBb8RILmKSShPycQQBjfP50BKaT9mpQES/7U= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d0ce755-71bf-4640-e663-08d714698a68 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:02.4055 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit Except bit toggling code, rest of the code is same to enable/disable metadata passing functionality. Hence, combine them to single function and control using enable flag. Also instead of checking metadata supported at multiple places, fold into the helper function. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/eswitch_offloads.c | 48 +++++-------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 089ae4d48a82..4be19890f725 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -587,38 +587,15 @@ void mlx5_eswitch_del_send_to_vport_rule(struct mlx5_flow_handle *rule) mlx5_del_flow_rules(rule); } -static int mlx5_eswitch_enable_passing_vport_metadata(struct mlx5_eswitch *esw) +static int esw_set_passing_vport_metadata(struct mlx5_eswitch *esw, bool enable) { u32 out[MLX5_ST_SZ_DW(query_esw_vport_context_out)] = {}; u32 in[MLX5_ST_SZ_DW(modify_esw_vport_context_in)] = {}; u8 fdb_to_vport_reg_c_id; int err; - err = mlx5_eswitch_query_esw_vport_context(esw, esw->manager_vport, - out, sizeof(out)); - if (err) - return err; - - fdb_to_vport_reg_c_id = MLX5_GET(query_esw_vport_context_out, out, - esw_vport_context.fdb_to_vport_reg_c_id); - - fdb_to_vport_reg_c_id |= MLX5_FDB_TO_VPORT_REG_C_0; - MLX5_SET(modify_esw_vport_context_in, in, - esw_vport_context.fdb_to_vport_reg_c_id, fdb_to_vport_reg_c_id); - - MLX5_SET(modify_esw_vport_context_in, in, - field_select.fdb_to_vport_reg_c_id, 1); - - return mlx5_eswitch_modify_esw_vport_context(esw, esw->manager_vport, - in, sizeof(in)); -} - -static int mlx5_eswitch_disable_passing_vport_metadata(struct mlx5_eswitch *esw) -{ - u32 out[MLX5_ST_SZ_DW(query_esw_vport_context_out)] = {}; - u32 in[MLX5_ST_SZ_DW(modify_esw_vport_context_in)] = {}; - u8 fdb_to_vport_reg_c_id; - int err; + if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) + return 0; err = mlx5_eswitch_query_esw_vport_context(esw, esw->manager_vport, out, sizeof(out)); @@ -628,7 +605,10 @@ static int mlx5_eswitch_disable_passing_vport_metadata(struct mlx5_eswitch *esw) fdb_to_vport_reg_c_id = MLX5_GET(query_esw_vport_context_out, out, esw_vport_context.fdb_to_vport_reg_c_id); - fdb_to_vport_reg_c_id &= ~MLX5_FDB_TO_VPORT_REG_C_0; + if (enable) + fdb_to_vport_reg_c_id |= MLX5_FDB_TO_VPORT_REG_C_0; + else + fdb_to_vport_reg_c_id &= ~MLX5_FDB_TO_VPORT_REG_C_0; MLX5_SET(modify_esw_vport_context_in, in, esw_vport_context.fdb_to_vport_reg_c_id, fdb_to_vport_reg_c_id); @@ -2138,11 +2118,9 @@ int esw_offloads_init(struct mlx5_eswitch *esw) if (err) return err; - if (mlx5_eswitch_vport_match_metadata_enabled(esw)) { - err = mlx5_eswitch_enable_passing_vport_metadata(esw); - if (err) - goto err_vport_metadata; - } + err = esw_set_passing_vport_metadata(esw, true); + if (err) + goto err_vport_metadata; err = esw_offloads_load_all_reps(esw); if (err) @@ -2156,8 +2134,7 @@ int esw_offloads_init(struct mlx5_eswitch *esw) return 0; err_reps: - if (mlx5_eswitch_vport_match_metadata_enabled(esw)) - mlx5_eswitch_disable_passing_vport_metadata(esw); + esw_set_passing_vport_metadata(esw, false); err_vport_metadata: esw_offloads_steering_cleanup(esw); return err; @@ -2187,8 +2164,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw) mlx5_rdma_disable_roce(esw->dev); esw_offloads_devcom_cleanup(esw); esw_offloads_unload_all_reps(esw); - if (mlx5_eswitch_vport_match_metadata_enabled(esw)) - mlx5_eswitch_disable_passing_vport_metadata(esw); + esw_set_passing_vport_metadata(esw, false); esw_offloads_steering_cleanup(esw); esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; } From patchwork Mon Jul 29 21:13:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5947B112C for ; Mon, 29 Jul 2019 21:13:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46121285F2 for ; Mon, 29 Jul 2019 21:13:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A9B928758; Mon, 29 Jul 2019 21:13:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDB74285F2 for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388502AbfG2VNX (ORCPT ); Mon, 29 Jul 2019 17:13:23 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388472AbfG2VNX (ORCPT ); Mon, 29 Jul 2019 17:13:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5FnfSiZycjAaG0qFVscSP9B2vp/j+xUCuTzlKL661a7Xrub+2XzehXAm4dO7i7B70BjNGbf+ru8dTv36jtbpBa85VbIVx+GoLVl6JO2yH6LpczqiMugU0+U0hUp8SEgCbA9SHdMUyjIN/Wr4aacDskFbPKV9N0jkAFrwxxRCS2L2VXoE4DzhAt6+70nA3skwY2YQHOXmhj+pJq/W1apAOGstr/4HSkfcHjXaDC4b725Q0dQxtoZ87R4F0XyDDgplTdG9U6GDj09p5xBOlQf+AHJ+43sA44Yef79UCpfOARNHBAZpEvq99p5doKbB8NZdaqrA4yRO+mP7aSKhcNrOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I3cb+p0cbBhNE2HiO9qUVufeIq2ORh3A5ksuPEW8Tgs=; b=SyfZK98zzRT6S5e/KpEwGbyRltrN03ICM6/ecxlqTCRIf+Xk30FhrYx0dqKe7LbljPs2GlX1+QMTb6DgRUupFIgZU8Gu67qUB3mczkhJafAP2QHshNe7PSP4RJxCJd++oM0XREigrxbgsBEYajxIne7CnPYc6b8FVC4nV9Mz54NhFBt6pPrbU6+UucyHFFFK6AvvWKabm/9REQft3SqOqJ+UqG4D+tJ+jiRfM0JwKFefhNPX6keDkXkPkALX4JTj5spLzqKg6Swi8o+W4yWZ+FgQ1Q9hD93DxT2zDRuinWG1SIL3S97EzCp9nadUBrWqOi7iRvDcRKyWW8FxZdnIeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I3cb+p0cbBhNE2HiO9qUVufeIq2ORh3A5ksuPEW8Tgs=; b=pwP77nAnuaD6axbvqsiIkS5/uYG31EHz71DCLFCdL6UCuYlZRQjqlIhLD6la4d2aoAh/TIbxmbUZ9Jh9cAxQVCkagjw2e8ECr5HeQnAQszCGNwjV4sGFQPTnyergDpCJ4Exd997ngfpkOF9IJx095J90jDxOHtbLqts2nEU37Vg= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:04 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:04 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 07/11] net/mlx5: E-switch, Initialize TSAR Qos hardware block before its user vports Thread-Topic: [PATCH mlx5-next 07/11] net/mlx5: E-switch, Initialize TSAR Qos hardware block before its user vports Thread-Index: AQHVRlJph95keMFpHE+RU8yZrj0QYQ== Date: Mon, 29 Jul 2019 21:13:04 +0000 Message-ID: <20190729211209.14772-8-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7d3dab05-4431-490e-59fd-08d714698b73 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: S/jL6n/2l4AK/lxdzTjeKxuV9+5MWxsk9kivSVPn8yAa8XcNsdsI/FjtgnzJPeByDjIOncDaGv/BMvaA/cFpIKa0k4/TzRJybh7rwM45K1GM58NdOJ1tK6Q73AdT20ZI1vcL3IZDtae46SBgvmkTo45xe3flUuP5XmLNNMiMFq++RSU8Pd25jTEYcLhT5Ww1ZxNwT0/ia+JmVyKc2puc/A3cM22pKfACr8o9Zc4Va+oqJ6RFKK9I9yXospPfrcuFo3Ch4x23Z+KykGTE8CyNUlT1jqYwZaPqF+UCLg/hd7gNg0S6hacZBG8YazsY8dq7/GswK2//hG66WtRS+aMKS2Lug6W+13GS9d6x5a3R5H9XwSGkdoCkRoNupEZd0/Ho+S0bO9+otKJPaD+jAAC0S1+euh8wG3hnm4RoPJNb2Ro= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d3dab05-4431-490e-59fd-08d714698b73 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:04.3067 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit First enable TSAR Qos hardware block in device before enabling its user vports. This refactor is needed so that vports can be enabled before their representor netdevice can be created. While at it, esw_create_tsar() returns error code which was used only to print error. However esw_create_tsar() already prints warning if it hits an error. Hence, remove the redundant warning. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 2927fa1da92f..820970911f8b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1415,7 +1415,7 @@ static bool element_type_supported(struct mlx5_eswitch *esw, int type) } /* Vport QoS management */ -static int esw_create_tsar(struct mlx5_eswitch *esw) +static void esw_create_tsar(struct mlx5_eswitch *esw) { u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; struct mlx5_core_dev *dev = esw->dev; @@ -1423,13 +1423,13 @@ static int esw_create_tsar(struct mlx5_eswitch *esw) int err; if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) - return 0; + return; if (!element_type_supported(esw, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR)) - return 0; + return; if (esw->qos.enabled) - return -EEXIST; + return; MLX5_SET(scheduling_context, tsar_ctx, element_type, SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); @@ -1443,11 +1443,10 @@ static int esw_create_tsar(struct mlx5_eswitch *esw) &esw->qos.root_tsar_id); if (err) { esw_warn(esw->dev, "E-Switch create TSAR failed (%d)\n", err); - return err; + return; } esw->qos.enabled = true; - return 0; } static void esw_destroy_tsar(struct mlx5_eswitch *esw) @@ -1819,6 +1818,8 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) if (!MLX5_CAP_ESW_EGRESS_ACL(esw->dev, ft_support)) esw_warn(esw->dev, "engress ACL is not supported by FW\n"); + esw_create_tsar(esw); + esw->mode = mode; mlx5_lag_update(esw->dev); @@ -1836,10 +1837,6 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) if (err) goto abort; - err = esw_create_tsar(esw); - if (err) - esw_warn(esw->dev, "Failed to create eswitch TSAR"); - enabled_events = (mode == MLX5_ESWITCH_LEGACY) ? SRIOV_VPORT_EVENTS : UC_ADDR_CHANGE; @@ -1899,13 +1896,13 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) if (mc_promisc && mc_promisc->uplink_rule) mlx5_del_flow_rules(mc_promisc->uplink_rule); - esw_destroy_tsar(esw); - if (esw->mode == MLX5_ESWITCH_LEGACY) esw_destroy_legacy_table(esw); else if (esw->mode == MLX5_ESWITCH_OFFLOADS) esw_offloads_cleanup(esw); + esw_destroy_tsar(esw); + old_mode = esw->mode; esw->mode = MLX5_ESWITCH_NONE; From patchwork Mon Jul 29 21:13:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F15C0112C for ; Mon, 29 Jul 2019 21:13:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0995285F2 for ; Mon, 29 Jul 2019 21:13:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4FF42875E; Mon, 29 Jul 2019 21:13:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DCEB285F2 for ; Mon, 29 Jul 2019 21:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388519AbfG2VN0 (ORCPT ); Mon, 29 Jul 2019 17:13:26 -0400 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:5933 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387803AbfG2VNX (ORCPT ); Mon, 29 Jul 2019 17:13:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEeIvkCwotGVTY46i6nnk+Oua9DbMGuzVelzbJ3OS5Lzh+TAFgC52ICv+oPYhy7sf/WNxa+5/r1AW9My8KgxfWC/XiAvtZWKPOVbQryT1GKPhki2uvWYEc59RADYQ+6u3CtFHYCa6amhAJbOvb47rIYLvhdySaC4Ek2VXsjN4Jze32sG3mJ5oGPAsa0iWkKBGhnL31YHFcYHU2pYXFL1t+Xceqtg5A13lpx/61Tf+FC0yXQd6ndGLAsN6fuCpkaZKXWAveotwdBZS+9TUl3BHPU6V6Lh4VY77wGYHlbqC+AGLkWdUWRLZh0zNxQqLBrOBamW7NaMws7/xpzUeB84qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NinPoY+SXXEqP9gQPOBYP+CDho9tnXtTrNYR/ULuqgk=; b=hkUNgOoO6tjDeAz0lR9FqTGxAVsDTH6pxRp3JwvKirlNRt20OjR6J/NvSW9nbEM/yDwQun3FH8mU0BFWenvnqepcryGurk3qfRZLwmdVT7p1vU4B7I2dv+F0rhXRmbj86F5voDnceLs4oeUuGz+frFeKvu/SzDZJTB/FK2Z/iSHcdH20O2mn5m0Nd4Q+OtO9UUoSzlhXsFP4XxYtbPjl2AbhbQyayo3LeVqEAe/v8ue8l//LCiIK60ppMTXlcm1dBepH3Un+yJLDhP7behZB/uWgqkLpVmT0Sl5fyl+Nzo/X0xefwmo5ECvZuSYM20/vbte5YQVDBZn1XnvHE7ILxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NinPoY+SXXEqP9gQPOBYP+CDho9tnXtTrNYR/ULuqgk=; b=LUAbrF5e7aVRPbiUNJ8jsSHGBamIKgl9Fit69kyg2UumyZtF6BNbmVL7PlbskeRkc16G/033QOkcI90m/vuyv68GdM7rHBSENzdHf1jPjuVhV93rtIxuTji2VWl5uleCYyTjlhtAhcYUgw1TOOjJikfeXbqrmpPJKfmYHWATw0E= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:06 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:06 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 08/11] net/mlx5: E-switch, Introduce helper function to enable/disable vports Thread-Topic: [PATCH mlx5-next 08/11] net/mlx5: E-switch, Introduce helper function to enable/disable vports Thread-Index: AQHVRlJqdF5X4qzm0EmW0Bkkm5dRvw== Date: Mon, 29 Jul 2019 21:13:06 +0000 Message-ID: <20190729211209.14772-9-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b99e3700-1629-4d6f-08fd-08d714698ca1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(5024004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9q5tHYMT96DgTVZXXfSwfaOsMf696OWKgQ9onaYMHMtzEDnKgWydIGya5sKDtqwlfiuG6aqQsktyGKO0ruSApDqVp8cNzWXd6gARG0S/2m6x874D+Z6BWfjr+vqJXVtasl9+RpFz/NvXq0CdDKWvlnJBBcGW4+kg54Hr68iz2pRMkIcCa3rciQZ49cIuuC4N3ZaQUKXYKowU+uTHhmYdEGcCdVXerWQP67aa3QR/gz25+Mb6Cw/iAaavU5Sd3zO4+hGWUj839E5Ezn7uQ7rirOJZKBrZwxv5rkPLS9Ainz6QjJNYq8FvrTNRI5sQy/DZGdSQ0gNoJw7CUGJPGt/NU9h9lZz4EI8yv4dcy6PwJtdDq9Fd/l2H9sJkzwfmMSq7B+DULvmwpHpwXxpdm7/ePPCdtM/uuZdA770TmqDTcLs= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b99e3700-1629-4d6f-08fd-08d714698ca1 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:06.1849 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit vports needs to be enabled in switchdev and legacy mode. In switchdev mode, vports should be enabled after initializing the FDB tables and before creating their represntors so that representor works on an initialized vport object. Prepare a helper function which can be called when enabling either of the eswitch modes. Similarly, have disable vports helper function. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 96 +++++++++++-------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 19 +++- 2 files changed, 73 insertions(+), 42 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 820970911f8b..6d82aefae6e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -58,20 +58,9 @@ struct vport_addr { bool mc_promisc; }; -enum { - UC_ADDR_CHANGE = BIT(0), - MC_ADDR_CHANGE = BIT(1), - PROMISC_CHANGE = BIT(3), -}; - static void esw_destroy_legacy_fdb_table(struct mlx5_eswitch *esw); static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw); -/* Vport context events */ -#define SRIOV_VPORT_EVENTS (UC_ADDR_CHANGE | \ - MC_ADDR_CHANGE | \ - PROMISC_CHANGE) - struct mlx5_vport *__must_check mlx5_eswitch_get_vport(struct mlx5_eswitch *esw, u16 vport_num) { @@ -108,13 +97,13 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport, MLX5_SET(nic_vport_context, nic_vport_ctx, arm_change_event, 1); - if (events_mask & UC_ADDR_CHANGE) + if (events_mask & MLX5_VPORT_UC_ADDR_CHANGE) MLX5_SET(nic_vport_context, nic_vport_ctx, event_on_uc_address_change, 1); - if (events_mask & MC_ADDR_CHANGE) + if (events_mask & MLX5_VPORT_MC_ADDR_CHANGE) MLX5_SET(nic_vport_context, nic_vport_ctx, event_on_mc_address_change, 1); - if (events_mask & PROMISC_CHANGE) + if (events_mask & MLX5_VPORT_PROMISC_CHANGE) MLX5_SET(nic_vport_context, nic_vport_ctx, event_on_promisc_change, 1); @@ -901,21 +890,21 @@ static void esw_vport_change_handle_locked(struct mlx5_vport *vport) esw_debug(dev, "vport[%d] Context Changed: perm mac: %pM\n", vport->vport, mac); - if (vport->enabled_events & UC_ADDR_CHANGE) { + if (vport->enabled_events & MLX5_VPORT_UC_ADDR_CHANGE) { esw_update_vport_addr_list(esw, vport, MLX5_NVPRT_LIST_TYPE_UC); esw_apply_vport_addr_list(esw, vport, MLX5_NVPRT_LIST_TYPE_UC); } - if (vport->enabled_events & MC_ADDR_CHANGE) + if (vport->enabled_events & MLX5_VPORT_MC_ADDR_CHANGE) esw_update_vport_addr_list(esw, vport, MLX5_NVPRT_LIST_TYPE_MC); - if (vport->enabled_events & PROMISC_CHANGE) { + if (vport->enabled_events & MLX5_VPORT_PROMISC_CHANGE) { esw_update_vport_rx_mode(esw, vport); if (!IS_ERR_OR_NULL(vport->allmulti_rule)) esw_update_vport_mc_promisc(esw, vport); } - if (vport->enabled_events & (PROMISC_CHANGE | MC_ADDR_CHANGE)) + if (vport->enabled_events & (MLX5_VPORT_PROMISC_CHANGE | MLX5_VPORT_MC_ADDR_CHANGE)) esw_apply_vport_addr_list(esw, vport, MLX5_NVPRT_LIST_TYPE_MC); esw_debug(esw->dev, "vport[%d] Context Changed: Done\n", vport->vport); @@ -1649,7 +1638,7 @@ static void esw_vport_destroy_drop_counters(struct mlx5_vport *vport) } static void esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport, - int enable_events) + enum mlx5_eswitch_vport_event enabled_events) { u16 vport_num = vport->vport; @@ -1671,7 +1660,7 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport, esw_warn(esw->dev, "Failed to attach vport %d to eswitch rate limiter", vport_num); /* Sync with current vport context */ - vport->enabled_events = enable_events; + vport->enabled_events = enabled_events; vport->enabled = true; /* Esw manager is trusted by default. Host PF (vport 0) is trusted as well @@ -1800,11 +1789,51 @@ static void mlx5_eswitch_event_handlers_unregister(struct mlx5_eswitch *esw) /* Public E-Switch API */ #define ESW_ALLOWED(esw) ((esw) && MLX5_ESWITCH_MANAGER((esw)->dev)) -int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) +/* mlx5_eswitch_enable_pf_vf_vports() enables vports of PF, ECPF and VFs + * whichever are present on the eswitch. + */ +void +mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw, + enum mlx5_eswitch_vport_event enabled_events) +{ + struct mlx5_vport *vport; + int i; + + /* Enable PF vport */ + vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_PF); + esw_enable_vport(esw, vport, enabled_events); + + /* Enable ECPF vports */ + if (mlx5_ecpf_vport_exists(esw->dev)) { + vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_ECPF); + esw_enable_vport(esw, vport, enabled_events); + } + + /* Enable VF vports */ + mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) + esw_enable_vport(esw, vport, enabled_events); +} + +/* mlx5_eswitch_disable_pf_vf_vports() disables vports of PF, ECPF and VFs + * whichever are previously enabled on the eswitch. + */ +void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw) { struct mlx5_vport *vport; + int i; + + mlx5_esw_for_all_vports_reverse(esw, i, vport) + esw_disable_vport(esw, vport); +} + +#define MLX5_LEGACY_SRIOV_VPORT_EVENTS (MLX5_VPORT_UC_ADDR_CHANGE | \ + MLX5_VPORT_MC_ADDR_CHANGE | \ + MLX5_VPORT_PROMISC_CHANGE) + +int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) +{ + int enabled_events; int err; - int i, enabled_events; if (!ESW_ALLOWED(esw) || !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ft_support)) { @@ -1837,22 +1866,10 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) if (err) goto abort; - enabled_events = (mode == MLX5_ESWITCH_LEGACY) ? SRIOV_VPORT_EVENTS : - UC_ADDR_CHANGE; + enabled_events = (mode == MLX5_ESWITCH_LEGACY) ? MLX5_LEGACY_SRIOV_VPORT_EVENTS : + MLX5_VPORT_UC_ADDR_CHANGE; - /* Enable PF vport */ - vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_PF); - esw_enable_vport(esw, vport, enabled_events); - - /* Enable ECPF vports */ - if (mlx5_ecpf_vport_exists(esw->dev)) { - vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_ECPF); - esw_enable_vport(esw, vport, enabled_events); - } - - /* Enable VF vports */ - mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) - esw_enable_vport(esw, vport, enabled_events); + mlx5_eswitch_enable_pf_vf_vports(esw, enabled_events); mlx5_eswitch_event_handlers_register(esw); @@ -1876,9 +1893,7 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) void mlx5_eswitch_disable(struct mlx5_eswitch *esw) { struct esw_mc_addr *mc_promisc; - struct mlx5_vport *vport; int old_mode; - int i; if (!ESW_ALLOWED(esw) || esw->mode == MLX5_ESWITCH_NONE) return; @@ -1890,8 +1905,7 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) mc_promisc = &esw->mc_promisc; mlx5_eswitch_event_handlers_unregister(esw); - mlx5_esw_for_all_vports(esw, i, vport) - esw_disable_vport(esw, vport); + mlx5_eswitch_disable_pf_vf_vports(esw); if (mc_promisc && mc_promisc->uplink_rule) mlx5_del_flow_rules(mc_promisc->uplink_rule); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index a38e8a3c7c9a..3103a34c619c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -101,6 +101,13 @@ struct mlx5_vport_info { bool trusted; }; +/* Vport context events */ +enum mlx5_eswitch_vport_event { + MLX5_VPORT_UC_ADDR_CHANGE = BIT(0), + MLX5_VPORT_MC_ADDR_CHANGE = BIT(1), + MLX5_VPORT_PROMISC_CHANGE = BIT(3), +}; + struct mlx5_vport { struct mlx5_core_dev *dev; int vport; @@ -122,7 +129,7 @@ struct mlx5_vport { } qos; bool enabled; - u16 enabled_events; + enum mlx5_eswitch_vport_event enabled_events; }; enum offloads_fdb_flags { @@ -513,6 +520,11 @@ void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw); (vport) = &(esw)->vports[i], \ (i) < (esw)->total_vports; (i)++) +#define mlx5_esw_for_all_vports_reverse(esw, i, vport) \ + for ((i) = (esw)->total_vports - 1; \ + (vport) = &(esw)->vports[i], \ + (i) >= MLX5_VPORT_PF; (i)--) + #define mlx5_esw_for_each_vf_vport(esw, i, vport, nvfs) \ for ((i) = MLX5_VPORT_FIRST_VF; \ (vport) = &(esw)->vports[(i)], \ @@ -574,6 +586,11 @@ bool mlx5_eswitch_is_vf_vport(const struct mlx5_eswitch *esw, u16 vport_num); void mlx5_eswitch_update_num_of_vfs(struct mlx5_eswitch *esw, const int num_vfs); int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type, void *data); +void +mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw, + enum mlx5_eswitch_vport_event enabled_events); +void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw); + #else /* CONFIG_MLX5_ESWITCH */ /* eswitch API stubs */ static inline int mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; } From patchwork Mon Jul 29 21:13:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A06B31823 for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 933D0285F2 for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 879F128758; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ABD52874C for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388523AbfG2VN0 (ORCPT ); Mon, 29 Jul 2019 17:13:26 -0400 Received: from mail-eopbgr10054.outbound.protection.outlook.com ([40.107.1.54]:2445 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388459AbfG2VNZ (ORCPT ); Mon, 29 Jul 2019 17:13:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cg0KwjrRBhNGPsHPvTBE9yvN2vgxxb6vNwLBDJyhAfvOQXb3wL1pP+8WZ20mms53N9+BI6sqbSxCa69siLCgVyqFo44VVSA3qk7ibaY3TayTpaUXjhLZO2i+ZtzVmDM45+0wYXjU8BNTDNIHrt+6nfQX4IOB+GvF0LWFNgzIJmzN7x3R6jrxzB2vPLu5nPVNGMiAW/yLeq4tySk4+hUPSt4sc7RyAyFa+cyKkKc3ys0al5zqYu0sFflze57lNWfVimGsUVskKw8U4ZIESk4HmVUVH1IEn0XCpQIFSAwKBxDuMt8Qi20htC2becSwMgAUcs+ZeW/KE947tzlFIuKyrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J0i5aejQlheFphj2M+F0pcIc0C5Cn833NpesqFdDiR0=; b=d+A9Riv0I1L9SofgyCKUgFtd9HFG5vo0c7qwKykx23RBPhVHkRSHYPczF+xTRlyV5+55W38/BoXHl1dYQdZ7IClh6TF7aZ78bBtmj5jiko84oARDM4cms4crgwDq9v9GOUvJnanukW6JRm0Q1as4SwOw7FrflwB9fOPNXTC7X+XWkD7aokSqBclC8MDTLKRnhazRFISzPeiGHVl4kUvd7o1wcpiK1voJjcrsDooIwdtqDAB8A+0lDjh50ldM2Db3q+sDxoeDfUNjSTDkJEp/MazKgRaiyMOCWGy3yPpR1WZ6U+rkwal+DmD5C9TIrk+rfwHPcGxVYUtla6zeQjSl/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J0i5aejQlheFphj2M+F0pcIc0C5Cn833NpesqFdDiR0=; b=Qh000N4zuq/gpiWRxg9FRdWSIQDL1vGElbQNaDJfape7aZsILt3rmPlqQEuMF2KRa16VDPLFzS3ObsNpsQ+CYH9cqea9fcohltGiIwGxuDeI0RTa2zooIi58gIQGlcp0iNY9KBRh5aHqRTiGwkxoBDOqkkialQ70iCrbptdPBmw= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:08 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:08 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Roi Dayan Subject: [PATCH mlx5-next 09/11] net/mlx5: E-Switch, remove redundant error handling Thread-Topic: [PATCH mlx5-next 09/11] net/mlx5: E-Switch, remove redundant error handling Thread-Index: AQHVRlJr9MeQVxMrKkqK89Z/73ncQQ== Date: Mon, 29 Jul 2019 21:13:08 +0000 Message-ID: <20190729211209.14772-10-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: df21c283-c229-42b0-24a4-08d714698dca x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(4744005)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9lMJhpJWtZmIuajtc0QNBGLz4HcddiXg7D4M1JKP3+SmJAk28+xjV1AnL/cZ2BHUAr0W/+d+qxqm822t4FoaU1PrX5XlVYJ9IXBVkhrc1jbd6+5MCCjJtBpq7rzIKZmp4CWhNmKvyXf6Qfdr7Rp8d483iE/+SvOnDu3MSxIx/WHlN+zvHm73ZqELHtc1Yn6ySxuU68Mo2a+jQSaqsE294wWFGTwY9UzKt4QgYX854qe70IpCAoqO64057g2LTNODf+O1sgNLBNZo5fcFr4NQf0k/AcO02yk5z9tW04in6O6LzM4WrIn7mbKxeDrVYRJEUyCPAvMZX9MI1EvVmgvmbclomwKh3rcRhFM0CzZAgYTxEVCs1qEBZDc3rmbhqI14I/qA7h4v7zzjIrMpVYvjtHqgZKZwZk+jrhzf8pJ+IBg= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: df21c283-c229-42b0-24a4-08d714698dca X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:08.2529 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We don't need to handle error flow of esw_create_legacy_table() in the same branch, it is already being handled directly after the if statement, for both legacy and switchdev modes in one place. Signed-off-by: Saeed Mahameed Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 6d82aefae6e1..17fb982b3489 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1855,8 +1855,6 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) if (mode == MLX5_ESWITCH_LEGACY) { err = esw_create_legacy_table(esw); - if (err) - goto abort; } else { mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); From patchwork Mon Jul 29 21:13:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 402941823 for ; Mon, 29 Jul 2019 21:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 330FA285F2 for ; Mon, 29 Jul 2019 21:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276BA2874C; Mon, 29 Jul 2019 21:13:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFAB128758 for ; Mon, 29 Jul 2019 21:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388533AbfG2VN0 (ORCPT ); Mon, 29 Jul 2019 17:13:26 -0400 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:5933 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388516AbfG2VNZ (ORCPT ); Mon, 29 Jul 2019 17:13:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iVU1eeSSb6wHlpzarLaY5/oUphekP/NcI+X5evsr76hR0Qu0GU2VdT3rwjA/WKRLhwfgO+8urMyDGgMBZZV64Gvq3PCiCQiS92hMkr/o9AcB838bELivMGN7rfox5/SbYtOIllbGahzifNeIsKz5KlprN9KBIl0FGEYd6w4oxH3gRqozw2XR8v/kRre2w4g35o1saJng7eJU92fem5vl4HCoERD62LCVpW5+Tn2pWEzWxrudWfC5U0QFgEsTqMXhEGBFBg4lmnpNO3F/5IMu9jooD8HkOMfyRIWD/ADjTNNINFS0MWq00Gkb01St+3Bol61X0Lcf7MkC9bVGCpQkBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qmvxowdFsHXTPJLou6VQ5AzCi2qFquy/aEsxLenIPw4=; b=TrYqUfpDsn08r6iV8cLD1qoOEiTXHcratqILUFcToBCVvf1KqsprrAfqMxjnHfFmhDmBeZKQsNxMTY6rfA/xH2lFOe835FColAWwuz2HPtE21es6keWViU5w9rd2dFwrC2KCYMkhWRJ4OjwCaaMiGyKQdVEC1GSLdS+Uec4JQW8hQSq+Awn+jQcWEI2x8V4S147BSoE7lntuaV7slpTQKdHXfn5igStNw+5+ysHhGbCToiRySB0+c1JBTuU+AypRKeoX/9rn2FYQyUbj/u0m7QYCfvcHtExTp+c1iH5F65rj1JU7DnR9EfkHw5GHPUZdQCyuq2xSPT8so9JCrx9QBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qmvxowdFsHXTPJLou6VQ5AzCi2qFquy/aEsxLenIPw4=; b=rOWxpdyjJ2cf2prkXzIp7xQeiSxGIL1uS1skSklaEnKtcIPVF6sDjuiIP9iVu6nnb0jpviFidyhz6wWJd3JfzF2znvOGLYNQ/qKTrSx2eqRwnNSujmJ9cuLIpGYolaeSRSRK1GI0mqKkISr4qSVsXjyFXInSYBzhE+889GwUj/Y= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:10 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:10 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 10/11] net/mlx5: E-Switch, Remove redundant mc_promisc NULL check Thread-Topic: [PATCH mlx5-next 10/11] net/mlx5: E-Switch, Remove redundant mc_promisc NULL check Thread-Index: AQHVRlJsEOiWNpMm00mWvxla2CilQg== Date: Mon, 29 Jul 2019 21:13:10 +0000 Message-ID: <20190729211209.14772-11-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1be83d54-88d2-4fa0-9c05-08d714698ee4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1850; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6KK5iIuDkrBJPqfleTDmVKozj/9LgdsC9q8V3AvkPP4M077WY3LTS7UUjo5adj5huY9wManofuv9e+t2nx9eZB8CVwCffn1+xw/6r6iw9Ku9YvLR4J5iwZYl7+qr52LmTpt2DmTy/vjMA9TnSf3ePghOQFFmrs57zeJ+T4Xshsi9ShEOe8PYPC+eOgLYp+J+0h2bkTADV/RusYVvQtpcrebnl+e+GTJz4bQxNqqr2Bd+zKKkpDoSRemXpFQN2rmtYeZdyv+/ireUCGDNQUd94UrB2awBaaAJFipVpnJ7SiS9MOLuBFMEfHitnLxNDT6V1/mAO+W/8I7f0DV0qt2ryyz6gkFpdkUb7yufEPsmRFwB4XISkdjnEhkfCkQkFor9QEcSF22OOyjAr7niAdWlZI9zrjOKAW80uNZ+HoNt9BU= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1be83d54-88d2-4fa0-9c05-08d714698ee4 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:10.0541 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit mc_promisc pointer points to an instance of struct esw_mc_addr allocated as part of the esw structure. Hence it cannot be NULL. Removed such redundant check and assign where it is actually used. While at it, add comment around legacy mode fields and move mc_promisc close to other legacy mode structures to improve code redability. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 17fb982b3489..90d150be237b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1900,12 +1900,12 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) esw->mode == MLX5_ESWITCH_LEGACY ? "LEGACY" : "OFFLOADS", esw->esw_funcs.num_vfs, esw->enabled_vports); - mc_promisc = &esw->mc_promisc; mlx5_eswitch_event_handlers_unregister(esw); mlx5_eswitch_disable_pf_vf_vports(esw); - if (mc_promisc && mc_promisc->uplink_rule) + mc_promisc = &esw->mc_promisc; + if (mc_promisc->uplink_rule) mlx5_del_flow_rules(mc_promisc->uplink_rule); if (esw->mode == MLX5_ESWITCH_LEGACY) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 3103a34c619c..51b6d29466f1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -214,8 +214,11 @@ enum { struct mlx5_eswitch { struct mlx5_core_dev *dev; struct mlx5_nb nb; + /* legacy data structures */ struct mlx5_eswitch_fdb fdb_table; struct hlist_head mc_table[MLX5_L2_ADDR_HASH_SIZE]; + struct esw_mc_addr mc_promisc; + /* end of legacy */ struct workqueue_struct *work_queue; struct mlx5_vport *vports; u32 flags; @@ -225,7 +228,6 @@ struct mlx5_eswitch { * and async SRIOV admin state changes */ struct mutex state_lock; - struct esw_mc_addr mc_promisc; struct { bool enabled; From patchwork Mon Jul 29 21:13:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11064561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EEDC912 for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 615A7285F2 for ; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 551D52875E; Mon, 29 Jul 2019 21:13:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE91D285F2 for ; Mon, 29 Jul 2019 21:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388516AbfG2VNa (ORCPT ); Mon, 29 Jul 2019 17:13:30 -0400 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:5933 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388520AbfG2VN2 (ORCPT ); Mon, 29 Jul 2019 17:13:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjWvj/4iCb3X1dnn8Owvo7IxKnw5TVCjPh4n1nX8JVHyOfccqA5pY8d4xpv8p0xqm8i37d/CTEAkN9k8ek+O6yKo794yXn0bncmt+QQnwVJ1cOEwYb1V3APGoytbBYEiZLn0jXjakNwgTcNDYODy4YPSG2f9C6HbaB1fbEqKxQWF77VqeQvMuo897uM4KMTtQG0eZ9foMlVO68aXbxO+OwNRcAmLEuwXnif+pg848tUaeak0aIay3GaczWt3st6HKQ3WG9mx6ucwfW+mZcrCGT8wB+RGr78eYoBlpydzsvx+SppI8e6bZq9WBd9iGcW0kJjaq9G2FR0HU+yf3IGqww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O3XfJjMTtTWrmDCXodkJamhpKVr3/P0U0gbbV2YT8yc=; b=Y7NCFnerR+dvoebFzq8usKiD5Y21znhULkM8TRC8GXSCuxgBOZDL1pFNF5PTPvDqbomcaW9U++4SNybKZOVZMCIk1JILific/GA2tNtxmPbuQ99hYZWBrns1rDJ2rIccVRcI7tlOlymtgL1zUrUHUstUdvjfh8UL1QDAakp3pwLfKJseSzbwycY1X/884jYWzXpPLH8MiJlXDZzjo68gh2b1VWWM1CzxCEeiEnFLL9+FxXg7s2+r5xqSjH89hNE+8Rf7ArXJIvAlBG7u2T11zYG6bazq/zY7ZjAnkf26im/7H/TSLA7/vFrr3phEZg2Yst2Frk6JQNR3iY0csFTNKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O3XfJjMTtTWrmDCXodkJamhpKVr3/P0U0gbbV2YT8yc=; b=aE+RRjg+wJyuXZU2k0M1sUY/QxMtPMK0DBfM+F8gJpbBjnpy6M3Qnk6MpqNn/qdah9WnhHSonpaPX9haGsWhufuEZZYXU9QN0EFEQyKS6Rhl66ws9mQpWc9xZZ0HPNlQuyySXWR3QsgWlw/u9azupzLTEWmlN4cxrPX+mAiYdto= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2375.eurprd05.prod.outlook.com (10.168.72.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Mon, 29 Jul 2019 21:13:12 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::3c28:c77d:55b0:15b2%5]) with mapi id 15.20.2115.005; Mon, 29 Jul 2019 21:13:12 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" CC: Parav Pandit Subject: [PATCH mlx5-next 11/11] net/mlx5: E-switch, Tide up eswitch config sequence Thread-Topic: [PATCH mlx5-next 11/11] net/mlx5: E-switch, Tide up eswitch config sequence Thread-Index: AQHVRlJtLvlb9aQ/DkWqervHwap/nw== Date: Mon, 29 Jul 2019 21:13:12 +0000 Message-ID: <20190729211209.14772-12-saeedm@mellanox.com> References: <20190729211209.14772-1-saeedm@mellanox.com> In-Reply-To: <20190729211209.14772-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4c69e7e6-2da2-4e1d-c89e-08d714699017 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2375; x-ms-traffictypediagnostic: DB6PR0501MB2375: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 01136D2D90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(199004)(189003)(50226002)(14444005)(5660300002)(6116002)(3846002)(486006)(446003)(86362001)(81156014)(186003)(36756003)(81166006)(8936002)(26005)(25786009)(316002)(71190400001)(71200400001)(110136005)(64756008)(76176011)(66556008)(2906002)(66946007)(66446008)(99286004)(66476007)(1076003)(386003)(6506007)(102836004)(256004)(7736002)(6486002)(14454004)(66066001)(2501003)(8676002)(305945005)(6436002)(4326008)(11346002)(68736007)(52116002)(2616005)(476003)(478600001)(6512007)(450100002)(2201001)(107886003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2375;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: cXbbsKeX9ZoRjxdMFwanknqawjj4zuYx1wm6SGuxBcDLJiFtZ7CI7UE6bYmEzruZpwvgSfmsm3T07+bwVTbo5grFZaMDTTcQQ29pJBHOKiEbpU2O4qS4jdI8lSn5Jtk/ryp8aV4P0BWrvPagvALWSe5/ix7SxbfSBPSyJsRClEjguRAu3babFNooQ/iH1X7cGnhVNTrNHAf7MvyZsTYgyjzSkYNeSK33bVg20moFnuxN/EG4zyGsHsImnnDLiMo/hmnGoB2BBCbzAOQVLuxOjMrbOM1swxBzu792QJKrXX2ZMqAVbLqFrlBiEha+DW2hVdvsTpwflnl7rq84feTjULj4kdCpV5x182Mdudkth2Ko77PMS1vl9DR83h7/tvx4IoPbgLYCnLWVkpmCknxPj0gMmHFjWRPmuzwywnPgvVw= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c69e7e6-2da2-4e1d-c89e-08d714699017 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2019 21:13:12.0712 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2375 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parav Pandit Currently for PF and ECPF vports, representors are created before their eswitch hardware ports are initialized in below flow. mlx5_eswitch_enable() esw_offloads_init() esw_offloads_load_all_reps() [..] esw_enable_vport() However for VFs, vports are initialized before creating their respective netdev represnetors in event handling context. Similarly while disabling eswitch, first hardware vports are disabled, followed by destroying their representors. Here while underlying vports gets destroyed but its respective user facing netdevice can still exist on which user can continue to perform more offload operations. Instead, its more accurate to do enable_eswitch switchdev mode: 1. perform FDB tables initialization 2. initialize hw vport 3. create and publish representor for this vport disable_eswitch switchdev mode: 1. destroy user facing representor for the vport 2. disable hw vport 3. perform FDB tables cleanup Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 54 +++++++++++-------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 4 +- .../mellanox/mlx5/core/eswitch_offloads.c | 8 ++- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 90d150be237b..d4465dd18c11 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -452,6 +452,22 @@ static int esw_create_legacy_table(struct mlx5_eswitch *esw) return err; } +#define MLX5_LEGACY_SRIOV_VPORT_EVENTS (MLX5_VPORT_UC_ADDR_CHANGE | \ + MLX5_VPORT_MC_ADDR_CHANGE | \ + MLX5_VPORT_PROMISC_CHANGE) + +static int esw_legacy_enable(struct mlx5_eswitch *esw) +{ + int ret; + + ret = esw_create_legacy_table(esw); + if (ret) + return ret; + + mlx5_eswitch_enable_pf_vf_vports(esw, MLX5_LEGACY_SRIOV_VPORT_EVENTS); + return 0; +} + static void esw_destroy_legacy_table(struct mlx5_eswitch *esw) { esw_cleanup_vepa_rules(esw); @@ -459,6 +475,19 @@ static void esw_destroy_legacy_table(struct mlx5_eswitch *esw) esw_destroy_legacy_vepa_table(esw); } +static void esw_legacy_disable(struct mlx5_eswitch *esw) +{ + struct esw_mc_addr *mc_promisc; + + mlx5_eswitch_disable_pf_vf_vports(esw); + + mc_promisc = &esw->mc_promisc; + if (mc_promisc->uplink_rule) + mlx5_del_flow_rules(mc_promisc->uplink_rule); + + esw_destroy_legacy_table(esw); +} + /* E-Switch vport UC/MC lists management */ typedef int (*vport_addr_action)(struct mlx5_eswitch *esw, struct vport_addr *vaddr); @@ -1826,13 +1855,8 @@ void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw) esw_disable_vport(esw, vport); } -#define MLX5_LEGACY_SRIOV_VPORT_EVENTS (MLX5_VPORT_UC_ADDR_CHANGE | \ - MLX5_VPORT_MC_ADDR_CHANGE | \ - MLX5_VPORT_PROMISC_CHANGE) - int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) { - int enabled_events; int err; if (!ESW_ALLOWED(esw) || @@ -1854,21 +1878,16 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) mlx5_lag_update(esw->dev); if (mode == MLX5_ESWITCH_LEGACY) { - err = esw_create_legacy_table(esw); + err = esw_legacy_enable(esw); } else { mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); - err = esw_offloads_init(esw); + err = esw_offloads_enable(esw); } if (err) goto abort; - enabled_events = (mode == MLX5_ESWITCH_LEGACY) ? MLX5_LEGACY_SRIOV_VPORT_EVENTS : - MLX5_VPORT_UC_ADDR_CHANGE; - - mlx5_eswitch_enable_pf_vf_vports(esw, enabled_events); - mlx5_eswitch_event_handlers_register(esw); esw_info(esw->dev, "Enable: mode(%s), nvfs(%d), active vports(%d)\n", @@ -1890,7 +1909,6 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode) void mlx5_eswitch_disable(struct mlx5_eswitch *esw) { - struct esw_mc_addr *mc_promisc; int old_mode; if (!ESW_ALLOWED(esw) || esw->mode == MLX5_ESWITCH_NONE) @@ -1902,16 +1920,10 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) mlx5_eswitch_event_handlers_unregister(esw); - mlx5_eswitch_disable_pf_vf_vports(esw); - - mc_promisc = &esw->mc_promisc; - if (mc_promisc->uplink_rule) - mlx5_del_flow_rules(mc_promisc->uplink_rule); - if (esw->mode == MLX5_ESWITCH_LEGACY) - esw_destroy_legacy_table(esw); + esw_legacy_disable(esw); else if (esw->mode == MLX5_ESWITCH_OFFLOADS) - esw_offloads_cleanup(esw); + esw_offloads_disable(esw); esw_destroy_tsar(esw); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 51b6d29466f1..d447e1e44d59 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -242,8 +242,8 @@ struct mlx5_eswitch { struct mlx5_esw_functions esw_funcs; }; -void esw_offloads_cleanup(struct mlx5_eswitch *esw); -int esw_offloads_init(struct mlx5_eswitch *esw); +void esw_offloads_disable(struct mlx5_eswitch *esw); +int esw_offloads_enable(struct mlx5_eswitch *esw); void esw_offloads_cleanup_reps(struct mlx5_eswitch *esw); int esw_offloads_init_reps(struct mlx5_eswitch *esw); void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 4be19890f725..db01b8ee9385 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2104,7 +2104,7 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type return NOTIFY_OK; } -int esw_offloads_init(struct mlx5_eswitch *esw) +int esw_offloads_enable(struct mlx5_eswitch *esw) { int err; @@ -2122,6 +2122,8 @@ int esw_offloads_init(struct mlx5_eswitch *esw) if (err) goto err_vport_metadata; + mlx5_eswitch_enable_pf_vf_vports(esw, MLX5_VPORT_UC_ADDR_CHANGE); + err = esw_offloads_load_all_reps(esw); if (err) goto err_reps; @@ -2134,6 +2136,7 @@ int esw_offloads_init(struct mlx5_eswitch *esw) return 0; err_reps: + mlx5_eswitch_disable_pf_vf_vports(esw); esw_set_passing_vport_metadata(esw, false); err_vport_metadata: esw_offloads_steering_cleanup(esw); @@ -2159,11 +2162,12 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw, return err; } -void esw_offloads_cleanup(struct mlx5_eswitch *esw) +void esw_offloads_disable(struct mlx5_eswitch *esw) { mlx5_rdma_disable_roce(esw->dev); esw_offloads_devcom_cleanup(esw); esw_offloads_unload_all_reps(esw); + mlx5_eswitch_disable_pf_vf_vports(esw); esw_set_passing_vport_metadata(esw, false); esw_offloads_steering_cleanup(esw); esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;