mbuf: replace data pointer by an offset
[dpdk.git] / app / test-pmd / csumonly.c
index 3568ba0..2ce4c42 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -263,7 +263,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                pkt_ol_flags = mb->ol_flags;
                ol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK));
 
-               eth_hdr = (struct ether_hdr *) mb->pkt.data;
+               eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
                eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
                if (eth_type == ETHER_TYPE_VLAN) {
                        /* Only allow single VLAN label here */
@@ -313,6 +313,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                                ol_flags |= PKT_TX_IP_CKSUM;
                        }
                        else {
+                               ol_flags |= PKT_TX_IPV4;
                                /* SW checksum calculation */
                                ipv4_hdr->src_addr++;
                                ipv4_hdr->hdr_checksum = get_ipv4_cksum(ipv4_hdr);
@@ -373,6 +374,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                                        unsigned char *) + l2_len);
                        l3_len = sizeof(struct ipv6_hdr) ;
                        l4_proto = ipv6_hdr->proto;
+                       ol_flags |= PKT_TX_IPV6;
 
                        if (l4_proto == IPPROTO_UDP) {
                                udp_hdr = (struct udp_hdr*) (rte_pktmbuf_mtod(mb,
@@ -430,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                }
 
                /* Combine the packet header write. VLAN is not consider here */
-               mb->pkt.vlan_macip.f.l2_len = l2_len;
-               mb->pkt.vlan_macip.f.l3_len = l3_len;
+               mb->l2_len = l2_len;
+               mb->l3_len = l3_len;
                mb->ol_flags = ol_flags;
        }
        nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);