The sample code demonstrates device (ethdev only) management at a multi-process environment. The user can attach/detach a device on primary process and see it is synced on secondary process automatically. How to start? ./hotplug_mp --proc-type=auto Command Line Example: >help >list /* attach a pci device */ > attach 0000:81:00.0 /* detach the pci device */ > detach 0000:81:00.0 /* attach a vdev af_packet device */ > attach net_af_packet,iface=eth0 /* detach the vdev af_packet device */ > detach net_af_packet Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
42 lines
750 B
C
42 lines
750 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2018 Intel Corporation
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <errno.h>
|
|
#include <termios.h>
|
|
#include <sys/queue.h>
|
|
|
|
#include <cmdline_rdline.h>
|
|
#include <cmdline_parse.h>
|
|
#include <cmdline_socket.h>
|
|
#include <cmdline.h>
|
|
|
|
#include <rte_memory.h>
|
|
#include <rte_eal.h>
|
|
#include <rte_debug.h>
|
|
|
|
#include "commands.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int ret;
|
|
struct cmdline *cl;
|
|
|
|
ret = rte_eal_init(argc, argv);
|
|
if (ret < 0)
|
|
rte_panic("Cannot init EAL\n");
|
|
|
|
cl = cmdline_stdin_new(main_ctx, "example> ");
|
|
if (cl == NULL)
|
|
rte_panic("Cannot create cmdline instance\n");
|
|
cmdline_interact(cl);
|
|
cmdline_stdin_exit(cl);
|
|
|
|
rte_eal_cleanup();
|
|
|
|
return 0;
|
|
}
|