From patchwork Wed Jun 19 00:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703285 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2040.outbound.protection.outlook.com [40.107.92.40]) (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 D57461860 for ; Wed, 19 Jun 2024 00:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757211; cv=fail; b=MH7cSR776iIiR51sK741I+cGzp537IkquGWsEBkbUZdfde3wYrN3u6pcEW3tFzDBA3LxxddGe9bsykwG9pZG0SNBwIRlnOZcSu7OVjkAW2m8GZeGMtgdOWmP01LSCxEVw+GN9pj0/xQoABSSvypPcuCjQd7ZsM+Uq2rYYurQGOM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757211; c=relaxed/simple; bh=4BD7HPXY/Q4Zw7xlGKdSko+VhSqXpKGPNppCpvfJEmY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s7PtaDgHpIpO4V//jHnWc5cktnYGeYlUaS+GOD/X7UGXMiaaWn2x9RrY8/OvZZqtMacF3CoKD9B0TSk6mnM9ChmuDu7adUyDsnA70wS6fOeN0sxz4Z8EL3y6pUqdARC0pUzdy1c1nLn/JYK7bEjL7XIwBaiYP1zA2s6AFLdZ9Ng= 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=StPyvsw2; arc=fail smtp.client-ip=40.107.92.40 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="StPyvsw2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nL47MdTkqDFPz9VLqsfU05d1xV5or0wq3iRr3YKvcCzE8NhO1Bh7SC5GV8pAwpqsTLtFIb2urHJYIBUrqaYj1U3B9vFI9cCGEjMBJByR+K85M4aN1WiJASSznud7fzDQwKhWMqTmbn0li5sIqv5sTxC8rxMJxSlfptpjGKr+Cefv041c7Vk2sv+VRJe04d6fqf01856XcJ2rNzZVa3DO7VoDcBoQis2z/++hjB2pGDhXXoL6/JTpuNbZT6OSDxQ1bOzYIMe7k2kdAiuaTmgw0b87haYKDBFNISwfR6S6m6RyEC0xufY9/nxx3mXX7FoypPd+OO+wefZIofQkJszSKw== 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=rlEFf93vN+OqzWNVVbuG7hlVTzvHT5FmhhCV8THDU44=; b=FoATi3iptl4E747i7CPHhbgO9GcvH33RVjoTZaZ+qAo+r7+qRdvs8Pwqprp989bArojmZhaRGV3WQ+wXCh2f2dwYWol9PhaMnDHp5VUmqMjHR3Xc501hx62SMfr100C7OsW7LSECs/viQeP3sDbuCSL0qHm4YJ2/GXPFoOpyHvEeogoz4S3lDhnTg0zoD4TOvGiFs7nFUOMIdyKSOYB/dBl9t32L2zHDKrrbq2jzbE0oiK90auqo9fQxqL1AEfKwrHuCDTQmjiHOwvO3ItKL0Yf0AgBws5mDPOQ38Uq4Lf6DyGhiv0cr43RG0lFMlgNT9B4RLBiPhZ2MrUlg2TU3mA== 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=rlEFf93vN+OqzWNVVbuG7hlVTzvHT5FmhhCV8THDU44=; b=StPyvsw2A3qwu4XPoA6p8H2Y6tgh39+1El1T++6YT4FgBp5BoQ5TbjXAlBGNciTiG2HO+xRStxEvFadjtH685cY9KE/MANUC32cXt9y9JJ5/hC6X4uguCc2GfarDR0ohGgPqD3ODAoiixo0SKW3I1s4GOu4weWLZJWgOEOEfegs= Received: from DM6PR11CA0048.namprd11.prod.outlook.com (2603:10b6:5:14c::25) by DM4PR12MB6256.namprd12.prod.outlook.com (2603:10b6:8:a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 00:33:25 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:5:14c:cafe::f2) by DM6PR11CA0048.outlook.office365.com (2603:10b6:5:14c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Wed, 19 Jun 2024 00:33:25 +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 CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:25 +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; Tue, 18 Jun 2024 19:33:24 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 1/8] ionic: remove missed doorbell per-queue timer Date: Tue, 18 Jun 2024 17:32:50 -0700 Message-ID: <20240619003257.6138-2-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|DM4PR12MB6256:EE_ X-MS-Office365-Filtering-Correlation-Id: b8c01858-1846-47db-4620-08dc8ff76ec7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|82310400023|36860700010|376011; X-Microsoft-Antispam-Message-Info: PhA26jfBijHrqon0NOZubQWSPbgUz2g462hIw6aDLQuhmpR6O4+bXVAY1CVO2tNbjd4ez+ftsvMQ/+2dvaX77f1XsnCoLcEZMHUyXeMV2MxrHlhWlI1xYFnpuaEZym5eOXJd0BdqFPYfgaLOV3ZoyPRehb+xFuyaFEaHprsplu61wrWvVdXT/2BFKAZtbqTEnrCgMAM8Zc/LrL5dMZoI6uh0sIHC5HRCg3ITChLmGzZPByin9XuYnYD1EOnkctioF0kBweH8Gc7Iw/Wf9YW5Sf+HpUMupjf0YcnHN6jzrHpTJfVyDsEAQef6BcgUFi59yH/NpmgbXswxUL6BGgEkDiERMuwuvY4Ew5fMg/YpLDaGE5PF99AXmq+KAPykYYI3K+nbUfdtJgGfiqrZ/ibjTOJ3nmTSTOlTCFtXVRPDbftBmXB7Cipmet9krP2NRpeF34Mj9qph975GsSc+/xOpOvnLaUO0owRDnky/7PK4+i5lwZKVZQd93eLJyn5UpdAghiloixbVovUBbdoH0G6w+5VYpTUteMbEMOw6+NfSVQdwY7MCPbM7jsInsDeIPNS0FdjOm008woSFrULiJem49Y8u9PKnRm0BpnKX+9A69gxFWchC73qcce/D8BYEWfgX77oyC1Gx4eySFjHECK5L0yudbKjWB1OR4LjU2MK8B2of1gwuZiOUY1CJgJhAgmMhjVqOtxKmSKHhg7FDdr8yMl5f7xDeA8SRU0wx+1I0FhpYA/zhSF63wD/ZYlRZXi3+oprxKuAX8Kez8yx/QIXv8pWKgQemlu4S1t8OOkx8Rap2HJ0C2QFaeW57H9yTeS0uTGik0l6Za+jhWZgZtl8oQznRXhxlz0SAznRwu2XS1uOKFLqr+4YZ3CzexyGD6lemTkkBEjVhCcA7VayJPalc0q/EHu95qNzTj6RYm2VcMBrjxXUhiE7JSFqkdHxiVaT7dzQRtz2XMKSz2ml0NyqNVYLGHDIOH9Kn0xauyx5gW8Fhvr4OK5kD0yruUTdeRAXSdi5wkM5NNIihX0CJ5fYkRUXRi3kq6ZxVU4VgNRcM8upaVaDELdbxtXg4s7/k6IU0PkeWFmytc8wARTBBmfiBPr/UU4e2dMWzBmz+KI56CLVJIEsMnpHEyRaHZC8uKYx1mDY/L2DdfKBKP3szc3w7eCk8U1n6t0kVwXmrWk6DALqLVrQ3+pgxrJGEBshQHOx3PnfxsBJuB00r+7YNu7Z25ID6qTN5hWtDd3IH2V3mK2h5T25hMxy5uiMwspcMe0jEpSBGVOaC785s/qKTrQWzFbbxg6vsfboKGl7+/bGSMH2i64xaV4y26h/DXo2SHsbs4AYqk9LoN1j5Zr0XhGq3uBnu/tqoHdj3dUvVEEJ5rpkOXpUxl4JF5Glvp0r1LzPKD1YIhza3jFCKf1uwQixmvw== 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:(13230037)(1800799021)(82310400023)(36860700010)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:25.6765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8c01858-1846-47db-4620-08dc8ff76ec7 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: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6256 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 b8fdfb355386..1f02b32755fc 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; @@ -343,7 +336,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 @@ -478,7 +470,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) @@ -832,11 +823,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; @@ -909,9 +897,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; @@ -1166,7 +1151,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; @@ -1203,15 +1187,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; } @@ -3502,9 +3483,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 9e6dee2fc1d4..a4e923376484 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -868,9 +868,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) @@ -953,8 +950,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; } @@ -996,8 +993,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; } @@ -1010,7 +1007,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; @@ -1042,12 +1038,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 Wed Jun 19 00:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703286 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.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 16E654A19 for ; Wed, 19 Jun 2024 00:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757213; cv=fail; b=u4xyE5FpzO0zcEbPw/jyuwRWKr9anbVQpgNx1P4L7GkWr37EQmi1kAkqW5PdUtQ0cJaeqksQoG/eFvlZ0UunRZSDH1LYg3yXKFFEFnN5My0dI4irvaOtFHP4WWkmD/Zgwr2X35wcU3r4VWP7ub+cbdSpH/fyk/aHgl+aoB/07YY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757213; c=relaxed/simple; bh=xL4Fc744fo0X3e+7jiezkTy/0zoIbuo5QEpImCz9LoU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A3N45JAAiQlElzNPrlShUj6K3k3qYVa44nvdnkHWx7cDUb3w3dQAaKbVZjrhnOt25Lye4ybLQD7SQaqJbFj9tNCB8riq2hHCiWtbfxATXEY1pnrwLBky97hLtQq0kzspURTHpbKV+i2aok2F4hvhwV5M1/F4JlvEuWJNI+SIdng= 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=41pfK9wm; arc=fail smtp.client-ip=40.107.223.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="41pfK9wm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZ6W2cKdhAsYchnB7g5PSPdbc27kTrwaKSbFzllvIgDb7tXF4m1kGkv/fCzlJpohYxLqd/SB4YG7PuOzZRR6cMz6uXonCm2TYZW0f58h4HSJyZF3iEd3XNQJAK2mTd8CkXdgsoDlJdviws/QYqzSNJC4zg3F9ZIgRXudeUIiemweQ58oekQBArjaF6WOMr+nHC8cvVTbUUCwoorFcRTlaYFmRIupl7zE6W4p98dpQxR26bQSpBsVFI/Jl4rZo7pfH7fZMQq+JZldwqw3ERcOgSTSMy4U06v4kE+niD5xyCKnxfASA4Q9jxi2U3E2tODSHZWy6F1NfqJNoEn5aPs7GQ== 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=8ZiNq6BZGxeglM5cmmyMwikbZbZv0l3qgGHPTuNQw+Y=; b=mZ1bElFg6b/b0oDg5Ddi3fTClS97DdYJ5HzB23MTJYM5g4SUQK/ZTx80MVG9UG3NIzyD3VWIiJSHnbN9ChrdQFkdV8Fj6reBtPWhf3wGrGS71nj8i2t78F292jVS95NMITT2rR5oaPz6vfvEEoQ9dJz1izhJp7d2t+P6sI+tPvrxhAHVE9EvlSL1Y5aVYOMI+fyCsdScgGZzc8xwtEoNVDvdGIwujhtzepaCJqfBqGDw7Vt1foRCiVgOrXcjPNhMHhlhoVOU5KragJVLj4qUHCrxkCu0kjoiHJOUyp7wAbKfM89cq2bTQCytpjZ6NnKg/qgS4lMzdTFb3CRnus5AAQ== 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=8ZiNq6BZGxeglM5cmmyMwikbZbZv0l3qgGHPTuNQw+Y=; b=41pfK9wm6R47yonZkMdwg4Kh8QhNEnw/7v9mPHvD86Z8tsiuJv7C2cugBCRV36ZcWxftYz0LGrT6VAMTKKKYB+UIDtlwOG1PT0D0uh5SWlcPmyAyCSap72sT1VfjkmyGbP3SsAIU0x0LFRxZ4LMp5Dx31z+uSsqVSP/VJmV0TfQ= Received: from DM6PR11CA0049.namprd11.prod.outlook.com (2603:10b6:5:14c::26) by DS7PR12MB5982.namprd12.prod.outlook.com (2603:10b6:8:7d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Wed, 19 Jun 2024 00:33:26 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:5:14c:cafe::d2) by DM6PR11CA0049.outlook.office365.com (2603:10b6:5:14c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Wed, 19 Jun 2024 00:33:26 +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 CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:26 +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; Tue, 18 Jun 2024 19:33:25 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 2/8] ionic: Keep interrupt affinity up to date Date: Tue, 18 Jun 2024 17:32:51 -0700 Message-ID: <20240619003257.6138-3-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|DS7PR12MB5982:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fc030e8-a0da-4cca-dc6a-08dc8ff76f5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: owUZ6yA/MThocxC3n4Hq7Tjn/PxM5SNzGkqHHetXudBo71zZR6RMjHfaL7FokKlaqOE1vWzNpZT37WMDP5PE3Pi2IoSx3+3R8p+f2WQKZzLlwY0rh2KikPpGjFTfj+cRbPeZfX+VOcK0oBQnv+EHWdO/VHIfoiXJjSliuXEjVehFhCVphuB7DeNaW+1ZFv/Nn5hr4f726mkBCqFKi4vm3hVFDC47b8HYXh1AZeRRBE/AKlzWbJKcX1FIBSZuT/RW/DvI0A4ogz5z6RcHzCvEpokTNcBKheRm0UbEArab0+zsXwsmMrNxzPfeuhLHLcpi/x3wGf0yfQRqqwJW7z+stRjs6Vu+uFZe3Yi27EyTxyDAUxh++ZVB+t8LaS6FRNVMmJSltsZrfpgJH0nRIytO9YtEymRXf1rJUmXxoJt5K4R61sEIhabpal/KRCJXreQc/UyEMzHuR1XhvIkdadTeDwqu+RnOn/RZpbjUFY0OLKDPdy5N/jDsjYitjseglezMUz44YKNZ30DhEY3PKxEuXOxVSjgdnjMU/G8AfYhnvaLGrGB9ySh2mOZm2szJHY7fai+roLr5klda4Rk83M470aWr2Wt59OAgOcxeIsjJzMIpvqwLgaz4yBORPfL436mWRR+aSU7q+aHKnXBNpHPUEI50yj1k4M/8YbmpaZrPH6hDIcvw97n9P38lF5B/liYkcpHKSJlI85p87OaHkFR7H30tnIofxcZ4yr9ajJDB9QGHuX9vzq2Uo6R4xIb31wTxG8p1GWjCprjveGPF34tZHA6VlICapQcIGBrKMS0sGZGznlEPuoeZrAVhTdN8WIRnZ875kj0tfo2pvXK1fZxMhBIvZMLVL1730rAiD7o7ukChtyk9ZHKKW82sQclyFi8TXcszEaejGkXUaNcTBhBcgCormHknVJfzR4A3J98Wpd1K3tk4AMs/IngTAz6pcnsHmGkWzbBHEUeSluZBQGcS0+neWTdPwj15Ylk09xtkEWPVafQPlklI0tHG91AEHuHVCHTg8AOhO8gIx51zPE/etO0yG8eyjkzJI8bHsvft2zaL7MlllaJNNJ4AyFenXuYyC0myIFwv82JvJvo4jdjRzQmX6TkYP0C6Z8CSkFqDerHIPA+2E3UMTgqAY6NGhRlqVZDQ3HOwu8lvAOzA/y3sDfSdp5FK52YETSN2eEeiWEBdm2RLvdh1JOVl6WZUoeqq4Wwge+KsbGq88aeBwEJ4KkMfdiv/OHjnuY4S20xINeXmf0E+cQiC0x5lCOpsVA+kLH+VVtC2Bnvn6zPb2ZZ+9212XZOlZg66/tOKIucwCyjX6eGqhyaSNsMEmvZdEhNPLAeLnc57yp1Wkaaxhqei5BzIJMtNKlckxf+8CYkJFD7+DC4eS6Lanc7lsZZnRGRppA5XxYaT/W0IlbFv0HO3Xw== 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:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:26.6765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fc030e8-a0da-4cca-dc6a-08dc8ff76f5f 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: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5982 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 1f02b32755fc..e53375e61e20 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; @@ -299,8 +311,10 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq) if (qcq->flags & IONIC_QCQ_F_INTR) { napi_enable(&qcq->napi); + 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); } @@ -334,6 +348,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); } @@ -474,6 +489,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)) { @@ -505,10 +521,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; @@ -3120,6 +3145,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; @@ -3211,11 +3274,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); @@ -3237,6 +3304,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; @@ -3410,6 +3479,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); @@ -3487,7 +3558,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 Wed Jun 19 00:32:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703287 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) (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 6B94D4C9F for ; Wed, 19 Jun 2024 00:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757233; cv=fail; b=ICN93O+/qAQ4eEqMOs4JZgeGlO4Xdu5NVZdYWet+EVjQMoVItSLyuJidMArE8FPd6RxbhRP+C1Vkda/WN9+DIyV0sVwO93mrE4eIZ4NN6KBrqeUlEuzV+dReZOHXZQMJpSI3sGhtU10SlIxjpOGJ6/jT2iDDdN1nE4OCC8/tiNs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757233; c=relaxed/simple; bh=Wikd18BAnS7WjA25uNUk9utIr307krUGH+I2/UpLDXk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GWnG0ho6hrYxCuMSEkXFHO7OzPXasoNZfK7mg3gGzXoffQonwyO93SvQgoa7qazJUkbivx0q7I8qNcohY8Je4BXLU/gs4N9mudZr2uFTpjraw2rNJIfCOFZZvU4T7EFrloG+3kyAt1sCzYt6/5n8eFSsWm5ywBql5lb/ch3Eu+w= 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=OwcWy2Fz; arc=fail smtp.client-ip=40.107.220.49 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="OwcWy2Fz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KF9lb06okuBGl0g1absWyTtem7o1GZKh4leJplJ20yalfILps0MthS2Tlc5GEZ5zuwxUHgx5+uumm/ALx5dVhnkGNXaNlZVivxjx/xYj9qrREeRa4U7mUyzZZvYEfmKCFnR7pnt+UIxoI1AymI6gX3u7KULniYPS+9MQsxEEjSnQgGcojVocfcJ4enYq1OrzTX41yoiP2WiYiMlJU7Zo0BCii8hwk1ngRLq5X/JsolE9nlFzwdKFtVqcQw2OQIywsDnoyxBVtlKe0KVkMHAy69N9aGcpoJtmEBwVfczDnGqplWP0XkK1wTT2BFaoy3MKk7AIqVtdS3M6mZiDrkRQ8A== 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=UjCWxZ3XVi7UGdMfDZTICWVfrbpT/FOMSPFdGHmgZqI=; b=WzWBpwOy4cX11G4vUGawYNorr6veNFuNKeMT7RaTa8X+ePTK2J9ty4yygCPweB872LhvviHckAmKv3Yf8vs5K9whBfBPtGB/DLf1BGDen6MiZcNMZ0B1YpI3Qerb+m/X90c7UcgPk52WcJ4MaEOSAPF2iuizhhf4STP1OXj+Mq7wICt1hRWttr7rN9Z9hYuq2+kaVdaeCHlEG0fAUb7j3+gUYJU2t1ku4GncL+Rc99yYQEOFAvRqp6hZ3IFFleexnG3yxVkkK0c0wMY53wUA2/LFpN7gtpWdPsXVNzxfBv+yFac1QnoZ0eu+RqQZ+c0Qyip9qi8KgOeB2sniY5hyVg== 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=UjCWxZ3XVi7UGdMfDZTICWVfrbpT/FOMSPFdGHmgZqI=; b=OwcWy2FzPfeDsgltpUZBlJgPig0o4k1hVoBHAv1v31Tmon2fkE32LTv/hKz5nyh1/dW/BgKvx6/L1sDASWPyqMA7apCdvcX9D/viMINqDQQM69Zkvlz8BAFmsixEyPDNJzGqRIPtZYWJI9PF44jWFcRxiHPHKNTlFZT6pCIkVb8= Received: from PH7PR17CA0037.namprd17.prod.outlook.com (2603:10b6:510:323::28) by DS0PR12MB8044.namprd12.prod.outlook.com (2603:10b6:8:148::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Wed, 19 Jun 2024 00:33:48 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:323:cafe::9) by PH7PR17CA0037.outlook.office365.com (2603:10b6:510:323::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 00:33:48 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:48 +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; Tue, 18 Jun 2024 19:33:26 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 3/8] ionic: add private workqueue per-device Date: Tue, 18 Jun 2024 17:32:52 -0700 Message-ID: <20240619003257.6138-4-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|DS0PR12MB8044:EE_ X-MS-Office365-Filtering-Correlation-Id: c7422ef5-c3c7-43e7-8be9-08dc8ff77c1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|82310400023|376011|1800799021; X-Microsoft-Antispam-Message-Info: ItVVjE281YWIFHl8h0Ul+U8s17ZvDMWTvvRgTwrNcB8Yqh7a1RSWcLoiRrqyDyzoaZZ9YtQijxuHXYeWRzQie7Yn6ElTsU+495HMLzAvHGqvD3tdan1Pb+iFk2xj1mu8P3A0nGFoLF9ik9oe8MtowQqF0hLAhhCYrYuLvCAEeZDlGjUpK21b6XsXClfkUgmOpHrxrKtXEU7H9Mi772Q/wPyMzDDSYmVV/NJl2/K3Ivz9YDmkvEa2KaLuzh0EcvUU1iy4AMvW1/F0sk/YKd6XreG9RXSU6rzM+IyPNiKlOPGc6hUBwYXd70s6BI32lx23XrKk9oLF/h5JH8rOtwNID8y825Y7qn6LVbHY6NT/WU8JVzFdtXgTE/NmdWcUCbFL7d0peetxI460aIDRXC1zOjtmVS7sXzDJvrIfHcQfenJNqtypkQ34WTiexVMluxq2bkncKYpMKgMdTEK6ZX3jPkW7IQw4i82fnZnnNVEGgCOxx7+EBYEOVW7UGaIV4T+umEVTm/Lo75LApkXpFX8lmIzTsGUMU5hmybG0X38PmFH7o9DG0gAvByyz8fAGgZpJ2nIYzfp9RQCCMQzq/o2H3s/hDMVmMXueI5kF5zdgSYWooNjEWcr6Zpr7Xskv1bYA+F4r4pXdAR8WTbMvqVYPLT/3fXqkiwnMG+n3IqiK0ypjuH2suvTkn86xIrGxBzQi2/dAg+CC8lWC9xbp/tjvJJ5i7pKXQQAKJ8trHrYCxoyDSGEFJacq0Ss35rjYPWBBuvRLlZWT0FJunooG6XYwy7xJFYx/okOnS/45z3RCdeuVmMh75TlXRWWIU9rCdvQQy6KfVjMYmuZLuV6858arld0JG1yZd3C/59lb3POoKMowiuGIvRpYd7Xck4+OgpAu5MJSviTGhua/AR70t5aH4EPbAyoycOrjzYGCKsWxmKLWQq3Qgdl4zXfd1sZmZ008wjVLLB70n9ZQGfNTm8Hc5F/jgvQ18SBPEcZsWwH62TxCWR8pMAcC701gVV7RFprcVEzWxYVpPAjw0UfyPPCBLwaoescNm+4KAnj+8x6xLZqWEw0mfvOqfdwADUv1hcdbDCGs38U5dUpkX115Cc9/oeICj7DarbdKuNfRe3v9zfZ9iII/bmzQeDSM0SDx5T47M65wyeQYUaxNTJlRqytpqiTFx8yLODb2o4Ny2nNtf+/MPSF8pMRaaKYpDT7YZUEj8IcZpdlQqLzrqgGOMvik+opMeluWjaGxN1wjuDTWvhptV2cbJEqukrwsuHMdTUsk9JVUmE1MTqQ95RZdDVCP/YqSDLAE8haSyydKntkQ7qX2TlQ9B+Xn6SPY9qcEBh3Xn1Disx1P2JNzNPhgwb0v+pqWL3U1RbnYGwAFXDvLq8vFtny3vsVh5S6TI9tF3KOs1waQSKHqada3v4IutkEuvQ== 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:(13230037)(36860700010)(82310400023)(376011)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:48.0391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7422ef5-c3c7-43e7-8be9-08dc8ff77c1b 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8044 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. This is to better support the new work items we will be adding in the next patches for PF and VF specific jobs, without inundating the system workqueue in a couple of customer cases where our devices get scaled out to 100-200 VFs. 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 e53375e61e20..cd12107f66d7 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); } @@ -1389,7 +1389,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 Wed Jun 19 00:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703288 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2067.outbound.protection.outlook.com [40.107.96.67]) (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 2A3CC6112 for ; Wed, 19 Jun 2024 00:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757233; cv=fail; b=ipTGeJh/fFVHttRjUDWxSuoq44LMtWnQ7s1woyEVgwFAhgFsidz4QeFfjgWVsFUgs2nYu1zxt8oamUgNTtTmEONEx/XWiMWbfjiKGFbnhZ2Yyxi/S0ex5g3P3Ofd90AhcFJ8ALGpiG+F/9F5lxzzWl6IyWC+34pP3P+qh1OtFlQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757233; c=relaxed/simple; bh=7IqtFTmFTUpqvwNZkWvfb1NGykkvuiTh1P8w1Kop328=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kW8R0f6qezuOhVHWnMaRnnJ4SdWJvM6UuzWUcJmjD781XJ+yRgEoqNyZ2p30ooBatdvo7bnQYJBwMDfSQg+bp/Ai/3DZYnhK42/kGcMa0drTRmnkG6K1SLZoG6caSLUfrwhfcP8jvZ2H8y9qQiQtPeG1y4+wi4ULNTUrpxu4tz4= 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=TydnOyY4; arc=fail smtp.client-ip=40.107.96.67 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="TydnOyY4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iYW+tQ3prTTg8ulXpm144pKD+sXeIQ7CdlLR35GqDQhkMqiM7vZ2BlCFv3FeSLT1Jz0sJhE2kvpCis3mUG38n/Vt0RHdFucBSl9O6yzk9ZvNH4lWpnD4uIEwKrS7l7HXj1QOVaEoh9Xkk4XzHkHJwJY0+C4hGrXnyIPkGCYfpvAtJZ7EO/FReufe+e3rT5n/DcGU5os2KzCFy+/erpO69jLlaTqRtIkKzeuvfvFNFQ3C9xfBJfya6M8D19b0BwjlrMIyNyuwF/Tc+rlW2optXNlrsVfp2Ser0jB6TsOKgg8jMbThkbJF0ad0kzVxlxOi4prfsAsEzMGSWh/ej8/xog== 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=UkXPci90f9gUI8GIm5oSooMxWEVWBEzxbpWePUS2GK0=; b=Q0F9tMb81wUBGqxTXj37xswVxq4uP0VzXjxsd8eorhS41t82EL8ZWLQO+Bf29ZSKWI5w3jqYzIRPVo4URw5PA/dVcfh4rAq0RnT3ipHNOBGEcoau9z6TO0fiFw9jO6mMhim9xmL1mVlu7LJfHL/wT8iBY3ew4oNz+BNQQ1VCXoj/+p1yy+qNNhyAHlZzIIfe8l1md/WdzH5FlUmgPfIZMV1juTG6BtTvI9enpVBlpocnno2aT2TO0zgEMhuoT7M/dsC+iruUh2Er8bqZotvy2/+A5cK1ZHb/1SOCxe24udYiXGmcFoi127twLKzw0qjttLrBToJv/TCmFZpidZYPdQ== 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=UkXPci90f9gUI8GIm5oSooMxWEVWBEzxbpWePUS2GK0=; b=TydnOyY4Fwsu4I633wDVNC1eLomXx+cqG1FQ44iMMVs5YyI5pQe9pzOmtiT8aXOSsuiKFCu9oHC6B6oiv66cczfxylpsRPPasHyOklYXNbXgXwGl5sPVXxykHDsm+BjDIxM4/CoKfjf4ALVF7JuQ7EowjEyoJY+Z9RQHEONGGGk= Received: from PH7PR17CA0045.namprd17.prod.outlook.com (2603:10b6:510:323::10) by CY8PR12MB7756.namprd12.prod.outlook.com (2603:10b6:930:85::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 00:33:49 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:323:cafe::ab) by PH7PR17CA0045.outlook.office365.com (2603:10b6:510:323::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 00:33:49 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:49 +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; Tue, 18 Jun 2024 19:33:46 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 4/8] ionic: add work item for missed-doorbell check Date: Tue, 18 Jun 2024 17:32:53 -0700 Message-ID: <20240619003257.6138-5-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|CY8PR12MB7756:EE_ X-MS-Office365-Filtering-Correlation-Id: de98d07e-fb5b-4915-70f6-08dc8ff77cc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: buyihoEVtFjE+cU7lMpisuCu6skBCxDB9H71FDegddJEXIMVBarbILmfNmdXlrEsrgU0oV1hEp34PmbZ8wyKmi5Meap9BJEoN3b9hhKeUB3YYgYw+4IiWGfDy/U5auiZCVYUbMcPO4heKZeibZk76EJ9+Wk1IjvKkO0W8Qx5JRBBYsha6P6peubAvT2gKXqFtNcQ7H5T9F79THUWSMhbJ3MO1fDwTJNUoGb+/yb2CWGaMDnTPv1ghnpSBKz4y/OnLMzreZynSUgBqTpZE/ww549r2cdDu7Iy2PIl1b0NuTsHcq26sYvmtBz6u42n8PBw1KFYTY1SD0jP6Vk8ATIGLGIM6AE82k0VjX5kSxYYMtJvNbfki8Wh+hkoPGW1hL8iz0ka2MVl3aWldFfAI0brozHQKBE1D2dsLUuBP3kubxPJiitc0uEsgridRJ5gfr226apIljWUqnIgkmSeahGn8DFLCwBVezxOHYWs7Ia+MXchvqdXq4gA7XyGBf2Lwytv7zAY+n8VHVjndw7z0a1ahwHJYS//nig16+hoafeId5iJ1qGkO+yI/N9GqkxqxE9sysirkb/o5QYqUbmDHXceHd7KC5bA5yCPCkOvkeVxp9aKgiHAVC0R2EVoA7ovNq5jgorP004J61TzfVwmKziKallqXibyAhUabzaC+xwlJH4fz3LKcgTeaIanaJFCqakjeNAvBlQKj5IUh2skyfEvkMYUuWchVoklZtfORVZj1vlVTpzoGvzot0wnOimmol2T2AyLbYnAKwQ+owt9N31yZ5zERFJcS2AVHOLjqnQ9qSsN+4v4r8lYkkpncA0VkfLrLiYoLOfhygcaKAprIQdpTx65W2bkfv7sEsjpHxc131MjjXKk2M2FJxS5lZUkKN/RFhfbGfp/1gbBA8/a02YmrsSYj5mJREGJMkgODlPkHn+KjFGBewjmjN2inXYDQHN7ojDem2kZKac0urbo2s1ikkPugQwKiHzBuJ6r0WPVf1vzHNPu3Jk9GuZxVyqkttILaeWXTgBoSJbNEaFC52lLPovvYC0lHVxqifmCTC4uW5oTLVZFLXWUEuN7qvBelZnnscweKO9PyLxh6ruZZ29zPUjqSWUU7B+LBBmYB0sfpc8Gn/4LCpevRDPJ7H4j0SfBD3i/KxxrQDrVsbjpJf7hbylgDftg93xZ9XUqZ29EN7pEwAbMoG5lNNA/KMwbFuu869zdTsRuMYsTKeTlh2Yn4Betvc2eexIZvQcaJXiIIa0U4fhdGewn94kAU5MznfYQdR7i5gIkPSN/ti71ESruRbxD75KSoS+E+Wo/CGqEeBRqi/FuY/edWnYCRgCICnsj81yW54Y0w5/zlKP7DPjrQ6B8hzAIKOQuChtnLtCoBTcw1zUenkBc7ALSxNQTxDCNMUegRR244zwIf6I5mo13UQ== 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:(13230037)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:49.1329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de98d07e-fb5b-4915-70f6-08dc8ff77cc2 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7756 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 | 2 + .../net/ethernet/pensando/ionic/ionic_dev.c | 66 +++++++++++++++++++ .../net/ethernet/pensando/ionic/ionic_dev.h | 3 +- .../net/ethernet/pensando/ionic/ionic_lif.c | 2 + 5 files changed, 73 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 a7146d50f814..f362e76756df 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -377,6 +377,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; @@ -411,6 +412,7 @@ static void ionic_remove(struct pci_dev *pdev) if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state)) set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state); + cancel_delayed_work_sync(&ionic->doorbell_check_dwork); ionic_lif_unregister(ionic->lif); ionic_devlink_unregister(ionic); ionic_lif_deinit(ionic->lif); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 342863fd0b16..5d5990e7376e 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -47,6 +47,61 @@ static void ionic_watchdog_cb(struct timer_list *t) } } +static void ionic_napi_schedule_do_softirq(struct napi_struct *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; + + mutex_lock(&lif->queue_lock); + + if (test_bit(IONIC_LIF_F_FW_STOPPING, lif->state) || + test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { + mutex_unlock(&lif->queue_lock); + return; + } + + 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 +125,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 cd12107f66d7..42a587d14d01 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1191,6 +1191,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) @@ -3406,6 +3407,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; From patchwork Wed Jun 19 00:32:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703289 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2041.outbound.protection.outlook.com [40.107.102.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 A39EF6FC1 for ; Wed, 19 Jun 2024 00:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757236; cv=fail; b=LpGtdmR8sbalfIu8W4dXapByT4raljsqLqNmUrny+kRNSTWgYbaoEE475ps8cUVnC887qFPvozBBR9GK+T4b1QpUWrNc42EoUTDDTMu9rK+oGTd8DIFu7V6KQAUlJHtyF1choUYSyEnkgtm24dEAz6CepfCaZtm/bGxG/JS4WQ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757236; c=relaxed/simple; bh=EK8NBMtehx796JNFT4BMFCWvkrCk4ApaYnZuFMWNU0M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p7g53eDs1g+EIYpG1km19Qs5+J5cMCXS+Zrja8dGcPcbhHeCZLD6Soxp0yfZRUmIOHNbTClQtEX14ihbs+hGH+17dioELFBG0E45oj1yqQk8ROl4GY6l0c5idwMQK0c13Stku5XGDCFt3xGl264LRCIKt4O6vF/L6iE5C1CsnrM= 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=nsX30z4w; arc=fail smtp.client-ip=40.107.102.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="nsX30z4w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X0TRdskX5lHwGmmH+A+SAw7lbcd0zKkA94xbssBflXqvKxNgfHoarYdNZOUZwS4RIMSEpK0SCZPl5g8+FWWHY5mqXtVi8tRfZIYKrrYnCXXypy6trwtDcAvEL5WDc7XFTdx7YT48U2YJDHwYx/2dK9TXQ0a/CTgXw6KCgtDbHAmCRM5u5OONdJt7KTj+7gsCu4/Z/egribQB5u8++TgXARHJpdelwiOrCkEccICSBeZjM0AYZXjcwUpEgafW54fdKnzhRLCxfA6gjxz/h4zx+Y/+wLi2ImRy1ZZmA0imxma7mq3R+Bb2PkUt0vB7ntkJ2LYx+7mHngfP1yKsPqfV+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=IIVJDtq+alQMPYx31dQmMQcxz/NcYVN+rkfuHRJYuwk=; b=Gww9Ik5H9HVR1ktSPwh4HKaBb59l/z0hjD9aSIGqRBAfge5yNagmDJ4v74hDZyCMr8FbxP81KkR3hxMEPrSnVfYsM+xeBLYge2fXL20tJ93b3DMLPFDgZLekRNgc+Oxtz1/17bm+zzYbg2fgG+nb4Ye/zygDU7zgaDw6IWAJl/n3fq46rEkBmAecUImsghTAcZayuM9n5mHtHfdTTIkgG3FgDCtExl5pDj5xn58pcbIc158iMGMdRelMy+VX4Dc7LTr+B18/eqK7eH6deghxU+fjh7JqkAdqEASqY4iKWm2I5ht4qa+xoAz9clbnKwyQaoejQTdOGvH/opDttnU/QQ== 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=IIVJDtq+alQMPYx31dQmMQcxz/NcYVN+rkfuHRJYuwk=; b=nsX30z4wu/ojo2+9oebiODLEzrL+t1Rnfshpt/BEnbkKF3ko0Pl/UUb7m8F3k7VGj3UbKCwo+QyWdIjPF9bCjVkB4r5YchiCJdqvIbN+6nvWOLrmIA7fBzUCp7i9ViuKdnZg7t34xJ6/BgZxHJEGgnUzWpTKWcxMjEpOBCicYiw= Received: from PH7P220CA0103.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::29) by SA3PR12MB9130.namprd12.prod.outlook.com (2603:10b6:806:37f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32; Wed, 19 Jun 2024 00:33:52 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:32d:cafe::48) by PH7P220CA0103.outlook.office365.com (2603:10b6:510:32d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 00:33:50 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:50 +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; Tue, 18 Jun 2024 19:33:47 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 5/8] ionic: add per-queue napi_schedule for doorbell check Date: Tue, 18 Jun 2024 17:32:54 -0700 Message-ID: <20240619003257.6138-6-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|SA3PR12MB9130:EE_ X-MS-Office365-Filtering-Correlation-Id: 5affa8d3-519f-462d-2eb5-08dc8ff77d62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|376011|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: 6r3Qglp0zIaWmI31nh5sKhuD+ahFn+m1fB7Uw3amGrfETPU84LaNGPN04O0/L+KasgLwt1AeRwso8ZnwSWQS1UvwjqUxmKxmQb4FOaxVtUJbc+i4w7lCIxT8oKVHbRkcOAkQ1MjoDz1R23akUnu3GvNU4UyYXCxYYFZOVIa2fJsPPI87yey7HzLiIVLuMqhbyHwoAzXHsJ9jAk7VRN3Hptn7syr6h+Fln3FVkOZo/0QYI80YzjoUIkt1KJSGdR8pFKrJJcIC7U7jbqfXKktlX6f51yYDNbf1udWcLw8Apiz5ow0JWFTcTpCElJUOTOTGCcnh7wUrRMciTvZpzEDuCdC5XE1Efu53F83KoK1KV1SWhRhbgDhLsn47icaVIswr3ivbrfZh3cteA8tMDAVCWrpcLXUtHmEoqqSL+crngE/TgediBLcuNZxfAbuyvWeego/kJcSmOGLKTKIizBiVNU4gBVzu4tdg1vmxpRUyly0IJkZEhV7dvpeLOYI9iLbTV33TTaCDdApV+sJABpdLNEkIDyAX8X0/3Z52s8F6BrUniHM1EKrMwuN+BUGL3nLAdrSu9cCE2cHWHuhAmdYt0tI6p/nXumgFpkC2f0dKcBeal50NT76YzMFe87HnagnzSTPQynsDFcwPa2MLolFKRU8TduLgVGmf2lGRZMknNyJy4k1WAdy3DWcilnxud0W2MiPr0ob9oIwQMrWkMJXf2JZWPLCTtc/aN9e06di0cLiciH1MdC7h4MfbxUPclU4+oocmWA8nEspM907kFQyIIi1FlXalYOti5xxaIJjNJS1YLahW9svNzvU5ifjHGiIXwEAPux2ce/4QqX/Xcx8WJb3ipwIrIA3S24UdRXAwbsPShQOhrTfQTS50LPZOXHwwu10QHlsrEoZuwNVa75dZ92NSCJXpioMDbWusQLRtx77q2VS+zhA0bk5ExoD2i1j3NvMJurR0kLzmDY9rzEvB3XVafwOwIZ5BmghpFBEYTWaUGdVwZabr3y3tT78HrhSNG9iJsAwmOL0YbRzIw+cx73pUD0kLu9My2AHuxKU+F1cCvR9bGHu0hWVIdZfxprKONko8Jh5jExUzJBFX5BgUAls7+RybOh7ew7ItmtXEqKwGcNtu4xAFQaaPsTevmHxC4aHrp2ww3VQmY6Bx+OFz3rXBHX6WAZ3TsO8uAql29ExAmD6X3Ouihym/9xtVhlrbjAyrq7fsV7/TqX5TpgJrDHZe7mmBAN6235DUwQ33R5/3iSf8LjPUV7m0dL+Jh8kvaytXedZdAjRETkTd4INKbEeW/G/3BvKn1lec60Tn4eXu934XwNKv9z/gzcY5CgidczvLsyEMTs4gGYiiNqJjQoykptFjHEKG03iazpLTefc1FFIwIRsjTiyKoVwjatdDvMaNWuclLs9I3EnDKtOxSg== 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:(13230037)(1800799021)(376011)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:50.1798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5affa8d3-519f-462d-2eb5-08dc8ff77d62 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9130 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 5d5990e7376e..56e7c120d492 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -54,6 +54,13 @@ static void ionic_napi_schedule_do_softirq(struct napi_struct *napi) local_bh_enable(); } +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) { @@ -66,6 +73,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, @@ -86,8 +105,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 42a587d14d01..d7abfbe05f2b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -344,6 +344,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); @@ -690,6 +691,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 Wed Jun 19 00:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703290 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) (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 D66B4A920 for ; Wed, 19 Jun 2024 00:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757237; cv=fail; b=rzVGAlfvpNYXSr+nss5J5U3DpZi1cFzH+pGkWNSemUp9VAAsZmKxTJNIx/qdWzS9wdpW6F2pM/KIfc0zVVjt/PCjhHVFVw/euTh4MHf6oaNjNZUbxWhC3LlZ8KE8ki/opZd7tHtRWvqBPKKjHTBWb+CgKr60q31zMISiaGi7wdk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757237; c=relaxed/simple; bh=t33wZQI4GXJOHyKVZvr+MA4t71TSiWrMmGfPjn+3XWc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nk+FN5GA4s+cpDYNSykNgAA0T7Kd6zwEGDu+RrQ4n/UqQObt36DcNPjYojmzxRRd1KMeYaDkm7oETkaEjHxKi9cg6oG6/aADDQWsKr709ltK4Y9utN9NNVSiyyzTHKmwZr4roTMvNrcYPqAfhkGaxGmojcifVAHTKUxZ+sxPN7c= 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=dg5uG3Gn; arc=fail smtp.client-ip=40.107.243.68 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="dg5uG3Gn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KAqQQpOQoy94wo6CGaG34gfmJvqoZQbFNdWLzNDsFxSIXbCgSHH3t9ZXe2L8/uy+jlQxvwaCPhyv1zPq5LKiVB7oVR9acLzanbAKgSGqSj4IX5BL8+Ktf5rC7jRxMGDnQcchh/CBMoIyqOwLA0XkWMudiDZjeq5B5dNH7AAdiwoyCqT20VIGhSayT+3sQb79VI0X4diqCMegpiZ78XF7YP8twHsAwZXpiQ9NXmAZXwCzkMBD0qHy7ZP7XDKoPY0HXxXc0z2JB6XLgNWc3hxjjzuVDjw4xFQK8R+Xni9YorL5Yf2Wpfw0jeuKVUIOABoP5FZDPcZwGusf7AhnwYcFSQ== 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=0pNS1LYNkHzBVGxpxpPaPzmrnkxVxFaudIEfX5iWu74=; b=AYCcgNjaUu9xdyWV/9IMaNpA6syZ2nlUECiDOVo+72p4eFPPOU/aIBqw4zfDAUn3XnJQIclOAbbUSF4V+tK16ZXgkoams/ikRpGuI5VwHlvggLmrSUc4Ho66d1b1h11w0ZcNNqk+PQECDSjzDMVxyS/FXjmCYoI5TATwGs2PheYMdNDQtZCSxgMnTZwDtsduW4v6wcNIR6zQoQOMVMCf0Sk/0p7/fpoVaAZJp2ol5dUnR6eVzJs1P4YNny+rBcMixhV175y71cfpdSFu1DJm+DLgDzPK2Gfe8Z68c7/4oINV/u1PI+2LgSJd1+cBjeRYElLhJsd+eYeyOZlQAXocxQ== 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=0pNS1LYNkHzBVGxpxpPaPzmrnkxVxFaudIEfX5iWu74=; b=dg5uG3GnTrG/Vn30QyDP89kTGx/ejJX2Acld/jhP4Ew3MrH4NfEwGzAcgfMxqurnmjMZbaPofDyz1Z0/jB6/UcRI0HU2pj3EtgQdSerdnGMkW48p56gqGPOTY9nvvZxDonJBCS9yfrRNEVNhHCQgE+2xGbRvHljbEsw8dWtnaCc= Received: from PH7P220CA0117.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::34) by IA0PR12MB8422.namprd12.prod.outlook.com (2603:10b6:208:3de::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Wed, 19 Jun 2024 00:33:53 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:32d:cafe::c2) by PH7P220CA0117.outlook.office365.com (2603:10b6:510:32d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 00:33:52 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:52 +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; Tue, 18 Jun 2024 19:33:47 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 6/8] ionic: check for queue deadline in doorbell_napi_work Date: Tue, 18 Jun 2024 17:32:55 -0700 Message-ID: <20240619003257.6138-7-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|IA0PR12MB8422:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e9841f5-56cd-4499-d04d-08dc8ff77ec7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: 8vSxMWSojw+AAiKJgVmiWR6b3Ac4JAlEOAcLHs9mYDRqs554x1JIw9DJz/ssn6i56QXwyZNR5Bimzqte80ESutDnhlFmUZltNxXsP3fjcPPdSZvpDVSpPyhO74pF0aqOQYsfVPEqUfUNCNR8Z/Zj0CBdcBJUBg/aSjW/guCMzX/VgJj5gyL5o4tgbUDkD256/BaH7I9OV2VJS4JpbV3e2+8GEcfiXWjnLojJ6BNCa9DO+r1Kf+pqg7eqC99Kap/GXvYDETJ2ek8rmOJGQNx916uOy5ridOS07/0qHSJ2cbDgvUy1D4i9nI1b2L7lxxUPLuSVGjTkDA6RtLqoPlzS+0/SbfVFJ1TemH89tbI1uFvBfDgkrRArDZzw0Ej4uiZafMULuY5ymGhuIBiXL2TzLKMiXDC5OzhfGR1Aad4fuBM0B0pRitPCK5E0AfmrGZAwqFJihMWN/SmEjF2P6lSIGtCAWe5lZ0horFeqYfKIIAwTYaCkTScMmCLpw7IGbdyxvsNiCQPbDt2IoJBJX5tKN5PBdu3OmBqZrm0OSWilwLf5oQh2ZQtMcCEeiykKaRNqvwA/FpqlObz62reOfCJRIfFtsAIPgUnN7CVefcTO6RNx8Sez02dPyIOx0BhVOgMiKtWqVqE5ZPgGPoXHimXG4KhCTqrlWL5TXmZ9fFs7H7Qr7E1skXhUfa7qhjXyRQ5ElLzPZoNmpa4J1IF7kgwB8tYSQfSMlrfplDlju9YOm7Nrw+u6z8CtHNGa+IXMSJcg1P3h9789ufZ3FSP8+NX3RbABXEow3pyAd3JVDxTsPh9wKkMErUHOo6dLik/jXQBPL296Lc/2/YjDWaledIV5CcHOXW1JDQ5BKaF+ash7Uis69Ptnmu04sEPzNQ4NsP6yWyUoRisOn47QVyYs26M/ZPHXYvwMJmg6RX2evLUzk4P6evz0s/0A/Ald+9cOl+1YBs06ZZNsHdLqhgVsA6xSeovRO+efYdiTED4B9GHHAwJDLV3Kn/c5JXuGFlnSPATJswJ258jCBQWz/IXT+znH99gtvfv155HRhXaPdzoNAcGXjECkU3RI7SXK1dCz/1XbnOKUyGC29WBYOB3Ns8kVI2klIC88E9yBLaM0hBMBXUkKuk1ZkZqU4TS/z/K0dl0e15ijB5IDyoOMWaceRqNmz3mTNLCyCP63lgr7OZ6rsmYiwoj9lixsZjjCYxw23uI877XnhSkak85P4rnpzaIAkKaG6GAgTDaO1d4tff91wU6iB/Hf4f1qGxuKxik4DAb2/j8+mxNOEwmnZ0zD6uSRLw8bNwkPCJUMjkcY5HPZ9lT6qOgYo2vVcPZ/yHnqk937Ccl/z4UZF/H9ZE9c6N5Ze0VilBtmLFgSVEqKMs2HTt3+V2jnMuOQUjVZpSmDj2gRIoBoEQi6O75Gg7Jpojlyzw== 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:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:52.5236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e9841f5-56cd-4499-d04d-08dc8ff77ec7 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8422 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 56e7c120d492..ec36ace6d010 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -58,7 +58,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 Wed Jun 19 00:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703291 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2085.outbound.protection.outlook.com [40.107.101.85]) (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 909878F6D for ; Wed, 19 Jun 2024 00:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757239; cv=fail; b=QVhElX97g2CVGDWrlZ3dR942ykWpbgAEpMr5RS4ncBZYVtyvPnSHhL4cHvF9CisXKZjeMOQ3z6ybupkqOuyIBa40EVdxfxtekrhItinZ/Rr3wWo7tf+jkeGFPDftUN4kSBlv9i+IfdfbTmmV1xdRgc7qwyUIoWET1OV3q3NZh/g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757239; c=relaxed/simple; bh=MfVamlefaV1WIF/C/69cndT3IZ14FZ08FCuWIdzCoAs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YK1dbf9KaEwNcUNemYJtjWloRK+2VfzKaPfx4/c7yGkBla+vAH16XAX0nnR+jnhjIvfokE3q2lfYUsN9upoQZpvHqz6o/jtp4qKIyhQPADRc1tTQF9K0EV7HBlPn4SxDJk4BJfKaUXkclyp7wAQxjGoaCcJQCHV8XHaFSMA7E60= 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=FMXdXuXc; arc=fail smtp.client-ip=40.107.101.85 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="FMXdXuXc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erg9QlxBv0uqfWRHnxfS87V7mRV7GqMw08E+5FZBljtlj7iqwNsZdXjpWtOFXMGnJPBFlTTZMkx5WWvGKhn6aWiHPk6OEx2wC4bT4+bDQZYNreNxnyG7Ak0YFdSt0jI2zIsQX4nR1qCmnbLPTCB/pquy4r4iprtMEXcU34ToeyAgF6aJHYMGidlEC8Xt9klLRBMZDpx5lJKKGI+/Rks5jQbSiomz+2ci6xqubOtRXjpsN3EFlG6uGuaqKWVJ2vXOqqh8bmwHYSgYPGb+4y9+BZ1rgGU5oJzHhpLhW6qd2yNILJjAP3lrsd6bV1QNNcSHvtT9FDsYV11tjfcn+j3VlQ== 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=SFYdi/uRGxPUEepHCoCtFy3NcbEECYgizrL/XlFOqRc=; b=A8EExFgGKTAhwdWVvGxCxhjGQONnrsfKjLa/Dv7vHmzzsQL1yNav3snlfXCfAxKEPlXXT5fNikBpEwauF732LbgrFl5gyEDk3YCANRIUro6YCyGakPwPIv11Z8rvnd08J1cg44C5HrQfJIfZVLhyvxClOJdCyu7tEWx5Izxg4MEXj/OaX5AOJ6cQKquux9okCJ1bQuHxmatBtqIprMG1l5twmtdovmZik2LqO/is7h6UKAPkuxQmkkCLoHZBLFXKpTZ+7webo06bd/IjDH+wHoZNPJIBWAaftaopSi/ZNIx/HSKo4UA4OZZtSNC+V7xjLvLAdvI5RODIHlQN+GIW4A== 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=SFYdi/uRGxPUEepHCoCtFy3NcbEECYgizrL/XlFOqRc=; b=FMXdXuXc+UR+Xtw9JSJcdyiLzqF6/OzsapttVg0GguTjoQJ/Fm6r+pVCu6fcm1WxLjImdIJ+2mVPN4lWumgIpKatBVlRElCTFXdSHuTdD/+o3TUvwUPKTZdrxihcvpfLaIDjtJMwu0BNsq6m/ScdGpPM3sneCbUVdm2g4UOv0Ns= Received: from PH7P220CA0098.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::9) by SJ0PR12MB6877.namprd12.prod.outlook.com (2603:10b6:a03:47f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 00:33:54 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:32d:cafe::c8) by PH7P220CA0098.outlook.office365.com (2603:10b6:510:32d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Wed, 19 Jun 2024 00:33:53 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:53 +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; Tue, 18 Jun 2024 19:33:48 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 7/8] ionic: Use an u16 for rx_copybreak Date: Tue, 18 Jun 2024 17:32:56 -0700 Message-ID: <20240619003257.6138-8-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|SJ0PR12MB6877:EE_ X-MS-Office365-Filtering-Correlation-Id: f9124e65-6c77-4309-79ea-08dc8ff77f73 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|82310400023|1800799021|376011; X-Microsoft-Antispam-Message-Info: CrprtqFLuJvcWPRMFOYTSbL1QWimoJuqbmcdTWISvWaKvKwgsuWyvn484COThw0dnKNniLIY5Dyx0JPJk8w6RmlllIZDR/4dMcJG1qFG9BsEJZqaQpERjtsbp1j4gXTiwcsmpxzZ7U7gmWnCuaQQfXCV9HsQUt4mAlu0XPQENvGuPb6drC/G5fUtoqCJeSGKMcVzo+MkB02+xpVxmEONg8eU3NdQ6qkA8J+1d9eHH65aa1zwX1Q9/2q+Hi3cEySGFzh6X2zbSO81zfJ7/yleFVPyiUSYs72inbcS40Sl4J/2tv7d7yPBDUbQhQYYzaJ0SrVpgFsFADmD3R+vrzlgIo+7g+nZYeF7hZupJeNSSLrk/Xp6waQACWM8hpHXJwXmTa6z1XqfZSH3Og/9+pY7LOd3nlZKUQZt2QKJ7wjxg8nlqHN9YbhNUnrOm7pYCaRW9e0Q5iKIl2otB1YyqRxDjlz1tFt9621BFLQLg8ClLabDWS0pgpsoIGSUN+XmVR/f2MDJV8XCTFqBnPUwtGZM8BwDMH1zm1ySloMq20qCUacDzgQAUHY+DOhh61348D4rFCDmJvx+naWU3Jq3sIyqjmXMLPSMXGVMxU2ot8G19cD9mkFXU5d/BUKV6Wfr7+J7v/f6DEyDyxR05aYU/FXPFgI1gNlVInjawNmRgJ8ihHVUTZE/Ztx4lhnZr0U6YDHGGUFKx5rANLIYATdK2JuI0xRQ2rcg6cclhdHv6E82oyivyKKsrCeJr0tU81XE6v2M68V0U4NSAxaYuNYCdwmfKIFGlUxmytj51LDlvQTkCftZ/5bc3PiZpEdk+eWGGMtKef9d5WdHlACaq5Q32+A+DMLdqomoG0wAlZG2DPenT5fO8qomRkuQ8Y9MRkH5e9URJFAHk3ZCO6Wnbx+CARJR82H2mVYS1+tzh1jQ8ym14EP+EHr6FL1820QpydqudYOzJxm4FfIhgnA+2no4ZT+cJ7Mdbcwcq4eGib3PXPvq/6ATNTP9C7BAjYLuW028rYVVFwkplrphqCZ650x2x3Hn0SgmG3IpQNqHgP7M9yNchaeF61MW47Cc3DmWUrtw5aOU1fCQbKT6gBy9kqg1YAmc0PZkOBvF7rqkFdHFM5MTXfHryNkZaJ0jLk29IIdNH86QTI38Z0vNsPlMjK54C5mWABTKz3FdIol/pyaBqxHqBMojQw9SGkwI7mxQuTw22mu6Ky6+pqWTinu69ztcBAVvP6pD73X4c8IqxLB1U+hw1vR/DVIZgIMaCWIJdSe51x1vjIcFCkgQ9Xb1i6FddwGaAx62LsH22lugbI2rOPtPp+0rdMAxw+uDbaXffkHfECQXH1NNv4OhNk3ruCvx3BIf5A2dsJPB5Deu6uFZqo9o6NVT+kwPeonYk7QgbRZquM3Zib0qmLCd0jTR5hfAwsmpcw== 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:(13230037)(36860700010)(82310400023)(1800799021)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:53.6486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9124e65-6c77-4309-79ea-08dc8ff77f73 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6877 X-Patchwork-Delegate: kuba@kernel.org From: Brett Creeley We only support (u16)-1 size for rx_copybreak, so we can reduce the field size and move a couple other fields around to save a little space in the ionic_lif struct. Before: /* size: 17440, cachelines: 273, members: 56 */ /* sum members: 17403, holes: 9, sum holes: 37 */ /* last cacheline: 32 bytes */ After: /* size: 17424, cachelines: 273, members: 56 */ /* sum members: 17401, holes: 7, sum holes: 23 */ /* last cacheline: 16 bytes */ Signed-off-by: Brett Creeley Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 11 ++++++++++- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index 91183965a6b7..185a03514ae3 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -11,6 +11,8 @@ #include "ionic_ethtool.h" #include "ionic_stats.h" +#define IONIC_MAX_RX_COPYBREAK min(U16_MAX, IONIC_MAX_BUF_LEN) + static void ionic_get_stats_strings(struct ionic_lif *lif, u8 *buf) { u32 i; @@ -872,10 +874,17 @@ static int ionic_set_tunable(struct net_device *dev, const void *data) { struct ionic_lif *lif = netdev_priv(dev); + u32 rx_copybreak; switch (tuna->id) { case ETHTOOL_RX_COPYBREAK: - lif->rx_copybreak = *(u32 *)data; + rx_copybreak = *(u32 *)data; + if (rx_copybreak > IONIC_MAX_RX_COPYBREAK) { + netdev_err(dev, "Max supported rx_copybreak size: %u\n", + IONIC_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..5bd501355670 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -206,10 +206,10 @@ struct ionic_lif { unsigned int nxqs; unsigned int ntxq_descs; unsigned int nrxq_descs; - u32 rx_copybreak; u64 rxq_features; - u16 rx_mode; u64 hw_features; + u16 rx_copybreak; + u16 rx_mode; bool registered; u16 lif_type; unsigned int link_down_count; @@ -225,11 +225,11 @@ struct ionic_lif { u32 info_sz; struct ionic_qtype_info qtype_info[IONIC_QTYPE_MAX]; - u16 rss_types; u8 rss_hash_key[IONIC_RSS_HASH_KEY_SIZE]; u8 *rss_ind_tbl; dma_addr_t rss_ind_tbl_pa; u32 rss_ind_tbl_sz; + u16 rss_types; struct ionic_rx_filters rx_filters; u32 rx_coalesce_usecs; /* what the user asked for */ From patchwork Wed Jun 19 00:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nelson, Shannon" X-Patchwork-Id: 13703292 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2087.outbound.protection.outlook.com [40.107.92.87]) (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 CFE99AD24 for ; Wed, 19 Jun 2024 00:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757239; cv=fail; b=q5Rd18R7ZO8oAG2t5mTBbxh3iPAynRgXFtRjol+hxb7PDw5k+gY8fwJrP+LkpwcrEnYfN4/2gjsTa7jd8HGk+a4KMJLVTjuSP8A+2Csx4lUJrORVGCM0Ll2jlhm6SKu8OYaHBZOqghsvk4J+LjbcgzJISmcPMsk3WM3qGDleZ9Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718757239; c=relaxed/simple; bh=dk+OeI4Axd+q4xZWbPiDEiRhPIgJ+01f41nOyqOEDo8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PzPvROQS/qIcwHeq7Cibf8UwhHoHbeLvY6QEhXJrvUly2mDzFHznvuFEpY1ytrl8tLBjCQ/eBBdb2lp5YlN9KZyojiF3vG3wl1J8Xv03tjxHLIfLu2jsyq5MLqI2hYxYtfwX1nQ8pIVgiUZ/yF+J9Rku99wi3w2nVVDYqtUirmY= 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=SLQlhKiq; arc=fail smtp.client-ip=40.107.92.87 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="SLQlhKiq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOdt1HnQnYA5MfIUmv6iiv2TAJZvhrmToPM+1qzns3M2TDOJoZ4JdQoP9FtjJGhMeIvJy5bQqgrnlOKPwF4CWYUVAAvFPNMZrThyV/sLDkFBJ/SboGpuL+N1/uUpwSUyzSboqTbR2lFcv84EA3RSJNdlYHOWPR0y4n87SOALEKZAliDXal0nkSO5JfahogLQj7DnuSJhJqk9hKImhMcVqM2mCCVOhmCHhzWV/ycia2YauBPHSyimKIplUi2KShOeUq9C66QIlnYeRAsRUrsF+53U7ldAMeY8XO9sVlzEznsnE3Ek//7g1WBylQj05sSZsEmaM1eKLFn/DJIaUW/q/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=AHdZ8pIWR4ByGpmQpEW7B7hDoQrcrlbhJge2W8yTnZk=; b=LsOlxGBOUGeJmymiYucF2EiRdVXyVVHoyF0Wd0C0hwGcPKIfMHBjdORDQGaymTHPTaPFzXlnN33xMG8tCShylAvrpKfQLxPn9HZmtRGcBMPGJezf7ax6uOT6FXceACNRl83tPPLJnf2PC7GCu3v96Dvr9ea15C4me613ENPPkSaHvYlQxAakAFdkYnIhWwFNS1gtt25cLE1ec3aT9KqWn8sFQ9qtMor/OIURESGEksgFaETFBmbof52YDJCSwm3njHZD95aCtlEPK5FKexZpUTQgfpM/ySEwNWnccArMOZn1o9Zv1idigJpvg3RzRSqjoPjl3cXk+9ki9v1tlnsBDg== 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=AHdZ8pIWR4ByGpmQpEW7B7hDoQrcrlbhJge2W8yTnZk=; b=SLQlhKiqen49lVxYyqodhQrq/07T0yAOoZZj+q6l5P6Vy4ZCh0+XNxxjZPOhM2S4Bqc5IZ9Xbyifnu277ZNkiEQmuRFmu/lMJr8viOs5PWMN39WLMvUqNUvDATmZuQxRuoXoC+KafpuIXLa9UtLTiephPRkSjzxaL/A6nZPQ77w= Received: from PH7P220CA0112.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32d::33) by MN0PR12MB6055.namprd12.prod.outlook.com (2603:10b6:208:3cd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 00:33:54 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:510:32d:cafe::81) by PH7P220CA0112.outlook.office365.com (2603:10b6:510:32d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Wed, 19 Jun 2024 00:33:54 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 00:33:54 +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; Tue, 18 Jun 2024 19:33:49 -0500 From: Shannon Nelson To: , , , , , , CC: , , Shannon Nelson Subject: [PATCH v2 net-next 8/8] ionic: Only run the doorbell workaround for certain asic_type Date: Tue, 18 Jun 2024 17:32:57 -0700 Message-ID: <20240619003257.6138-9-shannon.nelson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240619003257.6138-1-shannon.nelson@amd.com> References: <20240619003257.6138-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|MN0PR12MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: d6ed6d0b-d492-4c10-d834-08dc8ff77fd2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: aC5U+EOqhW/X6ce5yCoztUXigqEUrZqeRbE+DntjsXQ6C7anh1b3VkWZSmLctHuu5zFVameTZYUayelqlYfuYeSSAEZSy9nQWCWkRDawRAx3s5ZbEsTL0pSkOgvJ/CjlElxnNezU4o5dKKhq2IjkTsjC98if9t8QqHJzFhDzfmJa7asdM6JsK/8AbtbBp8L29t7hd/p3vqOOWHet9jv5TC4FAEafld9kipRf5n1QJk7HzNi7JmZ88mCoAL7g6Ht15CW3BUV27qrmFjNeevFjIo3yen9T5tUPy6Rlas5HsoIGxmDLDJbdCCglrzYOJ3TerET+lfbJsl1x4/mixxXjXS7u8KFxnHTDqIq9mNhEbaP5ZMir6d+sfUiKO/i6m8sgiOwwW4pxNWX2KoHCCpdcxXZki6FVwIoZttJioBkqFfNgq7PzS6aAVkwOBcjamNHc36jU8khM3cSUZrd+1IA/wW5G/5dtDRp82ThxIWYrj0co6g79+fLN29XxcnfamV302O/neNk2Pz4YyVlMrcZ+qOQjq/vWL9SV4whuOdabk93gwg0fyvExWvOhfgNOuKDQUT7Z2iWL5xHa2FUi2OpKNF3nznKEh3RaBtp3+ZwAm/3pRRMD4M4Z29Bemu6bsAx7g39t21DS1dr1wWZXKHCFwuCgcGXO2vYupAe/oKm0pagOHE5x5RMDyxf89jnsm78I7hSEJ9Q6vTxvbu+GAtN3Jym7n+yiTKkISkBdYAFyay8fMjKjt+ERuTVELMgH0MaQTg4nH5NBug+jyKfIDgF532LV4ovKZwwYN8qBI0jxLtTDLglBBk04R+xfb9kLuxucuM8dxu48Bxi2DSG2VoQ5lxriddNaHCJdG0/u9dzu5gV1gmOK5g9Maz5h35fl3svz0JiaAAv1TX2WCF/Q3XK7jv+gLVxbpgW3E0qJVnswswV4l+cX6VVIxJZV18SW4Ztu3uj0Y5R/WQc7Lj7udN+hZtXmHWvNuvheUvrEShQeVPiqgbGK+2xVHzDSBYYMKxF1H59sp1ySfwCxIcuUa5UsByF1g+scBBTilrzwz/23hgnL+3gGE1BnxEwjfoQujHGejN0lk3jTp9PG5mXu5tUBRBV5seY8e3sGCRXjeAhuW0QHF9nfK+jNbO6v8ev0thkxkYGvCwgmYfDb5IF/TvUwCr9VPgvf/7XXVSS0CYDjrcmpAqc+4gs+1VtUgVZIxdfS0SC1F85wcW6LpLYmgT82/6ubvUnQPBPB/sKOKkYKGpi64TxKCP9l8ukSIKlQMSzqnCFQsJldU5pavKpGHuamiHJGvYQdbDBvd4V/zJLc7NJqzVbNMrbLONczbCEtLvJXRjgIzLBMcc0RjDrqUk7UQ6dScKcj1iXWTynx3HGs8BzQiuexEKpZW/kDiLlsIszRxTUtl8z6XCstNovPg8UeEw== 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:(13230037)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 00:33:54.2736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6ed6d0b-d492-4c10-d834-08dc8ff77fd2 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6055 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 ++++ .../ethernet/pensando/ionic/ionic_bus_pci.c | 3 ++- .../net/ethernet/pensando/ionic/ionic_dev.c | 16 ++++++++++++-- .../net/ethernet/pensando/ionic/ionic_lif.c | 21 ++++++++++++------- .../net/ethernet/pensando/ionic/ionic_lif.h | 1 + .../net/ethernet/pensando/ionic/ionic_txrx.c | 14 +++++++------ 6 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_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index f362e76756df..b93791d6b593 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -412,7 +412,8 @@ static void ionic_remove(struct pci_dev *pdev) if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state)) set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state); - cancel_delayed_work_sync(&ionic->doorbell_check_dwork); + if (ionic->lif->doorbell_wa) + cancel_delayed_work_sync(&ionic->doorbell_check_dwork); ionic_lif_unregister(ionic->lif); ionic_devlink_unregister(ionic); ionic_lif_deinit(ionic->lif); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index ec36ace6d010..9e42d599840d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -128,6 +128,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; @@ -151,8 +158,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; } @@ -161,6 +170,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 d7abfbe05f2b..3b32228cee1e 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -344,7 +344,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); @@ -691,7 +692,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; @@ -1215,12 +1217,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; } @@ -3749,6 +3753,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 5bd501355670..3e1005293c4a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -211,6 +211,7 @@ struct ionic_lif { u16 rx_copybreak; u16 rx_mode; bool registered; + bool doorbell_wa; u16 lif_type; unsigned int link_down_count; unsigned int nmcast; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index a4e923376484..5bf13a5d411c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -950,7 +950,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; @@ -993,7 +993,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; @@ -1038,10 +1038,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; }