diff mbox

[PATCHv3,3/4] Add ability to set packet flags

Message ID 1408999672-29253-4-git-send-email-robking@cisco.com
State Superseded
Headers show

Commit Message

Robbie King Aug. 25, 2014, 8:47 p.m. UTC
Signed-off-by: Robbie King <robking@cisco.com>
---
 .../linux-generic/include/api/odp_packet_flags.h   |  136 ++++++++++++++++++++
 platform/linux-generic/odp_packet_flags.c          |   87 +++++++++++++
 2 files changed, 223 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h
index eb9315b..2c19440 100644
--- a/platform/linux-generic/include/api/odp_packet_flags.h
+++ b/platform/linux-generic/include/api/odp_packet_flags.h
@@ -182,6 +182,142 @@  int odp_packet_inflag_icmp(odp_packet_t pkt);
  */
 void odp_packet_outflag_l4_chksum(odp_packet_t pkt);
 
+/**
+ * Set flag for L2 header, e.g. ethernet
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_l2(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for L3 header, e.g. IPv4, IPv6
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_l3(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for L4 header, e.g. UDP, TCP, SCTP (also ICMP)
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_l4(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for Ethernet header
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_eth(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for jumbo frame
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for VLAN
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for VLAN QinQ (stacked VLAN)
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for ARP
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_arp(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for IPv4
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for IPv6
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for IP fragment
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for IP options
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for IPSec
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for UDP
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_udp(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for TCP
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for SCTP
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val);
+
+/**
+ * Set flag for ICMP
+ *
+ * @param pkt Packet handle
+ * @param val Value
+ */
+void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index 992b94b..06fdeed 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -113,3 +113,90 @@  void odp_packet_outflag_l4_chksum(odp_packet_t pkt)
 {
 	odp_packet_hdr(pkt)->output_flags.l4_chksum = 1;
 }
+
+/* Set Input Flags */
+
+void odp_packet_set_inflag_l2(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.l2 = val;
+}
+
+void odp_packet_set_inflag_l3(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.l3 = val;
+}
+
+void odp_packet_set_inflag_l4(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.l4 = val;
+}
+
+void odp_packet_set_inflag_eth(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.eth = val;
+}
+
+void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.jumbo = val;
+}
+
+void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.vlan = val;
+}
+
+void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.vlan_qinq = val;
+}
+
+void odp_packet_set_inflag_arp(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.arp = val;
+}
+
+void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.ipv4 = val;
+}
+
+void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.ipv6 = val;
+}
+
+void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.ipfrag = val;
+}
+
+void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.ipopt = val;
+}
+
+void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.ipsec = val;
+}
+
+void odp_packet_set_inflag_udp(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.udp = val;
+}
+
+void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.tcp = val;
+}
+
+void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.sctp = val;
+}
+
+void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val)
+{
+	odp_packet_hdr(pkt)->input_flags.icmp = val;
+}