int oce_start(struct oce_dev *dev) { int qidx = 0; struct link_status link = {0}; /* get link status */ (void) oce_get_link_status(dev, &link); dev->link_status = (link.logical_link_status == NTWK_LOGICAL_LINK_UP) ? LINK_STATE_UP : LINK_STATE_DOWN; dev->link_speed = link.qos_link_speed ? link.qos_link_speed * 10 : pow10[link.mac_speed]; mac_link_update(dev->mac_handle, dev->link_status); for (qidx = 0; qidx < dev->nwqs; qidx++) { (void) oce_start_wq(dev->wq[qidx]); } for (qidx = 0; qidx < dev->nrqs; qidx++) { (void) oce_start_rq(dev->rq[qidx]); } (void) oce_start_mq(dev->mq); /* enable interrupts */ oce_ei(dev); /* arm the eqs */ for (qidx = 0; qidx < dev->neqs; qidx++) { oce_arm_eq(dev, dev->eq[qidx]->eq_id, 0, B_TRUE, B_FALSE); } /* TODO update state */ return (DDI_SUCCESS); } /* oce_start */
/* Internally resume the rings on group basis (Eg IRM) */ int oce_resume_group_rings(oce_group_t *grp) { struct oce_dev *dev = grp->parent; int qidx, pmac_idx, ret = DDI_SUCCESS; if (grp->state & GROUP_MAC_STARTED) { if (grp->grp_num == 0) { if (dev->num_mca > OCE_MAX_MCA) { ret = oce_set_multicast_table(dev, dev->if_id, &dev->multi_cast[0], OCE_MAX_MCA, B_TRUE, MBX_BOOTSTRAP); } else { ret = oce_set_multicast_table(dev, dev->if_id, &dev->multi_cast[0], dev->num_mca, B_FALSE, MBX_BOOTSTRAP); } if (ret != 0) { oce_log(dev, CE_WARN, MOD_CONFIG, "set mcast failed 0x%x", ret); return (ret); } } /* Add the group based MACs */ for (pmac_idx = 0; pmac_idx < grp->num_pmac; pmac_idx++) { if (grp->pmac_ids[pmac_idx] != INVALID_PMAC_ID) { ret = oce_add_mac(dev, grp->if_id, (uint8_t *)&grp->mac_addr[pmac_idx], &grp->pmac_ids[pmac_idx], MBX_BOOTSTRAP); if (ret != DDI_SUCCESS) { oce_log(dev, CE_WARN, MOD_CONFIG, "MAC addition failed grp = %p, " "idx = %d, ret = %x", (void *)grp, pmac_idx, ret); return (ret); } } } for (qidx = 0; qidx < grp->num_rings; qidx++) { mac_ring_intr_set(grp->ring[qidx].rx->handle, dev->htable[grp->ring[qidx].rx->cq->eq->idx]); (void) oce_start_rq(grp->ring[qidx].rx); } grp->state &= ~GROUP_SUSPEND; } return (ret); }
/* * Ring level operations */ int oce_ring_start(mac_ring_driver_t ring_handle, uint64_t gen_number) { struct oce_rq *rx_ring = (struct oce_rq *)ring_handle; struct oce_dev *dev = rx_ring->parent; mutex_enter(&rx_ring->rx_lock); rx_ring->gen_number = gen_number; mac_ring_intr_set(rx_ring->handle, dev->htable[rx_ring->cq->eq->idx]); (void) oce_start_rq(rx_ring); mutex_exit(&rx_ring->rx_lock); return (0); }