Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1687826pxb; Fri, 26 Feb 2021 19:06:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxT8bNwHAbH5+KN+/c68+KACQDPes5s7R90AlKD3SeF6nKk6jmB31j9ocs8YvzjQtEMuwn3 X-Received: by 2002:aa7:ccd4:: with SMTP id y20mr6537224edt.94.1614395171532; Fri, 26 Feb 2021 19:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614395171; cv=none; d=google.com; s=arc-20160816; b=qZj0L5zlbFhwRgAYc+tvHTsALcLZwK8yVHmBM/NohKrA7jmtJETRvLFYT0kIMbUlYg a3bWzQuOJF2CB2ekFosezNjW7Vgk0sJ2NQNxHVz6CRrAjSl27D3BQvhJW5gQA3QoBSsa yez9I5LqvwzNxMrf0mUZyRm9hWGNDWU93FnKsii9yLu3dq2eRVbBzjHXXnlCOpF7PypB yFvwTNByj29Nq+eEaSd9jfGv6dv3SNzQFk7cl9xo7N/5JeITbWMlszKYU5P+Ln3PWMKZ Les/PfIHIcTnyWNHtWILNnJBtZKUSZg1WT8M0KD1tlW0j8fQWKPmwnEWbusPD79lKiim d/ag== 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=JW0H+pSBgzuarY+eec76gJmVAWOYiMk80UdfbhLDiWA=; b=soPRD4U4g2ZX5eUTsOVZc95WaJUe6oeb0ScHAYcxXd2cin1Aev7iDnWW4/UueXeDcM WZYle+dmQfqAwUpBWrEuIbHOVLxxcAN4yi+Rwp4aRJFswYj+vVUsy1/7sJBZefWz06RU RdSuioZqeZmp7k9Q/ogGL01bCw7ZwUH9I8dfWE0UCQsrXO+iXqa8F1qjNCkpDCzDbCka lFcEL/uxAal6zBA0Xk4XYqz2TvtaBxKpFWOcoIzNy9iZJ4dxkaneLWyntYqLnkJwXzG1 n6g8X9hvCattBxvKH1HdNZ8x+KE+/kysJGfrkWZhAc/mcJzDF8g1U3oqPOH5l97alcZf NhIg== 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 j18si7018230edw.197.2021.02.26.19.05.47; Fri, 26 Feb 2021 19:06:11 -0800 (PST) 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 S230053AbhB0Czn (ORCPT + 99 others); Fri, 26 Feb 2021 21:55:43 -0500 Received: from p3plsmtpa09-08.prod.phx3.secureserver.net ([173.201.193.237]:46880 "EHLO p3plsmtpa09-08.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbhB0Czm (ORCPT ); Fri, 26 Feb 2021 21:55:42 -0500 Received: from chrisHP110 ([76.103.216.188]) by :SMTPAUTH: with ESMTPA id FpcKl4mTzvmOLFpcLlNjVY; Fri, 26 Feb 2021 19:46:06 -0700 X-CMAE-Analysis: v=2.4 cv=I6Wg+Psg c=1 sm=1 tr=0 ts=6039b26e a=ZkbE6z54K4jjswx6VoHRvg==:117 a=ZkbE6z54K4jjswx6VoHRvg==:17 a=kj9zAlcOel0A:10 a=9rYyynFDu-Sy5EvBzPcA:9 a=CjuIK1q_8ugA:10 X-SECURESERVER-ACCT: don@thebollingers.org From: "Don Bollinger" To: "'Andrew Lunn'" Cc: , , , , , , , , , "'netdev'" , References: <20210215193821.3345-1-don@thebollingers.org> In-Reply-To: Subject: RE: [PATCH v2] eeprom/optoe: driver to read/write SFP/QSFP/CMIS EEPROMS Date: Fri, 26 Feb 2021 18:46:05 -0800 Message-ID: <000901d70cb2$b2848420$178d8c60$@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: AQKX2ThEytgxSBCv+zte4L/P7xUGAgJF1IfoqNd7BDA= Content-Language: en-us X-CMAE-Envelope: MS4xfLhnB6rtrG/0pUf1SzZL2148mkVoMuVJ3y0CEPbe/WSkjxw69VaTD2tucrVxwBIuXR2SX8ZtWUpWAN4k6lfiM/siFrMbJ3JpRIp8SnhytX2bEi8X8okK jtqg4dakMLPqFn883HPt/ZZco0K5NByVcT8DkD5SsWciUDUnHEzFNDchKDriXiOWHWahr6UjhqEzTlFagI4hVvAI69J59tojZsW8JmaR1EkeYDgylW5s4Spa J4fk49KtvBnYE/I5ItzlJt3Rau3A2CzE9yKgjtBuzN62ItCHkdZTFg3FSMtfeq2C7tWuYsHJki44c/FhU1stv0NM2jwiTndee5XVtoB0rqf4BYBEGG27sMfY W3MtYvJdySRt/CUSftehmRklMoNJTZVt8covDriMD8/T2eVn5C4jZMOmAmNcm6WgcieO1vI8ZmUmz/qxftR93ladhlwd6zK0GAh3swI0018jl4mvokIHvOMO M46pKm1O2pZ+a7yGbIeup5CHjeoo6KGvzMWAWYAY31zlHljqFj7x+ovJ6PN24ED3F51tQUZHuMYXg27yiX6RJwAL/nRqGy6Juxk5VA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 26, 2021 at 2:35 PM -0800, Andrew Lunn wrote: > On Mon, Feb 15, 2021 at 11:38:21AM -0800, Don Bollinger wrote: > > optoe is an i2c based driver that supports read/write access to all > > the pages (tables) of MSA standard SFP and similar devices (conforming > > to the SFF-8472 spec), MSA standard QSFP and similar devices > > (conforming to the SFF-8636 spec) and CMIS and similar devices > > (conforming to the Common Management Interface Specfication). > > Hi Don > > Please make sure you Cc: netdev. This is networking stuff. Will do. > And we have seen this code before, and the netdev Maintainers have > argued against it before. Yes, though I have tried to make it more acceptable, and also more useful to you... > > These devices provide identification, operational status and control > > registers via an EEPROM model. These devices support one or 3 fixed > > pages > > (128 bytes) of data, and one page that is selected via a page register > > on the first fixed page. Thus the driver's main task is to map these > > pages onto a simple linear address space for user space management > applications. > > See the driver code for a detailed layout. > > I assume you have seen the work NVIDIA submitted last week? This idea of > linear pages is really restrictive and we are moving away from it. No, I haven't seen it. I can't seem to locate anything in the past month on LMKL from NVIDIA. Please point me to it. What are you using instead of mapping the pages into a linear address space? Perhaps I can provide a different interface to call with some other mapping. > > The EEPROM data is accessible to user space and kernel consumers via > > the nvmem interface. > > ethtool -m ? This is actually below ethtool. Ethtool has to fetch the data from the eeprom using an appropriate i2c interface (these are defined to be i2c devices). And, to fetch the data from any but the first 256 bytes the code ethtool calls must deal with the page register on the device. This driver handles the page register, for both SFP and QSFP/CMIS devices. This driver would be a useful path for ethtool to use when someone decides to make that data available. Note for example, CMIS devices put the DOM data (per-channel Tx power, Rx Power, laser bias) on page 0x11. When you want that data, you'll have to go past 256 bytes and deal with the page register. optoe will do that for you. > In the past, this code has been NACKed because it does not integrate into > the networking stack. Is this attempt any different? Yes. I have updated the driver with all the latest changes in at24.c, the primary eeprom driver. That update includes use of the nvmem interface, which means this driver can now be called by kernel code. I believe it would be useful and easy to replace the sfp.c code that accesses the eeprom with nvmem calls to this driver. By doing so, you will be able to access the additional pages of data on those devices. You would also get the benefit of sharing common code the other eeprom drivers. As part of that cleanup, the explicit sysfs creation of an eeprom device has been removed. Full disclosure, the nvmem interface creates that device now. > Thanks > Andrew One more point, I have been requested by the SONiC team to upstream this driver. It is on their short list of kernel code that is not upstream, and they want to fix that. They are not consumers of the netdev interface, but they (and other NOS providers) have a need for a driver to access the eeprom data. Greg KH was involved in that request, and I related your concerns to him, as well as my position that this is an eeprom driver with partners that need it independent of netdev. His response: GKH> I can't remember the actual patch anymore, but you are right, it's "just" GKH> poking around in the EEPROM for the device, and doing what you want in GKH> userspace, which really should be fine. Submit it and I'll be glad to review it GKH> under that type of functionality being added. He didn't say he would override your position, but he suggested it was appropriate to submit it. So, here it is. Thus: 1. There are existing NOS platforms that need and use this functionality, they want it in the upstream kernel. 2. This driver is better than sfp.c, and could easily be plugged in to improve netdev and ethtool access to SFP/QSFP/CMIS EEPROM data. Don