Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4548213imm; Mon, 11 Jun 2018 14:25:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLkmuYNTydxyL1beVITxKrewkRQc+GjdhPZdZrC+ZVfIJ5ICztsdVINtlyUbWFjQHbJF9nr X-Received: by 2002:a63:41c1:: with SMTP id o184-v6mr683527pga.323.1528752331872; Mon, 11 Jun 2018 14:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528752331; cv=none; d=google.com; s=arc-20160816; b=esASSNwbprwzrMa4YncSDtaIKkMZVaItM0ddBgM3QqRp5BlmbHVt1h2BgFJR+Eydeu 3XGkcVwPAdb9bnb9cl++ksP7Mmlz20kCjsPF3BcnACUmBIYblwa3bgYGqhWBdX9sEqTC v5D+4n4A9D+4rAftk8aYgclTdrmz8W3ZrLaS0JwxQkL/1GcE3Y59/bpzKF1CUTAQAwzB aqD3oPFlpbwxJvf7WNOah7sjSsfCmkhRPp8GbD18aJGGMkMHvGlUksTqjGQVzCCN66WF PXY1lmWAjCtFgqWH5HLOJ3PiIuecNM0oVUGd0lrMNw709lcbn64xZ0cR2rADVTaLxG9f DIHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=941Eg1bV/YbOzSgAElDt1XpVe2J9Om8M0eu87h7dQZ4=; b=ZOVMa5fri1yBIUnMgD8VMYc9TEjNTdOyIpTHWBVbGQPl2YSX8I2P3FuT0tPItD4O+8 oZ/SamwPOVFYSOOpkGbiUfav06LXWU5p5CMbJpqhLfLYK3Gw7r5zfJ8mwneUCxcRkFPd TMZClnN9Ab/GeeP6DS3RKQy6Ga9Dy2nQmHiklX94mEKxs9ziGsfzyGOQFxd6jkk0/A05 FRzI/IgVH7/lNTQUukixEguVpjD4s8HUpC17X7RZqlHr1cGhIxr+UdAfzi6un6J6YTSp hvptOUEqSj9FiH656hKchCN+z9yoBQQnSOLlaSa7ql76deppZlmA+paMZPUoYi/Bj/4l Oz+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si41437368ple.447.2018.06.11.14.25.17; Mon, 11 Jun 2018 14:25:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934553AbeFKVUY (ORCPT + 99 others); Mon, 11 Jun 2018 17:20:24 -0400 Received: from resqmta-po-09v.sys.comcast.net ([96.114.154.168]:53902 "EHLO resqmta-po-09v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934487AbeFKVUT (ORCPT ); Mon, 11 Jun 2018 17:20:19 -0400 Received: from resomta-po-03v.sys.comcast.net ([96.114.154.227]) by resqmta-po-09v.sys.comcast.net with ESMTP id SU1PfpQ4dv8ZOSUEcfVhUX; Mon, 11 Jun 2018 21:20:18 +0000 Received: from thebollingers.org ([73.223.250.230]) by resomta-po-03v.sys.comcast.net with ESMTPA id SUEZfGLqvbew8SUEafpaUd; Mon, 11 Jun 2018 21:20:18 +0000 Date: Mon, 11 Jun 2018 14:01:04 -0700 From: Don Bollinger To: Tom Lendacky Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, brandon_chuang@edge-core.com, wally_wang@accton.com, roy_lee@edge-core.com, rick_burchett@edge-core.com, quentin.chang@quantatw.com, steven.noble@bigswitch.com, jeffrey.townsend@bigswitch.com, scotte@cumulusnetworks.com, roopa@cumulusnetworks.com, David Ahern , luke.williams@canonical.com, Guohan Lu , Xin Liu , steve.joiner@finisar.com Subject: Re: [PATCH] optoe: driver to read/write SFP/QSFP EEPROMs Message-ID: <20180611210104.cdmzcdexkyte4klz@thebollingers.org> References: <20180611042515.ml6zbcmz6dlvjmrp@thebollingers.org> <496e06b9-9f02-c4ae-4156-ab6221ba23fd@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <496e06b9-9f02-c4ae-4156-ab6221ba23fd@amd.com> User-Agent: NeoMutt/20170113 (1.7.2) X-CMAE-Envelope: MS4wfG7gzwhdNJqL9rWuU6JU7dvc49A8+3BetSqFx+Xx28pWry6rXoZxbKHoAvQAj29TqNECvc1zrX1g5Yy67ENSXqyOt+eaNsj8sJTvOO551x7dn9kDPk2m +wO3sUDNthnlfhoIbyfjHYKfXhlgJZ2vWHh070eNISrrMFL95bQLaqIciAcwct34oyxX7/y5CVCcZ6IpID7UKppHcsxvi541AwuQCiiMT8/WKd4FmRdzQRqj /yQpeGHXBF/cNbT7b0ixLB51UarY2LU+AmAYKYmzV6pxCsA92yvpDc4J26GL6KikONYZ7FSNabRF8KuZxU6LRLvceKcJk5HtH5OKQ+TX2+8rqhOYuacvaau7 GXnFnnoknk8T4y2n7jKlW6ov5u3g6z15wPdhwsos6IYlRBYFDO9eBhHvHFRrqHRYBX8lCagAhQ0O6kmhq0zZvg2F8SZxtvXkw3wO+f9Gt4gYcF8bh+yIfld4 rNJkb/+dkRrhg392ALQVF1g8rrKPNYB2YHwYaMwMRlHzrk9L4R8W8wjY3hxrTqpkXHGVnp1y11Slaf5hrC9MBhVolCZwrwK5QnDyqJMQOfR6gCigFRCvl96N BKXy3/gS7CMxx2Nch8cTqZernE7WjFrFblemFtt/9sUT+P3K+aevrgQRYmstlgOg0e2DVmwkFTImA3+r8E6udz58cHgZDh0pJQXdOb5PvViuCfVbw0mz6vTh 9WDdqD4Atd3UEy4/0fmHiVxQd684BLAHjf+fXXPiH1jfKSh7FarLP85PlH7cYiVjzseyCA7simdJESvp3hocVg+D0O79UWLXXH1K+6FJlCUpQyMOZTHG5Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 11, 2018 at 01:33:07PM -0500, Tom Lendacky wrote: > On 6/10/2018 11:25 PM, 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) and MSA standard QSFP and similar devices > > (conforming to the SFF-8436 spec). > > > > 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. > > > > EEPROM data is accessible via a bin_attribute file called 'eeprom', > > e.g. /sys/bus/i2c/devices/24-0050/eeprom. > > > > Signed-off-by: Don Bollinger > > --- > > > > Why should this driver be in the Linux kernel? SFP and QSFP devices plug > > into switches to convert electrical to optical signals and drive the > > optical signal over fiber optic cables. They provide status and control > > registers through an i2c interface similar to to other EEPROMS. However, > > they have a paging mechanism that is unique, which requires a different > > driver from (for example) at24. Various drivers have been developed for > > this purpose, none of them support both SFP and QSFP, provide both read > > and write access, and access all 256 architected pages. optoe does all > > of these. > > > > optoe has been adopted and is shipping to customers as a base module, > > available to all platforms (switches) and used by multiple vendors and > > platforms on both ONL (Open Network Linux) and SONiC (Microsoft's > > 'Software for Open Networking in the Cloud'). > > > > This patch has been built on the latest staging-testing kernel. It has > > built and tested with SFP and QSFP devices on an ARM platform with a 4.9 > > kernel, and an x86 switch with a 3.16 kernel. This patch should install > > and build clean on any kernel from 3.16 up to the latest (as of 6/10/2018). > > > > > > Documentation/misc-devices/optoe.txt | 56 ++ > > drivers/misc/eeprom/Kconfig | 18 + > > drivers/misc/eeprom/Makefile | 1 + > > drivers/misc/eeprom/optoe.c | 1141 ++++++++++++++++++++++++++++++++++ > > 4 files changed, 1216 insertions(+) > > create mode 100644 Documentation/misc-devices/optoe.txt > > create mode 100644 drivers/misc/eeprom/optoe.c > > > > There's an SFP driver under drivers/net/phy. Can that driver be extended > to provide this support? Adding Russel King who developed sfp.c, as well > at the netdev mailing list. > > Thanks, > Tom I don't think that would work very well. It's software, anything is possible, but... sfp.c appears to be working with mdio, gpio and 'sfp_bus', in addition to i2c. optoe only access the EEPROM, and only via i2c. The linux standard i2c interfaces are the only dependencies for optoe. Also, sfp.c does not support QSFP (best I can tell), and it does not support additional pages beyond the 256 bytes at i2c address 0x50 and 0x51. Best I can tell, sfp.c supports SFP devices on NIC cards. Those cards have a very different hardware architecture from the network switches that optoe is targeting.