{"id":809206,"url":"http://patchwork.ozlabs.org/api/1.2/patches/809206/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170903042117.28923-11-saeedm@mellanox.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170903042117.28923-11-saeedm@mellanox.com>","list_archive_url":null,"date":"2017-09-03T04:21:10","name":"[net-next,10/17] net/mlx5e: Non-atomic RQ state indicator for UMR WQE in progress","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"207001563692a918a31c64d19841bf92911c48bd","submitter":{"id":65299,"url":"http://patchwork.ozlabs.org/api/1.2/people/65299/?format=json","name":"Saeed Mahameed","email":"saeedm@mellanox.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170903042117.28923-11-saeedm@mellanox.com/mbox/","series":[{"id":1196,"url":"http://patchwork.ozlabs.org/api/1.2/series/1196/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1196","date":"2017-09-03T04:21:09","name":"[net-next,01/17] net/mlx5e: Reorganize struct mlx5e_rq","version":1,"mbox":"http://patchwork.ozlabs.org/series/1196/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809206/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809206/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlKbB1wQmz9s7C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun,  3 Sep 2017 14:23:02 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752130AbdICEW7 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 00:22:59 -0400","from mail-il-dmz.mellanox.com ([193.47.165.129]:60094 \"EHLO\n\tmellanox.co.il\" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1750858AbdICEWO (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 3 Sep 2017 00:22:14 -0400","from Internal Mail-Server by MTLPINE1 (envelope-from\n\tsaeedm@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 3 Sep 2017 07:22:06 +0300","from sws.mtl.labs.mlnx (reg-l-vrt-045-015.mtl.labs.mlnx\n\t[10.135.45.15])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v834M5lB017672;\n\tSun, 3 Sep 2017 07:22:06 +0300"],"From":"Saeed Mahameed <saeedm@mellanox.com>","To":"\"David S. Miller\" <davem@davemloft.net>","Cc":"netdev@vger.kernel.org, kernel-team@fb.com,\n\tTariq Toukan <tariqt@mellanox.com>, Saeed Mahameed <saeedm@mellanox.com>","Subject":"[net-next 10/17] net/mlx5e: Non-atomic RQ state indicator for UMR\n\tWQE in progress","Date":"Sun,  3 Sep 2017 07:21:10 +0300","Message-Id":"<20170903042117.28923-11-saeedm@mellanox.com>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170903042117.28923-1-saeedm@mellanox.com>","References":"<20170903042117.28923-1-saeedm@mellanox.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Tariq Toukan <tariqt@mellanox.com>\n\nThe indication for a UMR WQE in progress is needed only within\nthe NAPI context, and hence no races possible and no need for\nthe use of atomic operations.\nThe only place the flag is read outside of NAPI context is\nin closure flow, after RQ is disabled flag is no more accessed\nin NAPI.\nUse a boolean instead of a bit in ring state, so that its\nnon-atomic set operations do not race with the atomic sets of\nthe other bits.\n\nSigned-off-by: Tariq Toukan <tariqt@mellanox.com>\nSigned-off-by: Saeed Mahameed <saeedm@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlx5/core/en.h      |  2 +-\n drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  3 ++-\n drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   | 10 +++++-----\n 3 files changed, 8 insertions(+), 7 deletions(-)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h\nindex 0c4f1f30085a..bce2080eb86a 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h\n@@ -291,7 +291,6 @@ struct mlx5e_tstamp {\n \n enum {\n \tMLX5E_RQ_STATE_ENABLED,\n-\tMLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS,\n \tMLX5E_RQ_STATE_AM,\n };\n \n@@ -539,6 +538,7 @@ struct mlx5e_rq {\n \t\t\tvoid                  *mtt_no_align;\n \t\t\tu16                    num_strides;\n \t\t\tu8                     log_stride_sz;\n+\t\t\tbool                   umr_in_progress;\n \t\t} mpwqe;\n \t};\n \tstruct {\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\nindex 411fb68794bc..2767a3ee81bc 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\n@@ -886,7 +886,8 @@ static void mlx5e_free_rx_descs(struct mlx5e_rq *rq)\n \tu16 wqe_ix;\n \n \t/* UMR WQE (if in progress) is always at wq->head */\n-\tif (test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state))\n+\tif (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ &&\n+\t    rq->mpwqe.umr_in_progress)\n \t\tmlx5e_free_rx_mpwqe(rq, &rq->mpwqe.info[wq->head]);\n \n \twhile (!mlx5_wq_ll_is_empty(wq)) {\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\nindex a5522c3992a2..11dba9940029 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\n@@ -422,7 +422,7 @@ void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq)\n \tstruct mlx5_wq_ll *wq = &rq->wq;\n \tstruct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(wq, wq->head);\n \n-\tclear_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state);\n+\trq->mpwqe.umr_in_progress = false;\n \n \tif (unlikely(!MLX5E_TEST_BIT(rq->state, MLX5E_RQ_STATE_ENABLED))) {\n \t\tmlx5e_free_rx_mpwqe(rq, &rq->mpwqe.info[wq->head]);\n@@ -441,10 +441,13 @@ int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix)\n {\n \tint err;\n \n+\tif (rq->mpwqe.umr_in_progress)\n+\t\treturn -EBUSY;\n+\n \terr = mlx5e_alloc_rx_umr_mpwqe(rq, ix);\n \tif (unlikely(err))\n \t\treturn err;\n-\tset_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state);\n+\trq->mpwqe.umr_in_progress = true;\n \tmlx5e_post_umr_wqe(rq, ix);\n \treturn -EBUSY;\n }\n@@ -467,9 +470,6 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq)\n \tif (mlx5_wq_ll_is_full(wq))\n \t\treturn false;\n \n-\tif (test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state))\n-\t\treturn true;\n-\n \tdo {\n \t\tstruct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(wq, wq->head);\n \n","prefixes":["net-next","10/17"]}