ethtool tool TAPI (tapi_ethtool)

Overview

Declarations for TAPI to handle ethtool tool. More…

// typedefs

typedef enum tapi_ethtool_cmd tapi_ethtool_cmd;
typedef struct tapi_ethtool_opt tapi_ethtool_opt;
typedef struct tapi_ethtool_if_props tapi_ethtool_if_props;
typedef struct tapi_ethtool_pause tapi_ethtool_pause;
typedef struct tapi_ethtool_ring tapi_ethtool_ring;
typedef struct tapi_ethtool_report tapi_ethtool_report;

// enums

enum tapi_ethtool_cmd;

// structs

struct tapi_ethtool_if_props;
struct tapi_ethtool_opt;
struct tapi_ethtool_pause;
struct tapi_ethtool_report;
struct tapi_ethtool_ring;

// global variables

const tapi_ethtool_opt tapi_ethtool_default_opt;
const tapi_ethtool_report tapi_ethtool_default_report;

// global functions

te_errno tapi_ethtool(tapi_job_factory_t* factory, const tapi_ethtool_opt* opt, tapi_ethtool_report* report);
te_errno tapi_ethtool_get_stat(tapi_ethtool_report* report, const char* name, long int* value);
void tapi_ethtool_destroy_report(tapi_ethtool_report* report);

// macros

#define TAPI_ETHTOOL_MAX_STR

Detailed Documentation

Declarations for TAPI to handle ethtool tool.

WARNING: do not use this TAPI unless you really need to check ethtool application itself. Normally configuration tree should be used to read and change network interface settings. It is strictly prohibited to use this TAPI for changing configuration.

Copyright (C) 2021-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef enum tapi_ethtool_cmd tapi_ethtool_cmd

Supported ethtool commands

typedef struct tapi_ethtool_opt tapi_ethtool_opt

Command line options for ethtool

typedef struct tapi_ethtool_if_props tapi_ethtool_if_props

Interface properties parsed in case of TAPI_ETHTOOL_CMD_NONE

typedef struct tapi_ethtool_pause tapi_ethtool_pause

Pause parameters parsed in case of TAPI_ETHTOOL_CMD_SHOW_PAUSE

typedef struct tapi_ethtool_ring tapi_ethtool_ring

Ring parameters parsed in case of TAPI_ETHTOOL_CMD_SHOW_RING

typedef struct tapi_ethtool_report tapi_ethtool_report

Structure for storing parsed data from ethtool output

Global Variables

const tapi_ethtool_opt tapi_ethtool_default_opt

Default options initializer

const tapi_ethtool_report tapi_ethtool_default_report

Default report initializer

Global Functions

te_errno tapi_ethtool(tapi_job_factory_t* factory, const tapi_ethtool_opt* opt, tapi_ethtool_report* report)

Run ethtool command, parse its output if required.

Parameters:

factory

Job factory

opt

Ethtool command options

report

If not NULL, parsed data from output will be saved here

Returns:

Status code.

te_errno tapi_ethtool_get_stat(tapi_ethtool_report* report, const char* name, long int* value)

Get a single statistic from parsed ethtool output.

Parameters:

report

Pointer to parsed data storage

name

Name of the statistic

value

Where to save parsed value

Returns:

Status code.

void tapi_ethtool_destroy_report(tapi_ethtool_report* report)

Release resources allocated for ethtool output data.

Parameters:

report

Structure storing parsed data

Macros

#define TAPI_ETHTOOL_MAX_STR

Maximum string length in ethtool output