From owner-freebsd-usb@freebsd.org Mon Mar 2 21:45:46 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62C9A25B5F4 for ; Mon, 2 Mar 2020 21:45:46 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48WYbs5D2Yz4Wbk for ; Mon, 2 Mar 2020 21:45:45 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1583185544; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=qRfUCtUhPIyoEUY38I5qce2uvnCX0w6a0GvqsxAx8LpBR48IGHrOeE0zGkDYM2eVJk1DsLtHrqM+O 0VCwKuGAX+q/JBJSXDVHuzuEJ8GpXk2bMtkqmEqga3qNQ0TR/YcIAZYRC9WiIXYL+UyV7ydE4YyjmB 5uuyUXq1lSJFBx+Qk4M+3yePK2/xGUzCS9nqopDwmRii4U4JGj5tJCWcFQu1mBJ7fXxHX3MnALLTzO Zk6kIDv7KIvD+0hfJzBw+qb9ZNxQnepjyClpSSXZ5x5Y/5Uh3pchujibcgn6B16Gqq07/iq7G67SAr dpfowRKqIX36oXq1Ml25EjvnNgfW0Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=AJ1zslkDFes+eTSfX55jOlt0vy9IYV88V4jxuwOJgt4=; b=MnRh0uG4HvjZzdernTpkIyYgaNyGbm+1WqJKi4dXFY3nPsEW1AMSikenKE22SFTQ8BIBEL/WCDlg4 UP9gwhxxgTQTzWxnkbH0QzcIuZYYIzikoukp5ZhOQJKMRmL3Zwgeqk1Kp+/buOnlmD542YD2gZkFXf hc6EmIgd9HLghqCfmZIYFldYcTKBIuoGPJc/Uy0mNYp71UlY4MY0kyZmDDQO1HKeyQVpEkS45XCPrU OMKc8nuyHBhosYbBQv+mIvV7tTlcbFF6y5eujF511EqcVM1y0gKDmM47EnlqwxXbrLd9gEizykivN4 wxtbipOT9cYq66EM+JqqplEHRP9CdPQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=AJ1zslkDFes+eTSfX55jOlt0vy9IYV88V4jxuwOJgt4=; b=AyN0Lvky0iju3aZgQ5yUgEB+d4dU9wRmqZSgXF6Q3nZOu7rzIXpCbwU5UZNoauAX2cvryY8AfpGLX hIGMaJQiVC7CGi7HyPo+e83JN6h1jMWCg5GV2jOUDdD6U996pAEcNE0jaqr1iUS2bcjZYmcBWQo109 thsSYjxClFiy0jbkfoIB0ogOeoLcieNDeFCd8qR7N5BrzrcgKVVlEVRb+c/BbVMsUs6lHiR3EvfvbC RqiYEkGnLQ5kHsaksjkuecp3VbLNYjvVeedQZvO0B1oHGTrDSnfl9GBneOvJIF5Qj+02C5Z0F5wAWK YU28XI45e6JbWqn2dQ6HNNSqLKhNybA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 29715e6f-5ccf-11ea-b80e-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 29715e6f-5ccf-11ea-b80e-052b4a66b6b2; Mon, 02 Mar 2020 21:45:42 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 022LjeE9013277; Mon, 2 Mar 2020 14:45:40 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: Understanding how USB transmission works From: Ian Lepore To: Farhan Khan , freebsd-usb@freebsd.org Date: Mon, 02 Mar 2020 14:45:40 -0700 In-Reply-To: <8d84a572-f70f-4080-bfe2-263b7f97993c@www.fastmail.com> References: <8d84a572-f70f-4080-bfe2-263b7f97993c@www.fastmail.com> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 48WYbs5D2Yz4Wbk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.61 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.61)[-0.609,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2020 21:45:46 -0000 On Mon, 2020-03-02 at 16:19 -0500, Farhan Khan wrote: > Hi all, > > I am trying to understand how FreeBSD's usb transfers work compared > to OpenBSD by using the rum(4) driver. I am a little confused how the > FreeBSD side works. > > On the OpenBSD side, it seems that after allocating the pipes, you > use usbd_setup_xfer and usbd_transfer(). As an example, look at > OpenBSD's /usr/src/sys/dev/usb/if_rum.c, starting on line 2027-2029, > I believe that corresponds to FreeBSD's > /usr/src/sys/dev/usb/wlan/if_rum.c, line 2607 (rum_setup_tx_list) > which goes to 807. In this function, I see that it adds rum_tx_data > (tx_data[i] to the end of tx_free. However, how does it actually send > the data? I believe this occurs in the callback functions, > specifically with the usbd_transfer_submit function, but I am not > certain how that is triggered, especially when it is triggered by the > driver, such as in a send function. > > Please assist. > Thank you! > > Links below to make it easy to follow: > OpenBSD: > https://github.com/openbsd/src/blob/2e342c845e9966c26657b08851237fc18e7b5ff5/sys/dev/usb/if_rum.c#L2024 > > FreeBSD: > 1. https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L2607 > 2. https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L807 > I think you're probably looking for: https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L1623 Note that I don't know anything about the if_rum driver in general, I just know to look for occurrances of usbd_transfer_start(). -- Ian