DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Tanzeel-inline <tanxeel1.ahmed@gmail.com>
Cc: olivier.matz@6wind.com, thomas@monjalon.net,
	tanzeelahmed713@gmail.com, dev@dpdk.org
Subject: Re: [PATCH v3] lib/net: add MPLS insert and strip functionality
Date: Thu, 3 Oct 2024 11:46:23 -0700	[thread overview]
Message-ID: <20241003114623.74d9526a@hermes.local> (raw)
In-Reply-To: <20230224110619.665-1-tanxeel1.ahmed@gmail.com>

On Fri, 24 Feb 2023 16:06:19 +0500
Tanzeel-inline <tanxeel1.ahmed@gmail.com> wrote:

> +static inline int
> +rte_mpls_strip_over_l2(struct rte_mbuf *m)
> +{
> +	struct rte_ether_hdr *eh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
> +	struct rte_mpls_hdr *mph;
> +	bool mpls_exist = true;
> +
> +	if (eh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS))
> +		return -1;
> +
> +	/* Stripping all MPLS header */
> +	while (mpls_exist) {
> +		mph = rte_pktmbuf_mtod_offset(m, struct rte_mpls_hdr*,
space required (i.e "struct rte_mpls_hdr *")
> +		sizeof(struct rte_ether_hdr));
> +		if (mph->bs & 1)
> +			mpls_exist = false;
> +		memmove(rte_pktmbuf_adj(m, sizeof(struct rte_mpls_hdr)),
> +		eh, sizeof(struct rte_ether_hdr));
> +		eh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
> +	}
> +
> +	return 0;
> +}

This function will fail for the case of segmented mbuf.
Also need to handle case where mbuf is corrupted and just has stack of mpls
tags and the last one is incomplete.


  reply	other threads:[~2024-10-03 18:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 11:06 Tanzeel-inline
2024-10-03 18:46 ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-19 22:43 [PATCH v2] " Tanzeel-inline
2023-02-24 11:25 ` [PATCH v3] " Tanzeel-inline
2023-02-24 16:29   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241003114623.74d9526a@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=tanxeel1.ahmed@gmail.com \
    --cc=tanzeelahmed713@gmail.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).