mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
* Unconditionally turn on SIOCGI2C probing for all interfaces
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
This commit is contained in:
parent
6b17688b56
commit
5c02a66b2b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271014
@ -753,25 +753,31 @@ void
|
||||
sfp_status(int s, struct ifreq *ifr, int verbose)
|
||||
{
|
||||
struct i2c_info ii;
|
||||
uint8_t id_byte;
|
||||
|
||||
memset(&ii, 0, sizeof(ii));
|
||||
/* Prepare necessary into to pass to NIC handler */
|
||||
ii.s = s;
|
||||
ii.ifr = ifr;
|
||||
ii.f = read_i2c_generic;
|
||||
|
||||
/*
|
||||
* Check if we have i2c support for particular driver.
|
||||
* TODO: Determine driver by original name.
|
||||
* Try to read byte 0 from i2c:
|
||||
* Both SFF-8472 and SFF-8436 use it as
|
||||
* 'identification byte'
|
||||
*/
|
||||
if (strncmp(ifr->ifr_name, "ix", 2) == 0) {
|
||||
ii.f = read_i2c_generic;
|
||||
print_sfp_status(&ii, verbose);
|
||||
} else if (strncmp(ifr->ifr_name, "cxl", 3) == 0) {
|
||||
ii.port_id = atoi(&ifr->ifr_name[3]);
|
||||
ii.f = read_i2c_generic;
|
||||
ii.cfd = -1;
|
||||
print_qsfp_status(&ii, verbose);
|
||||
} else
|
||||
id_byte = 0;
|
||||
ii.f(&ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&id_byte);
|
||||
if (ii.error != 0)
|
||||
return;
|
||||
|
||||
switch (id_byte) {
|
||||
case SFF_8024_ID_QSFP:
|
||||
case SFF_8024_ID_QSFPPLUS:
|
||||
print_qsfp_status(&ii, verbose);
|
||||
break;
|
||||
default:
|
||||
print_sfp_status(&ii, verbose);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user