traffic_mirror增加配置项app_symbol
This commit is contained in:
@@ -109,8 +109,8 @@ struct traffic_mirror_rebuild_target
|
||||
};
|
||||
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_pcap_create(const char * str_ethdev, void * logger);
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_mr4_create(const char * str_ethdev,
|
||||
unsigned int nr_threads, void * logger);
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_mr4_create(const char * str_ethdev,
|
||||
const char * str_app_name, unsigned int nr_threads, void * logger);
|
||||
|
||||
void traffic_mirror_ethdev_destroy(struct traffic_mirror_ethdev * ethdev);
|
||||
int traffic_mirror_ethdev_finish(struct traffic_mirror_ethdev * ethdev, unsigned int tid, unsigned int pktlen);
|
||||
|
||||
@@ -390,6 +390,7 @@ error_out:
|
||||
static int traffic_mirror_ethdev_init(struct traffic_mirror_instance * instance)
|
||||
{
|
||||
char str_ethdev[TFE_SYMBOL_MAX] = {0};
|
||||
char app_symbol[TFE_SYMBOL_MAX] = {0};
|
||||
const char * profile = "./conf/tfe/tfe.conf";
|
||||
|
||||
int ret = MESA_load_profile_string_nodef(profile, "traffic_mirror", "device",
|
||||
@@ -407,14 +408,22 @@ static int traffic_mirror_ethdev_init(struct traffic_mirror_instance * instance)
|
||||
unsigned int device_type;
|
||||
MESA_load_profile_uint_def(profile, "traffic_mirror", "type", &device_type, TRAFFIC_MIRROR_ETHDEV_AF_PACKET);
|
||||
|
||||
ret = MESA_load_profile_string_nodef(profile, "traffic_mirror", "app_symbol", app_symbol, sizeof(app_symbol));
|
||||
if (ret < 0)
|
||||
{
|
||||
TFE_LOG_ERROR(instance->logger, "failed at reading conffile, "
|
||||
"[traffic_mirror]app_symbol is not defined.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (device_type == TRAFFIC_MIRROR_ETHDEV_AF_PACKET)
|
||||
{
|
||||
instance->ethdev = traffic_mirror_ethdev_pcap_create(str_ethdev, instance->logger);
|
||||
}
|
||||
else if(device_type == TRAFFIC_MIRROR_ETHDEV_MARSIO)
|
||||
{
|
||||
instance->ethdev = traffic_mirror_ethdev_mr4_create(str_ethdev,
|
||||
tfe_proxy_get_work_thread_count(), instance->logger);
|
||||
instance->ethdev = traffic_mirror_ethdev_mr4_create(str_ethdev,
|
||||
app_symbol, tfe_proxy_get_work_thread_count(), instance->logger);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -134,8 +134,8 @@ char * traffic_mirror_ethdev_send_prepare(struct traffic_mirror_ethdev * ethdev,
|
||||
|
||||
/* =============================== VIRTUAL INTERFACE END =========================================== */
|
||||
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_mr4_create(const char * str_ethdev,
|
||||
unsigned int nr_threads, void * logger)
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_mr4_create(const char * str_ethdev,
|
||||
const char * str_app_name, unsigned int nr_threads, void * logger)
|
||||
{
|
||||
struct traffic_mirror_ethdev * ethdev = ALLOC(struct traffic_mirror_ethdev, 1);
|
||||
ethdev->type = TRAFFIC_MIRROR_ETHDEV_MARSIO;
|
||||
@@ -152,7 +152,7 @@ struct traffic_mirror_ethdev * traffic_mirror_ethdev_mr4_create(const char * str
|
||||
detail_mr4->instance = marsio_create();
|
||||
assert(detail_mr4->instance != NULL);
|
||||
|
||||
if (marsio_init(detail_mr4->instance, "tfe-traffic-mirror") < 0)
|
||||
if (marsio_init(detail_mr4->instance, str_app_name) < 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "failed at init MARSIOv4 instance.");
|
||||
goto errout;
|
||||
|
||||
Reference in New Issue
Block a user