Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1757676pxf; Fri, 26 Mar 2021 14:15:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1QS23gn7sHn127wA272AM64v4g+bgO1kvu4QHUU0TiiX+cyIGukabRhdVqwD5jvzEY4Ik X-Received: by 2002:a50:fa04:: with SMTP id b4mr17606817edq.293.1616793305163; Fri, 26 Mar 2021 14:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616793305; cv=none; d=google.com; s=arc-20160816; b=qLRBfe86TZXdRAE7Y6HH5YSpxKMkJG9fwB/HlLqUvm0FuaEzbd+Vl0dI5o07/HhLq2 85p2nT6bdtoTZUC6MnIas09zROi8vjuLpTf1zz+sB1mwiTfNcEQGAK2YmTbj2HBxIFFf 22G4AxvYbnk4o/W/SbJ+C87vnaR2zW6ZZANea8dKknQ7LRHyay/HvbNRtj1liCdCKT7a oa1oYNoBI9Mwtx7TDNHlpkRA6JWN3KpFTQvmQUg19AQ1F7ppxiHH9Xa/iOpS6JWNpkp5 z4qYyr45Rr2iC09NbJKm0yCRznEIa+wKDXjokBWNpA6IbOjGKbq2vu8ayI4Iu8IG1r+M On3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from; bh=NrSkimZeQx6PdE4ZkrEGT4h5NqLaPRngv9FM4aSbyms=; b=ptIb2MV2K6b4GRJRUdPBkxmwKhBJXRaR3vBI8jgrURiaoE1RuTbkHuFrosx2jlkfh4 DYa1B3qBIiEzaMkLb9y5BXqrb5gARGT/mxkLGP13IpFv5qsnw8kZsMn0Pm3BSGGO62b2 x4Db9B3qVFgt+kFWjLZh+wcEu3BV2X/sPVncidivdltDi0nzYEuHLP9y6ieybKpS6hLa vZCNjhAWmqliUE6zMIcCeFTiRntTsMee8cWiuVEKrO7ou6O6iPM9fdk4nngItYpofv1N I9gW2CQ514mZjExLK2/B0MZtOUd+S4jRlfAv1qVPreFImdZFeH/GGX8OppcokxtxxPJl hhWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si7758901ejs.584.2021.03.26.14.14.41; Fri, 26 Mar 2021 14:15:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbhCZVJv (ORCPT + 99 others); Fri, 26 Mar 2021 17:09:51 -0400 Received: from p3plsmtpa09-03.prod.phx3.secureserver.net ([173.201.193.232]:46956 "EHLO p3plsmtpa09-03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbhCZVJl (ORCPT ); Fri, 26 Mar 2021 17:09:41 -0400 Received: from chrisHP110 ([76.103.216.188]) by :SMTPAUTH: with ESMTPA id Pti5lXABrc40iPti6l1OKO; Fri, 26 Mar 2021 14:09:38 -0700 X-CMAE-Analysis: v=2.4 cv=Cot6zl0D c=1 sm=1 tr=0 ts=605e4d92 a=ZkbE6z54K4jjswx6VoHRvg==:117 a=ZkbE6z54K4jjswx6VoHRvg==:17 a=kj9zAlcOel0A:10 a=MXRq0mXx-RAhC34I2ScA:9 a=CjuIK1q_8ugA:10 a=fCgQI5UlmZDRPDxm0A3o:22 X-SECURESERVER-ACCT: don@thebollingers.org From: "Don Bollinger" To: "'Andrew Lunn'" Cc: "'Jakub Kicinski'" , , , , , , , , , , "'netdev'" , "'Moshe Shemesh'" , References: <01ae01d71850$db4f5a20$91ee0e60$@thebollingers.org> <20210315103950.65fedf2c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <001201d719c6$6ac826c0$40587440$@thebollingers.org> <009601d72023$b73dbde0$25b939a0$@thebollingers.org> <011301d7226f$dc2426f0$946c74d0$@thebollingers.org> <011901d7227c$e00015b0$a0004110$@thebollingers.org> In-Reply-To: Subject: RE: [PATCH v2] eeprom/optoe: driver to read/write SFP/QSFP/CMIS EEPROMS Date: Fri, 26 Mar 2021 14:09:36 -0700 Message-ID: <011c01d72284$544c8f50$fce5adf0$@thebollingers.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQIn9Rn138S2ieljdt1P4rieupeZMgI33dQVAf1peR4CCKQDaAINVcRpAhqKAxkCWKqBOgE8vtiLAcIzA0wBJxcy+QL8fwBAqVYSElA= Content-Language: en-us X-CMAE-Envelope: MS4xfLRug2nTtgck3zuB/MqhLW554hPRoikOzK4oHb9MSlI7Lzok5YXIT23Dmvt7Ad92psmBxLRMFTM0fxF70aXfPerCxbv6cWA7REEIwYryp03n7r3ZIocV DdAyhyMO2ZcgxeXXBFu6vVfUS6Cka1g7LMtwidJkcGlW4ERipAlpczUptgddznbdZ6ayOGmP/SXvdZiDIKaCH3qnDzJNzDnXzaLvTS4CHjBQNmLzmSBHq2jq k2W++/blyeWZ1FC0dWqFQwHRXg6tj0rsnN4AKqGvYDr5OzyIMskAljW/oc7x4Jc1N2rfBGLjgrSX6eg7WzyzDJK1ym0FkVmqfWwYy4Xg3zfn4apfHSyP6FI6 JBUJmd4rq3iS8z2pYaEeKlBEx7f8A9xZv02bvVYXKf215cGU4DxfdAI/5NnwRqn8HIhtJUIaA92hA0g95OdlGHwZqoGbMM0eUfdZcIueROXjxlAn4wvTxBTg 5WomIELpXiM4vS48VmZiQJSn11/hAw3Csk7qHFYmj1qmzeDOL5o+PB/fBscAXebZNYFK+/UYxTwn3Gscv8N4+ZgTOeOUY1JVJsoAoJl67+qlTFui09RYXPTp EYQj50LTyjsj8c0Nls1HaePf Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 01:37PM -0700, Andrew Lunn wrote: > On Fri, Mar 26, 2021 at 01:16:14PM -0700, Don Bollinger wrote: > > > > In my community, the SFP/QSFP/CMIS devices (32 to 128 of them per > > > > switch) often cost more than the switch itself. Consumers (both > > > > vendors and > > > > customers) extensively test these devices to ensure correct and > > > > reliable operation. Then they buy them literally by the millions. > > > > Quirks lead to quick rejection in favor of reliable parts from > > > > reliable vendors. In this environment, for completely different > > > > reasons, optoe does not need to handle quirks. > > > > > > Well, if optoe were to be merged, it would not be just for your > community. > > It > > > has to work for everybody who wants to use the Linux kernel with an > SFP. > > > You cannot decide to add a KAPI which just supports a subset of > > > SFPs. It needs to support as many as possible, warts and all. > > > > > > So how would you handle these SFPs with the optoe KAPI? > > > > Just like they are handled now. Folks who use your stack would filter > > through sfp.c, with all the quirk handling, and eventually call optoe > > for the actual device access. Folks who don't use kernel networking > > would call optoe directly and limit themselves to well behaved SFPs, > > or would handle quirks in user space. You think that's dumb, but > > there is clearly a market for that approach. It is working, at scale, today. > > > > BTW, why can't we have a driver > > You keep missing the point. I always refer to the KAPI. The driver we can > rework and rework, throw away and reimplement, as much as we want. > The KAPI cannot be changed, it is ABI. It is pretty much frozen the day the > code is first committed. Maybe I don't understand what you mean by KAPI. The KAPI that optoe exposes is in two parts. First, it makes the EEPROM accessible via the nvmem() interface, an existing KAPI that I call from optoe. at24 implemented it, I made use of it. This interface exposes EEPROM data to user space through a defined sysfs() file. I didn't invent this, nor am I proposing it, it already exists. Second, it specifies how the data in the EEPROM is accessed. It says that low memory is in offset 0-127, and paged memory starts at offset (128 + (page * 128)). For SFP devices, memory at i2c address 0x50 is the first 256 bytes, and everything at 0x51 is pushed up 256 bytes. This is exactly the behavior of ethtool. Again, I didn't invent this, I adopted the existing convention for how to flatten the SFP/QSFP/CMIS address space. With these two parts, EEPROM data can be accessed by standard open(2), seek(2), read(2), write(2) calls. Nothing special there, the actual syntax is as old school and standard as you can possibly get. So, what is wrong with that KAPI? The only thing wrong I can see is that it doesn't use the kernel network stack. Here's where "you keep missing the point". The kernel network stack is not being used in these systems. Implementing EEPROM access through ethtool is of course possible, but it is a lot of work with no benefit on these systems. The simple approach works. Let me use it. > > The optoe KAPI needs to handle these 'interesting' SFP modules. The KAPI > design needs to be flexible enough that the driver underneath it can be > extended to support these SFPs. The code does not need to be there, but > the KAPI design needs to allow it. And i personally cannot see how the optoe > KAPI can efficiently support these SFPs. Help me understand. Your KAPI specifies ethtool as the KAPI, and the ethtool/netlink stack as the interface through which the data flows. As I see it, your KAPI only specifies i2c address, page, bank, offset and length. How does your KAPI support interesting SFP modules but mine does not? optoe could be reworked ad infinitum to implement support for quirks, just as yours can. Neither has any hint of quirks in the KAPI. Don