Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bnxt/if_bnxt.c
Show All 40 Lines | |||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_dl.h> | |||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <net/iflib.h> | #include <net/iflib.h> | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_rss.h" | #include "opt_rss.h" | ||||
▲ Show 20 Lines • Show All 1,123 Lines • ▼ Show 20 Lines | bnxt_stop(if_ctx_t ctx) | ||||
struct bnxt_softc *softc = iflib_get_softc(ctx); | struct bnxt_softc *softc = iflib_get_softc(ctx); | ||||
bnxt_do_disable_intr(&softc->def_cp_ring); | bnxt_do_disable_intr(&softc->def_cp_ring); | ||||
bnxt_hwrm_func_reset(softc); | bnxt_hwrm_func_reset(softc); | ||||
bnxt_clear_ids(softc); | bnxt_clear_ids(softc); | ||||
return; | return; | ||||
} | } | ||||
static u_int | |||||
bnxt_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) | |||||
{ | |||||
uint8_t *mta = arg; | |||||
if (cnt == BNXT_MAX_MC_ADDRS) | |||||
return (1); | |||||
bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); | |||||
return (1); | |||||
} | |||||
static void | static void | ||||
bnxt_multi_set(if_ctx_t ctx) | bnxt_multi_set(if_ctx_t ctx) | ||||
{ | { | ||||
struct bnxt_softc *softc = iflib_get_softc(ctx); | struct bnxt_softc *softc = iflib_get_softc(ctx); | ||||
if_t ifp = iflib_get_ifp(ctx); | if_t ifp = iflib_get_ifp(ctx); | ||||
uint8_t *mta; | uint8_t *mta; | ||||
int cnt, mcnt; | int mcnt; | ||||
mcnt = if_multiaddr_count(ifp, -1); | mta = softc->vnic_info.mc_list.idi_vaddr; | ||||
bzero(mta, softc->vnic_info.mc_list.idi_size); | |||||
mcnt = if_foreach_llmaddr(ifp, bnxt_copy_maddr, mta); | |||||
if (mcnt > BNXT_MAX_MC_ADDRS) { | if (mcnt > BNXT_MAX_MC_ADDRS) { | ||||
softc->vnic_info.rx_mask |= | softc->vnic_info.rx_mask |= | ||||
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ||||
bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info); | bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info); | ||||
} | } else { | ||||
else { | |||||
softc->vnic_info.rx_mask &= | softc->vnic_info.rx_mask &= | ||||
~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ||||
mta = softc->vnic_info.mc_list.idi_vaddr; | |||||
bzero(mta, softc->vnic_info.mc_list.idi_size); | |||||
if_multiaddr_array(ifp, mta, &cnt, mcnt); | |||||
bus_dmamap_sync(softc->vnic_info.mc_list.idi_tag, | bus_dmamap_sync(softc->vnic_info.mc_list.idi_tag, | ||||
softc->vnic_info.mc_list.idi_map, BUS_DMASYNC_PREWRITE); | softc->vnic_info.mc_list.idi_map, BUS_DMASYNC_PREWRITE); | ||||
softc->vnic_info.mc_list_count = cnt; | softc->vnic_info.mc_list_count = mcnt; | ||||
softc->vnic_info.rx_mask |= | softc->vnic_info.rx_mask |= | ||||
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST; | HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST; | ||||
if (bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info)) | if (bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info)) | ||||
device_printf(softc->dev, | device_printf(softc->dev, | ||||
"set_multi: rx_mask set failed\n"); | "set_multi: rx_mask set failed\n"); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
bnxt_promisc_set(if_ctx_t ctx, int flags) | bnxt_promisc_set(if_ctx_t ctx, int flags) | ||||
{ | { | ||||
struct bnxt_softc *softc = iflib_get_softc(ctx); | struct bnxt_softc *softc = iflib_get_softc(ctx); | ||||
if_t ifp = iflib_get_ifp(ctx); | if_t ifp = iflib_get_ifp(ctx); | ||||
int rc; | int rc; | ||||
if (ifp->if_flags & IFF_ALLMULTI || | if (ifp->if_flags & IFF_ALLMULTI || | ||||
if_multiaddr_count(ifp, -1) > BNXT_MAX_MC_ADDRS) | if_llmaddr_count(ifp) > BNXT_MAX_MC_ADDRS) | ||||
softc->vnic_info.rx_mask |= | softc->vnic_info.rx_mask |= | ||||
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ||||
else | else | ||||
softc->vnic_info.rx_mask &= | softc->vnic_info.rx_mask &= | ||||
~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; | ||||
if (ifp->if_flags & IFF_PROMISC) | if (ifp->if_flags & IFF_PROMISC) | ||||
softc->vnic_info.rx_mask |= | softc->vnic_info.rx_mask |= | ||||
▲ Show 20 Lines • Show All 1,119 Lines • Show Last 20 Lines |