FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
** Get the width and transaction speed of
** the bus this adapter is plugged into.
*/
Get the width and transaction speed of
the bus this adapter is plugged into.
Get the width and transaction speed of the bus this adapter is plugged into .
void
ixl_get_bus_info(struct i40e_hw *hw, device_t dev)
{
        u16                     link;
        u32                     offset;
	if (hw->mac.type == I40E_MAC_X722)
		return;
        pci_find_cap(dev, PCIY_EXPRESS, &offset);
        link = pci_read_config(dev, offset + PCIER_LINK_STA, 2);
	i40e_set_pci_config_data(hw, link);
        device_printf(dev,"PCI Express Bus: Speed %s %s\n",
            ((hw->bus.speed == i40e_bus_speed_8000) ? "8.0GT/s":
            (hw->bus.speed == i40e_bus_speed_5000) ? "5.0GT/s":
            (hw->bus.speed == i40e_bus_speed_2500) ? "2.5GT/s":"Unknown"),
            (hw->bus.width == i40e_bus_width_pcie_x8) ? "Width x8" :
            (hw->bus.width == i40e_bus_width_pcie_x4) ? "Width x4" :
            (hw->bus.width == i40e_bus_width_pcie_x1) ? "Width x1" :
            ("Unknown"));
        if ((hw->bus.width <= i40e_bus_width_pcie_x8) &&
            (hw->bus.speed < i40e_bus_speed_8000)) {
                device_printf(dev, "PCI-Express bandwidth available"
                    " for this device may be insufficient for"
                    " optimal performance.\n");
                device_printf(dev, "For optimal performance, a x8 "
                    "PCIE Gen3 slot is required.\n");
        }
}
void ixl_get_bus_info ( struct i40e_hw * hw , device_t dev ) { u16 link ; u32 offset ; if ( hw -> mac . type == I40E_MAC_X722 ) return ; pci_find_cap ( dev , PCIY_EXPRESS , & offset ) ; link = pci_read_config ( dev , offset + PCIER_LINK_STA , 2 ) ; i40e_set_pci_config_data ( hw , link ) ; device_printf ( dev , " \n " , ( ( hw -> bus . speed == i40e_bus_speed_8000 ) ? " " : ( hw -> bus . speed == i40e_bus_speed_5000 ) ? " " : ( hw -> bus . speed == i40e_bus_speed_2500 ) ? " " : " " ) , ( hw -> bus . width == i40e_bus_width_pcie_x8 ) ? " " : ( hw -> bus . width == i40e_bus_width_pcie_x4 ) ? " " : ( hw -> bus . width == i40e_bus_width_pcie_x1 ) ? " " : ( " " ) ) ; if ( ( hw -> bus . width <= i40e_bus_width_pcie_x8 ) && ( hw -> bus . speed < i40e_bus_speed_8000 ) ) { device_printf ( dev , " " " " " \n " ) ; device_printf ( dev , " " " \n " ) ; } }
Get the width and transaction speed of
the bus this adapter is plugged into.
Get the width and transaction speed of the bus this adapter is plugged into .
/* Some devices don't use PCIE */ /* Read PCI Express Capabilities Link Status Register */ /* Fill out hw struct with PCIE info */ /* Use info to print out bandwidth messages */