🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25627

Re: [PATCH v2 03/11] net/xsc: add the command queue

#25627
From: Jason Xing
Date: Wed, 02 Dec 2026 06:21
76 lines
15234 bytes
On Tue, Dec 1, 2026 at 5:22 PM Xin Tian <tianx@yunsilicon.com> wrote:
>
...
> >> +static int xsc_cmd_cq_polling(void *data)
> >> +{
> >> +       struct xsc_core_device *xdev = data;
> >> +       struct xsc_cmd *cmd = xdev->cmd;
> >> +       struct xsc_rsp_layout *rsp;
> >> +       u32 err_status;
> >> +       u32 cq_pid;
> >> +
> >> +       while (!kthread_should_stop()) {
> >> +               if (need_resched())
> >> +                       schedule();
> > cond_resched()
> Will use cond_resched().
> >
> >> +
> >> +               err_status = xsc_read_cmdq_err_status(xdev);
> >> +               if (err_status)
> >> +                       xsc_cmd_err_handler(xdev, err_status);
> >> +
> >> +               cq_pid = xsc_get_cmdq_rsp_pid(xdev) & XSC_CMDQ_INDEX_MASK;
> >> +               if (cmd->cq_cid == cq_pid) {
> >> +                       usleep_range(1000, 2000);
> > xsc_cmd_init() creates a kthread that polls the response ring every
> > 1-2ms, even with no command in flight. 1-2ms means around 1000
> > periodic wakeups/context switches on one cpu.
> >
> > It reminds me of future RDMA support. I noticed there are a few
> > production applications where frequent create/modify/destroy of pairs
> > are unavoidable, meaning the latency there is sensitive. It's unlike
> > TCP 3-way handshake. 1-2ms will possibly add huge latency
> > comparatively.
> >
> > With that said, what I had in my mind is there are three directions:
> > 1. event-driven as you mentioned. Patch 5 already brings up the EQ and MSI-X.
> > 2. demand-driven (dedicated) thread. Keep the kthread, but let the
> > submitter wake it and have it sleep on a waitqueue once no command is
> > outstanding.
> > 3. Or drop the kthread and let the submitter poll in xsc_cmd_invoke()
> > with read_poll_timeout(), using a staged delay (udelay(1) a few times,
> > then usleep_range(20, 30), then 1ms) as bnxt does in __hwrm_send().
> > This also removes the fixed 1ms floor per command.
> >
> > Any thoughts on this?
> >
> > Thanks,
> > Jason
>    This is an intentional trade-off for
>    this series. The command queue only serves the control plane (QP/CQ/EQ
>    create/destroy, queries, config), not the data path, so the completion

Yep, but as I said I saw some applications heavily and frequently
using create qp and friends.

>    latency does not affect throughput. This version ships a single-channel
>    ethernet driver where polling is sufficient, and to keep the series lean
>    (the earlier ~6000-line concern) we keep only the poller for now. We do
>    plan to move the command queue to EQ-driven completion when multi-channel
>    and RDMA support land. So I'd like to keep the poller -- I hope the
>
>    rationale makes sense.

Sure. Sounds good to me.

Thanks,
Jason
Technical Details
Message-ID: <CAL+tcoDPHFmPe1E_GP9z7F54v5N8zFAmccZEGbS=fY0rFRLSfQ@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375581-linux-kernel-netdev=dewy.ru
References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com> <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com> <65f9fb97-fb21-4ffc-9eb3-ee1446cfad8e@yunsilicon.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375581-linux-kernel-netdev=dewy.ru
From: kerneljasonxing@gmail.com (Jason Xing)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 03/11] net/xsc: add the command queue
Date: Wed, 2 Dec 2026 14:21:31 +0800
Organization: Usenet Network
Message-ID: <CAL+tcoDPHFmPe1E_GP9z7F54v5N8zFAmccZEGbS=fY0rFRLSfQ@mail.gmail.com>
References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145718.70868-4-tianx@yunsilicon.com>
 <CAL+tcoCB69Me=4NC5WNUDiN16U_EMeepxGR1NSf0mJ8g6FDiRg@mail.gmail.com> <65f9fb97-fb21-4ffc-9eb3-ee1446cfad8e@yunsilicon.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1905091"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gdVdW7PhP7znzyaQgVHC3gcmcoQ= sha256:chDry/q2FlaU9Yh4dk7SAl5RPyCcYrArJSxZGyLoc3k=
	sha1:9w7wroUD6QQLKZILV1CdQn2eoPo= sha256:FWh+lPQij2tRyoiizhz9WQYgB9QyMeWLOM7NtJuDuUM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C232811756D; Wed,  2 Dec 2026 09:22:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EEW59uy0AAly;
	Wed,  2 Dec 2026 09:22:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-375581-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 7C1C81171EB; Wed,  2 Dec 2026 09:22:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 6083660165B; Wed,  2 Dec 2026 06:22:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796192533;
	b=UFeJ8j32C/fe5lTVyx8A4LYgS9r83GpIGPNs+knbZCLAxgIkYWClKAHHxZs0Rpi5ade+
	 dO5ZVQ7zL68VpXEQ7QFxWlHKsOwHRQlDDTfhNWZ+5/UGvCnFejWgIeKzItiThT1c9PiRI
	 Hxm1cRWF73lWt+/fsIJEnxkJEHEg0Inr84M5hCatLHJEJXmpDyt6kXll49T3dOL/ImViI
	 e/ySrJSEALgHgY4whD4Y0ADrtfB7ivtzzkeLuvjFgIktLQKTNgO//7g6UQGgG4oyVLHR+
	 03CHk12X+g3Z1tDEg3GU9POXlf/4AWPrmVSOuT58JgeXF1aQ1TFkWNHFMGAWjrHz/FQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796192533;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
	 Cc:Content-Type:Content-Transfer-Encoding;
	bh=3D1+8wQkZ/HFiI93LzNyfeCrPh5kbaXE77NghLuSoiQ=;
	b=V62ODQUMHSIFDJjDPzqKQE2j5VszpgGotIrB4TZVh9xYzkGAguhHA7NsNfab3k3oFIes
	 T38PPUxsAfohL9CS6ZpAFPVIo5ZNj40qJAdkYyaGUx+zNN3Qp42sgqQG1FIOvnIAL8MIO
	 W3UJRCSoAv4jvIYCLdbeERWiY3oydendXTaZ52or0xS8x/tQtNAI/itj/duN28L6CmeWT
	 lSXP0NDDHVm5o9LvctloZlG2trlWJLMLWkrsHk+tsYZ86jvcJT9+ZGGqio1Sfe6+79pqk
	 ohzXgxC5Z6zVP4fJH2AyrGlBGyopzj+RNhFYlMO3YwLaXXN7NKrV+SODqrW0hgqAp1w==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dzFLw9Au;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id CEA33606A332;
	Wed,  2 Dec 2026 06:22:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dzFLw9Au
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.167.47
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796192533;
	b=St5w0TMDQuExZwtbCnrFr11OCiZHy8NzNyYLlx+UuT42Zg9wsq/QaHNM33OIrQDrALAq
	 xGcYLg5FylS6FY91e1ecmGg5LVpd+6dpIYqSHhvbAKWA3hkuY+ynyp72U9Dgndr0QYstO
	 SEeRJahCLQDHDRqhPq7TYllMt4LybWvfcqqV8yYK2p15hHPLUy1EV2uAggfvWdxK8FpTG
	 sXpD7SL5JExetZ6QlVk/J+DvJolJ3n416kJazbDfrHwfK9TPBL3JCqPjWS6Fdm6TfMq0c
	 BcTyvCRTh8GsKQyekHE+4JGCNoXluP5TAXF+nBWZLtyZXoYLmOndihq8ONHbCXks78w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796192533;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=3D1+8wQkZ/HFiI93LzNyfeCrPh5kbaXE77NghLuSoiQ=;
	b=r1XblvM495CAmq0djL/95AKt61MfsTRmdWJg+gm6Dqn7qrIgyGWy6FZp8m6Y4ENq+/O3
	 LQNJ/a5LW1/lh1Lm26fCtMwCvSfw8W0AgX0y47d9YmoMja42sK2k1E7Rqcwn/ErCxROhu
	 L+hT5dQvh6+T5XQiVveC9XUaVQfMGw0N4o8zyUIPrjYM6+gK/WlyxFeEe6O/u9a25Lx9v
	 1UXN+Q4dYx2qKgZPWThxCS2bqbVay2irSAWnWkEsNXjst7u+OfX30uv4/uKvFDBk+IAa4
	 PQisYplbZkpL6qZZ6C07zIjqV2tmlQ9hoGrZ1m1vlIpjlnExZMXsg2kz/n3vcvvniaA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dzFLw9Au;
	arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.167.47
X-Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97DDB606A31A
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 06:22:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 97DDB606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5bcdae234ecso8404060e87.3
        for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 22:22:12 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1796192531; cv=none;
        d=google.com; s=arc-20260327;
        b=OS2Mju+HuBHD5sOTflsU75H78I8ZkUZIkDbQzPL70t4sF0kjxEctic50InYKiYTNSl
         79L/5lwL38FQMQONPMappYUwoZ3eRwil3yv8xdPIGLcj1DKp7A5wS/4qk3UBGiky8wjv
         icnLdvdnuhmRMLXXUchEDO+xkQ8OFqWaUS7eBv0mYQ0r4vKWssGoiMUDo4cP/0HZpd+O
         oMzVKdSIVSRt8jRswwvRvpkRCIfL5YY1hHeEld6qo5OR+KRcV8XzSiB9Oz2XcCyn+LBl
         88XtAVN1zh0Tr9+0HHcUAVjNCT72OU9M+C5ZextRVrHyxTO+qYYSNmcQQeGtIPaWv4MR
         lRIw==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=3D1+8wQkZ/HFiI93LzNyfeCrPh5kbaXE77NghLuSoiQ=;
        fh=2JZC5cdqixJl9HAR00OWGLj8P+sZKd3ENyOeQCKx/70=;
        b=ZeuqVIRFFgjSzd8y0WUPebExF5SwckPy9pt6X691zpJ5TVFFwu88kcOqGrBWeoWxg8
         vzu0gR9xVrZEaJVEFBGTUDn1gWiHlVUK8Jmqj+uIk3RdROUm6wgKYdfSirfl9gDUzUh0
         rL04iAUj9hd400aiDmbsRvRyb8Usmle3/EfGaxiqFFORxao27skrOazRgTaLSIFyo2bE
         VoxmUVZseJs7YmrfjK8eQorC0uQSx5bo9ovP1tKadvQss3PXzfduzIgOOHRmJl1cHztS
         v9xZsszhs8ujH1/ZVTavGLe575h6WWndvwMiz+qscKt/G4F53yp5Alvlj+3wMLDaMvkx
         rn5w==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796192531; x=1796797331; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=3D1+8wQkZ/HFiI93LzNyfeCrPh5kbaXE77NghLuSoiQ=;
        b=dzFLw9Au9X+MxU6pEVLSNaWebi2jWFKg1Emd6xcgjqeF1VYxfuAYxGTX1IlW1k3mol
         R6L2SLyo4K0QCYTkKFmhyqYiY1QFrgG9KJvuKDeYA6C8dPzBRacshajePI5MmBlUav/B
         FJNpn974FpDzbxIcGuhAja1c8E39zVsnHnizXDfo+uHt2Y3Wtp1/df+1W5qdOJz9iRg/
         TLVD6K3PcZNOn9+JhDohzKMKBZLXmJ8S5CoyBfzr55mK9APeI+l8t42kpM+apfaW8jUq
         TwfbkbQd7eoz0sjjmYUGAogvAOxg+ykAPOXCt2sjRGPtOsOevRsOZIOF+cDaRiZvoDkA
         NfNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796192531; x=1796797331;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=3D1+8wQkZ/HFiI93LzNyfeCrPh5kbaXE77NghLuSoiQ=;
        b=srpPvomEQAKKKwpSmoGJXMeSWjndCp40b9TI56FejQDGmuMxgS252pr9TMHk+p9iOR
         cSE/6xwAAUdCfyyJ1mLujurLBljcbncBN8GJYwLaNi9sH8/3Bvppgt1RFbBov+FmnyHL
         yzXswrXbXu5vUSWwoE3+bwcrqkqLdohRPbi+STRKFlE2LaX3NMspVKWSOesy+TaGXB3B
         LdOEBGnsQi1+5feshgRXSVSPADw+TJa7rABJnp22UaJK59tMacL489f0NmStpNP07g8P
         2WpjuBCXngDoj7Zh8b14jkfEA6khi1iI7GDYiMqQi3j6vQ5ApHo0YFTPpieKu4bG/cqL
         YgZg==
X-Forwarded-Encrypted: i=1; AL+hErH6u1pvsErDDhQAJL7AM7wIK3hkFllYX5e5FPlAlmOF8aK3B7MyEe/PHweDHrTl7pxiIIcwkJY=@vger.kernel.org
X-Gm-Message-State: APuU4Z+evHFFHqkzV5xYOwg9thYqVVVWAnP/AHVsKTnPQBo5X33Ssg/4
	5aRkLYo9I42d76mFkCEUyXEazu6gg/QszEpJblaTGlSYfMAYISGx9g7nYloDfxj+06Nkh7ddAUe
	5PctMZ40IM5VgxLo49X2I9JLvCejSSiY=
X-Gm-Gg: AZFdTZdc+il5sq/2GKVnbS/xasfz++MmJTe1wU/VdGLAHE3xsJ69m0P3zkNQyF2E1sZ
	kTEvgHmAKe+F6jVeSJ/A1hdiqnMCmuNHfzI5YnDIUkeER7ydA6jihOMSXw2rUfEE3bxXce5aS27
	G5T+GlQmTOcRe/N8/oUoSytHDjEZjZMH47C4Up5a6JsZKfwz8AIHsWfaJjzQQLmDaRx5qH7nSMj
	8Xb4SyypXRRQ9avlQLi3Y8XEXA9GEUlGEsK1VzyF5gchzquuiOiaHfGroLYLpIgHSrtJnG2ChoU
	zCWaE2/Eiw0NKcoSlpy4Tj4HQoWuU5Ok00ltKk3Ecom4B2YXe70fhopU4aN7eMda4X7qI0p6E23
	2/1QRzemzWLm2dY9nHAzHM1zCNl1X9tQw0hCmBW1zjjnn6+8nmFixqtxU9qol818go5YIoUbBnP
	kLnXYkdlrxIOxDTjb+WKsUTBW7hSQ/+osq9PYVL2Jf04LUouelRHA=
X-Received: by 2002:a05:6512:6685:10b0:5c1:5cee:632d with SMTP id
 2adb3069b0e04-5c1bc7d33f7mr7233077e87.32.1796192530634; Tue, 01 Dec 2026
 22:22:10 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <65f9fb97-fb21-4ffc-9eb3-ee1446cfad8e@yunsilicon.com>
X-Gm-Features: Aa3M54oFgunSBhrrajRGE8BVOLMbGJTjnT_ThVR7oX6gdEwHL957xlsXulHTo5k
X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, 
	Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>, 
	Junxian Huang <huangjunxian6@hisilicon.com>, weihg@yunsilicon.com, 
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org, 
	linux-rdma@vger.kernel.org