44 #include <sys/types.h> 48 #include <sys/ioctl.h> 50 #include <linux/ethtool.h> 51 #include <linux/sockios.h> 74 "Address",
"Socket",
"VID:PID",
"Link Speed",
"Driver",
80 if (d->device_class != PCI_CLASS_NETWORK_ETHERNET && !show_all)
85 if (d->numa_node >= 0)
86 s = format (s,
" %d", d->numa_node);
88 vlib_cli_output (vm,
"%-13U%-7v%04x:%04x %-15U%-20s%-40v",
89 format_vlib_pci_addr, &d->bus_address, s,
90 d->vendor_id, d->device_id,
91 format_vlib_pci_link_speed, d,
92 d->driver_name ? (char *) d->driver_name :
"",
104 vlib_pci_addr_t *
addr = va_arg (*args, vlib_pci_addr_t *);
107 if (!
unformat (input,
"%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
113 addr->function = x[3];
121 vlib_pci_addr_t *
addr = va_arg (*va, vlib_pci_addr_t *);
122 return format (s,
"%04x:%02x:%02x.%x", addr->domain, addr->bus,
123 addr->slot, addr->function);
129 vlib_pci_addr_t *
addr = va_arg (*va, vlib_pci_addr_t *);
130 return format (s,
"%x/%x/%x", addr->bus, addr->slot, addr->function);
137 pcie_config_regs_t *r =
142 return format (s,
"unknown");
144 width = (r->link_status >> 4) & 0x3f;
146 if ((r->link_status & 0xf) == 1)
147 return format (s,
"2.5 GT/s x%u", width);
148 if ((r->link_status & 0xf) == 2)
149 return format (s,
"5.0 GT/s x%u", width);
150 if ((r->link_status & 0xf) == 3)
151 return format (s,
"8.0 GT/s x%u", width);
152 return format (s,
"unknown");
159 .short_help =
"show pci [all]",
clib_error_t * pci_bus_init(vlib_main_t *vm)
static void * pci_config_find_capability(pci_config_type0_regs_t *t, int cap_type)
u8 * format_vlib_pci_link_speed(u8 *s, va_list *va)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
vlib_pci_device_t * pci_devs
static clib_error_t * show_pci_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword unformat_vlib_pci_addr(unformat_input_t *input, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_CLI_COMMAND(x,...)
pci_config_type0_regs_t config0
u8 * format_vlib_pci_addr(u8 *s, va_list *va)
u8 * format_vlib_pci_handle(u8 *s, va_list *va)
#define clib_error_return(e, args...)