Extending - UofG-netlab/BPFabric GitHub Wiki

Functions

Adding new forwarding decision

If you want to add a new forwarding decision from a function you can:

  • Add the new function opcode in ebpf_consts.h
  • Change transmit in the softswitch to handle this opcode
  • Change pkt_transmit in the DPDK switch to handle this opcode
  • Change pipeline_exec in the agent if the pipeline execution is impacted by this opcode

Adding new API calls

If you want to expose new API calls in your functions you can:

  • Add the function prototype and identifier in ebpf_functions.h
  • Change recv_function_add in the agent to register the new function in the eBPF virtual machine.

Adding new type of maps

If you want to support new type of maps in your functions you can:

  • Add the map type to bpfmap.h in enum bpf_map_type
  • Add your function pointers in bpfmap.c
  • If your map is not a default map type exposed by the linux kernel in linux/bpf.h you need to define the ID from bpfmap.h in your function.
  • Modify recv_table_list_request to allow this table type content to be sent to the controller

Southbound API

Adding new messages

If you want to allow new messages from the controller to the switch or vice-versa you must:

  • Add the Protobuf definition for your message in protocol/
  • Add the message type to Header.proto
  • Add the message handler in agent.c
  • Add the message type to protocol.py