diff mbox

[2/4] linux-generic: packet: remove vlan_s_tag and vlan_c_tag members from odp_packet_hdr_t

Message ID AM4PR07MB1233D309E6D6B4E2518E606B9C740@AM4PR07MB1233.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) May 13, 2016, 8:16 a.m. UTC
Hi Bala,

As this code is used in the fast path I’d rather just remove it for now. When someone is actually implementing this use-case he/she can choose how to do it without causing performance degradation.

Before this patch set the size of odp_packet_hdr_t was 360 bytes (!). Simply by removing unused odp_packet_hdr_t members and optimizing the packet_init() function I was able to increase maximum packet throughput by almost 1 Mpps (odp_l2fwd, 64B packets, netmap/dpdk pktio).

-Matias


From: EXT Bala Manoharan [mailto:bala.manoharan@linaro.org]

Sent: Friday, May 13, 2016 9:39 AM
To: Elo, Matias (Nokia - FI/Espoo) <matias.elo@nokia.com>
Cc: LNG ODP Mailman List <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [PATCH 2/4] linux-generic: packet: remove vlan_s_tag and vlan_c_tag members from odp_packet_hdr_t

There is a use-case in classification, where the packet can be classified based on outer/inner vlan tag and for that specific use-case it is better to store the vlan value in packet header field.

Regards,
Bala

On 12 May 2016 at 18:06, Matias Elo <matias.elo@nokia.com<mailto:matias.elo@nokia.com>> wrote:
There is no way to read vlan tags in the ODP API, so don't
save them.

Signed-off-by: Matias Elo <matias.elo@nokia.com<mailto:matias.elo@nokia.com>>

---
 platform/linux-generic/include/odp_packet_internal.h | 4 ----
 platform/linux-generic/odp_packet.c                  | 4 ----
 2 files changed, 8 deletions(-)

--
1.9.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org<mailto:lng-odp@lists.linaro.org>
https://lists.linaro.org/mailman/listinfo/lng-odp

Comments

Balasubramanian Manoharan May 13, 2016, 10:25 a.m. UTC | #1
On 13 May 2016 at 13:46, Elo, Matias (Nokia - FI/Espoo) <
matias.elo@nokia.com> wrote:

> Hi Bala,

>

>

>

> As this code is used in the fast path I’d rather just remove it for now.

> When someone is actually implementing this use-case he/she can choose how

> to do it without causing performance degradation.

>

>

>

> Before this patch set the size of odp_packet_hdr_t was 360 bytes (!).

> Simply by removing unused odp_packet_hdr_t members and optimizing the

> packet_init() function I was able to increase maximum packet throughput by

> almost 1 Mpps (odp_l2fwd, 64B packets, netmap/dpdk pktio).

>


Sure. If the performance boost is by this much makes sense to remove this
now.

Regards,
Bala

> -Matias

>

>

>

>

>

> *From:* EXT Bala Manoharan [mailto:bala.manoharan@linaro.org]

> *Sent:* Friday, May 13, 2016 9:39 AM

> *To:* Elo, Matias (Nokia - FI/Espoo) <matias.elo@nokia.com>

> *Cc:* LNG ODP Mailman List <lng-odp@lists.linaro.org>

> *Subject:* Re: [lng-odp] [PATCH 2/4] linux-generic: packet: remove

> vlan_s_tag and vlan_c_tag members from odp_packet_hdr_t

>

>

>

> There is a use-case in classification, where the packet can be classified

> based on outer/inner vlan tag and for that specific use-case it is better

> to store the vlan value in packet header field.

>

>

>

> Regards,

> Bala

>

>

>

> On 12 May 2016 at 18:06, Matias Elo <matias.elo@nokia.com> wrote:

>

> There is no way to read vlan tags in the ODP API, so don't

> save them.

>

> Signed-off-by: Matias Elo <matias.elo@nokia.com>

> ---

>  platform/linux-generic/include/odp_packet_internal.h | 4 ----

>  platform/linux-generic/odp_packet.c                  | 4 ----

>  2 files changed, 8 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_packet_internal.h

> b/platform/linux-generic/include/odp_packet_internal.h

> index 508adf8..2a12503 100644

> --- a/platform/linux-generic/include/odp_packet_internal.h

> +++ b/platform/linux-generic/include/odp_packet_internal.h

> @@ -143,8 +143,6 @@ typedef struct {

>         uint32_t l4_offset; /**< offset to L4 hdr (TCP, UDP, SCTP, also

> ICMP) */

>         uint32_t payload_offset; /**< offset to payload */

>

> -       uint32_t vlan_s_tag;     /**< Parsed 1st VLAN header (S-TAG) */

> -       uint32_t vlan_c_tag;     /**< Parsed 2nd VLAN header (C-TAG) */

>         uint32_t l3_len;         /**< Layer 3 length */

>         uint32_t l4_len;         /**< Layer 4 length */

>

> @@ -184,8 +182,6 @@ static inline void

> copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,

>         dst_hdr->l4_offset      = src_hdr->l4_offset;

>         dst_hdr->payload_offset = src_hdr->payload_offset;

>

> -       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;

> -       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;

>         dst_hdr->l3_len         = src_hdr->l3_len;

>         dst_hdr->l4_len         = src_hdr->l4_len;

>  }

> diff --git a/platform/linux-generic/odp_packet.c

> b/platform/linux-generic/odp_packet.c

> index 8681c08..436265e 100644

> --- a/platform/linux-generic/odp_packet.c

> +++ b/platform/linux-generic/odp_packet.c

> @@ -42,8 +42,6 @@ void packet_parse_reset(odp_packet_hdr_t *pkt_hdr)

>         pkt_hdr->l3_offset        = ODP_PACKET_OFFSET_INVALID;

>         pkt_hdr->l4_offset        = ODP_PACKET_OFFSET_INVALID;

>         pkt_hdr->payload_offset   = ODP_PACKET_OFFSET_INVALID;

> -       pkt_hdr->vlan_s_tag       = 0;

> -       pkt_hdr->vlan_c_tag       = 0;

>  }

>

>  /**

> @@ -1223,7 +1221,6 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr,

> const uint8_t *ptr)

>

>                 vlan = (const odph_vlanhdr_t *)parseptr;

>                 ethtype = odp_be_to_cpu_16(vlan->type);

> -               pkt_hdr->vlan_s_tag = odp_be_to_cpu_16(vlan->tci);

>                 offset += sizeof(odph_vlanhdr_t);

>                 parseptr += sizeof(odph_vlanhdr_t);

>         }

> @@ -1232,7 +1229,6 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr,

> const uint8_t *ptr)

>                 pkt_hdr->input_flags.vlan = 1;

>                 vlan = (const odph_vlanhdr_t *)parseptr;

>                 ethtype = odp_be_to_cpu_16(vlan->type);

> -               pkt_hdr->vlan_c_tag = odp_be_to_cpu_16(vlan->tci);

>                 offset += sizeof(odph_vlanhdr_t);

>                 parseptr += sizeof(odph_vlanhdr_t);

>         }

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>

>

>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 508adf8..2a12503 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -143,8 +143,6 @@  typedef struct {
        uint32_t l4_offset; /**< offset to L4 hdr (TCP, UDP, SCTP, also ICMP) */
        uint32_t payload_offset; /**< offset to payload */

-       uint32_t vlan_s_tag;     /**< Parsed 1st VLAN header (S-TAG) */
-       uint32_t vlan_c_tag;     /**< Parsed 2nd VLAN header (C-TAG) */
        uint32_t l3_len;         /**< Layer 3 length */
        uint32_t l4_len;         /**< Layer 4 length */

@@ -184,8 +182,6 @@  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
        dst_hdr->l4_offset      = src_hdr->l4_offset;
        dst_hdr->payload_offset = src_hdr->payload_offset;

-       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
-       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
        dst_hdr->l3_len         = src_hdr->l3_len;
        dst_hdr->l4_len         = src_hdr->l4_len;
 }
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 8681c08..436265e 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -42,8 +42,6 @@  void packet_parse_reset(odp_packet_hdr_t *pkt_hdr)
        pkt_hdr->l3_offset        = ODP_PACKET_OFFSET_INVALID;
        pkt_hdr->l4_offset        = ODP_PACKET_OFFSET_INVALID;
        pkt_hdr->payload_offset   = ODP_PACKET_OFFSET_INVALID;
-       pkt_hdr->vlan_s_tag       = 0;
-       pkt_hdr->vlan_c_tag       = 0;
 }

 /**
@@ -1223,7 +1221,6 @@  int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)

                vlan = (const odph_vlanhdr_t *)parseptr;
                ethtype = odp_be_to_cpu_16(vlan->type);
-               pkt_hdr->vlan_s_tag = odp_be_to_cpu_16(vlan->tci);
                offset += sizeof(odph_vlanhdr_t);
                parseptr += sizeof(odph_vlanhdr_t);
        }
@@ -1232,7 +1229,6 @@  int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *ptr)
                pkt_hdr->input_flags.vlan = 1;
                vlan = (const odph_vlanhdr_t *)parseptr;
                ethtype = odp_be_to_cpu_16(vlan->type);
-               pkt_hdr->vlan_c_tag = odp_be_to_cpu_16(vlan->tci);
                offset += sizeof(odph_vlanhdr_t);
                parseptr += sizeof(odph_vlanhdr_t);
        }