From patchwork Mon Jun 10 23:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692542 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 604A1481C2 for ; Mon, 10 Jun 2024 23:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060854; cv=fail; b=c8jO3jV1DvvXIGTSW/DAFZbtddTfZh6/EQzyM6pPvfpNa3obQ5wn/aCZZ2hj7iF+l6/oNB2HEp/klqrYQWmGhR4aEdHHye6cgjvUIJeJmtVWUKIOQbE/jEdqaDp7jenNj6NvKUUyRU3TAnzMROrP8WqdBA1rOvi243xL+1+uGVY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060854; c=relaxed/simple; bh=dKxapnrhdowmoxQ8IMw7OSglZc0+2X717VriuOsZweo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=r7pDdUbbxk/VMuxzTF9snIT6xBnPPz56O1CrqnGRbsccHCYwXaATjZ4gLvpjxG27OFxcdRdZXOWZj0FCI6E4C5H5mOyQpFI9OheSc1sNE4yQSIHacSHmE5wG5uhO16/3I7Ub2UefDwkFYGbU1GhZVREISZwKcdG+/eemNv0aX44= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=uyy7C1Hk; arc=fail smtp.client-ip=40.107.94.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="uyy7C1Hk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mt8PPM6Ky0BUv34B1NOLza9I06iGsiEZCE82P+TcVy5UfhV8Q2NQka+ERLLxoqFORLxfNzTxlHUpxX9mBYuqPPPdhTaXv6LqtWjj9i4AEu9mIL85KknU/Qk3YhF/1Tg7QFcmnXx6iYM+zTx8sxWU//VUFEGVClYHehARTUAQ74WsUCd+PMREWg8fz5FuXt+KQFTey+uLeOpqI6EePpU7gqe9iwiRliwcjFvjYT2kwmxTZkpMy0WXtzjQv05EgfZsS+rxfMpvX6AfITdiESN9clXjc19Hrz0Th/s4DD26DiyBzju79xSfhHmlx2wl8sBsIbBgDEPy+r+dZrzlLqW5fg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xKn9K+x9Z5vBF+EYyrlxoR/ajVU9EgIpu9/tZ8owzWY=; b=UPxebPuZH0AM5Udz16h7yjqH8MyKnDpYE98pLCh+PAHcM9twVj4raG9Su+vUlAVVJthrcmVLg+qsM2OlmgsVDKcyrUMkwsBBFAWYk4zB6FvpbmxE6IbnAQkCQgQgwA0o+keNnAHl/uOD5SAiDXXX5XTtbyGHIJgznET1/RCOZGuWkYC3hB6GCLg5XR62F5ZApJtP3aIYPxp6b2iDoykfD1uqhFocuI4EAt3ZZKahheCPIB4uozAlxKjq3bWICBgWtEjmOvITXyTYV46h7vG/v/awu8S94CgbWCmUPyeIPHQN1nCePZRMCf9WRrTPKK4ARJi12hcL5dryap5kLYV9ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xKn9K+x9Z5vBF+EYyrlxoR/ajVU9EgIpu9/tZ8owzWY=; b=uyy7C1HkHYxRtQJnzscjDTzzd75AyKjhROsF05WTFLZ0FNrirPO4LMIX/muAEzct9Qs1DvFfXXPgzdTs3SSGnvwQoqzQHGNfQ4ivmqWD3fYNwbyU3TaG6cYfq/LqS52w34XHdkUR1TIYG81b/XbGiiQy+xd7ytAzfCD0b8ZxBzA= Received: from DM6PR11CA0030.namprd11.prod.outlook.com (2603:10b6:5:190::43) by SA1PR12MB7224.namprd12.prod.outlook.com (2603:10b6:806:2bb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:30 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:5:190:cafe::c4) by DM6PR11CA0030.outlook.office365.com (2603:10b6:5:190::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:29 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:28 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 1/8] ionic: remove missed doorbell per-queue timer Date: Mon, 10 Jun 2024 16:06:59 -0700 Message-ID: <20240610230706.34883-2-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|SA1PR12MB7224:EE_ X-MS-Office365-Filtering-Correlation-Id: 313d1165-76bd-4bad-f6ee-08dc89a21a42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: nVrdZ2bqz95ArmHMbYvd7MPI8YotMIJUYDHnJOR5lk2pJfo8ntDz4K2Crcqyhv6MtBmPdQuuDIxVw7PGsKmfgoC0nXGnvU5JzKfjhwRxlrL4cUBqQniHQmqaAdxQWZJYExD+Fiy/97wSn+DgEHZJPvE+NQ2R048xiZDOYeamwnoQQC47dZyfaei76KQpaylEBaTKbGV6riSJwiyBAKjTI9X7Jbl0Czap4GxM6fatEWe4Ef9MufOjwqS6I5wso4tZ0obmb3GPls6c3no/L2QoHmarTMD0njOrWKjnb3eTpDnFTsn7NtcIL+tnj2UOhh+JDWowsaZP3dLqer5QdzG4s2mrANcUn013ZMzfv2GBieMSuAh6fJFZT8f8HYuVPP84yIc06ffJolXIR7FwE3LRiFCi1/BT10hKmolgk9EuoiQmj2BxxonSE8NskZ6vgaPcT8ngmgI64yuorMsbeHjlYBsbcb9NDMHzHNY9PM7EWD42rAPseFNcd171xOCAwU8GPMNS9PleTTmp1XGMbswpzQKmjsuw7T0lYdlp/BKAm3X2ePbuWHpPw6bRdQF+4w4kVYJ51mh9mT3Bk/EgXKgNLV18l8tUG+pseePc3SzyEs7OtMN2Gqm7xVPR6Z0Rh7vguvfpkWeQnHde00D5gVcHZfceXmJtx2jGMNGO2ieklB38NkBohxP+1OjwXNVKsr94nEwHpyVBIqRxqvNxMWj4OkGqQOQXUxMccSPeNEaXNaFoeHhIl+RvNKPhcMEnQhV8U1TSEaZxDEgoP01+5Zkf2pmoUqsBMGsGYBlMGrF067KhUSyQHHOWiqEd2I6lcE1kU16TTLRKjkCrR68/WthRLM6EVZY4ZGzx6OLC/uExP+3nM7TBIeq1YU0f/l5HV68ag8wWrZNMuhZM9CR0fWLLaN7l0NoxmI76f1S0H4Wr3hGnghr0pJTbRtVHM45y9A01XO5yFSErK7YcoS+1iarzkZY2s35aQV+H1ch6azF2TNorYQ+1BfRKOddh/WgDX56RuuC2vzII18nYfkxsY/bxfrsnRiUyTz61huYjymDeB9Hr2j0c8Vt9bAPkmOh30AJVNTx03Kzl8HJCb9BTSKEo0ZPk6zm6b2MP0cOSBb3TeTKZRtUntWbGt6LLSnm3gP9B043oazApzgLs0c+o9CZJ5I+oEdwk7e4BMNMJh9lv6ad19cwKSihKbbxUvL6pewgmTOt6c7c9DM4jRR+eo3pcXhbsbkx55yaiU9KdJK7ClYg4V2oZhMfYODGQj1j01BWHey1wf78iW0HEQjuRukqYCLp6Q0r2nPBNlQ7M3HFSHxVOUVqVHZmznR0bWQdSAyF2AGKy8hgsn5QryJe8NkeEUgL/NGVUpIZU6vgnzzilnYfP2tviaOP5BGhvWl7WkDofT1juhyMhV9iyPqYJGwIS3Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(376005)(82310400017)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:29.6977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 313d1165-76bd-4bad-f6ee-08dc89a21a42 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7224 X-Patchwork-Delegate: kuba@kernel.org Remove the timer-per-queue mechanics from the missed doorbell check in preparation for the new missed doorbell fix. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_dev.c | 4 --- .../net/ethernet/pensando/ionic/ionic_lif.c | 36 ++++--------------- .../net/ethernet/pensando/ionic/ionic_lif.h | 2 -- .../net/ethernet/pensando/ionic/ionic_txrx.c | 22 +++++------- 4 files changed, 15 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 874499337132..89b4310f244c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -703,10 +703,6 @@ void ionic_q_post(struct ionic_queue *q, bool ring_doorbell) q->dbval | q->head_idx); q->dbell_jiffies = jiffies; - - if (q_to_qcq(q)->napi_qcq) - mod_timer(&q_to_qcq(q)->napi_qcq->napi_deadline, - jiffies + IONIC_NAPI_DEADLINE); } } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 23e1f6638b38..48b2b150fbcc 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -213,13 +213,6 @@ void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep) } } -static void ionic_napi_deadline(struct timer_list *timer) -{ - struct ionic_qcq *qcq = container_of(timer, struct ionic_qcq, napi_deadline); - - napi_schedule(&qcq->napi); -} - static irqreturn_t ionic_isr(int irq, void *data) { struct napi_struct *napi = data; @@ -345,7 +338,6 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f synchronize_irq(qcq->intr.vector); irq_set_affinity_hint(qcq->intr.vector, NULL); napi_disable(&qcq->napi); - del_timer_sync(&qcq->napi_deadline); } /* If there was a previous fw communcation error, don't bother with @@ -480,7 +472,6 @@ static void ionic_link_qcq_interrupts(struct ionic_qcq *src_qcq, { n_qcq->intr.vector = src_qcq->intr.vector; n_qcq->intr.index = src_qcq->intr.index; - n_qcq->napi_qcq = src_qcq->napi_qcq; } static int ionic_alloc_qcq_interrupt(struct ionic_lif *lif, struct ionic_qcq *qcq) @@ -834,11 +825,8 @@ static int ionic_lif_txq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) q->dbell_deadline = IONIC_TX_DOORBELL_DEADLINE; q->dbell_jiffies = jiffies; - if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) { + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) netif_napi_add(lif->netdev, &qcq->napi, ionic_tx_napi); - qcq->napi_qcq = qcq; - timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); - } qcq->flags |= IONIC_QCQ_F_INITED; @@ -911,9 +899,6 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) else netif_napi_add(lif->netdev, &qcq->napi, ionic_txrx_napi); - qcq->napi_qcq = qcq; - timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); - qcq->flags |= IONIC_QCQ_F_INITED; return 0; @@ -1168,7 +1153,6 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget) struct ionic_dev *idev = &lif->ionic->idev; unsigned long irqflags; unsigned int flags = 0; - bool resched = false; int rx_work = 0; int tx_work = 0; int n_work = 0; @@ -1205,15 +1189,12 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget) ionic_intr_credits(idev->intr_ctrl, intr->index, credits, flags); } - if (!a_work && ionic_adminq_poke_doorbell(&lif->adminqcq->q)) - resched = true; - if (lif->hwstamp_rxq && !rx_work && ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q)) - resched = true; - if (lif->hwstamp_txq && !tx_work && ionic_txq_poke_doorbell(&lif->hwstamp_txq->q)) - resched = true; - if (resched) - mod_timer(&lif->adminqcq->napi_deadline, - jiffies + IONIC_NAPI_DEADLINE); + if (!a_work) + ionic_adminq_poke_doorbell(&lif->adminqcq->q); + if (lif->hwstamp_rxq && !rx_work) + ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q); + if (lif->hwstamp_txq && !tx_work) + ionic_txq_poke_doorbell(&lif->hwstamp_txq->q); return work_done; } @@ -3504,9 +3485,6 @@ static int ionic_lif_adminq_init(struct ionic_lif *lif) netif_napi_add(lif->netdev, &qcq->napi, ionic_adminq_napi); - qcq->napi_qcq = qcq; - timer_setup(&qcq->napi_deadline, ionic_napi_deadline, 0); - napi_enable(&qcq->napi); if (qcq->flags & IONIC_QCQ_F_INTR) { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 08f4266fe2aa..a029206c0bc8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -84,11 +84,9 @@ struct ionic_qcq { u32 cmb_pgid; u32 cmb_order; struct dim dim; - struct timer_list napi_deadline; struct ionic_queue q; struct ionic_cq cq; struct napi_struct napi; - struct ionic_qcq *napi_qcq; struct ionic_intr_info intr; struct dentry *dentry; }; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index c3a6c4af52f1..3066eb4788f9 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -867,9 +867,6 @@ void ionic_rx_fill(struct ionic_queue *q) q->dbell_deadline = IONIC_RX_MIN_DOORBELL_DEADLINE; q->dbell_jiffies = jiffies; - - mod_timer(&q_to_qcq(q)->napi_qcq->napi_deadline, - jiffies + IONIC_NAPI_DEADLINE); } void ionic_rx_empty(struct ionic_queue *q) @@ -952,8 +949,8 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) work_done, flags); } - if (!work_done && ionic_txq_poke_doorbell(&qcq->q)) - mod_timer(&qcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); + if (!work_done) + ionic_txq_poke_doorbell(&qcq->q); return work_done; } @@ -995,8 +992,8 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) work_done, flags); } - if (!work_done && ionic_rxq_poke_doorbell(&qcq->q)) - mod_timer(&qcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); + if (!work_done) + ionic_rxq_poke_doorbell(&qcq->q); return work_done; } @@ -1009,7 +1006,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) struct ionic_qcq *txqcq; struct ionic_lif *lif; struct ionic_cq *txcq; - bool resched = false; u32 rx_work_done = 0; u32 tx_work_done = 0; u32 flags = 0; @@ -1041,12 +1037,10 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) tx_work_done + rx_work_done, flags); } - if (!rx_work_done && ionic_rxq_poke_doorbell(&rxqcq->q)) - resched = true; - if (!tx_work_done && ionic_txq_poke_doorbell(&txqcq->q)) - resched = true; - if (resched) - mod_timer(&rxqcq->napi_deadline, jiffies + IONIC_NAPI_DEADLINE); + if (!rx_work_done) + ionic_rxq_poke_doorbell(&rxqcq->q); + if (!tx_work_done) + ionic_txq_poke_doorbell(&txqcq->q); return rx_work_done; } From patchwork Mon Jun 10 23:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692544 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E23161514C1 for ; Mon, 10 Jun 2024 23:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060854; cv=fail; b=HhTDOl3xWgPBTYhfs+rOvAIOHCmxWx2RZObMQI4wowF+YZoiYFZiXO5WsHKPGJ2VqPaAyxz8iZynrlW9z2rD6HhrqtLPka1QCyojL0xPEYgqD2fHZPJ1w3IiRrR1wnJgAPksT+ZH0M2NzoWdjh1CHBU6/Btd9KyrySc0XEMD/mM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060854; c=relaxed/simple; bh=k3JXNLpsL3VjhJh6PEdaUo2wqY6Ng/RhyNLcUrPvFt0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c9DSOkdjrgNb+148PnPr+2Er5B5FsT5ScVUTdOcE2RWNoNK4Q+XPUEsJj3upCDKr4YWK1pCDJqyynyv5vPxB1adgzGB7BoacdR8EV1egT7eIN28Md1uqoFrzrR1J43f7gD1D8QREVW4CgF57Ch6k+mYWs1/6LTi4gJTm8nCNA8M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=rCC7zLAh; arc=fail smtp.client-ip=40.107.94.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rCC7zLAh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VfQzD3t1tFZ9P2vyA8vgtg6MxcXFLc6g79s+CloGfpu8ohNB8yTK2BOOfmcHLy69S+0CKyEaUhCj14eF8TBijWoTHDIE7WXowXFbox1xPstGsAD1ESlgSym3db8+cmxMxAQHrkwLr/EwqzhqAT5vmHKEx1xknmQYqRhswZ9KRbQLbnPLwDnjggzXkNbyYhvZ8HkfkJVwKlfsIW1vt2l3MvxbLhyBLsWTZ/MSjKgfjUhmCKNPfiSo2QiLHxSRfZfYy6hDVb71plN38dcuOdzkqa21ZJs1V4xJLZ1baDOsTw9G0TEZrkblTn4sRgG6zxj9ZrMMOlzHxTRjruTLSiexEg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jgNyzCvUN5vvcMoEtMlZWFeiAdZfRPpKm1zVNnSTrf8=; b=eVptxEmki9OLtaKGR9+hqeUEWYxgx/LhX+mCXyrmOWltwLJla+GyxwtPlTxhaeUS86HEyzkvmHPofo5ptrLwXZMngPNEPCx4BgtrQdMdhB1rW8MWEOA7eAZJyffmM49ub+u7+BmFCeYeaDTTBTtjPcsqRDURE0rYv3TLh5cKrWRa87ZGuZPA0sa+H1Cu8UWs7x3OxCnKwnT+uLe31ZkA4YlNZML8rReYIcbTjFEwxVuyo+IhI8vEBAsfe/z6CPu6+3nc5aGmuqWNIORO2J9BjEiOXVa/VdwEeh65SFOeRB+Tb1Z2AK1nCXIj/M090pSgAjiD75CMSdGz3a14gv5uJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jgNyzCvUN5vvcMoEtMlZWFeiAdZfRPpKm1zVNnSTrf8=; b=rCC7zLAhEbuZzSRBk0nxyIIfh8fG/K4r+CaDOEvJa54rSngTG5ms4vffs9dOQpwVT1AoT60+cAaqzfeNBkxtIDGbGPbLIjT6ECt+VJwG5djZevvdxjA7/3sPPouC6soryDdbKhB/87Zsw0MBOSbp+aGQm0L0fwXtSYYFaF8tx1w= Received: from DM6PR11CA0020.namprd11.prod.outlook.com (2603:10b6:5:190::33) by DS0PR12MB7629.namprd12.prod.outlook.com (2603:10b6:8:13e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:30 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:5:190:cafe::ac) by DM6PR11CA0020.outlook.office365.com (2603:10b6:5:190::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:30 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:28 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 2/8] ionic: Keep interrupt affinity up to date Date: Mon, 10 Jun 2024 16:07:00 -0700 Message-ID: <20240610230706.34883-3-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|DS0PR12MB7629:EE_ X-MS-Office365-Filtering-Correlation-Id: 218c342c-a0c9-40d5-19d7-08dc89a21aa7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|376005|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: QKunluBQk/+uv3eek2PDSrZIT3rcUcnycLaPhD+bo3FZqXHgv3L6MKfZ8odIRjeDabGb7JEK4a21jjmU1sASG+AFILafaDx9VqSM6MBFKW/DWhcv+y0XlDvTcEDwXrdikbyDTgPnRZUOId6Zkiq65qOB9FFZ4q+vM7GdBNW2wD1xzjZxGPCgFgZUneu4+pUEsz+W6DRpxogFIKMmOtAnIJlNQTGFDwryE12BIvhick/yZkdOMH9NH2eH7KZKov8g4ehI51nqpLgDp0iHZkgJG+ZQ0o5cXZrPzOsBEwmo6miXXLe9R7t4txISgvrHFDWvwRYBxrw5H/lKaNG0w05/c6qsXuHKnWoXcWYmidxBdTXHhVGnzc+r/qg0x9Sx2UJJiw5KIHV2SMIQidzTo/f9LQF18OftXvzy7VXAjBMjHj6+WYZmRjyau7KDvt70K0vDNa7L5ANZHJjmUHfhl5n56eMFFFM7dvVjBbxSOPl8gmlNtlPVEyBlyXAB8TAPY6XodwVs+ILPjMjrkMqiAhJjt2pPeUJPyw8xUqmvsQ7doGR5+Ra7zevA/RpUVEdQo6S7gvog0v/1tuvtmvbUni0bfGZ+mHvbzAwOedzyOtGyOC1UUYpaTEvB2PmqGDSZFRGqK4QH3kXmGrhBsp97Sb2/8LG+rK4s45Bc7xIESb+eCBL/20RBWiHiPtU+LyJGJCI4yLuNd8+bGl2C/qO5zsRYXmANuBTYEzoGUzbA6s8oX5gLaJe1vDyVlnY4jw2zLk3xT/9yhP6F4iyqDyaFcGY4JeXZtvgBOlrxyFgQKr1Zt75zagUKWFRBkdRoKAaDyyz2up83lzCBrcXWSADIYTeLYoykCcVMo7aIOWYtRbrcYnI6slBY8VdSPcdLP75iCvn628zeoetx0w63R3OOl6kxrvDE2GdBjg1g70abChphmC7xRzFpUl71oVw2g/hXtzVX3WXBAilJYZpAjnX9nIh8MFrl0sAfybV0gkPOmElHmmkWblpP8KJ9MIaqtLgX0AaEFAC7d5tpz5k+ijt8Z31mEeoPe8kU3yPtkM6cNtF7AJ16WS43FAlsU6AuUhfT5vZTPQxBs+a64KVoqPS9wgMRUJBYdXXtyQEX6QCjz5CCwtTnAAD12L7WhdQMQ9CG9m+9vLwwXbVM7ybBmLQ9nf5MfYUybCbo7DkBm8ccMiCDO9aDb8qUtLOHwaGYeRiMcFUOclrjpv7zwULtLdDXFfA2fyf7zWJV3fThlB5Th/opc4+2JD46wXUf05nfDXwiTwRMwPEL9PRl/3AOlckhqU1229TzGhTQy1tqiWDnxIaJ33wr/IL3Ljj9Xu21agNL9Gm6XjpjwM3IMEnsBqYkM7VHccTB2xgQ6DkrGqOtzCzsocjYf72qiAudITq0ZQ0uGSz29auOsrIQdlbWdph0K6V+sA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(376005)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:30.3540 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 218c342c-a0c9-40d5-19d7-08dc89a21aa7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7629 X-Patchwork-Delegate: kuba@kernel.org From: Brett Creeley Currently the driver either sets the initial interrupt affinity for its adminq and tx/rx queues on probe or resets it on various down/up/reconfigure flows. If any user and/or user process (i.e. irqbalance) changes IRQ affinity for any of the driver's interrupts that will be reset to driver defaults whenever any down/up/reconfigure operation happens. This is incorrect and is fixed by making 2 changes: 1. Allocate an array of cpumasks that's only allocated on probe and destroyed on remove. 2. Update the cpumask(s) for interrupts that are in use by registering for affinity notifiers. Signed-off-by: Brett Creeley Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic.h | 1 + .../net/ethernet/pensando/ionic/ionic_dev.h | 4 +- .../net/ethernet/pensando/ionic/ionic_lif.c | 85 +++++++++++++++++-- 3 files changed, 81 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h index 2ccc2c2a06e3..438172cfb170 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic.h +++ b/drivers/net/ethernet/pensando/ionic/ionic.h @@ -54,6 +54,7 @@ struct ionic { unsigned int nrxqs_per_lif; unsigned int nintrs; DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX); + cpumask_var_t *affinity_masks; struct work_struct nb_work; struct notifier_block nb; struct rw_semaphore vf_op_lock; /* lock for VF operations */ diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index f30eee4a5a80..7dbd3b8b0e36 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -280,9 +280,9 @@ struct ionic_intr_info { u64 rearm_count; unsigned int index; unsigned int vector; - unsigned int cpu; u32 dim_coal_hw; - cpumask_t affinity_mask; + cpumask_var_t *affinity_mask; + struct irq_affinity_notify aff_notify; }; struct ionic_cq { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 48b2b150fbcc..ff6a7e86254c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -265,6 +265,18 @@ static void ionic_intr_free(struct ionic *ionic, int index) clear_bit(index, ionic->intrs); } +static void ionic_irq_aff_notify(struct irq_affinity_notify *notify, + const cpumask_t *mask) +{ + struct ionic_intr_info *intr = container_of(notify, struct ionic_intr_info, aff_notify); + + cpumask_copy(*intr->affinity_mask, mask); +} + +static void ionic_irq_aff_release(struct kref __always_unused *ref) +{ +} + static int ionic_qcq_enable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; @@ -301,8 +313,10 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) napi_enable(&qcq->napi); if (qcq->flags & IONIC_QCQ_F_INTR) { + irq_set_affinity_notifier(qcq->intr.vector, + &qcq->intr.aff_notify); irq_set_affinity_hint(qcq->intr.vector, - &qcq->intr.affinity_mask); + *qcq->intr.affinity_mask); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_CLEAR); } @@ -336,6 +350,7 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_SET); synchronize_irq(qcq->intr.vector); + irq_set_affinity_notifier(qcq->intr.vector, NULL); irq_set_affinity_hint(qcq->intr.vector, NULL); napi_disable(&qcq->napi); } @@ -476,6 +491,7 @@ static void ionic_link_qcq_interrupts(struct ionic_qcq *src_qcq, static int ionic_alloc_qcq_interrupt(struct ionic_lif *lif, struct ionic_qcq *qcq) { + cpumask_var_t *affinity_mask; int err; if (!(qcq->flags & IONIC_QCQ_F_INTR)) { @@ -507,10 +523,19 @@ static int ionic_alloc_qcq_interrupt(struct ionic_lif *lif, struct ionic_qcq *qc } /* try to get the irq on the local numa node first */ - qcq->intr.cpu = cpumask_local_spread(qcq->intr.index, - dev_to_node(lif->ionic->dev)); - if (qcq->intr.cpu != -1) - cpumask_set_cpu(qcq->intr.cpu, &qcq->intr.affinity_mask); + affinity_mask = &lif->ionic->affinity_masks[qcq->intr.index]; + if (cpumask_empty(*affinity_mask)) { + unsigned int cpu; + + cpu = cpumask_local_spread(qcq->intr.index, + dev_to_node(lif->ionic->dev)); + if (cpu != -1) + cpumask_set_cpu(cpu, *affinity_mask); + } + + qcq->intr.affinity_mask = affinity_mask; + qcq->intr.aff_notify.notify = ionic_irq_aff_notify; + qcq->intr.aff_notify.release = ionic_irq_aff_release; netdev_dbg(lif->netdev, "%s: Interrupt index %d\n", qcq->q.name, qcq->intr.index); return 0; @@ -3122,6 +3147,44 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, return err; } +static int ionic_affinity_masks_alloc(struct ionic *ionic) +{ + cpumask_var_t *affinity_masks; + int nintrs = ionic->nintrs; + int i; + + affinity_masks = kcalloc(nintrs, sizeof(cpumask_var_t), GFP_KERNEL); + if (!affinity_masks) + return -ENOMEM; + + for (i = 0; i < nintrs; i++) { + if (!zalloc_cpumask_var_node(&affinity_masks[i], GFP_KERNEL, + dev_to_node(ionic->dev))) + goto err_out; + } + + ionic->affinity_masks = affinity_masks; + + return 0; + +err_out: + for (--i; i >= 0; i--) + free_cpumask_var(affinity_masks[i]); + kfree(affinity_masks); + + return -ENOMEM; +} + +static void ionic_affinity_masks_free(struct ionic *ionic) +{ + int i; + + for (i = 0; i < ionic->nintrs; i++) + free_cpumask_var(ionic->affinity_masks[i]); + kfree(ionic->affinity_masks); + ionic->affinity_masks = NULL; +} + int ionic_lif_alloc(struct ionic *ionic) { struct device *dev = ionic->dev; @@ -3213,11 +3276,15 @@ int ionic_lif_alloc(struct ionic *ionic) ionic_debugfs_add_lif(lif); + err = ionic_affinity_masks_alloc(ionic); + if (err) + goto err_out_free_lif_info; + /* allocate control queues and txrx queue arrays */ ionic_lif_queue_identify(lif); err = ionic_qcqs_alloc(lif); if (err) - goto err_out_free_lif_info; + goto err_out_free_affinity_masks; /* allocate rss indirection table */ tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); @@ -3239,6 +3306,8 @@ int ionic_lif_alloc(struct ionic *ionic) err_out_free_qcqs: ionic_qcqs_free(lif); +err_out_free_affinity_masks: + ionic_affinity_masks_free(lif->ionic); err_out_free_lif_info: dma_free_coherent(dev, lif->info_sz, lif->info, lif->info_pa); lif->info = NULL; @@ -3412,6 +3481,8 @@ void ionic_lif_free(struct ionic_lif *lif) if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) ionic_lif_reset(lif); + ionic_affinity_masks_free(lif->ionic); + /* free lif info */ kfree(lif->identity); dma_free_coherent(dev, lif->info_sz, lif->info, lif->info_pa); @@ -3489,7 +3560,7 @@ static int ionic_lif_adminq_init(struct ionic_lif *lif) if (qcq->flags & IONIC_QCQ_F_INTR) { irq_set_affinity_hint(qcq->intr.vector, - &qcq->intr.affinity_mask); + *qcq->intr.affinity_mask); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_CLEAR); } From patchwork Mon Jun 10 23:07:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692545 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEC501514C0 for ; Mon, 10 Jun 2024 23:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060855; cv=fail; b=l3SQQbasgNOfJrfC69kPRM0cFr0awN6D9ppgtTzyTs7j6YbmzxWHGiNtmK/SNZiuzcohZ9OSfobsAGnfyShEMP4avJAa5dFQTkJpN1ashzyXu67iJGU6Ef280jJO4Pdj60uECejp+axAxYnWvohdKXEDkAHg7o0/+u3SJaVHNpg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060855; c=relaxed/simple; bh=lGevOxzgSHDUBrv1WmzTp5XoSm82wZrs0XCPRA1VgW8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mXSFgtfOKLSlFD8aoSIGbyuMTyljyuZbOpmorBLHWCLi9k2z0NmJA3ZR2s9mxVSPG0ziVSEe1vbxcEVwZR3Z6eY2nEet4mFUZvY2uu3WVRHSJeB7o9n86vcJWw3ckFvdYba0OrdHPP1zEVOKDu6Og7HabV9OuvaCYjqinOsmYP0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=MK+pBVFs; arc=fail smtp.client-ip=40.107.220.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="MK+pBVFs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eU5B+eepK32dS27oVglTyhP0MgAxBKEod660503L8c6d0FnllVVmbpMOciikVdqhaatkm3LBiPpWehCj9iVuBVXUWKmE0gQ+4qBfXH4LW/w/WE+rtzjZrLrfesf4NjgOtbv5Pk06Q8VyZWcwx/wQzf+Mdov/i6TXEiyn63QLfJntspkhVJzcgAN5fyFFoTxW8Sstulqw5218l79zWDxqQDZeoPnSNqVvdnUU/4je+H57iYxqhgPOZMzRaqAqpyPS4pMPegX0JgUAk8oPUGGNIH5QiIVu/KPxOBmJSlxcWNPIJijIQ8EzsNs8aUJZySyLkXxdrjcBMkNMciwHfPZHmA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aNAFByucoup3ugeuW4Km+KzUTLZr9/lGitT7gTetok8=; b=ERAn0G+j8KfCfTqPz6LgNQUjxWR1Iu0LI3pQo1B9+k0H1MCGpCACc18rvHgyUDG5jsNpyL0d9vfl3+tZKkXbiuaTY5ZlQicXvumITTtJAOmK8ikWM0u5DGIsFdHSKhmerXguGrMDxhR6kG0EToBdA8XI/kYalwW071ZXMcj5lf6SZQqADIqsTHv2wvzKG+S5QdEVJfPzl9GX4N5w4+17kesuGKOwO8On1lC1xBqGJ94o7A1wC+Tml6kOhnyTal+4XBg3VnsQhKjrW/D6bXj0lM3ytWtqoYmd8gTLnwilARXfXoD8cmzMcS26+9Ee1gOEcMA8NhgKWJE2SPKCJoE8Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aNAFByucoup3ugeuW4Km+KzUTLZr9/lGitT7gTetok8=; b=MK+pBVFsrLLFpBJlyNJ9Uy/YAsYdLTU8v8yYBc3/GNclAlcBqojQLMJ+BNPmZsneFvBzUWGyvGTgIr9dXe55iyMyD9eVI/7ZIZPAhwchUzi2JUz6dfcsqoD/xMuQjo17t+YBXX2r/ukvJtGAX8MzQLOA16DONZm9D6v0FOV+LuI= Received: from DM6PR11CA0025.namprd11.prod.outlook.com (2603:10b6:5:190::38) by LV3PR12MB9144.namprd12.prod.outlook.com (2603:10b6:408:19d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:30 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:5:190:cafe::9e) by DM6PR11CA0025.outlook.office365.com (2603:10b6:5:190::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:30 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:29 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 3/8] ionic: add private workqueue per-device Date: Mon, 10 Jun 2024 16:07:01 -0700 Message-ID: <20240610230706.34883-4-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|LV3PR12MB9144:EE_ X-MS-Office365-Filtering-Correlation-Id: cbec1f68-80b4-469d-792b-08dc89a21ae7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|1800799015|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: gPlI68YQ/5OteIfDYhFpgk8QaB9kdR9Cg+XOiPmOYH8zQC0uyLKja4T6yGLEgyrmtO2L4LmDL1heNwgVW2VLyUa8CF6aV/ClD0QX9qKrFdOZw/Ows3SlKFH2qxaw8Zr2wVcTrS+4DMbykhLm+yKehRFE7pIARz7Xp4KsIxbaGpFQBsqvAi0ef1fdr0HBRzyBCJLcRERsTUy7MBHGMwlLUygSL5Bobnfz2XMWWJdby8P0hpbbW88NEZPZk4AlimoPVenqjcsP6r4V1LGwZKU0XTQGExvQYt03o87dy2jm3brQ21TEXE0aoZnLXL3O63XtTXG9tG9CzPrQsa2gJ088P29vmIQlSyjRHFEEq8eK2I5YwU40MvKp/XSxgD46PogGOOPzDn0VmAidYVjqmTonph90x8xkW8kIhHq4KUFB+VPGvarWHsgh+aqaowCzb/RWEGZNqlGl2AkLhMSpE8J3uwr4LT5ymqAFwNak7Gh+h5qFe4QOnG4I2wHdXCUaVnpeffUwFEMB5LG3aZmPBCIYUf8KgWJ14unuSN5aLRGAqSsItrmcUY064qkTpSM/Mpac5TIUS1aX9OMriAiMqVOPQx3sfxFcEufJ3OEkhQqjO0nIGGPgJCmfL8/aIA3oI83CV23huw0ohuDQZzklDqll7SEYuIqDrlsEzbf0k5IPooA2BPjsVUNi1SpO+3FCvOX9e1wVGGUqaymr6EwCf1FjdfoafZ5Db0Sa56tuffhGU+85vKc24b3ZTHkF+BBoC8PwV/9qDYvhLfhgIrhQJSqmgaLA4Wda6LQyWAnPeihcvU3js0wyeL+hUcYNAiJU39aQBNF6GLMEUro+ve4/A7Hd2PxJkDUhm6K4ZnlZqchmHH0hU1AH7gVYtLWE9Tmyy6vOC+KRZYAGcpqBbY5p+XL3N2XoOr9wwDcnZLRYJeE5cbU+KDhhw9e7h/eDtq2m+laW5qDqZ/tkqvluev52cgkhX3hSH/ARzUqJt5yXGsiEv4/P25/OEl2/5bVi0cQLZ7uS2jpKH1rhZreVHtMDDQxIWAWV10bnvd5Pyb5t69aHkDzQqWLcsmGvpQXsE+dBA9GsFeSoTra/ZqqX/VN1uzDudzNfF7b+u8VD9UnjaU+QCDAFickkRc7qUAxRb+5PFDs8zknlNeoAgYjo+LZHHLKIgtxl86rjNgB0Y2LJqa9Pt1I7U5Z7+Jd3zhdlLdqERCtVtEZC4XsgUbegtkp+cgCz6pJaRatthzV0+Ys5m31F3WWnlv09vBiWL5ipKyql97rlKvu94Mpr7SyZA+1ItesQL+kj5fwOI8QjoDhWzrA3Jh6S2M66OydHHmh4/vQ5psVd1WZgfcX82CqH48JSGoUqUWDz6zAi+48ANPQW29BPJoAZFg/E7jG67V9UYB5GMYwLV/3SrgugWnXE3WGTrhDRgQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(1800799015)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:30.7758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbec1f68-80b4-469d-792b-08dc89a21ae7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9144 X-Patchwork-Delegate: kuba@kernel.org Instead of using the system's default workqueue, add a private workqueue for the device to use for its little jobs. Signed-off-by: Brett Creeley Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic.h | 1 + .../net/ethernet/pensando/ionic/ionic_dev.c | 21 +++++++++++++++---- .../net/ethernet/pensando/ionic/ionic_lif.c | 14 ++++++------- .../net/ethernet/pensando/ionic/ionic_lif.h | 2 +- .../net/ethernet/pensando/ionic/ionic_main.c | 2 +- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h index 438172cfb170..df29c977a702 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic.h +++ b/drivers/net/ethernet/pensando/ionic/ionic.h @@ -47,6 +47,7 @@ struct ionic { struct ionic_dev_bar bars[IONIC_BARS_MAX]; unsigned int num_bars; struct ionic_identity ident; + struct workqueue_struct *wq; struct ionic_lif *lif; unsigned int nnqs_per_lif; unsigned int neqs_per_lif; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 89b4310f244c..342863fd0b16 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -43,11 +43,11 @@ static void ionic_watchdog_cb(struct timer_list *t) work->type = IONIC_DW_TYPE_RX_MODE; netdev_dbg(lif->netdev, "deferred: rx_mode\n"); - ionic_lif_deferred_enqueue(&lif->deferred, work); + ionic_lif_deferred_enqueue(lif, work); } } -static void ionic_watchdog_init(struct ionic *ionic) +static int ionic_watchdog_init(struct ionic *ionic) { struct ionic_dev *idev = &ionic->idev; @@ -63,6 +63,15 @@ static void ionic_watchdog_init(struct ionic *ionic) idev->fw_status_ready = true; idev->fw_generation = IONIC_FW_STS_F_GENERATION & ioread8(&idev->dev_info_regs->fw_status); + + ionic->wq = alloc_workqueue("%s-wq", WQ_UNBOUND, 0, + dev_name(ionic->dev)); + if (!ionic->wq) { + dev_err(ionic->dev, "alloc_workqueue failed"); + return -ENOMEM; + } + + return 0; } void ionic_init_devinfo(struct ionic *ionic) @@ -94,6 +103,7 @@ int ionic_dev_setup(struct ionic *ionic) struct device *dev = ionic->dev; int size; u32 sig; + int err; /* BAR0: dev_cmd and interrupts */ if (num_bars < 1) { @@ -129,7 +139,9 @@ int ionic_dev_setup(struct ionic *ionic) return -EFAULT; } - ionic_watchdog_init(ionic); + err = ionic_watchdog_init(ionic); + if (err) + return err; idev->db_pages = bar->vaddr; idev->phy_db_pages = bar->bus_addr; @@ -161,6 +173,7 @@ void ionic_dev_teardown(struct ionic *ionic) idev->phy_cmb_pages = 0; idev->cmb_npages = 0; + destroy_workqueue(ionic->wq); mutex_destroy(&idev->cmb_inuse_lock); } @@ -273,7 +286,7 @@ int ionic_heartbeat_check(struct ionic *ionic) if (work) { work->type = IONIC_DW_TYPE_LIF_RESET; work->fw_status = fw_status_ready; - ionic_lif_deferred_enqueue(&lif->deferred, work); + ionic_lif_deferred_enqueue(lif, work); } } } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index ff6a7e86254c..af269a198d5d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -126,13 +126,13 @@ static void ionic_lif_deferred_work(struct work_struct *work) } while (true); } -void ionic_lif_deferred_enqueue(struct ionic_deferred *def, +void ionic_lif_deferred_enqueue(struct ionic_lif *lif, struct ionic_deferred_work *work) { - spin_lock_bh(&def->lock); - list_add_tail(&work->list, &def->list); - spin_unlock_bh(&def->lock); - schedule_work(&def->work); + spin_lock_bh(&lif->deferred.lock); + list_add_tail(&work->list, &lif->deferred.list); + spin_unlock_bh(&lif->deferred.lock); + queue_work(lif->ionic->wq, &lif->deferred.work); } static void ionic_link_status_check(struct ionic_lif *lif) @@ -207,7 +207,7 @@ void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep) } work->type = IONIC_DW_TYPE_LINK_STATUS; - ionic_lif_deferred_enqueue(&lif->deferred, work); + ionic_lif_deferred_enqueue(lif, work); } else { ionic_link_status_check(lif); } @@ -1391,7 +1391,7 @@ static void ionic_ndo_set_rx_mode(struct net_device *netdev) } work->type = IONIC_DW_TYPE_RX_MODE; netdev_dbg(lif->netdev, "deferred: rx_mode\n"); - ionic_lif_deferred_enqueue(&lif->deferred, work); + ionic_lif_deferred_enqueue(lif, work); } static __le64 ionic_netdev_features_to_nic(netdev_features_t features) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index a029206c0bc8..e4a5ae70793e 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -331,7 +331,7 @@ static inline bool ionic_txq_hwstamp_enabled(struct ionic_queue *q) void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep); void ionic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *ns); -void ionic_lif_deferred_enqueue(struct ionic_deferred *def, +void ionic_lif_deferred_enqueue(struct ionic_lif *lif, struct ionic_deferred_work *work); int ionic_lif_alloc(struct ionic *ionic); int ionic_lif_init(struct ionic_lif *lif); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index c1259324b0be..0f817c3f92d8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -287,7 +287,7 @@ bool ionic_notifyq_service(struct ionic_cq *cq) clear_bit(IONIC_LIF_F_FW_STOPPING, lif->state); } else { work->type = IONIC_DW_TYPE_LIF_RESET; - ionic_lif_deferred_enqueue(&lif->deferred, work); + ionic_lif_deferred_enqueue(lif, work); } } break; From patchwork Mon Jun 10 23:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692546 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2079.outbound.protection.outlook.com [40.107.236.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAA621514F3 for ; Mon, 10 Jun 2024 23:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060856; cv=fail; b=eT1hakLPK2JEbopW/xiC//lTW3OO/M7JrMSrh3c+Yird57yep3mvZKPrqNUx5HunC+q6UMjxOx032yjeXoyPHPt5682SCRuHHzjfRt5gpxxC2eLVNyRrHzUWeWzOzvj1tKg/SaYoLzhlXYRrxOpBezEkCFvtNp7r7lVHGMaWPpw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060856; c=relaxed/simple; bh=C3vb9qP8XoqKqsZ4RJhcGKRW/jWM6CtDVd17hWpbheQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YwTzaXPgyYydQTINoUJO3b0cF5caRrzYj/DacyK91U0q7Bci08xVddkxVUhHp3Xrz46UgSUB3BH1++Ggk2AD6pv90mok8HIFU0aK3rRhv5c0sTk+bF762zLLT7YXZsR3/LTrW3ff/4udj/ex1RIceI1AZP6aRqNCuQMZLwRLTAI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=o0Aq86Y7; arc=fail smtp.client-ip=40.107.236.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="o0Aq86Y7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HEBP9x1kecLkSEiGod3mqqhwn8v1ioijvEe0b+f6dYkyF8GT7E+bPeAq8WFU9wXynbYloI8FKNoBGmI6pjfGZ8f/9zQagiQGsbrBPcBzOWD+PQ+Zw1bSmhsI0SYMI97M3GpQ/bZ25oHFb/MjVj40ybCGxUoH/vAllMmFPd7y9ioSVkPLWvAgvJNlvrcBmMy7uvmq3VvPUJbD/Ik3pcLEYDbcAFqPM2Y5BdefrQSWxA9JKQk6e5BZw2nDJwABUrfYpqhDOOxklo4zr7aH0dz6OajPjmasXCON0ppwkuYZlvsqJ94JHwjCrazv7TyPStfcGbp7VBdu1APxzFPIc3eoXw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XOIn3sn61pPxzNwZS6rZ19Cd6wuDn07swvzwibtitok=; b=YRy3tG41oGJAvx+pFK5V2Nsr4o9O16tAgPwWheo8rIT3Z90gPUjcAbeCMBE1sG8meyy6L12foSN2nUMVhLbDEcCHG1f1tOj8lEWjMkOd0Aajk0CpGvkAmZyu1i6Y0NlexDgOKtWRLysT5RaJXK8GzOfayZmDzVjDV/6YJ+AaAdROPUK8Krc43tFMhG05ajMO4LR0tPduADXzpUClQlzydAubVR9Fd4QsQ1RSlE37wEd+drC8ufCXYtYKdYZ4zen+2QdjIIW/FPEc4JiWIn/P5LQngeq/2N16XUJUItP4FwETBjH8cA2PjI/8J+2h1Co3Mg8INhzAzGCWeqwn3ZEEEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XOIn3sn61pPxzNwZS6rZ19Cd6wuDn07swvzwibtitok=; b=o0Aq86Y7P0yqt020MEt2M6ZhHmvmzw09oQFMrdwOqZXA5Eii0kT1AZGnRzNgRBqCZsRrufzdwGC/JcgWr1LvpQTNFolUB9EBB4tPz6PTVe0ZIzFLW9hAs97C59g/Xf7omgkIq8izKIinP0JSQcWFlpEmGJ3BdLTwhYr7HGpV9fc= Received: from DS7PR03CA0284.namprd03.prod.outlook.com (2603:10b6:5:3ad::19) by SN7PR12MB7418.namprd12.prod.outlook.com (2603:10b6:806:2a5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:32 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:5:3ad:cafe::ba) by DS7PR03CA0284.outlook.office365.com (2603:10b6:5:3ad::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:31 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:30 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 4/8] ionic: add work item for missed-doorbell check Date: Mon, 10 Jun 2024 16:07:02 -0700 Message-ID: <20240610230706.34883-5-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017097:EE_|SN7PR12MB7418:EE_ X-MS-Office365-Filtering-Correlation-Id: a782c336-37bf-42a0-880c-08dc89a21b76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|376005|36860700004; X-Microsoft-Antispam-Message-Info: JwmTK9901lRXaKad71XTxTPo2ufdakT/3tKU0LmlOAJzhl3g52SpgJYwfx9mdF0YqYitiNNIV0SkBzoSnJGgjPFCx8vypBQmEqjnX5u9GNrQhoYB3NeVD5qlBUpTE+nJcY/dZ88zxWk6lG6I5VyD5L1BCEVYXUVQIbr2tKqR2Be7ypxcbWe2kQtN3thvAYjDDAMIQ2OBFaf5GDOpWG1z5CdGXRN3NFK1dbWeowXJy3vWjAR/swUbZHKse/1UPkYqhpZUfZxhM8+J/qsQcGga0z9Gy3X9I9Dij5qHFC4v8KMSZJRQAFs0ssRA9niAS1XeGXou6LMqSJWLhFA29gol4xvDxcidXbnG3Y6h3jcELmPGry8caY27KS926THCm6d8i6X9T4rwFEFYc6wx1jypgmB2Vc9p7t3M3eTceyxP8IMHPVaNDc5S7Ieoq+kXcGPCwKWKeABQIWh9IBIZW028tHb9r9OcbnFye161v2a7wm5i0kg157KcTwp6euPD3BqErsqeMu64vMhgxV0ziS6ZGatGR/AcNa0uzMx8De2UgMtlhKOObwGXwdZP2HGaOPjQavcIRFsJvhtbeJfWa1lr8gFOBN/78ufd0vj/2vTGAnnnifbqD5QyMYmlby/gugBXf0zTL/osthcOnp6r13bSJR+0Ti3yUPDt/hIQBp/OjiEA2zYEDyLwxoIcSlIVqf79p9n/awmdFisjKvMGwfVPASy9/Pd7dfyS7MQWBymr/DEbcUMbM3eAAfvDfWXmrrUUzF6Ni4XNfmeu8PQvXXvFS/Vt9yza0tMcMpD0MnJBkTFvtPyqJGnfdz+fNhCUIxevk2v8R5MPe6ggcsl5fyV6xLe4ZuH3C4gabVHlMyM0mIyrzmTT7sVy29UGJdBjZOQX/8OJ6GBFI0eeyTKI5O/enpOlF8qWF36U5Cu3JoVAyTwmrlAaFKIoetftX3Pqh+GkwDEvL7U2D7C6NGOB17pq/SoQSOqdFYhTvIzb9a8MvB2aUeMJK4zWUJGU4F3cbfmSno+10wT0IqgZur0+l2rj2XfbuCqOrBGJRAAHfs+q5tdlQ0wM85AjMqoDj7pd51WLzPzcubr4YiCiDTD3u+VKWGlD5Fj/psSonAcdjyX/lzyzHDc5Vqs4FbDtVOl2Kc6XixcB9d0xw5x0bPRb0rwr6X+SUmkBZByW6AbKOoBLaxM1ZZSM3DIZtq615jrUeVZQTA3MiPLq7xg0bRkVaLRnB2fMjFfxAsKG6zccCJW+AwCMD7Z/1dC71PD3BoMMKacCFISdHADupiO4+dlumvdXDbFtoUbz0Kaj1tpM5haSQ5F8nD8TtIq7S+MdcZ5ehbhlWSj1HqewiyR17fLMrchuqCIisgPUOUAIK2X+PAhBWEjWIAu07GacsyKhs6RwfMv270H7y9h5y4y4LXqqn7awLg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(1800799015)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:31.7134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a782c336-37bf-42a0-880c-08dc89a21b76 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7418 X-Patchwork-Delegate: kuba@kernel.org Add the first queued work for checking on the missed doorbell. This is a delayed work item that reschedules itself every cycle starting at probe. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic.h | 1 + .../ethernet/pensando/ionic/ionic_bus_pci.c | 1 + .../net/ethernet/pensando/ionic/ionic_dev.c | 65 +++++++++++++++++++ .../net/ethernet/pensando/ionic/ionic_dev.h | 3 +- .../net/ethernet/pensando/ionic/ionic_lif.c | 3 + 5 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h index df29c977a702..106ee5b2ceff 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic.h +++ b/drivers/net/ethernet/pensando/ionic/ionic.h @@ -56,6 +56,7 @@ struct ionic { unsigned int nintrs; DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX); cpumask_var_t *affinity_masks; + struct delayed_work doorbell_check_dwork; struct work_struct nb_work; struct notifier_block nb; struct rw_semaphore vf_op_lock; /* lock for VF operations */ diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index 6ba8d4aca0a0..a6a6df6b7304 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -372,6 +372,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mod_timer(&ionic->watchdog_timer, round_jiffies(jiffies + ionic->watchdog_period)); + ionic_queue_doorbell_check(ionic, IONIC_NAPI_DEADLINE); return 0; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 342863fd0b16..30185ac324ff 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -47,6 +47,60 @@ static void ionic_watchdog_cb(struct timer_list *t) } } +static void ionic_napi_schedule_do_softirq(struct napi_struct *napi) +{ + if (napi_schedule_prep(napi)) { + local_bh_disable(); + __napi_schedule(napi); + local_bh_enable(); + } +} + +static int ionic_get_preferred_cpu(struct ionic *ionic, + struct ionic_intr_info *intr) +{ + int cpu; + + cpu = cpumask_first_and(*intr->affinity_mask, cpu_online_mask); + if (cpu >= nr_cpu_ids) + cpu = cpumask_local_spread(0, dev_to_node(ionic->dev)); + + return cpu; +} + +static void ionic_doorbell_check_dwork(struct work_struct *work) +{ + struct ionic *ionic = container_of(work, struct ionic, + doorbell_check_dwork.work); + struct ionic_lif *lif = ionic->lif; + + if (test_bit(IONIC_LIF_F_FW_STOPPING, lif->state) || + test_bit(IONIC_LIF_F_FW_RESET, lif->state)) + return; + + mutex_lock(&lif->queue_lock); + ionic_napi_schedule_do_softirq(&lif->adminqcq->napi); + + if (test_bit(IONIC_LIF_F_UP, lif->state)) { + int i; + + for (i = 0; i < lif->nxqs; i++) { + ionic_napi_schedule_do_softirq(&lif->txqcqs[i]->napi); + ionic_napi_schedule_do_softirq(&lif->rxqcqs[i]->napi); + } + + if (lif->hwstamp_txq && + lif->hwstamp_txq->flags & IONIC_QCQ_F_INTR) + ionic_napi_schedule_do_softirq(&lif->hwstamp_txq->napi); + if (lif->hwstamp_rxq && + lif->hwstamp_rxq->flags & IONIC_QCQ_F_INTR) + ionic_napi_schedule_do_softirq(&lif->hwstamp_rxq->napi); + } + mutex_unlock(&lif->queue_lock); + + ionic_queue_doorbell_check(ionic, IONIC_NAPI_DEADLINE); +} + static int ionic_watchdog_init(struct ionic *ionic) { struct ionic_dev *idev = &ionic->idev; @@ -70,10 +124,21 @@ static int ionic_watchdog_init(struct ionic *ionic) dev_err(ionic->dev, "alloc_workqueue failed"); return -ENOMEM; } + INIT_DELAYED_WORK(&ionic->doorbell_check_dwork, + ionic_doorbell_check_dwork); return 0; } +void ionic_queue_doorbell_check(struct ionic *ionic, int delay) +{ + int cpu; + + cpu = ionic_get_preferred_cpu(ionic, &ionic->lif->adminqcq->intr); + queue_delayed_work_on(cpu, ionic->wq, &ionic->doorbell_check_dwork, + delay); +} + void ionic_init_devinfo(struct ionic *ionic) { struct ionic_dev *idev = &ionic->idev; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index 7dbd3b8b0e36..d87e6020cfb1 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -28,7 +28,7 @@ #define IONIC_DEV_INFO_REG_COUNT 32 #define IONIC_DEV_CMD_REG_COUNT 32 -#define IONIC_NAPI_DEADLINE (HZ / 200) /* 5ms */ +#define IONIC_NAPI_DEADLINE (HZ) /* 1 sec */ #define IONIC_ADMIN_DOORBELL_DEADLINE (HZ / 2) /* 500ms */ #define IONIC_TX_DOORBELL_DEADLINE (HZ / 100) /* 10ms */ #define IONIC_RX_MIN_DOORBELL_DEADLINE (HZ / 100) /* 10ms */ @@ -386,6 +386,7 @@ bool ionic_q_is_posted(struct ionic_queue *q, unsigned int pos); int ionic_heartbeat_check(struct ionic *ionic); bool ionic_is_fw_running(struct ionic_dev *idev); +void ionic_queue_doorbell_check(struct ionic *ionic, int delay); bool ionic_adminq_poke_doorbell(struct ionic_queue *q); bool ionic_txq_poke_doorbell(struct ionic_queue *q); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index af269a198d5d..a04d09b8189f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1193,6 +1193,7 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget) if (lif->adminqcq && lif->adminqcq->flags & IONIC_QCQ_F_INITED) a_work = ionic_cq_service(&lif->adminqcq->cq, budget, ionic_adminq_service, NULL, NULL); + spin_unlock_irqrestore(&lif->adminq_lock, irqflags); if (lif->hwstamp_rxq) @@ -3408,6 +3409,7 @@ int ionic_restart_lif(struct ionic_lif *lif) clear_bit(IONIC_LIF_F_FW_RESET, lif->state); ionic_link_status_check_request(lif, CAN_SLEEP); netif_device_attach(lif->netdev); + ionic_queue_doorbell_check(ionic, IONIC_NAPI_DEADLINE); return 0; @@ -3506,6 +3508,7 @@ void ionic_lif_deinit(struct ionic_lif *lif) if (!test_and_clear_bit(IONIC_LIF_F_INITED, lif->state)) return; + cancel_delayed_work_sync(&lif->ionic->doorbell_check_dwork); if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { cancel_work_sync(&lif->deferred.work); cancel_work_sync(&lif->tx_timeout_work); From patchwork Mon Jun 10 23:07:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692547 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D951C15216E for ; Mon, 10 Jun 2024 23:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060856; cv=fail; b=SEiz5SEI1e9ZQwllb9kb5xgOAA/QoyM/8MxLf5MI7DlGLy/oiaFbn17dEuJ4aEz75ZEnzME4hdD5hGR4eCCVaG3DeVdZOiGNkeVoqokihPfp11i08jcGIMSU+HN/mKs/BczdadsJfsyC08WTEOuNbyFdWphLQNhgvqOGkryDjcg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060856; c=relaxed/simple; bh=/cTdyX4v7mu7R4joFmb77I3eoMXOk8K2wTK+H9SL7IU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h23KnSHFvxWSB6az0UBXanO8VE8ENpBLcTz+ZQfaAtnsWVaQIiyfBuEKQUkUGKxG6hgijkDmpIDpLBLrkkxxwi1+3k//mrMWZ61R0xv0LuHs5aGNh+6eQiVoORwpn8AqcbTETQDa4AncRaPv4m4YpZNXwVU17HRzLBvdPkT8nY0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=LOdqKnKC; arc=fail smtp.client-ip=40.107.243.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LOdqKnKC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=noGzP2NFUrTpo8KFW7shP4e+eJEtXEDTlYpOpJKX5zBihbEc9H0QWtiPGb/Q9bJch1pnaEe7X9nlw7UDr0KN8fNALPHc8CfexGdKy03MGGOqf8NYMNdp6MTN9EIsouhutv96+7G/VcTbdbUdSRDkw8yrWJlfjZoPJW4IEfGHyi76Pg4QrhZ782cFGdutADo9ZJKrcpDbDZMBN3CSccX7yqSeZFztHCxdK3vD8s2K2CUpr0n3Q37uWfNiD6778/+59MN5kZtGhyhV9qYlAkN3efFVYtJLMdiDKMFmbGCYa+LpRUJwowV+wN94b/rKn6vINkms+3og7DljENR//MnR+A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q78fPIwboFPtDs3KLxExyqPMnVBsMwVO+0t3C6yvLd4=; b=QYkzOuilmdioYpL5daYDZaymyB5NNi6+Tw++Wc7WQjWKh9iBnHWazKAOlAvPP/hugmk1ZRcO6QPZLcmCaW40Or8OnaiIV5J4JfoIYtv1wkPOF6ODbyArs2+gJEFtA+pM+1Zzx5Tm9zPfxn96ZNMc+Ljgk+u+XLKRilbrkhNPfTrRtmGfUwnC7MwrVzpDGICApNI4TsRKinOsIWvdYnVam+NvwKa5cdtpJ0e6KvVp6k3k9GzGB+pstE7/VGkr1zQqEPeTxoY4WXqCz+sHi0Mu6BIH4LUwJbGl5tHTN80hkN3D4cGJxcneruWdby6xvZEwpFeJruKFpUbEo0wHCvEstA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q78fPIwboFPtDs3KLxExyqPMnVBsMwVO+0t3C6yvLd4=; b=LOdqKnKCFdD5KU30gioEnm9nNTZ0YKaGk8P/akAFHbRW14x4VswPjCV7DNn6QCtY4ktZ93qsTKllkA4EkSvL8oXBVoPQC2dRPiM8q51aA7kOuKOoH8gy5wUvLMQLkSefV/xDlqb8LaytFZVz8Biy8m+nmXFU5mVV35BXim4J1Jk= Received: from DS7PR03CA0293.namprd03.prod.outlook.com (2603:10b6:5:3ad::28) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:32 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:5:3ad:cafe::75) by DS7PR03CA0293.outlook.office365.com (2603:10b6:5:3ad::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:32 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:31 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 5/8] ionic: add per-queue napi_schedule for doorbell check Date: Mon, 10 Jun 2024 16:07:03 -0700 Message-ID: <20240610230706.34883-6-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017097:EE_|SA0PR12MB4495:EE_ X-MS-Office365-Filtering-Correlation-Id: 654a476c-8ab7-41fa-d255-08dc89a21be1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|376005|36860700004|1800799015; X-Microsoft-Antispam-Message-Info: lifuoLGlAEEySRIgNy+fvCwseyfYJGaB8DScPBfeAJZamvmX/RPiS9Ktax+0LlaEy1Wzrz79Lo/5Q85eJUgtIpMEKRwnC84mFsI1OWep5jAxzfDjHiUeeccoh2LKznB9rjjRsMlC+EzEMfTrYHtEnWbegFfs9nXCJu3G+l7dPOST8mbAK7/UhogBjE50Asvhpqy6yMZRGeL1T7B6/jCbFMARQJeGBE+v+JDYMZxOfY1fFtiW65mVplPQVTHNYmYuxfCnS48CIuJEfYA3iGgaKt+ig37HWZieAJ4wXmT4eNjZGH03mNhVMSPQMEBkIwv2m6hElHx3/i3lL+e/eBfpS0Gz46c+qTO1B5o+ftUDrMmp/BFgqo0lDL6UD5KyH0CYHs2T2GtKbZVbGbxbvD9v9NSREMzS+7coSXDNTGZET7OiGE9pKsgL+m72VsGk/pbU6EWhQuiybpLfo2H5ozMb9pfZkrcJC1pjZ9Leb7F4ReIBK9Z5a4CXG6PfLL3tIEI7DtB3IqQVj2RrZFnF5qBVYUGm8tGF6SPOrQkLC21UVDH+pvHkLjv3hdK2ens2uuqNDA86DOy+DLF80d6pKKzuXy2Y6WUQ9zMXfwabafAZSRXwr2MJT1sGiLMHiTo236QIaAI5Wbb5H3cgpL6xejPuvVo4HIUNAAp+eb8DxVpSTDuGGdlripWQMMufGAMiTYVVD41UyACYQXP916FUWKFWFGAVwz7i7rYkr0adFThihzrRse7Tfk3+lGOG7sctdZgOSyRlc1khNCCaELVmWjrcAAfb2ztXq4qmPHEWDaYpDUhY2ovu9Fx+joxf73Ps81ARWL5obhACpZEVEo7IIWSNFGuMlPuQvlGENE0IwCTaFGzCNU4A+vXWEcjprzX7IRLMcYc+pmOKf+r0x2y77/zIUhVxm8TKH2avboNHAwYvaTdACdg+kAyJ2CD607utYtAVGFIZaMIAURMdV3HFWfXipIFPnftf5cxSH8ZgGSY2q955y+6NuA6alAF2IyYfxoVu3MCwnUpqmUYDen0xnRDaZG9nHKoTPmTM+QcmPb+4/6MoCqLvn5s54BRxcTpWq1DhAbsRE1E82DlYDXBq8Lb+nBkEsf1CmhVU2d+yM+hnAijBolt83IdJjQSAuZHNhNqvmMCW05MGtQJS0NehGybgRtjGaigKnqDrHkS+LQP3UnGQBARgKqu7YRYaaZEIv82LlMSS3PfQyXFBwarEleOexsIX/77aKSpBamXD5c2OaGhyV8rTQ51VLF0TtLB8tzY09do4s/CrD/jgXSCnHkQQ/y7PsZd8g53uER0hdE+pgOHJLSbDNL8236x9k6u7uZn0hWeTM6SqyIzf1gCH9AgxN20DMcmzVLCULFaD4JHIy8q+qC26OFmDIUNUTQP3HvW1FEcZk3TpKEVShI8+A1Bmhw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(376005)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:32.4165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 654a476c-8ab7-41fa-d255-08dc89a21be1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 X-Patchwork-Delegate: kuba@kernel.org Add a work item for each queue that will be run on the queue's preferred cpu and will schedule another napi. This napi is run in case the device missed a doorbell and didn't process a packet. This is a problem for the Elba asic that happens very rarely. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_dev.c | 23 +++++++++++++++++-- .../net/ethernet/pensando/ionic/ionic_dev.h | 1 + .../net/ethernet/pensando/ionic/ionic_lif.c | 2 ++ .../net/ethernet/pensando/ionic/ionic_lif.h | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 30185ac324ff..a5a4dc21b9f3 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -56,6 +56,13 @@ static void ionic_napi_schedule_do_softirq(struct napi_struct *napi) } } +void ionic_doorbell_napi_work(struct work_struct *work) +{ + struct ionic_qcq *qcq = container_of(work, struct ionic_qcq, + doorbell_napi_work); + ionic_napi_schedule_do_softirq(&qcq->napi); +} + static int ionic_get_preferred_cpu(struct ionic *ionic, struct ionic_intr_info *intr) { @@ -68,6 +75,18 @@ static int ionic_get_preferred_cpu(struct ionic *ionic, return cpu; } +static void ionic_queue_dbell_napi_work(struct ionic *ionic, + struct ionic_qcq *qcq) +{ + int cpu; + + if (!(qcq->flags & IONIC_QCQ_F_INTR)) + return; + + cpu = ionic_get_preferred_cpu(ionic, &qcq->intr); + queue_work_on(cpu, ionic->wq, &qcq->doorbell_napi_work); +} + static void ionic_doorbell_check_dwork(struct work_struct *work) { struct ionic *ionic = container_of(work, struct ionic, @@ -85,8 +104,8 @@ static void ionic_doorbell_check_dwork(struct work_struct *work) int i; for (i = 0; i < lif->nxqs; i++) { - ionic_napi_schedule_do_softirq(&lif->txqcqs[i]->napi); - ionic_napi_schedule_do_softirq(&lif->rxqcqs[i]->napi); + ionic_queue_dbell_napi_work(ionic, lif->txqcqs[i]); + ionic_queue_dbell_napi_work(ionic, lif->rxqcqs[i]); } if (lif->hwstamp_txq && diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index d87e6020cfb1..92f16b6c5662 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -386,6 +386,7 @@ bool ionic_q_is_posted(struct ionic_queue *q, unsigned int pos); int ionic_heartbeat_check(struct ionic *ionic); bool ionic_is_fw_running(struct ionic_dev *idev); +void ionic_doorbell_napi_work(struct work_struct *work); void ionic_queue_doorbell_check(struct ionic *ionic, int delay); bool ionic_adminq_poke_doorbell(struct ionic_queue *q); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index a04d09b8189f..be601183deff 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -346,6 +346,7 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f if (qcq->flags & IONIC_QCQ_F_INTR) { struct ionic_dev *idev = &lif->ionic->idev; + cancel_work_sync(&qcq->doorbell_napi_work); cancel_work_sync(&qcq->dim.work); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_SET); @@ -692,6 +693,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, INIT_WORK(&new->dim.work, ionic_dim_work); new->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_CQE; + INIT_WORK(&new->doorbell_napi_work, ionic_doorbell_napi_work); *qcq = new; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index e4a5ae70793e..40b28d0b858f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -88,6 +88,7 @@ struct ionic_qcq { struct ionic_cq cq; struct napi_struct napi; struct ionic_intr_info intr; + struct work_struct doorbell_napi_work; struct dentry *dentry; }; From patchwork Mon Jun 10 23:07:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692549 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA7251527AC for ; Mon, 10 Jun 2024 23:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060862; cv=fail; b=aU9p9vzPAg6NmxlZtFxtXlu6OuepdmZAu76znNUKomo9o/9aOeYiT6lBd8pSwrhoPhA4Z54STK1Ug5HdvaCGLpr/qPawDZ2bau+U8bNFkU+e6Kl/3kkHqgVaXCaBSlkx2060tPNlqcmMYyqjE3H7+Q8G04yUGTXJSrNNiBria/s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060862; c=relaxed/simple; bh=5sB3CxUDmaaUAuSYh5D97XEKHROPVNs8AmsPJmf/+Wc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H+H+Qru93422x6jlbD1DlRMeG9UvEqCywXsBe/Li9S6JrEQGWuU2UJsAwhR5pc9P/loOE56BqP2c78W15Wbg6xU8/IpI6VlUwTLJdtTbQsRXXRYhfM2JjuQ25kM+taTtG7ofcAlHgW3BP1dTYmS0+o1t/hcElGNUfYx46JfTsBI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=CmzvVKt+; arc=fail smtp.client-ip=40.107.237.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CmzvVKt+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDLq51fuBpF2/k0P058PY4NMirWb0fFAAYLNRMNBmcVfF61EBxq06ZrkKcn8v3IqVA+5mOYeZ/ll0VREhhsSEVuHl3qld5nf7hGcXluaeFntdytj6dCoKG6wzXqXY59JlgH59K0r3EeETDuITREoj7H4XhZDNETsj+xa31zXJDvKDd76GmgUbKGUCeSbVOiMZqcezcKx9JjG1/7WOGuhq+eYUt9xSa5eBniUoLYWb/5WIkkzymLZxPXHsx1VDRKsEXJEtSYNL63dyEURavb6otb5523TayI0DBA4WyAkVb06iFqGEaiMDWcwGCq5H9p6I0UGzV8w7qUZoqcVpJbBmw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f8LFdBwLNkkIc+Jt1O/jE3YCpb8bveIk9X0+cT6vdU0=; b=IytJR4uLdtrg32hDjCHFeizApSAFe5e1HbvGGGCRoSx7h5N8Ebg0noTys6YhhyVS6emjD9hlejKdl/PtDJhIVSEvlP1un1IlPaf8r94X1gmGEyQ45v/3WsSsUoBXtJHaFeF9BzjigJV6Jp+NoY92Mm3OLvLLZsGuaCu09inMjviJv8bVYc9JKJzFxqUEkywyOS+d1BJhfLGVbcjnHIKmWdunjwXWZLDkcrP+KdAy8WBBBNlIDQU51a0Oij+EyLWQ7jPTHWN9bYFBVxS3FiEKa73vVL2HZpVbzjj7zG6fLy3JLdV6oDZFqVJpX4WxHpKQHPwOU2hshbapOkmZyTfH6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f8LFdBwLNkkIc+Jt1O/jE3YCpb8bveIk9X0+cT6vdU0=; b=CmzvVKt+pTPQ1/3SqrCZDPdwhSA78zNqCUuEIqEUzPLIGxpjV9pX63xwHFFxs/WxreoKYb3D2aDAezhpcUDUGgt6Qdt410b3KoTTGmBYjZDgeCq4ruUHLmnY4gZC7NgIE91waU6p1U20A3VhnBtPaWus7aEMBNuc2GBWX/uqdYA= Received: from DS7PR03CA0283.namprd03.prod.outlook.com (2603:10b6:5:3ad::18) by SN7PR12MB7934.namprd12.prod.outlook.com (2603:10b6:806:346::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:35 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:5:3ad:cafe::96) by DS7PR03CA0283.outlook.office365.com (2603:10b6:5:3ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:33 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:31 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 6/8] ionic: check for queue deadline in doorbell_napi_work Date: Mon, 10 Jun 2024 16:07:04 -0700 Message-ID: <20240610230706.34883-7-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017097:EE_|SN7PR12MB7934:EE_ X-MS-Office365-Filtering-Correlation-Id: 86a7c073-ff19-4f1d-cdfb-08dc89a21c3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|82310400017|1800799015|376005; X-Microsoft-Antispam-Message-Info: 1O+fS1B2vO8czqnchbTmTsEloL4PNzUFuHw1U4DFCi9oV8jnkR2uXc9FNxnmbY4CyNszLbJb6hlmobC7lihQy7c4Il3gSZUMu4Bcx4dzYL6fwc+Gn66Y1CsWhq10Pa6CDvs+XvubT9Qjr1Mbv1qYju36qots7uJFSTskVQxnjzWj9gxCtlBZynvxgnXeLw/HdfQ9+by5i/KiAM2BQy+AGuG175oliThGz/4IadgUrPHEulR/iefQa2HRUcw7f/7bPVDkYrC/2bxtgQJvRUSd2APm0+jRQEbc/jQqWWD1wmY+uXGPIXbmYNU7qTi8643HQJ8embpA9U7sjF7z+DJvfoBsBUc7yU3gAoi3HzEGWbH6OvQ1bAqFnz60BNar84H0pA02Yz9/xEZ6NPO3l3xDYSzuN+QY8639yxEMQ57vIXLJrzQNkWf/bg4Rok8hjaSfXRYeLwELJMLhS6JwiJIV0a92so+Td/GseFraXtpExqvCPdPM6vlKp/gGH6eYo/PHrxxADJK8r92UNC+IrPOjjnXMEbvsqNU5do8V1z74VlD6U2dNzuL9rubydEO+D5PTcWGEHNMLDQFM3Lj2j9PJ+HnKXsc8AAu0q2nvSOr112NI3LWlOV27u5mPUTY2YrOvg3AOWD7BzVFR9FEiyPo5Jlr8XeC9R78hakad2f4kljg69uZYUPq4tjy4V66Ke/6IT5nlVItYWVDXBToJDewkb/jtfZ5HGr0KVJgZ3wMISvf8TsvU/l+NdPOs2nKkgX8yLxOI1k6PN9VwoArUx1EvBRVvGBLPEMC9lzous3sYGbF/17O5t+ezmXYAGMFoVH41M0QPdALPM2Y1HqeKjP5LIG//K6dFzLlu7cuHQ/cxAhasIee2bw/PeSIW4LmP5Ru1+VxT1HEw4fSDGsnlgjHw4H9t6PabvESLHI8sUeYmooI0E4uu3zogoWvXBLklMtX2O87GQVcxg0NAkR/ch3eDCUefHratOVsYiZ06Sbs+3PQeVdBuSBhX6J/uQyvst7BFVFklkMUl/hI86Ylvx4NBUDmGzAqZCI0oQf7BM6wwvA1Jwz4gsvc7T2DPjacG3srV4aS1B2B2ZfIiIfBwA83neXJWsQGGo5pED0UFeWVDKjFfbErkxYMDZqlqsMg0B2NCaiXggJwE7lW+Npl4uP+00WmBcPPyRA83gAwY6Vk2T25Wpf1Sa3tP2lIIUiduaaGq9a0KDmP+sxp0iLTmuZP0oK4zW2yyKsEnd1aFAACjW5ENXi2gQArRdp2ZBsCxTNq0tAAmNhCz+Mzq6cbOoE+eSPCqXlZxMuqqnzuzmFgPLeWV7aS6ZJ9RP7H7mu19JqkZEtFMILX33jMP26dxmdCrBKuKRSfMWdJZiR31ebGbvIskcVPSbdvCHtbqo4cxGj0qEQHBrd3xbGI3/9+PHY9bng== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(82310400017)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:33.0259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86a7c073-ff19-4f1d-cdfb-08dc89a21c3e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7934 X-Patchwork-Delegate: kuba@kernel.org Check the deadline against the last time run and only schedule a new napi if we haven't been run recently. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index a5a4dc21b9f3..f3f603c90c94 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -60,7 +60,14 @@ void ionic_doorbell_napi_work(struct work_struct *work) { struct ionic_qcq *qcq = container_of(work, struct ionic_qcq, doorbell_napi_work); - ionic_napi_schedule_do_softirq(&qcq->napi); + unsigned long now, then, dif; + + now = READ_ONCE(jiffies); + then = qcq->q.dbell_jiffies; + dif = now - then; + + if (dif > qcq->q.dbell_deadline) + ionic_napi_schedule_do_softirq(&qcq->napi); } static int ionic_get_preferred_cpu(struct ionic *ionic, From patchwork Mon Jun 10 23:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692548 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2063.outbound.protection.outlook.com [40.107.95.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC50F15279E for ; Mon, 10 Jun 2024 23:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060860; cv=fail; b=C5w3IdOvtxHAs/jMbujbRbNiLykrTMx6OKthD64brx3aZOVisOxhAMqpcPEpf2iBtY+UONDmurW0DbEOeaBrhtqTH70s3RjQ0Og1dIrANWbbYfWBymdBqwu6JFsM5cQiZO2m3z0ppDuLi7vK6rVQID6o/syxLWnOVvH04bobDIo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060860; c=relaxed/simple; bh=7NPfARyBD6T7EJzXjt7Kt+Us8wC4SS0xczGyNzja5Uo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F4zmuxeokeuLOIiMnzXq5IFBusAz/IOMePurc0+uqvQArJhOXlmeKi5gqQ9Bou1T4P2v/m/FFgIIqGKtFVrezwp+CTEANwqTd780U247dbcElUlEmBeDKd3bDdaIYhVTsF7Xj3YyJAOC9ucGj15gFC7lwkF1Utt9h0tWvSYQysU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=1gsZ0OE0; arc=fail smtp.client-ip=40.107.95.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1gsZ0OE0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjUGLESvwvGsa5i2iqLCHT3O/w9zmE3nWPAg4WFBucUyEH/zqdGMfZhp3yqUBStgLZPJxne9mpXmg/uGrmRXGZIxx8O3rhVmqrnhwqqUVcvEJ+2PJKjnn3pkNEUNgFDUfncfsV8BblT2f2BtsACISppYTS6cii/8F7c6829B2wNxc7Af06Kafi8lWQ1+O6hxAl6j49HiMKT9HeTcW/QTlRO8IbluQI25/zxj4A9VfCshGNmZmainZVusiymBIw2i+bF64jdgG8AeNmyXAxdG6RXcCt95eYl82OARi4qy/Cf1X8ssrrS6FHht0Cwu40q0ECPloI+Yc6EjXJPKVCJR9Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nuDYLNzSJiVivAy7/PO2pTERKnr2k64XVRKdiLO3mzA=; b=lsMozywiGgVvKiyWZU0PLvVCj1hqGjxkeiwkrc6MIBukKZKNjFjmO/jdPKHQc0McSBREY7wlGvPH+biei2+XqO9+cQB3SVBnlMkSlyW7uCy9OqxjjN/Grn2ysa5e7NPMQwJGErSVfim6+v/HGUzZAUw0NHkWyRdq9CMOpABKPlfk0ICvPIwz70tmICpwEAomuURDfZRt/CU5MEdRdgztJgJzfYHwn7b2XU4ExhDjgami3x3sSxyCbgcmH1CqxSwouZ0460uzVhyvt7UOrKHmGnZO01M1nEooGIo+hSpZqRyGvpiVo14H/AJOsniiR9S/CHlAwpR9KPS/kehFFhwM9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nuDYLNzSJiVivAy7/PO2pTERKnr2k64XVRKdiLO3mzA=; b=1gsZ0OE0vQaGui6WEAhvuuMRp8nu4/AqLKpcz6gxyh097E+uNNGbQ2PejSOM1NXabg5trpebWbuU0yyDQxu7XNba263FL4yFA40kXZd5OkDG3vcFBWVToB8uhBLwjngHEtSXEapKaAr3mHcvvN79tWaA1uNmnWhPC2yPuUOsGHs= Received: from DS7PR03CA0287.namprd03.prod.outlook.com (2603:10b6:5:3ad::22) by SA3PR12MB7974.namprd12.prod.outlook.com (2603:10b6:806:307::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Mon, 10 Jun 2024 23:07:36 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:5:3ad:cafe::af) by DS7PR03CA0287.outlook.office365.com (2603:10b6:5:3ad::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:36 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:32 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak Date: Mon, 10 Jun 2024 16:07:05 -0700 Message-ID: <20240610230706.34883-8-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017097:EE_|SA3PR12MB7974:EE_ X-MS-Office365-Filtering-Correlation-Id: 74b2d970-35d0-4a79-7db1-08dc89a21e14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|1800799015|376005|82310400017; X-Microsoft-Antispam-Message-Info: ONxxLSFWNv4cHdODDrCGgx6sgXQx/+PnX5ESiz8vbruGechJ3VDlyZwXLrPHDeiXlC0d2fHqPbtrM3Ks8sDepykRZeabVwPY0d+gHC3l7ULcQMFHXqG6G70xuLq39a/Ts4yX/LEZQUZVCk+GgfgcEO99FWFlC+7U5eYERXgaBFOuu3brIBrTWvrB26ibLdWgkddy0dhsN+NeVxI2Q8ei8kGOO6GGLPU5z9Vbp/dsZ9dxc7aDtmrEFGDnj9s5r8VKSV5YsALtZ9arZqs7ULz2QyRMA4r2BfedQ9dzfR5AGDX9hThPrrvNq+oICbiSaf4yidzg9dCeDm89oP9KK0Kr9Me3FvUShgqMMTZzAfHr87OYJAhRsDE+LdqTHohCwTeRqt9dTQXUBRVE3wVOUcIPgQ4C2hzyMKtwEX2SYFHg7DQ3iiVV7irzn6mQP+wzsgcRzP7+sJGbJDah/LqbKYW2YB2NXWm4AHjko8qQ24tbgdt/HTAw1UIBEHgs7PuFHunlonZeJIPzPaPrrWQ1dYh6aPE3jD7hCyS1XMuYu/lKkDQSshYkyevWPFGKtS5oLhQwY2qD088xie2IXsQqXhlwrOZXrmeM9TpjyOXKgAWZ+7SheF3WHFkVgw2Xd2eAo/Rr1oNuUmfTh2piUCbQ+nDvVl+8Z5rvyhQrXl/kUG9WRkCC++Lu1q3G27Qsgnb1ePvMLxZGKLQtkjHs4KChDuIM6GvzZqe/3QQYbKCucx8n37SodztUTKUq0dC/UjWX19AUQxQnm3LpiKqhi8lb+K0djenaNy+TsqGXRDQxOYc153w9jIFhO8cD370XbpQIMz1vm3QrZgRYX20AqOzk6jiNza/lRk83oLoaWd0Q7nkrZ7zwEeDH0Ffsr+vXEv/HR/lbApGL6endbJGF7reO/Li20gEs0ohSHCgIzJQ1aMFziyBbuc60NnF/+QHxleFB0UXaAB/VgzDTRPalBjULkgZo5zj2KZH7rFMvjIKOLph0WmF4jLBUzChu9z+Il3l7yHpmDRzWunBnc2uPUJAxkw1mpLbvxHWY//SpZauZkTAjtV9QibBQwylnNPF9GsDzz24OlFw0aRWJAbeZfhtkqMAcq+vFSa62AoEz+fPf0BUyO9pfoZsLEEQCMOx51FBHmzgVkgkz90RqAu6Wk0F001fzCXqrAAzvQ1rIn2+Qvd3zDyOoucbMBtF9t7ec3XvZP+nxIuamEOO+XKEs446qz5wP1Mq4c9kb8R3x5w/xCY/w2J0/Wq42Ct/YXSXRoNhoa3fIQQbA5OEjesiUtQArtoxrYLxO1BgLfmJ1qZn9jah82MMotqaVxrYldclM+in+rQ0NmU267iQ0UbCxo/+k5O36Tj+tE22pjVpt0XR1yDwGYS8pcAqGRgFkp1qt0qvPFKhJiSyu7SuFFjeNqnuEpZt+1w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(1800799015)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:36.1040 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74b2d970-35d0-4a79-7db1-08dc89a21e14 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7974 X-Patchwork-Delegate: kuba@kernel.org From: Brett Creeley To make space for other data members on the first cache line reduce rx_copybreak from an u32 to u16. The max Rx buffer size we support is (u16)-1 anyway so this makes sense. Signed-off-by: Brett Creeley Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 10 +++++++++- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index 91183965a6b7..26acd82cf6bc 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -872,10 +872,18 @@ static int ionic_set_tunable(struct net_device *dev, const void *data) { struct ionic_lif *lif = netdev_priv(dev); + u32 rx_copybreak, max_rx_copybreak; switch (tuna->id) { case ETHTOOL_RX_COPYBREAK: - lif->rx_copybreak = *(u32 *)data; + rx_copybreak = *(u32 *)data; + max_rx_copybreak = min_t(u32, U16_MAX, IONIC_MAX_BUF_LEN); + if (rx_copybreak > max_rx_copybreak) { + netdev_err(dev, "Max supported rx_copybreak size: %u\n", + max_rx_copybreak); + return -EINVAL; + } + lif->rx_copybreak = (u16)rx_copybreak; break; default: return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 40b28d0b858f..50fda9bdc4b8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -206,7 +206,7 @@ struct ionic_lif { unsigned int nxqs; unsigned int ntxq_descs; unsigned int nrxq_descs; - u32 rx_copybreak; + u16 rx_copybreak; u64 rxq_features; u16 rx_mode; u64 hw_features; From patchwork Mon Jun 10 23:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13692550 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2083.outbound.protection.outlook.com [40.107.244.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8EDD1527AF for ; Mon, 10 Jun 2024 23:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060862; cv=fail; b=LUXN09/31vRijxN+UnO2K0p709a45iif1bDujLxLiVaZ56JlqiW1BUaFns04bJ4xrrpZMMM8JZxlUZSPYgFQYqVdNArLPeBC0vuMfXDWi9pdfRlchhBznNkNkNXv1sjnhrHYj/7A2vPe66stgKs1gl1mLEeZYaYfNXBjMsK2Qf4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718060862; c=relaxed/simple; bh=3e/V0mjIEl6WLeVi5A7mOFanfdXz9XojSdlKydXvCk8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P+aBtIlObcQawKbzYhisnmpSSAIZLkdwDTngUh2sxaIF46oeRgDnevI0L4oJFohbAwGTG+x9xYCm7TyIzS+lKO8oVjmJ6IqWPaiLQD/VX6sZQyGmBXOwp7nTG+wNjV9CWtI2B1aDqC5nQz8l8RugtIdjuIqxeKc2Qk0hdYqKh7I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=s3CWsM+2; arc=fail smtp.client-ip=40.107.244.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="s3CWsM+2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MrPKMFGu7H4racoGW3ihHp/8XIL5mMRkQvMMXJrXnsDfkVKVLFrG5qmYaQRYsWG9InTLriF+OYlGOBY8HMpP14ZNqc5gLH3la16VR7w25mEGkgmHF0U6XO7lXN67Fgj9A3VPOmqSdRf1fQWPqCY8yInkQ6LAuBTOWhu5HcUjCaS2oPJABFoeqHQ7thnhg79soLJgQwbuB+Cy1mEswG/5YvANAaLjIXaKjAyDT8/ZUWJs5sW0UvwLj3b8yzIDqf82TiINdA9dOMbP+9CQdlKO06ZDnYCLCqE/rcfSGfZE6qIggi2QjCv7cZFFPYhgYhlOiHTo9gieebwd+F7hHK5tJw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U0T/uVVSF2aVSbsZl8PX1CXoTpPwdw2J9qZ1LM7y64k=; b=Ohtha3GlxVlH9sFcrUdXiIYwCaugkfPnuke2J3ejQgscix7RlTwcOUstWq5SQFNJ0jdizTLoYoysEhCaBFqC4jwFlCPO+4h6c8kNE636XQdeghX4Cl8ywHUjDCaHaN2TT1OxoGosZrZdmzmF/7ZD0xXp2HuvGZv9taYqRK8pt+3HsoYQ/h9VKwD4qAOqUNrCs/7TfYWI3ZI7DgEJE9LI4EFGgXZ8E+O1j6Eoaa/8uRKGA9VniGN8JrpRlCTAfvI0mK6cJkWIvpibAsBLJfDlmaCOq0ZwpWQHnEslG86T09V3VKVRwc+ehsBexHGTRQpyJpU7EJcR4sZAleMP1lUdOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U0T/uVVSF2aVSbsZl8PX1CXoTpPwdw2J9qZ1LM7y64k=; b=s3CWsM+2qGrSMeOA1b3yrKyDveS0IomHcJ1cytrZ9bcIcO0NwUILdOMNeTCflk0PGGb6oTvLnFOkYpt95jWAmr36AsIyV8ISwAS83KGKfVjDWrlQVE0tIYB6j9SxFe+gfy8jfBBpMQ6yhxMCnWNCL1KpVySkIlT+Dny6GZMZVwk= Received: from DS7PR03CA0289.namprd03.prod.outlook.com (2603:10b6:5:3ad::24) by BL1PR12MB5849.namprd12.prod.outlook.com (2603:10b6:208:384::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 10 Jun 2024 23:07:36 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:5:3ad:cafe::6) by DS7PR03CA0289.outlook.office365.com (2603:10b6:5:3ad::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.25 via Frontend Transport; Mon, 10 Jun 2024 23:07:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Mon, 10 Jun 2024 23:07:36 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 18:07:33 -0500 From: Shannon Nelson To: , , , , CC: , , Shannon Nelson Subject: [PATCH net-next 8/8] ionic: Only run the doorbell workaround for certain asic_type Date: Mon, 10 Jun 2024 16:07:06 -0700 Message-ID: <20240610230706.34883-9-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610230706.34883-1-shannon.nelson@amd.com> References: <20240610230706.34883-1-shannon.nelson@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017097:EE_|BL1PR12MB5849:EE_ X-MS-Office365-Filtering-Correlation-Id: 0690211f-a3d2-420a-a0ac-08dc89a21e78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: nubRV2Uzy4B07lBfTNc2bVPKHHEg6og+kiFPwtSrSRaNgaT6mizA7Hk05MBH2shk/v8m4LriKv9ko/UuoFvsg/hLHUIHTIsK6rOYp4E83Axq00L5tlBUP//jRvq5/yfmjVOm52NbQJBP70n2VJ8wjYTfqVvjDqTLJ/Zgf9Fo8yRd+Uh5DWL+9K9WtKHZpE3xPUNwLEC9qowOSgvdt+ltLQTxCZrzqPx+yp/TmzfNklyTT9CbVNTLDBpekQlWT2wcYx+6lNYLm3TNTr7p2LKqJxq+UBPTkpfKgQuycOjXaIHeK09bJHcEG3aJq5IVxmhShURlbUW2B7z/Pmdb5KTyyW8IhoK2e1iruURykop7P32UE3F5/nArQ7PQrHOkdTWAfbwYiNboujuD2a22y0dtjv2U4Hmer7sxV4eqhkuoHN5MyJuvRtJ3/rQuslG1IyW4B/JdEw9YyJ9msiYsmtY/ruV/r1LGnqfYjJIov38DVEaIJ8Lzm6j7u8z9yoD0ivJ8L4uQOwBjlrSwoiDHE2Sa6rJgoX6Lj0ITn7DlOdAfbVQS/1YggpuYgDh/xWpR0hRiqXgIZbPf2lbk7g/oBfYP3ht2f+k83M1NAcX49fXL6GHrQKVF5oXlvZmIxREB+d2k84MHhDRly6NjZ4Ce+PzdDcqeTY3LelaEW3aqi4L0exJzuv1Xgpr4Lh3UomM+yXAtniILOwuvzX9Sc30DCc7yxQ45zMMJIUVOhldeb9cKql+eKmrSoX4UbIiHQN3OMNA3ozJ551ibwFldYun2V8p2Z/TnwhyBOMzF5fslu/PgdmV9ObiMzhcHeAP6rr0CMG5Cj2zCHMhknYYHgD0r9pAB5FN7tEnmPWDVcBFZsjrh4Dg4/WjYyy+gnUvWG/g58iKJcnzHr2wavofZGOf3VO79d42VVtJ83FZOfIeQ+jUoETFeyjaiipgOOBtgCPdHYW+XeURtnsIgWtmlr59Ewc1hd5QHDq05XJ1WyU3duK+SHMnTHXoF+GYpYPsDWFw0YK+8pPlZKVdCrQnpEtYNvl/CfOy3+5xdj03TqQPX6n6rMyYxdmr+cpkYcCJj10Izm4t1/ho9fnXNHq6JK+jcatm9gEkqAXJMNmKXE9EdOSd1XbTVHe8XNBDczlt+P561V/62rNgDqtBsNpKnqINImOgAn2LjBAULvqPdOYsC5F+xYgjGeexjRKm1lMhmyNQzU6mtpM/UHcRr7e/Jgb+fKWEAzoIFnFMFA05gE476J6i8EuZJJumBInwzuIiOebFWuDn2JVdRdi0/pm2SwCdeHGh/s5YKqh4J83UiVC3l2MfTdzwYbnaW5YEpQHCbCz6IwON0OTRyn7bqiBje7ByN2wad7EkRXOAfqpeugojbGVjrXfMvV6wGrSJ0KtwfarVHW8RMuYQ9Hsf18Ot87cpYbu//Ug== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2024 23:07:36.7603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0690211f-a3d2-420a-a0ac-08dc89a21e78 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5849 X-Patchwork-Delegate: kuba@kernel.org From: Brett Creeley If the doorbell workaround isn't required for a certain asic_type then there is no need to run the associated code. Since newer FW versions are finally reporting their asic_type we can use a flag to determine whether or not to do the workaround. Signed-off-by: Brett Creeley Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic.h | 4 ++++ .../net/ethernet/pensando/ionic/ionic_dev.c | 16 +++++++++++-- .../net/ethernet/pensando/ionic/ionic_lif.c | 24 ++++++++++++------- .../net/ethernet/pensando/ionic/ionic_lif.h | 1 + .../net/ethernet/pensando/ionic/ionic_txrx.c | 14 ++++++----- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h index 106ee5b2ceff..1c61390677f7 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic.h +++ b/drivers/net/ethernet/pensando/ionic/ionic.h @@ -18,6 +18,8 @@ struct ionic_lif; #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002 #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003 +#define IONIC_ASIC_TYPE_ELBA 2 + #define DEVCMD_TIMEOUT 5 #define IONIC_ADMINQ_TIME_SLICE msecs_to_jiffies(100) @@ -96,4 +98,6 @@ int ionic_port_identify(struct ionic *ionic); int ionic_port_init(struct ionic *ionic); int ionic_port_reset(struct ionic *ionic); +bool ionic_doorbell_wa(struct ionic *ionic); + #endif /* _IONIC_H_ */ diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index f3f603c90c94..d18ea1b4a8b9 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -127,6 +127,13 @@ static void ionic_doorbell_check_dwork(struct work_struct *work) ionic_queue_doorbell_check(ionic, IONIC_NAPI_DEADLINE); } +bool ionic_doorbell_wa(struct ionic *ionic) +{ + u8 asic_type = ionic->idev.dev_info.asic_type; + + return !asic_type || asic_type == IONIC_ASIC_TYPE_ELBA; +} + static int ionic_watchdog_init(struct ionic *ionic) { struct ionic_dev *idev = &ionic->idev; @@ -150,8 +157,10 @@ static int ionic_watchdog_init(struct ionic *ionic) dev_err(ionic->dev, "alloc_workqueue failed"); return -ENOMEM; } - INIT_DELAYED_WORK(&ionic->doorbell_check_dwork, - ionic_doorbell_check_dwork); + + if (ionic_doorbell_wa(ionic)) + INIT_DELAYED_WORK(&ionic->doorbell_check_dwork, + ionic_doorbell_check_dwork); return 0; } @@ -160,6 +169,9 @@ void ionic_queue_doorbell_check(struct ionic *ionic, int delay) { int cpu; + if (!ionic->lif->doorbell_wa) + return; + cpu = ionic_get_preferred_cpu(ionic, &ionic->lif->adminqcq->intr); queue_delayed_work_on(cpu, ionic->wq, &ionic->doorbell_check_dwork, delay); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index be601183deff..b8813809bb75 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -346,7 +346,8 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f if (qcq->flags & IONIC_QCQ_F_INTR) { struct ionic_dev *idev = &lif->ionic->idev; - cancel_work_sync(&qcq->doorbell_napi_work); + if (lif->doorbell_wa) + cancel_work_sync(&qcq->doorbell_napi_work); cancel_work_sync(&qcq->dim.work); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, IONIC_INTR_MASK_SET); @@ -693,7 +694,8 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, INIT_WORK(&new->dim.work, ionic_dim_work); new->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_CQE; - INIT_WORK(&new->doorbell_napi_work, ionic_doorbell_napi_work); + if (lif->doorbell_wa) + INIT_WORK(&new->doorbell_napi_work, ionic_doorbell_napi_work); *qcq = new; @@ -1217,12 +1219,14 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget) ionic_intr_credits(idev->intr_ctrl, intr->index, credits, flags); } - if (!a_work) - ionic_adminq_poke_doorbell(&lif->adminqcq->q); - if (lif->hwstamp_rxq && !rx_work) - ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q); - if (lif->hwstamp_txq && !tx_work) - ionic_txq_poke_doorbell(&lif->hwstamp_txq->q); + if (lif->doorbell_wa) { + if (!a_work) + ionic_adminq_poke_doorbell(&lif->adminqcq->q); + if (lif->hwstamp_rxq && !rx_work) + ionic_rxq_poke_doorbell(&lif->hwstamp_rxq->q); + if (lif->hwstamp_txq && !tx_work) + ionic_txq_poke_doorbell(&lif->hwstamp_txq->q); + } return work_done; } @@ -3510,7 +3514,8 @@ void ionic_lif_deinit(struct ionic_lif *lif) if (!test_and_clear_bit(IONIC_LIF_F_INITED, lif->state)) return; - cancel_delayed_work_sync(&lif->ionic->doorbell_check_dwork); + if (lif->doorbell_wa) + cancel_delayed_work_sync(&lif->ionic->doorbell_check_dwork); if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { cancel_work_sync(&lif->deferred.work); cancel_work_sync(&lif->tx_timeout_work); @@ -3752,6 +3757,7 @@ int ionic_lif_init(struct ionic_lif *lif) goto err_out_notifyq_deinit; lif->rx_copybreak = IONIC_RX_COPYBREAK_DEFAULT; + lif->doorbell_wa = ionic_doorbell_wa(lif->ionic); set_bit(IONIC_LIF_F_INITED, lif->state); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 50fda9bdc4b8..e5bcdd2cf86a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -207,6 +207,7 @@ struct ionic_lif { unsigned int ntxq_descs; unsigned int nrxq_descs; u16 rx_copybreak; + u8 doorbell_wa:1; u64 rxq_features; u16 rx_mode; u64 hw_features; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 3066eb4788f9..b381863b54ef 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -949,7 +949,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) work_done, flags); } - if (!work_done) + if (!work_done && cq->bound_q->lif->doorbell_wa) ionic_txq_poke_doorbell(&qcq->q); return work_done; @@ -992,7 +992,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) work_done, flags); } - if (!work_done) + if (!work_done && cq->bound_q->lif->doorbell_wa) ionic_rxq_poke_doorbell(&qcq->q); return work_done; @@ -1037,10 +1037,12 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) tx_work_done + rx_work_done, flags); } - if (!rx_work_done) - ionic_rxq_poke_doorbell(&rxqcq->q); - if (!tx_work_done) - ionic_txq_poke_doorbell(&txqcq->q); + if (lif->doorbell_wa) { + if (!rx_work_done) + ionic_rxq_poke_doorbell(&rxqcq->q); + if (!tx_work_done) + ionic_txq_poke_doorbell(&txqcq->q); + } return rx_work_done; }