Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
/****************************************************************************** | /****************************************************************************** | ||||
Copyright (c) 2013-2018, Intel Corporation | Copyright (c) 2013-2019, Intel Corporation | ||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
1. Redistributions of source code must retain the above copyright notice, | 1. Redistributions of source code must retain the above copyright notice, | ||||
this list of conditions and the following disclaimer. | this list of conditions and the following disclaimer. | ||||
Show All 37 Lines | |||||
*********************************************************************/ | *********************************************************************/ | ||||
#define IXL_DRIVER_VERSION_MAJOR 2 | #define IXL_DRIVER_VERSION_MAJOR 2 | ||||
#define IXL_DRIVER_VERSION_MINOR 1 | #define IXL_DRIVER_VERSION_MINOR 1 | ||||
#define IXL_DRIVER_VERSION_BUILD 0 | #define IXL_DRIVER_VERSION_BUILD 0 | ||||
#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 46 Lines • ▼ Show 20 Lines | |||||
static int ixl_if_media_change(if_ctx_t ctx); | static int ixl_if_media_change(if_ctx_t ctx); | ||||
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 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 int ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int); | static int ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int); | ||||
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 *); | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | static device_method_t ixl_if_methods[] = { | ||||
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), | ||||
#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 | ||||
DEVMETHOD(ifdi_vfstat_ioctl, ixl_if_vfstat_ioctl), | |||||
// ifdi_led_func | // ifdi_led_func | ||||
// ifdi_debug | // ifdi_debug | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t ixl_if_driver = { | static driver_t ixl_if_driver = { | ||||
"ixl_if", ixl_if_methods, sizeof(struct ixl_pf) | "ixl_if", ixl_if_methods, sizeof(struct ixl_pf) | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,423 Lines • ▼ Show 20 Lines | ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data) | ||||
/* NVM update command */ | /* NVM update command */ | ||||
if (ifd->ifd_cmd == I40E_NVM_ACCESS) | if (ifd->ifd_cmd == I40E_NVM_ACCESS) | ||||
error = ixl_handle_nvmupd_cmd(pf, ifd); | error = ixl_handle_nvmupd_cmd(pf, ifd); | ||||
else | else | ||||
error = EINVAL; | error = EINVAL; | ||||
return (error); | return (error); | ||||
} | |||||
static int | |||||
ixl_if_vfstat_ioctl(if_ctx_t ctx, struct ifvfstatus *ifvfs) | |||||
{ | |||||
struct ixl_pf *pf = iflib_get_softc(ctx); | |||||
struct ifvfstatus_entry ent; | |||||
struct ixl_vf *vf; | |||||
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) { | |||||
device_printf(pf->dev, "%s: Invalid count: ioctl=%d vs driver=%d\n", | |||||
__func__, ifvfs->ifvfs_count, pf->num_vfs); | |||||
return (EINVAL); | |||||
} | |||||
for (int i = 0; i < pf->num_vfs; i++) { | |||||
vf = &pf->vfs[i]; | |||||
ent.active = !!(vf->vf_flags & VF_FLAG_ENABLED); | |||||
memcpy(ent.mac_addr, vf->mac, sizeof(ent.mac_addr)); | |||||
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… | |||||
/* No host VLAN support, yet */ | |||||
ent.vlan = 0; | |||||
copyout(&ent, &ifvfs->ifvfs_list[i], sizeof(ent)); | |||||
} | |||||
return (0); | |||||
} | } | ||||
static int | static int | ||||
ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count __unused) | ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count __unused) | ||||
{ | { | ||||
struct ixl_vsi *vsi = arg; | struct ixl_vsi *vsi = arg; | ||||
if (ifma->ifma_addr->sa_family != AF_LINK) | if (ifma->ifma_addr->sa_family != AF_LINK) | ||||
return (0); | return (0); | ||||
ixl_add_mc_filter(vsi, | ixl_add_mc_filter(vsi, | ||||
(u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); | (u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* Sanity check and save off tunable values. | * Sanity check and save off tunable values. | ||||
*/ | */ | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |
this should get removed...