From owner-freebsd-hackers@freebsd.org Thu Jul 16 20:20:57 2020 Return-Path: Delivered-To: freebsd-hackers@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 7D8F836CB1C for ; Thu, 16 Jul 2020 20:20:57 +0000 (UTC) (envelope-from bmcgover@cisco.com) Received: from rcdn-iport-8.cisco.com (rcdn-iport-8.cisco.com [173.37.86.79]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (Client CN "iport.cisco.com", Issuer "HydrantID SSL ICA G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B75HD4QZVz42sn for ; Thu, 16 Jul 2020 20:20:56 +0000 (UTC) (envelope-from bmcgover@cisco.com) IronPort-PHdr: =?us-ascii?q?9a23=3AFQXq6hLFO82VzHw/ANmcpTVXNCE6p7X5OBIU4Z?= =?us-ascii?q?M7irVIN76u5InmIFeGvKU/gkXEUI/A57RDkeWF+6zjWGlV55GHvThCdZFXTB?= =?us-ascii?q?YKhI0QmBBoG8+KD0D3bZuIJyw3FchPThlpqne8N0UGFtzzalfJrju19zFBUh?= =?us-ascii?q?n6PBB+c+LyHIOahs+r1ue0rpvUZQgAhDe0bb5oahusqgCEvcgNiowkIaE0mR?= =?us-ascii?q?Y=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DWCAA5tRBf/4cNJK1ggQmBSoEjL1E?= =?us-ascii?q?HgUcvLId5A6E4hGyCUwNVCwEBAQwBAS0CBAEBhEwCghMCJDcGDgIDAQELAQE?= =?us-ascii?q?FAQEBAgEGBG2FWwELhggVGQEBOBEBDHQnBBsahQNNAy4BoE8CgTmIYXSBATO?= =?us-ascii?q?DAQEBBYUkGIIOCYE4gmqKCBqBQT+BEUOHAEqDR4ItmR6BO5pgCoJdBJl9n0G?= =?us-ascii?q?RfJ59AgQCBAUCDgEBBYFpJIFXcBWDJFAXAg2OKheDTopWdDcCBggBAQMJfIx?= =?us-ascii?q?3gjUBAQ?= X-IronPort-AV: E=Sophos;i="5.75,360,1589241600"; d="scan'208,217";a="798433692" Received: from alln-core-2.cisco.com ([173.36.13.135]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 16 Jul 2020 20:20:54 +0000 Received: from XCH-RCD-001.cisco.com (xch-rcd-001.cisco.com [173.37.102.11]) by alln-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 06GKKsaE020711 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL) for ; Thu, 16 Jul 2020 20:20:54 GMT Received: from xhs-rtp-001.cisco.com (64.101.210.228) by XCH-RCD-001.cisco.com (173.37.102.11) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Jul 2020 15:20:54 -0500 Received: from xhs-rcd-003.cisco.com (173.37.227.248) by xhs-rtp-001.cisco.com (64.101.210.228) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Jul 2020 16:20:53 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (72.163.14.9) by xhs-rcd-003.cisco.com (173.37.227.248) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 16 Jul 2020 15:20:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I2ARgXSTDIqXAfQyrIqDEbHfyX/iPhtIZe4hC4aHHFkuLtAjMYw4lVwB0s7awfhjBIEMRxtsjJAhnl+Wl3moKLJB4+gabBBdIl7xMdQTGjcYJa84WSFyQI/Tuo1mmYtuMMq0UBGVrXQrRDTWTRNc2ykDzjJxf9EVsgVFH2j3/rtcsdLt1f9jDsonYFiaCbrwiswmMjT7C3710pYDJcNcnRRFn9N5O0LD0IwKvDScAPiavr15KR2TIWE6Li5BOPjHcSsV4wmP8G+jjUNvItzineZUQopPEVB9k3w+xs/FZ3eLNLkb4WdeAbYlvkwu2ETngDfIAEltknEAzDW+DNcnIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YxH3Bkt3sGJIBLG4nP95KarVj65GblD3MRKd6S+8BEc=; b=Rj1FohuseqyfBkslrbLYeYVJY4aGMPhOYnEl7fp79y2R/t1VleyKpRLGw50tZopnAoN1haufcMx6qntwllDzS+oORBlxbGoTgG+PZJLqMLRNK22PuFNzkeRxGr8I0oPy6GZCv+xnbyOcCT8sFKW0gw6epjI1O95qPeUegpYmWwh9nmN8M+Z/wO9gZL3/AeV5YhVZpmzO5D1JwU/KoJHafLAERkKH/zvBjDjoFhqzt53tMdDXQ9qkDrKCTHjMiEaTmwgD/cSkclPZoG9Ni7onwDaoMiT0XE7F9uAI4B8p66AbSL3AYMrAbPl1GcZ730zGor74gwUKJX9jVv50aD6wBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none Received: from BL0PR11MB3442.namprd11.prod.outlook.com (2603:10b6:208:68::19) by MN2PR11MB4317.namprd11.prod.outlook.com (2603:10b6:208:179::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.23; Thu, 16 Jul 2020 20:20:52 +0000 Received: from BL0PR11MB3442.namprd11.prod.outlook.com ([fe80::844f:50d2:7986:e539]) by BL0PR11MB3442.namprd11.prod.outlook.com ([fe80::844f:50d2:7986:e539%7]) with mapi id 15.20.3174.026; Thu, 16 Jul 2020 20:20:52 +0000 From: "Brian Mcgovern (bmcgover)" To: "freebsd-hackers@freebsd.org" Subject: Question on structure of USB (specifically USB Serial) stack Thread-Topic: Question on structure of USB (specifically USB Serial) stack Thread-Index: AQHWW66ajFBPEQF6REi43/I0wUQCzA== Date: Thu, 16 Jul 2020 20:20:52 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2601:18c:d07f:d140:547b:bff9:d6a8:7b19] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 75423e68-441f-447c-1e53-08d829c5bcaa x-ms-traffictypediagnostic: MN2PR11MB4317: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iGw+Xf++h7NW9VKipB1KXaDsqPBCfUdbeixNY4NJnSk0glz0DYBAcTEKRrxorv8Pn3Q1xTw8GV8isxQCipG5ZalPC6M4PWQVmp7WOwWoZD0xmK0AfmANPsKNv/vJPaqwzB9SrHcmrudeZPSSuqysvyTbjFCjAraIStbAJLfo4HDGJy/Bkk7uxoclCRpmk6ng3WY5x4Bx7F+qBX+ZGFoY8TKpN2NDboleVQTK/TO0KpQmEpTS1plWmosc8rQDyBDCTj8rfLAVOfmOsbcp9xghc62owH8AVmJYyJ7S5FygEeGF7GBGWMkADhtcn8VeexOO x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR11MB3442.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(66556008)(5660300002)(64756008)(8936002)(316002)(86362001)(83380400001)(66946007)(66446008)(8676002)(6916009)(19627405001)(76116006)(7696005)(71200400001)(52536014)(66476007)(9686003)(33656002)(6506007)(478600001)(55016002)(2906002)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: TOMaMRzMjrmqHhQf3b0juMkBbKN8UdOSPPeGXvhheg3J9V6PzHt25P4BmuMCixxAEFf0mdaRvt/QzEdtGbQ55wLqMasr1Byaz+j4LL3GChiSUPIdunSQIcwV+3sxDaihnuVfIcybnJ0AtwB8rLMyBNoGyOueOdMb8KENTarX7zoofPlC2ZbVuhxdaOObteqv2DRcJ1aJkFgIiPFOZNiwIumMnMT997Fs+SnTUI77jLn0xtZcdd5ny/V1WUOapj/eIBhTdSCOR5FkXdox0aeMILbXB6TmeRlsZh4UkM9irFa7P5w5ShMqMYerrDXXmlNcEdBEIz4P6UA94KmiLqdGnb1Y5cWm5YoPgAbC77s//Tbu3ci77PplgASo66JQ4SdoE9v5kCYQwoevzkwRxMxMU5bAWBsAgTSKZzso2tU4Ee1yMAMGu2PDi+LCnm8v6FVTg5BuTlI9wchqgg6NjRgvKxkxzH28NVSS4a8GFKG1KrB0X56fwDGUCF+Wtg07wn5QftVtAqv3AUHKrF+1X6bM2nqXRPdrE7BEr2quQtbe03Wdy1ozvgz96h4jg7cAkheL x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR11MB3442.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75423e68-441f-447c-1e53-08d829c5bcaa X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jul 2020 20:20:52.1814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mHnrNAOdiD2PIZnQLdNtSqUTrg1Rt0i85qqoIdHRCdJbxcifos5voyaxTmrxwS16mSb5ZeqRhcoAxmi9FcDQkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4317 X-OriginatorOrg: cisco.com X-Outbound-SMTP-Client: 173.37.102.11, xch-rcd-001.cisco.com X-Outbound-Node: alln-core-2.cisco.com X-Rspamd-Queue-Id: 4B75HD4QZVz42sn X-Spamd-Bar: ----------- X-Spamd-Result: default: False [-11.59 / 15.00]; NEURAL_HAM_MEDIUM(-1.01)[-1.014]; R_DKIM_ALLOW(-0.20)[cisco.com:s=iport,cisco.onmicrosoft.com:s=selector2-cisco-onmicrosoft-com]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[cisco.com:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:173.37.86.0/24]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; NEURAL_HAM_LONG(-1.02)[-1.017]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; RCPT_COUNT_ONE(0.00)[1]; RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; WHITELIST_SPF_DKIM(-3.00)[cisco.com:d:+,cisco.com:s:+]; DKIM_TRACE(0.00)[cisco.com:+,cisco.onmicrosoft.com:+]; DMARC_POLICY_ALLOW(-0.50)[cisco.com,quarantine]; NEURAL_HAM_SHORT(-1.06)[-1.059]; TO_DN_EQ_ADDR_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:109, ipnet:173.37.64.0/18, country:US]; RCVD_COUNT_SEVEN(0.00)[8]; RWL_MAILSPIKE_VERYGOOD(0.00)[173.37.86.79:from]; RCVD_IN_DNSWL_HI(-0.50)[173.37.86.79:from] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 20:20:57 -0000 All, I'm doing some playing with the ucom code, and I'm down to a link in the = data that I'm just not confident I've parsed the code correctly. In sys/dev= /usb/serial/usb_serial.c, specifically in ucom_attach_tty, I'm trying to g= et a reference to the usb_device structure for the device used elsewhere in= the USB code. The specific devices I'm working with are USB->RJ 45 cables = with a built in FTDI chip, in case this matters It appears that the ucom_super_softc and ucom_softc structures are availa= ble. From looking around the code, it appears the sc_parent field of ucom_s= oftc is pointing back to the uftdi_softc structure in uftdi.c (for the uftd= i case), so the path would be ucom_softc->sc_parent->sc_udev, but my concer= n is going through the void *, as it appears each of the devices that use u= com as the base have sc_udev in a different part of their structure, meanin= g I'm likely going to crash the system if I plan on it being an FTDI device= , and its not. Is there a callback or a canonical mechanism for accessing t= his part of the structure given a starting point of the ucom_softc? Alterna= tively, are there any well defined attributes I can use to figure out what = that void* is pointing to, or at least conditionalizing the code so I can d= ereference it correctly? -Brian