Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
| *********************************************************************/ | *********************************************************************/ | ||||
| #define IXL_DRIVER_VERSION_MAJOR 2 | #define IXL_DRIVER_VERSION_MAJOR 2 | ||||
| #define IXL_DRIVER_VERSION_MINOR 3 | #define IXL_DRIVER_VERSION_MINOR 3 | ||||
| #define IXL_DRIVER_VERSION_BUILD 3 | #define IXL_DRIVER_VERSION_BUILD 3 | ||||
| #define IXL_DRIVER_VERSION_STRING \ | #define IXL_DRIVER_VERSION_STRING \ | ||||
| __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ | __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ | ||||
| __XSTRING(IXL_DRIVER_VERSION_MINOR) "." \ | __XSTRING(IXL_DRIVER_VERSION_MINOR) "." \ | ||||
| __XSTRING(IXL_DRIVER_VERSION_BUILD) "-k" | __XSTRING(IXL_DRIVER_VERSION_BUILD) "-k" | ||||
erj: this should get removed... | |||||
| /********************************************************************* | /********************************************************************* | ||||
| * PCI Device ID Table | * PCI Device ID Table | ||||
| * | * | ||||
| * Used by probe to select devices to load on | * Used by probe to select devices to load on | ||||
| * | * | ||||
| * ( Vendor ID, Device ID, Branding String ) | * ( Vendor ID, Device ID, Branding String ) | ||||
| *********************************************************************/ | *********************************************************************/ | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| static int ixl_if_promisc_set(if_ctx_t ctx, int flags); | static int ixl_if_promisc_set(if_ctx_t ctx, int flags); | ||||
| static void ixl_if_timer(if_ctx_t ctx, uint16_t qid); | static void ixl_if_timer(if_ctx_t ctx, uint16_t qid); | ||||
| static void ixl_if_vlan_register(if_ctx_t ctx, u16 vtag); | static void ixl_if_vlan_register(if_ctx_t ctx, u16 vtag); | ||||
| static void ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag); | static void ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag); | ||||
| static uint64_t ixl_if_get_counter(if_ctx_t ctx, ift_counter cnt); | static uint64_t ixl_if_get_counter(if_ctx_t ctx, ift_counter cnt); | ||||
| static int ixl_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); | static int ixl_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); | ||||
| static int ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data); | static int ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data); | ||||
| static bool ixl_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); | static bool ixl_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); | ||||
| static int ixl_if_vfstat_ioctl(if_ctx_t ctx, struct ifvfstatus *ifvfs); | |||||
| #ifdef PCI_IOV | #ifdef PCI_IOV | ||||
| static void ixl_if_vflr_handle(if_ctx_t ctx); | static void ixl_if_vflr_handle(if_ctx_t ctx); | ||||
| #endif | #endif | ||||
| /*** Other ***/ | /*** Other ***/ | ||||
| static void ixl_save_pf_tunables(struct ixl_pf *); | static void ixl_save_pf_tunables(struct ixl_pf *); | ||||
| static int ixl_allocate_pci_resources(struct ixl_pf *); | static int ixl_allocate_pci_resources(struct ixl_pf *); | ||||
| static void ixl_setup_ssctx(struct ixl_pf *pf); | static void ixl_setup_ssctx(struct ixl_pf *pf); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | static device_method_t ixl_if_methods[] = { | ||||
| DEVMETHOD(ifdi_promisc_set, ixl_if_promisc_set), | DEVMETHOD(ifdi_promisc_set, ixl_if_promisc_set), | ||||
| DEVMETHOD(ifdi_timer, ixl_if_timer), | DEVMETHOD(ifdi_timer, ixl_if_timer), | ||||
| DEVMETHOD(ifdi_vlan_register, ixl_if_vlan_register), | DEVMETHOD(ifdi_vlan_register, ixl_if_vlan_register), | ||||
| DEVMETHOD(ifdi_vlan_unregister, ixl_if_vlan_unregister), | DEVMETHOD(ifdi_vlan_unregister, ixl_if_vlan_unregister), | ||||
| DEVMETHOD(ifdi_get_counter, ixl_if_get_counter), | DEVMETHOD(ifdi_get_counter, ixl_if_get_counter), | ||||
| DEVMETHOD(ifdi_i2c_req, ixl_if_i2c_req), | DEVMETHOD(ifdi_i2c_req, ixl_if_i2c_req), | ||||
| DEVMETHOD(ifdi_priv_ioctl, ixl_if_priv_ioctl), | DEVMETHOD(ifdi_priv_ioctl, ixl_if_priv_ioctl), | ||||
| DEVMETHOD(ifdi_needs_restart, ixl_if_needs_restart), | DEVMETHOD(ifdi_needs_restart, ixl_if_needs_restart), | ||||
| DEVMETHOD(ifdi_vfstat_ioctl, ixl_if_vfstat_ioctl), | |||||
| #ifdef PCI_IOV | #ifdef PCI_IOV | ||||
| DEVMETHOD(ifdi_iov_init, ixl_if_iov_init), | DEVMETHOD(ifdi_iov_init, ixl_if_iov_init), | ||||
| DEVMETHOD(ifdi_iov_uninit, ixl_if_iov_uninit), | DEVMETHOD(ifdi_iov_uninit, ixl_if_iov_uninit), | ||||
| DEVMETHOD(ifdi_iov_vf_add, ixl_if_iov_vf_add), | DEVMETHOD(ifdi_iov_vf_add, ixl_if_iov_vf_add), | ||||
| DEVMETHOD(ifdi_vflr_handle, ixl_if_vflr_handle), | DEVMETHOD(ifdi_vflr_handle, ixl_if_vflr_handle), | ||||
| #endif | #endif | ||||
| // ifdi_led_func | // ifdi_led_func | ||||
| // ifdi_debug | // ifdi_debug | ||||
| ▲ Show 20 Lines • Show All 1,699 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| switch (event) { | switch (event) { | ||||
| case IFLIB_RESTART_VLAN_CONFIG: | case IFLIB_RESTART_VLAN_CONFIG: | ||||
| default: | default: | ||||
| return (false); | return (false); | ||||
| } | } | ||||
| } | } | ||||
| static int | |||||
| ixl_if_vfstat_ioctl(if_ctx_t ctx, struct ifvfstatus *ifvfs) | |||||
| { | |||||
| struct ixl_pf *pf; | |||||
| struct ifvfstatus_entry ent; | |||||
| struct ixl_vf *vf; | |||||
| int error; | |||||
Done Inline ActionsThis should either use sizeof(ent.mac_addr) instead of ETHER_ADDR_LEN or the declaration of mac_addr should use ETHER_ADDR_LEN instead of 6, too, but you should not hardcode the assumption that ETHER_ADDR_LEN equals 6. marius: This should either use sizeof(ent.mac_addr) instead of ETHER_ADDR_LEN or the declaration of… | |||||
| pf = iflib_get_softc(ctx); | |||||
| if (pf->num_vfs < 1) | |||||
| return (ENXIO); | |||||
| if (ifvfs->ifvfs_count == 0) { | |||||
| ifvfs->ifvfs_count = pf->num_vfs; | |||||
| return (0); | |||||
| } | |||||
| if (ifvfs->ifvfs_count != pf->num_vfs) | |||||
| return (EINVAL); | |||||
| for (int i = 0; i < pf->num_vfs; i++) { | |||||
| vf = &pf->vfs[i]; | |||||
| memset(&ent, 0, sizeof(ent)); | |||||
| ent.active = !!(vf->vf_flags & VF_FLAG_ENABLED); | |||||
| memcpy(ent.mac_addr, vf->mac, sizeof(ent.mac_addr)); | |||||
| /* No host VLAN support. */ | |||||
| ent.vlan = -1; | |||||
| error = copyout(&ent, &ifvfs->ifvfs_list[i], sizeof(ent)); | |||||
| if (error != 0) | |||||
| return (error); | |||||
| } | |||||
| return (0); | |||||
| } | |||||
| /* | /* | ||||
| * Sanity check and save off tunable values. | * Sanity check and save off tunable values. | ||||
| */ | */ | ||||
| static void | static void | ||||
| ixl_save_pf_tunables(struct ixl_pf *pf) | ixl_save_pf_tunables(struct ixl_pf *pf) | ||||
| { | { | ||||
| device_t dev = pf->dev; | device_t dev = pf->dev; | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if (ixl_flow_control < 0 || ixl_flow_control > 3) { | ||||
| "flow_control must be between %d and %d, " | "flow_control must be between %d and %d, " | ||||
| "inclusive\n", 0, 3); | "inclusive\n", 0, 3); | ||||
| device_printf(dev, | device_printf(dev, | ||||
| "Using default configuration instead\n"); | "Using default configuration instead\n"); | ||||
| } else | } else | ||||
| pf->fc = ixl_flow_control; | pf->fc = ixl_flow_control; | ||||
| } | } | ||||
| } | } | ||||
this should get removed...