Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function "truncate" problem #1354

Closed
tomyhu1995 opened this issue Jun 21, 2018 · 2 comments
Closed

Function "truncate" problem #1354

tomyhu1995 opened this issue Jun 21, 2018 · 2 comments

Comments

@tomyhu1995
Copy link

tomyhu1995 commented Jun 21, 2018

Hi all,
I am trying to use truncate to eliminate payload of packet. The following is the code I use:

   action no_payload() {
        truncate(0);
    }
    apply {
            if (standard_metadata.enq_qdepth >= ECN_THRESHOLD){
                no_payload();
            }
    }

In my opinion, the packet's payload will be eliminate when queue length is larger than ECN_THRESHOLD. However, it doesn't work. Receiver can't receive any packet. And I change the parameter of truncate( change 0 to 34). Receiver can receive packet which only include mac+ipv4 header.

My question is: what is the detail definition of truncate on bmv2? How to eliminate payload by using truncate?

@antoninbas
Copy link
Member

What you are describing makes sense to me. The bmv2 truncate primitive applies to the deparsed packet I believe, not to the payload specifically. So if you truncate to 0, the packet is dropped.

@tomyhu1995
Copy link
Author

@antoninbas It is real make sense to me, too.
I was confused by this issue #303. I do believe your explanation is correct and make sense. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants