From patchwork Thu Apr 2 14:07:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 457677 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 676D314011D for ; Fri, 3 Apr 2015 01:08:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753530AbbDBOII (ORCPT ); Thu, 2 Apr 2015 10:08:08 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:35605 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbbDBOIE (ORCPT ); Thu, 2 Apr 2015 10:08:04 -0400 Received: by wgdm6 with SMTP id m6so86625786wgd.2 for ; Thu, 02 Apr 2015 07:08:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bjP2fUOkGG8qFTMCcbtgz0U7M9bI5gaiG8Rnh1vejjY=; b=XY0q8/RzBhSDUxiAuy1kba568jMxHpzKCf0OV/dLJAU3WPxt7OiG9yXktcIixeAbvp fSOeUtxh7j4vcv8kRX8Pd0C5Qb/xEIpdvxkpN3e31F/hkyijE7Cl6401Jn+aalTb158P e/D68PWKDZCzJW+6JjZGS6dUswJAGqR+QGVn1dFUikmLvH3JhyHSSg3DBLrWbrZnnMnO nG+X0ISJpuF3hHLAs7/Um6ELTli7Y/6WQJ4BdirbfcTjxpQgd9pemSzuPACC7qBdjI6E 6UHynd2K4kxNiO0eCZwBzZ8utA0n+HIinehYyzGfLK/dyxbCXA+CizVYywpFdYWAoGtA Dcbg== X-Gm-Message-State: ALoCoQmrJuQyejOopwlf30fwpk+zbnKkGrsyVPJ/bdq1O7ITYGnm7CluF4v2VkEi/U2k3dCrdnmj X-Received: by 10.180.84.69 with SMTP id w5mr24761573wiy.18.1427983683613; Thu, 02 Apr 2015 07:08:03 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPSA id r14sm7890249wiv.13.2015.04.02.07.08.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 02 Apr 2015 07:08:03 -0700 (PDT) From: Eli Cohen X-Google-Original-From: Eli Cohen To: davem@davemloft.net Cc: netdev@vger.kernel.org, idos@mellaox.com, amirv@mellanox.com, Ira Gusinsky , Saeed Mahameed , Eli Cohen Subject: [PATCH net-next 09/16] net/mlx5_core: Avoid usage command work entry after writing command doorbell Date: Thu, 2 Apr 2015 17:07:27 +0300 Message-Id: <1427983654-971-10-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1427983654-971-1-git-send-email-eli@mellanox.com> References: <1427983654-971-1-git-send-email-eli@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ira Gusinsky Avoid usage of command work entry in cmd_work_handler since it can be released by mlx5_cmd_invoke before the work handler returns to running. Signed-off-by: Ira Gusinsky Signed-off-by: Saeed Mahameed Signed-off-by: Eli Cohen --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 290ae87fdef7..0d862696b876 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -515,10 +515,11 @@ static void cmd_work_handler(struct work_struct *work) ent->ts1 = ktime_get_ns(); /* ring doorbell after the descriptor is valid */ + mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); wmb(); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); - mlx5_core_dbg(dev, "write 0x%x to command doorbell\n", 1 << ent->idx); mmiowb(); + /* if not in polling don't use ent after this point */ if (cmd->mode == CMD_MODE_POLLING) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */