Coder Social home page Coder Social logo

compiler support for lpm about p4c-xdp HOT 5 OPEN

kwjjyn avatar kwjjyn commented on September 22, 2024
compiler support for lpm

from p4c-xdp.

Comments (5)

mihaibudiu avatar mihaibudiu commented on September 22, 2024

If I understand right, this should be very easy to do as far as the compiler is concerned.

from p4c-xdp.

mihaibudiu avatar mihaibudiu commented on September 22, 2024

I have pushed a PR against the compiler adding LPM table support.
p4lang/p4c#1962
I don't have a recent enough kernel, so perhaps you can help us test?

from p4c-xdp.

kwjjyn avatar kwjjyn commented on September 22, 2024

hi, Mihai Budiu
I saw this PR fail. Does this update relate to the kernel version? And if I want to test whether the compiler support lpm when I define a table in P4 like this :

table dstmactable {
        key = { hd.ipv4.dstAddr : lpm; }
        actions = {
            Fallback_action;
            Drop_action;
        }
        default_action = Drop_action;
        implementation = hash_table(64);
    }

do I need to pull the new commit of p4c and rebuild it firstly? And the key of dstmactable table also should be the ip address and netmask. How do I specify and add these infomation as key. For example, I want to add 10.0.0.0/24 as key , and in the control plane , maybe this way to specify the key is right?

key.field0 = 0x0a00000020   // 0x0a000000 is 10.0.0.0 , 0x20 is netmask 24.

from p4c-xdp.

mihaibudiu avatar mihaibudiu commented on September 22, 2024

The PR did not pass because of a minor C++ style issue.

You can test this by indeed pulling this PR and building it; you can also wait until the PR is merged into master, but I don't know how soon that will be.

Interestingly, this PR may actually do what you want for the kernel, but it will break our user-level tests, since we do not support LPM tables in user space. I will file a separate issue for that. Since I didn't write a user-level test, we will be fine for now.

To insert entries in this table you will have to use the APIs specific to tries, see for example torvalds/linux@b95a5c4. The key is specified as the actual key plus a length. Currently we do not generate a specific key+length structure for this purpose, that's something that we could probably also add.

Please note that next week I will be traveling and I may be unable to respond to requests in a timeline manner.

from p4c-xdp.

kwjjyn avatar kwjjyn commented on September 22, 2024

Thank you for your prompt reply. And I'll test it by pulling the PR.

from p4c-xdp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.