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

[Suggestion] General trex plugins in server side #207

Closed
egwakim opened this issue Mar 18, 2019 · 5 comments
Closed

[Suggestion] General trex plugins in server side #207

egwakim opened this issue Mar 18, 2019 · 5 comments

Comments

@egwakim
Copy link
Contributor

egwakim commented Mar 18, 2019

There is plugin feature in trex-console side, but, there is no plugins support in trex server side.
I think it'll be easy way to cover general features like tunneling.
https://trex-tgn.cisco.com/youtrack/issue/trex-482

If we do not support dynamic unload plugins, just enabling DPDK Rx/Tx callback and load shared libraries will be enough to support this feature.

For example.

  1. In TRex server
    1.1. enable RXTX callback in DPDK library config
    #define RTE_ETHDEV_RXTX_CALLBACKS 1

1.2. Load shared library after device started to be able to use rte_eth_add_tx_callback() API.
device_start();

  • load_plugins();
    dump_config(stdout);

void load_plugins( void ) {
dlopen(trex/plugins/*.so);
...

  1. In shared library
    Use rte_eth_add_tx_callback() API in constructor function in library.
    It'll be called when dlopen() called in TRex.
    attribute((constructor)) init_func(void)
    {
    rte_eth_add_tx_callback(port_id, queue_id, my_tunnel_func, NULL);
    }
    Copy generated .so to trex/plugins

How about your opinion on this approach?

Best Regards
Gwangmoon

@hhaim
Copy link
Contributor

hhaim commented Mar 18, 2019

The tunneling feature is a perfect candidate for plugins.
The main problem is not to have it as a shared object or not.
The problem in implementing such a feature is to define the API and a layer of configuration etc.

@egwakim
Copy link
Contributor Author

egwakim commented Mar 19, 2019

Yes, API layer will be needed.
I think general 'tunnel or plugin' command will be needed.

  1. make general tunnel(or plugin) command.
  2. In tunnel command, call callback function with 'args' in tunnel command function.
  3. make external interface to register callback function for tunnel.

Here is Pseudo RPC command table.

Usage RPC command Description
trex>tunnel control -t GTPUv1 args=“add teid=1000, inner-ip=…” trex>tunnel -t GTPUv1 args=“delete teid=1000, inner-ip=…” { "method" : "tunnel" "params" : { “name" : “GTPUv1", “cmd” : “control”, “args” : “add teid=1000, inner-ip=…” } Control tunnel of ‘GTPUv1’.
trex>tunnel status {“method” : “tunnel” “params” : { “cmd” : “status” } } Show current tunnel plugin status “Not loaded” or “Loaded ‘GTPUv1’ ....”

Here is Pseudo code

trex_tunnel.h
/* interface to external plugin */
int register_tunnel( char name, int (tunnel_control)(String));

trex_rpc_cmds_common.cpp
TREX_RPC_CMD(TrexRpcCmdTunnel, "tunnel");

trex_rpc_cmd_rc_e
TrexRpcCmdTunnel::_run(const Json::Value &params, Json::Value &result) {
string name = parse_string(params, "name", result);
string args = parse_string(params, "args", result);
(*)(String) tunnel_control = NULL;

if ( (tunnel_control = lookup_tunnel(name)) != NULL )
{
    return tunnel_control(args);
}

return (TREX_RPC_CMD_OK);

}
m_cmds.push_back(new TrexRpcCmdTunnel(this));

@hhaim
Copy link
Contributor

hhaim commented Mar 19, 2019 via email

@egwakim
Copy link
Contributor Author

egwakim commented Mar 19, 2019

Not decided yet. I'm checking feasibility of it.
Do you have plan to do it(trex-482)?

@hhaim
Copy link
Contributor

hhaim commented Mar 19, 2019

Not yet, I think there is a backlog of multi-profile support for ASTF and STL let's finish that and then look into more advance features.
I'm working on server side L2 scalable emulations, like IPv6 ND/MLDv2/ARP/IGMP so it would be easier/faster to add clients to ASTF/STL. We have tried to do it in Python side and Linux namespace, but I'm looking into more efficient ways to do the same in scalable way

@egwakim egwakim closed this as completed Mar 31, 2020
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