* process_responses - process responses from an SGE response queue * @q: the ingress queue to process * @budget: how many responses can be processed in this round * @rx_pkts: mbuf to put the pkts * * Process responses from an SGE response queue up to the supplied budget. * Responses include received packets as well as control messages from FW * or HW. * * Additionally choose the interrupt
| 1507 | * long delay to help recovery. |
| 1508 | */ |
| 1509 | static int process_responses(struct sge_rspq *q, int budget, |
| 1510 | struct rte_mbuf **rx_pkts) |
| 1511 | { |
| 1512 | int ret = 0, rsp_type; |
| 1513 | int budget_left = budget; |
| 1514 | const struct rsp_ctrl *rc; |
| 1515 | struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); |
| 1516 | |
| 1517 | while (likely(budget_left)) { |
| 1518 | if (q->cidx == ntohs(q->stat->pidx)) |
| 1519 | break; |
| 1520 | |
| 1521 | rc = (const struct rsp_ctrl *) |
| 1522 | ((const char *)q->cur_desc + (q->iqe_len - sizeof(*rc))); |
| 1523 | |
| 1524 | /* |
| 1525 | * Ensure response has been read |
| 1526 | */ |
| 1527 | rmb(); |
| 1528 | rsp_type = G_RSPD_TYPE(rc->u.type_gen); |
| 1529 | |
| 1530 | if (likely(rsp_type == X_RSPD_TYPE_FLBUF)) { |
| 1531 | struct sge *s = &q->adapter->sge; |
| 1532 | unsigned int stat_pidx; |
| 1533 | int stat_pidx_diff; |
| 1534 | |
| 1535 | stat_pidx = ntohs(q->stat->pidx); |
| 1536 | stat_pidx_diff = P_IDXDIFF(q, stat_pidx); |
| 1537 | while (stat_pidx_diff && budget_left) { |
| 1538 | const struct rx_sw_desc *rsd = |
| 1539 | &rxq->fl.sdesc[rxq->fl.cidx]; |
| 1540 | const struct rss_header *rss_hdr = |
| 1541 | (const void *)q->cur_desc; |
| 1542 | const struct cpl_rx_pkt *cpl = |
| 1543 | (const void *)&q->cur_desc[1]; |
| 1544 | struct rte_mbuf *pkt, *npkt; |
| 1545 | u32 len, bufsz; |
| 1546 | |
| 1547 | rc = (const struct rsp_ctrl *) |
| 1548 | ((const char *)q->cur_desc + |
| 1549 | (q->iqe_len - sizeof(*rc))); |
| 1550 | |
| 1551 | rsp_type = G_RSPD_TYPE(rc->u.type_gen); |
| 1552 | if (unlikely(rsp_type != X_RSPD_TYPE_FLBUF)) |
| 1553 | break; |
| 1554 | |
| 1555 | len = ntohl(rc->pldbuflen_qid); |
| 1556 | BUG_ON(!(len & F_RSPD_NEWBUF)); |
| 1557 | pkt = rsd->buf; |
| 1558 | npkt = pkt; |
| 1559 | len = G_RSPD_LEN(len); |
| 1560 | pkt->pkt_len = len; |
| 1561 | |
| 1562 | /* Chain mbufs into len if necessary */ |
| 1563 | while (len) { |
| 1564 | struct rte_mbuf *new_pkt = rsd->buf; |
| 1565 | |
| 1566 | bufsz = min(get_buf_size(q->adapter, |
no test coverage detected