diff mbox

[03/13] Add ability to set packet flags

Message ID 1408624238-12430-4-git-send-email-robking@cisco.com
State New
Headers show

Commit Message

Robbie King Aug. 21, 2014, 12:30 p.m. UTC
Signed-off-by: Robbie King <robking@cisco.com>
---
 include/odp_packet_flags.h                |  136 +++++++++++++++++++++++++++++
 platform/linux-generic/odp_packet_flags.c |   88 +++++++++++++++++++
 2 files changed, 224 insertions(+), 0 deletions(-)

Comments

Alexandru Badicioiu Aug. 22, 2014, 7:32 a.m. UTC | #1
On 21 August 2014 15:30, Robbie King <robking@cisco.com> wrote:

> Signed-off-by: Robbie King <robking@cisco.com>
>
    Tested-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org>

> ---
>  include/odp_packet_flags.h                |  136
> +++++++++++++++++++++++++++++
>  platform/linux-generic/odp_packet_flags.c |   88 +++++++++++++++++++
>  2 files changed, 224 insertions(+), 0 deletions(-)
>
> diff --git a/include/odp_packet_flags.h b/include/odp_packet_flags.h
> index eb9315b..2c19440 100644
> --- a/include/odp_packet_flags.h
> +++ b/include/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..9fea8b6 100644
> --- a/platform/linux-generic/odp_packet_flags.c
> +++ b/platform/linux-generic/odp_packet_flags.c
> @@ -113,3 +113,91 @@ 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;
> +}
> +
> --
> 1.7.7.6
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/include/odp_packet_flags.h b/include/odp_packet_flags.h
index eb9315b..2c19440 100644
--- a/include/odp_packet_flags.h
+++ b/include/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..9fea8b6 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -113,3 +113,91 @@  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;
+}
+