update copyright date to 2013
[dpdk.git] / app / test-pmd / txonly.c
index 7692cb3..eab61e4 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -92,13 +92,10 @@ static inline struct rte_mbuf *
 tx_mbuf_alloc(struct rte_mempool *mp)
 {
        struct rte_mbuf *m;
-       void *mb;
 
-       if (rte_mempool_get(mp, &mb) < 0)
-               return NULL;
-       m = (struct rte_mbuf *)mb;
-       __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
-       return m;
+       m = __rte_mbuf_raw_alloc(mp);
+       __rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+       return (m);
 }
 
 static void
@@ -234,6 +231,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
                for (i = 1; i < tx_pkt_nb_segs; i++) {
                        pkt_seg->pkt.next = tx_mbuf_alloc(mbp);
                        if (pkt_seg->pkt.next == NULL) {
+                               pkt->pkt.nb_segs = i;
                                rte_pktmbuf_free(pkt);
                                goto nomore_mbuf;
                        }
@@ -266,9 +264,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
                pkt->pkt.nb_segs = tx_pkt_nb_segs;
                pkt->pkt.pkt_len = tx_pkt_length;
                pkt->ol_flags = ol_flags;
-               pkt->pkt.vlan_tci  = vlan_tci;
-               pkt->pkt.l2_len = sizeof(struct ether_hdr);
-               pkt->pkt.l3_len = sizeof(struct ipv4_hdr);
+               pkt->pkt.vlan_macip.f.vlan_tci  = vlan_tci;
+               pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+               pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
                pkts_burst[nb_pkt] = pkt;
        }
        nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);