From nobody Tue Mar 22 21:43:44 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 C264C1A3FAD9 for ; Tue, 22 Mar 2022 21:44:11 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (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 4KNQ3t69hlz4vVf for ; Tue, 22 Mar 2022 21:44:10 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CC8C15C098C; Tue, 22 Mar 2022 17:44:04 -0400 (EDT) Received: from imap45 ([10.202.2.95]) by compute1.internal (MEProxy); Tue, 22 Mar 2022 17:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=farhan.codes; h= cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; bh=7sKHrbZLUzBQbRUCwehnwIEql6D3gjR0blrWlV yofXM=; b=Ctr/d6c+LDrIX2truPKry0utRX6/bJRLKLZ6ied7mvJ29dDlhjhgua VEbUxqoCzWCZtZXTfq86CihFSnLvla//qGpTB5whcY10nX3U/qiUCgR/YpTmrWOD Se+1YQkV3Yn7PTkwxujgu6n85xDg5DYBrQ3aszuwtA1189KfWeB08ji52CPFAxdz DComcX6GZXSF7rcD+KRwy9n8+9y1E3MFRvVdgRzEHDik77pxbA8E+5C7uE5vfDnk 3snFFp8ksMip18lndlGv1unpjwo5ujaCh4BD+akQZG4SMsKTivmGMVDd0+diQzjk rcvUEYU1VrrkmQgP8Y6Oa97TgqQuBXaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=7sKHrbZLUzBQbRUCw ehnwIEql6D3gjR0blrWlVyofXM=; b=YFFOHT0CcQskZUp14HbvjvhuTHkdnuqVZ lvp1GeoQg/7ogFw5hCN/MoyENdKzuB8pi/gcdtVB1Vd7/8NmrKAsSKPimDaz1xZ9 meljXLBsWbvEKUE4A1Nbeg2c6Xxr3x8KL+ZAOxKzzk5MvQXBH8TLufbqOmUntPjj 9fzsG7ixF11nNlA1adVb+QMWONOxdVf9unUC0T6dOb5X7RpvrI7O7hfBadLlKg1h qD2kNqaafW31xz2Kjw5gW2vjEahKUCaJO85HiKzTjg59iGZhBT6msWq91NdpVE7+ C8stkG6vupSpO7grKNry9osDbIrKYfuQ/ngG9/SzGQ3O4QHBXtU/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeghedgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesth dtredtreertdenucfhrhhomhepfdfhrghrhhgrnhcumfhhrghnfdcuoehfrghrhhgrnhes fhgrrhhhrghnrdgtohguvghsqeenucggtffrrghtthgvrhhnpeffgeekfeeulefggeehle efvdffveelueeutdevvdelffefkeejgeeljedvhefgffenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfrghrhhgrnhesfhgrrhhhrghnrdgtoh guvghs X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7FDAA24A0074; Tue, 22 Mar 2022 17:44:04 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4907-g25ce6f34a9-fm-20220311.001-g25ce6f34 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 Message-Id: <1c6df2ff-ba79-4110-af5c-212ea72a1720@www.fastmail.com> In-Reply-To: <341dc4b3-d4c7-edac-66d3-d27f9e16b5fb@selasky.org> References: <57ff6d47-79b3-4409-b804-108fe7d62e9d@www.fastmail.com> <341dc4b3-d4c7-edac-66d3-d27f9e16b5fb@selasky.org> Date: Tue, 22 Mar 2022 17:43:44 -0400 From: "Farhan Khan" To: "Hans Petter Selasky" , freebsd-usb@freebsd.org Subject: Re: Understanding USB callback events and sequence Content-Type: text/plain X-Rspamd-Queue-Id: 4KNQ3t69hlz4vVf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm2 header.b="Ctr/d6c+"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=YFFOHT0C; dmarc=none; spf=pass (mx1.freebsd.org: domain of farhan@farhan.codes designates 66.111.4.27 as permitted sender) smtp.mailfrom=farhan@farhan.codes X-Spamd-Result: default: False [-3.59 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=fm2,messagingengine.com:s=fm3]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.27]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[farhan.codes]; NEURAL_HAM_LONG(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[farhan.codes:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MLMMJ_DEST(0.00)[freebsd-usb]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US]; MID_RHS_WWW(0.50)[]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.27:from] X-ThisMailContainsUnwantedMimeParts: N On Tue, Mar 22, 2022, at 2:28 PM, Hans Petter Selasky wrote: > This just means that the driver wants to check if it can send more > packets after the current job completed (USB_ST_TRANSFERRED). So it "double-dips" in case there are any other packets while it has the CPU without having to call us usb_transfer_start() again. Cool! > > Finally, I have been looking at USB traffic under wireshark (interpreted from usbdump -w file.pcap) and I see that every USB packet has a response from the device. Is this response packet handled by one of the RX callbacks? Or is this the same as TX's USB_ST_TRANSFERRED? > > The "DONE" callback is either USB_ST_TRANSFERRED or USB_ST_CANCELLED / > default. Why is this necessary? Meaning, why not have the driver just process its "Done" step without the need for another callback? Regarding Wireshark, are the reply USB packets from the device processed by a handler in any way? I ask because I am currently porting over some code and I do not seem to have my RX interrupt callback triggering and trying to determine why not. Perhaps something is wrong in my `usb_config`? I wonder if it has anything to do with the endpoint address being a specific address rather than `UE_ADDR_ANY`? Curious why that value even exists rather than the exact address? Questions glore! :) -- Farhan Khan PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE