Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3698185imu; Mon, 28 Jan 2019 09:13:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN4aIHvSASqvvlvV7fL/iTDM66nYdGRKNIb07jLdWqQYA13+qMNLkrI8pey0uTc0eAel+MBL X-Received: by 2002:a63:91c1:: with SMTP id l184mr20661147pge.29.1548695631281; Mon, 28 Jan 2019 09:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695631; cv=none; d=google.com; s=arc-20160816; b=gg7HWq2apnKu0m6xgPW6L95bL7PQmk+oGfTP7KqAOcLJSITfeTINormjpRPIJTIF9L 6o+9FPLbRYxl8afWtxgZa9yX8k63TtpJS1ilyPKLzUOxrXw5lX6U4MVf2O0+RSZgpbU/ 2wD5BBuqOuqpfwwhRx4dnt1hESQjtQc5BPWNL3LjeB62KQ49Iu8k76hSegToCj3W2jHK sLHm7HdISE9qqoZC2qhKoqbbfuufDq/p1R+KABMnSk10pjcxFJzQq2+RR5ktBLHzXa+a bsmQn+7QRKdmmwMWgT6GyOL53fP/X6vAHLvvktNxJ1jwqJ8kfrjrgjo73z7Ok+EXYYA+ ZmqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nB0r9PVA8+mD/72mf/CEpOtYyHrGziqIqsWNFeXlwLc=; b=d55MDycBO7DDNOVFsd/vrVxluSlrzlDc4lG+Dgfuvdu7HNeunrcqIpYvtARPg5Dp3k YpApp/WJzhfzGoQAZ3F3+Zz8UVAdKUyEbC2L3aBZFP1+J8HmdxaOpGqPIJ92idiwgv39 CNfCseW/6qQdLSZaSGG4uoiwG3r4wRBmcJaPZG9nro2KHR0khqtfrcQntIFHp+NI0ofN 0/JMYGPMUkr49oowY1Jdu6L88+mbNjzo7yA5k36obT+PN/GuCYBK98X6vjFBsPAlth4s mNxgp7rhIAuPom113+Uxyk7JcUBb50yqUiFGO5oNVKQIr1eHVtq5iQZREKcDy9b3RpJf CwGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r0+1lWYP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z123si28384081pfb.104.2019.01.28.09.13.35; Mon, 28 Jan 2019 09:13:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r0+1lWYP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732081AbfA1RMQ (ORCPT + 99 others); Mon, 28 Jan 2019 12:12:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:33938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731914AbfA1QJV (ORCPT ); Mon, 28 Jan 2019 11:09:21 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CFDA21738; Mon, 28 Jan 2019 16:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691761; bh=cWT+3wHl4fh/O3uJciDJKpHd1NBQ8RSh/G/cSfLyFa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r0+1lWYP3MxWjODLnwbQCfEirEMCWmas+6cR4ANwgCyPnkMlBdEkCdlSRrenFRZfB EECHVlAJCiWJUwsrINTt2NhPs9lpym3qv0fw/RZpPVo+BTt1E7Y2/hz5YxzhPIx/0e tjJm8CMNRA/D7oYEgw/OB7812g3nz8LOYWVbHEh0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Young Xiao , Jeff Kirsher , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 208/258] ice: Do not enable NAPI on q_vectors that have no rings Date: Mon, 28 Jan 2019 10:58:34 -0500 Message-Id: <20190128155924.51521-208-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Young Xiao [ Upstream commit eec903769b4ea476591ffff73bb7359f14f38c51 ] If ice driver has q_vectors w/ active NAPI that has no rings, then this will result in a divide by zero error. To correct it I am updating the driver code so that we only support NAPI on q_vectors that have 1 or more rings allocated to them. See commit 13a8cd191a2b ("i40e: Do not enable NAPI on q_vectors that have no rings") for detail. Signed-off-by: Young Xiao Acked-by: Anirudh Venkataramanan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 3f047bb43348..db1543bca701 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4333,8 +4333,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi) if (!vsi->netdev) return; - for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) - napi_enable(&vsi->q_vectors[q_idx]->napi); + for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) { + struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; + + if (q_vector->rx.ring || q_vector->tx.ring) + napi_enable(&q_vector->napi); + } } /** @@ -4817,8 +4821,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi) if (!vsi->netdev) return; - for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) - napi_disable(&vsi->q_vectors[q_idx]->napi); + for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) { + struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; + + if (q_vector->rx.ring || q_vector->tx.ring) + napi_disable(&q_vector->napi); + } } /** -- 2.19.1