From patchwork Thu Oct 1 16:22:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375208 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=C/05m0Zi; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMD3D4fz9sSC for ; Fri, 2 Oct 2020 02:23:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732389AbgJAQW7 (ORCPT ); Thu, 1 Oct 2020 12:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732208AbgJAQW6 (ORCPT ); Thu, 1 Oct 2020 12:22:58 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24248C0613E2 for ; Thu, 1 Oct 2020 09:22:58 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id n14so4998862pff.6 for ; Thu, 01 Oct 2020 09:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fMcKVD61nofaq5qqD+Y1T6wU0xAKqtvzSc1DonbyAPM=; b=C/05m0ZiXooWfrcQnbMoS25Ez6zbkCrSs6jBBtuJ9XiZR6oznAPsXuLBVN9xuOs5JY G3NqQnXE6yMwbJDefuk1XDQKEHi5XIzWBtL+O9kytE+2/BiRhF0okBvPj49ncO4AJHI6 y1kwv3Bga5e5abn5757qAQvJSGWPyuIM8sm2tWXvqlAfMBA/0Y8Hg4AcPtlmIceacS5T T2WYMqhFInz3tkKZracbWsk1KODrYBTnNh6jF3s6lPDyNjLwCoWeMspjnEJ2avCMY7w/ 4x+q9dN38nhchZNf41c1DSNbFhod4VkCvaIFR2fx6+Bc/WJveFGAN8ZxunOf4E9y2MgK lEFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fMcKVD61nofaq5qqD+Y1T6wU0xAKqtvzSc1DonbyAPM=; b=RBnDIEodU/SddSVuUpgYz5OmCeUPVnrAN1JqGcXDdi5VeZOuSj5xc9mPhEKuOUbXcR uJjotFURRuRnbURBUqCoFpLFluWJDTGkvyYHz99dc0+bRAN21V0Uh4JlY6jQwCmEV/rY toJJZlkXmrDxBw/uK4ohB/uQFyLJBEG8woC64vCrLWuM/x+R+mE7dGbdvmoPEwjDpirL GGF4epw41GpcrU5MX17ZLi+pei3/Zfu1DqzPhH3AnJIfSnwSNhKGQQkujA0JheNzSDcX Dm5X0vyVawvquGWi0h0DNsoRYJ6wg93sEXNjJJDSyDZ8G8YT0R0F8nBHtE86sGEyDdCd dKTg== X-Gm-Message-State: AOAM530nefmX7lzKfBZJQDKL6aNuPl1Nrv5wicEblOpl94i1LLj5I4QC Z9OEl8dEBRWAvcVTHKsCcTmBkgOKtantIw== X-Google-Smtp-Source: ABdhPJwBSdi9Cl86iw7WGN1tEgs8/yeuSeloiLCIEFkyezoEF8zCI8FWCahp2wN2dIXVcR0C/T0wLg== X-Received: by 2002:aa7:9204:0:b029:14b:f92e:f57 with SMTP id 4-20020aa792040000b029014bf92e0f57mr8141405pfo.16.1601569376216; Thu, 01 Oct 2020 09:22:56 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.22.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:22:55 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 1/8] ionic: contiguous memory for notifyq Date: Thu, 1 Oct 2020 09:22:39 -0700 Message-Id: <20201001162246.18508-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The event notification queue is set up a little differently in the NIC and so the notifyq q and cq descriptor structures need to be contiguous, which got missed in an earlier patch that separated out the q and cq descriptor allocations. That patch was aimed at making the big tx and rx descriptor queue allocations easier to manage - the notifyq is much smaller and doesn't need to be split. This patch simply adds an if/else and slightly different code for the notifyq descriptor allocation. Fixes: ea5a8b09dc3a ("ionic: reduce contiguous memory allocation requirement") Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 69 +++++++++++++------ 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 1b4d5eb9bbc9..969979b31e93 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -518,30 +518,55 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, goto err_out_free_cq_info; } - new->q_size = PAGE_SIZE + (num_descs * desc_size); - new->q_base = dma_alloc_coherent(dev, new->q_size, &new->q_base_pa, - GFP_KERNEL); - if (!new->q_base) { - netdev_err(lif->netdev, "Cannot allocate queue DMA memory\n"); - err = -ENOMEM; - goto err_out_free_cq_info; - } - q_base = PTR_ALIGN(new->q_base, PAGE_SIZE); - q_base_pa = ALIGN(new->q_base_pa, PAGE_SIZE); - ionic_q_map(&new->q, q_base, q_base_pa); + if (flags & IONIC_QCQ_F_NOTIFYQ) { + int q_size, cq_size; + + /* q & cq need to be contiguous in case of notifyq */ + q_size = ALIGN(num_descs * desc_size, PAGE_SIZE); + cq_size = ALIGN(num_descs * cq_desc_size, PAGE_SIZE); + + new->q_size = PAGE_SIZE + q_size + cq_size; + new->q_base = dma_alloc_coherent(dev, new->q_size, + &new->q_base_pa, GFP_KERNEL); + if (!new->q_base) { + netdev_err(lif->netdev, "Cannot allocate qcq DMA memory\n"); + err = -ENOMEM; + goto err_out_free_cq_info; + } + q_base = PTR_ALIGN(new->q_base, PAGE_SIZE); + q_base_pa = ALIGN(new->q_base_pa, PAGE_SIZE); + ionic_q_map(&new->q, q_base, q_base_pa); + + cq_base = PTR_ALIGN(q_base + q_size, PAGE_SIZE); + cq_base_pa = ALIGN(new->q_base_pa + q_size, PAGE_SIZE); + ionic_cq_map(&new->cq, cq_base, cq_base_pa); + ionic_cq_bind(&new->cq, &new->q); + } else { + new->q_size = PAGE_SIZE + (num_descs * desc_size); + new->q_base = dma_alloc_coherent(dev, new->q_size, &new->q_base_pa, + GFP_KERNEL); + if (!new->q_base) { + netdev_err(lif->netdev, "Cannot allocate queue DMA memory\n"); + err = -ENOMEM; + goto err_out_free_cq_info; + } + q_base = PTR_ALIGN(new->q_base, PAGE_SIZE); + q_base_pa = ALIGN(new->q_base_pa, PAGE_SIZE); + ionic_q_map(&new->q, q_base, q_base_pa); - new->cq_size = PAGE_SIZE + (num_descs * cq_desc_size); - new->cq_base = dma_alloc_coherent(dev, new->cq_size, &new->cq_base_pa, - GFP_KERNEL); - if (!new->cq_base) { - netdev_err(lif->netdev, "Cannot allocate cq DMA memory\n"); - err = -ENOMEM; - goto err_out_free_q; + new->cq_size = PAGE_SIZE + (num_descs * cq_desc_size); + new->cq_base = dma_alloc_coherent(dev, new->cq_size, &new->cq_base_pa, + GFP_KERNEL); + if (!new->cq_base) { + netdev_err(lif->netdev, "Cannot allocate cq DMA memory\n"); + err = -ENOMEM; + goto err_out_free_q; + } + cq_base = PTR_ALIGN(new->cq_base, PAGE_SIZE); + cq_base_pa = ALIGN(new->cq_base_pa, PAGE_SIZE); + ionic_cq_map(&new->cq, cq_base, cq_base_pa); + ionic_cq_bind(&new->cq, &new->q); } - cq_base = PTR_ALIGN(new->cq_base, PAGE_SIZE); - cq_base_pa = ALIGN(new->cq_base_pa, PAGE_SIZE); - ionic_cq_map(&new->cq, cq_base, cq_base_pa); - ionic_cq_bind(&new->cq, &new->q); if (flags & IONIC_QCQ_F_SG) { new->sg_size = PAGE_SIZE + (num_descs * sg_desc_size); From patchwork Thu Oct 1 16:22:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375206 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=D28G+adQ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JM85Pydz9sSC for ; Fri, 2 Oct 2020 02:23:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732431AbgJAQXA (ORCPT ); Thu, 1 Oct 2020 12:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730534AbgJAQW6 (ORCPT ); Thu, 1 Oct 2020 12:22:58 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DB9C0613D0 for ; Thu, 1 Oct 2020 09:22:57 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id l126so5002451pfd.5 for ; Thu, 01 Oct 2020 09:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YMPvlDFGFLQUs5HYTrj8gBRL0o3MHNTx28Yg7XSPyjs=; b=D28G+adQrkE50XOgYE3cDtG4tAXGcCdxftoZMpc6iHYbp144r6Vj88evCa90MytwPO ApfA6p2tLI9bE2nTh7RRYWi3roTcdFEGyYtlZghUxv7hJ0ORvJgyveVtYUjs+7qUbpJR UzSiBrvUUgyI3s3602RgHzcv7Z3jsf+AbHi3j8wwfTZLWGAK7c7C1+SvVZDD/GdrDOld kyLMQBn9WQlAlogwmq12IhMF/NlVNwSowZGk03/xv1KTQnO5FRXst80uHnps0fJZc28j c4Y5GPptlVHTEs0WGiE/frKJexp2YymCPy3BQdniXLWDfdRIrQwULqTakNMrIzLVH26C EXOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YMPvlDFGFLQUs5HYTrj8gBRL0o3MHNTx28Yg7XSPyjs=; b=APxu3YA40mQ5Cp68GBCjhXTG2JhUQHXqSWqdKCdSb5ae+XyhuROmJWMzArslmXiJeZ mu1WWom2q3Lda710KlHI/Tiv+mOxcjeFNxch9y4Rg6Y72WnVPbsv+cCeIGHWC0cCsrp2 2J99kiFunDm9gPZZhshDPoCQ+8IwTkeA4Nbd9ML4TF0ex0uNqtioUCjioQx9S3GmNrmg DvabX+43j9rUv+mbdJ+vcyDB12R3J1sx3i7h2gwyLR3imJ7E8PliWeD8pthjNcwDtNIG EyEKQzUyMua1BYg9Mo942oq76bLIT+QGJ6lVshbiv4trfrBluRQ0IDl7qLg+kuVpURbd kHIg== X-Gm-Message-State: AOAM531sOT06jdcW0Ew+MEq2lZrtJsH2d5zLNVX6kgUnmOPjE3bwKzqU Z9cI82JRuqh6/U54wDJ94GFbrrQSGVgTzA== X-Google-Smtp-Source: ABdhPJzrvNFrH0BWWCBKS35UhWrszY1naOKT3VdgVCdRa4E+EbwgHnPl2HJxn4Z7D+ALU0cd/RL+rA== X-Received: by 2002:a62:1dcb:0:b029:13e:d13d:a131 with SMTP id d194-20020a621dcb0000b029013ed13da131mr7896922pfd.25.1601569377156; Thu, 01 Oct 2020 09:22:57 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.22.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:22:56 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 2/8] ionic: drain the work queue Date: Thu, 1 Oct 2020 09:22:40 -0700 Message-Id: <20201001162246.18508-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Check through our work list for additional items. This normally will only have one item, but occasionally may have another job waiting. There really is no need reschedule ourself here. Reported-by: Sebastian Andrzej Siewior Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 969979b31e93..53ac0e4402e7 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -62,15 +62,18 @@ static void ionic_lif_deferred_work(struct work_struct *work) struct ionic_deferred *def = &lif->deferred; struct ionic_deferred_work *w = NULL; - spin_lock_bh(&def->lock); - if (!list_empty(&def->list)) { - w = list_first_entry(&def->list, - struct ionic_deferred_work, list); - list_del(&w->list); - } - spin_unlock_bh(&def->lock); + do { + spin_lock_bh(&def->lock); + if (!list_empty(&def->list)) { + w = list_first_entry(&def->list, + struct ionic_deferred_work, list); + list_del(&w->list); + } + spin_unlock_bh(&def->lock); + + if (!w) + break; - if (w) { switch (w->type) { case IONIC_DW_TYPE_RX_MODE: ionic_lif_rx_mode(lif, w->rx_mode); @@ -94,8 +97,8 @@ static void ionic_lif_deferred_work(struct work_struct *work) break; } kfree(w); - schedule_work(&def->work); - } + w = NULL; + } while (true); } void ionic_lif_deferred_enqueue(struct ionic_deferred *def, From patchwork Thu Oct 1 16:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375207 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=bvFeVn1S; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JM95c1Vz9sSC for ; Fri, 2 Oct 2020 02:23:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732522AbgJAQXA (ORCPT ); Thu, 1 Oct 2020 12:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732230AbgJAQW7 (ORCPT ); Thu, 1 Oct 2020 12:22:59 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 259D9C0613E3 for ; Thu, 1 Oct 2020 09:22:59 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id p21so1955134pju.0 for ; Thu, 01 Oct 2020 09:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0ZoJl2SUn268zHQPS8miTuBp3WaeXYkq3HEEnsdCi7A=; b=bvFeVn1SHatRqgwpwQf92ndWCIGVyKvUjwf/jkykGz/zepencu3gU5ngaJhYjSAwuK eGqW5j+q2vMzd9hy5or5HRsnD8Q8oVh3Al9ZHFpY+ZamnpaTKIDfGxEpXfQrBvhk2nl2 RiQ5nH4sWINmJ9+gHhmIoSfLCMUuuFp297Ho/WxZKImhuo06w8RLGNhMJ7F39vo2JLoz 62/6B261pK5na4lgkEcjA9+GKGRo4/0F4pG/CiuJ5wtesR3cvTR4Ec8NVj10mm64Kdk6 vEJr7KssM2mW6iPKLDMbL0xDvvycyblOeLoe5XnWordzKYhq+QfrCEG4sbynjVwSD9/2 l8Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0ZoJl2SUn268zHQPS8miTuBp3WaeXYkq3HEEnsdCi7A=; b=SKLesFArsAgMg+cy7owJF+PQEdfpJHqwECcgfStAB+BWkJzQ5nQhGLgGqBqH8wezxN GGu1pN+IYwd06BdVrbw7Ed8JCEEKr9Y74S8g6N0uIiO4Cl/CuAZBvdK1JSld5h5rlEiD KLrvrdYgurLv12a3JuLOaf0CPB/QFQMT+QuWwW02fvRX5TU2QtYiPynRR0PI+Sxmi9J9 SZTw6r8xolQdpa5GYr2t9mC/upqSEvLG8GeUXvpUs7Atc3l6u3iQ1twG+PT+L9GOzY2I Ye1HbMD1+7eJjhEk/yHP7d0TG1UzpW/I0ohfcLSJuXfAU/ncc00KbXT4jMRrUU05ecFT v2nA== X-Gm-Message-State: AOAM530Enisms+6RDTL6cFPsQa+j5KK6scVkSpkmd3y8txbJF7kRQrSM j3a8T886jLk4F9SCdEOVjhjRxJKDH+tFag== X-Google-Smtp-Source: ABdhPJyh3K703np8pCVG0ca510r9+w4CABZukn3DKq4ggpeX+/ZGFWqU6TJ8L2tFkrLzwyLC7135qw== X-Received: by 2002:a17:90a:aa18:: with SMTP id k24mr667540pjq.231.1601569378262; Thu, 01 Oct 2020 09:22:58 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.22.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:22:57 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 3/8] ionic: clear linkcheck bit on alloc fail Date: Thu, 1 Oct 2020 09:22:41 -0700 Message-Id: <20201001162246.18508-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Clear our link check requested flag on an allocation error. We end up dropping this link check request, but that should be fine as our watchdog will come back a few seconds later and request it again. Reported-by: Sebastian Andrzej Siewior Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 53ac0e4402e7..5906145e4585 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -164,8 +164,10 @@ void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep) if (!can_sleep) { work = kzalloc(sizeof(*work), GFP_ATOMIC); - if (!work) + if (!work) { + clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state); return; + } work->type = IONIC_DW_TYPE_LINK_STATUS; ionic_lif_deferred_enqueue(&lif->deferred, work); From patchwork Thu Oct 1 16:22:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375210 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=h9VtCFxA; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMG4gKTz9sSC for ; Fri, 2 Oct 2020 02:23:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732672AbgJAQXG (ORCPT ); Thu, 1 Oct 2020 12:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732026AbgJAQXB (ORCPT ); Thu, 1 Oct 2020 12:23:01 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13594C0613D0 for ; Thu, 1 Oct 2020 09:23:00 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id n14so4998989pff.6 for ; Thu, 01 Oct 2020 09:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ClIUYr4iNr71p0PkfukRICrUdDDVofFV6FT0DKMV7Js=; b=h9VtCFxAHqLWKRn/E1phWHaqAeqr7qJqzo1TBJ1xALwj18D9YIEOR3FuQFTkrgK57V AxoGiVa30ObXEC08ykwyBM1UeNseo2jpMqJus1PvZdPMhx3RFVLw9Ge0HWd/4J1ocIO/ 24rPtn0pRugds+Sg5nH4qvZosIv4X/149VfmNcMnUTFpARdNPD7ST3e0dSlEH/zCV5eH oAaSbzuJjUl2wm2a/JE31lLtr72UFVExaiDbemz+/vBqT7FFt4+PubPA52b6LCaA9CuR QCerDcDfXu9Ee+f4gIrDs050He1wtv/AGCwtXKY93Hdrf4+0SLbZo7+KfqhzTycenzuf QVJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ClIUYr4iNr71p0PkfukRICrUdDDVofFV6FT0DKMV7Js=; b=XZWYRqxO1U3akcDI72QNXLc43/7ogebZWQgYEs7hrkEA51+5HyWJJN4TyPsCMRoJVK E9OSOyFgBu0LgFSmQTUeG2/DUqNWmGEbV5oQByuH0s9xQBp5UqaI4gdXo80J+22SxNY5 tSvp4fJbqFC/E7cRFf1haBag3Np/w8TmwzgAbQbwUMZPFp+5xHxmP3Zw5lgYRTFYw1YB HxDc7zjiFuoNN0b9/FBGYRtVaOrpb1NVJSTqLjyrOquD561j7ap6BBrgfcWvCgEV04eG QuQYS13kOZS2sjlbHRAKHZTccyE7sOmlXfJSr/g2Rd3RY3z1eyK8u8mc3PCGM9jNVuli 3aVg== X-Gm-Message-State: AOAM5311njxhVgCxOJBElTiAnJvfB20AwNCMVUI+xNlCDIFqPKFdiNp2 7mEV3zcj/anCzmwRhNBkvrjD10Zz4bbhaA== X-Google-Smtp-Source: ABdhPJwvD0YcdUGtp3sTzDOLV/Rp6ccloF16ehKufy8UwL8oRgpvIdWtgKajo5MdUZTBNgS33pTXvw== X-Received: by 2002:a17:902:9884:b029:d2:4276:1b64 with SMTP id s4-20020a1709029884b02900d242761b64mr7957383plp.76.1601569379317; Thu, 01 Oct 2020 09:22:59 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.22.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:22:58 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 4/8] ionic: check qcq ptr in ionic_qcq_disable Date: Thu, 1 Oct 2020 09:22:42 -0700 Message-Id: <20201001162246.18508-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There are a couple of error recovery paths that can come through ionic_qcq_disable() without having set up the qcq, so we need to make sure we have a valid qcq pointer before using it. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 5906145e4585..efffdfe18406 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -266,29 +266,26 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) static int ionic_qcq_disable(struct ionic_qcq *qcq) { - struct ionic_queue *q = &qcq->q; - struct ionic_lif *lif = q->lif; - struct ionic_dev *idev; - struct device *dev; + struct ionic_queue *q; + struct ionic_lif *lif; struct ionic_admin_ctx ctx = { .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), .cmd.q_control = { .opcode = IONIC_CMD_Q_CONTROL, - .lif_index = cpu_to_le16(lif->index), - .type = q->type, - .index = cpu_to_le32(q->index), .oper = IONIC_Q_DISABLE, }, }; - idev = &lif->ionic->idev; - dev = lif->ionic->dev; + if (!qcq) + return -ENXIO; - dev_dbg(dev, "q_disable.index %d q_disable.qtype %d\n", - ctx.cmd.q_control.index, ctx.cmd.q_control.type); + q = &qcq->q; + lif = q->lif; if (qcq->flags & IONIC_QCQ_F_INTR) { + struct ionic_dev *idev = &lif->ionic->idev; + cancel_work_sync(&qcq->dim.work); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_SET); @@ -297,6 +294,12 @@ static int ionic_qcq_disable(struct ionic_qcq *qcq) napi_disable(&qcq->napi); } + ctx.cmd.q_control.lif_index = cpu_to_le16(lif->index); + ctx.cmd.q_control.type = q->type; + ctx.cmd.q_control.index = cpu_to_le32(q->index); + dev_dbg(lif->ionic->dev, "q_disable.index %d q_disable.qtype %d\n", + ctx.cmd.q_control.index, ctx.cmd.q_control.type); + return ionic_adminq_post_wait(lif, &ctx); } @@ -1794,6 +1797,12 @@ static int ionic_txrx_enable(struct ionic_lif *lif) int i, err; for (i = 0; i < lif->nxqs; i++) { + if (!(lif->rxqcqs[i] && lif->txqcqs[i])) { + dev_err(lif->ionic->dev, "%s: bad qcq %d\n", __func__, i); + err = -ENXIO; + goto err_out; + } + ionic_rx_fill(&lif->rxqcqs[i]->q); err = ionic_qcq_enable(lif->rxqcqs[i]); if (err) From patchwork Thu Oct 1 16:22:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375209 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=XEKdo+iG; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMF5QKcz9sSC for ; Fri, 2 Oct 2020 02:23:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732631AbgJAQXE (ORCPT ); Thu, 1 Oct 2020 12:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732230AbgJAQXC (ORCPT ); Thu, 1 Oct 2020 12:23:02 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E3CC0613E2 for ; Thu, 1 Oct 2020 09:23:01 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 7so4394956pgm.11 for ; Thu, 01 Oct 2020 09:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Crr7PSXFTq9YbjqXq0TxN69wsQ1MyA79mkwEfR5jo/U=; b=XEKdo+iGzWV313bExsECKolsqHALXhhHNMcoNWJ//yb+iA5EKH4WDK/kxFC/mOEwgd Aglxt/0ZYcQvTlvNAJR2BA3uo6rQyTsmeMETYKFOZVzu3Pboj2hrp7CsrLUn9ocMcPXJ u779c7nCSzfdz5/7VBz7AmYbk5eNab11ncFQqS5tqZaR2wMPKfXuEKK7a3IOWLOmkFGb nrvzXMxdWdHsK3kQIM06rOlvBmcgyTHGZ3iZSe2HAL3AptPU7IQHSd5Hq9GsQLFF8yzD qh6PwwClKY6BDrnMEuKFmond0OIiTkOPErlh9//JCZn/LnqFClKztxls/bA8+oJ6SzdB xpPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Crr7PSXFTq9YbjqXq0TxN69wsQ1MyA79mkwEfR5jo/U=; b=cRe712zK2y5zEl9jWmTHzMCyh4BAJ4Le0Jnk/5FYdqfr5hjoE1glvPmHlKyXoe4Zi7 AWKxP0WUtbgsH2TWENgZqitSwMA9VE7qdGqu4WlSF/m4zWHYslkp2prdCM03gOkTZxVF unuIvTJiZ56FWPCf4qgHysqLtbstsODD9eL+LrKQ8etgC9Ske4+bkUjPMDJfNSrc6n+h lU7qEET7r9blk3STq5qebbendkNv2npz6mvom12xuJsRmOzOd1sQt+t5lwCZ7cNDTMgt q5vte3YNLzvJ45ME5cN0ePlDteM4HDBoP1U3hf+s7CVAguvVv5Rr7wZJa1hCYS0fN3j8 2nKA== X-Gm-Message-State: AOAM532YfMhWUOHyhn6OfUrWgm2SxRQi3opaxVdKlIN966yo+9t6NsOr Bvah69GsUEVX6m2cMkTu8UueH0c2NAVytw== X-Google-Smtp-Source: ABdhPJw9PfGL+2dkEUCtigzkbCi5YYWzc2S/zyFyQj9WSzBB7tl3pz3Oj0rJZqUrw8jM6quxotl+iA== X-Received: by 2002:a63:5966:: with SMTP id j38mr6702895pgm.187.1601569380274; Thu, 01 Oct 2020 09:23:00 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.22.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:22:59 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 5/8] ionic: disable all queue napi contexts on timeout Date: Thu, 1 Oct 2020 09:22:43 -0700 Message-Id: <20201001162246.18508-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some time ago we short-circuited the queue disables on a timeout error in order to not have to wait on every queue when we already know it will time out. However, this meant that we're not properly stopping all the interrupts and napi contexts. This changes queue disable to always call ionic_qcq_disable() and to give it an argument to know when to not do the adminq request. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index efffdfe18406..2b6cd60095b1 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -264,10 +264,11 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) return ionic_adminq_post_wait(lif, &ctx); } -static int ionic_qcq_disable(struct ionic_qcq *qcq) +static int ionic_qcq_disable(struct ionic_qcq *qcq, bool send_to_hw) { struct ionic_queue *q; struct ionic_lif *lif; + int err = 0; struct ionic_admin_ctx ctx = { .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), @@ -294,13 +295,17 @@ static int ionic_qcq_disable(struct ionic_qcq *qcq) napi_disable(&qcq->napi); } - ctx.cmd.q_control.lif_index = cpu_to_le16(lif->index); - ctx.cmd.q_control.type = q->type; - ctx.cmd.q_control.index = cpu_to_le32(q->index); - dev_dbg(lif->ionic->dev, "q_disable.index %d q_disable.qtype %d\n", - ctx.cmd.q_control.index, ctx.cmd.q_control.type); + if (send_to_hw) { + ctx.cmd.q_control.lif_index = cpu_to_le16(lif->index); + ctx.cmd.q_control.type = q->type; + ctx.cmd.q_control.index = cpu_to_le32(q->index); + dev_dbg(lif->ionic->dev, "q_disable.index %d q_disable.qtype %d\n", + ctx.cmd.q_control.index, ctx.cmd.q_control.type); - return ionic_adminq_post_wait(lif, &ctx); + err = ionic_adminq_post_wait(lif, &ctx); + } + + return err; } static void ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq) @@ -1627,22 +1632,16 @@ static void ionic_lif_rss_deinit(struct ionic_lif *lif) static void ionic_txrx_disable(struct ionic_lif *lif) { unsigned int i; - int err; + int err = 0; if (lif->txqcqs) { - for (i = 0; i < lif->nxqs; i++) { - err = ionic_qcq_disable(lif->txqcqs[i]); - if (err == -ETIMEDOUT) - break; - } + for (i = 0; i < lif->nxqs; i++) + err = ionic_qcq_disable(lif->txqcqs[i], (err != -ETIMEDOUT)); } if (lif->rxqcqs) { - for (i = 0; i < lif->nxqs; i++) { - err = ionic_qcq_disable(lif->rxqcqs[i]); - if (err == -ETIMEDOUT) - break; - } + for (i = 0; i < lif->nxqs; i++) + err = ionic_qcq_disable(lif->rxqcqs[i], (err != -ETIMEDOUT)); } } @@ -1794,6 +1793,7 @@ static int ionic_txrx_init(struct ionic_lif *lif) static int ionic_txrx_enable(struct ionic_lif *lif) { + int derr = 0; int i, err; for (i = 0; i < lif->nxqs; i++) { @@ -1810,8 +1810,7 @@ static int ionic_txrx_enable(struct ionic_lif *lif) err = ionic_qcq_enable(lif->txqcqs[i]); if (err) { - if (err != -ETIMEDOUT) - ionic_qcq_disable(lif->rxqcqs[i]); + derr = ionic_qcq_disable(lif->rxqcqs[i], (err != -ETIMEDOUT)); goto err_out; } } @@ -1820,12 +1819,8 @@ static int ionic_txrx_enable(struct ionic_lif *lif) err_out: while (i--) { - err = ionic_qcq_disable(lif->txqcqs[i]); - if (err == -ETIMEDOUT) - break; - err = ionic_qcq_disable(lif->rxqcqs[i]); - if (err == -ETIMEDOUT) - break; + derr = ionic_qcq_disable(lif->txqcqs[i], (derr != -ETIMEDOUT)); + derr = ionic_qcq_disable(lif->rxqcqs[i], (derr != -ETIMEDOUT)); } return err; From patchwork Thu Oct 1 16:22:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375212 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=4f5uT58m; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMM0pDXz9sSC for ; Fri, 2 Oct 2020 02:23:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732711AbgJAQXJ (ORCPT ); Thu, 1 Oct 2020 12:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbgJAQXD (ORCPT ); Thu, 1 Oct 2020 12:23:03 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 207EDC0613E3 for ; Thu, 1 Oct 2020 09:23:02 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id d6so4990507pfn.9 for ; Thu, 01 Oct 2020 09:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9YOtY8kesgn2zGDhUYYJtsX4hPH7Y73W/wLF/LqVL8g=; b=4f5uT58mhEqQIURnyfJPUnO+OnzgndtcxBTmIKygeQh/FgGM2ru2/rSn/60wiPxWYv wVLgKNDgWZbJD6HQ1223XwgRuQ2bMAu3olpRWssGh3X18Ng4UWLNSf+3yRjIMEIpwn/c Lad3wOwKEVRjaLBwQob5ylIITSDdRF+dXNQ59xrjUJcMPve3XOAPCGHcb2xNoyUTitX9 6u7ryxNE2POqgum5JsyBSiNbAiNA3cx9InHZeidNOyfDLis+LthdFp3zlYngRAO1B5bl H0kI3aYS4hmzf+X9FG69RQiL434O7bzAPkDFJ3SsJIPZP5zwbAR/w1+07M6dKAjPJhrF B1MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9YOtY8kesgn2zGDhUYYJtsX4hPH7Y73W/wLF/LqVL8g=; b=l0Wy6G3+5trIOs0m3FBAZRSFeW60cmbv/O6DKThKSAcdBG88t4rybSnWdLMcShZ56D U64PHoaAku1pgiTT5PBztMLAv6wGFVh4ZFD4GDn/+ewbYhc3UrI3/76mQ0J789ddjxLe LXRMmBPdOJFQJSYeMri4WYs3PENbyqH1TNYZha0lrkNJVhrga8ZkCmFHJyyqrSU30nci p/gsaej80Rl8QpGrN/UGurAMzsvoTyseMnUNvxovbJV+T7eqhljk82bfECTeoFR8urg5 mXg5JABs4sir//iWcAO5A8ke1Cw1LC5guyiEuq1cUwdhqruZus4L/YfwxGbEADX2ZrGi Cbqw== X-Gm-Message-State: AOAM533NMgVDiZbHfpKeD9UwbYQHcND9bexI3Oc9+SJrpmJo12z+x5DJ QPtA3MTNB3zxfeRZcxBLB+ONdY+pNvddLg== X-Google-Smtp-Source: ABdhPJznjGqKiujZhZb0efLn/GtihCA8P01cEsgIhpcVewLq4C+QrUXyFP6gJOXrMEDJt1f643aLCQ== X-Received: by 2002:a17:902:a403:b029:d2:6379:a9a6 with SMTP id p3-20020a170902a403b02900d26379a9a6mr7895256plq.68.1601569381299; Thu, 01 Oct 2020 09:23:01 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.23.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:23:00 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 6/8] ionic: refill lif identity after fw_up Date: Thu, 1 Oct 2020 09:22:44 -0700 Message-Id: <20201001162246.18508-7-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org After we do a fw upgrade and refill the ionic->ident.dev, we also need to update the other identity info. Since the lif identity needs to be updated each time the ionic identity is refreshed, we can pull it into ionic_identify(). The debugfs entry is moved so that it doesn't cause an error message when the data is refreshed after the fw upgrade. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_bus_pci.c | 10 ++-------- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 10 +++++++++- drivers/net/ethernet/pensando/ionic/ionic_main.c | 16 +++++++++++----- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index 2749ce009ebc..b0d8499d373b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -266,6 +266,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dev_err(dev, "Cannot identify device: %d, aborting\n", err); goto err_out_teardown; } + ionic_debugfs_add_ident(ionic); err = ionic_init(ionic); if (err) { @@ -286,14 +287,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_reset; } - /* Configure LIFs */ - err = ionic_lif_identify(ionic, IONIC_LIF_TYPE_CLASSIC, - &ionic->ident.lif); - if (err) { - dev_err(dev, "Cannot identify LIFs: %d, aborting\n", err); - goto err_out_port_reset; - } - + /* Allocate and init the LIF */ err = ionic_lif_size(ionic); if (err) { dev_err(dev, "Cannot size LIF: %d, aborting\n", err); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 2b6cd60095b1..fcf5b00d1c33 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2556,7 +2556,15 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) dev_info(ionic->dev, "FW Up: restarting LIFs\n"); ionic_init_devinfo(ionic); - ionic_port_init(ionic); + err = ionic_identify(ionic); + if (err) + goto err_out; + err = ionic_port_identify(ionic); + if (err) + goto err_out; + err = ionic_port_init(ionic); + if (err) + goto err_out; err = ionic_qcqs_alloc(lif); if (err) goto err_out; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index c7a67c5cda42..c21195be59e1 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -429,17 +429,23 @@ int ionic_identify(struct ionic *ionic) sz = min(sizeof(ident->dev), sizeof(idev->dev_cmd_regs->data)); memcpy_fromio(&ident->dev, &idev->dev_cmd_regs->data, sz); } - mutex_unlock(&ionic->dev_cmd_lock); - if (err) - goto err_out_unmap; + if (err) { + dev_err(ionic->dev, "Cannot identify ionic: %dn", err); + goto err_out; + } - ionic_debugfs_add_ident(ionic); + err = ionic_lif_identify(ionic, IONIC_LIF_TYPE_CLASSIC, + &ionic->ident.lif); + if (err) { + dev_err(ionic->dev, "Cannot identify LIFs: %d\n", err); + goto err_out; + } return 0; -err_out_unmap: +err_out: return err; } From patchwork Thu Oct 1 16:22:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375211 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=HyUjKx3B; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMK58FSz9sSC for ; Fri, 2 Oct 2020 02:23:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732694AbgJAQXI (ORCPT ); Thu, 1 Oct 2020 12:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732534AbgJAQXD (ORCPT ); Thu, 1 Oct 2020 12:23:03 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708ECC0613E4 for ; Thu, 1 Oct 2020 09:23:03 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id z19so4984482pfn.8 for ; Thu, 01 Oct 2020 09:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e8+WoZz7JPIzdgAShuSA0TcanH2qdNyrsirkG8krFEs=; b=HyUjKx3BoZzVtUPuBppYe14sBN1RdtUSq9b4d/oCZHqOkByK+uRecExZqblaTyqKDm qGtz3rR7hMslJgi4PKNX+Zxde8QUvjoVeTlERejWXbtQol/7+3TwSvhES3VA8XbsaaJJ zrPXYXMCyu+X+ewKGVpCeE6/LrLkYV4xafwHnqTCgy7q456OHm/7aYh6eKE6HTBXrDp3 RdXeHucwgOhs/w9LXVWoieoSeniltUmYc3veK9yuNedBwue6+M11WcmPEtOhr3NjWvZy lDM24vsXUvtq59ulGQky6fGCM52XoXwor3DKLN4p0wGmFtXCdBfXfpbrikUbSXKTFJRk i8dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e8+WoZz7JPIzdgAShuSA0TcanH2qdNyrsirkG8krFEs=; b=XGVY7eJSNIhE1MF7ZT+5MtE9rfIJVrNyND1WkAuf56pYOoBC0t/AMp7r33biBkDzzx ToJst8TvXW9svZ5hYatHRD79GmG4DJpVu6gG/7GV3XEVrs7kzTDNjIKcgWdkTiTQYj/D X1mXcAfJ9PfQZIM6O4PZ5NFXhjY1UrH2+UMt6J8S1B1o81pwosQqud9wP/y0lajXSLea ZOmZupd3EwTimG3Qf49xFPp8NC5Gma2lDtoinAADEHlD6j8/8yWdLzf1Kl96te6TiasD dvCluoBN220M+B3/HwHdpIPhXAvzpg1i392OZyL08bTqcclUyZAr4s0XxRTodVVUljcn UKOg== X-Gm-Message-State: AOAM533jEb/seVp+BGtYOVfclxnQipPjkVdCpghgk1N7b7iPGATG+lJ7 +C9Xr9yA+QZoB78HTEuyYEMcFrnRRBj7MA== X-Google-Smtp-Source: ABdhPJzyDHps7qreCcbTxqTZaE3EcpPqNzfQJYnJWRU2kiQDF3QMl1F4fd/VBEe+BqSZuQMhdex43Q== X-Received: by 2002:a62:2b52:0:b029:142:2501:35d9 with SMTP id r79-20020a622b520000b0290142250135d9mr7914630pfr.57.1601569382605; Thu, 01 Oct 2020 09:23:02 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.23.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:23:01 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 7/8] ionic: use lif ident for filter count Date: Thu, 1 Oct 2020 09:22:45 -0700 Message-Id: <20201001162246.18508-8-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use the lif's ident information for the uc and mc filter counts rather than the ionic's version, to be sure we're getting the info that is specific to this lif. While we're thinking about it, add some missing error checking where we get the lif's identity information. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index fcf5b00d1c33..d655a7ae3058 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1022,7 +1022,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, bool can_sleep) { - struct ionic *ionic = lif->ionic; struct ionic_deferred_work *work; unsigned int nmfilters; unsigned int nufilters; @@ -1032,8 +1031,8 @@ static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, * here before checking the need for deferral so that we * can return an overflow error to the stack. */ - nmfilters = le32_to_cpu(ionic->ident.lif.eth.max_mcast_filters); - nufilters = le32_to_cpu(ionic->ident.lif.eth.max_ucast_filters); + nmfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); + nufilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); if ((is_multicast_ether_addr(addr) && lif->nmcast < nmfilters)) lif->nmcast++; @@ -1162,12 +1161,9 @@ static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo) static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) { struct ionic_lif *lif = netdev_priv(netdev); - struct ionic_identity *ident; unsigned int nfilters; unsigned int rx_mode; - ident = &lif->ionic->ident; - rx_mode = IONIC_RX_MODE_F_UNICAST; rx_mode |= (netdev->flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0; rx_mode |= (netdev->flags & IFF_BROADCAST) ? IONIC_RX_MODE_F_BROADCAST : 0; @@ -1182,7 +1178,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) * to see if we can disable NIC PROMISC */ ionic_dev_uc_sync(netdev, from_ndo); - nfilters = le32_to_cpu(ident->lif.eth.max_ucast_filters); + nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); if (netdev_uc_count(netdev) + 1 > nfilters) { rx_mode |= IONIC_RX_MODE_F_PROMISC; lif->uc_overflow = true; @@ -1194,7 +1190,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) /* same for multicast */ ionic_dev_uc_sync(netdev, from_ndo); - nfilters = le32_to_cpu(ident->lif.eth.max_mcast_filters); + nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); if (netdev_mc_count(netdev) > nfilters) { rx_mode |= IONIC_RX_MODE_F_ALLMULTI; lif->mc_overflow = true; @@ -2425,7 +2421,12 @@ int ionic_lif_alloc(struct ionic *ionic) lif->identity = lid; lif->lif_type = IONIC_LIF_TYPE_CLASSIC; - ionic_lif_identify(ionic, lif->lif_type, lif->identity); + err = ionic_lif_identify(ionic, lif->lif_type, lif->identity); + if (err) { + dev_err(ionic->dev, "Cannot identify type %d: %d\n", + lif->lif_type, err); + goto err_out_free_netdev; + } lif->netdev->min_mtu = max_t(unsigned int, ETH_MIN_MTU, le32_to_cpu(lif->identity->eth.min_frame_size)); lif->netdev->max_mtu = From patchwork Thu Oct 1 16:22:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1375213 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=TufSgKoN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4C2JMS2zbMz9sSC for ; Fri, 2 Oct 2020 02:23:16 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732755AbgJAQXP (ORCPT ); Thu, 1 Oct 2020 12:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732610AbgJAQXE (ORCPT ); Thu, 1 Oct 2020 12:23:04 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83152C0613D0 for ; Thu, 1 Oct 2020 09:23:04 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id kk9so2147074pjb.2 for ; Thu, 01 Oct 2020 09:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lQuZaRuWzexgVjSPkkZVKzzUtaieAt/b44l3FnkLuMo=; b=TufSgKoN31i8umHCwdzbcwpYs69igEZc9iBIzTIIZ4IburaqEytHaCmtdOgPdW63r/ GL/dXZoqVVJ0Y0LqBAW7R5Nz1JhL3ngRaHsfB21otKYfRsZLJwkwdZwjWLoJrmCsaZ3t 7yxxSd4PA7pT/ubn4+vyp8+FHe52maZT/eTeizwn00LzJJxQite58bzsen8fx1bRD0Zg UcIibiKBx14DvC5pDc7tsB97vzli3oqnIg8o/S+98cSuQ+mKbddpsNJdJSyqKYbt9kYP IZJhs038LmCzB5uTivt/j0cA3PLYm3dnpg7d2zFVtZ+UoZF4EmmRghan2B0V8iSBDUVT g0rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lQuZaRuWzexgVjSPkkZVKzzUtaieAt/b44l3FnkLuMo=; b=KJjolTOCeljvoV7mL1o9WMgGpA1fm6mbajCnxW4u7mlWOOmojM9f0QvV76W2Kk8Z0j m1Gnl8kp1JKNnK0IMxsCFH5pJa6x2X2EIaBN4V2+O0tzJC/Iw+ngHjfTYbMizbC31i1d yo/daIqZR8Yg8QJTmminVYywY+yhYaQ8vCAiZ4uTWfaPpxTajHPkqLFGV9RtFFh3h3Dn s89ISBnPWA8Oc7915MCAdd3qDIONM/GkhbivKlIkGLdXjCtcxv52Mi2QBOX7WBhwFoHT h3YcrKuSggDySifg3zLmjLZjOAekceZa3Cr1pCnn8+C1DnREvkBZqwc518fh1ZojkIBy +Evg== X-Gm-Message-State: AOAM5301TCQr72Y0v1QcJ7df6bzrPJkB24e64AKoo6E45wzcxSlKf7Rd IliSjd1cVBx4I0e24ZV7WzNMDzhHDvbWRg== X-Google-Smtp-Source: ABdhPJz9IJi1q1g8ZAvUoIkzh9DPiAl5j5fJX9eSNqSKtgrEEM5ymiwk+chLjYQD7ah+C5wNGXQN5g== X-Received: by 2002:a17:90a:6685:: with SMTP id m5mr658826pjj.235.1601569383802; Thu, 01 Oct 2020 09:23:03 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id k2sm6380066pfi.169.2020.10.01.09.23.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2020 09:23:03 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 8/8] ionic: add new bad firmware error code Date: Thu, 1 Oct 2020 09:22:46 -0700 Message-Id: <20201001162246.18508-9-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001162246.18508-1-snelson@pensando.io> References: <20201001162246.18508-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the new firmware image downladed for update is corrupted or is a bad format, the download process will report a status code specifically for that. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_if.h | 1 + drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_if.h b/drivers/net/ethernet/pensando/ionic/ionic_if.h index 5bb56a27a50d..31ccfcdc2b0a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_if.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h @@ -96,6 +96,7 @@ enum ionic_status_code { IONIC_RC_ERROR = 29, /* Generic error */ IONIC_RC_ERDMA = 30, /* Generic RDMA error */ IONIC_RC_EVFID = 31, /* VF ID does not exist */ + IONIC_RC_EBAD_FW = 32, /* FW file is invalid or corrupted */ }; enum ionic_notifyq_opcode { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index c21195be59e1..ee0740881af3 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -64,6 +64,8 @@ static const char *ionic_error_to_str(enum ionic_status_code code) return "IONIC_RC_ERROR"; case IONIC_RC_ERDMA: return "IONIC_RC_ERDMA"; + case IONIC_RC_EBAD_FW: + return "IONIC_RC_EBAD_FW"; default: return "IONIC_RC_UNKNOWN"; }