static void sbsh_intr(void *arg) { struct sbsh_softc *sc = (struct sbsh_softc *)arg; u_int8_t status = sc->regs->SR; if (status == 0) return; if (status & EXT) { cx28975_interrupt(sc); sc->regs->SR = EXT; } if (status & UFL) { resume_tx(sc); sc->regs->SR = UFL; ++sc->in_stats.ufl_errs; IFNET_STAT_INC(&sc->arpcom.ac_if, oerrors, 1); } if (status & RXS) { sc->regs->SR = RXS; indicate_frames(sc); alloc_rx_buffers(sc); } if (status & TXS) { sc->regs->SR = TXS; free_sent_buffers(sc); } if (status & CRC) { ++sc->in_stats.crc_errs; IFNET_STAT_INC(&sc->arpcom.ac_if, ierrors, 1); sc->regs->SR = CRC; } if (status & OFL) { ++sc->in_stats.ofl_errs; IFNET_STAT_INC(&sc->arpcom.ac_if, ierrors, 1); sc->regs->SR = OFL; } }
static void activate(struct sbsh_softc *sc) { struct timeval tv; sc->regs->SR = 0xff; /* clear it! */ sc->regs->CTDR = sc->regs->LTDR = sc->regs->CRDR = sc->regs->LRDR = 0; sc->head_tdesc = sc->head_rdesc = 0; alloc_rx_buffers(sc); sc->regs->CRB &= ~RXDE; sc->regs->IMR = EXT | RXS | TXS | CRC | OFL | UFL; sc->regs->CR |= TXEN | RXEN; sc->state = ACTIVE; ++sc->in_stats.attempts; microtime(&tv); sc->in_stats.last_time = tv.tv_sec; start_xmit_frames(sc); }
static int qtnf_pcie_init_xfer(struct qtnf_pcie_bus_priv *priv) { int ret; u32 val; priv->tx_bd_num = tx_bd_size_param; priv->rx_bd_num = rx_bd_size_param; priv->rx_bd_w_index = 0; priv->rx_bd_r_index = 0; if (!priv->tx_bd_num || !is_power_of_2(priv->tx_bd_num)) { pr_err("tx_bd_size_param %u is not power of two\n", priv->tx_bd_num); return -EINVAL; } val = priv->tx_bd_num * sizeof(struct qtnf_tx_bd); if (val > PCIE_HHBM_MAX_SIZE) { pr_err("tx_bd_size_param %u is too large\n", priv->tx_bd_num); return -EINVAL; } if (!priv->rx_bd_num || !is_power_of_2(priv->rx_bd_num)) { pr_err("rx_bd_size_param %u is not power of two\n", priv->rx_bd_num); return -EINVAL; } val = priv->rx_bd_num * sizeof(dma_addr_t); if (val > PCIE_HHBM_MAX_SIZE) { pr_err("rx_bd_size_param %u is too large\n", priv->rx_bd_num); return -EINVAL; } ret = qtnf_hhbm_init(priv); if (ret) { pr_err("failed to init h/w queues\n"); return ret; } ret = alloc_skb_array(priv); if (ret) { pr_err("failed to allocate skb array\n"); return ret; } ret = alloc_bd_table(priv); if (ret) { pr_err("failed to allocate bd table\n"); return ret; } ret = alloc_rx_buffers(priv); if (ret) { pr_err("failed to allocate rx buffers\n"); return ret; } return ret; }