{"id":2220330,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220330/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260406233236.3585504-3-joshua.a.hay@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.1/projects/46/?format=json","name":"Intel Wired Ethernet development","link_name":"intel-wired-lan","list_id":"intel-wired-lan.osuosl.org","list_email":"intel-wired-lan@osuosl.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260406233236.3585504-3-joshua.a.hay@intel.com>","date":"2026-04-06T23:32:36","name":"[iwl-net,2/2] idpf: fix skb datapath queue based scheduling crashes and timeouts","commit_ref":null,"pull_url":null,"state":"under-review","archived":false,"hash":"ab89138591914167843338af159c5f0658005372","submitter":{"id":19461,"url":"http://patchwork.ozlabs.org/api/1.1/people/19461/?format=json","name":"Joshua Hay","email":"joshua.a.hay@intel.com"},"delegate":{"id":109701,"url":"http://patchwork.ozlabs.org/api/1.1/users/109701/?format=json","username":"anguy11","first_name":"Anthony","last_name":"Nguyen","email":"anthony.l.nguyen@intel.com"},"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260406233236.3585504-3-joshua.a.hay@intel.com/mbox/","series":[{"id":498901,"url":"http://patchwork.ozlabs.org/api/1.1/series/498901/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=498901","date":"2026-04-06T23:32:34","name":"idpf: queue based scheduling fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/498901/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220330/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220330/checks/","tags":{},"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=5FY0geqI;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqQMP0Dncz1yGM\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 09:21:51 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id EFE0080D60;\n\tMon,  6 Apr 2026 23:21:49 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id W3UjpDAFhfCn; Mon,  6 Apr 2026 23:21:48 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 6EAD080D44;\n\tMon,  6 Apr 2026 23:21:48 +0000 (UTC)","from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists1.osuosl.org (Postfix) with ESMTP id 66C161EB\n for <intel-wired-lan@lists.osuosl.org>; Mon,  6 Apr 2026 23:21:47 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 58AA160A43\n for <intel-wired-lan@lists.osuosl.org>; Mon,  6 Apr 2026 23:21:47 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id oOY39R9MbMuh for <intel-wired-lan@lists.osuosl.org>;\n Mon,  6 Apr 2026 23:21:46 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.19])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 7766A607DB\n for <intel-wired-lan@lists.osuosl.org>; Mon,  6 Apr 2026 23:21:46 +0000 (UTC)","from orviesa003.jf.intel.com ([10.64.159.143])\n by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 06 Apr 2026 16:21:45 -0700","from dcskidmo-m40.jf.intel.com ([10.166.241.14])\n by orviesa003.jf.intel.com with ESMTP; 06 Apr 2026 16:21:45 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6EAD080D44","OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7766A607DB"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1775517708;\n\tbh=IeOafykmlncr8ZsAU6WO41Q1CIBiGCoHoCU4eZ7nqv4=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=5FY0geqIEJa4Cz+zq4JMcOMClOiOvEmzqjdJKVm6vR9hmJfSSYZCWtJIeR510L2HY\n\t HYiMcmbCvg+Zs6lLdsTeZv7Ruu9NqW/HmsFKvKpAhYc/Uhsa7hjf3g2OR3quzUfuGS\n\t wtcwVV1w+B9aTAyD3H2p+PLuXA/LsMakRAIhIFEf113EVMMBouTLWA2L1ZM5goDHlW\n\t L2d2hanPodm8N9DHHwSnaGEw/YABOjtxd644dDB6rR51tjTSP1wuXHMmH7ApTqXmI4\n\t llfoQsbiS9xOexXeY55q3vvLspt9ryxWH+uALUekptYjuHpxWeL3SewPyKG3S65zoM\n\t TC/3hEMsiCI2g==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.19;\n helo=mgamail.intel.com; envelope-from=joshua.a.hay@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp3.osuosl.org 7766A607DB","X-CSE-ConnectionGUID":["ZAMXC6thQ8u73hdKfQnuIw==","ie146FGOS0qcepsWoRMBfA=="],"X-CSE-MsgGUID":["vvwwk58cQa+4so2HEsLIOw==","6mnlO9qORUmQRZmMAe4jag=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11751\"; a=\"76368986\"","E=Sophos;i=\"6.23,164,1770624000\"; d=\"scan'208\";a=\"76368986\"","E=Sophos;i=\"6.23,164,1770624000\"; d=\"scan'208\";a=\"232050500\""],"X-ExtLoop1":"1","From":"Joshua Hay <joshua.a.hay@intel.com>","To":"intel-wired-lan@lists.osuosl.org","Cc":"netdev@vger.kernel.org","Date":"Mon,  6 Apr 2026 16:32:36 -0700","Message-Id":"<20260406233236.3585504-3-joshua.a.hay@intel.com>","X-Mailer":"git-send-email 2.39.2","In-Reply-To":"<20260406233236.3585504-1-joshua.a.hay@intel.com>","References":"<20260406233236.3585504-1-joshua.a.hay@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1775517707; x=1807053707;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=LoyL83Q4kP/YIk5ssgNwI9pOEK+CHoIbH+8bUYCFx5w=;\n b=HX1PV0p/4ih2xLknPcGvJh07clPSui24aiZ5+QeKJi90BTE/fuuXqyLa\n sXBN9ORUuHLbAo1VKAbOx4D+ydePICH3NzM5J9D03KvTNOmL42uunUgQi\n 86mDdFnNFg11IOHygBcwzFa95tnRQhi3xfF8Dces5/wimcKsasOz6JsS9\n 7eaVBaZyij3YCCQRW3Swnh8OXTVG85lL5obthowAXUOffVUMeQZcNSnQu\n pVosBZhlVJglExc918r3bc7pPQAiUPXHraauzYWGLLh/qACQ1R1DjI8yv\n lA5bL0Zq+cb27KFBTYuhWZvAwL+UwPEuPVmqOfvTL0Xft8jxq+s9EdfV/\n Q==;","X-Mailman-Original-Authentication-Results":["smtp3.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp3.osuosl.org;\n dkim=pass (2048-bit key,\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=HX1PV0p/"],"Subject":"[Intel-wired-lan] [PATCH iwl-net 2/2] idpf: fix skb datapath queue\n based scheduling crashes and timeouts","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"The splitq Tx resource checks were assuming that the queues were using\nflow based scheduling and checking the refillqs for free buffers.\nHowever, the Tx refillqs are not allocated when using queue based\nscheduling resulting in a NULL ptr dereference. Adjust the Tx resource\nchecks to only check available descriptor resources when using queue\nbased scheduling. Because queue based scheduling does not have any\nnotion of descriptor only completions, there cannot be any packets in\nflight, meaning there is no need to check for pending completions.\n\nThe driver also only supported 8 byte completion descriptors in the skb\ndatapath previously. However, currently the FW only supports 4 byte\ncompletion descriptors when using queue based scheduling. This meant we\nwere skipping over completions, resulting in Tx timeouts.  Add support\nto process both 4 and 8 byte completion descriptors, depending on the\nscheduling mode. Cache the next_to_clean completion descriptor in the\ncompletion queue struct, and fetch this descriptor before the start of\neach cleaning loop. Access the next descriptor in the loop by\ncalculating the index based on raw byte count.\n\nFixes: 0c3f135e840d (\"idpf: stop Tx if there are insufficient buffer resources\")\nFixes: 1c325aac10a8 (\"idpf: configure resources for TX queues\")\nSigned-off-by: Joshua Hay <joshua.a.hay@intel.com>\nReviewed-by: Madhu Chittim <madhu.chittim@intel.com>\n---\n drivers/net/ethernet/intel/idpf/idpf_txrx.c | 49 +++++++++++++--------\n drivers/net/ethernet/intel/idpf/idpf_txrx.h |  6 ++-\n 2 files changed, 36 insertions(+), 19 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c\nindex f6b3b15364ff..4fc0bb14c5b1 100644\n--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c\n+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c\n@@ -270,11 +270,9 @@ static int idpf_tx_desc_alloc(const struct idpf_vport *vport,\n static int idpf_compl_desc_alloc(const struct idpf_vport *vport,\n \t\t\t\t struct idpf_compl_queue *complq)\n {\n-\tu32 desc_size;\n-\n-\tdesc_size = idpf_queue_has(FLOW_SCH_EN, complq) ?\n-\t\t    sizeof(*complq->comp) : sizeof(*complq->comp_4b);\n-\tcomplq->size = array_size(complq->desc_count, desc_size);\n+\tcomplq->desc_sz = idpf_queue_has(FLOW_SCH_EN, complq) ?\n+\t\t\t  sizeof(*complq->comp) : sizeof(*complq->comp_4b);\n+\tcomplq->size = array_size(complq->desc_count, complq->desc_sz);\n \n \tcomplq->desc_ring = dma_alloc_coherent(complq->netdev->dev.parent,\n \t\t\t\t\t       complq->size, &complq->dma,\n@@ -284,6 +282,7 @@ static int idpf_compl_desc_alloc(const struct idpf_vport *vport,\n \n \tcomplq->next_to_use = 0;\n \tcomplq->next_to_clean = 0;\n+\tcomplq->ntc_desc = complq->comp;\n \tidpf_queue_set(GEN_CHK, complq);\n \n \tidpf_xsk_setup_queue(vport, complq,\n@@ -2193,7 +2192,7 @@ static void idpf_tx_handle_rs_completion(struct idpf_tx_queue *txq,\n static bool idpf_tx_clean_complq(struct idpf_compl_queue *complq, int budget,\n \t\t\t\t int *cleaned)\n {\n-\tstruct idpf_splitq_tx_compl_desc *tx_desc;\n+\tstruct idpf_splitq_tx_compl_desc *tx_desc = complq->ntc_desc;\n \ts16 ntc = complq->next_to_clean;\n \tstruct idpf_netdev_priv *np;\n \tunsigned int complq_budget;\n@@ -2201,7 +2200,6 @@ static bool idpf_tx_clean_complq(struct idpf_compl_queue *complq, int budget,\n \tint i;\n \n \tcomplq_budget = complq->clean_budget;\n-\ttx_desc = &complq->comp[ntc];\n \tntc -= complq->desc_count;\n \n \tdo {\n@@ -2257,11 +2255,12 @@ static bool idpf_tx_clean_complq(struct idpf_compl_queue *complq, int budget,\n \t\tu64_stats_update_end(&tx_q->stats_sync);\n \n fetch_next_desc:\n-\t\ttx_desc++;\n+\t\ttx_desc = (struct idpf_splitq_tx_compl_desc *)\n+\t\t\t\t((u8 *)tx_desc + complq->desc_sz);\n \t\tntc++;\n \t\tif (unlikely(!ntc)) {\n \t\t\tntc -= complq->desc_count;\n-\t\t\ttx_desc = &complq->comp[0];\n+\t\t\ttx_desc = complq->comp;\n \t\t\tidpf_queue_change(GEN_CHK, complq);\n \t\t}\n \n@@ -2271,6 +2270,8 @@ static bool idpf_tx_clean_complq(struct idpf_compl_queue *complq, int budget,\n \t\tcomplq_budget--;\n \t} while (likely(complq_budget));\n \n+\tcomplq->ntc_desc = tx_desc;\n+\n \t/* Store the state of the complq to be used later in deciding if a\n \t * TXQ can be started again\n \t */\n@@ -2437,21 +2438,32 @@ static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 descs_needed,\n  * @tx_q: the queue to be checked\n  * @descs_needed: number of descriptors required for this packet\n  * @bufs_needed: number of buffers needed for this packet\n+ * @flow: true if queue uses flow based scheduling, false if queue based scheduling\n  *\n  * Return: 0 if stop is not needed\n  */\n static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q,\n-\t\t\t\t     u32 descs_needed,\n-\t\t\t\t     u32 bufs_needed)\n+\t\t\t\t     u32 descs_needed, u32 bufs_needed,\n+\t\t\t\t     bool flow)\n {\n-\t/* Since we have multiple resources to check for splitq, our\n+\t/* Since we have multiple resources to check for flow based splitq, our\n \t * start,stop_thrs becomes a boolean check instead of a count\n \t * threshold.\n \t */\n-\tif (netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx,\n-\t\t\t\t      idpf_txq_has_room(tx_q, descs_needed,\n-\t\t\t\t\t\t\tbufs_needed),\n-\t\t\t\t      1, 1))\n+\tif (flow && netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx,\n+\t\t\t\t\t      idpf_txq_has_room(tx_q,\n+\t\t\t\t\t\t\t\tdescs_needed,\n+\t\t\t\t\t\t\t\tbufs_needed),\n+\t\t\t\t\t      1, 1))\n+\t\treturn 0;\n+\n+\t/* For queue based splitq, there is no need to check the number of\n+\t * pending completions since we cannot reuse descriptors until we get\n+\t * completions, so we only need to check for descriptor resources.\n+\t */\n+\tif (!flow && netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx,\n+\t\t\t\t\t       IDPF_DESC_UNUSED(tx_q),\n+\t\t\t\t\t       descs_needed, descs_needed))\n \t\treturn 0;\n \n \tu64_stats_update_begin(&tx_q->stats_sync);\n@@ -3021,6 +3033,7 @@ static bool idpf_tx_splitq_need_re(struct idpf_tx_queue *tx_q)\n static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb,\n \t\t\t\t\tstruct idpf_tx_queue *tx_q)\n {\n+\tbool flow = idpf_queue_has(FLOW_SCH_EN, tx_q);\n \tstruct idpf_tx_splitq_params tx_params = {\n \t\t.prev_ntu = tx_q->next_to_use,\n \t};\n@@ -3040,7 +3053,7 @@ static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb,\n \n \t/* Check for splitq specific TX resources */\n \tcount += (IDPF_TX_DESCS_PER_CACHE_LINE + tso);\n-\tif (idpf_tx_maybe_stop_splitq(tx_q, count, buf_count)) {\n+\tif (idpf_tx_maybe_stop_splitq(tx_q, count, buf_count, flow)) {\n \t\tidpf_tx_buf_hw_update(tx_q, tx_q->next_to_use, false);\n \n \t\treturn NETDEV_TX_BUSY;\n@@ -3072,7 +3085,7 @@ static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb,\n \t\tidpf_tx_set_tstamp_desc(ctx_desc, idx);\n \t}\n \n-\tif (idpf_queue_has(FLOW_SCH_EN, tx_q)) {\n+\tif (flow) {\n \t\tstruct idpf_sw_queue *refillq = tx_q->refillq;\n \n \t\t/* Save refillq state in case of a packet rollback.  Otherwise,\ndiff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h b/drivers/net/ethernet/intel/idpf/idpf_txrx.h\nindex 4be5b3b6d3ed..b6836e38f449 100644\n--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h\n+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h\n@@ -807,11 +807,13 @@ libeth_cacheline_set_assert(struct idpf_buf_queue, 64, 24, 32);\n  * @txq_grp: See struct idpf_txq_group\n  * @flags: See enum idpf_queue_flags_t\n  * @desc_count: Number of descriptors\n+ * @desc_sz: Descriptor size in bytes\n  * @clean_budget: queue cleaning budget\n  * @netdev: &net_device corresponding to this queue\n  * @next_to_use: Next descriptor to use. Relevant in both split & single txq\n  *\t\t and bufq.\n  * @next_to_clean: Next descriptor to clean\n+ * @ntc_desc: Pointer to next_to_clean descriptor for next NAPI poll\n  * @num_completions: Only relevant for TX completion queue. It tracks the\n  *\t\t     number of completions received to compare against the\n  *\t\t     number of completions pending, as accumulated by the\n@@ -833,6 +835,7 @@ struct idpf_compl_queue {\n \n \tDECLARE_BITMAP(flags, __IDPF_Q_FLAGS_NBITS);\n \tu32 desc_count;\n+\tu32 desc_sz;\n \n \tu32 clean_budget;\n \tstruct net_device *netdev;\n@@ -841,6 +844,7 @@ struct idpf_compl_queue {\n \t__cacheline_group_begin_aligned(read_write);\n \tu32 next_to_use;\n \tu32 next_to_clean;\n+\tstruct idpf_splitq_tx_compl_desc *ntc_desc;\n \n \taligned_u64 num_completions;\n \t__cacheline_group_end_aligned(read_write);\n@@ -853,7 +857,7 @@ struct idpf_compl_queue {\n \tstruct idpf_q_vector *q_vector;\n \t__cacheline_group_end_aligned(cold);\n };\n-libeth_cacheline_set_assert(struct idpf_compl_queue, 40, 16, 24);\n+libeth_cacheline_set_assert(struct idpf_compl_queue, 48, 24, 24);\n \n /**\n  * struct idpf_sw_queue\n","prefixes":["iwl-net","2/2"]}