From owner-freebsd-wireless@freebsd.org Wed Dec 20 15:59:45 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A76E91A0B for ; Wed, 20 Dec 2017 15:59:45 +0000 (UTC) (envelope-from amy.hodge@infodigitaldata.com) Received: from IND01-MA1-obe.outbound.protection.outlook.com (mail-ma1ind01on0136.outbound.protection.outlook.com [104.47.100.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9505774CCD for ; Wed, 20 Dec 2017 15:59:44 +0000 (UTC) (envelope-from amy.hodge@infodigitaldata.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORGFT2126287.onmicrosoft.com; s=selector1-infodigitaldata-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2+9E4PzOruVCdyHIzQjQX5MzGDflL3wNfCrhFPxXCac=; b=CWZ0tz9IYIQCZKPEOFdpDDiLeHT5GK9ODrZFn5bzLu8YdkAlUoEBwwPv5rGylu+Ev6QfRJZNQhWlsCxfTgctcdJ/oBiO/n44IgIozwe81NGfb1NXdjyawhkY9wuvEuagtd9GW0/Z0LcrXtob7Oh3Q/XbFofjA0r+UQX0cYuax6c= Received: from PN1PR01MB0800.INDPRD01.PROD.OUTLOOK.COM (10.174.146.22) by PN1PR01MB0798.INDPRD01.PROD.OUTLOOK.COM (10.174.146.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 15:59:39 +0000 Received: from PN1PR01MB0800.INDPRD01.PROD.OUTLOOK.COM ([10.174.146.22]) by PN1PR01MB0800.INDPRD01.PROD.OUTLOOK.COM ([10.174.146.22]) with mapi id 15.20.0323.018; Wed, 20 Dec 2017 15:59:39 +0000 From: Amy Hodge To: "freebsd-wireless@freebsd.org" Subject: M2M Users List Thread-Topic: M2M Users List Thread-Index: AdN5qyjxq31lXqgERY21VTuevYZAhQ== Importance: high X-Priority: 1 Date: Wed, 20 Dec 2017 15:57:16 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=amy.hodge@infodigitaldata.com; x-originating-ip: [49.207.53.75] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; PN1PR01MB0798; 6:VvD84CdQ1azMjxAID1rG6udS7X+TG8gWP5Wk1IYJ3MggHJbFCh03aeIz4jWmCmIYQg1K562yes6Tjj3SmZTENVPqiC9hObRmgvZn9r3zpvlrQlhmzSIf/Ma5uHjGTBLLS6y5EvF/VdITwzcxWQOu0oQf3ozeJDBxQrkrXu5F3LiYxm5fxk0n9QapHBpMMYD4c1Wj04mZu639s2ItvmCkIaXhlruu5gZHsYEFONudjgIzj8V2MIcB89mwyMnK5tP5/B3E6xtQyAGAqG0npeUO5EWSmqXo2orgY1JVBP3o6Vdhk1gsHfxwpLKxL46mh8WaLzPl6l1YnP/HXIFXei7dyDlY2DuEajX86gOMqQ+8OY4=; 5:EX9ZgeQf92EVCzyY/96qFRkr7OyOMgiJeQeEjPFeAHbm+Z/i+GP+O0oKUv+HzTqfLONe9ld9xOKDUgRCHqpX4Mbqg43uPlMH5Bg9/8t39ADJLpV5RdJPrFfu0MNxvegHPqWkF1GviWx3IPryqsGKlLC4YJOgmicCUJaHytFiD5E=; 24:x2cJcIPT6Aq0KJuDecxDtb+tDHtiTjNfTjPJWD74voSATehojytwGvOs3W06ViQ1MgWB63r2dQA/1gNsY9+UVGkY7XEeZBKoocgKnUPJ7aQ=; 7:ywqsD0f9WhONGtUcDQrLPnzWsXCY0YbA/mDii/Phflllkgq2k4CTLBSyB8TmEH9BUayPBRI+w7C3b57bdnX1DO8VpDXCSan5+ihHEhFXb/gNOmeozL+Tz28V2398KbxsOt/rU4aQZK0Y03TpFqxWsmj7fSoIlbvYgJ5lLV8DrFamQXfKossY8U6qu8ti7Sd6babzThMhAEcUST0w8CoRHgW+jGLYYmvD/Ihxvp9tcVwWO6fO9BcV85tkHhnrzxGp x-ms-office365-filtering-correlation-id: b6d27e03-65d0-4961-b0aa-08d547c2ad17 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4603075)(7168020)(4627115)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:PN1PR01MB0798; x-ms-traffictypediagnostic: PN1PR01MB0798: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(2016111802025)(6072148)(6043046)(201708071742011); SRVR:PN1PR01MB0798; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:PN1PR01MB0798; x-forefront-prvs: 0527DFA348 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(396003)(376002)(39380400002)(346002)(366004)(189003)(199004)(25786009)(316002)(2351001)(55236004)(14454004)(6506007)(5180700001)(86362001)(790700001)(106356001)(105586002)(7116003)(6666003)(53936002)(2906002)(478600001)(626008)(5640700003)(6916009)(3846002)(81166006)(5660300001)(8676002)(68736007)(99286004)(9686003)(3660700001)(7696005)(3280700002)(6436002)(6116002)(81156014)(2900100001)(81686011)(74316002)(54896002)(66066001)(97736004)(5630700001)(6306002)(102836003)(33656002)(77096006)(8936002)(7736002)(55016002)(2501003)(19870200002); DIR:OUT; SFP:1102; SCL:1; SRVR:PN1PR01MB0798; H:PN1PR01MB0800.INDPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: infodigitaldata.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: infodigitaldata.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6d27e03-65d0-4961-b0aa-08d547c2ad17 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2017 15:57:16.2117 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 478f63cc-97aa-4e10-99e0-25353d93f572 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN1PR01MB0798 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 15:59:45 -0000 Hello there, Hope you having a great day! I would like to know if you are interested in acquiring Machine to Machine = (M2M) Contact List? We provide the Database across North America, EMEA, APAC and Latin America. We also have other Technology Users like: Internet of Things (IoT), Web of = Things (WoT), Big Data, SCADA, Cloud Computing, VoIP, PBX, SIP and many mor= e. Please share your business email address and contact number if you are inte= rested to get some samples (at no cost) for your review. Await your response! Thanks, Amy Hodge:) Demand Generation- Technology Database To Opt Out, please respond "Leave Out" in the Subject line. From owner-freebsd-wireless@freebsd.org Thu Dec 21 22:43:41 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5142E90791 for ; Thu, 21 Dec 2017 22:43:41 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: from mail-yb0-x232.google.com (mail-yb0-x232.google.com [IPv6:2607:f8b0:4002:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B172D7C1E0 for ; Thu, 21 Dec 2017 22:43:41 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: by mail-yb0-x232.google.com with SMTP id a78so114302ybg.6 for ; Thu, 21 Dec 2017 14:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FIgAe2V0iZdPruz+4XiBJRf/7tPja5UUFJCQWg3fSLA=; b=UYrP068V2skyIa5cwAbvO9g70v66YAnHIdnF7mGNEjgKohYz8Bi0mnokGp4VPSoE1k 3+xd3snBcKYKdu96n24NkkmgnbPX/J1eIEY68TajMpuSLW0jr0ZvW3vGMFGLU9DHeCXP YNqM5C1rbJxmiP9Lyr2feWm4Vk3ziNwoJEdTPclvm9Iz4kq96cNooCTw3rJsxfVIt8l8 ou9a3j5JmM9FECuORqPJzZuX1Q0i0lCBIAJulgz+NobjO6mMmTh1OEygZcQ+pb/ooarh upGkdxDsEL3fr530vMpsZK2Lx0g7u94I61gUXjIF/QV3mwR3J37nNuD/+77P7QVTBthf ZHCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FIgAe2V0iZdPruz+4XiBJRf/7tPja5UUFJCQWg3fSLA=; b=fKAV+veaGbc7xKfw7E+OFyrBfukKblE8Dkzdy6FJCRVBPmhiQj8kvHXHqyeNQEynZL SxRAQ4T/KZ/fxrXn9kSnCaVuY2Fx/0gxRMWyDktlmhqwwML87yrpxZzn+di7P1oMPeoH 39V/X/YXJnhad3sK8ixAMSdetAC0dEfkY1LKJPa2chz1qqsGDo8n1rXnuY+nEo6NQ02A BtBChHLF72wndsWS0RdCzTS+lXssNsPX9B1VEUxOLef1+gkI3KXhS6zsQytADQmoNqYZ UzLaUpob7qBAcMXVz72BKMAS9rIcK0DvkGdUbzUmv/s8n4Xa0U9jKDagetJ7c83NJVf1 CgDA== X-Gm-Message-State: AKGB3mJZxW8SPthFAlvQ4G6bE0WM1PlAnszg/pLw5mbqGc8QjxAYSVcF mK/Q6BMavJdPvaGalPJuVKH7gpV2XmnT8RP+TqT9qEmd X-Google-Smtp-Source: ACJfBoscRkI28zo8AM1QRr0M0oMDBvr4PsuYSQzJQ0nLTOS2Az5rzK08bm5XS5sH0lcxR21AWxI+F+dnps1dAjuYQWk= X-Received: by 10.37.101.139 with SMTP id z133mr9366283ybb.353.1513896220244; Thu, 21 Dec 2017 14:43:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.131.194 with HTTP; Thu, 21 Dec 2017 14:43:19 -0800 (PST) From: Farhan Khan Date: Thu, 21 Dec 2017 17:43:19 -0500 Message-ID: Subject: rtwn(4) extension rtl8188ee receiving constantly interrupts To: freebsd-wireless@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 22:43:42 -0000 Hi, As I wrote a few weeks back, I am working on the extension to rtwn(4) to add RTL8188EE support. At the moment, I am working on the Rx code, which handles interrupts. After the interrupt is triggered, the code goes into the Rx routine and delivers "junk data" in a continuous loop. It seems that the interrupt code is **constantly** called - enough that the load average is frequently above 1.0. I suspect the issue is giving the WiFi driver an acknowledgement of some sort, but I am not certain. I attempted to copy Linux's interrupt code as best as possible, but cannot determine if the error is within my code. Here is a verbose explanation of what I believe Linux is doing and what I am doing on FreeBSD. -----Linux code works as follows----- 1. The IRQ trigger calls the function _rtl_pci_interrupt (drivers/net/wireless/realtek/rtlwifi/pci.c) 2. This calls disable_interrupt, which for rtl8188ee is rtl88ee_disable_interrupt. This function writes IMR_DISABLED (0x0) to REG_HIMR (0xb0) and REG_HIMRE (0xb8). 3. Next _rtl_pci_interrupt calls interrupt_recognized(), a function pointer to rtl88ee_interrupt_recognized(), which: * Reads from REG_HISR (0xb4), stores the value in 'inta', ANDs that value by 0x200084ff, then writes that value back to the same register. * Reads from REG_HISRE (0xbc), stores the value in 'intb', ANDs that value by 0x100, then writes that value back to the same register. Then the function returns returns. 4. Back in _rtl_pci_interrupt if 'inta' is 0 and 'intb' is 0xffff, the code will skip step 5, goto to "done" and execute enable_interrupt code (rtl88ee_enable_interrupt) 5. If bit(0) is set to 1, this is an Rx interrupt and will run _rtl_pci_rx_interrupt(). From my review of the code, from here the Linux driver will read from the DMA memory and send the frame to the ieee80211 layer. I only found 1 additional read instruction related to the power value, but nothing else is changed. 6. Here is the "done" portion, that happens no matter what, but is jumped to immediately as referenced above. It will call enable_interrupt(), a function pointer to rtl88ee_enable_Interrupt(), which will: a. Write 0x200084ff to REG_HIMR (0xb0) b. Write 0x100 to REG_HIMRE (0xb8) c. Write 0 to to REG_C2HEVT_CLEAR (0x01AF, A register having to do with C2H firmware) d. Write 0xc0 to REG_HSIMR (0x58 , I know this value from printf'ing it) This is what I identified from reviewing from the Linux code. -----My FreeBSD Code----- My code is located here: https://github.com/khanzf/freebsd/tree/rx_not_working/sys/dev/rtwn/. 1. The IRQ trigger calls the function rtwn_pci_intr() (sys/dev/rtwn/pci/rtwn_pci_rx.c) 2. The equivalent of Linux's line 2 and 3 is in rtwn_classify_intr, which is a pointer to r88ee_enable_intr located in sys/dev/rtwn/rtl8188e/pci/r88ee_rx. This write's 0x0 to REG_HIMR (0xb0) and REG_HIMRE (0xb8) 3. Continuing, the same function: * Reads from ISR_MINE (same as REG_HISR, 0xb4), ANDs the value by 0x200084ff, store it in 'status'. Then I write the value back to the same register. * Read from REG_HISRE (0xbc), AND the value by 0x100, store it in 'statusb'. Write this value back to the same register. * Since this is an Rx register, the 'ret' value is AND'd by RTWN_PCI_INTR_RX. 4. In the Linux code, if 'status' is 0x0 and 'statusb' is 0xFFFF, it will goto to "done". On FreeBSD, it simply does not set any bits on the 'ret' value and the function returns 0, going back to rtwn_pci_intr. 5. Returning to rtwn_pci_intr(), if the 'ret' (now 'status') has RTWN_PCI_INTR_RX flag on, it executes rtwn_pci_tx_done(), which will read the DMA memory and send the frame to the ieee80211 layer. The execution will skip step 5 if 'ret' was 0 (the RTWN_PCI_INTR_RX flag was never set). This returns execution back to rtwn_pci_intr(). 6. rtwn_pci_intr() concludes by running rtwn_pci_enable_intr(). This is similar to Linux's enable_interrupt(), it does the following: a. Write 0x200084f to R88EE_HIMR (0xb0) b. Write 0x100 to R88EE_HIMRE (0xb8) c. Write 0x0 to REG_C2HEVT_CLEAR (0x01AF) d. Write 0xc0 to REG_HSIMR --------- To me, it appears that I did a complete 1-to-1 copy of the Linux code. However, in my case the driver is receiving constant interrupts without stopping. I am not certain what I am missing or what is different. Could it be that something outside of this particular code path was not properly set. If so, what might that be? Please advise. Thank you, -- Farhan Khan PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE