Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/ixl/ixl_pf_main.c
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
static int ixl_sysctl_set_advertise(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_set_advertise(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_supported_speeds(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_supported_speeds(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_current_speed(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_current_speed(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_show_fw(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_show_fw(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_unallocated_queues(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_unallocated_queues(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_pf_tx_itr(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_pf_tx_itr(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_pf_rx_itr(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_pf_rx_itr(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS); | |||||
/* Debug Sysctls */ | /* Debug Sysctls */ | ||||
static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS); | ||||
static int ixl_sysctl_hena(SYSCTL_HANDLER_ARGS); | static int ixl_sysctl_hena(SYSCTL_HANDLER_ARGS); | ||||
▲ Show 20 Lines • Show All 543 Lines • ▼ Show 20 Lines | ixl_add_ifmedia(struct ifmedia *media, u64 phy_types) | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_T)) | if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_T)) | ||||
ifmedia_add(media, IFM_ETHER | IFM_1000_T, 0, NULL); | ifmedia_add(media, IFM_ETHER | IFM_1000_T, 0, NULL); | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_SX)) | if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_SX)) | ||||
ifmedia_add(media, IFM_ETHER | IFM_1000_SX, 0, NULL); | ifmedia_add(media, IFM_ETHER | IFM_1000_SX, 0, NULL); | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_LX)) | if (phy_types & (I40E_CAP_PHY_TYPE_1000BASE_LX)) | ||||
ifmedia_add(media, IFM_ETHER | IFM_1000_LX, 0, NULL); | ifmedia_add(media, IFM_ETHER | IFM_1000_LX, 0, NULL); | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_2_5GBASE_T)) | |||||
ifmedia_add(media, IFM_ETHER | IFM_2500_T, 0, NULL); | |||||
if (phy_types & (I40E_CAP_PHY_TYPE_5GBASE_T)) | |||||
ifmedia_add(media, IFM_ETHER | IFM_5000_T, 0, NULL); | |||||
if (phy_types & (I40E_CAP_PHY_TYPE_XAUI) || | if (phy_types & (I40E_CAP_PHY_TYPE_XAUI) || | ||||
phy_types & (I40E_CAP_PHY_TYPE_XFI) || | phy_types & (I40E_CAP_PHY_TYPE_XFI) || | ||||
phy_types & (I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU)) | phy_types & (I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU)) | ||||
ifmedia_add(media, IFM_ETHER | IFM_10G_TWINAX, 0, NULL); | ifmedia_add(media, IFM_ETHER | IFM_10G_TWINAX, 0, NULL); | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_10GBASE_SR)) | if (phy_types & (I40E_CAP_PHY_TYPE_10GBASE_SR)) | ||||
ifmedia_add(media, IFM_ETHER | IFM_10G_SR, 0, NULL); | ifmedia_add(media, IFM_ETHER | IFM_10G_SR, 0, NULL); | ||||
if (phy_types & (I40E_CAP_PHY_TYPE_10GBASE_LR)) | if (phy_types & (I40E_CAP_PHY_TYPE_10GBASE_LR)) | ||||
▲ Show 20 Lines • Show All 1,255 Lines • ▼ Show 20 Lines | ixl_stat_update32(hw, I40E_GLPRT_RFC(hw->port), | ||||
pf->stat_offsets_loaded, | pf->stat_offsets_loaded, | ||||
&osd->rx_fragments, &nsd->rx_fragments); | &osd->rx_fragments, &nsd->rx_fragments); | ||||
ixl_stat_update32(hw, I40E_GLPRT_ROC(hw->port), | ixl_stat_update32(hw, I40E_GLPRT_ROC(hw->port), | ||||
pf->stat_offsets_loaded, | pf->stat_offsets_loaded, | ||||
&osd->rx_oversize, &nsd->rx_oversize); | &osd->rx_oversize, &nsd->rx_oversize); | ||||
ixl_stat_update32(hw, I40E_GLPRT_RJC(hw->port), | ixl_stat_update32(hw, I40E_GLPRT_RJC(hw->port), | ||||
pf->stat_offsets_loaded, | pf->stat_offsets_loaded, | ||||
&osd->rx_jabber, &nsd->rx_jabber); | &osd->rx_jabber, &nsd->rx_jabber); | ||||
/* EEE */ | |||||
i40e_get_phy_lpi_status(hw, nsd); | |||||
i40e_lpi_stat_update(hw, pf->stat_offsets_loaded, | |||||
&osd->tx_lpi_count, &nsd->tx_lpi_count, | |||||
&osd->rx_lpi_count, &nsd->rx_lpi_count); | |||||
pf->stat_offsets_loaded = true; | pf->stat_offsets_loaded = true; | ||||
/* End hw stats */ | /* End hw stats */ | ||||
/* Update vsi stats */ | /* Update vsi stats */ | ||||
ixl_update_vsi_stats(vsi); | ixl_update_vsi_stats(vsi); | ||||
for (int i = 0; i < pf->num_vfs; i++) { | for (int i = 0; i < pf->num_vfs; i++) { | ||||
vf = &pf->vfs[i]; | vf = &pf->vfs[i]; | ||||
▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | ixl_add_device_sysctls(struct ixl_pf *pf) | ||||
struct sysctl_oid_list *ctx_list = | struct sysctl_oid_list *ctx_list = | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); | ||||
struct sysctl_oid *debug_node; | struct sysctl_oid *debug_node; | ||||
struct sysctl_oid_list *debug_list; | struct sysctl_oid_list *debug_list; | ||||
struct sysctl_oid *fec_node; | struct sysctl_oid *fec_node; | ||||
struct sysctl_oid_list *fec_list; | struct sysctl_oid_list *fec_list; | ||||
struct sysctl_oid *eee_node; | |||||
struct sysctl_oid_list *eee_list; | |||||
/* Set up sysctls */ | /* Set up sysctls */ | ||||
SYSCTL_ADD_PROC(ctx, ctx_list, | SYSCTL_ADD_PROC(ctx, ctx_list, | ||||
OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | ||||
pf, 0, ixl_sysctl_set_flowcntl, "I", IXL_SYSCTL_HELP_FC); | pf, 0, ixl_sysctl_set_flowcntl, "I", IXL_SYSCTL_HELP_FC); | ||||
SYSCTL_ADD_PROC(ctx, ctx_list, | SYSCTL_ADD_PROC(ctx, ctx_list, | ||||
OID_AUTO, "advertise_speed", | OID_AUTO, "advertise_speed", | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | SYSCTL_ADD_PROC(ctx, fec_list, | ||||
ixl_sysctl_fec_auto_enable, "I", | ixl_sysctl_fec_auto_enable, "I", | ||||
"Let FW decide FEC ability/request modes"); | "Let FW decide FEC ability/request modes"); | ||||
} | } | ||||
SYSCTL_ADD_PROC(ctx, ctx_list, | SYSCTL_ADD_PROC(ctx, ctx_list, | ||||
OID_AUTO, "fw_lldp", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | OID_AUTO, "fw_lldp", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | ||||
pf, 0, ixl_sysctl_fw_lldp, "I", IXL_SYSCTL_HELP_FW_LLDP); | pf, 0, ixl_sysctl_fw_lldp, "I", IXL_SYSCTL_HELP_FW_LLDP); | ||||
eee_node = SYSCTL_ADD_NODE(ctx, ctx_list, | |||||
OID_AUTO, "eee", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, | |||||
"Energy Efficient Ethernet (EEE) Sysctls"); | |||||
eee_list = SYSCTL_CHILDREN(eee_node); | |||||
SYSCTL_ADD_PROC(ctx, eee_list, | |||||
OID_AUTO, "enable", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, | |||||
pf, 0, ixl_sysctl_eee_enable, "I", | |||||
"Enable Energy Efficient Ethernet (EEE)"); | |||||
SYSCTL_ADD_UINT(ctx, eee_list, OID_AUTO, "tx_lpi_status", | |||||
CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.tx_lpi_status, 0, | |||||
"TX LPI status"); | |||||
SYSCTL_ADD_UINT(ctx, eee_list, OID_AUTO, "rx_lpi_status", | |||||
CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.rx_lpi_status, 0, | |||||
"RX LPI status"); | |||||
SYSCTL_ADD_UQUAD(ctx, eee_list, OID_AUTO, "tx_lpi_count", | |||||
CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.tx_lpi_count, | |||||
"TX LPI count"); | |||||
SYSCTL_ADD_UQUAD(ctx, eee_list, OID_AUTO, "rx_lpi_count", | |||||
CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.rx_lpi_count, | |||||
"RX LPI count"); | |||||
/* Add sysctls meant to print debug information, but don't list them | /* Add sysctls meant to print debug information, but don't list them | ||||
* in "sysctl -a" output. */ | * in "sysctl -a" output. */ | ||||
debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, | debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, | ||||
OID_AUTO, "debug", CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, | OID_AUTO, "debug", CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, | ||||
"Debug Sysctls"); | "Debug Sysctls"); | ||||
debug_list = SYSCTL_CHILDREN(debug_node); | debug_list = SYSCTL_CHILDREN(debug_node); | ||||
SYSCTL_ADD_UINT(ctx, debug_list, | SYSCTL_ADD_UINT(ctx, debug_list, | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | ixl_link_speed_string(enum i40e_aq_link_speed link_speed) | ||||
const char * link_speed_str[] = { | const char * link_speed_str[] = { | ||||
"Unknown", | "Unknown", | ||||
"100 Mbps", | "100 Mbps", | ||||
"1 Gbps", | "1 Gbps", | ||||
"10 Gbps", | "10 Gbps", | ||||
"40 Gbps", | "40 Gbps", | ||||
"20 Gbps", | "20 Gbps", | ||||
"25 Gbps", | "25 Gbps", | ||||
"2.5 Gbps", | |||||
"5 Gbps" | |||||
}; | }; | ||||
int index; | int index; | ||||
switch (link_speed) { | switch (link_speed) { | ||||
case I40E_LINK_SPEED_100MB: | case I40E_LINK_SPEED_100MB: | ||||
index = 1; | index = 1; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_1GB: | case I40E_LINK_SPEED_1GB: | ||||
index = 2; | index = 2; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_10GB: | case I40E_LINK_SPEED_10GB: | ||||
index = 3; | index = 3; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_40GB: | case I40E_LINK_SPEED_40GB: | ||||
index = 4; | index = 4; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_20GB: | case I40E_LINK_SPEED_20GB: | ||||
index = 5; | index = 5; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_25GB: | case I40E_LINK_SPEED_25GB: | ||||
index = 6; | index = 6; | ||||
break; | break; | ||||
case I40E_LINK_SPEED_2_5GB: | |||||
index = 7; | |||||
break; | |||||
case I40E_LINK_SPEED_5GB: | |||||
index = 8; | |||||
break; | |||||
case I40E_LINK_SPEED_UNKNOWN: | case I40E_LINK_SPEED_UNKNOWN: | ||||
default: | default: | ||||
index = 0; | index = 0; | ||||
break; | break; | ||||
} | } | ||||
return (link_speed_str[index]); | return (link_speed_str[index]); | ||||
} | } | ||||
Show All 17 Lines | |||||
/* | /* | ||||
* Converts 8-bit speeds value to and from sysctl flags and | * Converts 8-bit speeds value to and from sysctl flags and | ||||
* Admin Queue flags. | * Admin Queue flags. | ||||
*/ | */ | ||||
static u8 | static u8 | ||||
ixl_convert_sysctl_aq_link_speed(u8 speeds, bool to_aq) | ixl_convert_sysctl_aq_link_speed(u8 speeds, bool to_aq) | ||||
{ | { | ||||
#define SPEED_MAP_SIZE 6 | #define SPEED_MAP_SIZE 8 | ||||
static u16 speedmap[SPEED_MAP_SIZE] = { | static u16 speedmap[SPEED_MAP_SIZE] = { | ||||
(I40E_LINK_SPEED_100MB | (0x1 << 8)), | (I40E_LINK_SPEED_100MB | (0x1 << 8)), | ||||
(I40E_LINK_SPEED_1GB | (0x2 << 8)), | (I40E_LINK_SPEED_1GB | (0x2 << 8)), | ||||
(I40E_LINK_SPEED_10GB | (0x4 << 8)), | (I40E_LINK_SPEED_10GB | (0x4 << 8)), | ||||
(I40E_LINK_SPEED_20GB | (0x8 << 8)), | (I40E_LINK_SPEED_20GB | (0x8 << 8)), | ||||
(I40E_LINK_SPEED_25GB | (0x10 << 8)), | (I40E_LINK_SPEED_25GB | (0x10 << 8)), | ||||
(I40E_LINK_SPEED_40GB | (0x20 << 8)) | (I40E_LINK_SPEED_40GB | (0x20 << 8)), | ||||
(I40E_LINK_SPEED_2_5GB | (0x40 << 8)), | |||||
(I40E_LINK_SPEED_5GB | (0x80 << 8)), | |||||
}; | }; | ||||
u8 retval = 0; | u8 retval = 0; | ||||
for (int i = 0; i < SPEED_MAP_SIZE; i++) { | for (int i = 0; i < SPEED_MAP_SIZE; i++) { | ||||
if (to_aq) | if (to_aq) | ||||
retval |= (speeds & (speedmap[i] >> 8)) ? (speedmap[i] & 0xff) : 0; | retval |= (speeds & (speedmap[i] >> 8)) ? (speedmap[i] & 0xff) : 0; | ||||
else | else | ||||
retval |= (speeds & speedmap[i]) ? (speedmap[i] >> 8) : 0; | retval |= (speeds & speedmap[i]) ? (speedmap[i] >> 8) : 0; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
** Supported link speeds | ** Supported link speeds | ||||
** Flags: | ** Flags: | ||||
** 0x1 - 100 Mb | ** 0x1 - 100 Mb | ||||
** 0x2 - 1G | ** 0x2 - 1G | ||||
** 0x4 - 10G | ** 0x4 - 10G | ||||
** 0x8 - 20G | ** 0x8 - 20G | ||||
** 0x10 - 25G | ** 0x10 - 25G | ||||
** 0x20 - 40G | ** 0x20 - 40G | ||||
** 0x40 - 2.5G | |||||
** 0x80 - 5G | |||||
*/ | */ | ||||
static int | static int | ||||
ixl_sysctl_supported_speeds(SYSCTL_HANDLER_ARGS) | ixl_sysctl_supported_speeds(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct ixl_pf *pf = (struct ixl_pf *)arg1; | struct ixl_pf *pf = (struct ixl_pf *)arg1; | ||||
int supported = ixl_convert_sysctl_aq_link_speed(pf->supported_speeds, false); | int supported = ixl_convert_sysctl_aq_link_speed(pf->supported_speeds, false); | ||||
return sysctl_handle_int(oidp, NULL, supported, req); | return sysctl_handle_int(oidp, NULL, supported, req); | ||||
} | } | ||||
/* | /* | ||||
** Control link advertise speed: | ** Control link advertise speed: | ||||
** Flags: | ** Flags: | ||||
** 0x1 - advertise 100 Mb | ** 0x1 - advertise 100 Mb | ||||
** 0x2 - advertise 1G | ** 0x2 - advertise 1G | ||||
** 0x4 - advertise 10G | ** 0x4 - advertise 10G | ||||
** 0x8 - advertise 20G | ** 0x8 - advertise 20G | ||||
** 0x10 - advertise 25G | ** 0x10 - advertise 25G | ||||
** 0x20 - advertise 40G | ** 0x20 - advertise 40G | ||||
** 0x40 - advertise 2.5G | |||||
** 0x80 - advertise 5G | |||||
** | ** | ||||
** Set to 0 to disable link | ** Set to 0 to disable link | ||||
*/ | */ | ||||
int | int | ||||
ixl_sysctl_set_advertise(SYSCTL_HANDLER_ARGS) | ixl_sysctl_set_advertise(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct ixl_pf *pf = (struct ixl_pf *)arg1; | struct ixl_pf *pf = (struct ixl_pf *)arg1; | ||||
device_t dev = pf->dev; | device_t dev = pf->dev; | ||||
u8 converted_speeds; | u8 converted_speeds; | ||||
int requested_ls = 0; | int requested_ls = 0; | ||||
int error = 0; | int error = 0; | ||||
/* Read in new mode */ | /* Read in new mode */ | ||||
requested_ls = pf->advertised_speed; | requested_ls = pf->advertised_speed; | ||||
error = sysctl_handle_int(oidp, &requested_ls, 0, req); | error = sysctl_handle_int(oidp, &requested_ls, 0, req); | ||||
if ((error) || (req->newptr == NULL)) | if ((error) || (req->newptr == NULL)) | ||||
return (error); | return (error); | ||||
if (IXL_PF_IN_RECOVERY_MODE(pf)) { | if (IXL_PF_IN_RECOVERY_MODE(pf)) { | ||||
device_printf(dev, "Interface is currently in FW recovery mode. " | device_printf(dev, "Interface is currently in FW recovery mode. " | ||||
"Setting advertise speed not supported\n"); | "Setting advertise speed not supported\n"); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
/* Error out if bits outside of possible flag range are set */ | /* Error out if bits outside of possible flag range are set */ | ||||
if ((requested_ls & ~((u8)0x3F)) != 0) { | if ((requested_ls & ~((u8)0xFF)) != 0) { | ||||
device_printf(dev, "Input advertised speed out of range; " | device_printf(dev, "Input advertised speed out of range; " | ||||
"valid flags are: 0x%02x\n", | "valid flags are: 0x%02x\n", | ||||
ixl_convert_sysctl_aq_link_speed(pf->supported_speeds, false)); | ixl_convert_sysctl_aq_link_speed(pf->supported_speeds, false)); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
/* Check if adapter supports input value */ | /* Check if adapter supports input value */ | ||||
converted_speeds = ixl_convert_sysctl_aq_link_speed((u8)requested_ls, true); | converted_speeds = ixl_convert_sysctl_aq_link_speed((u8)requested_ls, true); | ||||
Show All 22 Lines | ixl_max_aq_speed_to_value(u8 link_speeds) | ||||
if (link_speeds & I40E_LINK_SPEED_40GB) | if (link_speeds & I40E_LINK_SPEED_40GB) | ||||
return IF_Gbps(40); | return IF_Gbps(40); | ||||
if (link_speeds & I40E_LINK_SPEED_25GB) | if (link_speeds & I40E_LINK_SPEED_25GB) | ||||
return IF_Gbps(25); | return IF_Gbps(25); | ||||
if (link_speeds & I40E_LINK_SPEED_20GB) | if (link_speeds & I40E_LINK_SPEED_20GB) | ||||
return IF_Gbps(20); | return IF_Gbps(20); | ||||
if (link_speeds & I40E_LINK_SPEED_10GB) | if (link_speeds & I40E_LINK_SPEED_10GB) | ||||
return IF_Gbps(10); | return IF_Gbps(10); | ||||
if (link_speeds & I40E_LINK_SPEED_5GB) | |||||
return IF_Gbps(5); | |||||
if (link_speeds & I40E_LINK_SPEED_2_5GB) | |||||
return IF_Mbps(2500); | |||||
if (link_speeds & I40E_LINK_SPEED_1GB) | if (link_speeds & I40E_LINK_SPEED_1GB) | ||||
return IF_Gbps(1); | return IF_Gbps(1); | ||||
if (link_speeds & I40E_LINK_SPEED_100MB) | if (link_speeds & I40E_LINK_SPEED_100MB) | ||||
return IF_Mbps(100); | return IF_Mbps(100); | ||||
else | else | ||||
/* Minimum supported link speed */ | /* Minimum supported link speed */ | ||||
return IF_Mbps(100); | return IF_Mbps(100); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 268 Lines • ▼ Show 20 Lines | ixl_phy_type_string(u32 bit_pos, bool ext) | ||||
}; | }; | ||||
static char * ext_phy_types_str[8] = { | static char * ext_phy_types_str[8] = { | ||||
"25GBASE-KR", | "25GBASE-KR", | ||||
"25GBASE-CR", | "25GBASE-CR", | ||||
"25GBASE-SR", | "25GBASE-SR", | ||||
"25GBASE-LR", | "25GBASE-LR", | ||||
"25GBASE-AOC", | "25GBASE-AOC", | ||||
"25GBASE-ACC", | "25GBASE-ACC", | ||||
"Reserved (6)", | "2.5GBASE-T", | ||||
"Reserved (7)" | "5GBASE-T" | ||||
}; | }; | ||||
if (ext && bit_pos > 7) return "Invalid_Ext"; | if (ext && bit_pos > 7) return "Invalid_Ext"; | ||||
if (bit_pos > 31) return "Invalid"; | if (bit_pos > 31) return "Invalid"; | ||||
return (ext) ? ext_phy_types_str[bit_pos] : phy_types_str[bit_pos]; | return (ext) ? ext_phy_types_str[bit_pos] : phy_types_str[bit_pos]; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,208 Lines • ▼ Show 20 Lines | ixl_sysctl_fw_lldp(SYSCTL_HANDLER_ARGS) | ||||
/* Already in requested state */ | /* Already in requested state */ | ||||
if (new_state == state) | if (new_state == state) | ||||
return (error); | return (error); | ||||
if (new_state == 0) | if (new_state == 0) | ||||
return ixl_stop_fw_lldp(pf); | return ixl_stop_fw_lldp(pf); | ||||
return ixl_start_fw_lldp(pf); | return ixl_start_fw_lldp(pf); | ||||
} | |||||
static int | |||||
ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS) | |||||
{ | |||||
struct ixl_pf *pf = (struct ixl_pf *)arg1; | |||||
int state, new_state; | |||||
int sysctl_handle_status = 0; | |||||
enum i40e_status_code cmd_status; | |||||
/* Init states' values */ | |||||
state = new_state = (!!(pf->state & IXL_PF_STATE_EEE_ENABLED)); | |||||
/* Get requested mode */ | |||||
sysctl_handle_status = sysctl_handle_int(oidp, &new_state, 0, req); | |||||
if ((sysctl_handle_status) || (req->newptr == NULL)) | |||||
return (sysctl_handle_status); | |||||
/* Check if state has changed */ | |||||
if (new_state == state) | |||||
return (0); | |||||
/* Set new state */ | |||||
cmd_status = i40e_enable_eee(&pf->hw, (bool)(!!new_state)); | |||||
/* Save new state or report error */ | |||||
if (!cmd_status) { | |||||
if (new_state == 0) | |||||
atomic_clear_32(&pf->state, IXL_PF_STATE_EEE_ENABLED); | |||||
else | |||||
atomic_set_32(&pf->state, IXL_PF_STATE_EEE_ENABLED); | |||||
} else if (cmd_status == I40E_ERR_CONFIG) | |||||
return (EPERM); | |||||
else | |||||
return (EIO); | |||||
return (0); | |||||
} | } | ||||
int | int | ||||
ixl_attach_get_link_status(struct ixl_pf *pf) | ixl_attach_get_link_status(struct ixl_pf *pf) | ||||
{ | { | ||||
struct i40e_hw *hw = &pf->hw; | struct i40e_hw *hw = &pf->hw; | ||||
device_t dev = pf->dev; | device_t dev = pf->dev; | ||||
int error = 0; | int error = 0; | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |