cxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a

port.

dev.cxgbe.<n>.max_speed
dev.cxl.<n>.max_speed

Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2016-02-25 01:10:56 +00:00
parent fa104e4174
commit e8c6ba7265
2 changed files with 19 additions and 0 deletions

View File

@ -1010,6 +1010,22 @@ is_40G_port(const struct port_info *pi)
return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) != 0);
}
static inline int
port_top_speed(const struct port_info *pi)
{
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G)
return (100);
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G)
return (40);
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G)
return (10);
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G)
return (1);
return (0);
}
static inline int
tx_resume_threshold(struct sge_eq *eq)
{

View File

@ -5499,6 +5499,9 @@ cxgbe_sysctls(struct port_info *pi)
CTLTYPE_STRING | CTLFLAG_RW, pi, PAUSE_TX, sysctl_pause_settings,
"A", "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)");
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "max_speed", CTLFLAG_RD, NULL,
port_top_speed(pi), "max speed (in Gbps)");
/*
* dev.cxgbe.X.stats.
*/