netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tobin C. Harding" <tobin@apporbit.com>
To: William Tu <u9012063@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] erspan: set bso bit based on mirrored packet's len
Date: Tue, 15 May 2018 15:33:42 +1000	[thread overview]
Message-ID: <20180515053342.GB10152@eros> (raw)
In-Reply-To: <1526342076-43714-1-git-send-email-u9012063@gmail.com>

On Mon, May 14, 2018 at 04:54:36PM -0700, William Tu wrote:
> Before the patch, the erspan BSO bit (Bad/Short/Oversized) is not
> handled.  BSO has 4 possible values:
>   00 --> Good frame with no error, or unknown integrity
>   11 --> Payload is a Bad Frame with CRC or Alignment Error
>   01 --> Payload is a Short Frame
>   10 --> Payload is an Oversized Frame
> 
> Based the short/oversized definitions in RFC1757, the patch sets
> the bso bit based on the mirrored packet's size.
> 
> Reported-by: Xiaoyan Jin <xiaoyanj@vmware.com>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
>  include/net/erspan.h | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/include/net/erspan.h b/include/net/erspan.h
> index d044aa60cc76..5eb95f78ad45 100644
> --- a/include/net/erspan.h
> +++ b/include/net/erspan.h
> @@ -219,6 +219,30 @@ static inline __be32 erspan_get_timestamp(void)
>  	return htonl((u32)h_usecs);
>  }
>  
> +/* ERSPAN BSO (Bad/Short/Oversized)
> + *   00b --> Good frame with no error, or unknown integrity
> + *   01b --> Payload is a Short Frame
> + *   10b --> Payload is an Oversized Frame
> + *   11b --> Payload is a Bad Frame with CRC or Alignment Error
> + */
> +enum erspan_bso {
> +	BSO_NOERROR,
> +	BSO_SHORT,
> +	BSO_OVERSIZED,
> +	BSO_BAD,
> +};

If we are relying on the values perhaps this would be clearer

	BSO_NOERROR	= 0x00,
	BSO_SHORT 	= 0x01,
	BSO_OVERSIZED 	= 0x02,
	BSO_BAD 	= 0x03,

> +
> +static inline u8 erspan_detect_bso(struct sk_buff *skb)
> +{
> +	if (skb->len < ETH_ZLEN)
> +		return BSO_SHORT;
> +
> +	if (skb->len > ETH_FRAME_LEN)
> +		return BSO_OVERSIZED;
> +
> +	return BSO_NOERROR;
> +}

Without having much contextual knowledge around this patch; should we be
doing some check on CRC or alignment (at some stage)?  Having BSO_BAD
seems to imply so? 


Hope this helps,
Tobin.

  reply	other threads:[~2018-05-15  5:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 23:54 [PATCH net-next] erspan: set bso bit based on mirrored packet's len William Tu
2018-05-15  5:33 ` Tobin C. Harding [this message]
2018-05-16 14:05   ` William Tu
2018-05-16 22:24     ` Tobin C. Harding
2018-05-17 16:57       ` William Tu

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=20180515053342.GB10152@eros \
    --to=tobin@apporbit.com \
    --cc=netdev@vger.kernel.org \
    --cc=u9012063@gmail.com \
    /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).