aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2015-01-22 17:17:26 +0000
committerZoltan Kiss <zoltan.kiss@linaro.org>2015-01-22 17:17:26 +0000
commit63defe34100ddf9b6559f4284fc703ff043c81e6 (patch)
treebc370749758ebfdc389aca2091aa1651bbff451b
parentb4c2d6d4b568350308618c633ae7eb803a8d6f92 (diff)
Rename packet start function
Porting commit from linux-generic (7df9)
-rw-r--r--platform/linux-dpdk/include/api/odp_packet.h32
-rw-r--r--platform/linux-dpdk/odp_packet.c12
2 files changed, 20 insertions, 24 deletions
diff --git a/platform/linux-dpdk/include/api/odp_packet.h b/platform/linux-dpdk/include/api/odp_packet.h
index 5002a626b..50e19ec06 100644
--- a/platform/linux-dpdk/include/api/odp_packet.h
+++ b/platform/linux-dpdk/include/api/odp_packet.h
@@ -98,41 +98,37 @@ void odp_packet_set_ctx(odp_packet_t buf, const void *ctx);
void *odp_packet_get_ctx(odp_packet_t buf);
/**
- * Get address to the start of the packet buffer
+ * Packet buffer start address
+ *
+ * Returns a pointer to the start of the packet buffer. The address is not
+ * necessarily the same as packet data address. E.g. on a received Ethernet
+ * frame, the protocol header may start 2 or 6 bytes within the buffer to
+ * ensure 32 or 64-bit alignment of the IP header.
*
- * The address of the packet buffer is not necessarily the same as the start
- * address of the received frame, e.g. an eth frame may be offset by 2 or 6
- * bytes to ensure 32 or 64-bit alignment of the IP header.
* Use odp_packet_l2(pkt) to get the start address of a received valid frame
- * or odp_packet_start(pkt) to get the start address even if no valid L2 header
- * could be found.
+ * or odp_packet_data(pkt) to get the current packet data address.
*
* @param pkt Packet handle
*
* @return Pointer to the start of the packet buffer
*
- * @see odp_packet_l2(), odp_packet_start()
+ * @see odp_packet_l2(), odp_packet_data()
*/
uint8_t *odp_packet_addr(odp_packet_t pkt);
/**
- * Get pointer to the start of the received frame
- *
- * The address of the packet buffer is not necessarily the same as the start
- * address of the received frame, e.g. an eth frame may be offset by 2 or 6
- * bytes to ensure 32 or 64-bit alignment of the IP header.
- * Use odp_packet_l2(pkt) to get the start address of a received valid eth frame
+ * Packet data address
*
- * odp_packet_start() will always return a pointer to the start of the frame,
- * even if the frame is unrecognized and no valid L2 header could be found.
+ * Returns the current packet data address. When a packet is received from
+ * packet input, the data address points to the first byte of the packet.
*
* @param pkt Packet handle
*
- * @return Pointer to the start of the received frame
+ * @return Pointer to the packet data
*
* @see odp_packet_l2(), odp_packet_addr()
*/
-uint8_t *odp_packet_start(odp_packet_t pkt);
+uint8_t *odp_packet_data(odp_packet_t pkt);
/**
* Get pointer to the start of the L2 frame
@@ -144,7 +140,7 @@ uint8_t *odp_packet_start(odp_packet_t pkt);
*
* @return Pointer to L2 header or NULL if not found
*
- * @see odp_packet_addr(), odp_packet_start()
+ * @see odp_packet_addr(), odp_packet_data()
*/
uint8_t *odp_packet_l2(odp_packet_t pkt);
diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c
index 28add7f7f..fe3f3f612 100644
--- a/platform/linux-dpdk/odp_packet.c
+++ b/platform/linux-dpdk/odp_packet.c
@@ -95,7 +95,7 @@ uint8_t *odp_packet_addr(odp_packet_t pkt)
return odp_buffer_addr(odp_buffer_from_packet(pkt));
}
-uint8_t *odp_packet_start(odp_packet_t pkt)
+uint8_t *odp_packet_data(odp_packet_t pkt)
{
struct rte_mbuf *mb = &(odp_packet_hdr(pkt)->buf_hdr.mb);
return mb->pkt.data;
@@ -109,7 +109,7 @@ uint8_t *odp_packet_l2(odp_packet_t pkt)
if (odp_unlikely(offset == ODP_PACKET_OFFSET_INVALID))
return NULL;
- return odp_packet_start(pkt) + offset;
+ return odp_packet_data(pkt) + offset;
}
size_t odp_packet_l2_offset(odp_packet_t pkt)
@@ -129,7 +129,7 @@ uint8_t *odp_packet_l3(odp_packet_t pkt)
if (odp_unlikely(offset == ODP_PACKET_OFFSET_INVALID))
return NULL;
- return odp_packet_start(pkt) + offset;
+ return odp_packet_data(pkt) + offset;
}
size_t odp_packet_l3_offset(odp_packet_t pkt)
@@ -149,7 +149,7 @@ uint8_t *odp_packet_l4(odp_packet_t pkt)
if (odp_unlikely(offset == ODP_PACKET_OFFSET_INVALID))
return NULL;
- return odp_packet_start(pkt) + offset;
+ return odp_packet_data(pkt) + offset;
}
size_t odp_packet_l4_offset(odp_packet_t pkt)
@@ -202,7 +202,7 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset)
pkt_hdr->input_flags.l2 = 1;
pkt_hdr->l2_offset = 0;
- eth = (odph_ethhdr_t *)odp_packet_start(pkt);
+ eth = (odph_ethhdr_t *)odp_packet_data(pkt);
ethtype = odp_be_to_cpu_16(eth->type);
vlan = (odph_vlanhdr_t *)&eth->type;
@@ -369,7 +369,7 @@ void odp_packet_print(odp_packet_t pkt)
printf("\n%s\n", str);
rte_pktmbuf_dump(stdout, &hdr->buf_hdr.mb, 32);
- p = odp_packet_start(pkt);
+ p = odp_packet_data(pkt);
printf("00000000: %02X %02X %02X %02X %02X %02X %02X %02X\n",
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
printf("00000008: %02X %02X %02X %02X %02X %02X %02X %02X\n",