diff options
| author | Robert Mustacchi <rm@fingolfin.org> | 2020-04-01 06:25:19 +0000 |
|---|---|---|
| committer | Robert Mustacchi <rm@fingolfin.org> | 2020-04-21 23:18:18 -0700 |
| commit | 9e717e77bf4b9b5ad279c38a2311c076468e85f5 (patch) | |
| tree | 51f301b468268192506dea962554907d02320a34 /usr/src | |
| parent | a2876d03ca2556102e024ae4a50bb4db8fe562b0 (diff) | |
| download | illumos-joyent-9e717e77bf4b9b5ad279c38a2311c076468e85f5.tar.gz | |
12496 bge mac address initialization is wrong
12497 bge ape locking left always disabled after 7513
12498 bge ring interrupt masking logic is broken
Reviewed by: Paul Winder <paul@winders.demon.co.uk>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/uts/common/io/bge/bge_main2.c | 137 |
1 files changed, 26 insertions, 111 deletions
diff --git a/usr/src/uts/common/io/bge/bge_main2.c b/usr/src/uts/common/io/bge/bge_main2.c index bc2087e01d..ab511c068d 100644 --- a/usr/src/uts/common/io/bge/bge_main2.c +++ b/usr/src/uts/common/io/bge/bge_main2.c @@ -119,9 +119,7 @@ static ddi_device_acc_attr_t bge_data_accattr = { static int bge_m_start(void *); static void bge_m_stop(void *); static int bge_m_promisc(void *, boolean_t); -static int bge_m_unicst(void * pArg, const uint8_t *); static int bge_m_multicst(void *, boolean_t, const uint8_t *); -static void bge_m_resources(void * arg); static void bge_m_ioctl(void *, queue_t *, mblk_t *); static boolean_t bge_m_getcapab(void *, mac_capab_t, void *); static int bge_unicst_set(void *, const uint8_t *, @@ -140,47 +138,19 @@ static void bge_priv_propinfo(const char *, mac_prop_info_handle_t); static mac_callbacks_t bge_m_callbacks = { - MC_IOCTL -#ifdef MC_RESOURCES - | MC_RESOURCES -#endif -#ifdef MC_SETPROP - | MC_SETPROP -#endif -#ifdef MC_GETPROP - | MC_GETPROP -#endif -#ifdef MC_PROPINFO - | MC_PROPINFO -#endif - | MC_GETCAPAB, - bge_m_stat, - bge_m_start, - bge_m_stop, - bge_m_promisc, - bge_m_multicst, - bge_m_unicst, - bge_m_tx, -#ifdef MC_RESOURCES - bge_m_resources, -#else - NULL, -#endif - bge_m_ioctl, - bge_m_getcapab, -#ifdef MC_OPEN - NULL, - NULL, -#endif -#ifdef MC_SETPROP - bge_m_setprop, -#endif -#ifdef MC_GETPROP - bge_m_getprop, -#endif -#ifdef MC_PROPINFO - bge_m_propinfo -#endif + .mc_callbacks = MC_IOCTL | MC_SETPROP | MC_GETPROP | MC_PROPINFO | + MC_GETCAPAB, + .mc_getstat = bge_m_stat, + .mc_start = bge_m_start, + .mc_stop = bge_m_stop, + .mc_setpromisc = bge_m_promisc, + .mc_multicst = bge_m_multicst, + .mc_tx = bge_m_tx, + .mc_ioctl = bge_m_ioctl, + .mc_getcapab = bge_m_getcapab, + .mc_setprop = bge_m_setprop, + .mc_getprop = bge_m_getprop, + .mc_propinfo = bge_m_propinfo }; char *bge_priv_prop[] = { @@ -1288,21 +1258,6 @@ bge_priv_propinfo(const char *pr_name, mac_prop_info_handle_t mph) mac_prop_info_set_default_str(mph, valstr); } - -static int -bge_m_unicst(void * arg, const uint8_t * mac_addr) -{ - bge_t *bgep = arg; - int i; - - /* XXX sets the mac address for all ring slots... OK? */ - for (i = 0; i < MIN(bgep->chipid.rx_rings, MAC_ADDRESS_REGS_MAX); i++) - bge_addmac(&bgep->recv[i], mac_addr); - - return (0); -} - - /* * Compute the index of the required bit in the multicast hash map. * This must mirror the way the hardware actually does it! @@ -1463,37 +1418,6 @@ bge_m_promisc(void *arg, boolean_t on) return (0); } -#ifdef MC_RESOURCES - -static void -bge_blank(void * arg, time_t tick_cnt, uint_t pkt_cnt) -{ - (void)arg; - (void)tick_cnt; - (void)pkt_cnt; -} - -static void -bge_m_resources(void * arg) -{ - bge_t *bgep = arg; - mac_rx_fifo_t mrf; - int i; - - mrf.mrf_type = MAC_RX_FIFO; - mrf.mrf_blank = bge_blank; - mrf.mrf_arg = (void *)bgep; - mrf.mrf_normal_blank_time = 25; - mrf.mrf_normal_pkt_count = 8; - - for (i = 0; i < BGE_RECV_RINGS_MAX; i++) { - bgep->macRxResourceHandles[i] = - mac_resource_add(bgep->mh, (mac_resource_t *)&mrf); - } -} - -#endif /* MC_RESOURCES */ - /* * Find the slot for the specified unicast address */ @@ -1540,7 +1464,10 @@ bge_addmac(void *arg, const uint8_t * mac_addr) * First add the unicast address to a available slot. */ slot = bge_unicst_find(bgep, mac_addr); - ASSERT(slot == -1); + if (slot != -1) { + mutex_exit(bgep->genlock); + return (EEXIST); + } for (slot = 0; slot < bgep->unicst_addr_total; slot++) { if (!bgep->curr_addr[slot].set) { @@ -1549,7 +1476,7 @@ bge_addmac(void *arg, const uint8_t * mac_addr) } } - ASSERT(slot < bgep->unicst_addr_total); + VERIFY3S(slot, <, bgep->unicst_addr_total); bgep->unicst_addr_avail--; mutex_exit(bgep->genlock); @@ -1671,7 +1598,7 @@ bge_remmac(void *arg, const uint8_t *mac_addr) static int -bge_flag_intr_enable(mac_ring_driver_t ih) +bge_flag_intr_enable(mac_intr_handle_t ih) { recv_ring_t *rrp = (recv_ring_t *)ih; bge_t *bgep = rrp->bgep; @@ -1684,7 +1611,7 @@ bge_flag_intr_enable(mac_ring_driver_t ih) } static int -bge_flag_intr_disable(mac_ring_driver_t ih) +bge_flag_intr_disable(mac_intr_handle_t ih) { recv_ring_t *rrp = (recv_ring_t *)ih; bge_t *bgep = rrp->bgep; @@ -1736,8 +1663,9 @@ bge_fill_ring(void *arg, mac_ring_type_t rtype, const int rg_index, infop->mri_stat = bge_rx_ring_stat; mintr = &infop->mri_intr; - mintr->mi_enable = (mac_intr_enable_t)bge_flag_intr_enable; - mintr->mi_disable = (mac_intr_disable_t)bge_flag_intr_disable; + mintr->mi_handle = (mac_intr_handle_t)rx_ring; + mintr->mi_enable = bge_flag_intr_enable; + mintr->mi_disable = bge_flag_intr_disable; break; } @@ -3718,6 +3646,8 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) bgep->ape_enabled = B_FALSE; bgep->ape_regs = NULL; + cidp = &bgep->chipid; + cidp->device = pci_config_get16(bgep->cfg_handle, PCI_CONF_DEVID); if (DEVICE_5717_SERIES_CHIPSETS(bgep) || DEVICE_5725_SERIES_CHIPSETS(bgep)) { err = ddi_regs_map_setup(devinfo, BGE_PCI_APEREGS_RNUMBER, @@ -3751,8 +3681,6 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) * registers. (This information will be used by bge_ind_put32, * bge_ind_get32 and bge_nic_read32) */ - bgep->chipid.device = pci_config_get16(bgep->cfg_handle, - PCI_CONF_DEVID); value16 = pci_config_get16(bgep->cfg_handle, PCI_CONF_COMM); value16 = value16 | (PCI_COMM_MAE | PCI_COMM_ME); pci_config_put16(bgep->cfg_handle, PCI_CONF_COMM, value16); @@ -3795,8 +3723,6 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) goto attach_fail; } bgep->progress |= PROGRESS_CFG; - cidp = &bgep->chipid; - bzero(cidp, sizeof(*cidp)); bge_chip_cfg_init(bgep, cidp, B_FALSE); if (bge_check_acc_handle(bgep, bgep->cfg_handle) != DDI_FM_OK) { ddi_fm_service_impact(bgep->devinfo, DDI_SERVICE_LOST); @@ -4068,14 +3994,6 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) * Determine whether to override the chip's own MAC address */ bge_find_mac_address(bgep, cidp); - { - int slot; - for (slot = 0; slot < MAC_ADDRESS_REGS_MAX; slot++) { - ethaddr_copy(cidp->vendor_addr.addr, - bgep->curr_addr[slot].addr); - bgep->curr_addr[slot].set = 1; - } - } bge_read_fw_ver(bgep); @@ -4093,10 +4011,7 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) macp->m_max_sdu = cidp->ethmax_size - sizeof (struct ether_header); macp->m_margin = VLAN_TAGSZ; macp->m_priv_props = bge_priv_prop; - -#if defined(ILLUMOS) - bge_m_unicst(bgep, cidp->vendor_addr.addr); -#endif + macp->m_v12n = MAC_VIRT_LEVEL1; /* * Finally, we're ready to register ourselves with the MAC layer |
