From nobody Fri May 06 03:52:30 2022 X-Original-To: freebsd-usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 033461ACBCCA for ; Fri, 6 May 2022 03:52:35 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kvc8f19Yzz3L2K for ; Fri, 6 May 2022 03:52:33 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 35C1F32001AB for ; Thu, 5 May 2022 23:52:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 05 May 2022 23:52:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=farhan.codes; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1651809151; x=1651895551; bh=YuH9SWTHjO Bm/jKnEn7DV8t9q2lvemAMjEvb2+tmtXU=; b=VXcG4ijAhYo5Cu2aNY+MVbVEFg /DM4LQajrljVl+XTnT0c3aXzqBmdO/eCAjOluw0y6gYTjbM0AVOcDKpLU9FLLGL2 d+2Fsv+2einY/sV2ekM00mEeYaq59/lFjSk8N9CORpM9bPsur/MI8nwrodjULCHW dW1ecMxq0BBG2NLzCDpRmVME5UWyS5br2sz6VtPunEIOlEl4CBmwlky/Heoai0+J JwFPRJTiJPs5PaR32KTpK6jSMp3oJo+1kVdlPeu/iOvuGdMnxwoHmbhlztR2emVk On4KepkJeUZPiWOWjxk/aKmiTORkTBGm92wi2583TX/aK875mKpYOauzx0VA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1651809151; x= 1651895551; bh=YuH9SWTHjOBm/jKnEn7DV8t9q2lvemAMjEvb2+tmtXU=; b=V WQrO6T6OyZ5plVQgD9/waUIiuiQrW3YLizCl7fOuYFu0VtqS8J06peaUUHnDIFyG pGBw3pKihuQV6OId65qLYhfNEiXrokP3OENel9YbybDupnPg+rAJvaNDhJVDctGa TCKKgyl4ZprnulOB2R5zAXMi+5jXkzhVJbj/ywjcvtUnD5JELsxVqlaYAMspapH3 SdyxzfHg73Skq68n8zX8cEE2Znypa14cmjZ2z0IcHwQUEn27t0H7baFXJR++Y6Ei qCzdic34mF4Djuo5iLEtu/sFXLhZZ7ifSJIO3AEweWAOWhcXgZKfOCWAJqWQ+8pL AuB5t9rGNPvTr5l6SXI0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgggfgtsehtufertddttd dvnecuhfhrohhmpefhrghrhhgrnhcumfhhrghnuceofhgrrhhhrghnsehfrghrhhgrnhdr tghouggvsheqnecuggftrfgrthhtvghrnhepudehveehvdffgfeklefhffetudfhkeelje dvheejvdeigfeivdeuveelffekveefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepfhgrrhhhrghnsehfrghrhhgrnhdrtghouggvsh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 5 May 2022 23:52:31 -0400 (EDT) From: Farhan Khan To: freebsd-usb@freebsd.org Subject: How are USB Rx interrupts periodically polled? Date: Thu, 05 May 2022 23:52:30 -0400 Message-ID: <2101266.irdbgypaU6@fedora> List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Rspamd-Queue-Id: 4Kvc8f19Yzz3L2K X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm2 header.b=VXcG4ijA; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="V WQrO6T"; dmarc=none; spf=pass (mx1.freebsd.org: domain of farhan@farhan.codes designates 64.147.123.21 as permitted sender) smtp.mailfrom=farhan@farhan.codes X-Spamd-Result: default: False [-2.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.21]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[farhan.codes:+,messagingengine.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; CTE_CASE(0.50)[]; ASN(0.00)[asn:29838, ipnet:64.147.123.0/24, country:US]; RCVD_IN_DNSWL_LOW(-0.10)[64.147.123.21:from]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=fm2,messagingengine.com:s=fm1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-usb@freebsd.org]; DMARC_NA(0.00)[farhan.codes]; RCPT_COUNT_ONE(0.00)[1]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; MLMMJ_DEST(0.00)[freebsd-usb]; MID_RHS_NOT_FQDN(0.50)[] X-ThisMailContainsUnwantedMimeParts: N Hi all, My understanding is that you have to manually start a USB Rx interrupt transfer for each read rather than when data is available to read. That makes sense, but I am trying to understand where in the code that reading mechanism is done. I looked up otus(4) and urtw(4), but those drivers only run usbd_start_transfer(9) when the pipe is first created. So, how is the polling of an Rx interrupt done? Background of this question: I am looking up how OpenBSD's implementation does this. They the kernel call usbd_open_pipe_intr(9), which does the handler once every `ival` seconds. I was wondering how one would replicate that on the FreeBSD side. My initial idea was a scheduled task, but that does not seem to be how other drivers implement it. Please advise. Thanks! - Farhan