From nobody Sun Dec 14 12:12:39 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.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 429A41ACEA6; Thu, 22 May 2025 06:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895877; cv=none; b=D8MNSAZT7kaItFFmhi0gruSCc43NfhLVBErb5VmTCIW7PT4fgMNxpU/DZZcguKSKzf0VLovLVU0yIcukR1Bqw9Ze3uCXHK9y3dbxblDUmvb1xdXAJFStiscnwOcjgtcW+nZ0m1nPrU0otUXfIZzP7/beVqmnso35bnX23z5C42Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895877; c=relaxed/simple; bh=uBlSAeu0InLqUwHqIpbqtlkDc3mvWJhwhxVYmOdp14M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wz2TeHm9oeXvbwPgISO/C8joG1Ef2Hq2kMjdTTppNONwJxgJG6N0Rb2gV6b7umV97kYKBnxBAuQneGAClleaamUMZzEAW+f5sstDAinmA3/P60RZchDqSDvePEUfOq/Wg0iQwjyUs6YVApXgKMBTdoibgDS7iJ2T9Mx7yrwCilo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b2z4Y2gJHz6GFXc; Thu, 22 May 2025 14:33:01 +0800 (CST) Received: from frapeml500005.china.huawei.com (unknown [7.182.85.13]) by mail.maildlp.com (Postfix) with ESMTPS id C46F01402FC; Thu, 22 May 2025 14:37:53 +0800 (CST) Received: from china (10.220.118.114) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 22 May 2025 08:37:49 +0200 From: Gur Stavi To: Gur Stavi CC: , , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Fan Gong Subject: [PATCH net-next v2 1/3] queue_api: add subqueue variant netif_subqueue_sent Date: Thu, 22 May 2025 09:54:41 +0300 Message-ID: <19057ca470251f5c48d90f379edafdb639278339.1747896423.git.gur.stavi@huawei.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To frapeml500005.china.huawei.com (7.182.85.13) Content-Type: text/plain; charset="utf-8" Add a new macro, netif_subqueue_sent, which is a wrapper for netdev_tx_sent_queue. Drivers that use the subqueue variant macros, netif_subqueue_xxx, identify queue by index and are not required to obtain struct netdev_queue explicitly. Such drivers still need to call netdev_tx_sent_queue which is a counterpart of netif_subqueue_completed_wake. Allowing drivers to use a subqueue variant for this purpose improves their code consistency by always referring to queue by its index. Signed-off-by: Gur Stavi Reviewed-by: Jakub Kicinski --- include/net/netdev_queues.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index ba2eaf39089b..7b6656ee549f 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -294,6 +294,14 @@ netdev_txq_completed_mb(struct netdev_queue *dev_queue, netif_txq_try_stop(_txq, get_desc, start_thrs); \ }) =20 +#define netif_subqueue_sent(dev, idx, bytes) \ + ({ \ + struct netdev_queue *_txq; \ + \ + _txq =3D netdev_get_tx_queue(dev, idx); \ + netdev_tx_sent_queue(_txq, bytes); \ + }) + #define netif_subqueue_maybe_stop(dev, idx, get_desc, stop_thrs, start_thr= s) \ ({ \ struct netdev_queue *_txq; \ --=20 2.45.2 From nobody Sun Dec 14 12:12:39 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.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 147962222D4; Thu, 22 May 2025 06:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895882; cv=none; b=SneHqTBo0ebAskqlQ2I5eeHPDk6G6nWbrPnindg6QrA8mkh+y7LVtJG5GB8BTQNPAhBsbeBg+z9ao5lQ67srjZ6WkJQc7ka0ZYp29TZXswJPMJwDm1WMIVG93uGD6u7Wdwp6CKEWyihub4HHQWEgrvai8EykPM7MX4/AFwAvsDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895882; c=relaxed/simple; bh=Co7iTXeSexNM0KzOIzkhOWOr9cEpHpm6VkYH6fgg2yc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dqL7vv7iT0YW3OC4U42zry6ntW04i0WH42ixISXavp4RuXS5Eq/fLa19FVpSvN0RZASZjwC86AQOinsC98eDhe8un3MnsRQ++6Ijtsg31lJMFyP1d3056za1FKD8uxh/wmZHyn31maCEfuI/33mwM3amGKXUtV/4p1B4pYe8n30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b2z9C6m4Jz6HJf7; Thu, 22 May 2025 14:37:03 +0800 (CST) Received: from frapeml500005.china.huawei.com (unknown [7.182.85.13]) by mail.maildlp.com (Postfix) with ESMTPS id 04997140557; Thu, 22 May 2025 14:37:59 +0800 (CST) Received: from china (10.220.118.114) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 22 May 2025 08:37:54 +0200 From: Gur Stavi To: Gur Stavi CC: , , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Fan Gong Subject: [PATCH net-next v2 2/3] hinic3: use netif_subqueue_sent api Date: Thu, 22 May 2025 09:54:42 +0300 Message-ID: <2f14adef7673782f2ffe9e3df9e5d45ecf2b7f96.1747896423.git.gur.stavi@huawei.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To frapeml500005.china.huawei.com (7.182.85.13) Content-Type: text/plain; charset="utf-8" Improve consistency of code by using only netif_subqueue variant apis Signed-off-by: Gur Stavi Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/huawei/hinic3/hinic3_tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/e= thernet/huawei/hinic3/hinic3_tx.c index ae08257dd1d2..7b6f101da313 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c @@ -542,8 +542,7 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *= skb, goto err_drop_pkt; } =20 - netdev_tx_sent_queue(netdev_get_tx_queue(netdev, txq->sq->q_id), - skb->len); + netif_subqueue_sent(netdev, txq->sq->q_id, skb->len); netif_subqueue_maybe_stop(netdev, tx_q->sq->q_id, hinic3_wq_free_wqebbs(&tx_q->sq->wq), tx_q->tx_stop_thrs, --=20 2.45.2 From nobody Sun Dec 14 12:12:39 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.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 11504221DBC; Thu, 22 May 2025 06:38:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895887; cv=none; b=SnrTBsXGR4CvGvBz4XaJ0H0XIJDPcW1j+x6tdVgnJ45yBjJVEhlQZLqqIXF1OFJZguWaNU141rWnwk+rfiHhCrWYFwNTBfvkF/m3sNPL5bPYKuQnybCwH9BjBJNVh42bF60y4ZYFz21/SMWM9z0G3SCrd0ylZd2hGvelgHgScTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747895887; c=relaxed/simple; bh=OvgUR6M8mrEzNRJnUalt7yVdkbKC4auzhxypn5qvETY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K898G7612Ai5FIYxa2zitRyr9UWd2qIQhDwL72zLQYPMZpxtRW3+6BR3FrtNA3YAyPoJLKYwxGj+z5PslWjtns7QRIFVmWUZ2muFAgmYM1TeZedPpj5DoLI232o5gOoH1tBpXsztmpYb8kh7/j+19DlBzFHqFG2y0Yg8E9ruPQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b2z6f2xc7z6DJ8M; Thu, 22 May 2025 14:34:50 +0800 (CST) Received: from frapeml500005.china.huawei.com (unknown [7.182.85.13]) by mail.maildlp.com (Postfix) with ESMTPS id 0897D140605; Thu, 22 May 2025 14:38:04 +0800 (CST) Received: from china (10.220.118.114) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 22 May 2025 08:37:59 +0200 From: Gur Stavi To: Gur Stavi CC: , , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Fan Gong Subject: [PATCH net-next v2 3/3] hinic3: remove tx_q name collision hack Date: Thu, 22 May 2025 09:54:43 +0300 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To frapeml500005.china.huawei.com (7.182.85.13) Content-Type: text/plain; charset="utf-8" A local variable of tx_q worked around name collision with internal txq variable in netif_subqueue macros. This workaround is no longer needed. Signed-off-by: Gur Stavi Reviewed-by: Jakub Kicinski --- .../net/ethernet/huawei/hinic3/hinic3_tx.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/e= thernet/huawei/hinic3/hinic3_tx.c index 7b6f101da313..3f7f73430be4 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c @@ -482,7 +482,6 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *= skb, { struct hinic3_sq_wqe_combo wqe_combo =3D {}; struct hinic3_tx_info *tx_info; - struct hinic3_txq *tx_q =3D txq; u32 offload, queue_info =3D 0; struct hinic3_sq_task task; u16 wqebb_cnt, num_sge; @@ -506,9 +505,9 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *= skb, if (likely(wqebb_cnt > txq->tx_stop_thrs)) txq->tx_stop_thrs =3D min(wqebb_cnt, txq->tx_start_thrs); =20 - netif_subqueue_try_stop(netdev, tx_q->sq->q_id, - hinic3_wq_free_wqebbs(&tx_q->sq->wq), - tx_q->tx_start_thrs); + netif_subqueue_try_stop(netdev, txq->sq->q_id, + hinic3_wq_free_wqebbs(&txq->sq->wq), + txq->tx_start_thrs); =20 return NETDEV_TX_BUSY; } @@ -543,10 +542,10 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff= *skb, } =20 netif_subqueue_sent(netdev, txq->sq->q_id, skb->len); - netif_subqueue_maybe_stop(netdev, tx_q->sq->q_id, - hinic3_wq_free_wqebbs(&tx_q->sq->wq), - tx_q->tx_stop_thrs, - tx_q->tx_start_thrs); + netif_subqueue_maybe_stop(netdev, txq->sq->q_id, + hinic3_wq_free_wqebbs(&txq->sq->wq), + txq->tx_stop_thrs, + txq->tx_start_thrs); =20 hinic3_prepare_sq_ctrl(&wqe_combo, queue_info, num_sge, owner); hinic3_write_db(txq->sq, 0, DB_CFLAG_DP_SQ, @@ -630,7 +629,6 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) struct net_device *netdev =3D txq->netdev; u16 hw_ci, sw_ci, q_id =3D txq->sq->q_id; struct hinic3_tx_info *tx_info; - struct hinic3_txq *tx_q =3D txq; unsigned int bytes_compl =3D 0; unsigned int pkts =3D 0; u16 wqebb_cnt =3D 0; @@ -662,8 +660,8 @@ bool hinic3_tx_poll(struct hinic3_txq *txq, int budget) hinic3_wq_put_wqebbs(&txq->sq->wq, wqebb_cnt); =20 netif_subqueue_completed_wake(netdev, q_id, pkts, bytes_compl, - hinic3_wq_free_wqebbs(&tx_q->sq->wq), - tx_q->tx_start_thrs); + hinic3_wq_free_wqebbs(&txq->sq->wq), + txq->tx_start_thrs); =20 return pkts =3D=3D HINIC3_TX_POLL_WEIGHT; } --=20 2.45.2