Skip to content
Permalink
Browse files

net: eth: mgmt: Add remaining 802.1Qav parameter types

This are all the parameters defined by the standard (12.21.1).

Additionally the parameters that are read-only are validated in the
ethernet_set_config callback.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
  • Loading branch information...
tgorochowik authored and jukkar committed Aug 1, 2018
1 parent aed075e commit b6852e5a3ad3af925118ead47fa8b579f1ee420a
Showing with 32 additions and 1 deletion.
  1. +6 −0 include/net/ethernet.h
  2. +26 −1 subsys/net/l2/ethernet/ethernet_mgmt.c
@@ -103,6 +103,8 @@ enum ethernet_config_type {
enum ethernet_qav_param_type {
ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
ETHERNET_QAV_PARAM_TYPE_STATUS,
};

@@ -118,6 +120,10 @@ struct ethernet_qav_param {
unsigned int delta_bandwidth;
/** Idle Slope (bits per second) */
unsigned int idle_slope;
/** Oper Idle Slope (bits per second) */
unsigned int oper_idle_slope;
/** Traffic class the queue is bound to */
unsigned int traffic_class;
};
};

@@ -105,6 +105,10 @@ static int ethernet_set_config(u32_t mgmt_request,
return -EINVAL;
}
break;
case ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE:
case ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS:
/* Read-only parameters */
return -EINVAL;
default:
/* No validation needed */
break;
@@ -192,7 +196,28 @@ static int ethernet_get_config(u32_t mgmt_request,
return ret;
}

params->qav_param.enabled = config.qav_param.enabled;
switch (config.qav_param.type) {
case ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH:
params->qav_param.delta_bandwidth =
config.qav_param.delta_bandwidth;
break;
case ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE:
params->qav_param.idle_slope =
config.qav_param.idle_slope;
break;
case ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE:
params->qav_param.oper_idle_slope =
config.qav_param.oper_idle_slope;
break;
case ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS:
params->qav_param.traffic_class =
config.qav_param.traffic_class;
break;
case ETHERNET_QAV_PARAM_TYPE_STATUS:
params->qav_param.enabled = config.qav_param.enabled;
break;
}

} else {
return -EINVAL;
}

0 comments on commit b6852e5

Please sign in to comment.
You can’t perform that action at this time.