Giter Club home page Giter Club logo

Comments (5)

antoninbas avatar antoninbas commented on August 19, 2024

According to the P4 spec, the first parameter of generate_digest is an opaque value which identifies the receiver of the learning notification. In bmv1, this parameter has to be equal to 1024 in order for learning to happen (let's say this is the identifier of the bmv1 learning channel, and that all other receiver values will lead to the generate_digest call being ignored). In bmv2, this first parameter will completely be ignored (you can set it to whatever you want) and all learning notifications go to the same channel (they are broadcast on an IPC socket).

from p4factory.

lmingcsce avatar lmingcsce commented on August 19, 2024

Thanks for you reply. So it means 1024 is the learning channel for bmv1.Will the mac learning can automatically happen or we should write the channel handler via an IPC socket?

from p4factory.

antoninbas avatar antoninbas commented on August 19, 2024

On bmv1: it depends on whether 1) you write a C application and link it with the bmv1 binary, or 2) do learning through the Thrift RPC server. For 1), the PD library lets you register a callback that will be called every time a new value is learned. For 2) you have to periodically poll the RPC sever to check for new samples learned. I found an old email I sent about this: https://gist.github.com/antoninbas/490676675388c25d6de9
On bmv2: learning notifications are published on a nanomsg IPC socket. There is an example C++ application which does learning checked in the bmv2 repository: https://github.com/p4lang/behavioral-model/blob/master/targets/l2_switch/learn_client/learn_client.cpp
I would advise using bmv2, as bmv1 is likely to be be officially deprecated soon.
Noe that in both cases, populating the mac tables is the responsibility of the application. The switch generates learning notifications, but it is up to the application to act on them.

from p4factory.

lmingcsce avatar lmingcsce commented on August 19, 2024

I see. Thanks for your reply.

from p4factory.

qin-nz avatar qin-nz commented on August 19, 2024

@antoninbas How can I implement several applications outside of P4, not just mac learning?

from p4factory.

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.