uint16_t failsafe_rx_burst_fast(void *queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct fs_priv *priv; struct sub_device *sdev; struct rxq *rxq; void *sub_rxq; uint16_t nb_rx; uint8_t nb_polled, nb_subs; uint8_t i; rxq = queue; priv = rxq->priv; nb_subs = priv->subs_tail - priv->subs_head; nb_polled = 0; for (i = rxq->last_polled; nb_polled < nb_subs; nb_polled++) { i++; if (i == priv->subs_tail) i = priv->subs_head; sdev = &priv->subs[i]; RTE_ASSERT(!fs_rx_unsafe(sdev)); sub_rxq = ETH(sdev)->data->rx_queues[rxq->qid]; FS_ATOMIC_P(rxq->refcnt[sdev->sid]); nb_rx = ETH(sdev)-> rx_pkt_burst(sub_rxq, rx_pkts, nb_pkts); FS_ATOMIC_V(rxq->refcnt[sdev->sid]); if (nb_rx) { rxq->last_polled = i; return nb_rx; } } return 0; }
static inline int fs_tx_unsafe(struct sub_device *sdev) { return (sdev == NULL) || (ETH(sdev) == NULL) || (ETH(sdev)->tx_pkt_burst == NULL) || (sdev->state != DEV_STARTED); }
uint16_t failsafe_tx_burst_fast(void *queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { struct sub_device *sdev; struct txq *txq; void *sub_txq; uint16_t nb_tx; txq = queue; sdev = TX_SUBDEV(txq->priv->dev); RTE_ASSERT(!fs_tx_unsafe(sdev)); sub_txq = ETH(sdev)->data->tx_queues[txq->qid]; FS_ATOMIC_P(txq->refcnt[sdev->sid]); nb_tx = ETH(sdev)->tx_pkt_burst(sub_txq, tx_pkts, nb_pkts); FS_ATOMIC_V(txq->refcnt[sdev->sid]); return nb_tx; }
/* * -- updateofs * * updates type and offset information in the pkt_t data structure. * requires the type of interface as input. */ __inline__ void updateofs(pkt_t * pkt, int type) { pkt->type = type; pkt->l2type = 0xFFFF; /* implies field unused */ switch (pkt->type) { case COMOTYPE_ETH: if (H16(ETH(type)) == ETHERTYPE_VLAN) { pkt->type = COMOTYPE_VLAN; pkt->l3type = H16(VLAN(ethtype)); } else if (isISL(pkt)) { pkt->type = COMOTYPE_ISL; pkt->l3type = H16(ISL(ethtype)); } else { pkt->l3type = H16(ETH(type)); } break; case COMOTYPE_HDLC: pkt->l3type = H16(HDLC(type)); break; case COMOTYPE_80211: pkt->l2type = H16(IEEE80211_HDR(fc)); if (FCTRL_TYPE(pkt->l2type) == WLANTYPE_DATA) pkt->l3type = H16(LLC_HDR(type)); else pkt->l3type = 0; break; case COMOTYPE_RADIO: pkt->l2type = H16(IEEE80211_HDR(fc)); /* 802.11 + XX byte capture hdr */ if (FCTRL_TYPE(pkt->l2type) == WLANTYPE_DATA) pkt->l3type = H16(LLC_HDR(type)); else pkt->l3type = 0; break; default: pkt->l3type = 0; break; } updatel4(pkt); }