Lines Matching refs:pkt
158 static int xnb_ring2pkt(struct xnb_pkt *pkt,
161 static void xnb_txpkt2rsp(const struct xnb_pkt *pkt,
163 static struct mbuf *xnb_pkt2mbufc(const struct xnb_pkt *pkt, struct ifnet *ifp);
164 static int xnb_txpkt2gnttab(const struct xnb_pkt *pkt,
172 struct xnb_pkt *pkt,
174 static int xnb_rxpkt2gnttab(const struct xnb_pkt *pkt,
179 static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt,
278 xnb_dump_pkt(const struct xnb_pkt *pkt) {
279 if (pkt == NULL) {
283 DPRINTF("pkt address= %p\n", pkt);
284 DPRINTF("pkt->size=%d\n", pkt->size);
285 DPRINTF("pkt->car_size=%d\n", pkt->car_size);
286 DPRINTF("pkt->flags=0x%04x\n", pkt->flags);
287 DPRINTF("pkt->list_len=%d\n", pkt->list_len);
288 /* DPRINTF("pkt->extra"); TODO */
289 DPRINTF("pkt->car=%d\n", pkt->car);
290 DPRINTF("pkt->cdr=%d\n", pkt->cdr);
291 DPRINTF("pkt->error=%d\n", pkt->error);
1470 * \param[out] pkt The returned packet. If there is an error building
1471 * the packet, pkt.list_len will be set to 0.
1477 xnb_ring2pkt(struct xnb_pkt *pkt, const netif_tx_back_ring_t *tx_ring,
1482 * 1) Initialize pkt
1487 * 6) Finalize pkt (stuff like car_size and list_len)
1494 xnb_pkt_initialize(pkt);
1499 pkt->size = tx->size;
1500 pkt->flags = tx->flags & ~NETTXF_more_data;
1502 pkt->list_len++;
1503 pkt->car = idx;
1508 if ((pkt->flags & NETTXF_extra_info) &&
1512 pkt->extra.type = ext->type;
1513 switch (pkt->extra.type) {
1515 pkt->extra.u.gso = ext->u.gso;
1526 __func__, __LINE__, pkt->extra.type);
1535 pkt->extra.flags = ext->flags;
1554 pkt->cdr = idx;
1559 pkt->list_len++;
1577 xnb_pkt_invalidate(pkt);
1581 pkt->car_size = pkt->size - cdr_size;
1584 xnb_pkt_invalidate(pkt);
1591 * Respond to all the requests that constituted pkt. Builds the responses and
1593 * \param[in] pkt the packet that needs a response
1599 xnb_txpkt2rsp(const struct xnb_pkt *pkt, netif_tx_back_ring_t *ring,
1615 status = (xnb_pkt_is_valid(pkt) == 0) || error ?
1617 KASSERT((pkt->list_len == 0) || (ring->rsp_prod_pvt == pkt->car),
1620 if (pkt->list_len >= 1) {
1629 if (pkt->flags & NETRXF_extra_info) {
1636 for (i=0; i < pkt->list_len - 1; i++) {
1651 * \param[in] pkt A packet to model the mbuf chain after
1656 xnb_pkt2mbufc(const struct xnb_pkt *pkt, struct ifnet *ifp)
1665 m = m_getm(NULL, pkt->size, M_NOWAIT, MT_DATA);
1669 if (pkt->flags & NETTXF_data_validated) {
1688 * Build a gnttab_copy table that can be used to copy data from a pkt
1691 * \param[in] pkt pkt's associated requests form the src for
1700 xnb_txpkt2gnttab(const struct xnb_pkt *pkt, struct mbuf *mbufc,
1707 RING_IDX r_idx = pkt->car; /* index into tx ring buffer */
1711 uint16_t size_remaining = pkt->size;
1717 r_idx == pkt->car ? pkt->car_size : txq->size;
1746 r_idx = (r_idx == pkt->car) ? pkt->cdr : r_idx + 1;
1810 struct xnb_pkt pkt;
1816 num_consumed = xnb_ring2pkt(&pkt, txb, txb->req_cons);
1827 if (xnb_pkt_is_valid(&pkt) == 0) {
1829 xnb_txpkt2rsp(&pkt, txb, 1);
1837 *mbufc = xnb_pkt2mbufc(&pkt, ifnet);
1844 xnb_txpkt2rsp(&pkt, txb, 1);
1851 nr_ents = xnb_txpkt2gnttab(&pkt, *mbufc, gnttab, txb, otherend);
1861 xnb_txpkt2rsp(&pkt, txb, 0);
1869 * \param[out] pkt Storage for the newly generated xnb_pkt
1874 * \retval EINVAL mbufc was corrupt or not convertible into a pkt
1879 xnb_mbufc2pkt(const struct mbuf *mbufc, struct xnb_pkt *pkt,
1888 xnb_pkt_invalidate(pkt);
1893 xnb_pkt_validate(pkt);
1894 pkt->flags = 0;
1895 pkt->size = mbufc->m_pkthdr.len;
1896 pkt->car = start;
1897 pkt->car_size = mbufc->m_len;
1900 pkt->flags |= NETRXF_extra_info;
1901 pkt->extra.u.gso.size = mbufc->m_pkthdr.tso_segsz;
1902 pkt->extra.u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
1903 pkt->extra.u.gso.pad = 0;
1904 pkt->extra.u.gso.features = 0;
1905 pkt->extra.type = XEN_NETIF_EXTRA_TYPE_GSO;
1906 pkt->extra.flags = 0;
1907 pkt->cdr = start + 2;
1909 pkt->cdr = start + 1;
1912 pkt->flags |=
1922 pkt->list_len = howmany(pkt->size, PAGE_SIZE);
1924 if (pkt->list_len > 1) {
1925 pkt->flags |= NETRXF_more_data;
1928 slots_required = pkt->list_len +
1929 (pkt->flags & NETRXF_extra_info ? 1 : 0);
1931 xnb_pkt_invalidate(pkt);
1943 * \param[in] pkt pkt's associated responses form the dest for the copy
1952 xnb_rxpkt2gnttab(const struct xnb_pkt *pkt, const struct mbuf *mbufc,
1959 RING_IDX r_idx = pkt->car; /* index into rx ring buffer */
1965 size_remaining = (xnb_pkt_is_valid(pkt) != 0) ? pkt->size : 0;
2001 r_idx = (r_idx == pkt->car) ? pkt->cdr : r_idx + 1;
2014 * Generates responses for all the requests that constituted pkt. Builds
2017 * \param[in] pkt the packet that needs a response
2027 xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab,
2080 const int has_extra = pkt->flags & NETRXF_extra_info;
2100 ext->u.gso.size = pkt->extra.u.gso.size;
2109 if (i < pkt->list_len - 1)
2114 (pkt->flags & NETRXF_data_validated)) {
2342 * Requeue pkt and send when space is
2389 * \retval EINVAL mbufc was corrupt or not convertible into a pkt
2395 struct xnb_pkt pkt;
2400 error = xnb_mbufc2pkt(mbufc, &pkt, ring->rsp_prod_pvt, space);
2403 n_entries = xnb_rxpkt2gnttab(&pkt, mbufc, gnttab, ring, otherend);
2411 n_reqs = xnb_rxpkt2rsp(&pkt, gnttab, n_entries, ring);