aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig/sfp.c
Commit message (Collapse)AuthorAgeFilesLines
* Move ifconfig SFP status functionality into libifconfigRyan Moeller2020-08-091-913/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libifconfig_sfp.h provides an API in libifconfig for querying SFP module properties, operational status, and vendor strings, as well as descriptions of the various fields, string conversions, and other useful helpers for implementing user interfaces. SFP module status is obtained by reading registers via an I2C interface. Descriptions of these registers and the values therein have been collected in a Lua table which is used to generate all the boilerplace C headers and source files for accessing these values, their names, and descriptions. The generated code is fully commented and readable. This is the first use of libifconfig in ifconfig itself. For now, the scope remains very limited. Over time, more of ifconfig will be replaced with libifconfig. Some minor changes to the formatting of ifconfig output have been made: - Module memory hex dumps are indented one extra space as a result of using hexdump(3) instead of a bespoke hex dump function. - Media descriptions have an added two-character short-name in parenthesis. - QSFP modules were incorrectly displaying TX bias current as power. Now TX channels display bias current, and this change has been made for both SFP and QSFP modules for consistency. A Lua binding for libifconfig including this functionality is implemented but has not been included in this commit. The plan is for it to be committed after dynamic module loading has been enabled in flua. Reviewed by: kp, melifaro Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25494 Notes: svn path=/head/; revision=364058
* net: Update SFF-8024 definitions and strings with values from rev 4.6Eric Joyner2019-08-171-6/+63
| | | | | | | | | | | | | | | This will let ifconfig -v's SFF eeprom read functionality recognize more module types. Signed-off-by: Eric Joyner <erj@freebsd.org> Reviewed by: gallatin@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21041 Notes: svn path=/head/; revision=351153
* ifconfig(8): Display extended compliance code string for SFP transceiversEric Joyner2017-12-051-24/+37
| | | | | | | | | | | | | | | | | - Updates tables in affected files with new entries from newer spec revisions of SFF-8472, SFF-8024, and SFF-8636 - Change ifconfig to read and display the extended compliance code for SFP media if the extended compliance code is not 0. This was being displayed for QSFP transceivers only, but SFP28 media uses this to report 25G capability. Reviewed by: melifaro, sbruno Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D13286 Notes: svn path=/head/; revision=326571
* Use macro MIN() from sys/param.h.Marcelo Araujo2016-04-271-2/+2
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=298681
* Cleanup unnecessary semicolons from utilities we all love.Pedro F. Giffuni2016-04-151-1/+1
| | | | Notes: svn path=/head/; revision=298089
* Improve detection of extended QSFP diagnostics.Hans Petter Selasky2016-03-151-17/+11
| | | | | | | | | | | | | | | | The standards in the QSFP diagnostics area are not clear when the additional measurements are present or not. Use a valid temperature reading as an indicator for the presence of voltage and TX/RX power measurements. MFC after: 1 week Sponsored by: Mellanox Technologies Tested by: Netflix Differential Revision: https://reviews.freebsd.org/D5391 Reviewed by: gallatin Notes: svn path=/head/; revision=296902
* Add SFF-8024 Extended Specification ComplianceAlexander V. Chernikov2015-12-281-4/+44
| | | | | | | | | Submitted by: markb_mellanox.com MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4666 Notes: svn path=/head/; revision=292831
* * Update SFF-8024 Identifier constants.Alexander V. Chernikov2015-05-161-4/+67
| | | | | | | | | * Fix SFF_8436_CC_EXT in SFF-8436 memory map. * Add SFF-8436/8636 bits (revision compliance/nominal bitrate). * Do some small style/type fixes. Notes: svn path=/head/; revision=283009
* Simplify i2c reader: we don't need per-NIC handler anymore.Alexander V. Chernikov2015-05-151-65/+57
| | | | | | | | | Make code use read_i2c() function instead of callback. Simplify&document struct i2c_info. Consistently use uint8_t to read from i2c. Notes: svn path=/head/; revision=282967
* Show SFP+/QSFP memory map dump on higher verbose levels.Alexander V. Chernikov2014-10-231-2/+44
| | | | | | | | Sponsored by: Yandex LLC MFC after: 1 week Notes: svn path=/head/; revision=273541
* Do not try to read i2c info when no transceiver is present.Alexander V. Chernikov2014-09-131-2/+4
| | | | | | | | MFC with: r270064 Sponsored by: Yandex LLC Notes: svn path=/head/; revision=271524
* * Unconditionally turn on SIOCGI2C probing for all interfacesAlexander V. Chernikov2014-09-031-11/+17
| | | | | | | | | | | | | | on "ifconfig -v". I've seen no measurable timing difference for doing additional SIOCGI2C call for system with 4k vlans. * Determine appropriate handler (SFP/QSFP) by reading identification byte (which is the same for both SFF-8472 and SFF-8436) instead of checking driver name. MFC with: r270064 Sponsored by: Yandex LLC Notes: svn path=/head/; revision=271014
* * Add SIOCGI2C driver ioctl used to retrieve i2c info.Alexander V. Chernikov2014-08-291-33/+21
| | | | | | | | | | | | * Convert ixgbe to use this ioctl * Convert ifconfig to use generic i2c handler for "ix" interfaces. Approved by: Eric Joyner (ixgbe part) MFC after: 2 weeks Sponsored by: Yandex LLC Notes: svn path=/head/; revision=270822
* * Add new net/sff8436.h containing constants used to accessAlexander V. Chernikov2014-08-211-88/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSFP+ data via i2c inteface. These constants has been taken from SFF-8436 "QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER" standard rev 4.8. * Add support for printing QSFP+ information from 40G NICs such as Chelsio T5. This commit does not contain ioctl changes necessary for this functionality work, there will be another commit soon. Example: cxl1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=ec07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,.....> ether 00:07:43:28:ad:08 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet 40Gbase-LR4 <full-duplex> status: active plugged: QSFP+ 40GBASE-LR4 (MPO Parallel Optic) vendor: OEM PN: OP-QSFP-40G-LR4 SN: 20140318001 DATE: 2014-03-18 module temperature: 64.06 C voltage: 3.26 Volts lane 1: RX: 0.47 mW (-3.21 dBm) TX: 2.78 mW (4.46 dBm) lane 2: RX: 0.20 mW (-6.94 dBm) TX: 2.80 mW (4.47 dBm) lane 3: RX: 0.18 mW (-7.38 dBm) TX: 2.79 mW (4.47 dBm) lane 4: RX: 0.90 mW (-0.45 dBm) TX: 2.80 mW (4.48 dBm) Tested on: Chelsio T5 Tested on: Mellanox/Huawei passive/active cables/transceivers. MFC after: 2 weeks Sponsored by: Yandex LLC Notes: svn path=/head/; revision=270287
* Zero buffer before request.Alexander V. Chernikov2014-08-181-0/+1
| | | | Notes: svn path=/head/; revision=270129
* Clean up unused definitions.Alexander V. Chernikov2014-08-161-22/+8
| | | | Notes: svn path=/head/; revision=270069
* * Use standard net/sff8472.h header for sff bits and offsets.Alexander V. Chernikov2014-08-161-103/+85
| | | | | | | | | * Convert sff_8472_id to 'const char *' to please clang. Pointed by: np Notes: svn path=/head/; revision=270068
* Add support for reading i2c SFP/SFP+ data from NIC driver andAlexander V. Chernikov2014-08-161-0/+543
presenting most interesting fields via ifconfig -v. This version supports Intel ixgbe driver only. Tested on: Cisco,Intel,Mellanox,ModuleTech,Molex transceivers MFC after: 2 weeks Notes: svn path=/head/; revision=270064